@Test
public void testCanonicalSigs() throws Exception {

    // Tests the canonical sigs from Bitcoin Core unit tests
    InputStream in = getClass().getResourceAsStream("sig_canonical.json");
    // Poor man's JSON parser (because pulling in a lib for this is overkill)
    while (in.available() > 0) {
        while (in.available() > 0 && in.read() != '"') ;
        if (in.available() < 1)
            break;
        StringBuilder sig = new StringBuilder();
        int c;
        while (in.available() > 0 && (c = in.read()) != '"')
            sig.append((char)c);
        assertTrue(TransactionSignature.isEncodingCanonical(HEX.decode(sig.toString())));
    }
    in.close();
}