~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to gnu/java/security/x509/ext/GeneralNames.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
import java.util.LinkedList;
53
53
import java.util.List;
54
54
 
 
55
import javax.security.auth.x500.X500Principal;
 
56
 
55
57
public class GeneralNames
56
58
{
57
59
 
81
83
    if (!nameList.isConstructed())
82
84
      throw new IOException("malformed GeneralNames");
83
85
    int len = 0;
 
86
    int i = 0;
84
87
    while (len < nameList.getLength())
85
88
      {
86
89
        DERValue name = der.read();
87
90
        List namePair = new ArrayList(2);
88
 
        if (name.getTagClass() != DER.APPLICATION)
89
 
          throw new IOException("malformed GeneralName");
 
91
        int tagClass = name.getTagClass();
 
92
        if (tagClass != DER.CONTEXT)
 
93
          throw new IOException("malformed GeneralName: Tag class is " + tagClass);
90
94
        namePair.add(new Integer(name.getTag()));
91
95
        DERValue val = null;
92
96
        switch (name.getTag())
99
103
            break;
100
104
 
101
105
          case OTHER_NAME:
 
106
            // MUST return the encoded bytes of the OID/OctetString sequence
 
107
            byte[] anotherName = name.getEncoded();
 
108
            anotherName[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE);
 
109
            namePair.add(anotherName);
 
110
            // DERReader goes back on Constructed things so we need to skip over them
 
111
            DERValue skip = der.read(); // skip OID
 
112
            skip = der.read(); // skip Octet String
 
113
            break;
 
114
            
102
115
          case EDI_PARTY_NAME:
103
116
            namePair.add(name.getValue());
104
117
            break;
106
119
          case DIRECTORY_NAME:
107
120
            byte[] b = name.getEncoded();
108
121
            b[0] = (byte) (DER.CONSTRUCTED|DER.SEQUENCE);
109
 
            namePair.add(new X500DistinguishedName(b).toString());
 
122
            DERReader r = new DERReader (b);
 
123
            r.read ();
 
124
            namePair.add(new X500Principal(r.read ().getEncoded ()).toString());
110
125
            break;
111
126
 
112
127
          case IP_ADDRESS: