(Java) Require that the Web Server's SSL Certificate is Non-Expired and the Signature is Valid
Demonstrates setting the RequireSslCertVerify property to require that the web server's SSL/TLS certificate is non-expired and that the certificate's signature is valid.
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// This example assumes the Chilkat HTTP API to have been previously unlocked.
// See Global Unlock Sample for sample code.
String url = "https://chilkatsoft.com";
CkHttp http = new CkHttp();
http.put_RequireSslCertVerify(true);
String html = http.quickGetStr(url);
if (http.get_LastMethodSuccess() != true) {
System.out.println(http.lastErrorText());
return;
}
System.out.println("Success.");
}
}
|