use of java.util.Enumeration in project XobotOS by xamarin.
the class CommandLine method doHelp.
// Print the help message
private static void doHelp() {
System.err.print("usage: java -jar tagsoup-*.jar ");
System.err.print(" [ ");
boolean first = true;
for (Enumeration e = options.keys(); e.hasMoreElements(); ) {
if (!first) {
System.err.print("| ");
}
first = false;
String key = (String) (e.nextElement());
System.err.print(key);
if (key.endsWith("="))
System.err.print("?");
System.err.print(" ");
}
System.err.println("]*");
}
use of java.util.Enumeration in project XobotOS by xamarin.
the class ASN1Sequence method hashCode.
public int hashCode() {
Enumeration e = this.getObjects();
int hashCode = size();
while (e.hasMoreElements()) {
Object o = getNext(e);
hashCode *= 17;
hashCode ^= o.hashCode();
}
return hashCode;
}
use of java.util.Enumeration in project XobotOS by xamarin.
the class BERConstructedOctetString method fromSequence.
public static BERConstructedOctetString fromSequence(ASN1Sequence seq) {
Vector v = new Vector();
Enumeration e = seq.getObjects();
while (e.hasMoreElements()) {
v.addElement(e.nextElement());
}
return new BERConstructedOctetString(v);
}
use of java.util.Enumeration in project XobotOS by xamarin.
the class BERTaggedObject method encode.
void encode(DEROutputStream out) throws IOException {
if (out instanceof ASN1OutputStream || out instanceof BEROutputStream) {
out.writeTag(CONSTRUCTED | TAGGED, tagNo);
out.write(0x80);
if (!empty) {
if (!explicit) {
Enumeration e;
if (obj instanceof ASN1OctetString) {
if (obj instanceof BERConstructedOctetString) {
e = ((BERConstructedOctetString) obj).getObjects();
} else {
ASN1OctetString octs = (ASN1OctetString) obj;
BERConstructedOctetString berO = new BERConstructedOctetString(octs.getOctets());
e = berO.getObjects();
}
} else if (obj instanceof ASN1Sequence) {
e = ((ASN1Sequence) obj).getObjects();
} else if (obj instanceof ASN1Set) {
e = ((ASN1Set) obj).getObjects();
} else {
throw new RuntimeException("not implemented: " + obj.getClass().getName());
}
while (e.hasMoreElements()) {
out.writeObject(e.nextElement());
}
} else {
out.writeObject(obj);
}
}
out.write(0x00);
out.write(0x00);
} else {
super.encode(out);
}
}
use of java.util.Enumeration in project XobotOS by xamarin.
the class ASN1Dump method outputApplicationSpecific.
private static String outputApplicationSpecific(String type, String indent, boolean verbose, DERObject obj, String nl) {
DERApplicationSpecific app = (DERApplicationSpecific) obj;
StringBuffer buf = new StringBuffer();
if (app.isConstructed()) {
try {
ASN1Sequence s = ASN1Sequence.getInstance(app.getObject(DERTags.SEQUENCE));
buf.append(indent + type + " ApplicationSpecific[" + app.getApplicationTag() + "]" + nl);
for (Enumeration e = s.getObjects(); e.hasMoreElements(); ) {
_dumpAsString(indent + TAB, verbose, (DERObject) e.nextElement(), buf);
}
} catch (IOException e) {
buf.append(e);
}
return buf.toString();
}
return indent + type + " ApplicationSpecific[" + app.getApplicationTag() + "] (" + new String(Hex.encode(app.getContents())) + ")" + nl;
}
Aggregations