Sertifika Doğrulama Kütüphanesi Kullanımı

Certificate Validation API, performs validation operation according to the validation policy file defined by the user. The time of the validation is specified by external parameter according to which revocation controls are applied. The certificates revoked before the given date is stated as invalid. For the validation in current time, the sample code is as follows:

ValidationSystem vs = CertificateValidation.createValidationSystem(policy);
vs.setBaseValidationTime(Calendar.getInstance());
CertificateStatusInfo csi = CertificateValidation.validateCertificate(vs, cert);

ValidationSystem vs = CertificateValidation.createValidationSystem(policy);
vs.setBaseValidationTime(DateTime.UtcNow);
CertificateStatusInfo csi = CertificateValidation.validateCertificate(vs, cert);

Interpreting Certificate Validation Result

Certificate validation operation creates CertificateStatusInfo object. By using its method toString(), you can get a textual validation result.The method getDetailedMessage() provides more detailed and user friendly result message. getCertificateStatus() returns the status of the certificate in the enumeration type of CertificateStatus. This enumeration can take values as below:

VALID Certificate is Valid.
REVOCATION_CHECK_FAILURE Certificate is revoked.
CERTIFICATE_SELF_CHECK_FAILURE Certificate is structually invalid.
NO_TRUSTED_CERT_FOUND No trusted certificate found.
PATH_VALIDATION_FAILURE No trusted certificate chain could be created. The root certificate is probably not in your trusted certificate list.
NOT_CHECKED Certificate revocation control coul not be performed.