上传者: 42151729
|
上传时间: 2022-02-11 15:08:09
|
文件大小: 7KB
|
文件类型: -
密钥转换
EC密钥的密钥转换工具支持secp256k1,secp384r1,secp521r1椭圆曲线密钥转换可以从rawKey转换为十六进制DER格式和PEM格式
当前仅支持secp384r1用法:
var keyConversion = require('key-conversion');
let rawPub = '04....';
let pubType = 'secp384r1'; //'secp384r1' or'secp521r1'
let pubDER = keyConversion.convertPublicKeyToDer(pubType, rawPub);
var pubPEM = keyConversion.convertPublicKeyToPem(pubType, rawPub);
let rawPrivate = 'e7...';
let privateTy