diff --git a/jwk.py b/jwk.py index 5c8165f..da9aed9 100644 --- a/jwk.py +++ b/jwk.py @@ -3,8 +3,8 @@ jwk = JWK(algorithms=JWK_ALGORITHMS) -with open('public.pem', 'r') as f: +with open("public.pem", "r") as f: key = f.read() -obj = jwk.dumps(key, kty='RSA', indent=4, sort_keys=True) +obj = jwk.dumps(key, kty="RSA", indent=4, sort_keys=True) key_str = str(obj).replace("'", '"') print(key_str) diff --git a/pgppubkey_to_jwk.py b/pgppubkey_to_jwk.py index 22baa81..09febb3 100644 --- a/pgppubkey_to_jwk.py +++ b/pgppubkey_to_jwk.py @@ -4,14 +4,10 @@ # Input is PGP armored pubkey -key, _ = pgpy.PGPKey.from_file('key.asc') +key, _ = pgpy.PGPKey.from_file("key.asc") n = int(key._key.keymaterial.n) e = int(key._key.keymaterial.e) # Expected JWK format according to https://tools.ietf.org/html/rfc7518#section-6.1 -pubkey = { - 'kty': 'RSA', - 'e': int_to_base64(e), - 'n': int_to_base64(n) -} +pubkey = {"kty": "RSA", "e": int_to_base64(e), "n": int_to_base64(n)} print(json.dumps(pubkey)) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..aa4949a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[tool.black] +line-length = 100