Skip to content

Commit

Permalink
accounts/keystore: handle error for invalid key in DecryptKey (ethere…
Browse files Browse the repository at this point in the history
…um#27432)


Co-authored-by: KAI <kaili@coinsummer.io>
Co-authored-by: Felix Lange <fjl@twurst.com>
  • Loading branch information
3 people authored and antonydenyer committed Jul 28, 2023
1 parent f7b95ae commit 7a5066f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions accounts/keystore/passphrase.go
Expand Up @@ -225,10 +225,13 @@ func DecryptKey(keyjson []byte, auth string) (*Key, error) {
if err != nil {
return nil, err
}
key := crypto.ToECDSAUnsafe(keyBytes)
key, err := crypto.ToECDSA(keyBytes)
if err != nil {
return nil, fmt.Errorf("invalid key: %w", err)
}
id, err := uuid.FromBytes(keyId)
if err != nil {
return nil, err
return nil, fmt.Errorf("invalid UUID: %w", err)
}
return &Key{
Id: id,
Expand Down

0 comments on commit 7a5066f

Please sign in to comment.