com.ibm.security.pkcs7
Class UserKeyingMaterial

java.lang.Object
  |
  +--com.ibm.security.pkcsutil.PKCSDerObject
        |
        +--com.ibm.security.pkcs7.UserKeyingMaterial

public final class UserKeyingMaterial
extends PKCSDerObject
implements Cloneable

Implements the ASN.1 UserKeyingMaterial type.

The UserKeyingMaterial type gives a syntax for user keying material (UKM) which is required by some key management algorithms. The sender provides a UKM for a specific key management algorithm and the UKM is employed by all recipients that use the same key encryption algorithm.

UserKeyingMaterial :: = SEQUENCE { algorithm KeyEncryptionAlgorithmIdentifier, ukm OCTET STRING }

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


Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject
provider
 
Constructor Summary
UserKeyingMaterial(AlgorithmId alg, byte[] ukm)
          Create a UserKeyingMaterial object with the specified values.
UserKeyingMaterial(AlgorithmId alg, byte[] ukm, String provider)
          Create a UserKeyingMaterial object with the specified values.
UserKeyingMaterial(byte[] der)
          Create a UserKeyingMaterial object with a DER byte array.
UserKeyingMaterial(byte[] der, String provider)
          Create a UserKeyingMaterial object with a DER byte array.
UserKeyingMaterial(String filename, boolean base64)
          Create a UserKeyingMaterial with the filename of the DER-encoded or BASE64-encoded object.
UserKeyingMaterial(String filename, boolean base64, String provider)
          Create a UserKeyingMaterial with the filename of the DER-encoded or BASE64-encoded object.
 
Method Summary
 Object clone()
          Creates a clone of this UserKeyingMaterial object.
protected  void decode(com.ibm.security.pkcs7.DerValue encoding)
          Initializes a UserKeyingMaterial object from a DerValue.
 void encode(OutputStream os)
          Encodes this object to an OutputStream.
 boolean equals(Object other)
          Determines if this UserKeyingMaterial object is equivalent to the input object.
 AlgorithmId getKeyEncryptionAlgorithm()
          Returns a copy of the key encryption AlgorithmId for this object.
 byte[] getUserKeyringMaterial()
          Returns a copy of the user keyring material byte array for this object.
 String toString()
          Returns a string representation of this UserKeyingMaterial object.
 
Methods inherited from class com.ibm.security.pkcsutil.PKCSDerObject
decode, decode, encode, getObjectIdentifier, hashCode, read, readBASE64, write, write, writeBASE64
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserKeyingMaterial

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

UserKeyingMaterial

public UserKeyingMaterial(byte[] der,
                          String provider)
                   throws IOException
Create a UserKeyingMaterial object with a DER byte array.
Parameters:
der - a DER byte array encoding a UserKeyingMaterial object.
provider - the name of the java security provider to use.
Throws:
IOException - on decoding errors.

UserKeyingMaterial

public UserKeyingMaterial(AlgorithmId alg,
                          byte[] ukm)
Create a UserKeyingMaterial object with the specified values.
Parameters:
alg - the key encryption algorithm.
ukm - the keying material.

UserKeyingMaterial

public UserKeyingMaterial(AlgorithmId alg,
                          byte[] ukm,
                          String provider)
Create a UserKeyingMaterial object with the specified values.
Parameters:
alg - the key encryption algorithm.
ukm - the keying material.
provider - the name of the java security provider to use.

UserKeyingMaterial

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

UserKeyingMaterial

public UserKeyingMaterial(String filename,
                          boolean base64,
                          String provider)
                   throws IOException
Create a UserKeyingMaterial 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 name of the java security provider to use.
Throws:
IOException - on decoding errors.
Method Detail

encode

public void encode(OutputStream os)
            throws IOException
Encodes this object to an OutputStream.
Overrides:
encode in class PKCSDerObject
Parameters:
os - the OutputStream to write the encoded data to.
Throws:
IOException - on encoding error.

decode

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

getKeyEncryptionAlgorithm

public AlgorithmId getKeyEncryptionAlgorithm()
                                      throws IOException
Returns a copy of the key encryption AlgorithmId for this object.
Returns:
the key encryption AlgorithmId for this object.

getUserKeyringMaterial

public byte[] getUserKeyringMaterial()
Returns a copy of the user keyring material byte array for this object.
Returns:
the user keyring material byte array for this object.

equals

public boolean equals(Object other)
Determines if this UserKeyingMaterial 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.

clone

public Object clone()
Creates a clone of this UserKeyingMaterial object.
Overrides:
clone in class Object
Returns:
clone of this UserKeyingMaterial object.

toString

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