MCPcopy Create free account
hub / github.com/apache/thrift / loadPrivateKey

Method loadPrivateKey

lib/cpp/src/thrift/transport/TSSLSocket.cpp:1019–1032  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1017}
1018
1019void 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
1034void TSSLSocketFactory::loadPrivateKeyFromBuffer(const char* aPrivateKey, const char* format) {
1035 if (aPrivateKey == nullptr || format == nullptr) {

Callers 8

serverMethod · 0.80
clientMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 4

buildErrorsFunction · 0.85
TSSLExceptionClass · 0.85
TTransportExceptionClass · 0.70
getMethod · 0.45

Tested by 8

serverMethod · 0.64
clientMethod · 0.64
mainFunction · 0.64
mainFunction · 0.64