com.plumtree.openfoundation.security
Class XPMACGenerator

java.lang.Object
  extended by com.plumtree.openfoundation.security.XPMACGenerator

public class XPMACGenerator
extends java.lang.Object

Use the platform libraries for creating a cryptographic hash signature (hashed message authentication code, HMAC-SHA1). This class contains code for regularizing the seed key of the HMAC generator so that it is compatible with the 5.0.x C++ implementation of MAC generation for login token creation. Note that this algorithm's MAC output does not match versions of Open Foundation previous to 2.5.2.0 (August 2004) which do not preprocess the seed key, and will not interoperate with them.

Author:
DaniilK, JeffM

Constructor Summary
XPMACGenerator()
           
 
Method Summary
 java.lang.String GenerateMACBase64(java.lang.String messageString)
          Returns a string containing a Base64 encoding of the message authentication code bytes.
 byte[] GenerateMACBytes(java.lang.String messageString)
          Returns a byte array containing the message authentication code.
 void InitializeMACGenerator(byte[] seedKeyBytes)
          Initializes MAC generator from byte array seed key via application of MD5 (to shorten key length) and XOR operations.
 void InitializeMACGenerator(java.lang.String macSeedKey)
          Convenience method to allow storing/passing seed key as a String value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPMACGenerator

public XPMACGenerator()
Method Detail

InitializeMACGenerator

public void InitializeMACGenerator(java.lang.String macSeedKey)
Convenience method to allow storing/passing seed key as a String value. Delegates to method taking byte[].

Parameters:
macSeedKey - String seed key via application of MD5.

InitializeMACGenerator

public void InitializeMACGenerator(byte[] seedKeyBytes)
Initializes MAC generator from byte array seed key via application of MD5 (to shorten key length) and XOR operations. Derived MAC generator parameters are cached to avoid computationally expensive rework. If the key is derived by byte-encoding a String, use UTF-16LE encoding to ensure compatibility with the C++ Windows portal login token algorithm.

Parameters:
seedKeyBytes - byte array of seed key data.

GenerateMACBytes

public byte[] GenerateMACBytes(java.lang.String messageString)
Returns a byte array containing the message authentication code.

Parameters:
messageString - The String to be encoded.
Returns:
a byte array containing the message authentication code.

GenerateMACBase64

public java.lang.String GenerateMACBase64(java.lang.String messageString)
Returns a string containing a Base64 encoding of the message authentication code bytes.

Parameters:
messageString - The String to be encoded.
Returns:
a string containing a Base64 encoding of the message authentication code bytes.


Copyright 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.