C++
C++
Transition from Http.GetServerSslCert to Http.GetServerCert
See more HTTP Examples
Provides instructions for replacing deprecated GetServerSslCert method calls with GetServerCert.Chilkat C++ Downloads
#include <CkHttp.h>
#include <CkCert.h>
void ChilkatSample(void)
{
bool success = false;
CkHttp http;
const char *domain = "chilkatsoft.com";
int port = 443;
// ------------------------------------------------------------------------
// The GetServerSslCert method is deprecated:
CkCert *cert1 = http.GetServerSslCert(domain,port);
if (http.get_LastMethodSuccess() == false) {
std::cout << http.lastErrorText() << "\r\n";
return;
}
std::cout << cert1->subjectDN() << "\r\n";
delete cert1;
// ------------------------------------------------------------------------
// Do the equivalent using GetServerCert.
// Your application creates a new, empty certificate object which is passed
// in the last argument and filled with the server certificate upon success.
CkCert cert2;
success = http.GetServerCert(domain,port,cert2);
if (success == false) {
std::cout << http.lastErrorText() << "\r\n";
return;
}
std::cout << cert2.subjectDN() << "\r\n";
}