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

Unable to sign data #13

@nolags

Description

@nolags

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions