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
-
certificate
-
-
cryptoInf
-
-
keyInfo
-
-
securityVal
- Additional information about the cryptographic functions, which is not key
specific.
-
Statement()
- Creates a new Statement Object with empty history.
-
Statement(String, String)
- Creates a new Statement object.
Deprecated.
-
clone()
- Making clone public
-
copyFrom(Statement)
- hm?
-
decipher(CryptoKeyInfo)
- Decipher an encrypted statement.
-
delinearize(byte[])
- "Helper" method to delinearize an array of bytes into the statement
ToDo : elaborate explanation (consider the relation to serializables)
-
encipher(CryptoKeyInfo)
- Encipher a statement using a conventional crypto system.
-
generateMAC(CryptoKeyInfo, Date, MACAlgorithm)
- Generate a (keyed) MAC value on a statement object.
Deprecated.
-
generateMAC(CryptoKeyInfo, MACAlgorithm)
- Generate a (keyed) MAC value on a statement object.
-
generateSignature(CryptoKeyInfo, HashingAlgorithm, Certificate)
- Sign a statement.
-
getAlg()
- Returns the cryptographic algorithm used in the Statement.
-
getCertificate()
- Get the certificate in the Statement.
-
getDate()
- Get the date.
Deprecated.
-
getHistory()
- Get the full history of the operations performed on the Statement.
-
getLastOperation()
- Gets the most recent performed operation on the Statement.
-
getPlainText()
- Returns the message using which this Statement was initiated.
-
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.
-
getRecipient()
- Get the information �contained in the Statement about the recipient.
Deprecated.
-
getSender()
- Get the information �contained in the Statement about the sender.
Deprecated.
-
isEncrypted()
- Tests if statement have just been Encrypted.
-
isMACed()
- Tests if statement have just been MACed.
-
isPKEncrypted()
- Tests if statement have just been PKEncrypted.
-
isPlainText()
- Tests if statement has had no operation performed on it.
-
isSigned()
- Tests if statement have just een signed.
-
linearize()
- "Helper" method to linearize the statement into an array of bytes
-
pkDecipher(CryptoKeyInfo)
- Decipher a pkEnciphered statement object.
-
pkEncipher(CryptoKeyInfo, ConventionalAlgorithm, KeyPadding)
- Encipher a statement object under a random, conventional key using encipher,
and include this key enciphered under a public key.
-
printContents()
- Temporary function printing the history and securityVal
-
resolvePublicKey(CryptoKeyInfo)
- Resolve public key.
-
setCertificate(Certificate)
- Set the certificate in the Statement.
-
setDate(Date)
- Set the date.
Deprecated.
-
setOperation(MessageOperation)
- Sets the most recent performed operation.
-
setRecipient(String)
- Inserts identification of the recipient in Statement.
Deprecated.
-
setSender(String)
- Inserts identification of the sender in Statement.
Deprecated.
-
verifyMAC(CryptoKeyInfo)
- Verify a (keyed) MAC value on a statement object.
-
verifyMAC(TimeRange, CryptoKeyInfo, Statement)
- Verify a (keyed) MAC value on a statement object.
Deprecated.
-
verifySignature(CryptoKeyInfo)
- Verify the signature in a signed statement..
-
verifySignature(TimeRange, CryptoKeyInfo)
- Verify the signature in a signed statement.
Deprecated.
keyInfo
protected CryptoKeyInfo keyInfo
certificate
protected Certificate certificate
cryptoInf
protected Constant cryptoInf
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.
Statement
public Statement()
- Creates a new Statement Object with empty history.
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
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
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
setOperation
protected void setOperation(MessageOperation operation)
- Sets the most recent performed operation.
- Parameters:
- operation - the performed operation on the statement
getLastOperation
public MessageOperation getLastOperation()
- Gets the most recent performed operation on the Statement.
- Returns:
- the most recent performed operation on the Statement.
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
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
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
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
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
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
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
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
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
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
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
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
isPlainText
public boolean isPlainText()
- Tests if statement has had no operation performed on it.
- Returns:
- true if so, otherwise false
isSigned
public boolean isSigned()
- Tests if statement have just een signed.
- Returns:
- true if last operation was a Sign operation, otherwise false
isEncrypted
public boolean isEncrypted()
- Tests if statement have just been Encrypted.
- Returns:
- true if last operation was a Encrypt operation, otherwise false
isPKEncrypted
public boolean isPKEncrypted()
- Tests if statement have just been PKEncrypted.
- Returns:
- true if last operation was a PKEncrypt operation, otherwise false
copyFrom
public void copyFrom(Statement src)
- hm?
isMACed
public boolean isMACed()
- Tests if statement have just been MACed.
- Returns:
- true if last operation was a MACoperation, otherwise false
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
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)
getCertificate
public Certificate getCertificate()
- Get the certificate in the Statement.
- Returns:
- Certificate in statement (possibly null)
setCertificate
public void setCertificate(Certificate cert)
- Set the certificate in the Statement.
- Parameters:
- Certificate - in statement (possibly null)
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)
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
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
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
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
getHistory
public Stack getHistory()
- Get the full history of the operations performed on the Statement.
- Returns:
- the history as a stack
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.
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
clone
public synchronized Object clone()
- Making clone public
- Returns:
- a clone of myself
- Overrides:
- clone in class Object
printContents
public void printContents()
- Temporary function printing the history and securityVal
All Packages Class Hierarchy This Package Previous Next Index