use of com.github.zhenwei.core.asn1.x509.CertificateList in project kubernetes-client by fabric8io.
the class V1alpha3CertificateCrudTest method shouldListAndGetCertificate.
@Test
void shouldListAndGetCertificate() {
Certificate certificate2 = new CertificateBuilder().withNewMetadata().withName("cert2").endMetadata().build();
client.v1alpha3().certificates().inNamespace("ns2").create(certificate2);
CertificateList certificateList = client.v1alpha3().certificates().inNamespace("ns2").list();
assertNotNull(certificateList);
assertEquals(1, certificateList.getItems().size());
}
use of com.github.zhenwei.core.asn1.x509.CertificateList in project kubernetes-client by fabric8io.
the class V1beta1CertificateCrudTest method shouldListAndGetCertificate.
@Test
void shouldListAndGetCertificate() {
Certificate certificate2 = new CertificateBuilder().withNewMetadata().withName("cert2").endMetadata().build();
client.v1beta1().certificates().inNamespace("ns2").create(certificate2);
CertificateList certificateList = client.v1beta1().certificates().inNamespace("ns2").list();
assertNotNull(certificateList);
assertEquals(1, certificateList.getItems().size());
}
use of com.github.zhenwei.core.asn1.x509.CertificateList in project pri by secure-device-onboard.
the class OnDieSignatureValidator method checkRevocations.
private static boolean checkRevocations(List<Certificate> certificateList, OnDieCache onDieCache) {
// Check revocations first.
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X509");
for (Certificate cert : certificateList) {
X509Certificate x509cert = (X509Certificate) cert;
X509CertificateHolder certHolder = new X509CertificateHolder(x509cert.getEncoded());
CRLDistPoint cdp = CRLDistPoint.fromExtensions(certHolder.getExtensions());
if (cdp != null) {
DistributionPoint[] distPoints = cdp.getDistributionPoints();
for (DistributionPoint dp : distPoints) {
GeneralName[] generalNames = GeneralNames.getInstance(dp.getDistributionPoint().getName()).getNames();
for (GeneralName generalName : generalNames) {
byte[] crlBytes = onDieCache.getCrl(generalName.getName().toString());
if (crlBytes == null) {
LoggerFactory.getLogger(OnDieSignatureValidator.class).warn("CRL not found in cache for: " + generalName.getName().toString());
return false;
} else {
CRL crl = certificateFactory.generateCRL(new ByteArrayInputStream(crlBytes));
if (crl.isRevoked(cert)) {
return false;
}
}
}
}
}
}
} catch (IOException | CertificateException | CRLException ex) {
return false;
}
return true;
}
Aggregations