encrypt

package
v0.0.0-...-85b91c5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesGcmDecrypt

func AesGcmDecrypt(key, ciphertext []byte) ([]byte, error)

AesGcmDecrypt (from legacy package): decrypts ciphertext with the given key using AES in GCM mode. should be replaced.

func AesGcmEncrypt

func AesGcmEncrypt(key, plaintext []byte) ([]byte, error)

AesGcmEncrypt (from legacy package): encrypts plaintext with the given key using AES in GCM mode. should be replaced.

func AesGcmKey32Decrypt

func AesGcmKey32Decrypt(key, ciphertext []byte) ([]byte, error)

func AesGcmKey32Encrypt

func AesGcmKey32Encrypt(key, plaintext []byte) ([]byte, error)

func DecryptLicense

func DecryptLicense(cipherString string, sourceKey []byte, shiftKey byte, shiftArray []int64) ([]byte, error)

func DecryptWithSshKey

func DecryptWithSshKey(cipherText, privateKey string) ([]byte, error)

func EncryptLicense

func EncryptLicense(plainText, sourceKey []byte, shiftKey byte, shiftArray []int64) (string, error)

func EncryptWithSshKey

func EncryptWithSshKey(plainText, publicKey []byte) (string, error)

func GenerateSshKeyPairs

func GenerateSshKeyPairs() (string, string, error)

Types

type Aesgcm

type Aesgcm struct {
	Compat bool
	// contains filtered or unexported fields
}

Aesgcm provides an encrypter that uses the aesgcm encryption algorithm.

func (*Aesgcm) Decrypt

func (e *Aesgcm) Decrypt(ciphertext []byte) (string, error)

Decrypt decrypts the ciphertext using aesgcm.

func (*Aesgcm) Encrypt

func (e *Aesgcm) Encrypt(plaintext string) ([]byte, error)

Encrypt encrypts the plaintext using aesgcm.

type Encrypter

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

Encrypter provides database field encryption and decryption. Encrypted values are currently limited to strings, which is reflected in the interface design.

func New

func New(key string) (Encrypter, error)

New provides a new database field encrypter.

type None

type None struct{}

none is an encryption strategy that stores secret values in plain text. This is the default strategy when no key is specified.

func (*None) Decrypt

func (*None) Decrypt(ciphertext []byte) (string, error)

func (*None) Encrypt

func (*None) Encrypt(plaintext string) ([]byte, error)

Jump to

Keyboard shortcuts

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