Converts PEM formatted keys to JWK
Uses node-jose to convert PEM formatted crypto keys to JWK format.
https://hub.docker.com/r/danedmunds/pem-to-jwk/
--public
outputs the public representation only--jwks-out
outputs the key wrapped in the JWKS structure
> openssl ecparam -name secp384r1 -genkey -noout | docker run -i danedmunds/pem-to-jwk:latest
{
"kty": "EC",
"kid": "LDKfPp9PVFjv9NztmlKdaq97450AwxjdXLllBqg4sro",
"crv": "P-384",
"x": "8X7IwpgYSmKYAonNPSVPXdNH6aWB3TcAKji4Lf8bkfDDXmI4XAGuxczahZYe2aSi",
"y": "R3Gl11-RPVF17JrntdNpUw2VzmmyWRnv_rTgUXn-AuEVwxpazmx31W8o3olOQ5G-",
"d": "PGE88usv2aVuDcsvzLBt4R7xYfIWHX4nmd8yVOhdq3FD5NC_1bYJFfyGHabj3OEf"
}
> openssl ecparam -name secp384r1 -genkey -noout | docker run -i danedmunds/pem-to-jwk:latest --public
{
"kty": "EC",
"kid": "LDKfPp9PVFjv9NztmlKdaq97450AwxjdXLllBqg4sro",
"crv": "P-384",
"x": "8X7IwpgYSmKYAonNPSVPXdNH6aWB3TcAKji4Lf8bkfDDXmI4XAGuxczahZYe2aSi",
"y": "R3Gl11-RPVF17JrntdNpUw2VzmmyWRnv_rTgUXn-AuEVwxpazmx31W8o3olOQ5G-"
}
> docker run -i danedmunds/pem-to-jwk:latest <<EOF
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEAzremgrCTOkuP6TJwwx+tre/wngN7K0i++Cbno89MRcCO7rl/
FhCCNVdjnPTBDPMJLcOWNnBknIFlCRmep9Z+Q4hH/hnXsTCZ1TI2aBdApf8/Q7Ge
Fa7WWDxM0tbfkcZkUYLhsQeqQs3TT9/gz0+Bhm0Zd8x3lItChpyoP048Shd+pWF9
xGXKMO3Kz03+oF4XDb3TECFyN7iAvWlCbfOalfOd7TzNRVvasJeuHefzvLxJwnRE
2LdgwlCRLY5T1kg4cTBg6uiO/6XHUJlJqaX/WxpBt1usD1P/PIcT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