key-encoder-js
key-encoder-js copied to clipboard
How to make raw keys
I need to make pem encoded secp256k1 keys.
I do this:
var KeyEncoder = require('key-encoder'),
keyEncoder = new KeyEncoder('secp256k1')
How I create raw keys from here?
I first have to make these raw keys from here and then encode them in Pem format with keyEncoder.encodePrivate and keyEncoder.encodePublic?
In this library, a raw key is a hex string. For secp256k1, you'll see it start with hex bytes 02, 03 or 04 and be either 33 or 65 bytes (66 or 130 hex chars) long. For a description of that curve and an example of a hex point, see: https://en.bitcoin.it/wiki/Secp256k1. For a library that allows you to manipulate points, see: https://github.com/indutny/elliptic