How to generate the secret key for the HMAC algorithm as I have to use it for data verification at the other clients end?
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The HMAC key must be pre-shared between the server and the client (both must known the key before you exchange messages).
You can generate the key in any way you want, for example by reading some bytes from /dev/random:
Then you can calculate the HMAC using
hash_hmac: