(self, M, S, h=None, mgf=None, sLen=None)
return Result
Implements RSASSA-PSS-VERIFY() function described in Sect 8.1.2
        of RFC 3447

        Input:
           M: message whose signature is to be verified
           S: signature to be verified, an octet string of length k, where k
              is the length in octets of the RSA modulus n.

        Output:
           True is the signature is valid. False otherwise.
Implements RSASSA-PSS-VERIFY() function described in Sect 8.1.2
        of RFC 3447
Implements RSASSA - PSS - VERIFY () function described in Sect 8 . 1 . 2 of RFC 3447
def _rsassa_pss_verify(self, M, S, h=None, mgf=None, sLen=None):
        """
        Implements RSASSA-PSS-VERIFY() function described in Sect 8.1.2
        of RFC 3447

        Input:
           M: message whose signature is to be verified
           S: signature to be verified, an octet string of length k, where k
              is the length in octets of the RSA modulus n.

        Output:
           True is the signature is valid. False otherwise.
        """

        # Set default parameters if not provided
        if h is None: # By default, sha1
            h = "sha1"
        if not _hashFuncParams.has_key(h):
            warning("Key._rsassa_pss_verify(): unknown hash function "
                    "provided (%s)" % h)
            return False
        if mgf is None: # use mgf1 with underlying hash function
            mgf = lambda x,y: pkcs_mgf1(x, y, h)
        if sLen is None: # use Hash output length (A.2.3 of RFC 3447)
            hLen = _hashFuncParams[h][0]
            sLen = hLen

        # 1) Length checking
        modBits = self.modulusLen
        k = modBits / 8
        if len(S) != k:
            return False

        # 2) RSA verification
        s = pkcs_os2ip(S)                           # 2.a)
        m = self._rsavp1(s)                         # 2.b)
        emLen = math.ceil((modBits - 1) / 8.)       # 2.c)
        EM = pkcs_i2osp(m, emLen) 

        # 3) EMSA-PSS verification
        Result = pkcs_emsa_pss_verify(M, EM, modBits - 1, h, mgf, sLen)

        return Result
def _rsassa_pss_verify ( self , M , S , h = None , mgf = None , sLen = None ) : # Set default parameters if not provided if h is None : # By default, sha1 h = "sha1" if not _hashFuncParams . has_key ( h ) : warning ( "Key._rsassa_pss_verify(): unknown hash function " "provided (%s)" % h ) return False if mgf is None : # use mgf1 with underlying hash function mgf = lambda x , y : pkcs_mgf1 ( x , y , h ) if sLen is None : # use Hash output length (A.2.3 of RFC 3447) hLen = _hashFuncParams [ h ] [ 0 ] sLen = hLen # 1) Length checking modBits = self . modulusLen k = modBits / 8 if len ( S ) != k : return False # 2) RSA verification s = pkcs_os2ip ( S ) # 2.a) m = self . _rsavp1 ( s ) # 2.b) emLen = math . ceil ( ( modBits - 1 ) / 8. ) # 2.c) EM = pkcs_i2osp ( m , emLen ) # 3) EMSA-PSS verification Result = pkcs_emsa_pss_verify ( M , EM , modBits - 1 , h , mgf , sLen ) return Result