Decrypts message
        @param pkey - private key to decrypt
        @param cert - certificate of this private key (to find
            neccessary RecipientInfo
        @param flags - flags
        @returns - decrypted data

def decrypt(self, pkey, cert, flags=0):
        """
        Decrypts message
        @param pkey - private key to decrypt
        @param cert - certificate of this private key (to find
            neccessary RecipientInfo
        @param flags - flags
        @returns - decrypted data
        """
        if not pkey.cansign:
            raise ValueError("Specified keypair has no private part")
        if pkey != cert.pubkey:
            raise ValueError("Certificate doesn't match private key")
        bio = Membio()
        res = libcrypto.CMS_decrypt(self.ptr, pkey.key, cert.cert, None,
                                    bio.bio, flags)
        if res <= 0:
            raise CMSError("decrypting CMS")
        return str(bio)