You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying out the crypto/cipher and I am hitting an error when performing CryptBlocks.
It works when the password I am encrypting is within the 16 bytes but, I have encountered a password with more than that, so I tried to change the aeskey to 24 bytes instead.
When I run the code and it comes to this point, I am getting an error in CryptBlocks. I tried looking at the code, and it seems that is comparing the size of the text-to-be-encrypted against the aes.BlockSize is which is declared a constant in the ./aes/cipher.go.
// The AES block size in bytes.
const BlockSize = 16
I assumed that by resizing the aeskey will also make the block size follow.
If that is not the case, will someone help/enlighten me?
I suspect you are making the same mistake as the OP in issue #9559 (please see Minux comment). The initialization vector (IV) is not the key, and it needs to have length 16.
That panic will trigger when the length of the source (src) is not divisible by the value of blockSize.
I suspect you are simply using the package incorrectly, but it's hard to say because you didn't provide a full, auto-contained code snippet that shows what you're doing and can be actually compiled and run.
In general, we only use the Github issue tracker for confirmed Go bugs. The Questions wiki page has a list of good places for asking questions. My suggestion is to ask for help in one of the places linked there. Remember to show them a full code snippet that can be run and triggers the error you are seeing. Ask if you're using the package correctly.
I'm closing this issue, but if it turns out that this is actually a bug, comment here and we'll re-open. Thanks.
Good day,
I am trying out the crypto/cipher and I am hitting an error when performing CryptBlocks.
It works when the password I am encrypting is within the 16 bytes but, I have encountered a password with more than that, so I tried to change the aeskey to 24 bytes instead.
When I run the code and it comes to this point, I am getting an error in CryptBlocks. I tried looking at the code, and it seems that is comparing the size of the text-to-be-encrypted against the aes.BlockSize is which is declared a constant in the ./aes/cipher.go.
I assumed that by resizing the aeskey will also make the block size follow.
If that is not the case, will someone help/enlighten me?
Thank you in advance.
go1.9.3
GOARCH="amd64"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
The text was updated successfully, but these errors were encountered: