key

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: BSD-3-Clause Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(ecdsaCurve string, rsaBits int) (priv interface{}, err error)

return a private key generated using rsa or ecdsa. if param ecdsaCurve is empty string, then rsa with 'rsaBits' will be used; otherwise corresponding ecdsa algorithm will be used and 'rsaBits' is ignored.

func PublicKey

func PublicKey(priv interface{}) interface{}

returns 'public part' of the passed asymmetric encryption algo key 'priv'

func ReadKey

func ReadKey(keyFile string) (priv interface{}, err error)

read and parse private key from 'keyFile', return the 'priv' key in the form of either *rsa.PrivateKey or *ecdsa.PrivateKey

func WriteKey

func WriteKey(keyFile string, priv interface{}) error

write private key 'priv' into 'keyFile' in ASN.1 DER format type of 'priv' can be *rsa.PrivateKey or *ecdsa.PrivateKey

Types

This section is empty.

Jump to

Keyboard shortcuts

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