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


java.lang.Object
   sun.security.x509.X500Name

X500Name
public class X500Name implements GeneralNameInterface,Principal(Code)
Note: As of 1.4, the public class, javax.security.auth.x500.X500Principal, should be used when parsing, generating, and comparing X.500 DNs. This class contains other useful methods for checking name constraints and retrieving DNs by keyword.

X.500 names are used to identify entities, such as those which are identified by X.509 certificates. They are world-wide, hierarchical, and descriptive. Entities can be identified by attributes, and in some systems can be searched for according to those attributes.

The ASN.1 for this is:

 GeneralName ::= CHOICE {
 ....
 directoryName                   [4]     Name,
 ....
 Name ::= CHOICE {
 RDNSequence }
 RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
 RelativeDistinguishedName ::=
 SET OF AttributeTypeAndValue
 AttributeTypeAndValue ::= SEQUENCE {
 type     AttributeType,
 value    AttributeValue }
 AttributeType ::= OBJECT IDENTIFIER
 AttributeValue ::= ANY DEFINED BY AttributeType
 ....
 DirectoryString ::= CHOICE {
 teletexString           TeletexString (SIZE (1..MAX)),
 printableString         PrintableString (SIZE (1..MAX)),
 universalString         UniversalString (SIZE (1..MAX)),
 utf8String              UTF8String (SIZE (1.. MAX)),
 bmpString               BMPString (SIZE (1..MAX)) }
 

This specification requires only a subset of the name comparison functionality specified in the X.500 series of specifications. The requirements for conforming implementations are as follows:

  1. attribute values encoded in different types (e.g., PrintableString and BMPString) may be assumed to represent different strings;

  2. attribute values in types other than PrintableString are case sensitive (this permits matching of attribute values as binary objects);

  3. attribute values in PrintableString are not case sensitive (e.g., "Marianne Swanson" is the same as "MARIANNE SWANSON"); and

  4. attribute values in PrintableString are compared after removing leading and trailing white space and converting internal substrings of one or more consecutive white space characters to a single space.

These name comparison rules permit a certificate user to validate certificates issued using languages or encodings unfamiliar to the certificate user.

In addition, implementations of this specification MAY use these comparison rules to process unfamiliar attribute types for name chaining. This allows implementations to process certificates with unfamiliar attributes in the issuer name.

Note that the comparison rules defined in the X.500 series of specifications indicate that the character sets used to encode data in distinguished names are irrelevant. The characters themselves are compared without regard to encoding. Implementations of the profile are permitted to use the comparison algorithm defined in the X.500 series. Such an implementation will recognize a superset of name matches recognized by the algorithm specified above.

Note that instances of this class are immutable.
author:
   David Brownell
author:
   Amit Kapoor
author:
   Hemma Prafullchandra
version:
   1.47
See Also:   GeneralName
See Also:   GeneralNames
See Also:   GeneralNameInterface



Field Summary
final public static  ObjectIdentifierDNQUALIFIER_OID
    
final public static  ObjectIdentifierDOMAIN_COMPONENT_OID
    
final public static  ObjectIdentifierGENERATIONQUALIFIER_OID
    
final public static  ObjectIdentifierGIVENNAME_OID
    
final public static  ObjectIdentifierINITIALS_OID
    
final public static  ObjectIdentifierSERIALNUMBER_OID
    
final public static  ObjectIdentifierSURNAME_OID
    
final public static  ObjectIdentifiercommonName_oid
    
final public static  ObjectIdentifiercountryName_oid
    
final public static  ObjectIdentifieripAddress_oid
    
final public static  ObjectIdentifierlocalityName_oid
    
final public static  ObjectIdentifierorgName_oid
    
final public static  ObjectIdentifierorgUnitName_oid
    
final public static  ObjectIdentifierstateName_oid
    
final public static  ObjectIdentifierstreetAddress_oid
    
final public static  ObjectIdentifiertitle_oid
    
final public static  ObjectIdentifieruserid_oid
    

Constructor Summary
public  X500Name(String dname)
     Constructs a name from a conventionally formatted string, such as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
public  X500Name(String dname, String format)
     Constructs a name from a string formatted according to format. Currently, the formats DEFAULT and RFC2253 are supported. DEFAULT is the default format used by the X500Name(String) constructor.
public  X500Name(String commonName, String organizationUnit, String organizationName, String country)
     Constructs a name from fields common in enterprise application environments.

NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.
Parameters:
  commonName - common name of a person, e.g.

public  X500Name(String commonName, String organizationUnit, String organizationName, String localityName, String stateName, String country)
     Constructs a name from fields common in Internet application environments.

NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.
Parameters:
  commonName - common name of a person, e.g.

public  X500Name(RDN[] rdnArray)
    
public  X500Name(DerValue value)
     Constructs a name from an ASN.1 encoded value.
public  X500Name(DerInputStream in)
     Constructs a name from an ASN.1 encoded input stream.
public  X500Name(byte[] name)
     Constructs a name from an ASN.1 encoded byte array.

Method Summary
public  ListallAvas()
     Return an immutable List of the the AVAs contained in all the RDNs of this X500Name.
public static  X500NameasX500Name(X500Principal p)
     Get the X500Name contained in the given X500Principal.
public  X500PrincipalasX500Principal()
     Get an X500Principal backed by this X500Name.
public  intavaSize()
     Return the total number of AVAs contained in all the RDNs of this X500Name.
public  X500NamecommonAncestor(X500Name other)
    
public  intconstrains(GeneralNameInterface inputName)
     Return constraint type:
  • NAME_DIFF_TYPE = -1: input name is different type from this name (i.e.
static  intcountQuotes(String string, int from, int to)
    
public  voidemit(DerOutputStream out)
     Encodes the name in DER-encoded form.
public  voidencode(DerOutputStream out)
     Encodes the name in DER-encoded form.
public  booleanequals(Object obj)
     Compares this name with another, for equality.
public  DerValuefindMostSpecificAttribute(ObjectIdentifier attribute)
     Find the most specific ("last") attribute of the given type.
public  StringgetCommonName()
     Returns a "Common Name" component.
public  StringgetCountry()
     Returns a "Country" name component.
public  StringgetDNQualifier()
     Returns a "DN Qualifier" name component.
public  StringgetDomain()
     Returns a "Domain" name component.
public  byte[]getEncoded()
     Gets the name in DER-encoded form.
public  byte[]getEncodedInternal()
     Returned the encoding as an uncloned byte array.
public  StringgetGeneration()
     Returns a "Generation Qualifier" name component.
public  StringgetGivenName()
     Returns a "Given Name" name component.
public  StringgetIP()
     Returns an "IP address" name component.
public  StringgetInitials()
     Returns an "Initials" name component.
public  StringgetLocality()
     Returns a "Locality" name component.
public  StringgetName()
     Returns the value of toString().
public  StringgetOrganization()
     Returns an "Organization" name component.
public  StringgetOrganizationalUnit()
     Returns an "Organizational Unit" name component.
public  StringgetRFC1779Name()
     Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 1779.
public  StringgetRFC2253CanonicalName()
    
public  StringgetRFC2253Name()
     Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 2253.
public  StringgetState()
     Returns a "State" name component.
public  StringgetSurname()
     Returns a "Surname" name component.
public  intgetType()
     Return type of GeneralName.
public  inthashCode()
     Calculates a hash code value for the object.
static  ObjectIdentifierintern(ObjectIdentifier oid)
    
public  booleanisEmpty()
     Return whether this X500Name is empty.
public  Listrdns()
     Return an immutable List of all RDNs in this X500Name.
public  intsize()
     Return the number of RDNs in this X500Name.
public  intsubtreeDepth()
     Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds and for calculating path lengths in name subtrees.
public  StringtoString()
     Returns a string form of the X.500 distinguished name. The format of the string is from RFC 1779.

Field Detail
DNQUALIFIER_OID
final public static ObjectIdentifier DNQUALIFIER_OID(Code)



DOMAIN_COMPONENT_OID
final public static ObjectIdentifier DOMAIN_COMPONENT_OID(Code)



GENERATIONQUALIFIER_OID
final public static ObjectIdentifier GENERATIONQUALIFIER_OID(Code)



GIVENNAME_OID
final public static ObjectIdentifier GIVENNAME_OID(Code)



INITIALS_OID
final public static ObjectIdentifier INITIALS_OID(Code)



SERIALNUMBER_OID
final public static ObjectIdentifier SERIALNUMBER_OID(Code)



SURNAME_OID
final public static ObjectIdentifier SURNAME_OID(Code)



commonName_oid
final public static ObjectIdentifier commonName_oid(Code)



countryName_oid
final public static ObjectIdentifier countryName_oid(Code)



ipAddress_oid
final public static ObjectIdentifier ipAddress_oid(Code)



localityName_oid
final public static ObjectIdentifier localityName_oid(Code)



orgName_oid
final public static ObjectIdentifier orgName_oid(Code)



orgUnitName_oid
final public static ObjectIdentifier orgUnitName_oid(Code)



stateName_oid
final public static ObjectIdentifier stateName_oid(Code)



streetAddress_oid
final public static ObjectIdentifier streetAddress_oid(Code)



title_oid
final public static ObjectIdentifier title_oid(Code)



userid_oid
final public static ObjectIdentifier userid_oid(Code)




Constructor Detail
X500Name
public X500Name(String dname) throws IOException(Code)
Constructs a name from a conventionally formatted string, such as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US". (RFC 1779 or RFC 2253 style).
Parameters:
  DN - X.500 Distinguished Name



X500Name
public X500Name(String dname, String format) throws IOException(Code)
Constructs a name from a string formatted according to format. Currently, the formats DEFAULT and RFC2253 are supported. DEFAULT is the default format used by the X500Name(String) constructor. RFC2253 is format strictly according to RFC2253 without extensions.
Parameters:
  DN - X.500 Distinguished Name



X500Name
public X500Name(String commonName, String organizationUnit, String organizationName, String country) throws IOException(Code)
Constructs a name from fields common in enterprise application environments.

NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.
Parameters:
  commonName - common name of a person, e.g. "Vivette Davis"
Parameters:
  organizationUnit - small organization name, e.g. "Purchasing"
Parameters:
  organizationName - large organization name, e.g. "Onizuka, Inc."
Parameters:
  country - two letter country code, e.g. "CH"




X500Name
public X500Name(String commonName, String organizationUnit, String organizationName, String localityName, String stateName, String country) throws IOException(Code)
Constructs a name from fields common in Internet application environments.

NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.
Parameters:
  commonName - common name of a person, e.g. "Vivette Davis"
Parameters:
  organizationUnit - small organization name, e.g. "Purchasing"
Parameters:
  organizationName - large organization name, e.g. "Onizuka, Inc."
Parameters:
  localityName - locality (city) name, e.g. "Palo Alto"
Parameters:
  stateName - state name, e.g. "California"
Parameters:
  country - two letter country code, e.g. "CH"




X500Name
public X500Name(RDN[] rdnArray) throws IOException(Code)
Constructs a name from an array of relative distinguished names
Parameters:
  rdnArray - array of relative distinguished names
throws:
  IOException - on error



X500Name
public X500Name(DerValue value) throws IOException(Code)
Constructs a name from an ASN.1 encoded value. The encoding of the name in the stream uses DER (a BER/1 subset).
Parameters:
  value - a DER-encoded value holding an X.500 name.



X500Name
public X500Name(DerInputStream in) throws IOException(Code)
Constructs a name from an ASN.1 encoded input stream. The encoding of the name in the stream uses DER (a BER/1 subset).
Parameters:
  in - DER-encoded data holding an X.500 name.



X500Name
public X500Name(byte[] name) throws IOException(Code)
Constructs a name from an ASN.1 encoded byte array.
Parameters:
  name - DER-encoded byte array holding an X.500 name.




Method Detail
allAvas
public List allAvas()(Code)
Return an immutable List of the the AVAs contained in all the RDNs of this X500Name.



asX500Name
public static X500Name asX500Name(X500Principal p)(Code)
Get the X500Name contained in the given X500Principal. Note that the X500Name is retrieved using reflection.



asX500Principal
public X500Principal asX500Principal()(Code)
Get an X500Principal backed by this X500Name. Note that we are using privileged reflection to access the hidden package private constructor in X500Principal.



avaSize
public int avaSize()(Code)
Return the total number of AVAs contained in all the RDNs of this X500Name.



commonAncestor
public X500Name commonAncestor(X500Name other)(Code)
Return lowest common ancestor of this name and other name
Parameters:
  other - another X500Name X500Name of lowest common ancestor; null if none



constrains
public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException(Code)
Return constraint type:
  • NAME_DIFF_TYPE = -1: input name is different type from this name (i.e. does not constrain)
  • NAME_MATCH = 0: input name matches this name
  • NAME_NARROWS = 1: input name narrows this name
  • NAME_WIDENS = 2: input name widens this name
  • NAME_SAME_TYPE = 3: input name does not match or narrow this name, & but is same type
. These results are used in checking NameConstraints during certification path verification.
Parameters:
  inputName - to be checked for being constrained
throws:
  UnsupportedOperationException - if name is not exact match, but narrowing and widening are not supported for this name type.



countQuotes
static int countQuotes(String string, int from, int to)(Code)



emit
public void emit(DerOutputStream out) throws IOException(Code)
Encodes the name in DER-encoded form.
Parameters:
  out - where to put the DER-encoded X.500 name



encode
public void encode(DerOutputStream out) throws IOException(Code)
Encodes the name in DER-encoded form.
Parameters:
  out - where to put the DER-encoded X.500 name



equals
public boolean equals(Object obj)(Code)
Compares this name with another, for equality. true iff the names are identical.



findMostSpecificAttribute
public DerValue findMostSpecificAttribute(ObjectIdentifier attribute)(Code)
Find the most specific ("last") attribute of the given type.



getCommonName
public String getCommonName() throws IOException(Code)
Returns a "Common Name" component. If more than one such attribute exists, the topmost one is returned. "CN=" component of the name, if any.



getCountry
public String getCountry() throws IOException(Code)
Returns a "Country" name component. If more than one such attribute exists, the topmost one is returned. "C=" component of the name, if any.



getDNQualifier
public String getDNQualifier() throws IOException(Code)
Returns a "DN Qualifier" name component. If more than one such component exists, the topmost one is returned. "DNQ=" component of the name, if any.



getDomain
public String getDomain() throws IOException(Code)
Returns a "Domain" name component. If more than one such component exists, the topmost one is returned. "DC=" component of the name, if any.



getEncoded
public byte[] getEncoded() throws IOException(Code)
Gets the name in DER-encoded form. the DER encoded byte array of this name.



getEncodedInternal
public byte[] getEncodedInternal() throws IOException(Code)
Returned the encoding as an uncloned byte array. Callers must guarantee that they neither modify it not expose it to untrusted code.



getGeneration
public String getGeneration() throws IOException(Code)
Returns a "Generation Qualifier" name component. If more than one such component exists, the topmost one is returned. "GENERATION=" component of the name, if any.



getGivenName
public String getGivenName() throws IOException(Code)
Returns a "Given Name" name component. If more than one such component exists, the topmost one is returned. "GIVENNAME=" component of the name, if any.



getIP
public String getIP() throws IOException(Code)
Returns an "IP address" name component. If more than one such component exists, the topmost one is returned. "IP=" component of the name, if any.



getInitials
public String getInitials() throws IOException(Code)
Returns an "Initials" name component. If more than one such component exists, the topmost one is returned. "INITIALS=" component of the name, if any.



getLocality
public String getLocality() throws IOException(Code)
Returns a "Locality" name component. If more than one such component exists, the topmost one is returned. "L=" component of the name, if any.



getName
public String getName()(Code)
Returns the value of toString(). This call is needed to implement the java.security.Principal interface.



getOrganization
public String getOrganization() throws IOException(Code)
Returns an "Organization" name component. If more than one such attribute exists, the topmost one is returned. "O=" component of the name, if any.



getOrganizationalUnit
public String getOrganizationalUnit() throws IOException(Code)
Returns an "Organizational Unit" name component. If more than one such attribute exists, the topmost one is returned. "OU=" component of the name, if any.



getRFC1779Name
public String getRFC1779Name()(Code)
Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 1779. Only standard attribute type keywords defined in RFC 1779 are emitted.



getRFC2253CanonicalName
public String getRFC2253CanonicalName()(Code)



getRFC2253Name
public String getRFC2253Name()(Code)
Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 2253. Only standard attribute type keywords defined in RFC 2253 are emitted.



getState
public String getState() throws IOException(Code)
Returns a "State" name component. If more than one such component exists, the topmost one is returned. "S=" component of the name, if any.



getSurname
public String getSurname() throws IOException(Code)
Returns a "Surname" name component. If more than one such component exists, the topmost one is returned. "SURNAME=" component of the name, if any.



getType
public int getType()(Code)
Return type of GeneralName.



hashCode
public int hashCode()(Code)
Calculates a hash code value for the object. Objects which are equal will also have the same hashcode.



intern
static ObjectIdentifier intern(ObjectIdentifier oid)(Code)



isEmpty
public boolean isEmpty()(Code)
Return whether this X500Name is empty. An X500Name is not empty if it has at least one RDN containing at least one AVA.



rdns
public List rdns()(Code)
Return an immutable List of all RDNs in this X500Name.



size
public int size()(Code)
Return the number of RDNs in this X500Name.



subtreeDepth
public int subtreeDepth() throws UnsupportedOperationException(Code)
Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds and for calculating path lengths in name subtrees.
throws:
  UnsupportedOperationException - if not supported for this name type



toString
public String toString()(Code)
Returns a string form of the X.500 distinguished name. The format of the string is from RFC 1779. The returned string may contain non-standardised keywords for more readability (keywords from 1779, 2253, and 2459).



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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