How to use the sshpk.Key function in sshpk

To help you get started, we’ve selected a few sshpk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SmartThingsCommunity / smartapp-sdk-nodejs / test / unit / util / authorizer-spec.js View on Github external
it('should resolve a remote file public key', async () => {
		const keyId = '/pl/useast1/keyId'
		const scope = nock('https://key.smartthings.com')
			.get(keyId)
			.reply(200, publicCert)
		const authorizer = new Authorizer()
		const actualPublicKey = await authorizer.getKey(keyId)
		const isKey = sshpk.Key.isKey(actualPublicKey, [1, 1])
		assert.strictEqual(isKey, true)
		scope.done()
	})
github joyent / node-http-signature / lib / verify.js View on Github external
verifySignature: function verifySignature(parsedSignature, pubkey) {
    assert.object(parsedSignature, 'parsedSignature');
    if (typeof (pubkey) === 'string' || Buffer.isBuffer(pubkey))
      pubkey = sshpk.parseKey(pubkey);
    assert.ok(sshpk.Key.isKey(pubkey, [1, 1]), 'pubkey must be a sshpk.Key');

    var alg = validateAlgorithm(parsedSignature.algorithm);
    if (alg[0] === 'hmac' || alg[0] !== pubkey.type)
      return (false);

    var v = pubkey.createVerify(alg[1]);
    v.update(parsedSignature.signingString);
    return (v.verify(parsedSignature.params.signature, 'base64'));
  },
github charlielin99 / Jobalytics / node_modules / http-signature / lib / verify.js View on Github external
verifySignature: function verifySignature(parsedSignature, pubkey) {
    assert.object(parsedSignature, 'parsedSignature');
    if (typeof (pubkey) === 'string' || Buffer.isBuffer(pubkey))
      pubkey = sshpk.parseKey(pubkey);
    assert.ok(sshpk.Key.isKey(pubkey, [1, 1]), 'pubkey must be a sshpk.Key');

    var alg = validateAlgorithm(parsedSignature.algorithm);
    if (alg[0] === 'hmac' || alg[0] !== pubkey.type)
      return (false);

    var v = pubkey.createVerify(alg[1]);
    v.update(parsedSignature.signingString);
    return (v.verify(parsedSignature.params.signature, 'base64'));
  },

sshpk

A library for finding and using SSH public keys

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis