Skip to content

Commit

Permalink
do not use NewInt, just make new ints
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicalTux committed Apr 19, 2019
1 parent c741219 commit 0377a47
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions yubihsm2.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,21 @@ func (k *YubiHSM2Key) Public() crypto.PublicKey {
case yubihsm2.Secp256r1:
return &ecdsa.PublicKey{
Curve: elliptic.P256(),
X: big.NewInt(0).SetBytes(key.KeyData[:32]),
Y: big.NewInt(0).SetBytes(key.KeyData[32:]),
X: new(big.Int).SetBytes(key.KeyData[:32]),
Y: new(big.Int).SetBytes(key.KeyData[32:]),
}
case yubihsm2.Secp384r1:
return &ecdsa.PublicKey{
Curve: elliptic.P384(),
X: big.NewInt(0).SetBytes(key.KeyData[:48]),
Y: big.NewInt(0).SetBytes(key.KeyData[48:]),
X: new(big.Int).SetBytes(key.KeyData[:48]),
Y: new(big.Int).SetBytes(key.KeyData[48:]),
}
case yubihsm2.Secp521r1:
// key size, 64 or 66?
return &ecdsa.PublicKey{
Curve: elliptic.P521(),
X: big.NewInt(0).SetBytes(key.KeyData[:66]),
Y: big.NewInt(0).SetBytes(key.KeyData[66:]),
X: new(big.Int).SetBytes(key.KeyData[:66]),
Y: new(big.Int).SetBytes(key.KeyData[66:]),
}
case yubihsm2.Rsa2048, yubihsm2.Rsa3072, yubihsm2.Rsa4096:
return &rsa.PublicKey{
Expand Down

0 comments on commit 0377a47

Please sign in to comment.