All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class semper.statement.Statement

java.lang.Object
   |
   +----semper.statement.Statement

public abstract class Statement
extends Object
implements Serializable, Cloneable
A Statement is a datastrucutre containing information which must be protected. The contents of a statement is unprotected, encrypted (symmetric or asymmetric), digitally signed or authenticated using a MAC. It is possible to have several layers or protection by performing more than one operation on the statement. The actual cryptographic operations are done by the crypto manager. A Statement may contain various information such as identification of originator and recipient, a time stamp (currently made using java.util.Date).

Version:
$Revision: 1.48 $ $Date: 1998/06/15 14:56:37 $
Author:
Jesper Drud Nielsen ([email protected]), Thomas Sepstrup Nielsen ([email protected]), Torben Pryds Pedersen ([email protected])
See Also:
CryptoMan

Variable Index

 o certificate
 o cryptoInf
 o keyInfo
 o securityVal
Additional information about the cryptographic functions, which is not key specific.

Constructor Index

 o Statement()
Creates a new Statement Object with empty history.
 o Statement(String, String)
Creates a new Statement object. Deprecated.

Method Index

 o clone()
Making clone public
 o copyFrom(Statement)
hm?
 o decipher(CryptoKeyInfo)
Decipher an encrypted statement.
 o delinearize(byte[])
"Helper" method to delinearize an array of bytes into the statement ToDo : elaborate explanation (consider the relation to serializables)
 o encipher(CryptoKeyInfo)
Encipher a statement using a conventional crypto system.
 o generateMAC(CryptoKeyInfo, Date, MACAlgorithm)
Generate a (keyed) MAC value on a statement object. Deprecated.
 o generateMAC(CryptoKeyInfo, MACAlgorithm)
Generate a (keyed) MAC value on a statement object.
 o generateSignature(CryptoKeyInfo, HashingAlgorithm, Certificate)
Sign a statement.
 o getAlg()
Returns the cryptographic algorithm used in the Statement.
 o getCertificate()
Get the certificate in the Statement.
 o getDate()
Get the date. Deprecated.
 o getHistory()
Get the full history of the operations performed on the Statement.
 o getLastOperation()
Gets the most recent performed operation on the Statement.
 o getPlainText()
Returns the message using which this Statement was initiated.
 o getPrevious()
If a given Statement is obtained by making an operation on a Statement (sign, MAC) then this method can be used to retrieve that previous Statement.
 o getRecipient()
Get the information �contained in the Statement about the recipient. Deprecated.
 o getSender()
Get the information �contained in the Statement about the sender. Deprecated.
 o isEncrypted()
Tests if statement have just been Encrypted.
 o isMACed()
Tests if statement have just been MACed.
 o isPKEncrypted()
Tests if statement have just been PKEncrypted.
 o isPlainText()
Tests if statement has had no operation performed on it.
 o isSigned()
Tests if statement have just een signed.
 o linearize()
"Helper" method to linearize the statement into an array of bytes
 o pkDecipher(CryptoKeyInfo)
Decipher a pkEnciphered statement object.
 o pkEncipher(CryptoKeyInfo, ConventionalAlgorithm, KeyPadding)
Encipher a statement object under a random, conventional key using encipher, and include this key enciphered under a public key.
 o printContents()
Temporary function printing the history and securityVal
 o resolvePublicKey(CryptoKeyInfo)
Resolve public key.
 o setCertificate(Certificate)
Set the certificate in the Statement.
 o setDate(Date)
Set the date. Deprecated.
 o setOperation(MessageOperation)
Sets the most recent performed operation.
 o setRecipient(String)
Inserts identification of the recipient in Statement. Deprecated.
 o setSender(String)
Inserts identification of the sender in Statement. Deprecated.
 o verifyMAC(CryptoKeyInfo)
Verify a (keyed) MAC value on a statement object.
 o verifyMAC(TimeRange, CryptoKeyInfo, Statement)
Verify a (keyed) MAC value on a statement object. Deprecated.
 o verifySignature(CryptoKeyInfo)
Verify the signature in a signed statement..
 o verifySignature(TimeRange, CryptoKeyInfo)
Verify the signature in a signed statement. Deprecated.

Variables

 o keyInfo
 protected CryptoKeyInfo keyInfo
 o certificate
 protected Certificate certificate
 o cryptoInf
 protected Constant cryptoInf
 o securityVal
 protected byte securityVal[]
Additional information about the cryptographic functions, which is not key specific. E.g., designates hash function, padding of messages, MAC algorithms, encryption of conventional keys.

Constructors

 o Statement
 public Statement()
Creates a new Statement Object with empty history.

 o Statement
 public Statement(String newSenderId,
                  String newRecipientId)
Note: Statement() is deprecated. The IDs are no longer member of the class.

Creates a new Statement object.

Parameters:
newSenderId - The sender identification
newRecipientId - The recipient identification

Methods

 o getPlainText
 public abstract Object getPlainText() throws StatementManException
Returns the message using which this Statement was initiated. If the message has been encrypted at some point an exception is thrown. This method is overridden in subclasses to return an object of a class with whcih the Statement was created. If the Statement has been signed/MACed several times this method will retrieve the original message.

Returns:
the object contained in the plaintext
Throws: StatementManException
if plain text can not be retrieved
 o getPrevious
 public Statement getPrevious() throws StatementManException
If a given Statement is obtained by making an operation on a Statement (sign, MAC) then this method can be used to retrieve that previous Statement. if a Statement has not been operated on or the last operation was encryption, then it is not possible to go back.

Returns:
the previous Statement
Throws: StatementManException
if it is not possible to go back
 o setOperation
 protected void setOperation(MessageOperation operation)
Sets the most recent performed operation.

Parameters:
operation - the performed operation on the statement
 o getLastOperation
 public MessageOperation getLastOperation()
Gets the most recent performed operation on the Statement.

Returns:
the most recent performed operation on the Statement.
 o encipher
 public void encipher(CryptoKeyInfo newKeyInfo) throws StatementManException
Encipher a statement using a conventional crypto system. During this process the Statement is changed in that the date, sender identification and recipient identification are removed. The method should be called from the corresponding method in the subclass, which will construct the actual ciphertext. Information on the key is added.

Parameters:
newKeyInfo - identifies the key under which to encipher
Throws: StatementManException
if the key information could not be added
See Also:
decipher, CryptoConstants
 o decipher
 public abstract void decipher(CryptoKeyInfo convKeyInfo) throws StatementManException
Decipher an encrypted statement. If a decipher key is provided in convKeyInfo, it is used to decipher. Otherwise, a decipher key is derived from the statement objects keyInfo attribute. This method should be implemented in the subclasses.

Parameters:
The - key needed for decryption (if null the key information from the Statement is used)
Throws: StatementManException
if the statement could not be deciphered
See Also:
encipher
 o generateSignature
 public void generateSignature(CryptoKeyInfo newKeyInfo,
                               HashingAlgorithm hashAlg,
                               Certificate newCertificate) throws StatementManException
Sign a statement. Linearises the Statement and hashes it using the hashalgorithm given as input parameter. A signature on the hash value is generated using the key in newKeyInfo. Afterwards the statement contains the linearised statement (before hashing), identification of the key (a certificate on the public key if supplied as input) used to sign and the signature.

Parameters:
newKeyInfo - the secret signature key
hashAlg - designates the hashing algorithm to be used (if a DSA signature is used SHS-1 will be used, overwriting ths parameter)
newCertificate - is the certificate to be added to the statement.
Throws: StatementManException
if signature generation failed
See Also:
verifySignature
 o verifySignature
 public void verifySignature(TimeRange validRange,
                             CryptoKeyInfo trustedPublicKey) throws StatementManException
Note: verifySignature() is deprecated. There is no longer any time stamp information in the class

Verify the signature in a signed statement. After verification the contents of message is delinearized into the statement. Thus this method changes the Statement!!!!

