use of org.mozilla.jss.asn1.Tag in project omegat by omegat-org.
the class Handler method queueTag.
private void queueTag(String tag, Attributes attributes) {
Tag xmltag = null;
XMLIntactTag intacttag = null;
setTranslatableTag(tag, XMLUtils.convertAttributes(attributes));
setSpacePreservingTag(XMLUtils.convertAttributes(attributes));
if (!collectingIntactText()) {
if (isContentBasedTag(tag, XMLUtils.convertAttributes(attributes))) {
intacttag = new XMLContentBasedTag(dialect, this, tag, getShortcut(tag), dialect.getContentBasedTags().get(tag), attributes);
xmltag = intacttag;
intacttagName = tag;
intacttagAttributes = XMLUtils.convertAttributes(attributes);
} else if (isIntactTag(tag, XMLUtils.convertAttributes(attributes))) {
intacttag = new XMLIntactTag(dialect, this, tag, getShortcut(tag), attributes);
xmltag = intacttag;
intacttagName = tag;
intacttagAttributes = XMLUtils.convertAttributes(attributes);
}
}
if (xmltag == null) {
xmltag = new XMLTag(tag, getShortcut(tag), Tag.Type.BEGIN, attributes, this.translator);
xmlTagName.push(xmltag.getTag());
xmlTagAttributes.push(xmltag.getAttributes());
}
currEntry().add(xmltag);
if (intacttag != null) {
intacttagEntry = intacttag.getIntactContents();
}
if (!collectingIntactText()) {
for (int i = 0; i < xmltag.getAttributes().size(); i++) {
Attribute attr = xmltag.getAttributes().get(i);
if ((dialect.getTranslatableAttributes().contains(attr.getName()) || dialect.getTranslatableTagAttributes().containsPair(tag, attr.getName())) && dialect.validateTranslatableTagAttribute(tag, attr.getName(), xmltag.getAttributes())) {
attr.setValue(StringUtil.makeValidXML(translator.translate(StringUtil.unescapeXMLEntities(attr.getValue()), null)));
}
}
}
}
use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.
the class CRLDistributionPoint method encode.
@Override
public void encode(Tag implicitTag, OutputStream ostream) throws IOException {
SEQUENCE seq = new SEQUENCE();
DerOutputStream derOut;
try {
// is a CHOICE, the [0] tag is forced to be EXPLICIT.
if (fullName != null) {
EXPLICIT distPoint = new EXPLICIT(Tag.get(0), fullNameEncoding);
seq.addElement(distPoint);
} else if (relativeName != null) {
derOut = new DerOutputStream();
relativeName.encode(derOut);
ANY rn = new ANY(derOut.toByteArray());
EXPLICIT raw = new EXPLICIT(Tag.get(1), rn);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
raw.encode(bos);
ANY distPointName = new ANY(bos.toByteArray());
EXPLICIT distPoint = new EXPLICIT(Tag.get(0), distPointName);
seq.addElement(distPoint);
}
// Encodes the ReasonFlags.
if (reasons != null) {
derOut = new DerOutputStream();
derOut.putUnalignedBitString(reasons);
ANY raw = new ANY(derOut.toByteArray());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
raw.encodeWithAlternateTag(Tag.get(1), bos);
ANY reasonEncoding = new ANY(bos.toByteArray());
seq.addElement(Tag.get(1), reasonEncoding);
}
// Encodes the CRLIssuer
if (CRLIssuer != null) {
seq.addElement(Tag.get(2), CRLIssuerEncoding);
}
seq.encode(implicitTag, ostream);
} catch (InvalidBERException e) {
// the Sun encoding classes
throw new IOException(e.toString());
}
}
use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.
the class Attribute method encode.
@Override
public void encode(Tag implicit, OutputStream ostream) throws IOException {
SEQUENCE seq = new SEQUENCE();
seq.addElement(type);
seq.addElement(values);
seq.encode(implicit, ostream);
}
use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.
the class SignerInfo method encode.
@Override
public void encode(Tag tag, OutputStream ostream) throws IOException {
SEQUENCE sequence = new SEQUENCE();
sequence.addElement(version);
sequence.addElement(issuerAndSerialNumber);
sequence.addElement(digestAlgorithm);
if (authenticatedAttributes != null) {
sequence.addElement(new Tag(0), authenticatedAttributes);
}
sequence.addElement(digestEncryptionAlgorithm);
sequence.addElement(encryptedDigest);
if (unauthenticatedAttributes != null) {
sequence.addElement(new Tag(1), unauthenticatedAttributes);
}
sequence.encode(tag, ostream);
}
use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.
the class CMCStatusInfoV2 method encode.
@Override
public void encode(Tag implicitTag, OutputStream ostream) throws IOException {
SEQUENCE seq = new SEQUENCE();
seq.addElement(status);
seq.addElement(bodyList);
if (statusString != null) {
seq.addElement(statusString);
}
if (otherInfo != null) {
seq.addElement(otherInfo);
}
seq.encode(implicitTag, ostream);
}
Aggregations