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

armor decryptPrivKey should return ErrWrongPassword #14993

Closed
JulianToledano opened this issue Feb 10, 2023 · 1 comment · Fixed by #15000
Closed

armor decryptPrivKey should return ErrWrongPassword #14993

JulianToledano opened this issue Feb 10, 2023 · 1 comment · Fixed by #15000
Labels
C:Keys Keybase, KMS and HSMs

Comments

@JulianToledano
Copy link
Contributor

Summary of Bug

When trying to import a key with a wrong passphrase a sdkerrors.ErrWrongPassword should be expected (not sure if its good idea to give that information) but a ciphertext decryption failed is returned. Turns out there’s a mistake when checking the error returned by xsalsa20symmetric.DecryptSymmetric. As you can see in the following code snippets one of the strings starts with a capital letter while the other don’t, which makes the comparation to fail.

cosmos-sdk/crypto/armor.go

Lines 202 to 205 in 3c53870

privKeyBytes, err := xsalsa20symmetric.DecryptSymmetric(encBytes, key)
if err != nil && err.Error() == "Ciphertext decryption failed" {
return privKey, sdkerrors.ErrWrongPassword
} else if err != nil {

if !ok {
return nil, errors.New("ciphertext decryption failed")
}

@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Feb 10, 2023
@tac0turtle tac0turtle added C:Keys Keybase, KMS and HSMs and removed needs-triage Issue that needs to be triaged labels Feb 10, 2023
@vidhanarya
Copy link

Hi, I would like to work on this issue, is it available?

@julienrbrt julienrbrt linked a pull request Feb 13, 2023 that will close this issue
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:Keys Keybase, KMS and HSMs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants