A tuple with two items. The first item is the ciphertext
of the same type as the plaintext (string or long). The second item
is always None.

Overrides:
pubkey.pubkey.encrypt

Attention:
this function performs the plain, primitive RSA encryption
(textbook). In real applications, you always need to use proper
cryptographic padding, and you should not directly encrypt data with
this method. Failure to do so may lead to security vulnerabilities.
It is recommended to use modules
Crypto.Cipher.PKCS1_OAEP or Crypto.Cipher.PKCS1_v1_5 instead.

decrypt(self,
ciphertext)

Decrypt a piece of data with RSA.

Decryption always takes place with blinding.

Parameters:

ciphertext (byte string, long or a 2-item tuple as returned by
encrypt) - The piece of data to decrypt with RSA. It may
not be numerically larger than the RSA module (n). If a tuple,
the first item is the actual ciphertext; the second item is ignored.

Returns:

A byte string if ciphertext was a byte string or a tuple
of byte strings. A long otherwise.

Overrides:
pubkey.pubkey.decrypt

Attention:
this function performs the plain, primitive RSA decryption
(textbook). In real applications, you always need to use proper
cryptographic padding, and you should not directly decrypt data with
this method. Failure to do so may lead to security vulnerabilities.
It is recommended to use modules
Crypto.Cipher.PKCS1_OAEP or Crypto.Cipher.PKCS1_v1_5 instead.

sign(self,
M,
K)

Sign a piece of data with RSA.

Signing always takes place with blinding.

Parameters:

M (byte string or long) - The piece of data to sign with RSA. It may
not be numerically larger than the RSA module (n).

A 2-item tuple. The first item is the actual signature (a
long). The second item is always None.

Overrides:
pubkey.pubkey.sign

Attention:
this function performs the plain, primitive RSA decryption
(textbook). In real applications, you always need to use proper
cryptographic padding, and you should not directly sign data with
this method. Failure to do so may lead to security vulnerabilities.
It is recommended to use modules
Crypto.Signature.PKCS1_PSS or Crypto.Signature.PKCS1_v1_5 instead.

verify(self,
M,
signature)

Verify the validity of an RSA signature.

Parameters:

M (byte string or long) - The expected message.

signature (A 2-item tuple as return by sign) - The RSA signature to verify. The first item of
the tuple is the actual signature (a long not larger than the modulus
n), whereas the second item is always ignored.

Returns:

True if the signature is correct, False otherwise.

Overrides:
pubkey.pubkey.verify

Attention:
this function performs the plain, primitive RSA encryption
(textbook). In real applications, you always need to use proper
cryptographic padding, and you should not directly verify data with
this method. Failure to do so may lead to security vulnerabilities.
It is recommended to use modules
Crypto.Signature.PKCS1_PSS or Crypto.Signature.PKCS1_v1_5 instead.

has_private(self)

Tell if the key object contains private components.

Returns:

bool

Overrides:
pubkey.pubkey.has_private

(inherited documentation)

size(self)

Tell the maximum number of bits that can be handled by this key.

Returns:

int

Overrides:
pubkey.pubkey.size

(inherited documentation)

can_blind(self)

Tell if the algorithm can deal with data blinding.

This property concerns the algorithm, not the key itself.
It may happen that this particular key object hasn't got
the private information required carry out blinding.

Returns:

boolean

Overrides:
pubkey.pubkey.can_blind

(inherited documentation)

can_encrypt(self)

Tell if the algorithm can deal with data encryption.

This property concerns the algorithm, not the key itself.
It may happen that this particular key object hasn't got
the private information required to decrypt data.

Returns:

boolean

Overrides:
pubkey.pubkey.can_encrypt

(inherited documentation)

can_sign(self)

Tell if the algorithm can deal with cryptographic signatures.

This property concerns the algorithm, not the key itself.
It may happen that this particular key object hasn't got
the private information required to generate a signature.