JoshKaufman / ursa

URSA - RSA public/private key OpenSSL bindings for Node.js
Other
618 stars 135 forks source link

PKCS8? #145

Open brandonros opened 8 years ago

brandonros commented 8 years ago

Trying to implement Wal-Mart's key signature code.

I have this:

walmart.generate_signature = function (consumer_id, private_key, method, path) {
    private_key = '-----BEGIN PRIVATE KEY-----\n' + private_key + '\n-----END PRIVATE KEY-----';

    var key = ursa.createPrivateKey(new Buffer(private_key));
    var signer = ursa.createSigner('SHA256');
    var timestamp = (new Date()).getTime();

    var str = consumer_id + '\n' + path + '\n' + method + '\n' + timestamp + '\n';

    signer.update(str, 'utf8');

    return {
        timestamp: timestamp,
        hash: signer.sign(key, 'hex')
    };
};

As you can guess, it isn't right. Any insight?

quartzjer commented 8 years ago

I'm looking for a new maintainer: https://github.com/quartzjer/ursa#maintainer-needed