You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
I'm trying to convert ethereum private key to DER format but get an error. Below are the steps:
First I use web3 to create new ethereum account that has the following key:
private key = 0x45a84f0899393274a9aa0ba3b86277543fc7f3ac508390a3b492fb88ac189dd1
Run key-encoder code:
var KeyEncoder = require('key-encoder').default,
keyEncoder = new KeyEncoder('secp256k1')
var rawPrivateKey = '0x45a84f0899393274a9aa0ba3b86277543fc7f3ac508390a3b492fb88ac189dd1',
var pemPrivateKey = keyEncoder.encodePrivate(rawPrivateKey, 'raw', 'pem', 'pkcs8') //default is 'pkcs1'
console.log(pemPrivateKey)
I save it to eth_private.pem file. Then I try to use openssl tool to covnert it to DER with this command: openssl pkcs8 -inform PEM -outform DER -topk8 -nocrypt -in eth_private.pem -out eth_private.der