crypto

package
v0.0.0-...-cbb00c2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// KeySize is the size of the key used by this AEAD, in bytes.
	KeySize = 32

	// NonceSizeX is the size of the nonce used with the XChaCha20-Poly1305
	// variant of this AEAD, in bytes.
	NonceSizeX = 24

	SaltSize = 16

	MaxPlaintextSize = 10000000
)

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key []byte, cryptoText string) (pt string, err error)

Decrypt from base64 to decrypted string.

func DecryptCipherText

func DecryptCipherText(cipherText, rawKey, nonce, rawAuthenticatedData string) (result []byte, err error)

func Encrypt

func Encrypt(key []byte, text string) string

Encrypt string to base64 crypto using AES.

func EncryptString

func EncryptString(plainText, key, nonce, authenticatedData string, noBytes int) (result string, err error)

func GenerateItemKey

func GenerateItemKey(returnBytes int) string

func GenerateMasterKeyAndServerPassword004

func GenerateMasterKeyAndServerPassword004(input GenerateEncryptedPasswordInput) (masterKey, serverPassword string, err error)

func GenerateNonce

func GenerateNonce() []byte

func SplitContent

func SplitContent(in string) (version, nonce, cipherText, authenticatedData string)

Types

type GenerateEncryptedPasswordInput

type GenerateEncryptedPasswordInput struct {
	UserPassword  string
	Identifier    string
	PasswordNonce string
	Debug         bool
}

Jump to

Keyboard shortcuts

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