示例#1
0
文件: etoken.py 项目: zbo/zbodo
 def pkcs7_seal(self, text, recip=None,pin="safenet123$"):
     self.session.login(pin=pin)
     if (None==recip): recip=self.barium_cert
     buf = makebuf(text)
     print text
     print buf
     sm = SMIME.SMIME()
     sm.pkey = self.my_pkey
     sm.x509 = self.my_cert
     M2Crypto.EVP.PKey
     p7 = sm.sign(buf)
     x509 = X509.load_cert('recipient.pem')
     stk = X509.X509_Stack()
     stk.push(x509)
     sm.set_x509_stack(stk)
     sm.set_x509_stack(stk)
     sm.set_cipher(SMIME.Cipher('des_ede3_cbc'))
     tmp = BIO.MemoryBuffer()
     m2.pkcs7_write_bio(p7._ptr(),tmp._ptr())
     p7a = sm.encrypt(tmp)
     out = BIO.MemoryBuffer()
     sm.write(out, p7a)
     self.session.logout()
     return out.read()
示例#2
0
 def write(self, bio):
     # type: (BIO.BIO) -> int
     return m2.pkcs7_write_bio(self.pkcs7, bio._ptr())
示例#3
0
文件: SMIME.py 项目: rodrigc/m2crypto
 def write(self, bio):
     return m2.pkcs7_write_bio(self.pkcs7, bio._ptr())
示例#4
0
文件: SMIME.py 项目: mcepl/M2Crypto
 def write(self, bio):
     # type: (BIO.BIO) -> int
     return m2.pkcs7_write_bio(self.pkcs7, bio._ptr())
示例#5
0
 def write(self, bio):
     return m2.pkcs7_write_bio(self.pkcs7, bio._ptr())