I am trying to perform following:
Generate Client Certificate,Key,Bundle Generate Server Certificate,Key,Bundle
And I am trying to perform:
-Client verification of server Certificate
-Server side verification of Client Certificate Using POCO-HTTPS.
Client verifies the certificate(Server) Successfully But Server Fails to Verify the Client certificate and i get "Certificate Validation Error Unacceptable certificate from 127.0.0.1: Application verification failure.
Used the https://jamielinux.com/docs/openssl-certificate-authority/sign-server-and-client-certificates.html for client and server certificate/key/CSR generation on Ubuntu Code:
Client Code:
**while(1){
try{
SharedPtr<PrivateKeyPassphraseHandler> pConsoleHandler = new KeyConsoleHandler(true);
SharedPtr<InvalidCertificateHandler> pInvalidCertHandler = new ConsoleCertificateHandler(true);
Poco::Net::Context::Ptr m_pContext = new Poco::Net::Context( Poco::Net::Context::CLIENT_USE,"client.key.pem","client.cert.pem","ca-chain.cert.pem",Poco::Net::Context::VERIFY_STRICT);
Poco::Net::SSLManager::instance().initializeClient(pConsoleHandler, pInvalidCertHandler, m_pContext);
Poco::Net::HTTPSClientSession *m_HTTPClientSession = new Poco::Net::HTTPSClientSession(host,65157,m_pContext);
std::string version("HTTP/1.1");
Poco::Net::HTTPRequest request("GET","/small",version);
request.setKeepAlive(m_HTTPClientSession->getKeepAlive());
request.write(std::cout);
std::ostream& outstream = m_HTTPClientSession->sendRequest(request);
Poco::Net::HTTPResponse response;
response.setKeepAlive(m_HTTPClientSession->getKeepAlive());
std::istream& respStream = m_HTTPClientSession->receiveResponse(response);
response.write(std::cout);
}
catch(Poco::Exception &exc)
{
std::cout << "::" << "HTTPClientConnection::ServiceConnection()" << "::" << " Exception while sending the request for client session ::" << exc.displayText().c_str() << std::endl;
}**
Server Code:
*try { SharedPtr pConsoleHandler = new KeyConsoleHandler(true); SharedPtr pInvalidCertHandler = new ConsoleCertificateHandler(true);
Poco::Net::Context::Ptr pServerContext = new Poco::Net::Context(
Poco::Net::Context::SERVER_USE,
"localhost.key.pem",
"localhost.cert.pem",
"ca-chain.cert.pem",
Poco::Net::Context::VERIFY_STRICT,
9,
true,
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
Poco::Net::SSLManager::instance().initializeServer(pConsoleHandler,pInvalidCertHandler,pServerContext);
HTTPSTestServer srv(pServerContext);
int port = srv.port();
std::cout << "Port on which it is listening:: " << port << std::endl;
while(1){}
}
catch(Poco::Exception &exc)
{
std::cout << "::" << "HTTPClientConnection::ServiceConnection()" << "::" << " Exception while sending the request for client session ::" << exc.displayText().c_str() << std::endl;
}
return 0;*