modos.genomics.c4gh#
crypt4gh implementation
Crypt4gh allows envelop encryption of genomic files. See [1] for more details.
Here we use the crypt4gh python [2] implementation to allow de/encryption of genomic files within modos.
References
Functions#
|
Get the secret key for encryption/decryption. |
|
Retrieves recipient public keys and builds a collection of "key tuples". |
|
Encrypt a file using the crypt4gh algorithm (authenticated encryption). |
|
Module Contents#
- modos.genomics.c4gh.get_secret_key(seckey_path=None, passphrase=None)[source]#
Get the secret key for encryption/decryption. If no secret key path is provided a new secret key will be generated automatically. This can be used to allow authicated encryption without prior key generation.
- Parameters:
seckey_path (Optional[os.PathLike]) – Path to the secret key.
passphrase (Optional[str]) – Passphrase for the secret key.
- Return type:
- modos.genomics.c4gh.get_keys(recipient_pubkeys, seckey)[source]#
Retrieves recipient public keys and builds a collection of “key tuples”.
- Parameters:
recipient_pubkeys (List[os.PathLike] | os.PathLike) – Path to the recipient public key, or list of paths if multiple recipients.
seckey (bytes) – Secret key of the sender.
- Returns:
Set of key triplets, one for each recipient.
- Return type:
{(method, seckey, recipient_pubkey)}
- modos.genomics.c4gh.encrypt_file(recipient_pubkeys, infile, outfile, seckey_path=None, passphrase=None)[source]#
Encrypt a file using the crypt4gh algorithm (authenticated encryption).
- Parameters:
recipient_pubkeys (List[os.PathLike] | os.PathLike)
infile (pathlib.Path | str)
outfile (pathlib.Path | str)
seckey_path (Optional[os.PathLike])
passphrase (Optional[str])
- modos.genomics.c4gh.decrypt_file(seckey_path, infile, outfile, sender_pubkey=None, passphrase=None)[source]#
- Parameters:
seckey_path (os.PathLike)
infile (pathlib.Path | str)
outfile (pathlib.Path | str)
sender_pubkey (Optional[os.PathLike])
passphrase (Optional[str])