Search in sources :

Example 61 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class CRLDistributionPointsExtension method encodeThis.

// Encode this extension value
private void encodeThis() throws IOException {
    if (distributionPoints.isEmpty()) {
        this.extensionValue = null;
    } else {
        DerOutputStream pnts = new DerOutputStream();
        for (DistributionPoint point : distributionPoints) {
            point.encode(pnts);
        }
        DerOutputStream seq = new DerOutputStream();
        seq.write(DerValue.tag_Sequence, pnts);
        this.extensionValue = seq.toByteArray();
    }
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 62 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class CRLDistributionPointsExtension method encode.

/**
 * Write the extension to the DerOutputStream.
 * (Also called by the subclass)
 */
protected void encode(OutputStream out, ObjectIdentifier extensionId, boolean isCritical) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    if (this.extensionValue == null) {
        this.extensionId = extensionId;
        this.critical = isCritical;
        encodeThis();
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 63 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class IssuingDistributionPointExtension method encode.

/**
 * Encodes the issuing distribution point extension and writes it to the
 * DerOutputStream.
 *
 * @param out the output stream.
 * @exception IOException on encoding error.
 */
public void encode(OutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    if (this.extensionValue == null) {
        this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id;
        this.critical = false;
        encodeThis();
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 64 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class IssuingDistributionPointExtension method encodeThis.

// Encodes this extension value
private void encodeThis() throws IOException {
    if (distributionPoint == null && revocationReasons == null && !hasOnlyUserCerts && !hasOnlyCACerts && !hasOnlyAttributeCerts && !isIndirectCRL) {
        this.extensionValue = null;
        return;
    }
    DerOutputStream tagged = new DerOutputStream();
    if (distributionPoint != null) {
        DerOutputStream tmp = new DerOutputStream();
        distributionPoint.encode(tmp);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_DISTRIBUTION_POINT), tmp);
    }
    if (hasOnlyUserCerts) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putBoolean(hasOnlyUserCerts);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ONLY_USER_CERTS), tmp);
    }
    if (hasOnlyCACerts) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putBoolean(hasOnlyCACerts);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ONLY_CA_CERTS), tmp);
    }
    if (revocationReasons != null) {
        DerOutputStream tmp = new DerOutputStream();
        revocationReasons.encode(tmp);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ONLY_SOME_REASONS), tmp);
    }
    if (isIndirectCRL) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putBoolean(isIndirectCRL);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_INDIRECT_CRL), tmp);
    }
    if (hasOnlyAttributeCerts) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putBoolean(hasOnlyAttributeCerts);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ONLY_ATTRIBUTE_CERTS), tmp);
    }
    DerOutputStream seq = new DerOutputStream();
    seq.write(DerValue.tag_Sequence, tagged);
    this.extensionValue = seq.toByteArray();
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 65 with DerOutputStream

use of sun.security.util.DerOutputStream in project j2objc by google.

the class PKCS9Attributes method generateDerEncoding.

private byte[] generateDerEncoding() throws IOException {
    DerOutputStream out = new DerOutputStream();
    Object[] attribVals = attributes.values().toArray();
    out.putOrderedSetOf(DerValue.tag_SetOf, castToDerEncoder(attribVals));
    return out.toByteArray();
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Aggregations

DerOutputStream (sun.security.util.DerOutputStream)125 IOException (java.io.IOException)17 DerValue (sun.security.util.DerValue)11 CertificateEncodingException (java.security.cert.CertificateEncodingException)9 CertificateException (java.security.cert.CertificateException)9 X509Certificate (java.security.cert.X509Certificate)9 ObjectIdentifier (sun.security.util.ObjectIdentifier)9 AlgorithmId (sun.security.x509.AlgorithmId)7 KeyStoreException (java.security.KeyStoreException)6 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)6 UnrecoverableEntryException (java.security.UnrecoverableEntryException)6 UnrecoverableKeyException (java.security.UnrecoverableKeyException)6 SecretKey (javax.crypto.SecretKey)6 DestroyFailedException (javax.security.auth.DestroyFailedException)6 ContentInfo (sun.security.pkcs.ContentInfo)6 BitArray (sun.security.util.BitArray)6 Date (java.util.Date)4 PKCS7 (sun.security.pkcs.PKCS7)4 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)3 InvalidKeyException (java.security.InvalidKeyException)3