Source Code Cross Referenced for TBSCertificateStructure.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 org.bouncycastle.asn1.ASN1Encodable;
004:        import org.bouncycastle.asn1.ASN1Sequence;
005:        import org.bouncycastle.asn1.ASN1TaggedObject;
006:        import org.bouncycastle.asn1.DERBitString;
007:        import org.bouncycastle.asn1.DERInteger;
008:        import org.bouncycastle.asn1.DERObject;
009:        import org.bouncycastle.asn1.DERTaggedObject;
010:        import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
011:
012:        /**
013:         * The TBSCertificate object.
014:         * <pre>
015:         * TBSCertificate ::= SEQUENCE {
016:         *      version          [ 0 ]  Version DEFAULT v1(0),
017:         *      serialNumber            CertificateSerialNumber,
018:         *      signature               AlgorithmIdentifier,
019:         *      issuer                  Name,
020:         *      validity                Validity,
021:         *      subject                 Name,
022:         *      subjectPublicKeyInfo    SubjectPublicKeyInfo,
023:         *      issuerUniqueID    [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
024:         *      subjectUniqueID   [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
025:         *      extensions        [ 3 ] Extensions OPTIONAL
026:         *      }
027:         * </pre>
028:         * <p>
029:         * Note: issuerUniqueID and subjectUniqueID are both deprecated by the IETF. This class
030:         * will parse them, but you really shouldn't be creating new ones.
031:         */
032:        public class TBSCertificateStructure extends ASN1Encodable implements 
033:                X509ObjectIdentifiers, PKCSObjectIdentifiers {
034:            ASN1Sequence seq;
035:
036:            DERInteger version;
037:            DERInteger serialNumber;
038:            AlgorithmIdentifier signature;
039:            X509Name issuer;
040:            Time startDate, endDate;
041:            X509Name subject;
042:            SubjectPublicKeyInfo subjectPublicKeyInfo;
043:            DERBitString issuerUniqueId;
044:            DERBitString subjectUniqueId;
045:            X509Extensions extensions;
046:
047:            public static TBSCertificateStructure getInstance(
048:                    ASN1TaggedObject obj, boolean explicit) {
049:                return getInstance(ASN1Sequence.getInstance(obj, explicit));
050:            }
051:
052:            public static TBSCertificateStructure getInstance(Object obj) {
053:                if (obj instanceof  TBSCertificateStructure) {
054:                    return (TBSCertificateStructure) obj;
055:                } else if (obj instanceof  ASN1Sequence) {
056:                    return new TBSCertificateStructure((ASN1Sequence) obj);
057:                }
058:
059:                throw new IllegalArgumentException("unknown object in factory");
060:            }
061:
062:            public TBSCertificateStructure(ASN1Sequence seq) {
063:                int seqStart = 0;
064:
065:                this .seq = seq;
066:
067:                //
068:                // some certficates don't include a version number - we assume v1
069:                //
070:                if (seq.getObjectAt(0) instanceof  DERTaggedObject) {
071:                    version = DERInteger.getInstance(seq.getObjectAt(0));
072:                } else {
073:                    seqStart = -1; // field 0 is missing!
074:                    version = new DERInteger(0);
075:                }
076:
077:                serialNumber = DERInteger.getInstance(seq
078:                        .getObjectAt(seqStart + 1));
079:
080:                signature = AlgorithmIdentifier.getInstance(seq
081:                        .getObjectAt(seqStart + 2));
082:                issuer = X509Name.getInstance(seq.getObjectAt(seqStart + 3));
083:
084:                //
085:                // before and after dates
086:                //
087:                ASN1Sequence dates = (ASN1Sequence) seq
088:                        .getObjectAt(seqStart + 4);
089:
090:                startDate = Time.getInstance(dates.getObjectAt(0));
091:                endDate = Time.getInstance(dates.getObjectAt(1));
092:
093:                subject = X509Name.getInstance(seq.getObjectAt(seqStart + 5));
094:
095:                //
096:                // public key info.
097:                //
098:                subjectPublicKeyInfo = SubjectPublicKeyInfo.getInstance(seq
099:                        .getObjectAt(seqStart + 6));
100:
101:                for (int extras = seq.size() - (seqStart + 6) - 1; extras > 0; extras--) {
102:                    DERTaggedObject extra = (DERTaggedObject) seq
103:                            .getObjectAt(seqStart + 6 + extras);
104:
105:                    switch (extra.getTagNo()) {
106:                    case 1:
107:                        issuerUniqueId = DERBitString.getInstance(extra, false);
108:                        break;
109:                    case 2:
110:                        subjectUniqueId = DERBitString
111:                                .getInstance(extra, false);
112:                        break;
113:                    case 3:
114:                        extensions = X509Extensions.getInstance(extra);
115:                    }
116:                }
117:            }
118:
119:            public int getVersion() {
120:                return version.getValue().intValue() + 1;
121:            }
122:
123:            public DERInteger getVersionNumber() {
124:                return version;
125:            }
126:
127:            public DERInteger getSerialNumber() {
128:                return serialNumber;
129:            }
130:
131:            public AlgorithmIdentifier getSignature() {
132:                return signature;
133:            }
134:
135:            public X509Name getIssuer() {
136:                return issuer;
137:            }
138:
139:            public Time getStartDate() {
140:                return startDate;
141:            }
142:
143:            public Time getEndDate() {
144:                return endDate;
145:            }
146:
147:            public X509Name getSubject() {
148:                return subject;
149:            }
150:
151:            public SubjectPublicKeyInfo getSubjectPublicKeyInfo() {
152:                return subjectPublicKeyInfo;
153:            }
154:
155:            public DERBitString getIssuerUniqueId() {
156:                return issuerUniqueId;
157:            }
158:
159:            public DERBitString getSubjectUniqueId() {
160:                return subjectUniqueId;
161:            }
162:
163:            public X509Extensions getExtensions() {
164:                return extensions;
165:            }
166:
167:            public DERObject toASN1Object() {
168:                return seq;
169:            }
170:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.