Code example for Mac

Methods: doFinal, init

0
    } catch (InvalidKeyException ike) {
      throw new IllegalArgumentException("Invalid key to HMAC computation", 
                                         ike);
    } 
    return mac.doFinal(identifier);
  } 
   
  /** 
   * Convert the byte[] to a secret key 
   * @param key the byte[] to create a secret key from 
   * @return the secret key 
   */ 
  protected static SecretKey createSecretKey(byte[] key) {
    return new SecretKeySpec(key, DEFAULT_HMAC_ALGORITHM);
  } 
}