update pairing salt

This commit is contained in:
Andrea Franz 2019-03-13 13:49:49 +01:00
parent f51eb1d5bc
commit 165bc34b82
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 6 additions and 6 deletions

View File

@ -15,7 +15,7 @@ import (
"golang.org/x/text/unicode/norm"
)
const pairingSalt = "Status Hardware Wallet Lite"
const PairingTokenSalt = "Keycard Pairing Password Salt"
var ErrInvalidCardCryptogram = errors.New("invalid card cryptogram")
@ -25,7 +25,7 @@ func GenerateECDHSharedSecret(priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey) []by
}
func VerifyCryptogram(challenge []byte, pairingPass string, cardCryptogram []byte) ([]byte, error) {
secretHash := pbkdf2.Key(norm.NFKD.Bytes([]byte(pairingPass)), norm.NFKD.Bytes([]byte(pairingSalt)), 50000, 32, sha256.New)
secretHash := pbkdf2.Key(norm.NFKD.Bytes([]byte(pairingPass)), norm.NFKD.Bytes([]byte(PairingTokenSalt)), 50000, 32, sha256.New)
h := sha256.New()
h.Write(secretHash[:])

View File

@ -7,14 +7,14 @@ import (
"fmt"
"math/big"
"github.com/status-im/keycard-go/crypto"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/text/unicode/norm"
)
const (
pairingTokenSalt = "Status Hardware Wallet Lite"
maxPukNumber = int64(999999999999)
maxPinNumber = int64(999999)
maxPukNumber = int64(999999999999)
maxPinNumber = int64(999999)
)
// Secrets contains the secret data needed to pair a client with a card.
@ -81,5 +81,5 @@ func generatePairingPass() (string, error) {
}
func generatePairingToken(pass string) []byte {
return pbkdf2.Key(norm.NFKD.Bytes([]byte(pass)), norm.NFKD.Bytes([]byte(pairingTokenSalt)), 50000, 32, sha256.New)
return pbkdf2.Key(norm.NFKD.Bytes([]byte(pass)), norm.NFKD.Bytes([]byte(crypto.PairingTokenSalt)), 50000, 32, sha256.New)
}