diff --git a/encrypt/password.go b/encrypt/password.go index cc96854..15a0f70 100644 --- a/encrypt/password.go +++ b/encrypt/password.go @@ -48,6 +48,9 @@ func ScryptComparePassword(storedPassword string, suppliedPassword string) (bool } shash, err := scrypt.Key([]byte(suppliedPassword), salt, 32768, 8, 1, 32) + if err != nil { + return false, err + } return hex.EncodeToString(shash) == pwsalt[0], nil } diff --git a/encrypt/rsa.go b/encrypt/rsa.go index e5aab0b..69d9620 100644 --- a/encrypt/rsa.go +++ b/encrypt/rsa.go @@ -26,7 +26,7 @@ func RSAEncrypt(origData []byte) ([]byte, error) { func RSADecrypt(ciphertext []byte) ([]byte, error) { block, _ := pem.Decode(privateKey) if block == nil { - return nil, errors.New("private key error!") + return nil, errors.New("private key error") } priv, err := x509.ParsePKCS1PrivateKey(block.Bytes) if err != nil {