keypair

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeECDSAPublicKey

func DecodeECDSAPublicKey(publicKey []byte) (*ecdsa.PublicKey, error)

DecodeECDSAPublicKey parses the ecdsa public key

func DecodeRSAPublicKey

func DecodeRSAPublicKey(publicKey []byte) (*rsa.PublicKey, error)

DecodeRSAPublicKey parses the rsa public key.

Types

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

KeyPair saves the ecdsa private key or the rsa private key and provides a get public/private encoded bytes array method

func DecodePrivateKey

func DecodePrivateKey(keyType KeyType, privateKey []byte) (*KeyPair, error)

DecodePrivateKey parses the private key to a KeyPair.

func New

func New(keyType KeyType, privateKey interface{}) *KeyPair

func (*KeyPair) EncodedPrivateKey

func (k *KeyPair) EncodedPrivateKey() ([]byte, error)

EncodedPrivateKey gets the encoded private key

func (*KeyPair) EncodedPublicKey

func (k *KeyPair) EncodedPublicKey() ([]byte, error)

EncodedPublicKey gets the encoded public key

func (*KeyPair) GetEcdsaPrivateKey

func (k *KeyPair) GetEcdsaPrivateKey() (*ecdsa.PrivateKey, error)

GetEcdsaPrivateKey gets the ecdsa private key if you are using ecdsa signature algorithm to generate the private key

func (*KeyPair) GetRsaPrivateKey

func (k *KeyPair) GetRsaPrivateKey() (*rsa.PrivateKey, error)

GetRsaPrivateKey gets the rsa private key if you are using rsa signature algorithm to generate the private key

type KeyType

type KeyType int
const (
	RSA KeyType = iota
	ECDSA
)

Jump to

Keyboard shortcuts

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