java.lang.Object | |
↳ | sun.security.util.DerValue |
Represents a single DER-encoded value. DER encoding rules are a subset of the "Basic" Encoding Rules (BER), but they only support a single way ("Definite" encoding) to encode any given value.
All DER-encoded data are triples {type, length, data}. This class represents such tagged values as they have been read (or constructed), and provides structured access to the encoded data.
At this time, this class supports only a subset of the types of DER data encodings which are defined. That subset is sufficient for parsing most X.509 certificates, and working with selected additional formats (such as PKCS #10 certificate requests, and some kinds of PKCS #7 data). A note with respect to T61/Teletex strings: From RFC 1617, section 4.1.3 and RFC 3280, section 4.1.2.4., we assume that this kind of string will contain ISO-8859-1 characters only.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
byte | TAG_APPLICATION | ||||||||||
byte | TAG_CONTEXT | ||||||||||
byte | TAG_PRIVATE | ||||||||||
byte | TAG_UNIVERSAL | The tag class types | |||||||||
byte | tag_BMPString | Tag value indicating an ASN.1 "BMPString" value. | |||||||||
byte | tag_BitString | Tag value indicating an ASN.1 "BIT STRING" value. | |||||||||
byte | tag_Boolean | Tag value indicating an ASN.1 "BOOLEAN" value. | |||||||||
byte | tag_Enumerated | Tag value including an ASN.1 "ENUMERATED" value | |||||||||
byte | tag_GeneralString | Tag value indicating an ASN.1 "GenerallString" value. | |||||||||
byte | tag_GeneralizedTime | Tag value indicating an ASN.1 "GeneralizedTime" value. | |||||||||
byte | tag_IA5String | Tag value including an ASCII string | |||||||||
byte | tag_Integer | Tag value indicating an ASN.1 "INTEGER" value. | |||||||||
byte | tag_Null | Tag value indicating an ASN.1 "NULL" value. | |||||||||
byte | tag_ObjectId | Tag value indicating an ASN.1 "OBJECT IDENTIFIER" value. | |||||||||
byte | tag_OctetString | Tag value indicating an ASN.1 "OCTET STRING" value. | |||||||||
byte | tag_PrintableString | Tag value including a "printable" string | |||||||||
byte | tag_Sequence | Tag value indicating an ASN.1 "SEQUENCE" (zero to N elements, order is significant). | |||||||||
byte | tag_SequenceOf | Tag value indicating an ASN.1 "SEQUENCE OF" (one to N elements, order is significant). | |||||||||
byte | tag_Set | Tag value indicating an ASN.1 "SET" (zero to N members, order does not matter). | |||||||||
byte | tag_SetOf | Tag value indicating an ASN.1 "SET OF" (one to N members, order does not matter). | |||||||||
byte | tag_T61String | Tag value including a "teletype" string | |||||||||
byte | tag_UTF8String | Tag value indicating an ASN.1 "UTF8String" value. | |||||||||
byte | tag_UniversalString | Tag value indicating an ASN.1 "UniversalString" value. | |||||||||
byte | tag_UtcTime | Tag value indicating an ASN.1 "UTCTime" value. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
buffer | |||||||||||
data | The DER-encoded data of the value. | ||||||||||
tag | The DER tag of the value; one of the tag_ constants. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a PrintableString or UTF8string DER value from a string
| |||||||||||
Creates a string type DER value from a String object
| |||||||||||
Creates a DerValue from a tag and some DER-encoded data.
| |||||||||||
Get an ASN.1/DER encoded datum from a buffer.
| |||||||||||
Get an ASN.1/DER encoded datum from part of a buffer.
| |||||||||||
Get an ASN1/DER encoded datum from an input stream.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create the tag of the attribute.
| |||||||||||
Encode an ASN1/DER encoded datum onto a DER output stream.
| |||||||||||
Returns true iff the other object is a DER value which
is bitwise equal to this one.
| |||||||||||
Bitwise equality comparison.
| |||||||||||
Returns the name component as a Java string, regardless of its
encoding restrictions (ASCII, T61, Printable, IA5, BMP, UTF8).
| |||||||||||
Returns the ASN.1 BMP (Unicode) STRING value as a Java string.
| |||||||||||
Returns an ASN.1 INTEGER value as a BigInteger.
| |||||||||||
Returns an ASN.1 BIT STRING value, with the tag assumed implicit
based on the parameter.
| |||||||||||
Returns an ASN.1 BIT STRING value.
| |||||||||||
Returns an ASN.1 BOOLEAN
| |||||||||||
Helper routine to return all the bytes contained in the
DerInputStream associated with this object.
| |||||||||||
Returns an ASN.1 ENUMERATED value.
| |||||||||||
Returns the ASN.1 GENERAL STRING value as a Java String.
| |||||||||||
Returns a Date if the DerValue is GeneralizedTime.
| |||||||||||
Returns an ASN.1 IA5 (ASCII) STRING value
| |||||||||||
Returns an ASN.1 INTEGER value as an integer.
| |||||||||||
Returns an ASN.1 OBJECT IDENTIFIER.
| |||||||||||
Returns an ASN.1 OCTET STRING
| |||||||||||
Returns an ASN.1 INTEGER value as a positive BigInteger.
| |||||||||||
Returns an ASN.1 STRING value
| |||||||||||
Returns an ASN.1 T61 (Teletype) STRING value
| |||||||||||
Returns a Date if the DerValue is UtcTime.
| |||||||||||
Returns the ASN.1 UTF-8 STRING value as a Java String.
| |||||||||||
Returns an ASN.1 BIT STRING value that need not be byte-aligned.
| |||||||||||
Returns an ASN.1 BIT STRING value, with the tag assumed implicit
based on the parameter.
| |||||||||||
Returns a hashcode for this DerValue.
| |||||||||||
Returns true if the tag class is APPLICATION.
| |||||||||||
Returns true iff the CONSTRUCTED TAG matches the passed tag.
| |||||||||||
Returns true iff the CONSTRUCTED bit is set in the type tag.
| |||||||||||
Returns true iff the CONTEXT SPECIFIC TAG matches the passed tag.
| |||||||||||
Returns true iff the CONTEXT SPECIFIC bit is set in the type tag.
| |||||||||||
Determine if a character is one of the permissible characters for
PrintableString:
A-Z, a-z, 0-9, space, apostrophe (39), left and right parentheses,
plus sign, comma, hyphen, period, slash, colon, equals sign,
and question mark.
| |||||||||||
Returns true if the tag class is UNIVERSAL.
| |||||||||||
Get the length of the encoded value.
| |||||||||||
Set the tag of the attribute.
| |||||||||||
Returns a DER-encoded value, such that if it's passed to the
DerValue constructor, a value equivalent to "this" is returned.
| |||||||||||
For "set" and "sequence" types, this function may be used
to return a DER stream of the members of the set or sequence.
| |||||||||||
Returns a printable representation of the value.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
The tag class types
Tag value indicating an ASN.1 "BMPString" value.
Tag value indicating an ASN.1 "BIT STRING" value.
Tag value indicating an ASN.1 "BOOLEAN" value.
Tag value including an ASN.1 "ENUMERATED" value
Tag value indicating an ASN.1 "GenerallString" value.
Tag value indicating an ASN.1 "GeneralizedTime" value.
Tag value including an ASCII string
Tag value indicating an ASN.1 "INTEGER" value.
Tag value indicating an ASN.1 "NULL" value.
Tag value indicating an ASN.1 "OBJECT IDENTIFIER" value.
Tag value indicating an ASN.1 "OCTET STRING" value.
Tag value including a "printable" string
Tag value indicating an ASN.1 "SEQUENCE" (zero to N elements, order is significant).
Tag value indicating an ASN.1 "SEQUENCE OF" (one to N elements, order is significant).
Tag value indicating an ASN.1 "SET" (zero to N members, order does not matter).
Tag value indicating an ASN.1 "SET OF" (one to N members, order does not matter).
Tag value including a "teletype" string
Tag value indicating an ASN.1 "UTF8String" value.
Tag value indicating an ASN.1 "UniversalString" value.
Tag value indicating an ASN.1 "UTCTime" value.
The DER tag of the value; one of the tag_ constants.
Creates a PrintableString or UTF8string DER value from a string
IOException |
---|
Creates a string type DER value from a String object
stringTag | the tag for the DER value to create |
---|---|
value | the String object to use for the DER value |
IOException |
---|
Creates a DerValue from a tag and some DER-encoded data.
tag | the DER type tag |
---|---|
data | the DER-encoded data |
Get an ASN.1/DER encoded datum from a buffer. The entire buffer must hold exactly one datum, including its tag and length.
buf | buffer holding a single DER-encoded datum. |
---|
IOException |
---|
Get an ASN.1/DER encoded datum from part of a buffer. That part of the buffer must hold exactly one datum, including its tag and length.
buf | the buffer |
---|---|
offset | start point of the single DER-encoded dataum |
IOException |
---|
Get an ASN1/DER encoded datum from an input stream. The stream may have additional data following the encoded datum. In case of indefinite length encoded datum, the input stream must hold only one datum.
in | the input stream holding a single DER datum, which may be followed by additional data |
---|
IOException |
---|
Create the tag of the attribute.
Encode an ASN1/DER encoded datum onto a DER output stream.
IOException |
---|
Returns true iff the other object is a DER value which is bitwise equal to this one.
other | the object being compared with this one |
---|
true
if this object is the same as the obj
argument; false
otherwise.Bitwise equality comparison. DER encoded values have a single encoding, so that bitwise equality of the encoded values is an efficient way to establish equivalence of the unencoded values.
other | the object being compared with this one |
---|
Returns the name component as a Java string, regardless of its encoding restrictions (ASCII, T61, Printable, IA5, BMP, UTF8).
IOException |
---|
Returns the ASN.1 BMP (Unicode) STRING value as a Java string.
IOException |
---|
Returns an ASN.1 INTEGER value as a BigInteger.
IOException |
---|
Returns an ASN.1 BIT STRING value, with the tag assumed implicit based on the parameter. The bit string must be byte-aligned.
IOException |
---|
Returns an ASN.1 BIT STRING value. The bit string must be byte-aligned.
IOException |
---|
Helper routine to return all the bytes contained in the DerInputStream associated with this object.
IOException |
---|
Returns the ASN.1 GENERAL STRING value as a Java String.
IOException |
---|
Returns a Date if the DerValue is GeneralizedTime.
IOException |
---|
Returns an ASN.1 IA5 (ASCII) STRING value
IOException |
---|
Returns an ASN.1 INTEGER value as an integer.
IOException |
---|
Returns an ASN.1 INTEGER value as a positive BigInteger. This is just to deal with implementations that incorrectly encode some values as negative.
IOException |
---|
Returns an ASN.1 T61 (Teletype) STRING value
IOException |
---|
Returns a Date if the DerValue is UtcTime.
IOException |
---|
Returns the ASN.1 UTF-8 STRING value as a Java String.
IOException |
---|
Returns an ASN.1 BIT STRING value that need not be byte-aligned.
IOException |
---|
Returns an ASN.1 BIT STRING value, with the tag assumed implicit based on the parameter. The bit string need not be byte-aligned.
IOException |
---|
Returns a hashcode for this DerValue.
Returns true if the tag class is APPLICATION.
Returns true iff the CONSTRUCTED TAG matches the passed tag.
Returns true iff the CONSTRUCTED bit is set in the type tag.
Returns true iff the CONTEXT SPECIFIC TAG matches the passed tag.
Returns true iff the CONTEXT SPECIFIC bit is set in the type tag. This is associated with the ASN.1 "DEFINED BY" syntax.
Determine if a character is one of the permissible characters for PrintableString: A-Z, a-z, 0-9, space, apostrophe (39), left and right parentheses, plus sign, comma, hyphen, period, slash, colon, equals sign, and question mark. Characters that are *not* allowed in PrintableString include exclamation point, quotation mark, number sign, dollar sign, percent sign, ampersand, asterisk, semicolon, less than sign, greater than sign, at sign, left and right square brackets, backslash, circumflex (94), underscore, back quote (96), left and right curly brackets, vertical line, tilde, and the control codes (0-31 and 127). This list is based on X.680 (the ASN.1 spec).
Returns true if the tag class is UNIVERSAL.
Get the length of the encoded value.
Set the tag of the attribute. Commonly used to reset the tag value used for IMPLICIT encodings.
Returns a DER-encoded value, such that if it's passed to the DerValue constructor, a value equivalent to "this" is returned.
IOException |
---|
For "set" and "sequence" types, this function may be used to return a DER stream of the members of the set or sequence. This operation is not supported for primitive types such as integers or bit strings.
IOException |
---|
Returns a printable representation of the value.