tests for malleability highest bit of signature ECDSA s value must be 0, in the 33th byte.
(t *testing.T, sig []byte)
| 48 | // tests for malleability |
| 49 | // highest bit of signature ECDSA s value must be 0, in the 33th byte. |
| 50 | func compactSigCheck(t *testing.T, sig []byte) { |
| 51 | var b = int(sig[32]) |
| 52 | if b < 0 { |
| 53 | t.Errorf("highest bit is negative: %d", b) |
| 54 | } |
| 55 | if ((b >> 7) == 1) != ((b & 0x80) == 0x80) { |
| 56 | t.Errorf("highest bit: %d bit >> 7: %d", b, b>>7) |
| 57 | } |
| 58 | if (b & 0x80) == 0x80 { |
| 59 | t.Errorf("highest bit: %d bit & 0x80: %d", b, b&0x80) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func TestSignatureValidity(t *testing.T) { |
| 64 | pubkey, seckey := generateKeyPair() |
no test coverage detected