Revised ide recommendations
This commit is contained in:
parent
6a518665d7
commit
39d23d0b8c
@ -48,6 +48,9 @@ func ScryptComparePassword(storedPassword string, suppliedPassword string) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
shash, err := scrypt.Key([]byte(suppliedPassword), salt, 32768, 8, 1, 32)
|
shash, err := scrypt.Key([]byte(suppliedPassword), salt, 32768, 8, 1, 32)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
return hex.EncodeToString(shash) == pwsalt[0], nil
|
return hex.EncodeToString(shash) == pwsalt[0], nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ func RSAEncrypt(origData []byte) ([]byte, error) {
|
|||||||
func RSADecrypt(ciphertext []byte) ([]byte, error) {
|
func RSADecrypt(ciphertext []byte) ([]byte, error) {
|
||||||
block, _ := pem.Decode(privateKey)
|
block, _ := pem.Decode(privateKey)
|
||||||
if block == nil {
|
if block == nil {
|
||||||
return nil, errors.New("private key error!")
|
return nil, errors.New("private key error")
|
||||||
}
|
}
|
||||||
priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
|
priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user