crypto

package
v1.10.4-0...-52d5685 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AESKEyLength = 32
	NonceLength  = 12
)
View Source
const Hasher = crypto.SHA256

Variables

This section is empty.

Functions

func KeysExist

func KeysExist(keysPath string) bool

func PrivatePath

func PrivatePath(keysPath string) string

Types

type KeyPair

type KeyPair struct {
	Path        string
	Bits        int
	PrivatePath string
	Private     *rsa.PrivateKey
	PrivatePEM  []byte
	PublicPath  string
	Public      *rsa.PublicKey
	PublicPEM   []byte
	// sha256 of PublicSSH
	Fingerprint    []byte
	FingerprintHex string
}

func FromPublicPEM

func FromPublicPEM(pubPEM string) (pair *KeyPair, err error)

func Load

func Load(keysPath string) (pair *KeyPair, err error)

func LoadOrCreate

func LoadOrCreate(keysPath string, bits int) (pair *KeyPair, err error)

func (*KeyPair) Decrypt

func (pair *KeyPair) Decrypt(ciphertext []byte) ([]byte, error)

func (*KeyPair) DecryptBlock

func (pair *KeyPair) DecryptBlock(block []byte) ([]byte, error)

func (*KeyPair) EncryptBlockFor

func (pair *KeyPair) EncryptBlockFor(block []byte, pubKey *rsa.PublicKey) ([]byte, error)

func (*KeyPair) EncryptFor

func (pair *KeyPair) EncryptFor(cleartext []byte, pubKey *rsa.PublicKey) ([]byte, error)

func (*KeyPair) Load

func (pair *KeyPair) Load() (err error)

func (*KeyPair) Save

func (pair *KeyPair) Save() (err error)

func (*KeyPair) Sign

func (pair *KeyPair) Sign(hash crypto.Hash, hashed []byte) ([]byte, error)

func (*KeyPair) SignMessage

func (pair *KeyPair) SignMessage(data []byte) ([]byte, error)

func (*KeyPair) Verify

func (pair *KeyPair) Verify(signature []byte, hasher crypto.Hash, hash []byte) error

func (*KeyPair) VerifyMessage

func (pair *KeyPair) VerifyMessage(data []byte, signature []byte) error

Jump to

Keyboard shortcuts

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