Parameters:
validRange - the timewindow in which the signature will be accepted. Ignored.
trustedPublicKey - is used to verify the signature. If no key is supplied the public key in the certificate is used.
Throws: StatementManException
if something went wrong during the verification
See Also:
generateSignature
 o verifySignature
 public boolean verifySignature(CryptoKeyInfo trustedPublicKey) throws StatementManException
Verify the signature in a signed statement.. This method DOES NOT alter the Statement. To obtain the Statemen, which was originally signed, use getPrevious().

Parameters:
trustedPublicKey - is used to verify the signature. If no key is supplied the public key in the certificate is used.
Returns:
true if the signture is valid with respect to the given key.
Throws: StatementManException
if something went wrong during the verification
See Also:
generateSignature, getPrevious
 o resolvePublicKey
 protected CryptoKeyInfo resolvePublicKey(CryptoKeyInfo trustedPublicKey)
Resolve public key. The resolved key is either that provided (if not null) or the key from the certificate.

Parameters:
trustedPublicKey - used to verify the signature. If null (no key is supplied) the public key in the certificate is used.
Returns:
resolved public key or null
 o generateMAC
 public void generateMAC(CryptoKeyInfo newKeyInfo,
                         Date newdate,
                         MACAlgorithm MACalg) throws StatementManException
Note: generateMAC() is deprecated. There is no longer timestamp information in the class

Generate a (keyed) MAC value on a statement object. This method should be overridden in the subclasses. Information about the key used for MACing is stored in the resulting Statement.

Parameters:
newKeyInfo - the key to use during the MAC operation
newdate - is a timestamp of the operation
MACalg - describes the MAC algorithm to be used
Throws: StatementManException
if the MAC value could not be generated
See Also:
verifyMAC
 o generateMAC
 public void generateMAC(CryptoKeyInfo newKeyInfo,
                         MACAlgorithm MACalg) throws StatementManException
Generate a (keyed) MAC value on a statement object. This method should be overridden in the subclasses. Information about the key used for MACing is stored in the resulting Statement.

Parameters:
newKeyInfo - the key to use during the MAC operation
MACalg - describes the MAC algorithm to be used
Throws: StatementManException
if the MAC value could not be generated
See Also:
verifyMAC
 o verifyMAC
 public void verifyMAC(TimeRange validRange,
                       CryptoKeyInfo newKeyInfo,
                       Statement origStatement) throws StatementManException
Note: verifyMAC() is deprecated. There is no longer time stamp information in the class

Verify a (keyed) MAC value on a statement object. Retrieve the MAC key using the keyInfo attribute and verify the MAC using this key. The statement on which the MAC was generated is delinearized into the statement. THIS METHOD TRANSFORMS THE OBJECT

Parameters:
validRange - is the timewindow in which to accept the MAC
newKeyInfo - the key to verify MAC with
origStatement - the original statement is copied into this.
Throws: StatementManException
if the MAC could not be verified
See Also:
generateMAC
 o verifyMAC
 public boolean verifyMAC(CryptoKeyInfo newKeyInfo) throws StatementManException
Verify a (keyed) MAC value on a statement object. Retrieve the MAC key using the keyInfo attribute and verify the MAC using this key. The statement is NOT CHANGED during verification. To get the Statement which was originally authenticated, use getPrevious().

Parameters:
newKeyInfo - the key to verify MAC with
Returns:
true if the MAC value is correct with respect to the key.
Throws: StatementManException
if the MAC could not be verified
See Also:
generateMAC, getPrevious
 o pkEncipher
 public void pkEncipher(CryptoKeyInfo newKeyInfo,
                        ConventionalAlgorithm convAlg,
                        KeyPadding keyEncoding) throws StatementManException
Encipher a statement object under a random, conventional key using encipher, and include this key enciphered under a public key.

Parameters:
newKeyInfo - is the public key to be used for encryption
convAlg - the conventional algorithm to be used (0 indicates no conventional encryption)
PublicKeyEncr - describes the way the conventional key is encrypted
Throws: StatementManException
if the encryption fails
See Also:
encipher, pkDecipher
 o pkDecipher
 public void pkDecipher(CryptoKeyInfo secretKey) throws StatementManException
