use of com.vmware.photon.controller.model.support.CertificateInfo in project photon-model by vmware.
the class X509TrustManagerResolver method getCertificateInfoServiceErrorResponse.
/**
* @return {@link CertificateInfoServiceErrorResponse} for the untrusted certificate or {@code
* null} if the resolver was not called or the certificate is trusted
*/
public CertificateInfoServiceErrorResponse getCertificateInfoServiceErrorResponse() {
if (this.connectionCertificates.isEmpty()) {
return null;
}
X509Certificate[] chain = getCertificateChain();
String certificate = CertificateUtil.toPEMformat(chain);
Map<String, String> certProps = CertificateUtil.getCertificateInfoProperties(chain[0]);
CertificateInfo certificateInfo = CertificateInfo.of(certificate, certProps);
CertificateException certException = getCertificateException();
return CertificateInfoServiceErrorResponse.create(certificateInfo, Operation.STATUS_CODE_UNAVAILABLE, CertificateInfoServiceErrorResponse.ERROR_CODE_UNTRUSTED_CERTIFICATE, certException.getCause());
}
Aggregations