def setUpClass(cls):
# Ensure there is a key to use
cls.pub_key, cls.priv_key = rsa.newkeys(512)
cls.pub_fname = '%s.pub' % cls.__name__
cls.priv_fname = '%s.key' % cls.__name__
with open(cls.pub_fname, 'wb') as outfile:
outfile.write(cls.pub_key.save_pkcs1())
with open(cls.priv_fname, 'wb') as outfile:
outfile.write(cls.priv_key.save_pkcs1())
评论列表
文章目录