Top Description Fields Constructors Methods
sun.security.x509

public Class AVA

Additional top-level class in compilation unit: AVAKeyword.

extends Object
implements DerEncoder
Class Inheritance
All Implemented Interfaces
sun.security.util.DerEncoder
Imports
java.io.ByteArrayOutputStream, .IOException, .Reader, java.text.Normalizer, java.util.*, sun.security.action.GetBooleanAction, sun.security.util.*, sun.security.pkcs.PKCS9Attribute

X.500 Attribute-Value-Assertion (AVA): an attribute, as identified by some attribute ID, has some particular value. Values are as a rule ASN.1 printable strings. A conventional set of type IDs is recognized when parsing (and generating) RFC 1779, 2253 or 4514 syntax strings.

AVAs are components of X.500 relative names. Think of them as being individual fields of a database record. The attribute ID is how you identify the field, and the value is part of a particular record.

Note that instances of this class are immutable.

Authors
David Brownell, Amit Kapoor, Hemma Prafullchandra
See Also
X500Name, RDN

Field Summary

Modifier and TypeField and Description
private static final Debug
pack-priv static final int
DEFAULT

DEFAULT format allows both RFC1779 and RFC2253 syntax and additional keywords.

private static final String
pack-priv final ObjectIdentifier
private static final boolean
pack-priv static final int
RFC1779

RFC1779 specifies format according to RFC1779.

pack-priv static final int
RFC2253

RFC2253 specifies format according to RFC2253.

private static final String
private static final String
private static final String
pack-priv final DerValue

Constructor Summary

AccessConstructor and Description
public
pack-priv
AVA(Reader in)

Parse an RFC 1779, 2253 or 4514 style AVA string: CN=fee fie foe fum or perhaps with quotes.

pack-priv
AVA(Reader in, Map<String, String> keywordMap)

Parse an RFC 1779, 2253 or 4514 style AVA string: CN=fee fie foe fum or perhaps with quotes.

pack-priv
AVA(Reader in, int format)

Parse an AVA string formatted according to format.

pack-priv
AVA(Reader
Reader containing AVA String
in
,
int
parsing format
format
,
Map<String, String>
a Map where a keyword String maps to a corresponding OID String. Each AVA keyword will be mapped to the corresponding OID. If an entry does not exist, it will fall back to the builtin keyword/OID mapping.
keywordMap
)

Parse an AVA string formatted according to format.

pack-priv
AVA(DerValue derval)

pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
encode(DerOutputStream
the output stream on which to write the DER encoding.
out
)

Implements sun.security.util.DerEncoder.encode.

DER encode this object onto an output stream.

public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public DerValue
getDerValue()

Get the value of this AVA as a DerValue.

private static Byte
private static String
public ObjectIdentifier
getObjectIdentifier()

Get the ObjectIdentifier of this AVA.

public String
getValueString()

Get the value of this AVA as a String.

public int

Returns:

a hashcode for this AVA
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this AVA.

pack-priv boolean
private static boolean
isDerString(DerValue value, boolean canonical)

private static boolean
isTerminator(int ch, int format)

private static DerValue
parseHexString(Reader in, int format)

private DerValue
private DerValue
parseString(Reader in, int c, int format, StringBuilder temp)

private static int
readChar(Reader in, String errMsg)

private String
toKeyword(int format, Map<String, String> oidMap)

private String
public String
toRFC1779String()

Returns a printable form of this attribute, using RFC 1779 syntax for individual attribute/value assertions.

public String
toRFC1779String(Map<String, String> oidMap)

Returns a printable form of this attribute, using RFC 1779 syntax for individual attribute/value assertions.

public String
public String
toRFC2253String()

Returns a printable form of this attribute, using RFC 2253 syntax for individual attribute/value assertions.

public String
toRFC2253String(Map<String, String> oidMap)

Returns a printable form of this attribute, using RFC 2253 syntax for individual attribute/value assertions.

public String
toString()

Overrides java.lang.Object.toString.

Returns a printable form of this attribute, using RFC 1779 syntax for individual attribute/value assertions.

private static boolean
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

debugback to summary
private static final Debug debug
DEFAULTback to summary
pack-priv static final int DEFAULT

DEFAULT format allows both RFC1779 and RFC2253 syntax and additional keywords.

escapedDefaultback to summary
private static final String escapedDefault
oidback to summary
pack-priv final ObjectIdentifier oid
PRESERVE_OLD_DC_ENCODINGback to summary
private static final boolean PRESERVE_OLD_DC_ENCODING
RFC1779back to summary
pack-priv static final int RFC1779

RFC1779 specifies format according to RFC1779.

RFC2253back to summary
pack-priv static final int RFC2253

RFC2253 specifies format according to RFC2253.

