1 // Copyright 2019 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 //////////////////////////////////////////////////////////////////////////////// 16 #ifndef TINK_SUBTLE_AEAD_TEST_UTIL_H_ 17 #define TINK_SUBTLE_AEAD_TEST_UTIL_H_ 18 19 #include "absl/strings/string_view.h" 20 #include "tink/aead.h" 21 #include "tink/aead/cord_aead.h" 22 #include "tink/util/status.h" 23 24 namespace crypto { 25 namespace tink { 26 27 // Encrypt, then decrypt. Any error will be propagated to the caller. Returns OK 28 // if the resulting decryption is equal to the plaintext. 29 crypto::tink::util::Status EncryptThenDecrypt(const Aead& encrypter, 30 const Aead& decrypter, 31 absl::string_view message, 32 absl::string_view aad); 33 34 // Encrypt, then decrypt. Any error will be propagated to the caller. Returns OK 35 // if the resulting decryption is equal to the plaintext. 36 crypto::tink::util::Status EncryptThenDecrypt(const CordAead& encrypter, 37 const CordAead& decrypter, 38 absl::string_view message, 39 absl::string_view aad); 40 41 } // namespace tink 42 } // namespace crypto 43 44 #endif // TINK_SUBTLE_AEAD_TEST_UTIL_H_ 45