use of com.google.cloud.security.privateca.v1.Certificate in project ddf by codice.
the class OcspCheckerTest method testGeneratingOcspRequest.
@Test
public void testGeneratingOcspRequest() throws Exception {
OcspChecker ocspChecker = new OcspChecker(factory, eventAdmin);
ocspChecker.setSecurityLogger(mock(SecurityLogger.class));
Certificate certificate = trustedCertBc;
OCSPReq ocspReq = ocspChecker.generateOcspRequest(certificate);
assertThat(ocspReq, is(notNullValue()));
assertThat(ocspReq.getRequestList()[0].getCertID().getSerialNumber(), equalTo(certificate.getSerialNumber().getValue()));
}
use of com.google.cloud.security.privateca.v1.Certificate in project LinLong-Java by zhenwei1108.
the class X509v3CertificateBuilder method copyAndAddExtension.
/**
* Add a given extension field for the standard extensions tag (tag 3) copying the extension value
* from another certificate.
*
* @param oid the OID defining the extension type.
* @param isCritical true if the copied extension is to be marked as critical, false otherwise.
* @param certHolder the holder for the certificate that the extension is to be copied from.
* @return this builder object.
*/
public X509v3CertificateBuilder copyAndAddExtension(ASN1ObjectIdentifier oid, boolean isCritical, X509CertificateHolder certHolder) {
Certificate cert = certHolder.toASN1Structure();
Extension extension = cert.getTBSCertificate().getExtensions().getExtension(oid);
if (extension == null) {
throw new NullPointerException("extension " + oid + " not present");
}
extGenerator.addExtension(oid, isCritical, extension.getExtnValue().getOctets());
return this;
}
use of com.google.cloud.security.privateca.v1.Certificate in project kubernetes-client by fabric8io.
the class V1CertificateCrudTest method shouldDeleteACertificate.
@Test
void shouldDeleteACertificate() {
Certificate certificate3 = new CertificateBuilder().withNewMetadata().withName("cert3").endMetadata().build();
client.v1().certificates().inNamespace("ns3").create(certificate3);
Boolean deleted = client.v1().certificates().inNamespace("ns3").withName("cert3").delete();
assertTrue(deleted);
}
use of com.google.cloud.security.privateca.v1.Certificate in project kubernetes-client by fabric8io.
the class V1alpha2CertificateCrudTest method shouldListAndGetCertificate.
@Test
void shouldListAndGetCertificate() {
Certificate certificate2 = new CertificateBuilder().withNewMetadata().withName("cert2").endMetadata().build();
client.v1alpha2().certificates().inNamespace("ns2").create(certificate2);
CertificateList certificateList = client.v1alpha2().certificates().inNamespace("ns2").list();
assertNotNull(certificateList);
assertEquals(1, certificateList.getItems().size());
}
use of com.google.cloud.security.privateca.v1.Certificate 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());
}
Aggregations