accounts/keystore: handle error for invalid key in DecryptKey (#27432)

Co-authored-by: KAI <kaili@coinsummer.io>
Co-authored-by: Felix Lange <fjl@twurst.com>
pull/27435/head
KAI 1 year ago committed by GitHub
parent 99eb0b52aa
commit 5c51ef8527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      accounts/keystore/passphrase.go

@ -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,

Loading…
Cancel
Save