]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | // Licensed to the Apache Software Foundation (ASF) under one |
2 | // or more contributor license agreements. See the NOTICE file | |
3 | // distributed with this work for additional information | |
4 | // regarding copyright ownership. The ASF licenses this file | |
5 | // to you under the Apache License, Version 2.0 (the | |
6 | // "License"); you may not use this file except in compliance | |
7 | // with the License. You may obtain a copy of the License at | |
8 | // | |
9 | // http://www.apache.org/licenses/LICENSE-2.0 | |
10 | // | |
11 | // Unless required by applicable law or agreed to in writing, | |
12 | // software distributed under the License is distributed on an | |
13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | // KIND, either express or implied. See the License for the | |
15 | // specific language governing permissions and limitations | |
16 | // under the License. | |
17 | ||
18 | #include "parquet/encryption/encryption_internal.h" | |
19 | #include "parquet/exception.h" | |
20 | ||
21 | namespace parquet { | |
22 | namespace encryption { | |
23 | ||
24 | void ThrowOpenSSLRequiredException() { | |
25 | throw ParquetException( | |
26 | "Calling encryption method in Arrow/Parquet built without OpenSSL"); | |
27 | } | |
28 | ||
29 | class AesEncryptor::AesEncryptorImpl {}; | |
30 | ||
31 | AesEncryptor::~AesEncryptor() {} | |
32 | ||
33 | int AesEncryptor::SignedFooterEncrypt(const uint8_t* footer, int footer_len, | |
34 | const uint8_t* key, int key_len, const uint8_t* aad, | |
35 | int aad_len, const uint8_t* nonce, | |
36 | uint8_t* encrypted_footer) { | |
37 | ThrowOpenSSLRequiredException(); | |
38 | return -1; | |
39 | } | |
40 | ||
41 | void AesEncryptor::WipeOut() { ThrowOpenSSLRequiredException(); } | |
42 | ||
43 | int AesEncryptor::CiphertextSizeDelta() { | |
44 | ThrowOpenSSLRequiredException(); | |
45 | return -1; | |
46 | } | |
47 | ||
48 | int AesEncryptor::Encrypt(const uint8_t* plaintext, int plaintext_len, const uint8_t* key, | |
49 | int key_len, const uint8_t* aad, int aad_len, | |
50 | uint8_t* ciphertext) { | |
51 | ThrowOpenSSLRequiredException(); | |
52 | return -1; | |
53 | } | |
54 | ||
55 | AesEncryptor::AesEncryptor(ParquetCipher::type alg_id, int key_len, bool metadata) { | |
56 | ThrowOpenSSLRequiredException(); | |
57 | } | |
58 | ||
59 | class AesDecryptor::AesDecryptorImpl {}; | |
60 | ||
61 | int AesDecryptor::Decrypt(const uint8_t* plaintext, int plaintext_len, const uint8_t* key, | |
62 | int key_len, const uint8_t* aad, int aad_len, | |
63 | uint8_t* ciphertext) { | |
64 | ThrowOpenSSLRequiredException(); | |
65 | return -1; | |
66 | } | |
67 | ||
68 | void AesDecryptor::WipeOut() { ThrowOpenSSLRequiredException(); } | |
69 | ||
70 | AesDecryptor::~AesDecryptor() {} | |
71 | ||
72 | AesEncryptor* AesEncryptor::Make(ParquetCipher::type alg_id, int key_len, bool metadata, | |
73 | std::vector<AesEncryptor*>* all_encryptors) { | |
74 | return NULLPTR; | |
75 | } | |
76 | ||
77 | AesDecryptor::AesDecryptor(ParquetCipher::type alg_id, int key_len, bool metadata) { | |
78 | ThrowOpenSSLRequiredException(); | |
79 | } | |
80 | ||
81 | AesDecryptor* AesDecryptor::Make(ParquetCipher::type alg_id, int key_len, bool metadata, | |
82 | std::vector<AesDecryptor*>* all_decryptors) { | |
83 | return NULLPTR; | |
84 | } | |
85 | ||
86 | int AesDecryptor::CiphertextSizeDelta() { | |
87 | ThrowOpenSSLRequiredException(); | |
88 | return -1; | |
89 | } | |
90 | ||
91 | std::string CreateModuleAad(const std::string& file_aad, int8_t module_type, | |
92 | int16_t row_group_ordinal, int16_t column_ordinal, | |
93 | int16_t page_ordinal) { | |
94 | ThrowOpenSSLRequiredException(); | |
95 | return ""; | |
96 | } | |
97 | ||
98 | std::string CreateFooterAad(const std::string& aad_prefix_bytes) { | |
99 | ThrowOpenSSLRequiredException(); | |
100 | return ""; | |
101 | } | |
102 | ||
103 | void QuickUpdatePageAad(const std::string& AAD, int16_t new_page_ordinal) { | |
104 | ThrowOpenSSLRequiredException(); | |
105 | } | |
106 | ||
107 | void RandBytes(unsigned char* buf, int num) { ThrowOpenSSLRequiredException(); } | |
108 | ||
109 | } // namespace encryption | |
110 | } // namespace parquet |