-
Notifications
You must be signed in to change notification settings - Fork 18k
How to extract the IV of AES-GCM in "crypto/cipher" #32742
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
Comments
Sorry, due to some personal blogs, maybe i confused the iv/nonce/aad/tag. |
Searched on Wikipedia. |
IV and nonce are mostly synonyms. AES-GCM is an AEAD and it takes (key, nonce, plaintext[, aad]) and generates a ciphertext, which includes the authentication tag. Note that the key for AES-256 must be 32 uniform (random-looking) bytes, you don't want to use a password like "123", or even "12345678901234567890123456789012". Use scrypt or something like it to derive the key first. The golang/go issue tracker is used to develop the Go project, so you'll get more help with questions about using the Go language through the resources listed at https://golang.org/wiki/Questions. |
If you are trying to separate ciphertext and tag, the tag is at the end of the ciphertext in Go. There is some discussion about a split API at #24990. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Developing an "AES-256-GCM" Client Interacting with PHP-openssl-ext
What did you expect to see?
Like this (It's Pseudo-code and only my target):
What did you see instead?
1.Golang has no iv, only nonce.(I found Python maybe hasn't too. But C and PHP has. And the RFC doc said it should have.)
2.Golang doesn't support un-fixed very short length password.(like "123" will cause error because of its short.)(It doesn't mean i can't do any padding for the password(key), If I do, it can't crypt as well as php.)
The text was updated successfully, but these errors were encountered: