💾 Archived View for tris.fyi › pydoc › cryptography.hazmat.primitives.asymmetric.rsa captured on 2022-04-28 at 17:43:55. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-03-01)

➡️ Next capture (2022-07-16)

🚧 View Differences

-=-=-=-=-=-=-

Back to module index

Go to module by name

cryptography.hazmat.primitives.asymmetric

cryptography.hazmat.primitives

cryptography.hazmat

cryptography

cryptography.hazmat.primitives.asymmetric.rsa

This module has no docstring.

Classes

AsymmetricPadding

name = <abc.abstractproperty object at 0x7ff35ff919a0>

          A string naming this padding (e.g. "PSS", "PKCS1").
        

AsymmetricSignatureContext

finalize(self)


          Returns the signature as bytes.
        
update(self, data)


          Processes the provided bytes and returns nothing.
        

AsymmetricVerificationContext

update(self, data)


          Processes the provided bytes and returns nothing.
        
verify(self)


          Raises an exception if the bytes provided to update do not match the
          signature or the signature does not match the public key.
        

RSABackend

generate_rsa_parameters_supported(self, public_exponent, key_size)


          Returns True if the backend supports the given parameters for key
          generation.
        
generate_rsa_private_key(self, public_exponent, key_size)


          Generate an RSAPrivateKey instance with public_exponent and a modulus
          of key_size bits.
        
load_rsa_private_numbers(self, numbers)


          Returns an RSAPrivateKey provider.
        
load_rsa_public_numbers(self, numbers)


          Returns an RSAPublicKey provider.
        
rsa_padding_supported(self, padding)


          Returns True if the backend supports the given padding options.
        

RSAPrivateKey

decrypt(self, ciphertext: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding) -> bytes


          Decrypts the provided ciphertext.
        
private_bytes(self, encoding: cryptography.hazmat.primitives._serialization.Encoding, format: cryptography.hazmat.primitives._serialization.PrivateFormat, encryption_algorithm: cryptography.hazmat.primitives._serialization.KeySerializationEncryption) -> bytes


          Returns the key serialized as bytes.
        
private_numbers(self) -> 'RSAPrivateNumbers'


          Returns an RSAPrivateNumbers.
        
public_key(self) -> 'RSAPublicKey'


          The RSAPublicKey associated with this private key.
        
sign(self, data: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: Union[cryptography.hazmat.primitives.asymmetric.utils.Prehashed, cryptography.hazmat.primitives.hashes.HashAlgorithm]) -> bytes


          Signs the data.
        
signer(self, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm) -> cryptography.hazmat.primitives.asymmetric.AsymmetricSignatureContext


          Returns an AsymmetricSignatureContext used for signing data.
        
key_size = <abc.abstractproperty object at 0x7ff35ff91a00>

          The bit length of the public modulus.
        

RSAPrivateKey

decrypt(self, ciphertext: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding) -> bytes


          Decrypts the provided ciphertext.
        
private_bytes(self, encoding: cryptography.hazmat.primitives._serialization.Encoding, format: cryptography.hazmat.primitives._serialization.PrivateFormat, encryption_algorithm: cryptography.hazmat.primitives._serialization.KeySerializationEncryption) -> bytes


          Returns the key serialized as bytes.
        
private_numbers(self) -> 'RSAPrivateNumbers'


          Returns an RSAPrivateNumbers.
        
public_key(self) -> 'RSAPublicKey'


          The RSAPublicKey associated with this private key.
        
sign(self, data: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: Union[cryptography.hazmat.primitives.asymmetric.utils.Prehashed, cryptography.hazmat.primitives.hashes.HashAlgorithm]) -> bytes


          Signs the data.
        
signer(self, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm) -> cryptography.hazmat.primitives.asymmetric.AsymmetricSignatureContext


          Returns an AsymmetricSignatureContext used for signing data.
        
key_size = <abc.abstractproperty object at 0x7ff35ff91a00>

          The bit length of the public modulus.
        

RSAPrivateNumbers

private_key(self, backend=None) -> cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey
d = <property object at 0x7ff35ff96680>
dmp1 = <property object at 0x7ff35ff966d0>
dmq1 = <property object at 0x7ff35ff96720>
iqmp = <property object at 0x7ff35ff96770>
p = <property object at 0x7ff35ff963b0>
public_numbers = <property object at 0x7ff35ff967c0>
q = <property object at 0x7ff35ff964f0>

RSAPublicKey

encrypt(self, plaintext: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding) -> bytes


          Encrypts the given plaintext.
        
public_bytes(self, encoding: cryptography.hazmat.primitives._serialization.Encoding, format: cryptography.hazmat.primitives._serialization.PublicFormat) -> bytes


          Returns the key serialized as bytes.
        
public_numbers(self) -> 'RSAPublicNumbers'


          Returns an RSAPublicNumbers
        
recover_data_from_signature(self, signature: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: Optional[cryptography.hazmat.primitives.hashes.HashAlgorithm]) -> bytes


          Recovers the original data from the signature.
        
verifier(self, signature: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm) -> cryptography.hazmat.primitives.asymmetric.AsymmetricVerificationContext


          Returns an AsymmetricVerificationContext used for verifying signatures.
        
verify(self, signature: bytes, data: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: Union[cryptography.hazmat.primitives.asymmetric.utils.Prehashed, cryptography.hazmat.primitives.hashes.HashAlgorithm]) -> None


          Verifies the signature of the data.
        
key_size = <abc.abstractproperty object at 0x7ff35ff91a60>

          The bit length of the public modulus.
        

RSAPublicKey

encrypt(self, plaintext: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding) -> bytes


          Encrypts the given plaintext.
        
public_bytes(self, encoding: cryptography.hazmat.primitives._serialization.Encoding, format: cryptography.hazmat.primitives._serialization.PublicFormat) -> bytes


          Returns the key serialized as bytes.
        
public_numbers(self) -> 'RSAPublicNumbers'


          Returns an RSAPublicNumbers
        
recover_data_from_signature(self, signature: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: Optional[cryptography.hazmat.primitives.hashes.HashAlgorithm]) -> bytes


          Recovers the original data from the signature.
        
verifier(self, signature: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: cryptography.hazmat.primitives.hashes.HashAlgorithm) -> cryptography.hazmat.primitives.asymmetric.AsymmetricVerificationContext


          Returns an AsymmetricVerificationContext used for verifying signatures.
        
verify(self, signature: bytes, data: bytes, padding: cryptography.hazmat.primitives._asymmetric.AsymmetricPadding, algorithm: Union[cryptography.hazmat.primitives.asymmetric.utils.Prehashed, cryptography.hazmat.primitives.hashes.HashAlgorithm]) -> None


          Verifies the signature of the data.
        
key_size = <abc.abstractproperty object at 0x7ff35ff91a60>

          The bit length of the public modulus.
        

RSAPublicNumbers

public_key(self, backend=None) -> cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey
e = <property object at 0x7ff35ff96860>
n = <property object at 0x7ff35ff968b0>

UnsupportedAlgorithm

with_traceback(...)

  Exception.with_traceback(tb) --
      set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>

Functions

gcd

gcd(*integers)

  Greatest Common Divisor.

generate_private_key

generate_private_key(public_exponent: int, key_size: int, backend=None) -> cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey

rsa_crt_dmp1

rsa_crt_dmp1(private_exponent: int, p: int) -> int


      Compute the CRT private_exponent % (p - 1) value from the RSA
      private_exponent (d) and p.
    

rsa_crt_dmq1

rsa_crt_dmq1(private_exponent: int, q: int) -> int


      Compute the CRT private_exponent % (q - 1) value from the RSA
      private_exponent (d) and q.
    

rsa_crt_iqmp

rsa_crt_iqmp(p: int, q: int) -> int


      Compute the CRT (q ** -1) % p value from RSA primes p and q.
    

rsa_recover_prime_factors

rsa_recover_prime_factors(n: int, e: int, d: int) -> Tuple[int, int]


      Compute factors p and q from the private exponent d. We assume that n has
      no more than two factors. This function is adapted from code in PyCrypto.
    

Other members

utils = <cryptography.utils._ModuleWithDeprecations object at 0x7ff35ffbbb20>

Modules

abc

asym_utils

hashes

typing