Source Code Cross Referenced for NamingAuthority.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.ASN1Sequence;
006:        import org.bouncycastle.asn1.ASN1TaggedObject;
007:        import org.bouncycastle.asn1.DEREncodable;
008:        import org.bouncycastle.asn1.DERIA5String;
009:        import org.bouncycastle.asn1.DERObject;
010:        import org.bouncycastle.asn1.DERObjectIdentifier;
011:        import org.bouncycastle.asn1.DERSequence;
012:        import org.bouncycastle.asn1.DERString;
013:        import org.bouncycastle.asn1.isismtt.ISISMTTObjectIdentifiers;
014:        import org.bouncycastle.asn1.x500.DirectoryString;
015:
016:        import java.util.Enumeration;
017:
018:        /**
019:         * Names of authorities which are responsible for the administration of title
020:         * registers.
021:         * 
022:         * <pre>
023:         *             NamingAuthority ::= SEQUENCE 
024:         *             {
025:         *               namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
026:         *               namingAuthorityUrl IA5String OPTIONAL,
027:         *               namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
028:         *             }
029:         * </pre>
030:         * @see org.bouncycastle.asn1.isismtt.x509.AdmissionSyntax
031:         * 
032:         */
033:        public class NamingAuthority extends ASN1Encodable {
034:
035:            /**
036:             * Profession OIDs should always be defined under the OID branch of the
037:             * responsible naming authority. At the time of this writing, the work group
038:             * �Recht, Wirtschaft, Steuern� (�Law, Economy, Taxes�) is registered as the
039:             * first naming authority under the OID id-isismtt-at-namingAuthorities.
040:             */
041:            public static final DERObjectIdentifier id_isismtt_at_namingAuthorities_RechtWirtschaftSteuern = new DERObjectIdentifier(
042:                    ISISMTTObjectIdentifiers.id_isismtt_at_namingAuthorities
043:                            + ".1");
044:
045:            private DERObjectIdentifier namingAuthorityId;
046:            private String namingAuthorityUrl;
047:            private DirectoryString namingAuthorityText;
048:
049:            public static NamingAuthority getInstance(Object obj) {
050:                if (obj == null || obj instanceof  NamingAuthority) {
051:                    return (NamingAuthority) obj;
052:                }
053:
054:                if (obj instanceof  ASN1Sequence) {
055:                    return new NamingAuthority((ASN1Sequence) obj);
056:                }
057:
058:                throw new IllegalArgumentException(
059:                        "illegal object in getInstance: "
060:                                + obj.getClass().getName());
061:            }
062:
063:            public static NamingAuthority getInstance(ASN1TaggedObject obj,
064:                    boolean explicit) {
065:                return getInstance(ASN1Sequence.getInstance(obj, explicit));
066:            }
067:
068:            /**
069:             * Constructor from ASN1Sequence.
070:             * <p/>
071:             * <p/>
072:             * <pre>
073:             *             NamingAuthority ::= SEQUENCE
074:             *             {
075:             *               namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
076:             *               namingAuthorityUrl IA5String OPTIONAL,
077:             *               namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
078:             *             }
079:             * </pre>
080:             *
081:             * @param seq The ASN.1 sequence.
082:             */
083:            private NamingAuthority(ASN1Sequence seq) {
084:
085:                if (seq.size() > 3) {
086:                    throw new IllegalArgumentException("Bad sequence size: "
087:                            + seq.size());
088:                }
089:
090:                Enumeration e = seq.getObjects();
091:
092:                if (e.hasMoreElements()) {
093:                    DEREncodable o = (DEREncodable) e.nextElement();
094:                    if (o instanceof  DERObjectIdentifier) {
095:                        namingAuthorityId = (DERObjectIdentifier) o;
096:                    } else if (o instanceof  DERIA5String) {
097:                        namingAuthorityUrl = DERIA5String.getInstance(o)
098:                                .getString();
099:                    } else if (o instanceof  DERString) {
100:                        namingAuthorityText = DirectoryString.getInstance(o);
101:                    } else {
102:                        throw new IllegalArgumentException(
103:                                "Bad object encountered: " + o.getClass());
104:                    }
105:                }
106:                if (e.hasMoreElements()) {
107:                    DEREncodable o = (DEREncodable) e.nextElement();
108:                    if (o instanceof  DERIA5String) {
109:                        namingAuthorityUrl = DERIA5String.getInstance(o)
110:                                .getString();
111:                    } else if (o instanceof  DERString) {
112:                        namingAuthorityText = DirectoryString.getInstance(o);
113:                    } else {
114:                        throw new IllegalArgumentException(
115:                                "Bad object encountered: " + o.getClass());
116:                    }
117:                }
118:                if (e.hasMoreElements()) {
119:                    DEREncodable o = (DEREncodable) e.nextElement();
120:                    if (o instanceof  DERString) {
121:                        namingAuthorityText = DirectoryString.getInstance(o);
122:                    } else {
123:                        throw new IllegalArgumentException(
124:                                "Bad object encountered: " + o.getClass());
125:                    }
126:
127:                }
128:            }
129:
130:            /**
131:             * @return Returns the namingAuthorityId.
132:             */
133:            public DERObjectIdentifier getNamingAuthorityId() {
134:                return namingAuthorityId;
135:            }
136:
137:            /**
138:             * @return Returns the namingAuthorityText.
139:             */
140:            public DirectoryString getNamingAuthorityText() {
141:                return namingAuthorityText;
142:            }
143:
144:            /**
145:             * @return Returns the namingAuthorityUrl.
146:             */
147:            public String getNamingAuthorityUrl() {
148:                return namingAuthorityUrl;
149:            }
150:
151:            /**
152:             * Constructor from given details.
153:             * <p/>
154:             * All parameters can be combined.
155:             *
156:             * @param namingAuthorityId   ObjectIdentifier for naming authority.
157:             * @param namingAuthorityUrl  URL for naming authority.
158:             * @param namingAuthorityText Textual representation of naming authority.
159:             */
160:            public NamingAuthority(DERObjectIdentifier namingAuthorityId,
161:                    String namingAuthorityUrl,
162:                    DirectoryString namingAuthorityText) {
163:                this .namingAuthorityId = namingAuthorityId;
164:                this .namingAuthorityUrl = namingAuthorityUrl;
165:                this .namingAuthorityText = namingAuthorityText;
166:            }
167:
168:            /**
169:             * Produce an object suitable for an ASN1OutputStream.
170:             * <p/>
171:             * Returns:
172:             * <p/>
173:             * <pre>
174:             *             NamingAuthority ::= SEQUENCE
175:             *             {
176:             *               namingAuthorityId OBJECT IDENTIFIER OPTIONAL,
177:             *               namingAuthorityUrl IA5String OPTIONAL,
178:             *               namingAuthorityText DirectoryString(SIZE(1..128)) OPTIONAL
179:             *             }
180:             * </pre>
181:             *
182:             * @return a DERObject
183:             */
184:            public DERObject toASN1Object() {
185:                ASN1EncodableVector vec = new ASN1EncodableVector();
186:                if (namingAuthorityId != null) {
187:                    vec.add(namingAuthorityId);
188:                }
189:                if (namingAuthorityUrl != null) {
190:                    vec.add(new DERIA5String(namingAuthorityUrl, true));
191:                }
192:                if (namingAuthorityText != null) {
193:                    vec.add(namingAuthorityText);
194:                }
195:                return new DERSequence(vec);
196:            }
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.