1 /* Copyright 2018 The TensorFlow Authors. All Rights Reserved. 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 TENSORFLOW_CONTRIB_IGNITE_KERNELS_CLIENT_IGNITE_SSL_WRAPPER_H_ 17 #define TENSORFLOW_CONTRIB_IGNITE_KERNELS_CLIENT_IGNITE_SSL_WRAPPER_H_ 18 19 #include "tensorflow/contrib/ignite/kernels/client/ignite_client.h" 20 21 #include <openssl/ssl.h> 22 23 namespace tensorflow { 24 25 class SslWrapper : public Client { 26 public: 27 SslWrapper(std::shared_ptr<Client> client, string certfile, string keyfile, 28 string cert_password, bool big_endian); 29 ~SslWrapper(); 30 31 Status Connect() override; 32 Status Disconnect() override; 33 bool IsConnected() override; 34 int GetSocketDescriptor() override; 35 Status ReadData(uint8_t* buf, const int32_t length) override; 36 Status WriteData(const uint8_t* buf, const int32_t length) override; 37 38 private: 39 Status InitSslContext(); 40 41 std::shared_ptr<Client> client_; 42 string certfile_; 43 string keyfile_; 44 string cert_password_; 45 SSL_CTX* ctx_; 46 SSL* ssl_; 47 }; 48 49 } // namespace tensorflow 50 51 #endif // TENSORFLOW_CONTRIB_IGNITE_KERNELS_CLIENT_IGNITE_SSL_WRAPPER_H_ 52