RSA Asymmetric Cipher¶
Interface to RSA cipher and signature algorithm
- pyflocker.ciphers.interfaces.RSA.generate(bits: int, e: int = 65537, *, backend: Backends | None = None) BaseRSAPrivateKey [source]¶
Generate a private key with given key modulus
bits
and public exponente
(default 65537). Recommended size ofbits
> 1024.- Parameters:
bits – The bit length of the RSA key.
e – The public exponent value. Default is 65537.
- Keyword Arguments:
backend – The backend to use. It must be a value from
Backends
.- Returns:
The RSA private key.
- pyflocker.ciphers.interfaces.RSA.load_public_key(data: bytes, *, backend: Backends | None = None) BaseRSAPublicKey [source]¶
Loads the public key and returns a Key interface.
- Parameters:
data – The public key (a bytes-like object) to deserialize.
- Keyword Arguments:
backend – The backend to use. It must be a value from
Backends
.- Returns:
The RSA public key.
- pyflocker.ciphers.interfaces.RSA.load_private_key(data: bytes, passphrase: bytes | None = None, *, backend: Backends | None = None) BaseRSAPrivateKey [source]¶
Loads the private key and returns a Key interface.
If the private key was not encrypted duting the serialization, passphrase must be None, otherwise it must be a bytes object.
- Parameters:
data – The private key (a bytes-like object) to deserialize.
passphrase – The passphrase that was used to encrypt the private key.
None
if the private key was not encrypted.
- Keyword Arguments:
backend – The backend to use. It must be a value from
Backends
.- Returns:
The RSA private key.