Java Doc for X509Extension.java in  » 6.0-JDK-Modules » j2me » java » security » cert » 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 » 6.0 JDK Modules » j2me » java.security.cert 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.security.cert.X509Extension

All known Subclasses:   java.security.cert.X509CRLEntry,  java.security.cert.X509Certificate,  java.security.cert.X509CRL,
X509Extension
public interface X509Extension (Code)
Interface for an X.509 extension.

The extensions defined for X.509 v3 X509Certificate Certificates and v2 X509CRL CRLs (Certificate Revocation Lists) provide methods for associating additional attributes with users or public keys, for managing the certification hierarchy, and for managing CRL distribution. The X.509 extensions format also allows communities to define private extensions to carry information unique to those communities.

Each extension in a certificate/CRL may be designated as critical or non-critical. A certificate/CRL-using system (an application validating a certificate/CRL) must reject the certificate/CRL if it encounters a critical extension it does not recognize. A non-critical extension may be ignored if it is not recognized.

The ASN.1 definition for this is:

 Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension
 Extension  ::=  SEQUENCE  {
 extnId        OBJECT IDENTIFIER,
 critical      BOOLEAN DEFAULT FALSE,
 extnValue     OCTET STRING
 -- contains a DER encoding of a value
 -- of the type registered for use with
 -- the extnId object identifier value
 }
 
Since not all extensions are known, the getExtensionValue method returns the DER-encoded OCTET STRING of the extension value (i.e., the extnValue). This can then be handled by a Class that understands the extension.
author:
   Hemma Prafullchandra
version:
   1.16 00/02/02




Method Summary
public  SetgetCriticalExtensionOIDs()
     Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface.
public  byte[]getExtensionValue(String oid)
     Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid String. The oid string is represented by a set of nonnegative whole numbers separated by periods.

For example:
OID (Object Identifier) Extension Name
2.5.29.14 SubjectKeyIdentifier
2.5.29.15 KeyUsage
2.5.29.16 PrivateKeyUsage
2.5.29.17 SubjectAlternativeName
2.5.29.18 IssuerAlternativeName
2.5.29.19 BasicConstraints
2.5.29.30 NameConstraints
2.5.29.33 PolicyMappings
2.5.29.35 AuthorityKeyIdentifier
2.5.29.36 PolicyConstraints

Parameters:
  oid - the Object Identifier value for the extension.

public  SetgetNonCriticalExtensionOIDs()
     Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface.
public  booleanhasUnsupportedCriticalExtension()
     Check if there is a critical extension that is not supported.



Method Detail
getCriticalExtensionOIDs
public Set getCriticalExtensionOIDs()(Code)
Gets a Set of the OID strings for the extension(s) marked CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of critical extensions from an X509Certificate and print the OIDs:

 InputStream inStrm = new FileInputStream("DER-encoded-Cert");
 CertificateFactory cf = CertificateFactory.getInstance("X.509");
 X509Certificate cert = (X509Certificate)cf.generateCertificate(inStrm);
 inStrm.close();

Set critSet = cert.getCriticalExtensionOIDs(); if (critSet != null && !critSet.isEmpty()) { System.out.println("Set of critical extensions:"); for (Iterator i = critSet.iterator(); i.hasNext();) { String oid = (String)i.next(); System.out.println(oid); } }

a Set (or an empty Set if none are marked critical) ofthe extension OID strings for extensions that are marked critical.If there are no extensions present at all, then this method returnsnull.



getExtensionValue
public byte[] getExtensionValue(String oid)(Code)
Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid String. The oid string is represented by a set of nonnegative whole numbers separated by periods.

For example:
OID (Object Identifier) Extension Name
2.5.29.14 SubjectKeyIdentifier
2.5.29.15 KeyUsage
2.5.29.16 PrivateKeyUsage
2.5.29.17 SubjectAlternativeName
2.5.29.18 IssuerAlternativeName
2.5.29.19 BasicConstraints
2.5.29.30 NameConstraints
2.5.29.33 PolicyMappings
2.5.29.35 AuthorityKeyIdentifier
2.5.29.36 PolicyConstraints

Parameters:
  oid - the Object Identifier value for the extension. the DER-encoded octet string of the extension value ornull if it is not present.




getNonCriticalExtensionOIDs
public Set getNonCriticalExtensionOIDs()(Code)
Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL in the certificate/CRL managed by the object implementing this interface. Here is sample code to get a Set of non-critical extensions from an X509CRL revoked certificate entry and print the OIDs:

 InputStream inStrm = new FileInputStream("DER-encoded-CRL");
 CertificateFactory cf = CertificateFactory.getInstance("X.509");
 X509CRL crl = (X509CRL)cf.generateCRL(inStrm);
 inStrm.close();

byte[] certData = <DER-encoded certificate data> ByteArrayInputStream bais = new ByteArrayInputStream(certData); X509Certificate cert = (X509Certificate)cf.generateCertificate(bais); bais.close(); X509CRLEntry badCert = crl.getRevokedCertificate(cert.getSerialNumber());

if (badCert != null) { Set nonCritSet = badCert.getNonCriticalExtensionOIDs();

if (nonCritSet != null) for (Iterator i = nonCritSet.iterator(); i.hasNext();) { String oid = (String)i.next(); System.out.println(oid); } }

a Set (or an empty Set if none are marked non-critical) ofthe extension OID strings for extensions that are marked non-critical.If there are no extensions present at all, then this method returnsnull.



hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()(Code)
Check if there is a critical extension that is not supported. true if a critical extension is found that isnot supported, otherwise false.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.