use of org.mozilla.jss.asn1.EXPLICIT in project jss by dogtagpki.
the class PKIArchiveOptions method encode.
/**
* DER-encodes a PKIArchiveOptions.
* @param implicitTag <b>This parameter is ignored.</b> A CHOICE cannot
* have an implicit tag.
*/
@Override
public void encode(Tag implicitTag, OutputStream ostream) throws IOException {
// no implicit tags on a CHOICE
assert (implicitTag.equals(tag));
if (type == ENCRYPTED_PRIV_KEY) {
// CHOICEs are always EXPLICITly tagged
EXPLICIT explicit = new EXPLICIT(new Tag(0), encryptedPrivKey);
explicit.encode(tag, ostream);
} else if (type == KEY_GEN_PARAMETERS) {
keyGenParameters.encode(tag, ostream);
} else {
assert (type == ARCHIVE_REM_GEN_PRIV_KEY);
(new BOOLEAN(archiveRemGenPrivKey)).encode(tag, ostream);
}
}
use of org.mozilla.jss.asn1.EXPLICIT in project jss by dogtagpki.
the class ProofOfPossession method encode.
@Override
public void encode(OutputStream ostream) throws IOException {
if (type == RA_VERIFIED) {
(new NULL()).encode(Tag.get(0), ostream);
} else if (type == SIGNATURE) {
signature.encode(Tag.get(1), ostream);
} else if (type == KEY_ENCIPHERMENT) {
// a CHOICE must be explicitly tagged
EXPLICIT e = new EXPLICIT(Tag.get(2), keyEncipherment);
e.encode(ostream);
} else {
assert (type == KEY_AGREEMENT);
// a CHOICE must be explicitly tagged
EXPLICIT e = new EXPLICIT(Tag.get(3), keyAgreement);
e.encode(ostream);
}
}
Aggregations