def test_create_fo_keys_bundle(): jb = JWKSBundle(ORGOP.iss, ORGOP.keyjar) jb[FOP.iss] = FOP.keyjar jb[FO1P.iss] = FO1P.keyjar sb = jb.create_signed_bundle() _jw = jws.factory(sb) assert _jw
def test_create_verify_fo_keys_bundle(): jb = JWKSBundle(ORGOP.iss, ORGOP.keyjar) jb[FOP.iss] = FOP.keyjar jb[FO1P.iss] = FO1P.keyjar sb = jb.create_signed_bundle() kj = KeyJar() kj.add_keyjar(ORGOP.keyjar) # Necessary since otherwise it won't find the key kj.issuer_keys[ORGOP.iss] = kj.issuer_keys[''] _jwt = verify_signed_bundle(sb, kj) bundle = _jwt["bundle"] assert set(bundle.keys()) == {FOP.iss, FO1P.iss}
def test_sign_verify(): bundle = JWKSBundle(ISS, SIGN_KEYS) bundle['https://www.swamid.se'] = KEYJAR['https://www.swamid.se'] bundle['https://www.sunet.se'] = KEYJAR['https://www.sunet.se'] bundle['https://www.feide.no'] = KEYJAR['https://www.feide.no'] _jws = bundle.create_signed_bundle() bundle2 = JWKSBundle(ISS2) verify_keys = SIGN_KEYS.copy() verify_keys.issuer_keys[ISS] = verify_keys.issuer_keys[''] bundle2.upload_signed_bundle(_jws, verify_keys) assert set(bundle.keys()) == set(bundle2.keys()) for iss, kj in bundle.items(): assert bundle2[iss] == kj