当前位置: 首页>>代码示例>>Python>>正文


Python KeyBundle.get方法代码示例

本文整理汇总了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
开发者ID:dajiaji,项目名称:pyoidc,代码行数:14,代码来源:test_keyio.py

示例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
开发者ID:asheidan,项目名称:pyoidc,代码行数:16,代码来源:test_keyio.py

示例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'
开发者ID:,项目名称:,代码行数:20,代码来源:

示例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)
开发者ID:asheidan,项目名称:pyoidc,代码行数:23,代码来源:test_keyio.py

示例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)
开发者ID:asheidan,项目名称:pyoidc,代码行数:23,代码来源:test_keyio.py

示例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"]}})
开发者ID:dash-dash,项目名称:pyoidc,代码行数:32,代码来源:test_oic.py

示例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])
开发者ID:asheidan,项目名称:pyoidc,代码行数:24,代码来源:debug_keybundle.py


注:本文中的oic.utils.keyio.KeyBundle.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。