#NEWLINE# def verify( self , mhash , S ) : #NEWLINE# #INDENT# 'Verify that a certain PKCS#1 PSS signature is authentic.\n    \n        This function checks if the party holding the private half of the given\n        RSA key has really signed the message.\n    \n        This function is called ``RSASSA-PSS-VERIFY``, and is specified in section\n        8.1.2 of RFC3447.\n    \n        :Parameters:\n         mhash : hash object\n                The hash that was carried out over the message. This is an object\n                belonging to the `Crypto.Hash` module.\n         S : string\n                The signature that needs to be validated.\n    \n        :Return: True if verification is correct. False otherwise.\n        ' #NEWLINE# if ( self . _saltLen == None ) : #NEWLINE# #INDENT# sLen = mhash . digest_size #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sLen = self . _saltLen #NEWLINE# #UNINDENT# if self . _mgfunc : #NEWLINE# #INDENT# mgf = self . _mgfunc #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mgf = ( lambda x , y : MGF1 ( x , y , mhash ) ) #NEWLINE# #UNINDENT# modBits = Crypto . Util . number . size ( self . _key . n ) #NEWLINE# k = ceil_div ( modBits , 8 ) #NEWLINE# if ( len ( S ) != k ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# em = self . _key . encrypt ( S , 0 ) [ 0 ] #NEWLINE# emLen = ceil_div ( ( modBits - 1 ) , 8 ) #NEWLINE# em = ( ( bchr ( 0 ) * ( emLen - len ( em ) ) ) + em ) #NEWLINE# try : #NEWLINE# #INDENT# result = EMSA_PSS_VERIFY ( mhash , em , ( modBits - 1 ) , mgf , sLen ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# return result