|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectmessageProcessor.Recoder
final class Recoder
Recodes (decrypts/encrypts) messages. Prevents linkability of (incoming and outgoing) messages due to their appearance.
This class is thread-safe (but parallel execution of a single instance's
methods won't increase performance. For parallel processing, several
Recoder
s are needed).
Field Summary | |
---|---|
private javax.crypto.Cipher |
asymmetricCipher
Cipher for asymmetric cryptography. |
private static InternalInformationPortController |
internalInformationPort
Reference on InternalInformationPort . |
private java.security.KeyPair |
KEY_PAIR
Public and private key of the asymmetric crypto system. |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
Constructor Summary | |
---|---|
protected |
Recoder()
Constructor used to generate a Recoder used to encrypt
replies. |
protected |
Recoder(java.security.KeyPair keyPair)
Constructor used to generate a Recoder used to decrypt
requests. |
Method Summary | |
---|---|
protected byte[] |
decrypt(byte[] data,
java.lang.String transformation)
Decrypts the bypassed data using the internal asymmetric cipher (and private key) and the specified transformation. |
private ChannelEstablishMessage |
decrypt(ChannelEstablishMessage message)
Decrypts the hybridly encrypted, bypassed ChannelEstablishMessage . |
private ChannelMessage |
decrypt(ChannelMessage message)
Decrypts the symmetrically encrypted, bypassed ChannelMessage . |
private ReplyMessage |
encrypt(ReplyMessage message)
Encrypts the bypassed ReplyMessage . |
protected java.security.Key |
getPublicKey()
Returns the public key of this Recoder . |
private void |
initializeCiphersForUser(User channel,
ChannelEstablishMessage message)
Initializes the ciphers used to recode messages for the bypassed user/channel. |
protected Message |
recode(BasicMessage message)
Recodes (decrypts/encrypts) the bypassed message according to its type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static InternalInformationPortController internalInformationPort
InternalInformationPort
. Used to display
and/or log data and read general settings.
private static final java.util.logging.Logger LOGGER
private final java.security.KeyPair KEY_PAIR
private javax.crypto.Cipher asymmetricCipher
Constructor Detail |
---|
protected Recoder(java.security.KeyPair keyPair)
Recoder
used to decrypt
requests.
Creates a new Recoder
which will use the bypassed
KeyPair
to decrypt messages.
Instantiates Cipher
objects for later use as specified in
the property file.
keyPair
- Public and private key of the asymmetric crypto system.protected Recoder()
Recoder
used to encrypt
replies.
Method Detail |
---|
protected java.security.Key getPublicKey()
Recoder
.
Recoder
.protected Message recode(BasicMessage message)
message
- The message to be recoded.
private ChannelEstablishMessage decrypt(ChannelEstablishMessage message)
ChannelEstablishMessage
.
message
- The message to be decrypted.
null
, if recoding failed.private ChannelMessage decrypt(ChannelMessage message)
ChannelMessage
.
message
- The message to be decrypted.
null
, if recoding failed.private ReplyMessage encrypt(ReplyMessage message)
ReplyMessage
.
message
- The message to be encrypted.
null
, if recoding failed.private void initializeCiphersForUser(User channel, ChannelEstablishMessage message) throws java.lang.Exception
channel
- User/channel the ciphers shall be initialized for.message
- Message containing the data needed to initialize the
ciphers (session key and initialization vector).
java.lang.Exception
- If the initialization process fails.protected byte[] decrypt(byte[] data, java.lang.String transformation) throws java.lang.Exception
data
- Data to be decrypted.transformation
- Transformation that shall be used for
decryption.
java.lang.Exception
- Any type of error preventing the data from being
decrypted.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |