Source Code Cross Referenced for IssuingDistributionPoint.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.ASN1EncodableVector;
005:        import org.bouncycastle.asn1.ASN1Sequence;
006:        import org.bouncycastle.asn1.ASN1TaggedObject;
007:        import org.bouncycastle.asn1.DERBoolean;
008:        import org.bouncycastle.asn1.DERObject;
009:        import org.bouncycastle.asn1.DERSequence;
010:        import org.bouncycastle.asn1.DERTaggedObject;
011:
012:        /**
013:         * <pre>
014:         * IssuingDistributionPoint ::= SEQUENCE { 
015:         *   distributionPoint          [0] DistributionPointName OPTIONAL, 
016:         *   onlyContainsUserCerts      [1] BOOLEAN DEFAULT FALSE, 
017:         *   onlyContainsCACerts        [2] BOOLEAN DEFAULT FALSE, 
018:         *   onlySomeReasons            [3] ReasonFlags OPTIONAL, 
019:         *   indirectCRL                [4] BOOLEAN DEFAULT FALSE,
020:         *   onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
021:         * </pre>
022:         */
023:        public class IssuingDistributionPoint extends ASN1Encodable {
024:            private DistributionPointName distributionPoint;
025:
026:            private boolean onlyContainsUserCerts;
027:
028:            private boolean onlyContainsCACerts;
029:
030:            private ReasonFlags onlySomeReasons;
031:
032:            private boolean indirectCRL;
033:
034:            private boolean onlyContainsAttributeCerts;
035:
036:            private ASN1Sequence seq;
037:
038:            public static IssuingDistributionPoint getInstance(
039:                    ASN1TaggedObject obj, boolean explicit) {
040:                return getInstance(ASN1Sequence.getInstance(obj, explicit));
041:            }
042:
043:            public static IssuingDistributionPoint getInstance(Object obj) {
044:                if (obj == null || obj instanceof  IssuingDistributionPoint) {
045:                    return (IssuingDistributionPoint) obj;
046:                } else if (obj instanceof  ASN1Sequence) {
047:                    return new IssuingDistributionPoint((ASN1Sequence) obj);
048:                }
049:
050:                throw new IllegalArgumentException("unknown object in factory");
051:            }
052:
053:            /**
054:             * Constructor from given details.
055:             * 
056:             * @param distributionPoint
057:             *            May contain an URI as pointer to most current CRL.
058:             * @param onlyContainsUserCerts Covers revocation information for end certificates.
059:             * @param onlyContainsCACerts Covers revocation information for CA certificates.
060:             * 
061:             * @param onlySomeReasons
062:             *            Which revocation reasons does this point cover.
063:             * @param indirectCRL
064:             *            If <code>true</code> then the CRL contains revocation
065:             *            information about certificates ssued by other CAs.
066:             * @param onlyContainsAttributeCerts Covers revocation information for attribute certificates.
067:             */
068:            public IssuingDistributionPoint(
069:                    DistributionPointName distributionPoint,
070:                    boolean onlyContainsUserCerts, boolean onlyContainsCACerts,
071:                    ReasonFlags onlySomeReasons, boolean indirectCRL,
072:                    boolean onlyContainsAttributeCerts) {
073:                this .distributionPoint = distributionPoint;
074:                this .indirectCRL = indirectCRL;
075:                this .onlyContainsAttributeCerts = onlyContainsAttributeCerts;
076:                this .onlyContainsCACerts = onlyContainsCACerts;
077:                this .onlyContainsUserCerts = onlyContainsUserCerts;
078:                this .onlySomeReasons = onlySomeReasons;
079:
080:                ASN1EncodableVector vec = new ASN1EncodableVector();
081:                if (distributionPoint != null) { // CHOICE item so explicitly tagged
082:                    vec.add(new DERTaggedObject(true, 0, distributionPoint));
083:                }
084:                if (!onlyContainsUserCerts) {
085:                    vec
086:                            .add(new DERTaggedObject(false, 1, new DERBoolean(
087:                                    true)));
088:                }
089:                if (!onlyContainsCACerts) {
090:                    vec
091:                            .add(new DERTaggedObject(false, 2, new DERBoolean(
092:                                    true)));
093:                }
094:                if (onlySomeReasons != null) {
095:                    vec.add(new DERTaggedObject(false, 3, onlySomeReasons));
096:                }
097:                if (!indirectCRL) {
098:                    vec
099:                            .add(new DERTaggedObject(false, 4, new DERBoolean(
100:                                    true)));
101:                }
102:                if (!onlyContainsAttributeCerts) {
103:                    vec
104:                            .add(new DERTaggedObject(false, 5, new DERBoolean(
105:                                    true)));
106:                }
107:
108:                seq = new DERSequence(vec);
109:            }
110:
111:            /**
112:             * Constructor from ASN1Sequence
113:             */
114:            public IssuingDistributionPoint(ASN1Sequence seq) {
115:                this .seq = seq;
116:
117:                for (int i = 0; i != seq.size(); i++) {
118:                    ASN1TaggedObject o = ASN1TaggedObject.getInstance(seq
119:                            .getObjectAt(i));
120:
121:                    switch (o.getTagNo()) {
122:                    case 0:
123:                        // CHOICE so explicit
124:                        distributionPoint = DistributionPointName.getInstance(
125:                                o, true);
126:                        break;
127:                    case 1:
128:                        onlyContainsUserCerts = DERBoolean
129:                                .getInstance(o, false).isTrue();
130:                        break;
131:                    case 2:
132:                        onlyContainsCACerts = DERBoolean.getInstance(o, false)
133:                                .isTrue();
134:                        break;
135:                    case 3:
136:                        onlySomeReasons = new ReasonFlags(ReasonFlags
137:                                .getInstance(o, false));
138:                        break;
139:                    case 4:
140:                        indirectCRL = DERBoolean.getInstance(o, false).isTrue();
141:                        break;
142:                    case 5:
143:                        onlyContainsAttributeCerts = DERBoolean.getInstance(o,
144:                                false).isTrue();
145:                        break;
146:                    default:
147:                        throw new IllegalArgumentException(
148:                                "unknown tag in IssuingDistributionPoint");
149:                    }
150:                }
151:            }
152:
153:            public boolean onlyContainsUserCerts() {
154:                return onlyContainsUserCerts;
155:            }
156:
157:            public boolean onlyContainsCACerts() {
158:                return onlyContainsCACerts;
159:            }
160:
161:            public boolean isIndirectCRL() {
162:                return indirectCRL;
163:            }
164:
165:            public boolean onlyContainsAttributeCerts() {
166:                return onlyContainsAttributeCerts;
167:            }
168:
169:            /**
170:             * @return Returns the distributionPoint.
171:             */
172:            public DistributionPointName getDistributionPoint() {
173:                return distributionPoint;
174:            }
175:
176:            /**
177:             * @return Returns the onlySomeReasons.
178:             */
179:            public ReasonFlags getOnlySomeReasons() {
180:                return onlySomeReasons;
181:            }
182:
183:            public DERObject toASN1Object() {
184:                return seq;
185:            }
186:
187:            public String toString() {
188:                String sep = System.getProperty("line.separator");
189:                StringBuffer buf = new StringBuffer();
190:
191:                buf.append("IssuingDistributionPoint: [");
192:                buf.append(sep);
193:                if (distributionPoint != null) {
194:                    appendObject(buf, sep, "distributionPoint",
195:                            distributionPoint.toString());
196:                }
197:                if (onlyContainsUserCerts) {
198:                    appendObject(buf, sep, "onlyContainsUserCerts",
199:                            booleanToString(onlyContainsUserCerts));
200:                }
201:                if (onlyContainsCACerts) {
202:                    appendObject(buf, sep, "onlyContainsCACerts",
203:                            booleanToString(onlyContainsCACerts));
204:                }
205:                if (onlySomeReasons != null) {
206:                    appendObject(buf, sep, "onlySomeReasons", onlySomeReasons
207:                            .toString());
208:                }
209:                if (onlyContainsAttributeCerts) {
210:                    appendObject(buf, sep, "onlyContainsAttributeCerts",
211:                            booleanToString(onlyContainsAttributeCerts));
212:                }
213:                if (indirectCRL) {
214:                    appendObject(buf, sep, "indirectCRL",
215:                            booleanToString(indirectCRL));
216:                }
217:                buf.append("]");
218:                buf.append(sep);
219:                return buf.toString();
220:            }
221:
222:            private void appendObject(StringBuffer buf, String sep,
223:                    String name, String value) {
224:                String indent = "    ";
225:
226:                buf.append(indent);
227:                buf.append(name);
228:                buf.append(":");
229:                buf.append(sep);
230:                buf.append(indent);
231:                buf.append(indent);
232:                buf.append(value);
233:                buf.append(sep);
234:            }
235:
236:            private String booleanToString(boolean value) {
237:                return value ? "true" : "false";
238:            }
239:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.