Class NetStorageUtils

java.lang.Object
org.frankframework.extensions.akamai.NetStorageUtils

public class NetStorageUtils extends Object
General utility functions needed to implement the HTTP SDK. Many of these functions are also available as standard parts of other libraries, but this package strives to operate without any external dependencies.
Author:
colinb@akamai.com (Colin Bendell)
  • Constructor Details

    • NetStorageUtils

      public NetStorageUtils()
  • Method Details

    • computeKeyedHash

      public static byte[] computeKeyedHash(@Nonnull byte[] data, String key, NetStorageUtils.KeyedHashAlgorithm hashType)
      Computes the HMAC hash of a given byte[]. This is a wrapper over the Mac crypto functions.
      Parameters:
      data - byte[] of content to hash
      key - secret key to salt the hash
      hashType - determines which algorithm to use. The recommendation is to use HMAC-SHA256
      Returns:
      a byte[] presenting the HMAC hash of the source data.
    • convertMapAsQueryParams

      public static String convertMapAsQueryParams(Map<String,String> data)
      Convert Map<String, String> into a name=value query params string.

      NB: This uses URLEncoding - not URI Encoding for escaping name and values. This shouldn't be an issue for most uses of this function for the Netstorage API, but could impact non-ascii usernames in the future.

      Parameters:
      data - a Key-Value map
      Returns:
      a query params encoded string in the form of name=value&name2=value2...