Skip to content

Commit

Permalink
Testing with bad private key
Browse files Browse the repository at this point in the history
  • Loading branch information
phayes committed Sep 25, 2017
1 parent 92247c1 commit 2cfd2bc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rsablind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/rand"
"crypto/rsa"
_ "crypto/sha256"
"math/big"
"testing"

"github.com/cryptoballot/fdh"
Expand Down Expand Up @@ -80,4 +81,15 @@ func TestErrors(t *testing.T) {
if err == nil {
t.Error("Failed to get error on too large a hash")
}

badkey := &rsa.PrivateKey{
PublicKey: key.PublicKey,
D: big.NewInt(8),
Primes: []*big.Int{big.NewInt(12)},
}
_, err = BlindSign(badkey, []byte("ABC123"))
if err == nil {
t.Error("Failed to get error on bad private key")
}

}

0 comments on commit 2cfd2bc

Please sign in to comment.