示例#1
0
 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
示例#2
0
文件: SMIME.py 项目: mcepl/M2Crypto
 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
示例#3
0
文件: SMIME.py 项目: rodrigc/m2crypto
 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
示例#4
0
 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
示例#5
0
 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)