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


001:        package org.bouncycastle.asn1.isismtt.ocsp;
002:
003:        import org.bouncycastle.asn1.ASN1Encodable;
004:        import org.bouncycastle.asn1.ASN1EncodableVector;
005:        import org.bouncycastle.asn1.ASN1Sequence;
006:        import org.bouncycastle.asn1.DERObject;
007:        import org.bouncycastle.asn1.DEROctetString;
008:        import org.bouncycastle.asn1.DERSequence;
009:        import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
010:
011:        /**
012:         * ISIS-MTT PROFILE: The responder may include this extension in a response to
013:         * send the hash of the requested certificate to the responder. This hash is
014:         * cryptographically bound to the certificate and serves as evidence that the
015:         * certificate is known to the responder (i.e. it has been issued and is present
016:         * in the directory). Hence, this extension is a means to provide a positive
017:         * statement of availability as described in T8.[8]. As explained in T13.[1],
018:         * clients may rely on this information to be able to validate signatures after
019:         * the expiry of the corresponding certificate. Hence, clients MUST support this
020:         * extension. If a positive statement of availability is to be delivered, this
021:         * extension syntax and OID MUST be used.
022:         * <p/>
023:         * <p/>
024:         * <pre>
025:         *     CertHash ::= SEQUENCE {
026:         *       hashAlgorithm AlgorithmIdentifier,
027:         *       certificateHash OCTET STRING
028:         *     }
029:         * </pre>
030:         */
031:        public class CertHash extends ASN1Encodable {
032:
033:            private AlgorithmIdentifier hashAlgorithm;
034:            private byte[] certificateHash;
035:
036:            public static CertHash getInstance(Object obj) {
037:                if (obj == null || obj instanceof  CertHash) {
038:                    return (CertHash) obj;
039:                }
040:
041:                if (obj instanceof  ASN1Sequence) {
042:                    return new CertHash((ASN1Sequence) obj);
043:                }
044:
045:                throw new IllegalArgumentException(
046:                        "illegal object in getInstance: "
047:                                + obj.getClass().getName());
048:            }
049:
050:            /**
051:             * Constructor from ASN1Sequence.
052:             * <p/>
053:             * The sequence is of type CertHash:
054:             * <p/>
055:             * <pre>
056:             *     CertHash ::= SEQUENCE {
057:             *       hashAlgorithm AlgorithmIdentifier,
058:             *       certificateHash OCTET STRING
059:             *     }
060:             * </pre>
061:             *
062:             * @param seq The ASN.1 sequence.
063:             */
064:            private CertHash(ASN1Sequence seq) {
065:                if (seq.size() != 2) {
066:                    throw new IllegalArgumentException("Bad sequence size: "
067:                            + seq.size());
068:                }
069:                hashAlgorithm = AlgorithmIdentifier.getInstance(seq
070:                        .getObjectAt(0));
071:                certificateHash = DEROctetString
072:                        .getInstance(seq.getObjectAt(1)).getOctets();
073:            }
074:
075:            /**
076:             * Constructor from a given details.
077:             *
078:             * @param hashAlgorithm   The hash algorithm identifier.
079:             * @param certificateHash The hash of the whole DER encoding of the certificate.
080:             */
081:            public CertHash(AlgorithmIdentifier hashAlgorithm,
082:                    byte[] certificateHash) {
083:                this .hashAlgorithm = hashAlgorithm;
084:                this .certificateHash = new byte[certificateHash.length];
085:                System.arraycopy(certificateHash, 0, this .certificateHash, 0,
086:                        certificateHash.length);
087:            }
088:
089:            public AlgorithmIdentifier getHashAlgorithm() {
090:                return hashAlgorithm;
091:            }
092:
093:            public byte[] getCertificateHash() {
094:                return certificateHash;
095:            }
096:
097:            /**
098:             * Produce an object suitable for an ASN1OutputStream.
099:             * <p/>
100:             * Returns:
101:             * <p/>
102:             * <pre>
103:             *     CertHash ::= SEQUENCE {
104:             *       hashAlgorithm AlgorithmIdentifier,
105:             *       certificateHash OCTET STRING
106:             *     }
107:             * </pre>
108:             *
109:             * @return a DERObject
110:             */
111:            public DERObject toASN1Object() {
112:                ASN1EncodableVector vec = new ASN1EncodableVector();
113:                vec.add(hashAlgorithm);
114:                vec.add(new DEROctetString(certificateHash));
115:                return new DERSequence(vec);
116:            }
117:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.