Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-7831
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Oct 6, 2023
1 parent 67bf9ca commit 61e346e
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/RADSEC_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,48 +222,38 @@ namespace OpenWifi {
"-----END CERTIFICATE-----\n"
};

std::cout << __LINE__ << std::endl;
std::ofstream ofs{OpenRoamingRootCertFile_.path().c_str(),std::ios_base::trunc|std::ios_base::out|std::ios_base::binary};
ofs << OpenRoamingRootCert;
ofs.close();

std::cout << __LINE__ << std::endl;
Poco::Net::Context::Ptr SecureContext =
Poco::AutoPtr<Poco::Net::Context>(new Poco::Net::Context(
Poco::Net::Context::TLS_CLIENT_USE, ""));

std::cout << __LINE__ << std::endl;
if (Server_.allowSelfSigned) {
SecureContext->setSecurityLevel(Poco::Net::Context::SECURITY_LEVEL_NONE);
SecureContext->enableExtendedCertificateVerification(false);
}

std::cout << __LINE__ << std::endl;
SecureContext->usePrivateKey(Poco::Crypto::RSAKey("",KeyFile_.path(),""));
Poco::Crypto::X509Certificate Cert(CertFile_.path());
if(!IsExpired(Cert)) {
std::cout << __LINE__ << std::endl;
SecureContext->useCertificate(Poco::Crypto::X509Certificate(CertFile_.path()));
} else {
std::cout << __LINE__ << std::endl;
poco_error(Logger_, fmt::format("Certificate for {} has expired. We cannot connect to this server.", Server_.name));
return false;
}

std::cout << __LINE__ << std::endl;
SecureContext->addCertificateAuthority(Poco::Crypto::X509Certificate(OpenRoamingRootCertFile_.path()));
SecureContext->addChainCertificate(Poco::Crypto::X509Certificate(Intermediate0.path()));
SecureContext->addChainCertificate(Poco::Crypto::X509Certificate(Intermediate1.path()));
SecureContext->enableExtendedCertificateVerification(false);

std::cout << __LINE__ << std::endl;
Socket_ = std::make_unique<Poco::Net::SecureStreamSocket>(SecureContext);
std::cout << __LINE__ << std::endl;

Poco::Net::SocketAddress Destination(Server_.ip, Server_.port);

try {
std::cout << __LINE__ << std::endl;
poco_information(Logger_, "Attempting to connect");
Socket_->connect(Destination, Poco::Timespan(20, 0));
Socket_->completeHandshake();
Expand Down Expand Up @@ -305,7 +295,6 @@ namespace OpenWifi {
poco_warning(Logger_, "Could not connect.");
}
}
std::cout << __LINE__ << std::endl;
return false;
}

Expand Down

0 comments on commit 61e346e

Please sign in to comment.