Versions in this module Expand all Collapse all v1 v1.0.1 Jun 17, 2021 v1.0.0 Mar 26, 2021 Changes in this version + const Ed25519 + const RSA + const Secp256k1 + var ErrBadKeyType = errors.New("invalid or unsupported key type") + func ConfigDecodeKey(b string) ([]byte, error) + func ConfigEncodeKey(b []byte) string + func GenerateEd25519Key(src io.Reader) (PrivKey, PubKey, error) + func GenerateKeyPair(typ, bits int) (PrivKey, PubKey, error) + func GenerateKeyPairWithReader(typ, bits int, src io.Reader) (PrivKey, PubKey, error) + func GenerateSecp256k1Key(src io.Reader) (PrivKey, PubKey, error) + func KeyEqual(k1, k2 Key) bool + func KeyStretcher(cipherType string, hashType string, secret []byte) (StretchedKeys, StretchedKeys) + func MarshalPrivateKey(k PrivKey) ([]byte, error) + func MarshalPublicKey(k PubKey) ([]byte, error) + func MarshalRsaPrivateKey(k *RsaPrivateKey) []byte + func MarshalRsaPublicKey(k *RsaPublicKey) ([]byte, error) + type Ed25519PrivateKey struct + func UnmarshalEd25519PrivateKey(data []byte) (*Ed25519PrivateKey, error) + func (k *Ed25519PrivateKey) Bytes() ([]byte, error) + func (k *Ed25519PrivateKey) Equals(o Key) bool + func (k *Ed25519PrivateKey) GetPublic() PubKey + func (k *Ed25519PrivateKey) Sign(msg []byte) ([]byte, error) + func (k *Ed25519PrivateKey) ToCurve25519() *[32]byte + type Ed25519PublicKey struct + func UnmarshalEd25519PublicKey(data []byte) (*Ed25519PublicKey, error) + func (k *Ed25519PublicKey) Bytes() ([]byte, error) + func (k *Ed25519PublicKey) Equals(o Key) bool + func (k *Ed25519PublicKey) ToCurve25519() (*[32]byte, error) + func (k *Ed25519PublicKey) Verify(data []byte, sig []byte) (bool, error) + type GenSharedKey func([]byte) ([]byte, error) + func GenerateEKeyPair(curveName string) ([]byte, GenSharedKey, error) + type Key interface + Bytes func() ([]byte, error) + Equals func(Key) bool + type PrivKey interface + GetPublic func() PubKey + Sign func([]byte) ([]byte, error) + func UnmarshalPrivateKey(data []byte) (PrivKey, error) + type PubKey interface + Verify func(data []byte, sig []byte) (bool, error) + func UnmarshalPublicKey(data []byte) (PubKey, error) + type RsaPrivateKey struct + func UnmarshalRsaPrivateKey(b []byte) (*RsaPrivateKey, error) + func (sk *RsaPrivateKey) Bytes() ([]byte, error) + func (sk *RsaPrivateKey) Decrypt(b []byte) ([]byte, error) + func (sk *RsaPrivateKey) Equals(k Key) bool + func (sk *RsaPrivateKey) GetPublic() PubKey + func (sk *RsaPrivateKey) Sign(message []byte) ([]byte, error) + type RsaPublicKey struct + func UnmarshalRsaPublicKey(b []byte) (*RsaPublicKey, error) + func (pk *RsaPublicKey) Bytes() ([]byte, error) + func (pk *RsaPublicKey) Encrypt(b []byte) ([]byte, error) + func (pk *RsaPublicKey) Equals(k Key) bool + func (pk *RsaPublicKey) Verify(data, sig []byte) (bool, error) + type Secp256k1PrivateKey btcec.PrivateKey + func UnmarshalSecp256k1PrivateKey(data []byte) (*Secp256k1PrivateKey, error) + func (k *Secp256k1PrivateKey) Bytes() ([]byte, error) + func (k *Secp256k1PrivateKey) Equals(o Key) bool + func (k *Secp256k1PrivateKey) GetPublic() PubKey + func (k *Secp256k1PrivateKey) Sign(data []byte) ([]byte, error) + type Secp256k1PublicKey btcec.PublicKey + func UnmarshalSecp256k1PublicKey(data []byte) (*Secp256k1PublicKey, error) + func (k *Secp256k1PublicKey) Bytes() ([]byte, error) + func (k *Secp256k1PublicKey) Equals(o Key) bool + func (k *Secp256k1PublicKey) Verify(data []byte, sigStr []byte) (bool, error) + type StretchedKeys struct + CipherKey []byte + IV []byte + MacKey []byte