Crypto: Use crypto/pbkdf2 instead of x (#106474)
This commit is contained in:
@@ -4,14 +4,13 @@ import (
|
||||
"bytes"
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"crypto/pbkdf2"
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -146,5 +145,5 @@ func Encrypt(payload []byte, secret string) ([]byte, error) {
|
||||
|
||||
// Key needs to be 32bytes
|
||||
func encryptionKeyToBytes(secret, salt string) ([]byte, error) {
|
||||
return pbkdf2.Key([]byte(secret), []byte(salt), 10000, 32, sha256.New), nil
|
||||
return pbkdf2.Key(sha256.New, secret, []byte(salt), 10000, 32)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user