cryptography#

Note

See the Glossary for the meaning of the acronyms used in this guide.

common#

load_payload(filepath: str) bytes[source]#

Load the payload contents

keygen#

generate_rsa_key_pair(public_exponent: int = 65537, key_size: int = 4096) Tuple[RSAPrivateKeyWithSerialization, RSAPublicKey][source]#

Generate a public/private key pair using the RSA algorithm

save_private_key(private_key: RSAPrivateKeyWithSerialization, filepath: str)[source]#

Save the private RSA key to a file

save_public_key(public_key: RSAPublicKey, filepath: str)[source]#

Save the public RSA key to a file

sign#

load_private_key(filepath: str) RSAPrivateKeyWithSerialization[source]#

Load the private RSA key from a file

sign_payload(payload: bytes, private_key: RSAPrivateKeyWithSerialization, filepath: str) bytes[source]#

Sign the payload

verify#

load_public_key(filepath: str) RSAPublicKey[source]#

Load the public RSA key from a file

load_signature(filepath: str) bytes[source]#

Load the signature

verify_payload(payload: bytes, signature: bytes, public_key: RSAPublicKey) bool[source]#

Verify the payload signature