-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
openssl dgst add support for reading the hmac key from a file #13382
Comments
My guess is that your key.txt file contains a newline, which becomes part of the key.
|
@kroeckx I can assure you it doesn't has any whitespaces including a new line. |
And you checked that using something like hexdump or xxd?
|
yeah, I did. |
Won't this use the string How about: |
this also gives a very different tag using |
My mistake, I mixed up cat and echo options. |
The |
@paulidale but this command is basically doing similar to providing the hex key directly as in @mattcaswell the content of the |
Because the |
I think he's actually using "-in" as key.
|
In this case, can I ask for a feature request then: It would be nice if |
What is the format of that file? Binary or base64 or hexbin? If base64 or hexbin, ignore newlines? |
This issue should be renamed "request key in file" or something. |
currently running |
It seems like we have duplicate issues here. Can we close this as a duplicate request of #24584 |
openssl dgst -sha256 -hmac ad12d06829e909e10404c7beca0b93504b4f987294f5300f6d68bb78af8407b8 q1.txt
where the
ad12d06829e909e10404c7beca0b93504b4f987294f5300f6d68bb78af8407b8
is the sha256 key and q1.txt is the cipher text in base64 gives a different value as compared to when you give the sha256 key in a file instead like:openssl dgst -sha256 -hmac key.txt q1.txt
I am not sure why this happens but mostly it's an issue where the
HMAC-SHA256
returns a different value. Also, to confirm, the first command gives the correctHMAC-SHA256
and the second one gives a wrong tag. It would be great if someone from OpenSSL contributors can take a look and explain why this happens?The text was updated successfully, but these errors were encountered: