All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.t.util.security.message.digest.hmc.HmacUtil Maven / Gradle / Ivy

There is a newer version: 1.0.16.RELEASE
Show newest version
package cn.t.util.security.message.digest.hmc;

import cn.t.util.security.message.AlgorithmName;

import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;

public class HmacUtil {

    /**
     * 转换encoded key
     * @param keyBytes xxx
     * @return xxx
     * @throws InvalidKeyException xxx
     * @throws NoSuchAlgorithmException xxx
     * @throws InvalidKeySpecException xxx
     */
    public static Key convertSecretKey(byte[] keyBytes) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException {
        return new SecretKeySpec(keyBytes, AlgorithmName.HMAC_MD5);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy