client
Class MacGenerator

java.lang.Object
  extended by client.MacGenerator

final class MacGenerator
extends java.lang.Object

Provides methods for generating message authentication codes (MACs) and MAC keys.

Author:
Karl-Peter Fuchs

Field Summary
private static InternalInformationPortController internalInformationPort
          Reference on component InternalInformationPortController.
private static javax.crypto.KeyGenerator keyGenerator
          Key generator.
private static java.util.logging.Logger LOGGER
          Logger used to log and display information.
private static java.lang.String MAC_ALGORITHM
          Name of the algorithm used to generate a message authentication code.
private static javax.crypto.Mac macGenerator
          Mac generator object used to generate MACs.
 
Constructor Summary
private MacGenerator()
          Empty, private constructor (never used since all methods are static).
 
Method Summary
protected static byte[] generateMAC(java.security.Key key, byte[] message)
          Generates and returns a message authentication code for the bypassed message.
protected static javax.crypto.SecretKey generateMacKey()
          Generates and returns a MAC key.
 
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 InternalInformationPortController. 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.


MAC_ALGORITHM

private static final java.lang.String MAC_ALGORITHM
Name of the algorithm used to generate a message authentication code.


macGenerator

private static javax.crypto.Mac macGenerator
Mac generator object used to generate MACs.


keyGenerator

private static javax.crypto.KeyGenerator keyGenerator
Key generator.

Constructor Detail

MacGenerator

private MacGenerator()
Empty, private constructor (never used since all methods are static).

Method Detail

generateMacKey

protected static javax.crypto.SecretKey generateMacKey()
Generates and returns a MAC key. Method is thread-safe.

Returns:
The generated MAC key.

generateMAC

protected 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.