Search in sources :

Example 81 with Enumeration

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("]*");
}
Also used : Enumeration(java.util.Enumeration)

Example 82 with Enumeration

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;
}
Also used : Enumeration(java.util.Enumeration)

Example 83 with Enumeration

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);
}
Also used : Enumeration(java.util.Enumeration) Vector(java.util.Vector)

Example 84 with Enumeration

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);
    }
}
Also used : Enumeration(java.util.Enumeration)

Example 85 with Enumeration

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;
}
Also used : ASN1Sequence(org.bouncycastle.asn1.ASN1Sequence) Enumeration(java.util.Enumeration) DERApplicationSpecific(org.bouncycastle.asn1.DERApplicationSpecific) IOException(java.io.IOException) DERBitString(org.bouncycastle.asn1.DERBitString) BERConstructedOctetString(org.bouncycastle.asn1.BERConstructedOctetString) DEROctetString(org.bouncycastle.asn1.DEROctetString) ASN1OctetString(org.bouncycastle.asn1.ASN1OctetString) DERBMPString(org.bouncycastle.asn1.DERBMPString) DERIA5String(org.bouncycastle.asn1.DERIA5String) DERUTF8String(org.bouncycastle.asn1.DERUTF8String) DERT61String(org.bouncycastle.asn1.DERT61String) DERPrintableString(org.bouncycastle.asn1.DERPrintableString) DERVisibleString(org.bouncycastle.asn1.DERVisibleString)

Aggregations

Enumeration (java.util.Enumeration)1418 IOException (java.io.IOException)247 ArrayList (java.util.ArrayList)183 File (java.io.File)122 Vector (java.util.Vector)98 Properties (java.util.Properties)97 HashMap (java.util.HashMap)96 List (java.util.List)89 URL (java.net.URL)74 HashSet (java.util.HashSet)71 Map (java.util.Map)71 Hashtable (java.util.Hashtable)70 Iterator (java.util.Iterator)70 Set (java.util.Set)67 InputStream (java.io.InputStream)62 ZipEntry (java.util.zip.ZipEntry)62 ServletContext (javax.servlet.ServletContext)55 ZipFile (java.util.zip.ZipFile)51 FileInputStream (java.io.FileInputStream)48 ServletException (javax.servlet.ServletException)46