Search in sources :

Example 96 with DerOutputStream

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

the class OCSPNoCheckExtension method encode.

@Override
public void encode(OutputStream out) throws CertificateException, IOException {
    if (mCached == null) {
        DerOutputStream temp = new DerOutputStream();
        encode(temp);
    }
    out.write(mCached);
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream)

Example 97 with DerOutputStream

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

the class ContentInfo method encode.

public void encode(DerOutputStream out) throws IOException {
    DerOutputStream contentDerCode;
    DerOutputStream seq;
    DerValue taggedContent;
    contentDerCode = new DerOutputStream();
    content.encode(contentDerCode);
    // Add the [0] EXPLICIT tag in front of the content encoding
    taggedContent = new DerValue((byte) 0xA0, contentDerCode.toByteArray());
    seq = new DerOutputStream();
    seq.putOID(contentType);
    seq.putDerValue(taggedContent);
    out.write(DerValue.tag_Sequence, seq);
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) DerValue(org.mozilla.jss.netscape.security.util.DerValue)

Example 98 with DerOutputStream

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

the class NSCertTypeExtension 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();
    encodeThis();
    if (this.extensionValue == null) {
        this.extensionId = CertType_Id;
        this.critical = true;
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream)

Example 99 with DerOutputStream

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

the class CertificateScopeOfUseExtension method encodeThis.

private void encodeThis() throws IOException {
    try (DerOutputStream seq = new DerOutputStream();
        DerOutputStream tmp = new DerOutputStream()) {
        if (mEntries == null)
            throw new IOException("Invalid Scope Entries");
        for (int i = 0; i < mEntries.size(); i++) {
            CertificateScopeEntry se = mEntries.elementAt(i);
            se.encode(tmp);
        }
        seq.write(DerValue.tag_Sequence, tmp);
        this.extensionValue = seq.toByteArray();
    }
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) IOException(java.io.IOException)

Example 100 with DerOutputStream

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

the class GenericASN1Extension 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();
    try {
        if (this.extensionValue == null) {
            this.extensionId = new ObjectIdentifier(OID);
            this.critical = true;
            encodeThis();
        }
    } catch (ParseException e) {
    }
    super.encode(tmp);
    out.write(tmp.toByteArray());
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) ParseException(java.text.ParseException) ObjectIdentifier(org.mozilla.jss.netscape.security.util.ObjectIdentifier)

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