@@ -31,14 +31,18 @@ import (
31
31
32
32
// ALTSRecordCrypto is the interface for gRPC ALTS record protocol.
33
33
type ALTSRecordCrypto interface {
34
- // Encrypt encrypts the plaintext and computes the tag (if any) of dst
35
- // and plaintext. dst and plaintext may fully overlap or not at all.
34
+ // Encrypt encrypts the plaintext, computes the tag (if any) of dst and
35
+ // plaintext, and appends the result to dst, returning the updated slice.
36
+ // dst and plaintext may fully overlap or not at all.
36
37
Encrypt (dst , plaintext []byte ) ([]byte , error )
37
38
// EncryptionOverhead returns the tag size (if any) in bytes.
38
39
EncryptionOverhead () int
39
- // Decrypt decrypts ciphertext and verify the tag (if any). dst and
40
- // ciphertext may alias exactly or not at all. To reuse ciphertext's
41
- // storage for the decrypted output, use ciphertext[:0] as dst.
40
+ // Decrypt decrypts ciphertext and verifies the tag (if any). If successful,
41
+ // this function appends the resulting plaintext to dst, returning the
42
+ // updated slice. dst and ciphertext may alias exactly or not at all. To
43
+ // reuse ciphertext's storage for the decrypted output, use ciphertext[:0]
44
+ // as dst. Even if the function fails, the contents of dst, up to its
45
+ // capacity, may be overwritten.
42
46
Decrypt (dst , ciphertext []byte ) ([]byte , error )
43
47
}
44
48
0 commit comments