(self, M, S, h)
return EM == EMPrime
Implements RSASSA-PKCS1-v1_5-VERIFY() function as described in
        Sect. 8.2.2 of RFC 3447.

        Input:
           M: message whose signature is to be verified, an octet string
           S: signature to be verified, an octet string of length k, where
              k is the length in octets of the RSA modulus n
           h: hash function name (in 'md2', 'md4', 'md5', 'sha1', 'tls',
                'sha256', 'sha384').
           
        Output:
           True if the signature is valid. False otherwise.
Implements RSASSA-PKCS1-v1_5-VERIFY() function as described in
        Sect. 8.2.2 of RFC 3447.
Implements RSASSA - PKCS1 - v1_5 - VERIFY () function as described in Sect . 8 . 2 . 2 of RFC 3447 .
def _rsassa_pkcs1_v1_5_verify(self, M, S, h):
        """
        Implements RSASSA-PKCS1-v1_5-VERIFY() function as described in
        Sect. 8.2.2 of RFC 3447.

        Input:
           M: message whose signature is to be verified, an octet string
           S: signature to be verified, an octet string of length k, where
              k is the length in octets of the RSA modulus n
           h: hash function name (in 'md2', 'md4', 'md5', 'sha1', 'tls',
                'sha256', 'sha384').
           
        Output:
           True if the signature is valid. False otherwise.
        """

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

        # 2) RSA verification
        s = pkcs_os2ip(S)                           # 2.a)
        m = self._rsavp1(s)                         # 2.b)
        EM = pkcs_i2osp(m, k)                       # 2.c)

        # 3) EMSA-PKCS1-v1_5 encoding
        EMPrime = pkcs_emsa_pkcs1_v1_5_encode(M, k, h)
        if EMPrime is None:
            warning("Key._rsassa_pkcs1_v1_5_verify(): unable to encode.")
            return False

        # 4) Comparison
        return EM == EMPrime
def _rsassa_pkcs1_v1_5_verify ( self , M , S , h ) : # 1) Length checking k = self . modulusLen / 8 if len ( S ) != k : warning ( "invalid signature (len(S) != k)" ) return False # 2) RSA verification s = pkcs_os2ip ( S ) # 2.a) m = self . _rsavp1 ( s ) # 2.b) EM = pkcs_i2osp ( m , k ) # 2.c) # 3) EMSA-PKCS1-v1_5 encoding EMPrime = pkcs_emsa_pkcs1_v1_5_encode ( M , k , h ) if EMPrime is None : warning ( "Key._rsassa_pkcs1_v1_5_verify(): unable to encode." ) return False # 4) Comparison return EM == EMPrime