com.baidubce.services.iothisk.device.crypto
Class HashCrypto

java.lang.Object
  extended by com.baidubce.services.iothisk.device.crypto.HashCrypto

public class HashCrypto
extends Object

Provides hash crypto operations


Constructor Summary
HashCrypto()
           
 
Method Summary
static byte[] hmacSha256(byte[] data, byte[] keyBytes)
          HMAC_SHA56 hash function
static byte[] pbkdf2WithHmacSha256(byte[] password, byte[] salt, int iteration)
          PBKDF2(Password-Based Key Derivation Function) with hmac sha256 key derivation function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashCrypto

public HashCrypto()
Method Detail

hmacSha256

public static byte[] hmacSha256(byte[] data,
                                byte[] keyBytes)
                         throws Exception
HMAC_SHA56 hash function

Parameters:
data - specified message data in byte array
keyBytes - specified key in byte array
Returns:
hash data in byte array
Throws:
Exception - NoSuchAlgorithmException, InvalidKeyException, IllegalStateException, IllegalArgumentException

pbkdf2WithHmacSha256

public static byte[] pbkdf2WithHmacSha256(byte[] password,
                                          byte[] salt,
                                          int iteration)
PBKDF2(Password-Based Key Derivation Function) with hmac sha256 key derivation function.

Parameters:
password - specified password in byte array
salt - specified salt in byte array
iteration - iteration counter
Returns:
derived key in byte array


Copyright © 2020. All rights reserved.