org.apache.hadoop.mapreduce.security
Class SecureShuffleUtils

java.lang.Object
  extended by org.apache.hadoop.mapreduce.security.SecureShuffleUtils

public class SecureShuffleUtils
extends Object

utilities for generating kyes, hashes and verifying them for shuffle


Field Summary
static String HTTP_HEADER_REPLY_URL_HASH
           
static String HTTP_HEADER_URL_HASH
           
 
Constructor Summary
SecureShuffleUtils()
           
 
Method Summary
static String buildMsgFrom(javax.servlet.http.HttpServletRequest request)
          Shuffle specific utils - build string for encoding from URL
static String buildMsgFrom(URL url)
          Shuffle specific utils - build string for encoding from URL
static String generateHash(byte[] msg, SecretKey key)
          Base64 encoded hash of msg
static String hashFromString(String enc_str, SecretKey key)
          Aux util to calculate hash of a String
static String toHex(byte[] ba)
          byte array to Hex String
static void verifyReply(String base64Hash, String msg, SecretKey key)
          verify that base64Hash is same as HMacHash(msg)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_HEADER_URL_HASH

public static final String HTTP_HEADER_URL_HASH
See Also:
Constant Field Values

HTTP_HEADER_REPLY_URL_HASH

public static final String HTTP_HEADER_REPLY_URL_HASH
See Also:
Constant Field Values
Constructor Detail

SecureShuffleUtils

public SecureShuffleUtils()
Method Detail

generateHash

public static String generateHash(byte[] msg,
                                  SecretKey key)
Base64 encoded hash of msg

Parameters:
msg -

hashFromString

public static String hashFromString(String enc_str,
                                    SecretKey key)
                             throws IOException
Aux util to calculate hash of a String

Parameters:
enc_str -
key -
Returns:
Base64 encodedHash
Throws:
IOException

verifyReply

public static void verifyReply(String base64Hash,
                               String msg,
                               SecretKey key)
                        throws IOException
verify that base64Hash is same as HMacHash(msg)

Parameters:
base64Hash - (Base64 encoded hash)
msg -
Throws:
IOException - if not the same

buildMsgFrom

public static String buildMsgFrom(URL url)
Shuffle specific utils - build string for encoding from URL

Parameters:
url -
Returns:
string for encoding

buildMsgFrom

public static String buildMsgFrom(javax.servlet.http.HttpServletRequest request)
Shuffle specific utils - build string for encoding from URL

Parameters:
request -
Returns:
string for encoding

toHex

public static String toHex(byte[] ba)
byte array to Hex String

Parameters:
ba -
Returns:
string with HEX value of the key


Copyright © 2009 The Apache Software Foundation