def decrypt(self, pkcs7, flags=0): # type: (PKCS7, int) -> Optional[bytes] if not hasattr(self, 'pkey'): raise SMIME_Error('no private key: use load_key()') if not hasattr(self, 'x509'): raise SMIME_Error('no certificate: load_key() used incorrectly?') blob = m2.pkcs7_decrypt(pkcs7._ptr(), self.pkey._ptr(), self.x509._ptr(), flags) return blob
def decrypt(self, pkcs7, flags=0): if not hasattr(self, 'pkey'): raise SMIME_Error('no private key: use load_key()') if not hasattr(self, 'x509'): raise SMIME_Error('no certificate: load_key() used incorrectly?') blob = m2.pkcs7_decrypt(pkcs7._ptr(), self.pkey._ptr(), self.x509._ptr(), flags) if blob is None: raise SMIME_Error(Err.get_error()) return blob
def get_decrypted_envelope_data(self, x509, evpkey): buf = BIO.MemoryBuffer(self.signedcontent) p7 = m2.pkcs7_read_bio_der(buf._ptr()) return m2.pkcs7_decrypt(p7, evpkey._ptr(), x509._ptr(), 0)