I'm trying to calculate HMAC with iv (without any additional key). I need to pass it at the 'init' level. I know that usually there is no need in passing the iv, since there are default ivs for hmac/sha. But if I don't want to use the defaults, and want to supply my own iv how is it possible to implement in java? I've tried using javax, but it's MAC init accepts only the signing key.
For example:
Mac hmac = Mac.getInstance("HmacSHA1");
byte[] hmacKeyBytes = key.getBytes();
SecretKeySpec secretKey = new SecretKeySpec(hmacKeyBytes, "HmacSHA1");
hmac.init(secretKey);
- I want to init with some iv value. But don't know how.
I'm referring to initial value used to start the hash/hmac iterated process. Usually it is some arbitrary number, not exposed to the user. I want to be able to change this default initialization vector for hash functions/ find some way to supply my own iv. How can I do it?
Thank you!