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();
}
}
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);
}
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);
}
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);
}
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();
}
}
Aggregations