(key []byte, nonce []byte, plaintext []byte, aad []byte)
| 28 | } |
| 29 | |
| 30 | func 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 | |
| 43 | func DecryptAEAD(key []byte, nonce []byte, ciphertext []byte, aad []byte) ([]byte, error) { |
| 44 | blk, err := aes.NewCipher(key) |
no outgoing calls
no test coverage detected