(self, C)
return M
Implements RSAES-PKCS1-V1_5-DECRYPT() function described in section
        7.2.2 of RFC 3447.

        Input:
           C: ciphertext to be decrypted, an octet string of length k, where
              k is the length in octets of the RSA modulus n.

        Output:
           an octet string of length k at most k - 11

        on error, None is returned.
Implements RSAES-PKCS1-V1_5-DECRYPT() function described in section
        7.2.2 of RFC 3447.
Implements RSAES - PKCS1 - V1_5 - DECRYPT () function described in section 7 . 2 . 2 of RFC 3447 .
def _rsaes_pkcs1_v1_5_decrypt(self, C):
        """
        Implements RSAES-PKCS1-V1_5-DECRYPT() function described in section
        7.2.2 of RFC 3447.

        Input:
           C: ciphertext to be decrypted, an octet string of length k, where
              k is the length in octets of the RSA modulus n.

        Output:
           an octet string of length k at most k - 11

        on error, None is returned.
        """
        
        # 1) Length checking
        cLen = len(C)
        k = self.modulusLen / 8
        if cLen != k or k < 11:
            warning("Key._rsaes_pkcs1_v1_5_decrypt() decryption error "
                    "(cLen != k or k < 11)")
            return None

        # 2) RSA decryption
        c = pkcs_os2ip(C)                           # 2.a)
        m = self._rsadp(c)                          # 2.b)
        EM = pkcs_i2osp(m, k)                       # 2.c)

        # 3) EME-PKCS1-v1_5 decoding

        # I am aware of the note at the end of 7.2.2 regarding error
        # conditions reporting but the one provided below are for _local_
        # debugging purposes. --arno
        
        if EM[0] != '\x00':
            warning("Key._rsaes_pkcs1_v1_5_decrypt(): decryption error "
                    "(first byte is not 0x00)")
            return None

        if EM[1] != '\x02':
            warning("Key._rsaes_pkcs1_v1_5_decrypt(): decryption error "
                    "(second byte is not 0x02)")
            return None

        tmp = EM[2:].split('\x00', 1)
        if len(tmp) != 2:
            warning("Key._rsaes_pkcs1_v1_5_decrypt(): decryption error "
                    "(no 0x00 to separate PS from M)")
            return None

        PS, M = tmp
        if len(PS) < 8:
            warning("Key._rsaes_pkcs1_v1_5_decrypt(): decryption error "
                    "(PS is less than 8 byte long)")
            return None

        return M
def _rsaes_pkcs1_v1_5_decrypt ( self , C ) : # 1) Length checking cLen = len ( C ) k = self . modulusLen / 8 if cLen != k or k < 11 : warning ( "Key._rsaes_pkcs1_v1_5_decrypt() decryption error " "(cLen != k or k < 11)" ) return None # 2) RSA decryption c = pkcs_os2ip ( C ) # 2.a) m = self . _rsadp ( c ) # 2.b) EM = pkcs_i2osp ( m , k ) # 2.c) # 3) EME-PKCS1-v1_5 decoding # I am aware of the note at the end of 7.2.2 regarding error # conditions reporting but the one provided below are for _local_ # debugging purposes. --arno if EM [ 0 ] != '\x00' : warning ( "Key._rsaes_pkcs1_v1_5_decrypt(): decryption error " "(first byte is not 0x00)" ) return None if EM [ 1 ] != '\x02' : warning ( "Key._rsaes_pkcs1_v1_5_decrypt(): decryption error " "(second byte is not 0x02)" ) return None tmp = EM [ 2 : ] . split ( '\x00' , 1 ) if len ( tmp ) != 2 : warning ( "Key._rsaes_pkcs1_v1_5_decrypt(): decryption error " "(no 0x00 to separate PS from M)" ) return None PS , M = tmp if len ( PS ) < 8 : warning ( "Key._rsaes_pkcs1_v1_5_decrypt(): decryption error " "(PS is less than 8 byte long)" ) return None return M