Package Crypto :: Package Signature :: Module PKCS1_v1_5 :: Class PKCS115_SigScheme
[frames] | no frames]

Class PKCS115_SigScheme

This signature scheme can perform PKCS#1 v1.5 RSA signature or verification.
Instance Methods
 
__init__(self, key)
Initialize this PKCS#1 v1.5 signature scheme object.
 
can_sign(self)
Return True if this cipher object can be used for signing messages.
 
sign(self, mhash)
Produce the PKCS#1 v1.5 signature of a message.
 
verify(self, mhash, S)
Verify that a certain PKCS#1 v1.5 signature is authentic.
Method Details

__init__(self, key)
(Constructor)

 
Initialize this PKCS#1 v1.5 signature scheme object.
Parameters:
  • key (an RSA key object) - If a private half is given, both signature and verification are possible. If a public half is given, only verification is possible.

sign(self, mhash)

 

Produce the PKCS#1 v1.5 signature of a message.

This function is named RSASSA-PKCS1-V1_5-SIGN, and is specified in section 8.2.1 of RFC3447.

Parameters:
  • mhash (hash object) - The hash that was carried out over the message. This is an object belonging to the Crypto.Hash module.
Returns:
The signature encoded as a string.
Raises:
  • ValueError - If the RSA key length is not sufficiently long to deal with the given hash algorithm.
  • TypeError - If the RSA key has no private half.

verify(self, mhash, S)

 

Verify that a certain PKCS#1 v1.5 signature is authentic.

This function checks if the party holding the private half of the key really signed the message.

This function is named RSASSA-PKCS1-V1_5-VERIFY, and is specified in section 8.2.2 of RFC3447.

Parameters:
  • mhash (hash object) - The hash that was carried out over the message. This is an object belonging to the Crypto.Hash module.
  • S (string) - The signature that needs to be validated.
Returns:
True if verification is correct. False otherwise.