| 175 | } |
| 176 | |
| 177 | int32_t AesEncryptor::AesEncryptorImpl::SignedFooterEncrypt( |
| 178 | std::span<const uint8_t> footer, std::span<const uint8_t> key, |
| 179 | std::span<const uint8_t> aad, std::span<const uint8_t> nonce, |
| 180 | std::span<uint8_t> encrypted_footer) { |
| 181 | if (static_cast<size_t>(key_length_) != key.size()) { |
| 182 | std::stringstream ss; |
| 183 | ss << "Wrong key length " << key.size() << ". Should be " << key_length_; |
| 184 | throw ParquetException(ss.str()); |
| 185 | } |
| 186 | |
| 187 | if (encrypted_footer.size() != footer.size() + ciphertext_size_delta_) { |
| 188 | std::stringstream ss; |
| 189 | ss << "Encrypted footer buffer length " << encrypted_footer.size() |
| 190 | << " does not match expected length " << (footer.size() + ciphertext_size_delta_); |
| 191 | throw ParquetException(ss.str()); |
| 192 | } |
| 193 | |
| 194 | if (kGcmMode != aes_mode_) { |
| 195 | throw ParquetException("Must use AES GCM (metadata) encryptor"); |
| 196 | } |
| 197 | |
| 198 | return GcmEncrypt(footer, key, nonce, aad, encrypted_footer); |
| 199 | } |
| 200 | |
| 201 | int32_t AesEncryptor::AesEncryptorImpl::Encrypt(std::span<const uint8_t> plaintext, |
| 202 | std::span<const uint8_t> key, |
no test coverage detected