예제 #1
0
def create_software_statement(sws_data):
    sws_data["iss"] = "https://{host}:{port}/static/jwks.json".format(host=HOST, port=PORT)
    sws = SWSMessage()
    sws.from_dict(sws_data)

    _, keyjar, _ = build_keyjar(KEYS)
    alg = 'RS256'
    ckey = keyjar.get_signing_key(alg2keytype(alg), "",
                                  alg=alg)
    return sws.to_jwt(key=ckey, algorithm=alg)
예제 #2
0
def create_signed_sws(sws_data, pem):
    sws = SWSMessage(**sws_data)
    rsa_key = import_rsa_key(pem)
    key = [RSAKey().load_key(rsa_key)]
    alg = 'RS256'
    return sws.to_jwt(key=key, algorithm=alg)