Class semper.crypto.CryptoKeyInfo
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.crypto.CryptoKeyInfo

java.lang.Object
   |
   +----semper.crypto.CryptoKeyInfo

public class CryptoKeyInfo
extends Object
implements CryptoConstants, Streamable
CryptoKeyInfo
Version:
$Revision: 1.18 $ $Date: 1996/09/06 15:59:54 $
Author:
Jesper Drud Nielsen ([email protected]), Torben Pryds Pedersen ([email protected])
See Also:
Statement

Constructor Index

 o CryptoKeyInfo()
Creates a new, empty key information object
 o CryptoKeyInfo(AccessName, byte[], CryptoKeyInfo, int, Capability)
Creates a new key information object with variables initialised by the parameters.
 o CryptoKeyInfo(CryptoKeyInfo)
Creates a new object based on the values of a given one.

Method Index

 o clearKeyId()
Deletes the key identifier from the object.
 o equals(CryptoKeyInfo)
Compares the CryptoKeyInfo with another CryptoKeyInfo
 o getAlg()
 o getCap()
 o getCommonKey()
Returns the value of the common key of the object.
 o getCommonKeyInfo()
Returns the common key of the object.
 o getKeyId()
Returns the key identifier in the object.
 o getKeyVal(boolean, CryptoKeyInfo)
Returns the key value stored in the object.
 o getLength()
Returns the block length for the conventional key.
 o myStreamSize()
Finds the expected number of bytes needed to externalize the object to s.
 o printContents()
 o readObject(StreamInputInterface)
Initialise a CryptoKeyInfo with values read from an io stream (SourceStream)
 o setAlg(int)
Sets the algorithm identifier of the object
 o setCap(Capability)
Sets the capability of the object if allowed by the present capability.
 o setCommonKeyInfo(CryptoKeyInfo)
Sets the common key of the object.
 o setKeyId(AccessName)
Defines the key identifier in the object.
 o setKeyVal(byte[])
Sets the actual key value of the object.
 o storeKeyVal(Date, boolean, CryptoKeyInfo)
If an expiration date is given as parameter the key value is stored in archive before being deleted.
 o writeObject(StreamOutputInterface)
Writes the state of the object to an io stream (TargetStream).

Constructors

 o CryptoKeyInfo
  public CryptoKeyInfo()
Creates a new, empty key information object
 o CryptoKeyInfo
  public CryptoKeyInfo(CryptoKeyInfo oldKeyInfo)
Creates a new object based on the values of a given one.
Parameters:
oldKeyInfo - is used to initialise the variables
 o CryptoKeyInfo
  public CryptoKeyInfo(AccessName newKeyId,
                       byte newKeyVal[],
                       CryptoKeyInfo newCommon,
                       int newAlgId,
                       Capability newCapability)
Creates a new key information object with variables initialised by the parameters. The supplied key value must not be encrypted.
Parameters:
newKeyID - is the identity of the key
newKeyVal - is the actual key value
newCommon - is the common part of the new key
identifies - the algorithm for which the key can be used
newCapabilityId - is the Id of the capability for protecting the key
Returns:
the new key information object

Methods

 o getKeyVal
  public byte[] getKeyVal(boolean decryptedKey,
                          CryptoKeyInfo masterKey) throws CryptoManException
Returns the key value stored in the object. If necessary the archive is used to retrieve it. The key is only returned if its capability is unlocked.
Parameters:
decryptedKey - if true the key will be decrypted (only if it is encrypted)
masterKey - is the key under which the key should be decrypted (if null the masterKey of CryptoMan will be used). If it is null no decryption will occur.
Returns:
an array of bytes containing the actual key
Throws: CryptoManException
if the capability is locked or problems with archive occur
See Also:
storeKeyVal
 o getCommonKey
  public byte[] getCommonKey() throws CryptoManException
Returns the value of the common key of the object. If necessary the archive is used to retrieve it. No master key is needed as the common key is not protected.
Returns:
key value of the common key
Throws: CryptoManException
if the common key value could not be retrieved
 o getCommonKeyInfo
  public CryptoKeyInfo getCommonKeyInfo()
