| java.lang.Object org.apache.harmony.security.x509.GeneralName
GeneralName | public class GeneralName (Code) | | The class encapsulates the ASN.1 DER encoding/decoding work
with the GeneralName structure which is a part of X.509 certificate
(as specified in RFC 3280 -
Internet X.509 Public Key Infrastructure.
Certificate and Certificate Revocation List (CRL) Profile.
http://www.ietf.org/rfc/rfc3280.txt):
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))
}
See Also: org.apache.harmony.security.x509.NameConstraints See Also: org.apache.harmony.security.x509.GeneralSubtree |
Constructor Summary | |
public | GeneralName(int tag, String name) Makes the GeneralName object from the tag type and corresponding
well established string representation of the name value.
The String representation of [7] iPAddress is such as:
For IP v4, as specified in RFC 791, the address must
contain exactly 4 byte component. | public | GeneralName(OtherName name) | public | GeneralName(ORAddress name) | public | GeneralName(Name name) | public | GeneralName(EDIPartyName name) | public | GeneralName(byte[] name) Constructor for type [7] iPAddress. | public | GeneralName(int tag, byte[] name) Constructs an object representing the value of GeneralName. |
Method Summary | |
public static void | checkDNS(String dns) Checks the correctness of the string representation of DNS name.
The correctness is checked as specified in RFC 1034 p. | public static void | checkURI(String uri) Checks the correctness of the string representation of URI name.
The correctness is checked as pointed out in RFC 3280 p. | public boolean | equals(Object _gname) | public List | getAsList() Gets a list representation of this GeneralName object.
The first entry of the list is an Integer object representing
the type of mane (0-8), and the second entry is a value of the name:
string or ASN.1 DER encoded form depending on the type as follows:
rfc822Name, dNSName, uniformResourceIdentifier names are returned
as Strings, using the string formats for those types (rfc 3280)
IP v4 address names are returned using dotted quad notation. | public byte[] | getEncoded() Returns ASN.1 encoded form of this X.509 GeneralName value. | public byte[] | getEncodedName() | public Object | getName() the value of the name. | public int | getTag() | public int | hashCode() | public static String | ipBytesToStr(byte[] ip) Helper method. | public static byte[] | ipStrToBytes(String ip) Helper method. | public boolean | isAcceptable(GeneralName gname) Checks if the other general name is acceptable by this object.
The name is acceptable if it has the same type name and its
name value is equal to name value of this object. | public static int[] | oidStrToInts(String oid) Converts OID into array of bytes. | public String | toString() |
DIR_NAME | final public static int DIR_NAME(Code) | | |
DNS_NAME | final public static int DNS_NAME(Code) | | |
EDIP_NAME | final public static int EDIP_NAME(Code) | | |
IP_ADDR | final public static int IP_ADDR(Code) | | |
OTHER_NAME | final public static int OTHER_NAME(Code) | | The values of the tags of fields
|
REG_ID | final public static int REG_ID(Code) | | |
RFC822_NAME | final public static int RFC822_NAME(Code) | | |
UR_ID | final public static int UR_ID(Code) | | |
X400_ADDR | final public static int X400_ADDR(Code) | | |
GeneralName | public GeneralName(int tag, String name) throws IOException(Code) | | Makes the GeneralName object from the tag type and corresponding
well established string representation of the name value.
The String representation of [7] iPAddress is such as:
For IP v4, as specified in RFC 791, the address must
contain exactly 4 byte component. For IP v6, as specified in
RFC 1883, the address must contain exactly 16 byte component.
If GeneralName structure is used as a part of Name Constraints
extension, to represent an address range the number of address
component is doubled (to 8 and 32 bytes respectively).
Note that the names:
[0] otherName, [3] x400Address, [5] ediPartyName
have no the string representation, so exception will be thrown.
To make the GeneralName object with such names use another constructor.
Parameters: tag - is an integer which value corresponds to the name type. Parameters: name - is a name value corresponding to the tag. |
GeneralName | public GeneralName(Name name)(Code) | | TODO
name: Name |
GeneralName | public GeneralName(byte[] name) throws IllegalArgumentException(Code) | | Constructor for type [7] iPAddress.
name is an array of bytes such as:
For IP v4, as specified in RFC 791, the address must
contain exactly 4 byte component. For IP v6, as specified in
RFC 1883, the address must contain exactly 16 byte component.
If GeneralName structure is used as a part of Name Constraints
extension, to represent an address range the number of address
component is doubled (to 8 and 32 bytes respectively).
|
GeneralName | public GeneralName(int tag, byte[] name) throws IOException(Code) | | Constructs an object representing the value of GeneralName.
Parameters: tag - is an integer which value correspondsto the name type (0-8), Parameters: name - is a DER encoded for of the name value |
checkDNS | public static void checkDNS(String dns) throws IOException(Code) | | Checks the correctness of the string representation of DNS name.
The correctness is checked as specified in RFC 1034 p. 10.
|
checkURI | public static void checkURI(String uri) throws IOException(Code) | | Checks the correctness of the string representation of URI name.
The correctness is checked as pointed out in RFC 3280 p. 34.
|
equals | public boolean equals(Object _gname)(Code) | | TODO
_gname: Object |
getAsList | public List getAsList()(Code) | | Gets a list representation of this GeneralName object.
The first entry of the list is an Integer object representing
the type of mane (0-8), and the second entry is a value of the name:
string or ASN.1 DER encoded form depending on the type as follows:
rfc822Name, dNSName, uniformResourceIdentifier names are returned
as Strings, using the string formats for those types (rfc 3280)
IP v4 address names are returned using dotted quad notation.
IP v6 address names are returned in the form "p1:p2:...:p8",
where p1-p8 are hexadecimal values representing the eight 16-bit
pieces of the address. registeredID name are returned as Strings
represented as a series of nonnegative integers separated by periods.
And directory names (distinguished names) are returned in
RFC 2253 string format.
otherName, X400Address, ediPartyName returned as byte arrays
containing the ASN.1 DER encoded form of the name.
|
getEncoded | public byte[] getEncoded()(Code) | | Returns ASN.1 encoded form of this X.509 GeneralName value.
a byte array containing ASN.1 encode form. |
getEncodedName | public byte[] getEncodedName()(Code) | | the encoded value of the name without the tag associated with the name in the GeneralName structure throws: IOException - |
getName | public Object getName()(Code) | | the value of the name. The class of name object depends on the tag as follows:[0] otherName - OtherName object,[1] rfc822Name - String object,[2] dNSName - String object,[3] x400Address - ORAddress object,[4] directoryName - instance of Name object,[5] ediPartyName - EDIPartyName object,[6] uniformResourceIdentifier - String object,[7] iPAddress - array of bytes such as:For IP v4, as specified in RFC 791, the address mustcontain exactly 4 byte component. For IP v6, as specified inRFC 1883, the address must contain exactly 16 byte component.If GeneralName structure is used as a part of Name Constraintsextension, to represent an address range the number of addresscomponent is doubled (to 8 and 32 bytes respectively).[8] registeredID - String. |
getTag | public int getTag()(Code) | | Returns the tag of the name in the structure
the tag of the name |
hashCode | public int hashCode()(Code) | | |
ipBytesToStr | public static String ipBytesToStr(byte[] ip)(Code) | | Helper method. Converts the byte array representation of ip address
to the String.
Parameters: ip - : byte array representation of ip addressIf the length of byte array 4 then it represents an IP v4 and the output String will be in the dotted quad form. If the length is 16 then it represents an IP v6 and the output String will be returned in format "p1:p2:...:p8", where p1-p8 are hexadecimal values representing the eight 16-bit pieces of the address.If the length is 8 or 32 then it represents an address range (RFC 1519)and the output String will contain 2 IP address divided by "/" String representation of ip address |
ipStrToBytes | public static byte[] ipStrToBytes(String ip) throws IOException(Code) | | Helper method. Converts the String representation of IP address
to the array of bytes. IP addresses are expected in two versions:
IPv4 - in dot-decimal notation
IPv6 - in colon hexadecimal notation
Also method works with the ranges of the addresses represented
as 2 addresses separated by '/' character.
Parameters: address - : String representation of IP address byte representation of IP address |
isAcceptable | public boolean isAcceptable(GeneralName gname)(Code) | | Checks if the other general name is acceptable by this object.
The name is acceptable if it has the same type name and its
name value is equal to name value of this object. Also the name
is acceptable if this general name object is a part of name
constraints and the specified name is satisfied the restriction
provided by this object (for more detail see section 4.2.1.11
of rfc 3280).
Note that for X400Address [3] check procedure is unclear so method
just checks the equality of encoded forms.
For otherName [0], ediPartyName [5], and registeredID [8]
the check procedure if not defined by rfc 3280 and for names of
these types this method also checks only for equality of encoded forms.
|
oidStrToInts | public static int[] oidStrToInts(String oid) throws IOException(Code) | | Converts OID into array of bytes.
|
|
|