Exemplo n.º 1
0
def test_dump_jwk():
    _ckey = x509_rsa_loads(open(CERT).read())
    jwk = dump_jwks([{"key": _ckey}])
    print jwk
    _wk = json.loads(jwk)
    assert _wk.keys() == ["keys"]
    assert len(_wk["keys"]) == 1
    assert _eq(_wk["keys"][0].keys(), ["kty", "e", "n"])
Exemplo n.º 2
0
def test_dump_jwk():
    _ckey = pem_cert2rsa(CERT)
    jwk = dump_jwks([{"key": _ckey}])
    print jwk
    _wk = json.loads(jwk)
    assert _wk.keys() == ["keys"]
    assert len(_wk["keys"]) == 1
    assert _eq(_wk["keys"][0].keys(), ["kty", "e", "n"])
Exemplo n.º 3
0
def test_dump_jwk():
    _ckey = pem_cert2rsa(CERT)
    jwk = dump_jwks([{"key": _ckey}])
    print jwk
    _wk = json.loads(jwk)
    assert _wk.keys() == ["keys"]
    assert len(_wk["keys"]) == 1
    assert _eq(_wk["keys"][0].keys(), ["kty", "e", "n"])
Exemplo n.º 4
0
def test_load_jwk():
    _ckey = x509_rsa_loads(open(CERT).read())
    jwk = dump_jwks([{"key": _ckey}])
    wk = load_jwks(jwk)
    print wk
    assert len(wk) == 1
    key = wk[0]
    assert key.kty == "RSA"
    assert isinstance(key.key, M2Crypto.RSA.RSA)
Exemplo n.º 5
0
def test_load_jwk():
    _ckey = pem_cert2rsa(CERT)
    jwk = dump_jwks([{"key": _ckey}])
    wk = load_jwks(jwk)
    print wk
    assert len(wk) == 1
    key = wk[0]
    assert key.kty == "RSA"
    assert isinstance(key.key, _RSAobj)
Exemplo n.º 6
0
def test_load_jwk():
    _ckey = pem_cert2rsa(CERT)
    jwk = dump_jwks([{"key": _ckey}])
    wk = load_jwks(jwk)
    print wk
    assert len(wk) == 1
    key = wk[0]
    assert key.kty == "RSA"
    assert isinstance(key.key, _RSAobj)
Exemplo n.º 7
0
#!/home/vinicius/Área de Trabalho/App-Flask-React/backend-flask/venv/bin/python3
import os
import argparse
from jwkest.jwk import RSAKey
from jwkest.jwk import rsa_load
from jwkest.jwk import dump_jwks

__author__ = 'rolandh'

parser = argparse.ArgumentParser()
parser.add_argument('-n', dest="name", default="pyoidc", help="file names")
parser.add_argument('-p',
                    dest="path",
                    default=".",
                    help="Path to the directory for the files")
parser.add_argument('-k', dest="key", help="Key file")

args = parser.parse_args()

rsa_key = RSAKey(key=rsa_load(args.key))

keyfile = os.path.join(args.path, args.name)

f = open(keyfile + ".jwk", "w")
f.write(dump_jwks([rsa_key]))
f.close()
Exemplo n.º 8
0
import os
import argparse
from jwkest.jwk import RSAKey, rsa_load, dump_jwks

__author__ = 'rolandh'

parser = argparse.ArgumentParser()
parser.add_argument('-n', dest="name", default="pyoidc", help="file names")
parser.add_argument('-p',
                    dest="path",
                    default=".",
                    help="Path to the directory for the files")
parser.add_argument('-k', dest="key", help="Key file")

args = parser.parse_args()

key = rsa_load(args.key)
rsa_key = RSAKey(key=key)
rsa_key.serialize()

# This will create JWK from the public RSA key
jwk_spec = json.dumps(rsa_key.to_dict(), "enc")

keyfile = os.path.join(args.path, args.name)

_out = dump_jwks([{"key": key, "use": "enc"}])

f = open(keyfile + ".jwk", "w")
f.write(_out)
f.close()
Exemplo n.º 9
0
import json
import os
import argparse
from jwkest.jwk import RSAKey, rsa_load, dump_jwks

__author__ = 'rolandh'

parser = argparse.ArgumentParser()
parser.add_argument('-n', dest="name", default="pyoidc",
                    help="file names")
parser.add_argument('-p', dest="path", default=".",
                    help="Path to the directory for the files")
parser.add_argument('-k', dest="key", help="Key file")

args = parser.parse_args()

key = rsa_load(args.key)
rsa_key = RSAKey(key=key)
rsa_key.serialize()

# This will create JWK from the public RSA key
jwk_spec = json.dumps(rsa_key.to_dict(), "enc")

keyfile = os.path.join(args.path, args.name)

_out = dump_jwks([{"key":key, "use":"enc"}])

f = open(keyfile + ".jwk", "w")
f.write(_out)
f.close()
Exemplo n.º 10
0
#!/usr/bin/env python
import os
import argparse
from jwkest.jwk import RSAKey
from jwkest.jwk import rsa_load
from jwkest.jwk import dump_jwks

__author__ = 'rolandh'

parser = argparse.ArgumentParser()
parser.add_argument('-n', dest="name", default="pyoidc",
                    help="file names")
parser.add_argument('-p', dest="path", default=".",
                    help="Path to the directory for the files")
parser.add_argument('-k', dest="key", help="Key file")

args = parser.parse_args()

rsa_key = RSAKey(key=rsa_load(args.key))

keyfile = os.path.join(args.path, args.name)

f = open(keyfile + ".jwk", "w")
f.write(dump_jwks([rsa_key]))
f.close()