com.ibm.security.pkcsutil
Class UnresolvedAttribute

com.ibm.security.pkcsutil.UnresolvedAttribute

public final class UnresolvedAttribute
implements Cloneable

Attributes are additonal information which can be inserted in a PKCS #10 certificate request. For example a "Driving License Certificate" could have the driving license number as an attribute. They are also used to add information to the PrivateKeyInfo defined by PKCS #8.

Attributes are represented as a sequence of the attribute identifier (Object Identifier) and a set of DER encoded attribute values. ASN.1 definition of Attribute:

Attribute :: SEQUENCE { type AttributeType, values SET OF AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY defined by type

UnresolvedAttribute objects are immutable; they cannot be changed once created.


Constructor Summary
UnresolvedAttribute()
          Default constructor for the UnresolvedAttribute object.
UnresolvedAttribute(byte[] der)
          Create an UnresolvedAttribute object with a DER byte array.
UnresolvedAttribute(byte[] der, String provider)
          Create an UnresolvedAttribute object with a DER byte array.
UnresolvedAttribute(ObjectIdentifier id, Object value)
          Constructs an attribute from individual components of ObjectIdentifier and the value (any java object).
UnresolvedAttribute(ObjectIdentifier id, Object value, String provider)
          Constructs an attribute from individual components of ObjectIdentifier and the value (any java object).
UnresolvedAttribute(String provider)
          Constructor for the UnresolvedAttribute object.
UnresolvedAttribute(String filename, boolean base64)
          Create an UnresolvedAttribute with the filename of the DER-encoded or BASE64-encoded object.
UnresolvedAttribute(String filename, boolean base64, String provider)
          Create an UnresolvedAttribute with the filename of the DER-encoded or BASE64-encoded object.
 
Method Summary
 Object clone()
          Creates a clone of this UnresolvedAttribute object.
protected  void decode(com.ibm.security.pkcsutil.DerValue encoding)
          Initializes an UnresolvedAttribute object from a DerValue.
 void derEncode(OutputStream out)
          DER encode this object onto an output stream.
 void encode(OutputStream out)
          Encode the attributes in DER form to the stream.
 boolean equals(Object obj)
          Determines if this UnresolvedAttribute object is equivalent to the input object.
 ObjectIdentifier getObjectIdentifier()
          Returns a reference to the ObjectIdentifier of the attribute.
 Object getValue()
          Returns a copy of the attribute value.
 String toString()
          Returns the attribute in user readable form.
 

Constructor Detail

UnresolvedAttribute

public UnresolvedAttribute()
Default constructor for the UnresolvedAttribute object.

UnresolvedAttribute

public UnresolvedAttribute(String provider)
Constructor for the UnresolvedAttribute object.

UnresolvedAttribute

public UnresolvedAttribute(byte[] der)
                    throws IOException
Create an UnresolvedAttribute object with a DER byte array.
Parameters:
der - a DER byte array of an UnresolvedAttribute object.
Throws:
IOException - on decoding errors.

UnresolvedAttribute

public UnresolvedAttribute(byte[] der,
                           String provider)
                    throws IOException
Create an UnresolvedAttribute object with a DER byte array.
Parameters:
der - a DER byte array of an UnresolvedAttribute object.
provider - the provider to be used.
Throws:
IOException - on decoding errors.

UnresolvedAttribute

public UnresolvedAttribute(ObjectIdentifier id,
                           Object value)
                    throws IOException
Constructs an attribute from individual components of ObjectIdentifier and the value (any java object).
Parameters:
id - the ObjectIdentifier of the attribute.
value - a DER-encoding of the SET OF value identified by the ObjectIdentifier; this argument must be a byte array.
Throws:
IllegalArgumentException - if the value argument is not a byte array or a DER-encoding of a SET OF.
IOException - if the value argument is not a valid DER-encoding.

UnresolvedAttribute

public UnresolvedAttribute(ObjectIdentifier id,
                           Object value,
                           String provider)
                    throws IOException
Constructs an attribute from individual components of ObjectIdentifier and the value (any java object).
Parameters:
id - the ObjectIdentifier of the attribute.
value - a DER-encoding of the SET OF value identified by the ObjectIdentifier; this argument must be a byte array.
provider - the provider to be used.
Throws:
IllegalArgumentException - if the value argument is not a byte array or a DER-encoding of a SET OF.
IOException - if the value argument is not a valid DER-encoding.

UnresolvedAttribute

public UnresolvedAttribute(String filename,
                           boolean base64)
                    throws IOException
Create an UnresolvedAttribute with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
Throws:
IOException - on decoding errors.

UnresolvedAttribute

public UnresolvedAttribute(String filename,
                           boolean base64,
                           String provider)
                    throws IOException
Create an UnresolvedAttribute with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
provider - the provider to be used
Throws:
IOException - on decoding errors.
Method Detail

clone

public Object clone()
Creates a clone of this UnresolvedAttribute object.
Returns:
clone of this UnresolvedAttribute object.

equals

public boolean equals(Object obj)
Determines if this UnresolvedAttribute object is equivalent to the input object.
Parameters:
other - the object to compare this one to.
Returns:
true, if the two objects are equivalent, false otherwise.

encode

public void encode(OutputStream out)
            throws IOException
Encode the attributes in DER form to the stream.
Parameters:
out - the OutputStream to marshal the contents to.
Throws:
IOException - on encoding errors.

derEncode

public void derEncode(OutputStream out)
               throws IOException
DER encode this object onto an output stream. Implements the DerEncoder interface.
Parameters:
out - the OutputStream on which to write the DER encoding.
Throws:
IOException - on encoding errors.

getObjectIdentifier

public ObjectIdentifier getObjectIdentifier()
Returns a reference to the ObjectIdentifier of the attribute. The attribute object identifier is an immutable object.

getValue

public Object getValue()
                throws IOException
Returns a copy of the attribute value.
Throws:
IOException - if the attribute value cannot be copied.

toString

public String toString()
Returns the attribute in user readable form.

decode

protected void decode(com.ibm.security.pkcsutil.DerValue encoding)
               throws IOException
Initializes an UnresolvedAttribute object from a DerValue. The DER encoding must be in the format specified by the ASN.1 notation of the contained attribute.
Parameters:
encoding - a DER-encoded UnresolvedAttribute object.
Throws:
IOException - on parsing error.