client
Class Cryptography

java.lang.Object
  extended by client.Cryptography

final class Cryptography
extends java.lang.Object

Provides methods for de- and encrypting messages.

Author:
Karl-Peter Fuchs

Constructor Summary
protected Cryptography(java.security.Key[] publicKeysOfMixes)
          Generates a new Cryptography object that can be used to de- and encrypting messages (using the bypassed keys).
 
Method Summary
protected  byte[] decryptReply(byte[] reply)
          Decrypts the bypassed reply.
protected  Message encryptMessage(Message plaintextMessage, int positionOfMixInCascade)
          Encrypts the bypassed message (hybridly) for the specified mix.
protected  javax.crypto.spec.IvParameterSpec getSessionIVOfMix(int positionOfMixInCascade)
          Returns the specified mix' initialization vector.
protected  javax.crypto.SecretKey getSessionKeyOfMix(int positionOfMixInCascade)
          Returns the specified mix' session key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cryptography

protected Cryptography(java.security.Key[] publicKeysOfMixes)
Generates a new Cryptography object that can be used to de- and encrypting messages (using the bypassed keys).

Parameters:
publicKeysOfMixes - Public keys of the cascade's mixes. The first mix' key must be located at publicKeysOfMixes[0].
Method Detail

getSessionKeyOfMix

protected javax.crypto.SecretKey getSessionKeyOfMix(int positionOfMixInCascade)
Returns the specified mix' session key.

Parameters:
positionOfMixInCascade - The mix' position in the cascade, who's session key shall be returned.
Returns:
The specified mix' session key.

getSessionIVOfMix

protected javax.crypto.spec.IvParameterSpec getSessionIVOfMix(int positionOfMixInCascade)
Returns the specified mix' initialization vector.

Parameters:
positionOfMixInCascade - The mix' position in the cascade, who's initialization vector shall be returned.
Returns:
The specified mix' initialization vector.

encryptMessage

protected Message encryptMessage(Message plaintextMessage,
                                 int positionOfMixInCascade)
Encrypts the bypassed message (hybridly) for the specified mix.

Parameters:
positionOfMixInCascade - The mix' position in the cascade, the message shall be encrypted for.
plaintextMessage - The message to be encrypted.
Returns:
The (hybridly) encrypted message.

decryptReply

protected byte[] decryptReply(byte[] reply)
Decrypts the bypassed reply.

Parameters:
reply - The reply to be decrypted.
Returns:
The decrypted reply.