@Test public void testNonCanonicalSigs() throws Exception { InputStream in = getClass().getResourceAsStream("sig_noncanonical.json"); 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); try { assertFalse(TransactionSignature.isEncodingCanonical(Hex.decode(sig.toString()))); } catch (StringIndexOutOfBoundsException e) { } } in.close(); }
public String toString() { StringBuilder b = new StringBuilder(); b.append("pub:").append(Utils.bytesToHexString(pub)); if (creationTimeSeconds != 0) { b.append(" timestamp:").append(creationTimeSeconds); } if (isEncrypted()) { b.append(" encrypted"); } return b.toString(); }
ECKey implements Serializable { public String toString() { StringBuilder b = new StringBuilder(); b.append("pub:").append(Utils.bytesToHexString(pub)); if (creationTimeSeconds != 0) { b.append(" timestamp:").append(creationTimeSeconds); } if (isEncrypted()) { b.append(" encrypted"); } return b.toString(); } }
ECKey implements Serializable { public String toString() { StringBuilder b = new StringBuilder(); b.append("pub:").append(Utils.bytesToHexString(pub)); if (creationTimeSeconds != 0) { b.append(" timestamp:").append(creationTimeSeconds); } if (isEncrypted()) { b.append(" encrypted"); } return b.toString(); } ECKey();  ECKey(BigInteger privKey);  ECKey(BigInteger privKey, BigInteger pubKey);  ECKey(@Nullable byte[] privKeyBytes, @Nullable byte[] pubKey);  ECKey(@Nullable EncryptedPrivateKey encryptedPrivateKey, @Nullable byte[] pubKey, KeyCrypter keyCrypter);  ECKey(@Nullable BigInteger privKey, @Nullable byte[] pubKey, boolean compressed); private  ECKey(@Nullable BigInteger privKey, @Nullable byte[] pubKey); }
ECKey implements Serializable { public String toString() { StringBuilder b = new StringBuilder(); b.append("pub:").append(Utils.bytesToHexString(pub)); if (creationTimeSeconds != 0) { b.append(" timestamp:").append(creationTimeSeconds); } if (isEncrypted()) { b.append(" encrypted"); } return b.toString(); } ECKey();  ECKey(BigInteger privKey);  ECKey(BigInteger privKey, BigInteger pubKey);  ECKey(@Nullable byte[] privKeyBytes, @Nullable byte[] pubKey);  ECKey(@Nullable EncryptedPrivateKey encryptedPrivateKey, @Nullable byte[] pubKey, KeyCrypter keyCrypter);  ECKey(@Nullable BigInteger privKey, @Nullable byte[] pubKey, boolean compressed); private  ECKey(@Nullable BigInteger privKey, @Nullable byte[] pubKey); static ECKey fromASN1(byte[] asn1privkey); boolean isPubKeyOnly(); boolean hasPrivKey(); byte[] toASN1(); static byte[] publicKeyFromPrivate(BigInteger privKey, boolean compressed); byte[] getPubKeyHash(); byte[] getPubKey(); boolean isCompressed(); String toString(); String toStringWithPrivate(); Address toAddress(NetworkParameters params); void clearPrivateKey(); ECDSASignature sign(Sha256Hash input); ECDSASignature sign(Sha256Hash input, @Nullable KeyParameter aesKey); static boolean verify(byte[] data, ECDSASignature signature, byte[] pub); static boolean verify(byte[] data, byte[] signature, byte[] pub); boolean verify(byte[] data, byte[] signature); boolean verify(Sha256Hash sigHash, ECDSASignature signature); boolean isPubKeyCanonical(); static boolean isPubKeyCanonical(byte[] pubkey); String signMessage(String message); String signMessage(String message, @Nullable KeyParameter aesKey); static ECKey signedMessageToKey(String message, String signatureBase64); void verifyMessage(String message, String signatureBase64); @Nullable static ECKey recoverFromSignature(int recId, ECDSASignature sig, Sha256Hash message, boolean compressed); @Nullable byte[] getPrivKeyBytes(); DumpedPrivateKey getPrivateKeyEncoded(NetworkParameters params); long getCreationTimeSeconds(); void setCreationTimeSeconds(long newCreationTimeSeconds); @Override boolean equals(Object o); @Override int hashCode(); ECKey encrypt(KeyCrypter keyCrypter, KeyParameter aesKey); ECKey decrypt(KeyCrypter keyCrypter, KeyParameter aesKey); static boolean encryptionIsReversible(ECKey originalKey, ECKey encryptedKey, KeyCrypter keyCrypter, KeyParameter aesKey); boolean isEncrypted(); @Nullable EncryptedPrivateKey getEncryptedPrivateKey(); KeyCrypter getKeyCrypter(); }
ECKey implements Serializable { public String toString() { StringBuilder b = new StringBuilder(); b.append("pub:").append(Utils.bytesToHexString(pub)); if (creationTimeSeconds != 0) { b.append(" timestamp:").append(creationTimeSeconds); } if (isEncrypted()) { b.append(" encrypted"); } return b.toString(); } ECKey();  ECKey(BigInteger privKey);  ECKey(BigInteger privKey, BigInteger pubKey);  ECKey(@Nullable byte[] privKeyBytes, @Nullable byte[] pubKey);  ECKey(@Nullable EncryptedPrivateKey encryptedPrivateKey, @Nullable byte[] pubKey, KeyCrypter keyCrypter);  ECKey(@Nullable BigInteger privKey, @Nullable byte[] pubKey, boolean compressed); private  ECKey(@Nullable BigInteger privKey, @Nullable byte[] pubKey); static ECKey fromASN1(byte[] asn1privkey); boolean isPubKeyOnly(); boolean hasPrivKey(); byte[] toASN1(); static byte[] publicKeyFromPrivate(BigInteger privKey, boolean compressed); byte[] getPubKeyHash(); byte[] getPubKey(); boolean isCompressed(); String toString(); String toStringWithPrivate(); Address toAddress(NetworkParameters params); void clearPrivateKey(); ECDSASignature sign(Sha256Hash input); ECDSASignature sign(Sha256Hash input, @Nullable KeyParameter aesKey); static boolean verify(byte[] data, ECDSASignature signature, byte[] pub); static boolean verify(byte[] data, byte[] signature, byte[] pub); boolean verify(byte[] data, byte[] signature); boolean verify(Sha256Hash sigHash, ECDSASignature signature); boolean isPubKeyCanonical(); static boolean isPubKeyCanonical(byte[] pubkey); String signMessage(String message); String signMessage(String message, @Nullable KeyParameter aesKey); static ECKey signedMessageToKey(String message, String signatureBase64); void verifyMessage(String message, String signatureBase64); @Nullable static ECKey recoverFromSignature(int recId, ECDSASignature sig, Sha256Hash message, boolean compressed); @Nullable byte[] getPrivKeyBytes(); DumpedPrivateKey getPrivateKeyEncoded(NetworkParameters params); long getCreationTimeSeconds(); void setCreationTimeSeconds(long newCreationTimeSeconds); @Override boolean equals(Object o); @Override int hashCode(); ECKey encrypt(KeyCrypter keyCrypter, KeyParameter aesKey); ECKey decrypt(KeyCrypter keyCrypter, KeyParameter aesKey); static boolean encryptionIsReversible(ECKey originalKey, ECKey encryptedKey, KeyCrypter keyCrypter, KeyParameter aesKey); boolean isEncrypted(); @Nullable EncryptedPrivateKey getEncryptedPrivateKey(); KeyCrypter getKeyCrypter(); static final ECDomainParameters CURVE; static final BigInteger HALF_CURVE_ORDER; @VisibleForTesting
    static boolean FAKE_SIGNATURES; }