Skip to content
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

crypto/cipher: can't reuse BlockMode by NewCBCDecrypter() #11159

Closed
Terry-Mao opened this issue Jun 11, 2015 · 7 comments
Closed

crypto/cipher: can't reuse BlockMode by NewCBCDecrypter() #11159

Terry-Mao opened this issue Jun 11, 2015 · 7 comments

Comments

@Terry-Mao
Copy link

code:
http://play.golang.org/p/oZ5OwdRYLV

After cbcDecrypter.CryptBlocks, the x.iv is changed. so reuse BlockMode got a wrong decrypt text.
i saw the source code has a exported method : SetIV, but cbcEncrypter is not exported.

this means everytime i must new a cbcDecrypter object.

@alphaqiu
Copy link

@Terry-Mao
Copy link
Author

@alphaqiu thks, this can fix the issue, but as a std library, this seems not so nice..

@bradfitz
Copy link
Contributor

Is there a documentation problem?

@Terry-Mao
Copy link
Author

@bradfitz
document don't tell us cbc blockmode must rest(SetIV), after CryptBlocks

@minux
Copy link
Member

minux commented Jun 11, 2015 via email

@minux
Copy link
Member

minux commented Jun 11, 2015 via email

@Terry-Mao
Copy link
Author

@minux thks, fixed

@mikioh mikioh changed the title crypto/cipher can't reuse BlockMode by NewCBCDecrypter() crypto/cipher: can't reuse BlockMode by NewCBCDecrypter() Jun 11, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants