Seal rekeys if nonce[2:8] is different than in the last call, masks the nonce, and calls Seal for aes128gcm.
(dst, nonce, plaintext, additionalData []byte)
| 68 | // Seal rekeys if nonce[2:8] is different than in the last call, masks the nonce, |
| 69 | // and calls Seal for aes128gcm. |
| 70 | func (s *rekeyAEAD) Seal(dst, nonce, plaintext, additionalData []byte) []byte { |
| 71 | if err := s.rekeyIfRequired(nonce); err != nil { |
| 72 | panic(fmt.Sprintf("Rekeying failed with: %s", err.Error())) |
| 73 | } |
| 74 | maskNonce(s.nonceBuf, nonce, s.nonceMask) |
| 75 | return s.gcmAEAD.Seal(dst, s.nonceBuf, plaintext, additionalData) |
| 76 | } |
| 77 | |
| 78 | // Open rekeys if nonce[2:8] is different than in the last call, masks the nonce, |
| 79 | // and calls Open for aes128gcm. |