Decipher a pkEnciphered statement object. The enciphered conventional key is deciphered using the supplied secret (asymmetric) key. The resulting conventional key is used to decipher the statement using decipher.

Parameters:
newKeyInfo - is the key to be used for decryption
Throws: StatementManException
if the statement could not be deciphered
See Also:
pkEncipher, decipher
 o isPlainText
 public boolean isPlainText()
Tests if statement has had no operation performed on it.

Returns:
true if so, otherwise false
 o isSigned
 public boolean isSigned()
Tests if statement have just een signed.

Returns:
true if last operation was a Sign operation, otherwise false
 o isEncrypted
 public boolean isEncrypted()
Tests if statement have just been Encrypted.

Returns:
true if last operation was a Encrypt operation, otherwise false
 o isPKEncrypted
 public boolean isPKEncrypted()
Tests if statement have just been PKEncrypted.

Returns:
true if last operation was a PKEncrypt operation, otherwise false
 o copyFrom
 public void copyFrom(Statement src)
hm?

 o isMACed
 public boolean isMACed()
Tests if statement have just been MACed.

Returns:
true if last operation was a MACoperation, otherwise false
 o setDate
 public void setDate(Date newDate)
Note: setDate() is deprecated. Has no longer any meaning. Nothing happens when calling this method.

Set the date. This function can be used to put a timestamp in a statement.

Parameters:
newDate - is the Date to be set in a Statement
 o getDate
 public Date getDate()
Note: getDate() is deprecated. No longer any meaning. There is no time stamp in the statement.

Get the date.

Returns:
the current time (instead of the time stamp)
 o getCertificate
 public Certificate getCertificate()
Get the certificate in the Statement.

Returns:
Certificate in statement (possibly null)
 o setCertificate
 public void setCertificate(Certificate cert)
Set the certificate in the Statement.

Parameters:
Certificate - in statement (possibly null)
 o getAlg
 public KeyType getAlg()
Returns the cryptographic algorithm used in the Statement. In case more operations have been done the last one is returned.

Returns:
an integer describing the algorithm used to protect the statement (if the statement is not protected 0 is returned)
 o setSender
 public void setSender(String sender)
Note: setSender() is deprecated. There is no longer any information in the class pertaining to this issue.

Inserts identification of the sender in Statement. A null string clears all information about the sender.

Parameters:
sender - identifies the sender
See Also:
getSender
 o getSender
 public String getSender()
Note: getSender() is deprecated. There is no longer any information in the class pertaining to this issue.

Get the information �contained in the Statement about the sender. A null string means that the statement contains no information about the sender.

Returns:
the sender identification
See Also:
setSender
 o setRecipient
 public void setRecipient(String recipient)
Note: setRecipient() is deprecated. There is no longer any information in the class pertaining to this issue.

Inserts identification of the recipient in Statement. A null string clears all information about the recipient.

Parameters:
the - recipient identification
See Also:
getRecipient
 o getRecipient
 public String getRecipient()
Note: getRecipient() is deprecated. There is no longer any information in the class pertaining to this issue.

Get the information �contained in the Statement about the recipient. A null string means that the statement contains no information about the recipient.

Returns:
the recipient identification
See Also:
setRecipient
 o getHistory
 public Stack getHistory()
Get the full history of the operations performed on the Statement.

Returns:
the history as a stack
 o linearize
 protected byte[] linearize() throws StatementManException
"Helper" method to linearize the statement into an array of bytes

Returns:
A string containing the linearized statement.
Throws: StatementManException
if the statement could not be linearised.
 o delinearize
 protected Statement delinearize(byte _byteArray[]) throws StatementManException
"Helper" method to delinearize an array of bytes into the statement ToDo : elaborate explanation (consider the relation to serializables)

Parameters:
_byteArray - the array containing the linearized statement
Throws: StatementManException
if the object could not be delinearized
 o clone
 public synchronized Object clone()
Making clone public

Returns:
a clone of myself
Overrides:
clone in class Object
 o printContents
 public void printContents()
Temporary function printing the history and securityVal


All Packages  Class Hierarchy  This Package  Previous  Next  Index