crypto

package
v0.0.0-...-80c7550 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrivKey

type PrivKey interface {
	GetPublic() PubKey
	Marshal() ([]byte, error)
	Decrypt(cipherText []byte, label []byte) ([]byte, error)
	Sign(data []byte) ([]byte, error)
	Hash() []byte
	HashString() string
}

PrivKey private key abstraction

func PrivateKeyNew

func PrivateKeyNew(random io.Reader, size int) (PrivKey, error)

PrivateKeyNew generate a new key

func UnmarshalPrivateKey

func UnmarshalPrivateKey(b []byte) (PrivKey, error)

UnmarshalPrivateKey parse a private key from bytes generated with PrivKey.Marshal

type PubKey

type PubKey interface {
	Marshal() ([]byte, error)
	Encrypt(data []byte, label []byte) ([]byte, error)
	Verify(data []byte, signature []byte) (bool, error)
	Hash() []byte
	HashString() string
}

PubKey public key abstraction

func UnmarshalPublicKey

func UnmarshalPublicKey(b []byte) (PubKey, error)

UnmarshalPublicKey parse a public key from bytes generated with PubKey.Marshal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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