Creating Key / Secrets for HMAC-SHA1

I am looking for a software way to generate a consumer key / secrets for HMAC-SHA1, which will be used by clients calling our API through OAuth. Any pointers to existing implementations will be very helpful.

+3
source share
1 answer

Secrets are best created with random data. Thus, there is no external data that could help an attacker infer or guess part or all of a key. Of course, this depends on how much protection your secret key needs. Java includes some random number generators in java.util.Random (with JDK1.0). Unless you have backward compatibility issues, Java 6 has java.security.SecureRandom that complies with FIPS 140-2 requirements. Java libraries are not really random, but this is probably good enough for most applications. If you need the best random data, you should go for a random hardware based generator.

+1
source

Source: https://habr.com/ru/post/1754195/


All Articles