xcrypto

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCreateAESCypher      = errors.New("ErrCreateAESCypher")
	ErrCreateAESGCM         = errors.New("ErrCreateAESGCM")
	ErrAESGCMEncrypt        = errors.New("ErrAESGCMEncrypt")
	ErrCypherTestIsTooShort = errors.New("ErrCypherTestIsTooShort")
	ErrAESGCMDecrypt        = errors.New("ErrAESGCMDecrypt")
)

Functions

func RandomBytes

func RandomBytes(n int) ([]byte, error)

RandomBytes create n bytes using crypto/rand

Types

type AesGcmCypher

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

AesGcmCypher implements the AES GCM

func NewAesGcmCypher

func NewAesGcmCypher(key string) (*AesGcmCypher, error)

NewAesGcmCypher creates the intance of AesGcmCypher

func (*AesGcmCypher) Decrypt

func (c *AesGcmCypher) Decrypt(ct []byte) ([]byte, error)

Decrypt the data

func (*AesGcmCypher) Encrypt

func (c *AesGcmCypher) Encrypt(pt []byte) ([]byte, error)

Encrypt the data

type Cipher

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

Cipher provides the interface to encrypt and decrypt the secrets

Jump to

Keyboard shortcuts

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