specialChars1779back to summary
private static final String specialChars1779
specialChars2253back to summary
private static final String specialChars2253
specialCharsDefaultback to summary
private static final String specialCharsDefault
valueback to summary
pack-priv final DerValue value

Constructor Detail

AVAback to summary
public AVA(ObjectIdentifier type, DerValue val)
AVAback to summary
pack-priv AVA(Reader in) throws IOException

Parse an RFC 1779, 2253 or 4514 style AVA string: CN=fee fie foe fum or perhaps with quotes. Not all defined AVA tags are supported; of current note are X.400 related ones (PRMD, ADMD, etc.). This terminates at unescaped AVA separators ("+") or RDN separators (",", ";"), and removes cosmetic whitespace at the end of values.

AVAback to summary
pack-priv AVA(Reader in, Map<String, String> keywordMap) throws IOException

Parse an RFC 1779, 2253 or 4514 style AVA string: CN=fee fie foe fum or perhaps with quotes. Additional keywords can be specified in the keyword/OID map. This terminates at unescaped AVA separators ("+") or RDN separators (",", ";"), and removes cosmetic whitespace at the end of values.

AVAback to summary
pack-priv AVA(Reader in, int format) throws IOException

Parse an AVA string formatted according to format.

AVAback to summary
pack-priv AVA(Reader in, int format, Map<String, String> keywordMap) throws IOException

Parse an AVA string formatted according to format.

Parameters
in:Reader

Reader containing AVA String

format:int

parsing format

keywordMap:Map<String, String>

a Map where a keyword String maps to a corresponding OID String. Each AVA keyword will be mapped to the corresponding OID. If an entry does not exist, it will fall back to the builtin keyword/OID mapping.

Exceptions
IOException:
if the AVA String is not valid in the specified format or an OID String from the keywordMap is improperly formatted
AVAback to summary
pack-priv AVA(DerValue derval) throws IOException
AVAback to summary
pack-priv AVA(DerInputStream in) throws IOException

Method Detail

encodeback to summary
public void encode(DerOutputStream out)

Implements sun.security.util.DerEncoder.encode.

DER encode this object onto an output stream. Implements the DerEncoder interface.

Parameters
out:DerOutputStream

the output stream on which to write the DER encoding.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDerValueback to summary
public DerValue getDerValue()

Get the value of this AVA as a DerValue.

getEmbeddedHexPairback to summary
private static Byte getEmbeddedHexPair(int c1, Reader in) throws IOException
getEmbeddedHexStringback to summary
private static String getEmbeddedHexString(List<Byte> hexList)
getObjectIdentifierback to summary
public ObjectIdentifier getObjectIdentifier()

Get the ObjectIdentifier of this AVA.

getValueStringback to summary
public String getValueString()

Get the value of this AVA as a String.

Exceptions
RuntimeException:
if we could not obtain the string form (should not occur)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hashcode for this AVA.

Returns:int

a hashcode for this AVA

Annotations
@Override
hasRFC2253Keywordback to summary
pack-priv boolean hasRFC2253Keyword()
isDerStringback to summary
private static boolean isDerString(DerValue value, boolean canonical)
isTerminatorback to summary
private static boolean isTerminator(int ch, int format)
parseHexStringback to summary
private static DerValue parseHexString(Reader in, int format) throws IOException
parseQuotedStringback to summary
private DerValue parseQuotedString(Reader in, StringBuilder temp) throws IOException
parseStringback to summary
private DerValue parseString(Reader in, int c, int format, StringBuilder temp) throws IOException
readCharback to summary
private static int readChar(Reader in, String errMsg) throws IOException
toKeywordback to summary
private String toKeyword(int format, Map<String, String> oidMap)
toKeywordValueStringback to summary
private String toKeywordValueString(String keyword)
toRFC1779Stringback to summary
public String toRFC1779String()

Returns a printable form of this attribute, using RFC 1779 syntax for individual attribute/value assertions. It only emits standardised keywords.

toRFC1779Stringback to summary
public String toRFC1779String(Map<String, String> oidMap)

Returns a printable form of this attribute, using RFC 1779 syntax for individual attribute/value assertions. It emits standardised keywords, as well as keywords contained in the OID/keyword map.

toRFC2253CanonicalStringback to summary
public String toRFC2253CanonicalString()
toRFC2253Stringback to summary
public String toRFC2253String()

Returns a printable form of this attribute, using RFC 2253 syntax for individual attribute/value assertions. It only emits standardised keywords.

toRFC2253Stringback to summary
public String toRFC2253String(Map<String, String> oidMap)

Returns a printable form of this attribute, using RFC 2253 syntax for individual attribute/value assertions. It emits standardised keywords, as well as keywords contained in the OID/keyword map.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a printable form of this attribute, using RFC 1779 syntax for individual attribute/value assertions.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object

trailingSpaceback to summary
private static boolean trailingSpace(Reader in) throws IOException