MCPcopy Create free account
hub / github.com/Mister-leo/fssh / EncryptAEAD

Function EncryptAEAD

internal/crypt/crypt.go:30–41  ·  view source on GitHub ↗
(key []byte, nonce []byte, plaintext []byte, aad []byte)

Source from the content-addressed store, hash-verified

28}
29
30func EncryptAEAD(key []byte, nonce []byte, plaintext []byte, aad []byte) ([]byte, error) {
31 blk, err := aes.NewCipher(key)
32 if err != nil {
33 return nil, err
34 }
35 aead, err := cipher.NewGCM(blk)
36 if err != nil {
37 return nil, err
38 }
39 ct := aead.Seal(nil, nonce, plaintext, aad)
40 return ct, nil
41}
42
43func DecryptAEAD(key []byte, nonce []byte, ciphertext []byte, aad []byte) ([]byte, error) {
44 blk, err := aes.NewCipher(key)

Callers 2

InitializeFunction · 0.92
SaveEncryptedRecordFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected