Class semper.statement.Statement
All Packages Class Hierarchy This Package Previous Next Index
Class semper.statement.Statement
java.lang.Object
|
+----semper.statement.Statement
- public class Statement
- extends Object
- implements StatementConstants, Streamable, CryptoConstants
Statement I/O
- Version:
- $Revision: 1.24 $ $Date: 1996/09/19 11:28:17 $
- Author:
- Jesper Drud Nielsen ([email protected]), Torben Pryds Pedersen ([email protected])
- See Also:
- Statement
-
Statement()
- Creates a new, empty Statement object.
-
Statement(byte[], String, String)
- Creates a new Statement object containing message, senderID and RecipientId.
-
decipher(CryptoKeyInfo)
- Decipher a ciphered statement.
-
encipher(CryptoKeyInfo)
- Encipher a statement.
-
generateMAC(CryptoKeyInfo, Date, int)
- Generate a (keyed) MAC value on a statement object.
-
generateSignature(CryptoKeyInfo, int, Certificate)
- Sign a statement.
-
getAlg()
- Returns the cryptographic algorithm used in the Statement.
-
getDate()
- Get the date.
-
getPlainString()
- Returns the message in the Statement provided it is a plaintext.
-
getPlaintext()
- Returns the message in the Statement provided it is a plaintext.
-
getRecipient()
- Get the recipient.
-
getSender()
- Get the sender.
-
myStreamSize()
- Returns the size of the Statement object when externalized.
-
pkDecipher(CryptoKeyInfo)
- Decipher a pkEnciphered statement object.
-
pkEncipher(CryptoKeyInfo, int, int)
- Encipher a statement object under a random, conventional key, and include
this key enciphered under a public RSA key.
-
printContents()
- Temporary function printing the message and securityVal of a Statement
-
readObject(StreamInputInterface)
- Internalizes a Statement object.
-
setDate(Date)
- Set the date.
-
setRecipient(String)
- Set the recipient.
-
setSender(String)
- Set the sender.
-
verifyMAC(Date, Date, CryptoKeyInfo)
- Verify a (keyed) MAC value on a statement object.
-
verifySignature(Date, Date, CryptoKeyInfo)
- Verify the signature in a signed statement.
-
writeObject(StreamOutputInterface)
- Externalizes a Statement object.
Statement
public Statement()
- Creates a new, empty Statement object.
A new Statement object is created. All of its attributes are empty,
except that its message_type attribute indicates that the Statement
is empty. This method is intended to for use by the reipient of a
linearized statement, who will make an empty statement and internalize
its contents from a stream.
Statement
public Statement(byte newMessage[],
String newSenderId,
String newRecipientId)
- Creates a new Statement object containing message, senderID and RecipientId.
A new Statement object containing a given plaintext and having a
sender identification and recipient identification.
- Parameters:
- newMessage - The plaintext message to insert in the Statement
- newSenderId - The sender identification
- newRecipientId - The recipient identification
getPlaintext
public byte[] getPlaintext() throws StatementManException
- Returns the message in the Statement provided it is a plaintext.
- Returns:
- the message contained in the plaintext
- Throws: StatementManException
- if the statement is not a plaintext
getPlainString
public String getPlainString() throws StatementManException
- Returns the message in the Statement provided it is a plaintext.
- Returns:
- A String corresponding to the message in the statement
- Throws: StatementManException
- if the statement is not a plaintext
encipher
public int encipher(CryptoKeyInfo newKeyInfo) throws StatementManException
- Encipher a statement.
Linearises the statement and encrypts it under the key in or designated by
newKeyInfo. Afterwards, the enciphered message is deleted and the
ciphertext is put in securityVal.
The date, senderId and recipientId attributes as well as the actual key
value are cleared.
- Parameters:
- newKeyInfo - identifies the key under which to encipher
- Returns:
- 0 on succes
- Throws: StatementManException
- if the statement could not be enciphered
- See Also:
- decipher, CryptoConstants
decipher
public int decipher(CryptoKeyInfo convKeyInfo) throws StatementManException
- Decipher a ciphered 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.
The securityVal attribute which contains the enciphered statement is deciphered,
and the resulting string is delinearized into the statement.
- Parameters:
- The - key needed for decryption (if null the key information
from the Statement is used)
- Returns:
- 0 on success
- Throws: StatementManException
- if the statement could not be deciphered
- See Also:
- encipher
generateSignature
public void generateSignature(CryptoKeyInfo newKeyInfo,
int hashAlg,
Certificate newCertificate) throws StatementManException
- Sign a statement.
Writes the current date and time in the date attribute ob the object and linearises
it. A signature is generated using the key in newKeyInfo. Afterwards the linearized
message is in message and the signature is put in securityVal. The newKeyInfo is
put into the keyInfo field.
- Parameters:
- newKeyInfo - the secret signature key
- hashAlg - designatures the hashing algorithm to be used
- newCertificate - is the certificate to be added to the statement.
- Returns:
- 0 on success
- Throws: StatementManException
- if signature generation failed
- See Also:
- verifySignature
verifySignature
public int verifySignature(Date timewindowstart,
Date timewindowend,
CryptoKeyInfo trustedPublicKey) throws StatementManException
- Verify the signature in a signed statement.
Verifies the signature in securityVal against the message. After verification,
the contents of message is delinearized into the statement.
- Parameters:
- timewindowstart - the earliest signature date to accept
- timewindowend - the lates signature date to accept
- trustedPublicKey - is the key against which the certificate should
be verified
- Returns:
- 0 if the signature is valid. 1 if it is not valid
- Throws: StatementManException
- if something went wrong during the verification
- See Also:
- generateSignature
generateMAC
public int generateMAC(CryptoKeyInfo newKeyInfo,
Date newdate,
int MACalg) throws StatementManException
- Generate a (keyed) MAC value on a statement object.
Linearize the statement into the message attribute. Generate a MAC value and
write it in securityVal. The newKeyInfo is stored in the keyInfo attribute.
- 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
- Returns:
- 0 on success
- Throws: StatementManException
- if the MAC value could not be generated
- See Also:
- verifyMAC
verifyMAC
public int verifyMAC(Date timewindowstart,
Date timewindowend,
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 on which the MAC was generated is delinearized into the statement.
- Returns:
- 0 on success
- Throws: StatementManException
- if the MAC could not be verified
- See Also:
- generateMAC
pkEncipher
public int pkEncipher(CryptoKeyInfo newKeyInfo,
int convAlg,
int keyEncryption) throws StatementManException
- Encipher a statement object under a random, conventional key, and include
this key enciphered under a public RSA key.
- Parameters:
- newKeyInfo - is the public key to be used for encryption
- convAlg - the conventional algorithm to be used (0 indicates no
conventional encryption)
- keyEncryption - describes the way the conventional key is encrypted
- Returns:
- 0
- Throws: StatementManException
- if the encryption fails
- See Also:
- pkDecipher
pkDecipher
public int pkDecipher(CryptoKeyInfo secretKey) throws StatementManException
- Decipher a pkEnciphered statement object.
- Parameters:
- newKeyInfo - is the key to be used for decryption
- Returns:
- returncode (0 for success)
- Throws: StatementManException
- if the statement could not be deciphered
- See Also:
- pkEncipher
setDate
public void setDate(Date newDate)
- Set the date.
- Parameters:
- newDate - is the Date to be set in a Statement
getDate
public Date getDate()
- Get the date.
- Returns:
- the date value of the statement
getAlg
public int getAlg()
- Returns the cryptographic algorithm used in the Statement.
long description with pre/post-conditions etc follows here
- Returns:
- an integer describing the algorithm used
setSender
public void setSender(String sender)
- Set the sender.
The senderId attribute is set to a specified string. A null string clears the sender.
- Parameters:
- the - sender identification
- See Also:
- getSender
getSender
public String getSender()
- Get the sender.
The senderId attribute is returned as a string. A null string means "no sender".
- Returns:
- the sender identification
- See Also:
- setSender
setRecipient
public void setRecipient(String recipient)
- Set the recipient.
The recipientId attribute is set to a specified string. A null string clears the recipient.
- Parameters:
- the - recipient identification
- See Also:
- getRecipient
getRecipient
public String getRecipient()
- Get the recipient.
The recipientId attribute is returned as a string. A null string means "no recipient".
- Returns:
- the recipient identification
- See Also:
- setRecipient
writeObject
public void writeObject(StreamOutputInterface s) throws StreamIOException
- Externalizes a Statement object. By calling this method a Statement will
be written to the IO stream.
- Returns:
- no return value
- Throws: StreamIOException
- if linearisation fails
readObject
public void readObject(StreamInputInterface s) throws StreamIOException
- Internalizes a Statement object. By calling this method a Statement will
be read from the IO stream.
- Returns:
- no return value
- Throws: IOException
- If the input data is corrupt.
myStreamSize
public int myStreamSize() throws StreamIOException
- Returns the size of the Statement object when externalized.
- Returns:
- Size of externalized object
- Throws: IOException
- if the correct sixe could not be computed.
printContents
public void printContents()
- Temporary function printing the message and securityVal of a Statement
All Packages Class Hierarchy This Package Previous Next Index