com.ibm.security.pkcs9
Class Countersignature

java.lang.Object
  |
  +--com.ibm.security.pkcsutil.PKCSDerObject
        |
        +--com.ibm.security.pkcs9.PKCS9DerObject
              |
              +--com.ibm.security.pkcs9.Countersignature

public final class Countersignature
extends PKCS9DerObject
implements Cloneable

Implements the ASN.1 Countersignature attribute type. The Countersignature object specifies one or more signatures.

A Countersignature attribute can have multiple attribute values.

Countersignature ::= SignerInfo

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


Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject
provider
 
Constructor Summary
Countersignature(byte[] der)
          Create a Countersignature object with a DER byte array.
Countersignature(byte[] der, String provider)
          Create a Countersignature object with a DER byte array.
Countersignature(SignerInfo signerinfo)
          Create an Countersignature object with a SignerInfo object as the only element of the set of SignerInfo objects.
Countersignature(SignerInfo[] signerinfos)
          Create an Countersignature object with an array of Strings.
Countersignature(SignerInfo[] signerinfos, String provider)
          Create an Countersignature object with an array of Strings.
Countersignature(SignerInfo signerinfo, String provider)
          Create an Countersignature object with a SignerInfo object as the only element of the set of SignerInfo objects.
Countersignature(String filename, boolean base64)
          Create a Countersignature with the filename of the DER-encoded or BASE64-encoded object.
Countersignature(String filename, boolean base64, String provider)
          Create a Countersignature with the filename of the DER-encoded or BASE64-encoded object.
 
Method Summary
 Object clone()
          Creates a clone of this Countersignature object.
protected  void decode(com.ibm.security.pkcs9.DerValue encoding)
          Initializes a Countersignature object from a DerValue.
 void encode(OutputStream os)
          Encodes this object to an OutputStream.
 boolean equals(Object obj)
          Determines if this Countersignature object is equivalent to the input object.
 String getAttributeName()
          Returns a String indicating the name of the attribute.
 ObjectIdentifier getObjectIdentifier()
          Returns the ObjectIdentifer for the Countersignature attribute.
 SignerInfo[] getSignerInfos()
          Returns a copy of the array of SignerInfo objects for this Countersignature object.
 Object getValue()
          Calls the getSignerInfos method.
 boolean isSingleValued()
          Returns false.
 boolean isTagValid(byte tag)
          Returns a boolean indicating if the tag is valid for this object.
 String toString()
          Returns a string representation of this Countersignature object.
 
Methods inherited from class com.ibm.security.pkcs9.PKCS9DerObject
getName, getOID, getPKCSAttribute
 
Methods inherited from class com.ibm.security.pkcsutil.PKCSDerObject
decode, decode, encode, hashCode, read, readBASE64, write, write, writeBASE64
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Countersignature

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

Countersignature

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

Countersignature

public Countersignature(SignerInfo signerinfo)
Create an Countersignature object with a SignerInfo object as the only element of the set of SignerInfo objects.
Parameters:
signerinfo - SignerInfo

Countersignature

public Countersignature(SignerInfo signerinfo,
                        String provider)
Create an Countersignature object with a SignerInfo object as the only element of the set of SignerInfo objects.
Parameters:
signerinfo - SignerInfo
provider - the provider to be used

Countersignature

public Countersignature(SignerInfo[] signerinfos)
Create an Countersignature object with an array of Strings.
Parameters:
signerinfos - SignerInfo array

Countersignature

public Countersignature(SignerInfo[] signerinfos,
                        String provider)
Create an Countersignature object with an array of Strings.
Parameters:
signerinfos - SignerInfo array
provider - the provider to be used

Countersignature

public Countersignature(String filename,
                        boolean base64)
                 throws IOException
Create a Countersignature 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.

Countersignature

public Countersignature(String filename,
                        boolean base64,
                        String provider)
                 throws IOException
Create a Countersignature 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 Countersignature object.
Overrides:
clone in class Object
Returns:
clone of this Countersignature object.

equals

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

getObjectIdentifier

public ObjectIdentifier getObjectIdentifier()
Returns the ObjectIdentifer for the Countersignature attribute.
Overrides:
getObjectIdentifier in class PKCSDerObject
Returns:
the ObjectIdentifer for the Countersignature attribute.

encode

public void encode(OutputStream os)
            throws IOException
Encodes this object to an OutputStream. The Countersignature object is encoded as a UTCTime or GeneralizedTime depending upon the bUTCTime attribute value.
Overrides:
encode in class PKCSDerObject
Parameters:
os - the OutputStream to write the encoded data to.
Throws:
IOException - on encoding errors.

getSignerInfos

public SignerInfo[] getSignerInfos()
Returns a copy of the array of SignerInfo objects for this Countersignature object.
Returns:
SignerInfo array.

getValue

public Object getValue()
Calls the getSignerInfos method. Standard method to access the value of the PKCS #9 object.
Overrides:
getValue in class PKCS9DerObject

isTagValid

public boolean isTagValid(byte tag)
Returns a boolean indicating if the tag is valid for this object. The Countersignature object does not have a primative tag type. Instead it relies upon the top level tag for the SignerInfo object.
Overrides:
isTagValid in class PKCS9DerObject
Returns:
true if tag_Sequence, false otherwise.

isSingleValued

public boolean isSingleValued()
Returns false. Countersignature allows multiple attribute values.
Overrides:
isSingleValued in class PKCS9DerObject
Returns:
false

getAttributeName

public String getAttributeName()
Returns a String indicating the name of the attribute.
Overrides:
getAttributeName in class PKCS9DerObject
Returns:
name of the Countersignature attribute.

toString

public String toString()
Returns a string representation of this Countersignature object.
Overrides:
toString in class PKCSDerObject
Returns:
a string representation of this object.

decode

protected void decode(com.ibm.security.pkcs9.DerValue encoding)
               throws IOException
Initializes a Countersignature object from a DerValue. The DER encoding must be in the format specified by the Countersignature ASN.1 notation. The bUTCTime flag on the Countersignature object is set according to the DER encoding tag.
Overrides:
decode in class PKCS9DerObject
Parameters:
encoding - a DER-encoded Countersignature object.
Throws:
IOException - on parsing error.