Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

Unable to sign data #13

Open
nolags opened this issue Sep 26, 2016 · 0 comments
Open

Unable to sign data #13

nolags opened this issue Sep 26, 2016 · 0 comments

Comments

@nolags
Copy link

nolags commented Sep 26, 2016

I used the crypto library to create a private Key and sign data.
My code is following:

var KEY_START = '-----BEGIN EC PRIVATE KEY-----\n';
var KEY_END = '\n-----END EC PRIVATE KEY-----\n';
const ecdh = crypto.createECDH('brainpoolP512t1');
        ecdh.generateKeys();
        var key =KEY_START + ecdh.getPrivateKey('base64') + KEY_END;
        console.log(key);
        const sign = crypto.createSign('sha512');
        sign.update('abcdefg');
        var signature = sign.sign(key, 'hex');

        console.log(signature);

But i get the error:

Error: error:0D07207B:asn1 encoding routines:ASN1_get_object:header too long
    at Error (native)
    at Sign.sign (crypto.js:283:26)

Is this a problem with my key format?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant