Last active
August 9, 2016 07:59
-
-
Save nov/765863718e1d3a551b1fd08ae7b9c384 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pem = '-----BEGIN PUBLIC KEY-----\ | |
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApnOaAemDtELggT4BpfuE\ | |
PDImzKZpEX/U8MNSk5RF/j8LGR5V8CjN1ASO0Yy9HxILpTDZFFVEsCVKo4c/Smi6\ | |
PzMlNIyywrpnAJFoqtuSLlD/A8SRBEgyXRWzEwvtfW5fhmGFVLw9qm5ZDgrL/XNW\ | |
gMH4uHvJA1mdQlRyCopUlvAeQJ2aM13rNpkYRnCQIDNfVStEsVbYTjF0m9QR1Nb1\ | |
zYpzB4nDNVQlZmj+SyDwtY+BMH6GAiXwa8JOb0mHgUVnxdWdL6lx8kVUkg16Yv17\ | |
D8u0Jhl+7W1SVVVNEYaGKaB1KKmJ7twibmyX4gwBRbQIamvHyZRc/BBaCg3YZNxh\ | |
pwIDAQAB\ | |
-----END PUBLIC KEY-----'; | |
var pubKey = KEYUTIL.getKey(pem); | |
var jwk = { | |
kty: pubKey.type, | |
e: hextob64u(pubKey.e.toString(16)), | |
n: hextob64u(pubKey.n.toString(16)) | |
} | |
jwk.kid = KJUR.jws.JWS.getJWKthumbprint(jwk); | |
console.info(jwk); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment