Source Code Cross Referenced for SubjectDirectoryAttributes.java in  » Security » Bouncy-Castle » org » bouncycastle » asn1 » 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.x509 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.bouncycastle.asn1.x509;
002:
003:        import java.util.Enumeration;
004:        import java.util.Vector;
005:
006:        import org.bouncycastle.asn1.ASN1Encodable;
007:        import org.bouncycastle.asn1.ASN1EncodableVector;
008:        import org.bouncycastle.asn1.ASN1Sequence;
009:        import org.bouncycastle.asn1.DERObject;
010:        import org.bouncycastle.asn1.DERSequence;
011:
012:        /**
013:         * This extension may contain further X.500 attributes of the subject. See also
014:         * RFC 3039.
015:         * 
016:         * <pre>
017:         *     SubjectDirectoryAttributes ::= Attributes
018:         *     Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
019:         *     Attribute ::= SEQUENCE 
020:         *     {
021:         *       type AttributeType 
022:         *       values SET OF AttributeValue 
023:         *     }
024:         *     
025:         *     AttributeType ::= OBJECT IDENTIFIER
026:         *     AttributeValue ::= ANY DEFINED BY AttributeType
027:         * </pre>
028:         * 
029:         * @see org.bouncycastle.asn1.x509.X509Name for AttributeType ObjectIdentifiers.
030:         */
031:        public class SubjectDirectoryAttributes extends ASN1Encodable {
032:            private Vector attributes = new Vector();
033:
034:            public static SubjectDirectoryAttributes getInstance(Object obj) {
035:                if (obj == null || obj instanceof  SubjectDirectoryAttributes) {
036:                    return (SubjectDirectoryAttributes) obj;
037:                }
038:
039:                if (obj instanceof  ASN1Sequence) {
040:                    return new SubjectDirectoryAttributes((ASN1Sequence) obj);
041:                }
042:
043:                throw new IllegalArgumentException(
044:                        "illegal object in getInstance: "
045:                                + obj.getClass().getName());
046:            }
047:
048:            /**
049:             * Constructor from ASN1Sequence.
050:             * 
051:             * The sequence is of type SubjectDirectoryAttributes:
052:             * 
053:             * <pre>
054:             *      SubjectDirectoryAttributes ::= Attributes
055:             *      Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
056:             *      Attribute ::= SEQUENCE 
057:             *      {
058:             *        type AttributeType 
059:             *        values SET OF AttributeValue 
060:             *      }
061:             *      
062:             *      AttributeType ::= OBJECT IDENTIFIER
063:             *      AttributeValue ::= ANY DEFINED BY AttributeType
064:             * </pre>
065:             * 
066:             * @param seq
067:             *            The ASN.1 sequence.
068:             */
069:            public SubjectDirectoryAttributes(ASN1Sequence seq) {
070:                Enumeration e = seq.getObjects();
071:
072:                while (e.hasMoreElements()) {
073:                    ASN1Sequence s = ASN1Sequence.getInstance(e.nextElement());
074:                    attributes.addElement(new Attribute(s));
075:                }
076:            }
077:
078:            /**
079:             * Constructor from a vector of attributes.
080:             * 
081:             * The vector consists of attributes of type {@link Attribute Attribute}
082:             * 
083:             * @param attributes
084:             *            The attributes.
085:             * 
086:             */
087:            public SubjectDirectoryAttributes(Vector attributes) {
088:                Enumeration e = attributes.elements();
089:
090:                while (e.hasMoreElements()) {
091:                    this .attributes.addElement(e.nextElement());
092:                }
093:            }
094:
095:            /**
096:             * Produce an object suitable for an ASN1OutputStream.
097:             * 
098:             * Returns:
099:             * 
100:             * <pre>
101:             *      SubjectDirectoryAttributes ::= Attributes
102:             *      Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
103:             *      Attribute ::= SEQUENCE 
104:             *      {
105:             *        type AttributeType 
106:             *        values SET OF AttributeValue 
107:             *      }
108:             *      
109:             *      AttributeType ::= OBJECT IDENTIFIER
110:             *      AttributeValue ::= ANY DEFINED BY AttributeType
111:             * </pre>
112:             * 
113:             * @return a DERObject
114:             */
115:            public DERObject toASN1Object() {
116:                ASN1EncodableVector vec = new ASN1EncodableVector();
117:                Enumeration e = attributes.elements();
118:
119:                while (e.hasMoreElements()) {
120:
121:                    vec.add((Attribute) e.nextElement());
122:                }
123:
124:                return new DERSequence(vec);
125:            }
126:
127:            /**
128:             * @return Returns the attributes.
129:             */
130:            public Vector getAttributes() {
131:                return attributes;
132:            }
133:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.