Returns the common key of the object.
Returns:
the common key object
 o setCommonKeyInfo
  public void setCommonKeyInfo(CryptoKeyInfo newComKeyInfo)
Sets the common key of the object.
Parameters:
newComKeyInfo - is the new common key of the object
Returns:
void
 o setCap
  public void setCap(Capability newCapability) throws CryptoManException
Sets the capability of the object if allowed by the present capability.
Parameters:
newCapabiity - is the new capability of the object
Returns:
void
Throws: CryptoManException
if the old capability could not be unlocked
 o getAlg
  public int getAlg()
Returns:
the algorithm identifier corresponding to the key information object
 o setAlg
  public void setAlg(int newAlgId)
Sets the algorithm identifier of the object
Parameters:
newAlgId - is the new algorithm identifier.
 o getCap
  public Capability getCap()
Returns:
the capability identifier corresponding to the key information object
 o clearKeyId
  public void clearKeyId()
Deletes the key identifier from the object. Since the key identifier is a local handle, this may be useful if the KeyInfo object is part of Statement which is communicatd to another enntity.
 o setKeyId
  public void setKeyId(AccessName newKeyId)
Defines the key identifier in the object. This may be useful if a Statement is received from nother party and the recipient want to store it. The key identifier should never be changed for an already stored key!
Parameters:
newKeyId - is the new value of the key identifier
 o getKeyId
  public AccessName getKeyId()
Returns the key identifier in the object.
Returns:
the key identifier
 o storeKeyVal
  public void storeKeyVal(Date expDate,
                          boolean encryptKey,
                          CryptoKeyInfo masterKey) throws CryptoManException
If an expiration date is given as parameter the key value is stored in archive before being deleted. If requested the key is encrypted before being stored. Note that this method works on the given object - not a copy. The key is stored under a key derived from the keyId. Currently an exception is raised if the key had been stored previously.
Parameters:
expDate - tells for how long the key must be stored in archive
encryptKey - tells if the key should be encrypted before storage, if not, it will be done by the Archive.
masterKey - is the key encryption key (if null masterKey of CryptoMan will be used)
Throws: CryptoManException
if problems with archive or encryption
See Also:
getKeyVal
 o setKeyVal
  public void setKeyVal(byte newKeyVal[]) throws CryptoManException
Sets the actual key value of the object. Can be used to clear the key value of a CryptoKeyInfo object. It is assumed that the key is in clear
Parameters:
newKeyVal - is the new key value to be associated with this object
Returns:
void
Throws: CryptoManException
if the capability could not be unlocked
 o getLength
  public int getLength() throws CryptoManException
Returns the block length for the conventional key.
Returns:
the block length
Throws: CryptoManException
if the key does not designate a supported conventional algorithm
 o writeObject
  public void writeObject(StreamOutputInterface s) throws StreamIOException
Writes the state of the object to an io stream (TargetStream). Caveat: The actual key value is also written if not explcicitly cleared previously.
Parameters:
s - is the stream the object is written to
Returns:
void
Throws: StreamIOException
if the object could not be serialised
See Also:
readObject
 o readObject
  public void readObject(StreamInputInterface s) throws StreamIOException
Initialise a CryptoKeyInfo with values read from an io stream (SourceStream)
Parameters:
s - is the stream the value is read from
Returns:
void
Throws: StreamIOException
if the object could not be externalised
See Also:
writeObject
 o myStreamSize
  public int myStreamSize() throws StreamIOException
Finds the expected number of bytes needed to externalize the object to s.
Parameters:
s - is the stream the key information is written to
Returns:
number of bytes required
Throws: StreamIOException
if the size could not be computed
See Also:
writeObject
 o equals
  public boolean equals(CryptoKeyInfo key)
Compares the CryptoKeyInfo with another CryptoKeyInfo
Parameters:
key - is the CryptoKeyInfo with which to compare
Returns:
true iff keyId, keyVal and algId match false otherwise.
 o printContents
  public void printContents()

All Packages  Class Hierarchy  This Package  Previous  Next  Index