Compare commits
1 Commits
81780e5ab1
...
1deaf14f5c
Author | SHA1 | Date | |
---|---|---|---|
1deaf14f5c |
@ -9,6 +9,11 @@ SSH.parse = function (opts) {
|
||||
var ssh = SSH.parseBlock(pub);
|
||||
if ('OPENSSH PRIVATE KEY' === ssh.type) {
|
||||
ssh = SSH.parsePrivateElements(ssh);
|
||||
if (7 === ssh.elements.length) {
|
||||
// RSA Private Keys have the `e` and `n` swapped (which is actually more normal)
|
||||
// but we have to reswap them to make them consistent with the public key format
|
||||
ssh.elements.splice(1, 0, ssh.elements.splice(2 ,1)[0]);
|
||||
}
|
||||
if (opts.public) {
|
||||
ssh.elements = ssh.elements.slice(0, 3);
|
||||
}
|
||||
@ -159,7 +164,6 @@ SSH.parsePublicKey = function (ssh) {
|
||||
, e: Enc.bufToUrlBase64(els[1])
|
||||
};
|
||||
} else {
|
||||
console.log('len:', els.length);
|
||||
ssh.jwk = {
|
||||
kty: 'RSA'
|
||||
, n: Enc.bufToUrlBase64(els[2])
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ssh-to-jwk",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.5",
|
||||
"description": "💯 SSH to JWK in a lightweight, zero-dependency library.",
|
||||
"homepage": "https://git.coolaj86.com/coolaj86/ssh-to-jwk.js",
|
||||
"main": "index.js",
|
||||
|
Loading…
x
Reference in New Issue
Block a user