コード例 #1
0
func TestSignAndVerify(t *testing.T) {
	testSignAndVerify(t, bitelliptic.S256(), "S256")
	if testing.Short() {
		return
	}
	testSignAndVerify(t, bitelliptic.S160(), "S160")
	testSignAndVerify(t, bitelliptic.S192(), "S192")
	testSignAndVerify(t, bitelliptic.S224(), "S224")
}
コード例 #2
0
func TestKeyGeneration(t *testing.T) {
	testKeyGeneration(t, bitelliptic.S256(), "S256")
	if testing.Short() {
		return
	}
	testKeyGeneration(t, bitelliptic.S160(), "S160")
	testKeyGeneration(t, bitelliptic.S192(), "S192")
	testKeyGeneration(t, bitelliptic.S224(), "S224")
}
コード例 #3
0
func TestVectors224(t *testing.T) {
	for i, test := range testVectors224 {
		pub := PublicKey{
			BitCurve: bitelliptic.S224(),
			X:        fromHex(test.Qx),
			Y:        fromHex(test.Qy),
		}
		hashed, _ := base64.StdEncoding.DecodeString(test.hash)
		r := fromHex(test.r)
		s := fromHex(test.s)
		//		t.Logf("Comparing %v %v %v %v", pub, hashed, r, s)
		if Verify(&pub, hashed, r, s) != test.ok {
			t.Errorf("%d: bad result", i)
		}
		if testing.Short() {
			break
		}
	}
}