crypto

package
v0.0.0-...-ff8180c Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomKey

func GenerateRandomKey(size int) ([]byte, error)

GenerateRandomKey generates a random key of a given size

Types

type Cipher

type Cipher interface {
	Encrypt(plaintext []byte) ([]byte, error)
	Decrypt(ciphertext []byte) ([]byte, error)
}

type CipherSigner

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

func NewCipherSigner

func NewCipherSigner(cipher Cipher, signer Signer) *CipherSigner

func (*CipherSigner) DecryptAndVerify

func (cs *CipherSigner) DecryptAndVerify(ciphertext []byte) ([]byte, error)

func (*CipherSigner) EncryptAndSign

func (cs *CipherSigner) EncryptAndSign(plaintext []byte) ([]byte, error)

func (*CipherSigner) SignAndEncrypt

func (cs *CipherSigner) SignAndEncrypt(plaintext []byte) ([]byte, error)

func (*CipherSigner) VerifyAndDecrypt

func (cs *CipherSigner) VerifyAndDecrypt(ciphertext []byte) ([]byte, error)

type Signer

type Signer interface {
	Sign(plaintext []byte) ([]byte, error)
	Verifier
}

type Verifier

type Verifier interface {
	Verify(plaintext, signature []byte) error
	SignatureSize() int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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