mirror of
https://github.com/rclone/rclone.git
synced 2025-01-22 14:19:56 +01:00
Make error messages less crypting when revealing an unobscured password - fixes #1743
This commit is contained in:
parent
ef1346602e
commit
115053930e
@ -182,15 +182,15 @@ func MustObscure(x string) string {
|
|||||||
func Reveal(x string) (string, error) {
|
func Reveal(x string) (string, error) {
|
||||||
ciphertext, err := base64.RawURLEncoding.DecodeString(x)
|
ciphertext, err := base64.RawURLEncoding.DecodeString(x)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.Wrap(err, "base64 decode failed")
|
return "", errors.Wrap(err, "base64 decode failed when revealing password - is it obscured?")
|
||||||
}
|
}
|
||||||
if len(ciphertext) < aes.BlockSize {
|
if len(ciphertext) < aes.BlockSize {
|
||||||
return "", errors.New("input too short")
|
return "", errors.New("input too short when revealing password - is it obscured?")
|
||||||
}
|
}
|
||||||
buf := ciphertext[aes.BlockSize:]
|
buf := ciphertext[aes.BlockSize:]
|
||||||
iv := ciphertext[:aes.BlockSize]
|
iv := ciphertext[:aes.BlockSize]
|
||||||
if err := crypt(buf, buf, iv); err != nil {
|
if err := crypt(buf, buf, iv); err != nil {
|
||||||
return "", errors.Wrap(err, "decrypt failed")
|
return "", errors.Wrap(err, "decrypt failed when revealing password - is it obscured?")
|
||||||
}
|
}
|
||||||
return string(buf), nil
|
return string(buf), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user