secrets

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportPrivateKeyPEM added in v1.3.1

func ExportPrivateKeyPEM(privateKey crypto.PrivateKey) ([]byte, error)

func ExportPublicKeyPEM added in v1.3.1

func ExportPublicKeyPEM(publicKey crypto.PublicKey) ([]byte, error)

func ExtractPublicKey added in v1.3.1

func ExtractPublicKey(privateKey crypto.PrivateKey) crypto.PublicKey

func GeneratePrivateKeyEthereum added in v1.3.1

func GeneratePrivateKeyEthereum() (crypto.PrivateKey, error)

func GetPublicKeyFromFile

func GetPublicKeyFromFile(file string) (string, error)

GetPublicKeyFromFile reads private/public keys pair from json file and return public key

func ImportPrivateKeyPEM added in v1.3.1

func ImportPrivateKeyPEM(pemEncoded []byte) (crypto.PrivateKey, error)

func ImportPublicKeyPEM added in v1.3.1

func ImportPublicKeyPEM(pemEncoded []byte) (crypto.PublicKey, error)

func MustConvertPrivateKeyToEcdsa added in v1.3.1

func MustConvertPrivateKeyToEcdsa(privateKey crypto.PrivateKey) *ecdsa.PrivateKey

func MustConvertPublicKeyToEcdsa added in v1.3.1

func MustConvertPublicKeyToEcdsa(publicKey crypto.PublicKey) *ecdsa.PublicKey

Types

type KeyPair

type KeyPair struct {
	Private crypto.PrivateKey
	Public  crypto.PublicKey
}

KeyPair holds private/public keys pair.

func GenerateKeyPair

func GenerateKeyPair() (*KeyPair, error)

GenerateKeyPair generates private/public keys pair. It uses default platform policy.

func ReadKeys

func ReadKeys(r io.Reader, publicOnly bool) (*KeyPair, error)

ReadKeysFile reads and parses json from reader, returns parsed private/public keys pair.

func ReadKeysFile

func ReadKeysFile(file string, publicOnly bool) (*KeyPair, error)

ReadKeysFile reads private/public keys pair from json file.

func ReadKeysFromDir

func ReadKeysFromDir(dir string) ([]*KeyPair, error)

ReadKeysFromDir reads directory, tries to parse every file in it as json with private/public keys pair returns list of parsed private/public keys pairs.

type KeyPairXCrypto added in v1.3.1

type KeyPairXCrypto struct {
	Private crypto.PrivateKey
	Public  crypto.PublicKey
}

KeyPairXCrypto holds private/public keys pair from x-crypto package.

func ReadXCryptoKeys added in v1.3.1

func ReadXCryptoKeys(r io.Reader, publicOnly bool) (*KeyPairXCrypto, error)

ReadXCryptoKeys reads and parses json from reader, returns parsed private/public keys pair.

func ReadXCryptoKeysFile added in v1.3.1

func ReadXCryptoKeysFile(file string, publicOnly bool) (*KeyPairXCrypto, error)

ReadXCryptoKeysFile reads private/public keys pair from json file.

Jump to

Keyboard shortcuts

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