0.3.2 • Published 8 years ago

sdmp-create-private-key v0.3.2

Weekly downloads
13
License
VOL
Repository
-
Last release
8 years ago

sdmp-create-private-key

This module will create a private_key container object according to the specifications in the SDMP protocol.

install

This module is made to use npm. Install the normal npm way:

npm install sdmp-create-private-key

use it

You must pass in a node-rsa object containing a private key of 2048 bits:

var create = require('sdmp-create-private-key')
var container = create(nodeRsaPrivateKey)
// container is a valid `private_key` container object, e,g,
console.log(container.private_key.key) // => -----BEGIN RSA PRIVATE KEY-----...

node-rsa

The node-rsa module is an RSA crypto module implemented in pure JavaScript. This gives maximum portability, but generating keys in JS is not as fast as system-native libraries.

You can create a node-rsa private key object any of the following ways:

new key

var NodeRSA = require('node-rsa')
var nodeRsaPrivateKey = new NodeRSA({ b: 2048 })

from PEM encoded string

var NodeRSA = require('node-rsa')
var pemKey = '-----BEGIN RSA PRIVATE KEY-----\n...'
var nodeRsaPrivateKey = new NodeRSA(pemKey)

api create(nodeRsaPrivateKey[, unixOffsetToExpire])

In all cases, calling the function will either return a new container object, or throw an exception.

nodeRsaPrivateKey (object, required)

The parameter nodeRsaPrivateKey must be a node-rsa equivalent object, containing a private key of 2048 bytes.

unixOffsetToExpire (integer, optional)

Pass in the unix offset (milliseconds since Unix Epoch) and the UTC expiration date will be set to that exact date.

If this value is not set, the expiration date will be set to five years in the future.

license

Published and released under the Very Open License.

<3

0.3.2

8 years ago

0.2.1

8 years ago

0.1.0

8 years ago