Search in sources :

Example 31 with CertID

use of com.github.zhenwei.core.asn1.ocsp.CertID in project snowflake-jdbc by snowflakedb.

the class SSDManager method getWildCardCertId.

SFTrustManager.OcspResponseCacheKey getWildCardCertId() {
    DigestCalculator digest = new SFTrustManager.SHA1DigestCalculator();
    AlgorithmIdentifier algo = digest.getAlgorithmIdentifier();
    ASN1OctetString nameHash = ASN1OctetString.getInstance("0");
    ASN1OctetString keyHash = ASN1OctetString.getInstance("0");
    ASN1Integer serial_number = ASN1Integer.getInstance(0);
    CertID cid = new CertID(algo, nameHash, keyHash, serial_number);
    SFTrustManager.OcspResponseCacheKey keyOcspResp = null;
    try {
        keyOcspResp = new SFTrustManager.OcspResponseCacheKey(ASN1OctetString.getInstance("0").getEncoded(), ASN1OctetString.getInstance("0").getEncoded(), ASN1Integer.getInstance(0).getValue());
    } catch (Throwable ex) {
        LOGGER.debug("Could not create wildcard certid as cache key");
        keyOcspResp = null;
    }
    return keyOcspResp;
}
Also used : ASN1OctetString(org.bouncycastle.asn1.ASN1OctetString) CertID(org.bouncycastle.asn1.ocsp.CertID) DigestCalculator(org.bouncycastle.operator.DigestCalculator) ASN1Integer(org.bouncycastle.asn1.ASN1Integer) AlgorithmIdentifier(org.bouncycastle.asn1.x509.AlgorithmIdentifier)

Example 32 with CertID

use of com.github.zhenwei.core.asn1.ocsp.CertID in project LinLong-Java by zhenwei1108.

the class CertBag method toASN1Primitive.

public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector(2);
    v.add(certId);
    v.add(new DERTaggedObject(0, certValue));
    return new DERSequence(v);
}
Also used : DERSequence(com.github.zhenwei.core.asn1.DERSequence) DERTaggedObject(com.github.zhenwei.core.asn1.DERTaggedObject) ASN1EncodableVector(com.github.zhenwei.core.asn1.ASN1EncodableVector)

Example 33 with CertID

use of com.github.zhenwei.core.asn1.ocsp.CertID in project LinLong-Java by zhenwei1108.

the class CertID method toASN1Primitive.

/**
 * Produce an object suitable for an ASN1OutputStream.
 * <pre>
 * CertID          ::=     SEQUENCE {
 *     hashAlgorithm       AlgorithmIdentifier,
 *     issuerNameHash      OCTET STRING, -- Hash of Issuer's DN
 *     issuerKeyHash       OCTET STRING, -- Hash of Issuers public key
 *     serialNumber        CertificateSerialNumber }
 * </pre>
 */
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector v = new ASN1EncodableVector(4);
    v.add(hashAlgorithm);
    v.add(issuerNameHash);
    v.add(issuerKeyHash);
    v.add(serialNumber);
    return new DERSequence(v);
}
Also used : DERSequence(com.github.zhenwei.core.asn1.DERSequence) ASN1EncodableVector(com.github.zhenwei.core.asn1.ASN1EncodableVector)

Aggregations

IOException (java.io.IOException)19 CertID (org.bouncycastle.asn1.ocsp.CertID)15 ASN1EncodableVector (com.github.zhenwei.core.asn1.ASN1EncodableVector)13 DERSequence (com.github.zhenwei.core.asn1.DERSequence)11 CertificateException (java.security.cert.CertificateException)7 X509Certificate (java.security.cert.X509Certificate)7 ASN1OctetString (com.github.zhenwei.core.asn1.ASN1OctetString)6 DEROctetString (com.github.zhenwei.core.asn1.DEROctetString)6 BigInteger (java.math.BigInteger)6 CertificateEncodingException (java.security.cert.CertificateEncodingException)6 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)5 NoSuchProviderException (java.security.NoSuchProviderException)5 ASN1BMPString (com.github.zhenwei.core.asn1.ASN1BMPString)4 ASN1ObjectIdentifier (com.github.zhenwei.core.asn1.ASN1ObjectIdentifier)4 DERBMPString (com.github.zhenwei.core.asn1.DERBMPString)4 Extension (org.bouncycastle.asn1.x509.Extension)4 ASN1Sequence (com.github.zhenwei.core.asn1.ASN1Sequence)3 BEROctetString (com.github.zhenwei.core.asn1.BEROctetString)3 DERTaggedObject (com.github.zhenwei.core.asn1.DERTaggedObject)3 CertID (com.github.zhenwei.core.asn1.ocsp.CertID)3