_encryptFile(sourcePath,
encryptMode,
encryptTarget,
backupUser,
backupGroup,
removeSource=True)
| source code
|
Encrypts the source file using the indicated mode.
The encrypted file will be owned by the indicated backup user and
group. If removeSource is True, then the
source file will be removed after it is successfully encrypted.
Currently, only the "gpg" encrypt mode is
supported.
- Parameters:
sourcePath - Absolute path of the source file to encrypt
encryptMode - Encryption mode (only "gpg" is allowed)
encryptTarget - Encryption target (GPG recipient)
backupUser - User that target files should be owned by
backupGroup - Group that target files should be owned by
removeSource - Indicates whether to remove the source file
- Returns:
- Path to the newly-created encrypted file.
- Raises:
ValueError - If an invalid encrypt mode is passed in.
IOError - If there is a problem accessing, encrypting or removing the
source file.
|