public final class GeneralName extends Object
GeneralName::= CHOICE {
otherName [0] OtherName,
rfc822Name [1] IA5String,
dNSName [2] IA5String,
x400Address [3] ORAddress,
directoryName [4] Name,
ediPartyName [5] EDIPartyName,
uniformResourceIdentifier [6] IA5String,
iPAddress [7] OCTET STRING,
registeredID [8] OBJECT IDENTIFIER
}
OtherName::= SEQUENCE {
type-id OBJECT IDENTIFIER,
value [0] EXPLICIT ANY DEFINED BY type-id
}
EDIPartyName::= SEQUENCE {
nameAssigner [0] DirectoryString OPTIONAL,
partyName [1] DirectoryString
}
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 class doesn't support masked addresses like "10.9.8.0/255.255.255.0". These are only necessary for NameConstraints, which are not exposed in the Java certificate API.
NameConstraints,
GeneralSubtree| Modifier and Type | Field and Description |
|---|---|
static ASN1Choice |
ASN1 |
static int |
DIR_NAME |
static int |
DNS_NAME |
static int |
EDIP_NAME |
static int |
IP_ADDR |
static int |
OTHER_NAME
The values of the tags of fields
|
static int |
REG_ID |
static int |
RFC822_NAME |
static int |
UR_ID |
static int |
X400_ADDR |
| Constructor and Description |
|---|
GeneralName(byte[] name)
Constructor for type [7] iPAddress.
|
GeneralName(EDIPartyName name) |
GeneralName(int tag,
byte[] name)
Constructs an object representing the value of GeneralName.
|
GeneralName(int tag,
String name)
Makes the GeneralName object from the tag type and corresponding
well established string representation of the name value.
|
GeneralName(Name name) |
GeneralName(ORAddress name) |
GeneralName(OtherName name) |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkDNS(String dns)
Checks the correctness of the string representation of DNS name as
specified in RFC 1034 p.
|
static void |
checkURI(String uri)
Checks the correctness of the string representation of URI name.
|
boolean |
equals(Object other)
Compares this instance with the specified object and indicates if they
are equal.
|
List<Object> |
getAsList()
Gets a list representation of this GeneralName object.
|
byte[] |
getEncoded()
Returns ASN.1 encoded form of this X.509 GeneralName value.
|
byte[] |
getEncodedName() |
Object |
getName() |
int |
getTag()
Returns the tag of the name in the structure
|
int |
hashCode()
Returns an integer hash code for this object.
|
static String |
ipBytesToStr(byte[] ip)
Returns the string form of the given IP address.
|
static byte[] |
ipStrToBytes(String ip)
Returns the bytes of the given IP address or masked IP address.
|
boolean |
isAcceptable(GeneralName gname)
Checks if the other general name is acceptable by this object.
|
static int[] |
oidStrToInts(String oid)
Converts OID into array of ints.
|
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
public static final int OTHER_NAME
public static final int RFC822_NAME
public static final int DNS_NAME
public static final int X400_ADDR
public static final int DIR_NAME
public static final int EDIP_NAME
public static final int UR_ID
public static final int IP_ADDR
public static final int REG_ID
public static final ASN1Choice ASN1
public GeneralName(int tag,
String name)
throws IOException
tag - is an integer which value corresponds to the name type.name - is a name value corresponding to the tag.IOExceptionpublic GeneralName(OtherName name)
public GeneralName(ORAddress name)
public GeneralName(Name name)
public GeneralName(EDIPartyName name)
public GeneralName(byte[] name)
throws IllegalArgumentException
IllegalArgumentExceptionpublic GeneralName(int tag,
byte[] name)
throws IOException
tag - is an integer which value corresponds
to the name type (0-8),name - is a DER encoded for of the name valueIOExceptionpublic int getTag()
public Object getName()
public boolean equals(Object other)
Objecto must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns true only if this ==
o. See Writing a correct
equals method
if you intend implementing your own equals method.
The general contract for the equals and Object.hashCode() methods is that if equals returns true for
any two objects, then hashCode() must return the same value for
these objects. This means that subclasses of Object usually
override either both methods or neither of them.
equals in class Objectother - the object to compare this instance with.true if the specified object is equal to this Object; false otherwise.Object.hashCode()public int hashCode()
ObjectObject.equals(java.lang.Object) returns true must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode method
if you intend implementing your own hashCode method.
hashCode in class ObjectObject.equals(java.lang.Object)public boolean isAcceptable(GeneralName gname)
public List<Object> getAsList()
public String toString()
ObjectgetClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString method
if you intend implementing your own toString method.
public byte[] getEncoded()
public byte[] getEncodedName()
IOExceptionpublic static void checkDNS(String dns) throws IOException
This permits a wildcard character '*' anywhere in the name; it is up to the application to check which wildcards are permitted. See RFC 6125 for recommended wildcard matching rules.
IOExceptionpublic static void checkURI(String uri) throws IOException
IOExceptionpublic static int[] oidStrToInts(String oid) throws IOException
IOExceptionpublic static byte[] ipStrToBytes(String ip) throws IOException
IOExceptionpublic static String ipBytesToStr(byte[] ip)