Search in sources :

Example 11 with BigInt

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

the class DSAParameters method engineGetEncoded.

@Override
protected byte[] engineGetEncoded() throws IOException {
    try (DerOutputStream out = new DerOutputStream()) {
        DerOutputStream bytes = new DerOutputStream();
        bytes.putInteger(new BigInt(p.toByteArray()));
        bytes.putInteger(new BigInt(q.toByteArray()));
        bytes.putInteger(new BigInt(g.toByteArray()));
        out.write(DerValue.tag_Sequence, bytes);
        return out.toByteArray();
    }
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) BigInt(org.mozilla.jss.netscape.security.util.BigInt)

Example 12 with BigInt

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

the class GeneralSubtree method encode.

/**
 * Encode the GeneralSubtree.
 *
 * @param out the DerOutputStream to encode this object to.
 */
public void encode(DerOutputStream out) throws IOException {
    DerOutputStream seq = new DerOutputStream();
    name.encode(seq);
    if (minimum != MIN_DEFAULT) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putInteger(new BigInt(minimum));
        seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_MIN), tmp);
    }
    if (maximum != -1) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putInteger(new BigInt(maximum));
        seq.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_MAX), tmp);
    }
    out.write(DerValue.tag_Sequence, seq);
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) BigInt(org.mozilla.jss.netscape.security.util.BigInt)

Example 13 with BigInt

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

the class PolicyConstraint method encode.

/**
 * Encode the object to the output stream.
 *
 * @param out the DerOutputStream to encode the object to.
 */
public void encode(DerOutputStream out) throws IOException {
    DerOutputStream tagged = new DerOutputStream();
    if (set != null) {
        DerOutputStream tmp = new DerOutputStream();
        set.encode(tmp);
        tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_SET), tmp);
    }
    if (require != -1) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putInteger(new BigInt(require));
        tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_REQUIRE), tmp);
    }
    if (inhibit != -1) {
        DerOutputStream tmp = new DerOutputStream();
        tmp.putInteger(new BigInt(inhibit));
        tagged.write(DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_INHIBIT), tmp);
    }
    out.write(DerValue.tag_Sequence, tagged);
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) BigInt(org.mozilla.jss.netscape.security.util.BigInt)

Example 14 with BigInt

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

the class NoticeReference method encode.

/**
 * Write the NoticeReference to the DerOutputStream.
 *
 * @param out the DerOutputStream to write the object to.
 * @exception IOException on errors.
 */
public void encode(DerOutputStream out) throws IOException {
    DerOutputStream tmp = new DerOutputStream();
    mOrg.encode(tmp);
    DerOutputStream iseq = new DerOutputStream();
    for (int i = 0; i < mNumbers.length; i++) {
        iseq.putInteger(new BigInt(mNumbers[i]));
    }
    tmp.write(DerValue.tag_Sequence, iseq);
    out.write(DerValue.tag_Sequence, tmp);
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) BigInt(org.mozilla.jss.netscape.security.util.BigInt)

Example 15 with BigInt

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

the class PolicyConstraintsExtension method encodeThis.

// Encode this extension value.
private void encodeThis() throws IOException {
    try (DerOutputStream seq = new DerOutputStream()) {
        DerOutputStream tagged = new DerOutputStream();
        if (require != -1) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putInteger(new BigInt(require));
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_REQUIRE), tmp);
        }
        if (inhibit != -1) {
            DerOutputStream tmp = new DerOutputStream();
            tmp.putInteger(new BigInt(inhibit));
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_INHIBIT), tmp);
        }
        seq.write(DerValue.tag_Sequence, tagged);
        extensionValue = seq.toByteArray();
    }
}
Also used : DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) BigInt(org.mozilla.jss.netscape.security.util.BigInt)

Aggregations

BigInt (org.mozilla.jss.netscape.security.util.BigInt)17 DerOutputStream (org.mozilla.jss.netscape.security.util.DerOutputStream)13 DerValue (org.mozilla.jss.netscape.security.util.DerValue)3 IOException (java.io.IOException)2 AlgorithmId (org.mozilla.jss.netscape.security.x509.AlgorithmId)2 BigInteger (java.math.BigInteger)1 SignatureException (java.security.SignatureException)1 CRLException (java.security.cert.CRLException)1 X509Certificate (java.security.cert.X509Certificate)1 RSAPublicKey (java.security.interfaces.RSAPublicKey)1 MGF1ParameterSpec (java.security.spec.MGF1ParameterSpec)1 PSSParameterSpec (java.security.spec.PSSParameterSpec)1 DerInputStream (org.mozilla.jss.netscape.security.util.DerInputStream)1 ObjectIdentifier (org.mozilla.jss.netscape.security.util.ObjectIdentifier)1 CertificateX509Key (org.mozilla.jss.netscape.security.x509.CertificateX509Key)1 X500Name (org.mozilla.jss.netscape.security.x509.X500Name)1 X509Key (org.mozilla.jss.netscape.security.x509.X509Key)1 PK11ECPublicKey (org.mozilla.jss.pkcs11.PK11ECPublicKey)1