Search in sources :

Example 36 with DerOutputStream

use of org.mozilla.jss.netscape.security.util.DerOutputStream in project jss by dogtagpki.

the class InhibitAnyPolicyExtension method encode.

@Override
public void encode(OutputStream out) throws IOException {
    try (DerOutputStream os = new DerOutputStream()) {
        DerOutputStream tmp = new DerOutputStream();
        if (this.extensionValue == null) {
            try {
                extensionId = ObjectIdentifier.getObjectIdentifier(OID);
            } catch (IOException e) {
            // never here
            }
            os.putInteger(mSkipCerts);
            this.extensionValue = os.toByteArray();
        }
        super.encode(tmp);
        out.write(tmp.toByteArray());
    }
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) IOException(java.io.IOException)

Example 37 with DerOutputStream

use of org.mozilla.jss.netscape.security.util.DerOutputStream in project jss by dogtagpki.

the class InhibitAnyPolicyExtension method encodeExtValue.

private void encodeExtValue() throws IOException {
    DerOutputStream out = new DerOutputStream();
    try {
        out.putInteger(mSkipCerts);
    } catch (IOException e) {
    } finally {
        out.close();
    }
    extensionValue = out.toByteArray();
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) IOException(java.io.IOException)

Example 38 with DerOutputStream

use of org.mozilla.jss.netscape.security.util.DerOutputStream in project jss by dogtagpki.

the class NSCertTypeExtension method encodeThis.

// Encode this extension value
private void encodeThis() throws IOException {
    try (DerOutputStream os = new DerOutputStream()) {
        os.putUnalignedBitString(mBitString);
        this.extensionValue = os.toByteArray();
    }
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream)

Example 39 with DerOutputStream

use of org.mozilla.jss.netscape.security.util.DerOutputStream in project jss by dogtagpki.

the class CertificateScopeOfUseExtension method encode.

/**
 * Write the extension to the DerOutputStream.
 *
 * @param out the DerOutputStream to write the extension to.
 * @exception IOException on encoding errors.
 */
@Override
public void encode(OutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    if (this.extensionValue == null) {
        encodeThis();
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream)

Example 40 with DerOutputStream

use of org.mozilla.jss.netscape.security.util.DerOutputStream in project jss by dogtagpki.

the class CertificateRenewalWindowExtension method encodeThis.

private void encodeThis() throws IOException {
    try (DerOutputStream seq = new DerOutputStream();
        DerOutputStream tmp = new DerOutputStream()) {
        tmp.putGeneralizedTime(mBeginTime);
        if (mEndTime != null) {
            tmp.putGeneralizedTime(mEndTime);
        }
        seq.write(DerValue.tag_Sequence, tmp);
        this.extensionValue = seq.toByteArray();
    }
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream)

Aggregations

DerOutputStream (org.mozilla.jss.netscape.security.util.DerOutputStream)141 IOException (java.io.IOException)37 BigInt (org.mozilla.jss.netscape.security.util.BigInt)13 DerValue (org.mozilla.jss.netscape.security.util.DerValue)8 ObjectIdentifier (org.mozilla.jss.netscape.security.util.ObjectIdentifier)8 CRLException (java.security.cert.CRLException)7 CertificateException (java.security.cert.CertificateException)7 InvalidKeyException (java.security.InvalidKeyException)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)5 ANY (org.mozilla.jss.asn1.ANY)5 InvalidBERException (org.mozilla.jss.asn1.InvalidBERException)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 KeyFactory (java.security.KeyFactory)3 SignatureException (java.security.SignatureException)3 CertificateEncodingException (java.security.cert.CertificateEncodingException)3 InvalidKeySpecException (java.security.spec.InvalidKeySpecException)3 NoSuchProviderException (java.security.NoSuchProviderException)2 Provider (java.security.Provider)2 PublicKey (java.security.PublicKey)2