Source Code Cross Referenced for X509Principal.java in  » EJB-Server-geronimo » crypto » org » apache » geronimo » crypto » jce » 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 » EJB Server geronimo » crypto » org.apache.geronimo.crypto.jce 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */package org.apache.geronimo.crypto.jce;
017:
018:        import java.io.ByteArrayInputStream;
019:        import java.io.ByteArrayOutputStream;
020:        import java.io.IOException;
021:        import java.security.Principal;
022:        import java.util.Hashtable;
023:        import java.util.Vector;
024:
025:        import org.apache.geronimo.crypto.asn1.ASN1InputStream;
026:        import org.apache.geronimo.crypto.asn1.ASN1Sequence;
027:        import org.apache.geronimo.crypto.asn1.DEROutputStream;
028:        import org.apache.geronimo.crypto.asn1.x509.X509Name;
029:
030:        public class X509Principal extends X509Name implements  Principal {
031:            /**
032:             * Constructor from an encoded byte array.
033:             */
034:            public X509Principal(byte[] bytes) throws IOException {
035:                super ((ASN1Sequence) (new ASN1InputStream(
036:                        new ByteArrayInputStream(bytes)).readObject()));
037:            }
038:
039:            /**
040:             * Constructor from an X509Name object.
041:             */
042:            public X509Principal(X509Name name) {
043:                super ((ASN1Sequence) name.getDERObject());
044:            }
045:
046:            /**
047:             * constructor from a table of attributes.
048:             * <p>
049:             * it's is assumed the table contains OID/String pairs.
050:             */
051:            public X509Principal(Hashtable attributes) {
052:                super (attributes);
053:            }
054:
055:            /**
056:             * constructor from a table of attributes and a vector giving the
057:             * specific ordering required for encoding or conversion to a string.
058:             * <p>
059:             * it's is assumed the table contains OID/String pairs.
060:             */
061:            public X509Principal(Vector ordering, Hashtable attributes) {
062:                super (ordering, attributes);
063:            }
064:
065:            /**
066:             * constructor from a vector of attribute values and a vector of OIDs.
067:             */
068:            public X509Principal(Vector oids, Vector values) {
069:                super (oids, values);
070:            }
071:
072:            /**
073:             * takes an X509 dir name as a string of the format "C=AU,ST=Victoria", or
074:             * some such, converting it into an ordered set of name attributes.
075:             */
076:            public X509Principal(String dirName) {
077:                super (dirName);
078:            }
079:
080:            /**
081:             * Takes an X509 dir name as a string of the format "C=AU,ST=Victoria", or
082:             * some such, converting it into an ordered set of name attributes. If reverse
083:             * is false the dir name will be encoded in the order of the (name, value) pairs
084:             * presented, otherwise the encoding will start with the last (name, value) pair
085:             * and work back.
086:             */
087:            public X509Principal(boolean reverse, String dirName) {
088:                super (reverse, dirName);
089:            }
090:
091:            /**
092:             * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or
093:             * some such, converting it into an ordered set of name attributes. lookUp
094:             * should provide a table of lookups, indexed by lowercase only strings and
095:             * yielding a DERObjectIdentifier, other than that OID. and numeric oids
096:             * will be processed automatically.
097:             * <p>
098:             * If reverse is true, create the encoded version of the sequence starting
099:             * from the last element in the string.
100:             */
101:            public X509Principal(boolean reverse, Hashtable lookUp,
102:                    String dirName) {
103:                super (reverse, lookUp, dirName);
104:            }
105:
106:            public String getName() {
107:                return this .toString();
108:            }
109:
110:            /**
111:             * return a DER encoded byte array representing this object
112:             */
113:            public byte[] getEncoded() {
114:                ByteArrayOutputStream bOut = new ByteArrayOutputStream();
115:                DEROutputStream dOut = new DEROutputStream(bOut);
116:
117:                try {
118:                    dOut.writeObject(this );
119:                } catch (IOException e) {
120:                    throw new RuntimeException(e.getMessage(), e);
121:                }
122:
123:                return bOut.toByteArray();
124:            }
125:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.