Search in sources :

Example 11 with DerOutputStream

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

the class DistributionPointName method encode.

/**
     * Encodes the distribution point name and writes it to the DerOutputStream.
     *
     * @param out the output stream.
     * @exception IOException on encoding error.
     */
public void encode(DerOutputStream out) throws IOException {
    DerOutputStream theChoice = new DerOutputStream();
    if (fullName != null) {
        fullName.encode(theChoice);
        out.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME), theChoice);
    } else {
        relativeName.encode(theChoice);
        out.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_RELATIVE_NAME), theChoice);
    }
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 12 with DerOutputStream

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

the class ExtendedKeyUsageExtension method encodeThis.

// Encode this extension value.
private void encodeThis() throws IOException {
    if (keyUsages == null || keyUsages.isEmpty()) {
        this.extensionValue = null;
        return;
    }
    DerOutputStream os = new DerOutputStream();
    DerOutputStream tmp = new DerOutputStream();
    for (int i = 0; i < keyUsages.size(); i++) {
        tmp.putOID(keyUsages.elementAt(i));
    }
    os.write(DerValue.tag_Sequence, tmp);
    this.extensionValue = os.toByteArray();
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 13 with DerOutputStream

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

the class ExtendedKeyUsageExtension method encode.

/**
     * Write the extension to the DerOutputStream.
     *
     * @param out the DerOutputStream to write the extension to.
     * @exception IOException on encoding errors.
     */
public void encode(OutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    if (extensionValue == null) {
        extensionId = PKIXExtensions.ExtendedKeyUsage_Id;
        critical = false;
        encodeThis();
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Example 14 with DerOutputStream

use of sun.security.util.DerOutputStream in project OpenAM by OpenRock.

the class IssuingDistributionPointExtension method encodeThis.

// Encode this extension value
private void encodeThis() throws IOException {
    if (onlyContainsUserCerts && onlyContainsCACerts) {
        throw new IOException("onlyContainsUserCerts and " + "onlyContainsCACerts can't both be true");
    }
    DerOutputStream tagged = new DerOutputStream();
    // NOTE: only one of pointNames and pointRDN can be set
    if ((fullName != null) || (relativeName != null)) {
        DerOutputStream distributionPoint = new DerOutputStream();
        if (fullName != null) {
            DerOutputStream derOut = new DerOutputStream();
            fullName.encode(derOut);
            distributionPoint.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME), derOut);
        } else if (relativeName != null) {
            DerOutputStream derOut = new DerOutputStream();
            encodeRDN(relativeName, derOut);
            distributionPoint.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_REL_NAME), derOut);
        }
        tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_DIST_PT), distributionPoint);
    }
    if (onlyContainsUserCerts) {
        DerOutputStream doOnlyContainsUserCerts = new DerOutputStream();
        doOnlyContainsUserCerts.putBoolean(onlyContainsUserCerts);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ONLY_USER_CERTS), doOnlyContainsUserCerts);
    }
    if (onlyContainsCACerts) {
        DerOutputStream doOnlyContainsCACerts = new DerOutputStream();
        doOnlyContainsCACerts.putBoolean(onlyContainsCACerts);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_ONLY_CA_CERTS), doOnlyContainsCACerts);
    }
    if (reasonFlags != null) {
        DerOutputStream reasons = new DerOutputStream();
        BitArray rf = new BitArray(reasonFlags);
        reasons.putUnalignedBitString(rf);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_REASONS), reasons);
    }
    if (indirectCRL) {
        DerOutputStream doIndirectCRL = new DerOutputStream();
        doIndirectCRL.putBoolean(indirectCRL);
        tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_INDIRECT_CRL), doIndirectCRL);
    }
    this.extensionValue = tagged.toByteArray();
}
Also used : DerOutputStream(sun.security.util.DerOutputStream) IOException(java.io.IOException) BitArray(sun.security.util.BitArray)

Example 15 with DerOutputStream

use of sun.security.util.DerOutputStream in project OpenAM by OpenRock.

the class IssuingDistributionPointExtension method encode.

/**
     * Write the extension to the DerOutputStream.
     *
     * @param out the DerOutputStream to write the extension to.
     * @exception IOException on encoding errors.
     */
public void encode(OutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    if (this.extensionValue == null) {
        this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id;
        this.critical = true;
        encodeThis();
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(sun.security.util.DerOutputStream)

Aggregations

DerOutputStream (sun.security.util.DerOutputStream)79 IOException (java.io.IOException)9 DerValue (sun.security.util.DerValue)8 ObjectIdentifier (sun.security.util.ObjectIdentifier)6 CertificateException (java.security.cert.CertificateException)5 BitArray (sun.security.util.BitArray)5 X509Certificate (java.security.cert.X509Certificate)4 AlgorithmId (sun.security.x509.AlgorithmId)4 KeyStoreException (java.security.KeyStoreException)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 UnrecoverableEntryException (java.security.UnrecoverableEntryException)3 UnrecoverableKeyException (java.security.UnrecoverableKeyException)3 CertificateEncodingException (java.security.cert.CertificateEncodingException)3 Date (java.util.Date)3 SecretKey (javax.crypto.SecretKey)3 DestroyFailedException (javax.security.auth.DestroyFailedException)3 ContentInfo (sun.security.pkcs.ContentInfo)3 DerInputStream (sun.security.util.DerInputStream)3 PolicyQualifierInfo (java.security.cert.PolicyQualifierInfo)2 X509CertSelector (java.security.cert.X509CertSelector)2