Source Code Cross Referenced for ProfessionInfo.java in  » Security » Bouncy-Castle » org » bouncycastle » asn1 » isismtt » x509 » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Security » Bouncy Castle » org.bouncycastle.asn1.isismtt.x509 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.bouncycastle.asn1.isismtt.x509;
002:
003:        import org.bouncycastle.asn1.ASN1Encodable;
004:        import org.bouncycastle.asn1.ASN1EncodableVector;
005:        import org.bouncycastle.asn1.ASN1OctetString;
006:        import org.bouncycastle.asn1.ASN1Sequence;
007:        import org.bouncycastle.asn1.ASN1TaggedObject;
008:        import org.bouncycastle.asn1.DEREncodable;
009:        import org.bouncycastle.asn1.DERObject;
010:        import org.bouncycastle.asn1.DERObjectIdentifier;
011:        import org.bouncycastle.asn1.DEROctetString;
012:        import org.bouncycastle.asn1.DERPrintableString;
013:        import org.bouncycastle.asn1.DERSequence;
014:        import org.bouncycastle.asn1.DERTaggedObject;
015:        import org.bouncycastle.asn1.x500.DirectoryString;
016:
017:        import java.util.Enumeration;
018:
019:        /**
020:         * Professions, specializations, disciplines, fields of activity, etc.
021:         * 
022:         * <pre>
023:         *               ProfessionInfo ::= SEQUENCE 
024:         *               {
025:         *                 namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
026:         *                 professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
027:         *                 professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
028:         *                 registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
029:         *                 addProfessionInfo OCTET STRING OPTIONAL 
030:         *               }
031:         * </pre>
032:         * 
033:         * @see org.bouncycastle.asn1.isismtt.x509.AdmissionSyntax
034:         */
035:        public class ProfessionInfo extends ASN1Encodable {
036:
037:            /**
038:             * Rechtsanw�ltin
039:             */
040:            public static final DERObjectIdentifier Rechtsanwltin = new DERObjectIdentifier(
041:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
042:                            + ".1");
043:
044:            /**
045:             * Rechtsanwalt
046:             */
047:            public static final DERObjectIdentifier Rechtsanwalt = new DERObjectIdentifier(
048:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
049:                            + ".2");
050:
051:            /**
052:             * Rechtsbeistand
053:             */
054:            public static final DERObjectIdentifier Rechtsbeistand = new DERObjectIdentifier(
055:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
056:                            + ".3");
057:
058:            /**
059:             * Steuerberaterin
060:             */
061:            public static final DERObjectIdentifier Steuerberaterin = new DERObjectIdentifier(
062:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
063:                            + ".4");
064:
065:            /**
066:             * Steuerberater
067:             */
068:            public static final DERObjectIdentifier Steuerberater = new DERObjectIdentifier(
069:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
070:                            + ".5");
071:
072:            /**
073:             * Steuerbevollm�chtigte
074:             */
075:            public static final DERObjectIdentifier Steuerbevollmchtigte = new DERObjectIdentifier(
076:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
077:                            + ".6");
078:
079:            /**
080:             * Steuerbevollm�chtigter
081:             */
082:            public static final DERObjectIdentifier Steuerbevollmchtigter = new DERObjectIdentifier(
083:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
084:                            + ".7");
085:
086:            /**
087:             * Notarin
088:             */
089:            public static final DERObjectIdentifier Notarin = new DERObjectIdentifier(
090:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
091:                            + ".8");
092:
093:            /**
094:             * Notar
095:             */
096:            public static final DERObjectIdentifier Notar = new DERObjectIdentifier(
097:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
098:                            + ".9");
099:
100:            /**
101:             * Notarvertreterin
102:             */
103:            public static final DERObjectIdentifier Notarvertreterin = new DERObjectIdentifier(
104:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
105:                            + ".10");
106:
107:            /**
108:             * Notarvertreter
109:             */
110:            public static final DERObjectIdentifier Notarvertreter = new DERObjectIdentifier(
111:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
112:                            + ".11");
113:
114:            /**
115:             * Notariatsverwalterin
116:             */
117:            public static final DERObjectIdentifier Notariatsverwalterin = new DERObjectIdentifier(
118:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
119:                            + ".12");
120:
121:            /**
122:             * Notariatsverwalter
123:             */
124:            public static final DERObjectIdentifier Notariatsverwalter = new DERObjectIdentifier(
125:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
126:                            + ".13");
127:
128:            /**
129:             * Wirtschaftspr�ferin
130:             */
131:            public static final DERObjectIdentifier Wirtschaftsprferin = new DERObjectIdentifier(
132:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
133:                            + ".14");
134:
135:            /**
136:             * Wirtschaftspr�fer
137:             */
138:            public static final DERObjectIdentifier Wirtschaftsprfer = new DERObjectIdentifier(
139:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
140:                            + ".15");
141:
142:            /**
143:             * Vereidigte Buchpr�ferin
144:             */
145:            public static final DERObjectIdentifier VereidigteBuchprferin = new DERObjectIdentifier(
146:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
147:                            + ".16");
148:
149:            /**
150:             * Vereidigter Buchpr�fer
151:             */
152:            public static final DERObjectIdentifier VereidigterBuchprfer = new DERObjectIdentifier(
153:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
154:                            + ".17");
155:
156:            /**
157:             * Patentanw�ltin
158:             */
159:            public static final DERObjectIdentifier Patentanwltin = new DERObjectIdentifier(
160:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
161:                            + ".18");
162:
163:            /**
164:             * Patentanwalt
165:             */
166:            public static final DERObjectIdentifier Patentanwalt = new DERObjectIdentifier(
167:                    NamingAuthority.id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern
168:                            + ".19");
169:
170:            private NamingAuthority namingAuthority;
171:
172:            private ASN1Sequence professionItems;
173:
174:            private ASN1Sequence professionOIDs;
175:
176:            private String registrationNumber;
177:
178:            private ASN1OctetString addProfessionInfo;
179:
180:            public static ProfessionInfo getInstance(Object obj) {
181:                if (obj == null || obj instanceof  ProfessionInfo) {
182:                    return (ProfessionInfo) obj;
183:                }
184:
185:                if (obj instanceof  ASN1Sequence) {
186:                    return new ProfessionInfo((ASN1Sequence) obj);
187:                }
188:
189:                throw new IllegalArgumentException(
190:                        "illegal object in getInstance: "
191:                                + obj.getClass().getName());
192:            }
193:
194:            /**
195:             * Constructor from ASN1Sequence.
196:             * <p/>
197:             * <p/>
198:             * <pre>
199:             *               ProfessionInfo ::= SEQUENCE
200:             *               {
201:             *                 namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
202:             *                 professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
203:             *                 professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
204:             *                 registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
205:             *                 addProfessionInfo OCTET STRING OPTIONAL
206:             *               }
207:             * </pre>
208:             *
209:             * @param seq The ASN.1 sequence.
210:             */
211:            private ProfessionInfo(ASN1Sequence seq) {
212:                if (seq.size() > 5) {
213:                    throw new IllegalArgumentException("Bad sequence size: "
214:                            + seq.size());
215:                }
216:
217:                Enumeration e = seq.getObjects();
218:
219:                DEREncodable o = (DEREncodable) e.nextElement();
220:
221:                if (o instanceof  ASN1TaggedObject) {
222:                    if (((ASN1TaggedObject) o).getTagNo() != 0) {
223:                        throw new IllegalArgumentException("Bad tag number: "
224:                                + ((ASN1TaggedObject) o).getTagNo());
225:                    }
226:                    namingAuthority = NamingAuthority.getInstance(
227:                            (ASN1TaggedObject) o, true);
228:                    o = (DEREncodable) e.nextElement();
229:                }
230:
231:                professionItems = ASN1Sequence.getInstance(o);
232:
233:                if (e.hasMoreElements()) {
234:                    o = (DEREncodable) e.nextElement();
235:                    if (o instanceof  ASN1Sequence) {
236:                        professionOIDs = ASN1Sequence.getInstance(o);
237:                    } else if (o instanceof  DERPrintableString) {
238:                        registrationNumber = DERPrintableString.getInstance(o)
239:                                .getString();
240:                    } else if (o instanceof  ASN1OctetString) {
241:                        addProfessionInfo = ASN1OctetString.getInstance(o);
242:                    } else {
243:                        throw new IllegalArgumentException(
244:                                "Bad object encountered: " + o.getClass());
245:                    }
246:                }
247:                if (e.hasMoreElements()) {
248:                    o = (DEREncodable) e.nextElement();
249:                    if (o instanceof  DERPrintableString) {
250:                        registrationNumber = DERPrintableString.getInstance(o)
251:                                .getString();
252:                    } else if (o instanceof  DEROctetString) {
253:                        addProfessionInfo = (DEROctetString) o;
254:                    } else {
255:                        throw new IllegalArgumentException(
256:                                "Bad object encountered: " + o.getClass());
257:                    }
258:                }
259:                if (e.hasMoreElements()) {
260:                    o = (DEREncodable) e.nextElement();
261:                    if (o instanceof  DEROctetString) {
262:                        addProfessionInfo = (DEROctetString) o;
263:                    } else {
264:                        throw new IllegalArgumentException(
265:                                "Bad object encountered: " + o.getClass());
266:                    }
267:                }
268:
269:            }
270:
271:            /**
272:             * Constructor from given details.
273:             * <p/>
274:             * <code>professionItems</code> is mandatory, all other parameters are
275:             * optional.
276:             *
277:             * @param namingAuthority    The naming authority.
278:             * @param professionItems    Directory strings of the profession.
279:             * @param professionOIDs     DERObjectIdentfier objects for the
280:             *                           profession.
281:             * @param registrationNumber Registration number.
282:             * @param addProfessionInfo  Additional infos in encoded form.
283:             */
284:            public ProfessionInfo(NamingAuthority namingAuthority,
285:                    DirectoryString[] professionItems,
286:                    DERObjectIdentifier[] professionOIDs,
287:                    String registrationNumber, ASN1OctetString addProfessionInfo) {
288:                this .namingAuthority = namingAuthority;
289:                ASN1EncodableVector v = new ASN1EncodableVector();
290:                for (int i = 0; i != professionItems.length; i++) {
291:                    v.add(professionItems[i]);
292:                }
293:                this .professionItems = new DERSequence(v);
294:                if (professionOIDs != null) {
295:                    v = new ASN1EncodableVector();
296:                    for (int i = 0; i != professionOIDs.length; i++) {
297:                        v.add(professionOIDs[i]);
298:                    }
299:                    this .professionOIDs = new DERSequence(v);
300:                }
301:                this .registrationNumber = registrationNumber;
302:                this .addProfessionInfo = addProfessionInfo;
303:            }
304:
305:            /**
306:             * Produce an object suitable for an ASN1OutputStream.
307:             * <p/>
308:             * Returns:
309:             * <p/>
310:             * <pre>
311:             *               ProfessionInfo ::= SEQUENCE
312:             *               {
313:             *                 namingAuthority [0] EXPLICIT NamingAuthority OPTIONAL,
314:             *                 professionItems SEQUENCE OF DirectoryString (SIZE(1..128)),
315:             *                 professionOIDs SEQUENCE OF OBJECT IDENTIFIER OPTIONAL,
316:             *                 registrationNumber PrintableString(SIZE(1..128)) OPTIONAL,
317:             *                 addProfessionInfo OCTET STRING OPTIONAL
318:             *               }
319:             * </pre>
320:             *
321:             * @return a DERObject
322:             */
323:            public DERObject toASN1Object() {
324:                ASN1EncodableVector vec = new ASN1EncodableVector();
325:                if (namingAuthority != null) {
326:                    vec.add(new DERTaggedObject(true, 0, namingAuthority));
327:                }
328:                vec.add(professionItems);
329:                if (professionOIDs != null) {
330:                    vec.add(professionOIDs);
331:                }
332:                if (registrationNumber != null) {
333:                    vec.add(new DERPrintableString(registrationNumber, true));
334:                }
335:                if (addProfessionInfo != null) {
336:                    vec.add(addProfessionInfo);
337:                }
338:                return new DERSequence(vec);
339:            }
340:
341:            /**
342:             * @return Returns the addProfessionInfo.
343:             */
344:            public ASN1OctetString getAddProfessionInfo() {
345:                return addProfessionInfo;
346:            }
347:
348:            /**
349:             * @return Returns the namingAuthority.
350:             */
351:            public NamingAuthority getNamingAuthority() {
352:                return namingAuthority;
353:            }
354:
355:            /**
356:             * @return Returns the professionItems.
357:             */
358:            public DirectoryString[] getProfessionItems() {
359:                DirectoryString[] items = new DirectoryString[professionItems
360:                        .size()];
361:                int count = 0;
362:                for (Enumeration e = professionItems.getObjects(); e
363:                        .hasMoreElements();) {
364:                    items[count++] = DirectoryString.getInstance(e
365:                            .nextElement());
366:                }
367:                return items;
368:            }
369:
370:            /**
371:             * @return Returns the professionOIDs.
372:             */
373:            public DERObjectIdentifier[] getProfessionOIDs() {
374:                if (professionOIDs == null) {
375:                    return new DERObjectIdentifier[0];
376:                }
377:                DERObjectIdentifier[] oids = new DERObjectIdentifier[professionOIDs
378:                        .size()];
379:                int count = 0;
380:                for (Enumeration e = professionOIDs.getObjects(); e
381:                        .hasMoreElements();) {
382:                    oids[count++] = DERObjectIdentifier.getInstance(e
383:                            .nextElement());
384:                }
385:                return oids;
386:            }
387:
388:            /**
389:             * @return Returns the registrationNumber.
390:             */
391:            public String getRegistrationNumber() {
392:                return registrationNumber;
393:            }
394:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.