accessControl
Class IntegrityCheck

java.lang.Object
  extended by accessControl.IntegrityCheck

final class IntegrityCheck
extends java.lang.Object

Checks integrity of a message by generating a local message authentication code and comparing it to the one included in the message.

This class is thread-safe.

Author:
Karl-Peter Fuchs

Field Summary
private static InternalInformationPortController internalInformationPort
          Reference on component InternalInformationPort.
private static java.util.logging.Logger LOGGER
          Logger used to log and display information.
 
Constructor Summary
private IntegrityCheck()
          Empty constructor.
 
Method Summary
private static byte[] generateMAC(java.security.Key key, byte[] message)
          Generates and returns a message authentication code for the bypassed message.
private static boolean isMACCorrect(ChannelEstablishMessage message)
          Checks if the bypassed ChannelEstablishMessage has integrity.
private static boolean isMACCorrect(ChannelMessage message)
          Checks if the bypassed ChannelMessage has integrity.
protected static boolean isMACCorrect(Message message)
          Checks if the bypassed message has integrity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalInformationPort

private static InternalInformationPortController internalInformationPort
Reference on component InternalInformationPort. Used to display and/or log data and read general settings.


LOGGER

private static final java.util.logging.Logger LOGGER
Logger used to log and display information.

Constructor Detail

IntegrityCheck

private IntegrityCheck()
Empty constructor. Never used since all methods are static.

Method Detail

generateMAC

private static byte[] generateMAC(java.security.Key key,
                                  byte[] message)
Generates and returns a message authentication code for the bypassed message. Method is thread-safe.

Parameters:
key - Key to generate message authentication code with.
message - Message to be authenticated.
Returns:
Message authentication code for the bypassed message.

isMACCorrect

protected static boolean isMACCorrect(Message message)
Checks if the bypassed message has integrity. Method is thread-safe.

Parameters:
message - Message to check.
Returns:
Whether message authentication code is correct or not.

isMACCorrect

private static boolean isMACCorrect(ChannelEstablishMessage message)
Checks if the bypassed ChannelEstablishMessage has integrity. Method is thread-safe.

Parameters:
message - Message to check.
Returns:
Whether message authentication code is correct or not.

isMACCorrect

private static boolean isMACCorrect(ChannelMessage message)
Checks if the bypassed ChannelMessage has integrity. Method is thread-safe.

Parameters:
message - Message to check.
Returns:
Whether message authentication code is correct or not.