本文整理汇总了Python中jwkest.jwk.RSAKey.load方法的典型用法代码示例。如果您正苦于以下问题:Python RSAKey.load方法的具体用法?Python RSAKey.load怎么用?Python RSAKey.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jwkest.jwk.RSAKey
的用法示例。
在下文中一共展示了RSAKey.load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keybundle_from_local_file
# 需要导入模块: from jwkest.jwk import RSAKey [as 别名]
# 或者: from jwkest.jwk.RSAKey import load [as 别名]
def keybundle_from_local_file(filename, typ, usage, kid):
if typ.upper() == "RSA":
kb = KeyBundle()
k = RSAKey(kid=kid)
k.load(filename)
k.use = usage[0]
kb.append(k)
for use in usage[1:]:
_k = RSAKey(kid=kid + "1")
_k.use = use
_k.load_key(k.key)
kb.append(_k)
elif typ.lower() == "jwk":
kb = KeyBundle(source=filename, fileformat="jwk", keyusage=usage)
else:
raise UnknownKeyType("Unsupported key type")
return kb
示例2: keybundle_from_local_file
# 需要导入模块: from jwkest.jwk import RSAKey [as 别名]
# 或者: from jwkest.jwk.RSAKey import load [as 别名]
def keybundle_from_local_file(filename, typ, usage):
if typ.upper() == "RSA":
kb = KeyBundle()
k = RSAKey()
k.load(filename)
k.use = usage[0]
kb.append(k)
for use in usage[1:]:
_k = RSAKey()
_k.use = use
_k.key = k.key
kb.append(_k)
elif typ.lower() == "jwk":
kb = KeyBundle(source=filename, fileformat="jwk", keyusage=usage)
else:
raise Exception("Unsupported key type")
return kb