{
  "name": "sshpk",
  "version": "1.11.0",
  "description": "A library for finding and using SSH public keys",
  "main": "lib/index.js",
  "scripts": {
    "test": "tape test/*.js"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/arekinath/node-sshpk.git"
  },
  "author": {
    "name": "Joyent, Inc"
  },
  "contributors": [
    {
      "name": "Dave Eddy",
      "email": "dave@daveeddy.com"
    },
    {
      "name": "Mark Cavage",
      "email": "mcavage@gmail.com"
    },
    {
      "name": "Alex Wilson",
      "email": "alex@cooperi.net"
    }
  ],
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/arekinath/node-sshpk/issues"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "directories": {
    "bin": "./bin",
    "lib": "./lib",
    "man": "./man/man1"
  },
  "homepage": "https://github.com/arekinath/node-sshpk#readme",
  "dependencies": {
    "asn1": "~0.2.3",
    "assert-plus": "^1.0.0",
    "dashdash": "^1.12.0",
    "getpass": "^0.1.1",
    "jsbn": "~0.1.0",
    "tweetnacl": "~0.14.0",
    "jodid25519": "^1.0.0",
    "ecc-jsbn": "~0.1.1",
    "bcrypt-pbkdf": "^1.0.0"
  },
  "optionalDependencies": {
    "jsbn": "~0.1.0",
    "tweetnacl": "~0.14.0",
    "jodid25519": "^1.0.0",
    "ecc-jsbn": "~0.1.1",
    "bcrypt-pbkdf": "^1.0.0"
  },
  "devDependencies": {
    "tape": "^3.5.0",
    "benchmark": "^1.0.0",
    "sinon": "^1.17.2",
    "temp": "^0.8.2"
  },
  "man": [
    "C:\\Users\\IEUser\\AppData\\Roaming\\npm-cache\\sshpk\\1.11.0\\package\\man\\man1\\sshpk-conv.1",
    "C:\\Users\\IEUser\\AppData\\Roaming\\npm-cache\\sshpk\\1.11.0\\package\\man\\man1\\sshpk-sign.1",
    "C:\\Users\\IEUser\\AppData\\Roaming\\npm-cache\\sshpk\\1.11.0\\package\\man\\man1\\sshpk-verify.1"
  ],
  "bin": {
    "sshpk-conv": "bin\\sshpk-conv",
    "sshpk-sign": "bin\\sshpk-sign",
    "sshpk-verify": "bin\\sshpk-verify"
  },
  "readme": "sshpk\n=========\n\nParse, convert, fingerprint and use SSH keys (both public and private) in pure\nnode -- no `ssh-keygen` or other external dependencies.\n\nSupports RSA, DSA, ECDSA (nistp-\\*) and ED25519 key types, in PEM (PKCS#1, \nPKCS#8) and OpenSSH formats.\n\nThis library has been extracted from\n[`node-http-signature`](https://github.com/joyent/node-http-signature)\n(work by [Mark Cavage](https://github.com/mcavage) and\n[Dave Eddy](https://github.com/bahamas10)) and\n[`node-ssh-fingerprint`](https://github.com/bahamas10/node-ssh-fingerprint)\n(work by Dave Eddy), with additions (including ECDSA support) by\n[Alex Wilson](https://github.com/arekinath).\n\nInstall\n-------\n\n```\nnpm install sshpk\n```\n\nExamples\n--------\n\n```js\nvar sshpk = require('sshpk');\n\nvar fs = require('fs');\n\n/* Read in an OpenSSH-format public key */\nvar keyPub = fs.readFileSync('id_rsa.pub');\nvar key = sshpk.parseKey(keyPub, 'ssh');\n\n/* Get metadata about the key */\nconsole.log('type => %s', key.type);\nconsole.log('size => %d bits', key.size);\nconsole.log('comment => %s', key.comment);\n\n/* Compute key fingerprints, in new OpenSSH (>6.7) format, and old MD5 */\nconsole.log('fingerprint => %s', key.fingerprint().toString());\nconsole.log('old-style fingerprint => %s', key.fingerprint('md5').toString());\n```\n\nExample output:\n\n```\ntype => rsa\nsize => 2048 bits\ncomment => foo@foo.com\nfingerprint => SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w\nold-style fingerprint => a0:c8:ad:6c:32:9a:32:fa:59:cc:a9:8c:0a:0d:6e:bd\n```\n\nMore examples: converting between formats:\n\n```js\n/* Read in a PEM public key */\nvar keyPem = fs.readFileSync('id_rsa.pem');\nvar key = sshpk.parseKey(keyPem, 'pem');\n\n/* Convert to PEM PKCS#8 public key format */\nvar pemBuf = key.toBuffer('pkcs8');\n\n/* Convert to SSH public key format (and return as a string) */\nvar sshKey = key.toString('ssh');\n```\n\nSigning and verifying:\n\n```js\n/* Read in an OpenSSH/PEM *private* key */\nvar keyPriv = fs.readFileSync('id_ecdsa');\nvar key = sshpk.parsePrivateKey(keyPriv, 'pem');\n\nvar data = 'some data';\n\n/* Sign some data with the key */\nvar s = key.createSign('sha1');\ns.update(data);\nvar signature = s.sign();\n\n/* Now load the public key (could also use just key.toPublic()) */\nvar keyPub = fs.readFileSync('id_ecdsa.pub');\nkey = sshpk.parseKey(keyPub, 'ssh');\n\n/* Make a crypto.Verifier with this key */\nvar v = key.createVerify('sha1');\nv.update(data);\nvar valid = v.verify(signature);\n/* => true! */\n```\n\nMatching fingerprints with keys:\n\n```js\nvar fp = sshpk.parseFingerprint('SHA256:PYC9kPVC6J873CSIbfp0LwYeczP/W4ffObNCuDJ1u5w');\n\nvar keys = [sshpk.parseKey(...), sshpk.parseKey(...), ...];\n\nkeys.forEach(function (key) {\n\tif (fp.matches(key))\n\t\tconsole.log('found it!');\n});\n```\n\nUsage\n-----\n\n## Public keys\n\n### `parseKey(data[, format = 'auto'[, options]])`\n\nParses a key from a given data format and returns a new `Key` object.\n\nParameters\n\n- `data` -- Either a Buffer or String, containing the key\n- `format` -- String name of format to use, valid options are:\n  - `auto`: choose automatically from all below\n  - `pem`: supports both PKCS#1 and PKCS#8\n  - `ssh`: standard OpenSSH format,\n  - `pkcs1`, `pkcs8`: variants of `pem`\n  - `rfc4253`: raw OpenSSH wire format\n  - `openssh`: new post-OpenSSH 6.5 internal format, produced by \n               `ssh-keygen -o`\n- `options` -- Optional Object, extra options, with keys:\n  - `filename` -- Optional String, name for the key being parsed \n                  (eg. the filename that was opened). Used to generate\n                  Error messages\n  - `passphrase` -- Optional String, encryption passphrase used to decrypt an\n                    encrypted PEM file\n\n### `Key.isKey(obj)`\n\nReturns `true` if the given object is a valid `Key` object created by a version\nof `sshpk` compatible with this one.\n\nParameters\n\n- `obj` -- Object to identify\n\n### `Key#type`\n\nString, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`.\n\n### `Key#size`\n\nInteger, \"size\" of the key in bits. For RSA/DSA this is the size of the modulus;\nfor ECDSA this is the bit size of the curve in use.\n\n### `Key#comment`\n\nOptional string, a key comment used by some formats (eg the `ssh` format).\n\n### `Key#curve`\n\nOnly present if `this.type === 'ecdsa'`, string containing the name of the\nnamed curve used with this key. Possible values include `nistp256`, `nistp384`\nand `nistp521`.\n\n### `Key#toBuffer([format = 'ssh'])`\n\nConvert the key into a given data format and return the serialized key as\na Buffer.\n\nParameters\n\n- `format` -- String name of format to use, for valid options see `parseKey()`\n\n### `Key#toString([format = 'ssh])`\n\nSame as `this.toBuffer(format).toString()`.\n\n### `Key#fingerprint([algorithm = 'sha256'])`\n\nCreates a new `Fingerprint` object representing this Key's fingerprint.\n\nParameters\n\n- `algorithm` -- String name of hash algorithm to use, valid options are `md5`,\n                 `sha1`, `sha256`, `sha384`, `sha512`\n\n### `Key#createVerify([hashAlgorithm])`\n\nCreates a `crypto.Verifier` specialized to use this Key (and the correct public\nkey algorithm to match it). The returned Verifier has the same API as a regular\none, except that the `verify()` function takes only the target signature as an\nargument.\n\nParameters\n\n- `hashAlgorithm` -- optional String name of hash algorithm to use, any\n                     supported by OpenSSL are valid, usually including\n                     `sha1`, `sha256`.\n\n`v.verify(signature[, format])` Parameters\n\n- `signature` -- either a Signature object, or a Buffer or String\n- `format` -- optional String, name of format to interpret given String with.\n              Not valid if `signature` is a Signature or Buffer.\n\n### `Key#createDiffieHellman()`\n### `Key#createDH()`\n\nCreates a Diffie-Hellman key exchange object initialized with this key and all\nnecessary parameters. This has the same API as a `crypto.DiffieHellman`\ninstance, except that functions take `Key` and `PrivateKey` objects as\narguments, and return them where indicated for.\n\nThis is only valid for keys belonging to a cryptosystem that supports DHE\nor a close analogue (i.e. `dsa`, `ecdsa` and `curve25519` keys). An attempt\nto call this function on other keys will yield an `Error`.\n\n## Private keys\n\n### `parsePrivateKey(data[, format = 'auto'[, options]])`\n\nParses a private key from a given data format and returns a new\n`PrivateKey` object.\n\nParameters\n\n- `data` -- Either a Buffer or String, containing the key\n- `format` -- String name of format to use, valid options are:\n  - `auto`: choose automatically from all below\n  - `pem`: supports both PKCS#1 and PKCS#8\n  - `ssh`, `openssh`: new post-OpenSSH 6.5 internal format, produced by \n                      `ssh-keygen -o`\n  - `pkcs1`, `pkcs8`: variants of `pem`\n  - `rfc4253`: raw OpenSSH wire format\n- `options` -- Optional Object, extra options, with keys:\n  - `filename` -- Optional String, name for the key being parsed \n                  (eg. the filename that was opened). Used to generate\n                  Error messages\n  - `passphrase` -- Optional String, encryption passphrase used to decrypt an\n                    encrypted PEM file\n\n### `PrivateKey.isPrivateKey(obj)`\n\nReturns `true` if the given object is a valid `PrivateKey` object created by a\nversion of `sshpk` compatible with this one.\n\nParameters\n\n- `obj` -- Object to identify\n\n### `PrivateKey#type`\n\nString, the type of key. Valid options are `rsa`, `dsa`, `ecdsa`.\n\n### `PrivateKey#size`\n\nInteger, \"size\" of the key in bits. For RSA/DSA this is the size of the modulus;\nfor ECDSA this is the bit size of the curve in use.\n\n### `PrivateKey#curve`\n\nOnly present if `this.type === 'ecdsa'`, string containing the name of the\nnamed curve used with this key. Possible values include `nistp256`, `nistp384`\nand `nistp521`.\n\n### `PrivateKey#toBuffer([format = 'pkcs1'])`\n\nConvert the key into a given data format and return the serialized key as\na Buffer.\n\nParameters\n\n- `format` -- String name of format to use, valid options are listed under \n              `parsePrivateKey`. Note that ED25519 keys default to `openssh`\n              format instead (as they have no `pkcs1` representation).\n\n### `PrivateKey#toString([format = 'pkcs1'])`\n\nSame as `this.toBuffer(format).toString()`.\n\n### `PrivateKey#toPublic()`\n\nExtract just the public part of this private key, and return it as a `Key`\nobject.\n\n### `PrivateKey#fingerprint([algorithm = 'sha256'])`\n\nSame as `this.toPublic().fingerprint()`.\n\n### `PrivateKey#createVerify([hashAlgorithm])`\n\nSame as `this.toPublic().createVerify()`.\n\n### `PrivateKey#createSign([hashAlgorithm])`\n\nCreates a `crypto.Sign` specialized to use this PrivateKey (and the correct\nkey algorithm to match it). The returned Signer has the same API as a regular\none, except that the `sign()` function takes no arguments, and returns a\n`Signature` object.\n\nParameters\n\n- `hashAlgorithm` -- optional String name of hash algorithm to use, any\n                     supported by OpenSSL are valid, usually including\n                     `sha1`, `sha256`.\n\n`v.sign()` Parameters\n\n- none\n\n### `PrivateKey#derive(newType)`\n\nDerives a related key of type `newType` from this key. Currently this is\nonly supported to change between `ed25519` and `curve25519` keys which are\nstored with the same private key (but usually distinct public keys in order\nto avoid degenerate keys that lead to a weak Diffie-Hellman exchange).\n\nParameters\n\n- `newType` -- String, type of key to derive, either `ed25519` or `curve25519`\n\n## Fingerprints\n\n### `parseFingerprint(fingerprint[, algorithms])`\n\nPre-parses a fingerprint, creating a `Fingerprint` object that can be used to\nquickly locate a key by using the `Fingerprint#matches` function.\n\nParameters\n\n- `fingerprint` -- String, the fingerprint value, in any supported format\n- `algorithms` -- Optional list of strings, names of hash algorithms to limit\n                  support to. If `fingerprint` uses a hash algorithm not on\n                  this list, throws `InvalidAlgorithmError`.\n\n### `Fingerprint.isFingerprint(obj)`\n\nReturns `true` if the given object is a valid `Fingerprint` object created by a\nversion of `sshpk` compatible with this one.\n\nParameters\n\n- `obj` -- Object to identify\n\n### `Fingerprint#toString([format])`\n\nReturns a fingerprint as a string, in the given format.\n\nParameters\n\n- `format` -- Optional String, format to use, valid options are `hex` and\n              `base64`. If this `Fingerprint` uses the `md5` algorithm, the\n              default format is `hex`. Otherwise, the default is `base64`.\n\n### `Fingerprint#matches(key)`\n\nVerifies whether or not this `Fingerprint` matches a given `Key`. This function\nuses double-hashing to avoid leaking timing information. Returns a boolean.\n\nParameters\n\n- `key` -- a `Key` object, the key to match this fingerprint against\n\n## Signatures\n\n### `parseSignature(signature, algorithm, format)`\n\nParses a signature in a given format, creating a `Signature` object. Useful\nfor converting between the SSH and ASN.1 (PKCS/OpenSSL) signature formats, and\nalso returned as output from `PrivateKey#createSign().sign()`.\n\nA Signature object can also be passed to a verifier produced by\n`Key#createVerify()` and it will automatically be converted internally into the\ncorrect format for verification.\n\nParameters\n\n- `signature` -- a Buffer (binary) or String (base64), data of the actual\n                 signature in the given format\n- `algorithm` -- a String, name of the algorithm to be used, possible values\n                 are `rsa`, `dsa`, `ecdsa`\n- `format` -- a String, either `asn1` or `ssh`\n\n### `Signature.isSignature(obj)`\n\nReturns `true` if the given object is a valid `Signature` object created by a\nversion of `sshpk` compatible with this one.\n\nParameters\n\n- `obj` -- Object to identify\n\n### `Signature#toBuffer([format = 'asn1'])`\n\nConverts a Signature to the given format and returns it as a Buffer.\n\nParameters\n\n- `format` -- a String, either `asn1` or `ssh`\n\n### `Signature#toString([format = 'asn1'])`\n\nSame as `this.toBuffer(format).toString('base64')`.\n\n## Certificates\n\n`sshpk` includes basic support for parsing certificates in X.509 (PEM) format\nand the OpenSSH certificate format. This feature is intended to be used mainly\nto access basic metadata about certificates, extract public keys from them, and\nalso to generate simple self-signed certificates from an existing key.\n\nNotably, there is no implementation of CA chain-of-trust verification, and only\nvery minimal support for key usage restrictions. Please do the security world\na favour, and DO NOT use this code for certificate verification in the\ntraditional X.509 CA chain style.\n\n### `parseCertificate(data, format)`\n\nParameters\n\n - `data` -- a Buffer or String\n - `format` -- a String, format to use, one of `'openssh'`, `'pem'` (X.509 in a\n               PEM wrapper), or `'x509'` (raw DER encoded)\n\n### `createSelfSignedCertificate(subject, privateKey[, options])`\n\nParameters\n\n - `subject` -- an Identity, the subject of the certificate\n - `privateKey` -- a PrivateKey, the key of the subject: will be used both to be\n                   placed in the certificate and also to sign it (since this is\n                   a self-signed certificate)\n - `options` -- optional Object, with keys:\n   - `lifetime` -- optional Number, lifetime of the certificate from now in\n                   seconds\n   - `validFrom`, `validUntil` -- optional Dates, beginning and end of\n                                  certificate validity period. If given\n                                  `lifetime` will be ignored\n   - `serial` -- optional Buffer, the serial number of the certificate\n   - `purposes` -- optional Array of String, X.509 key usage restrictions\n\n### `createCertificate(subject, key, issuer, issuerKey[, options])`\n\nParameters\n\n - `subject` -- an Identity, the subject of the certificate\n - `key` -- a Key, the public key of the subject\n - `issuer` -- an Identity, the issuer of the certificate who will sign it\n - `issuerKey` -- a PrivateKey, the issuer's private key for signing\n - `options` -- optional Object, with keys:\n   - `lifetime` -- optional Number, lifetime of the certificate from now in\n                   seconds\n   - `validFrom`, `validUntil` -- optional Dates, beginning and end of\n                                  certificate validity period. If given\n                                  `lifetime` will be ignored\n   - `serial` -- optional Buffer, the serial number of the certificate\n   - `purposes` -- optional Array of String, X.509 key usage restrictions\n\n### `Certificate#subjects`\n\nArray of `Identity` instances describing the subject of this certificate.\n\n### `Certificate#issuer`\n\nThe `Identity` of the Certificate's issuer (signer).\n\n### `Certificate#subjectKey`\n\nThe public key of the subject of the certificate, as a `Key` instance.\n\n### `Certificate#issuerKey`\n\nThe public key of the signing issuer of this certificate, as a `Key` instance.\nMay be `undefined` if the issuer's key is unknown (e.g. on an X509 certificate).\n\n### `Certificate#serial`\n\nThe serial number of the certificate. As this is normally a 64-bit or wider\ninteger, it is returned as a Buffer.\n\n### `Certificate#purposes`\n\nArray of Strings indicating the X.509 key usage purposes that this certificate\nis valid for. The possible strings at the moment are:\n\n * `'signature'` -- key can be used for digital signatures\n * `'identity'` -- key can be used to attest about the identity of the signer\n                   (X.509 calls this `nonRepudiation`)\n * `'codeSigning'` -- key can be used to sign executable code\n * `'keyEncryption'` -- key can be used to encrypt other keys\n * `'encryption'` -- key can be used to encrypt data (only applies for RSA)\n * `'keyAgreement'` -- key can be used for key exchange protocols such as\n                       Diffie-Hellman\n * `'ca'` -- key can be used to sign other certificates (is a Certificate\n             Authority)\n * `'crl'` -- key can be used to sign Certificate Revocation Lists (CRLs)\n\n### `Certificate#isExpired([when])`\n\nTests whether the Certificate is currently expired (i.e. the `validFrom` and\n`validUntil` dates specify a range of time that does not include the current\ntime).\n\nParameters\n\n - `when` -- optional Date, if specified, tests whether the Certificate was or\n             will be expired at the specified time instead of now\n\nReturns a Boolean.\n\n### `Certificate#isSignedByKey(key)`\n\nTests whether the Certificate was validly signed by the given (public) Key.\n\nParameters\n\n - `key` -- a Key instance\n\nReturns a Boolean.\n\n### `Certificate#isSignedBy(certificate)`\n\nTests whether this Certificate was validly signed by the subject of the given\ncertificate. Also tests that the issuer Identity of this Certificate and the\nsubject Identity of the other Certificate are equivalent.\n\nParameters\n\n - `certificate` -- another Certificate instance\n\nReturns a Boolean.\n\n### `Certificate#fingerprint([hashAlgo])`\n\nReturns the X509-style fingerprint of the entire certificate (as a Fingerprint\ninstance). This matches what a web-browser or similar would display as the\ncertificate fingerprint and should not be confused with the fingerprint of the\nsubject's public key.\n\nParameters\n\n - `hashAlgo` -- an optional String, any hash function name\n\n### `Certificate#toBuffer([format])`\n\nSerializes the Certificate to a Buffer and returns it.\n\nParameters\n\n - `format` -- an optional String, output format, one of `'openssh'`, `'pem'` or\n               `'x509'`. Defaults to `'x509'`.\n\nReturns a Buffer.\n\n### `Certificate#toString([format])`\n\n - `format` -- an optional String, output format, one of `'openssh'`, `'pem'` or\n               `'x509'`. Defaults to `'pem'`.\n\nReturns a String.\n\n## Certificate identities\n\n### `identityForHost(hostname)`\n\nConstructs a host-type Identity for a given hostname.\n\nParameters\n\n - `hostname` -- the fully qualified DNS name of the host\n\nReturns an Identity instance.\n\n### `identityForUser(uid)`\n\nConstructs a user-type Identity for a given UID.\n\nParameters\n\n - `uid` -- a String, user identifier (login name)\n\nReturns an Identity instance.\n\n### `identityForEmail(email)`\n\nConstructs an email-type Identity for a given email address.\n\nParameters\n\n - `email` -- a String, email address\n\nReturns an Identity instance.\n\n### `identityFromDN(dn)`\n\nParses an LDAP-style DN string (e.g. `'CN=foo, C=US'`) and turns it into an\nIdentity instance.\n\nParameters\n\n - `dn` -- a String\n\nReturns an Identity instance.\n\n### `Identity#toString()`\n\nReturns the identity as an LDAP-style DN string.\ne.g. `'CN=foo, O=bar corp, C=us'`\n\n### `Identity#type`\n\nThe type of identity. One of `'host'`, `'user'`, `'email'` or `'unknown'`\n\n### `Identity#hostname`\n### `Identity#uid`\n### `Identity#email`\n\nSet when `type` is `'host'`, `'user'`, or `'email'`, respectively. Strings.\n\n### `Identity#cn`\n\nThe value of the first `CN=` in the DN, if any.\n\nErrors\n------\n\n### `InvalidAlgorithmError`\n\nThe specified algorithm is not valid, either because it is not supported, or\nbecause it was not included on a list of allowed algorithms.\n\nThrown by `Fingerprint.parse`, `Key#fingerprint`.\n\nProperties\n\n- `algorithm` -- the algorithm that could not be validated\n\n### `FingerprintFormatError`\n\nThe fingerprint string given could not be parsed as a supported fingerprint\nformat, or the specified fingerprint format is invalid.\n\nThrown by `Fingerprint.parse`, `Fingerprint#toString`.\n\nProperties\n\n- `fingerprint` -- if caused by a fingerprint, the string value given\n- `format` -- if caused by an invalid format specification, the string value given\n\n### `KeyParseError`\n\nThe key data given could not be parsed as a valid key.\n\nProperties\n\n- `keyName` -- `filename` that was given to `parseKey`\n- `format` -- the `format` that was trying to parse the key (see `parseKey`)\n- `innerErr` -- the inner Error thrown by the format parser\n\n### `KeyEncryptedError`\n\nThe key is encrypted with a symmetric key (ie, it is password protected). The\nparsing operation would succeed if it was given the `passphrase` option.\n\nProperties\n\n- `keyName` -- `filename` that was given to `parseKey`\n- `format` -- the `format` that was trying to parse the key (currently can only\n              be `\"pem\"`)\n\n### `CertificateParseError`\n\nThe certificate data given could not be parsed as a valid certificate.\n\nProperties\n\n- `certName` -- `filename` that was given to `parseCertificate`\n- `format` -- the `format` that was trying to parse the key\n              (see `parseCertificate`)\n- `innerErr` -- the inner Error thrown by the format parser\n\nFriends of sshpk\n----------------\n\n * [`sshpk-agent`](https://github.com/arekinath/node-sshpk-agent) is a library\n   for speaking the `ssh-agent` protocol from node.js, which uses `sshpk`\n",
  "readmeFilename": "README.md",
  "_id": "sshpk@1.11.0",
  "_shasum": "2d8d5ebb4a6fab28ffba37fa62a90f4a3ea59d77",
  "_from": "sshpk@^1.7.0",
  "_resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.11.0.tgz"
}
