org.apache.hadoop.mapreduce.security
Class SecureShuffleUtils

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

public class SecureShuffleUtils
extends java.lang.Object

utilities for generating kyes, hashes and verifying them for shuffle


Field Summary
static java.lang.String HTTP_HEADER_REPLY_URL_HASH
           
static java.lang.String HTTP_HEADER_URL_HASH
           
 
Constructor Summary
SecureShuffleUtils()
           
 
Method Summary
static java.lang.String buildMsgFrom(javax.servlet.http.HttpServletRequest request)
          Shuffle specific utils - build string for encoding from URL
static java.lang.String buildMsgFrom(java.net.URL url)
          Shuffle specific utils - build string for encoding from URL
static java.lang.String generateHash(byte[] msg, javax.crypto.SecretKey key)
          Base64 encoded hash of msg
static java.lang.String hashFromString(java.lang.String enc_str, javax.crypto.SecretKey key)
          Aux util to calculate hash of a String
static java.lang.String toHex(byte[] ba)
          byte array to Hex String
static void verifyReply(java.lang.String base64Hash, java.lang.String msg, javax.crypto.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 java.lang.String HTTP_HEADER_URL_HASH
See Also:
Constant Field Values

HTTP_HEADER_REPLY_URL_HASH

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

SecureShuffleUtils

public SecureShuffleUtils()
Method Detail

generateHash

public static java.lang.String generateHash(byte[] msg,
                                            javax.crypto.SecretKey key)
Base64 encoded hash of msg

Parameters:
msg -

hashFromString

public static java.lang.String hashFromString(java.lang.String enc_str,
                                              javax.crypto.SecretKey key)
                                       throws java.io.IOException
Aux util to calculate hash of a String

Parameters:
enc_str -
key -
Returns:
Base64 encodedHash
Throws:
java.io.IOException

verifyReply

public static void verifyReply(java.lang.String base64Hash,
                               java.lang.String msg,
                               javax.crypto.SecretKey key)
                        throws java.io.IOException
verify that base64Hash is same as HMacHash(msg)

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

buildMsgFrom

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

Parameters:
url -
Returns:
string for encoding

buildMsgFrom

public static java.lang.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 java.lang.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