| 1017 | } |
| 1018 | |
| 1019 | void TSSLSocketFactory::loadPrivateKey(const char* path, const char* format) { |
| 1020 | if (path == nullptr || format == nullptr) { |
| 1021 | throw TTransportException(TTransportException::BAD_ARGS, |
| 1022 | "loadPrivateKey: either <path> or <format> is nullptr"); |
| 1023 | } |
| 1024 | if (strcmp(format, "PEM") == 0) { |
| 1025 | if (SSL_CTX_use_PrivateKey_file(ctx_->get(), path, SSL_FILETYPE_PEM) == 0) { |
| 1026 | int errno_copy = THRIFT_GET_SOCKET_ERROR; |
| 1027 | string errors; |
| 1028 | buildErrors(errors, errno_copy); |
| 1029 | throw TSSLException("SSL_CTX_use_PrivateKey_file: " + errors); |
| 1030 | } |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | void TSSLSocketFactory::loadPrivateKeyFromBuffer(const char* aPrivateKey, const char* format) { |
| 1035 | if (aPrivateKey == nullptr || format == nullptr) { |