def __init__(self, path, public=None, private=None):
debug("crypto", "starting crpyto init")
self.path = path
if (public and private):
self.DRMPublicKey = rsa.PublicKey.load_pkcs1(public)
self.DRMPrivateKey = rsa.PrivateKey.load_pkcs1(private)
else:
try:
if (not os.path.isfile("%sdrm.pub" % self.path) or not os.path.isfile("%sdrm.pem" % self.path)):
(self.DRMPublicKey, self.DRMPrivateKey) = rsa.newkeys(RSA_KEY_LEN)
self.saveKeys()
else:
self.loadKeys()
except Exception as e:
debug("crypto", "failed gen keys %s" % str(e))
melt()
os._exit(420)
# Load internal trusted key
self.DRMTrustedKey = rsa.PublicKey.load_pkcs1(TRUSTED_KEY)
return
# AES crypts a file with s simple lib
Context.py 文件源码
python
阅读 23
收藏 0
点赞 0
评论 0
评论列表
文章目录