ConsoleUser

Copyright (c) 2010-2023 Skaion Corporarion, www.skaion.com

This project was developed in part by numerous sponsorships from the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints of Governmental purposes notwithstanding any copyright notation thereon.

All content reflects those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government or Skaion Corporation.

class EncryptionImpl.EncryptionImpl(system, config)

I provide a common interface for <no title> objects to interact with to encrypt and decrypt files, regardless of the underlying application providing that capability.

Parameters:

  • system: a <no title> object to interact with the target host on

  • config: a <no title> object defining this user

decrypt(passwd, path, out_path=None)

Decrypt the file at a given path, optionally writing to the specific path instead of accepting the default location to write.

Parameters:

  • passwd: the password/phrase to decrypt the file with

  • path: the location of the source file, as a string

  • out_path: optionally a string saying where to write the decrypted file

Return: True if the decryption succeeded, False otherwise

decrypt_with_key(key_path, source_path, out_path=None)

Decrypt the file at a given path, optionally writing to the specific path instead of accepting the default location to write.

Parameters:

  • key_path: the key file to use to decrypt the source file

  • source_path: the location of the source file, as a string

  • out_path: optionally a string saying where to write the decrypted file

Return: True if the decryption succeeded, False otherwise

encrypt(passwd, path, out_path=None)

Encrypt the file at a given path, optionally writing to the specific path instead of accepting the default location to write.

Parameters:

  • passwd: the password/phrase to encrypt the file with

  • path: the location of the source file, as a string

  • out_path: optionally a string saying where to write the encrypted file

Return: True if the encryption succeeded, False otherwise

encrypt_with_key(key_path, source_path, out_path=None)

Encrypt the file at a given path, optionally writing to the specific path instead of accepting the default location to write.

Parameters:

  • key_path: the key file to use to encrypt the source file

  • path: the location of the source file, as a string

  • out_path: optionally a string saying where to write the encrypted file

Return: True if the encryption succeeded, False otherwise

EncryptionImpl.get_encryptor(system, config, e_type=None)

This is the Factory_ method that creates an instance of the appropriate subclass of EncryptionImpl to drive a specific application on a given platform.

Parameters:

  • system: a <no title> object to interact with the target host on

  • config: a <no title> object defining this user

  • e_type: optionally a string specifying the type of encryption application to use regardless of what it says in config

Return: The appropriate instance ready to use, or None if no suitable class can be found