本文整理汇总了Python中zato.common.crypto.CryptoManager.pub_key_location方法的典型用法代码示例。如果您正苦于以下问题:Python CryptoManager.pub_key_location方法的具体用法?Python CryptoManager.pub_key_location怎么用?Python CryptoManager.pub_key_location使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zato.common.crypto.CryptoManager
的用法示例。
在下文中一共展示了CryptoManager.pub_key_location方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_enrypt
# 需要导入模块: from zato.common.crypto import CryptoManager [as 别名]
# 或者: from zato.common.crypto.CryptoManager import pub_key_location [as 别名]
def test_enrypt(self):
""" Encrypt a message using the public key.
"""
_plain_text = uuid4().hex
with NamedTemporaryFile(prefix='zato-test-') as tf_priv:
with NamedTemporaryFile(prefix='zato-test-') as tf_pub:
tf_priv.write(priv_key)
tf_priv.flush()
tf_pub.write(pub_key)
tf_pub.flush()
cm_priv = CryptoManager()
cm_priv.priv_key_location = tf_priv.name
cm_priv.load_keys()
cm_pub = CryptoManager()
cm_pub.pub_key_location = tf_pub.name
cm_pub.load_keys()
encrypted = cm_pub.encrypt(_plain_text)
decrypted = cm_priv.decrypt(encrypted)
eq_(_plain_text, decrypted)
示例2: _update_crypto
# 需要导入模块: from zato.common.crypto import CryptoManager [as 别名]
# 或者: from zato.common.crypto.CryptoManager import pub_key_location [as 别名]
def _update_crypto(
self, args, copy_crypto_func, update_secrets=False, load_secrets_func=None,
store_secrets_func=None, conf_file_name=None, priv_key_name=None, pub_key_name=None, secret_names=[]):
repo_dir = os.path.join(os.path.abspath(os.path.join(self.original_dir, args.path)), 'config', 'repo')
secrets = {}
if update_secrets:
priv_key_location = os.path.abspath(os.path.join(repo_dir, priv_key_name))
pub_key_location = os.path.abspath(os.path.join(repo_dir, pub_key_name))
conf_location = os.path.join(repo_dir, conf_file_name)
cm = CryptoManager(priv_key_location=priv_key_location)
cm.load_keys()
secrets, conf = load_secrets_func(secrets, secret_names, cm, conf_location, conf_file_name)
copy_crypto_func(repo_dir, args)
if update_secrets:
cm.reset()
cm.pub_key_location = pub_key_location
cm.load_keys()
store_secrets_func(secrets, secret_names, cm, conf_location, conf)