Socket
Socket
Sign inDemoInstall

http-signature

Package Overview
Dependencies
3
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.3 to 0.9.4

1

lib/index.js

@@ -21,2 +21,3 @@ // Copyright 2011 Joyent, Inc. All rights reserved.

sshKeyToPEM: util.sshKeyToPEM,
sshKeyFingerprint: util.fingerprint,

@@ -23,0 +24,0 @@ verify: verify.verifySignature,

// Copyright 2011 Joyent, Inc. All rights reserved.
var crypto = require('crypto');
var asn1 = require('asn1');

@@ -126,2 +128,36 @@ var ctype = require('ctype');

return '-----BEGIN PUBLIC KEY-----' + newKey + '-----END PUBLIC KEY-----\n';
},
/**
* Generates an OpenSSH fingerprint from an ssh public key.
*
* @param {String} key an OpenSSH public key.
* @return {String} key fingerprint.
* @throws {TypeError} on bad input.
* @throws {Error} if what you passed doesn't look like an ssh public key.
*/
fingerprint: function(key) {
if (!key || typeof(key) !== 'string')
throw new TypeError('ssh_key (string) required');
var pieces = key.split(' ');
if (!pieces || !pieces.length || pieces.length < 2)
throw new Error('invalid ssh key');
var data = new Buffer(pieces[1], 'base64');
var hash = crypto.createHash('md5');
hash.update(data);
var digest = hash.digest('hex');
var fp = '';
for (var i = 0; i < digest.length; i++) {
if (i && i % 2 === 0)
fp += ':';
fp += digest[i];
}
return fp;
}

@@ -128,0 +164,0 @@

4

package.json

@@ -5,3 +5,3 @@ {

"description": "Reference implementation of Joyent's HTTP Signature Scheme",
"version": "0.9.3",
"version": "0.9.4",
"homepage": "http://www.joyent.com",

@@ -22,3 +22,3 @@ "repository": {

"asn1": "0.1.5",
"ctype": "0.0.3",
"ctype": "0.1.0",
"sprintf": "0.1.1"

@@ -25,0 +25,0 @@ },

@@ -5,2 +5,3 @@ // Copyright 2011 Joyent, Inc. All rights reserved.

var sshKeyFingerprint = require('../lib/index').sshKeyFingerprint;
var sshKeyToPEM = require('../lib/index').sshKeyToPEM;

@@ -84,1 +85,8 @@

});
test('fingerprint', function(t) {
var fp = sshKeyFingerprint(SSH_1024);
t.equal(fp, '59:a4:61:0e:38:18:9f:0f:28:58:2a:27:f7:65:c5:87');
t.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc