Search in sources :

Example 86 with Certificate

use of com.beanit.asn1bean.compiler.pkix1explicit88.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());
}
Also used : CertificateBuilder(io.fabric8.certmanager.api.model.v1alpha2.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1alpha2.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1alpha2.Certificate) Test(org.junit.jupiter.api.Test)

Example 87 with Certificate

use of com.beanit.asn1bean.compiler.pkix1explicit88.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());
}
Also used : CertificateBuilder(io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1alpha3.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1alpha3.Certificate) Test(org.junit.jupiter.api.Test)

Example 88 with Certificate

use of com.beanit.asn1bean.compiler.pkix1explicit88.Certificate in project kubernetes-client by fabric8io.

the class V1alpha3CertificateCrudTest method shouldDeleteACertificate.

@Test
void shouldDeleteACertificate() {
    Certificate certificate3 = new CertificateBuilder().withNewMetadata().withName("cert3").endMetadata().build();
    client.v1alpha3().certificates().inNamespace("ns3").create(certificate3);
    Boolean deleted = client.v1alpha3().certificates().inNamespace("ns3").withName("cert3").delete();
    assertTrue(deleted);
}
Also used : CertificateBuilder(io.fabric8.certmanager.api.model.v1alpha3.CertificateBuilder) Certificate(io.fabric8.certmanager.api.model.v1alpha3.Certificate) Test(org.junit.jupiter.api.Test)

Example 89 with Certificate

use of com.beanit.asn1bean.compiler.pkix1explicit88.Certificate 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());
}
Also used : CertificateBuilder(io.fabric8.certmanager.api.model.v1beta1.CertificateBuilder) CertificateList(io.fabric8.certmanager.api.model.v1beta1.CertificateList) Certificate(io.fabric8.certmanager.api.model.v1beta1.Certificate) Test(org.junit.jupiter.api.Test)

Example 90 with Certificate

use of com.beanit.asn1bean.compiler.pkix1explicit88.Certificate in project snowflake-jdbc by snowflakedb.

the class SFTrustManager method validateRevocationStatus.

/**
 * Certificate Revocation checks
 *
 * @param chain chain of certificates attached.
 * @param peerHost Hostname of the server
 * @throws CertificateException if any certificate validation fails
 */
void validateRevocationStatus(X509Certificate[] chain, String peerHost) throws CertificateException {
    final List<Certificate> bcChain = convertToBouncyCastleCertificate(chain);
    final List<SFPair<Certificate, Certificate>> pairIssuerSubjectList = getPairIssuerSubject(bcChain);
    if (peerHost.startsWith("ocspssd")) {
        return;
    }
    if (ocspCacheServer.new_endpoint_enabled) {
        ocspCacheServer.resetOCSPResponseCacheServer(peerHost);
    }
    setOCSPResponseCacheServerURL();
    boolean isCached = isCached(pairIssuerSubjectList);
    if (useOCSPResponseCacheServer() && !isCached) {
        if (!ocspCacheServer.new_endpoint_enabled) {
            LOGGER.debug("Downloading OCSP response cache from the server. URL: {}", SF_OCSP_RESPONSE_CACHE_SERVER_URL_VALUE);
        } else {
            LOGGER.debug("Downloading OCSP response cache from the server. URL: {}", ocspCacheServer.SF_OCSP_RESPONSE_CACHE_SERVER);
        }
        try {
            readOcspResponseCacheServer();
        } catch (SFOCSPException ex) {
            LOGGER.debug("Error downloading OCSP Response from cache server : {}." + "OCSP Responses will be fetched directly from the CA OCSP" + "Responder ", ex.getMessage());
        }
    // if the cache is downloaded from the server, it should be written
    // to the file cache at all times.
    }
    executeRevocationStatusChecks(pairIssuerSubjectList, peerHost);
    if (WAS_CACHE_UPDATED.getAndSet(false)) {
        JsonNode input = encodeCacheToJSON();
        fileCacheManager.writeCacheFile(input);
    }
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) X509Certificate(java.security.cert.X509Certificate) Certificate(org.bouncycastle.asn1.x509.Certificate) SFPair(net.snowflake.client.util.SFPair)

Aggregations

Certificate (org.bouncycastle.asn1.x509.Certificate)53 IOException (java.io.IOException)40 X509Certificate (java.security.cert.X509Certificate)37 CertificateException (java.security.cert.CertificateException)27 File (java.io.File)11 Test (org.junit.Test)10 BigInteger (java.math.BigInteger)9 CertificateEncodingException (java.security.cert.CertificateEncodingException)9 TBSCertificate (org.bouncycastle.asn1.x509.TBSCertificate)9 Test (org.junit.jupiter.api.Test)9 Certificate (com.google.cloud.security.privateca.v1.Certificate)8 CertificateAuthorityServiceClient (com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient)8 SQLException (java.sql.SQLException)8 X500Name (org.bouncycastle.asn1.x500.X500Name)8 ASN1Encodable (org.bouncycastle.asn1.ASN1Encodable)7 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)7 Certificate (com.beanit.asn1bean.compiler.pkix1explicit88.Certificate)6 Extension (org.bouncycastle.asn1.x509.Extension)6 OperatorCreationException (org.bouncycastle.operator.OperatorCreationException)6 Date (java.util.Date)5