key-encoder

command module
v0.0.0-...-67ffaa3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2019 License: MIT Imports: 5 Imported by: 0

README

Key Encoder

pipeline status coverage

Encode public and secret keys from PEM => Cryptocurrency specific formats to derive usable cryptocurrency keys from an HSM or other secure environment. Currently only supports Tezos key derivation.

Usage

# Install 
go install gitlab.com/polychainlabs/key-encoder

# Encode Keys
key-encoder keys/secp256k1.pem
> Curve:  Secp256k1: 1.3.132.0.10
> Tezos Secret Key:  spsk2rBBj5a6ahir2xZwbNkdeBuyZTxQZC9Pr6UvSAM4GNPeXfM3ix
> Tezos Public Key:  sppk7c9QAGWCJEvFWp6vGBs3VuxFax7GDwWQiPXR2rGSYPN7NMQN9rP
> Tezos Public Key Hash:  tz2PH72CdqfsBJRsDcGfUu3UvuXwEyzqzs3s

Develop

# Test 
go test ./...

# Run locally
go run encode.go keys/secp256k1.pem

Helpful OpenSSL Commands:

# p256
openssl ecparam -genkey -name prime256v1 -outform pem      > p256.ec.pem
openssl ec -in p256.ec.pem -outform der                    > p256.ec.der
openssl pkcs8 -topk8 -nocrypt -in p256.ec.pem -outform der > p256.pkcs8.der
openssl ec -in p256.ec.pem -pubout                         > p256.pub

# secp256k1
openssl ecparam -genkey -name secp256k1 -outform pem            > secp256k1.ec.pem
openssl ec -in secp256k1.ec.pem -outform der                    > secp256k1.ec.der
openssl pkcs8 -topk8 -nocrypt -in secp256k1.ec.pem -outform der > secp256k1.pkcs8.der
openssl ec -in secp256k1.ec.pem -pubout                         > secp256k1.pub

# ed25519 (Requires OpenSSL 1.1.1+)
openssl genpkey -algorithm ed25519 -outform PEM                  > ed25519.pkcs8.pem
openssl pkcs8 -topk8 -nocrypt -in ed25519.pkcs8.pem -outform der > ed25519.pkcs8.der

Future Work

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL