本文整理汇总了Python中oic.utils.keyio.KeyBundle.get方法的典型用法代码示例。如果您正苦于以下问题:Python KeyBundle.get方法的具体用法?Python KeyBundle.get怎么用?Python KeyBundle.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oic.utils.keyio.KeyBundle
的用法示例。
在下文中一共展示了KeyBundle.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_chain_1
# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import get [as 别名]
def test_chain_1():
kc = KeyBundle([{"kty": "oct", "key": "supersecret", "use": "sig"}])
assert len(kc.get("oct")) == 1
assert len(kc.get("rsa")) == 0
assert kc.remote is False
assert kc.source is None
kc.update() # Nothing should happen
assert len(kc.get("oct")) == 1
assert len(kc.get("rsa")) == 0
assert kc.remote is False
assert kc.source is None
示例2: test_chain_1
# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import get [as 别名]
def test_chain_1():
kc = KeyBundle({"hmac": "supersecret"}, usage="sig")
assert len(kc.get("hmac")) == 1
assert len(kc.get("rsa")) == 0
assert kc.usage == ["sig"]
assert kc.remote == False
assert kc.source is None
kc.update() # Nothing should happen
assert len(kc.get("hmac")) == 1
assert len(kc.get("rsa")) == 0
assert kc.usage == ["sig"]
assert kc.remote == False
assert kc.source is None
示例3: test_key_export
# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import get [as 别名]
def test_key_export():
kj = KeyJar()
url = key_export("http://example.com/keys/", "outbound", "secret",
keyjar=kj, sig={"alg": "rsa", "format": ["x509", "jwk"]})
assert url == "http://example.com/keys/outbound/jwks"
# Now a jwks should reside in './keys/outbound/jwks'
kb = KeyBundle(source='file://./keys/outbound/jwks')
# One key
assert len(kb) == 1
# more specifically one RSA key
assert len(kb.get('RSA')) == 1
k = kb.get('RSA')[0]
# For signing
assert k.use == 'sig'
示例4: test_chain_3
# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import get [as 别名]
def test_chain_3():
kc = KeyBundle(source="file://../oc3/certs/server.crt", type="rsa",
src_type="x509", usage=["sig", "enc"])
assert kc.usage == ["sig", "enc"]
assert kc.remote == False
assert kc.source == "../oc3/certs/server.crt"
assert len(kc.get("hmac")) == 0
assert len(kc.get("rsa")) == 1
key = kc.get("rsa")[0]
assert isinstance(key, M2Crypto.RSA.RSA)
kc.update()
assert kc.usage == ["sig", "enc"]
assert kc.remote == False
assert kc.source == "../oc3/certs/server.crt"
assert len(kc.get("hmac")) == 0
assert len(kc.get("rsa")) == 1
key = kc.get("rsa")[0]
assert isinstance(key, M2Crypto.RSA.RSA)
示例5: test_chain_2
# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import get [as 别名]
def test_chain_2():
kc = KeyBundle(source="file://../oc3/certs/mycert.key", type="rsa",
usage=["ver", "sig"])
assert kc.usage == ["ver", "sig"]
assert kc.remote == False
assert kc.source == "../oc3/certs/mycert.key"
assert len(kc.get("hmac")) == 0
assert len(kc.get("rsa")) == 1
key = kc.get("rsa")[0]
assert isinstance(key, M2Crypto.RSA.RSA)
kc.update()
assert kc.usage == ["ver", "sig"]
assert kc.remote == False
assert kc.source == "../oc3/certs/mycert.key"
assert len(kc.get("hmac")) == 0
assert len(kc.get("rsa")) == 1
key = kc.get("rsa")[0]
assert isinstance(key, M2Crypto.RSA.RSA)
示例6: UserInfoRequest
# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import get [as 别名]
UIREQ = UserInfoRequest(access_token="access_token")
REGREQ = RegistrationRequest(contacts=["[email protected]"],
redirect_uris=["http://example.org/jqauthz"],
application_name="pacubar", client_id=CLIENT_ID,
operation="register", application_type="web")
RSREQ = RefreshSessionRequest(id_token="id_token",
redirect_url="http://example.com/authz",
state="state0")
#key, type, usage, owner="."
alg = "HS256"
ktype = alg2keytype(alg)
keys = KC_SYM_S.get(ktype)
CSREQ = CheckSessionRequest(id_token=IDTOKEN.to_jwt(key=keys,
algorithm="HS256"))
ESREQ = EndSessionRequest(id_token=IDTOKEN.to_jwt(key=keys,
algorithm="HS256"),
redirect_url="http://example.org/jqauthz",
state="state0")
UINFO = Claims(name={"essential": True}, nickname=None,
email={"essential": True},
email_verified={"essential": True}, picture=None)
IDT2 = Claims(auth_time={"essential": True,
"acr": {"values": ["urn:mace:incommon:iap:silver"]}})
示例7: KeyBundle
# 需要导入模块: from oic.utils.keyio import KeyBundle [as 别名]
# 或者: from oic.utils.keyio.KeyBundle import get [as 别名]
from oic.utils.keyio import KeyBundle, key_eq
__author__ = 'rolandh'
jwk_url = ["https://connect.openid4.us/connect4us.jwk", # edmund
"https://connect-op.heroku.com/jwk.json"] # nov
x509_url = ["https://connect-op.heroku.com/cert.pem"]
kc0 = KeyBundle(source=jwk_url[1], src_type="jwk", type="rsa", usage=["sig", "enc"])
kc1 = KeyBundle(source=x509_url[0], src_type="x509", type="rsa", usage=["sig", "enc"])
kc0.update()
print kc0
kc1.update()
print kc1
print key_eq(kc0.get("rsa")[0], kc1.get("rsa")[0])