@Test void testSignatureGeneration() { SecretKey secretKey = SecretKey.fromInteger(new BigInteger("c85ef7d79691fe79573b1a7064c19c1a9819ebdbd1faaab1a8ec92344438aaf4", 16)); SECP256K1.KeyPair keyPair = SECP256K1.KeyPair.fromSecretKey(secretKey); Bytes data = Bytes.wrap("This is an example of a signed message.".getBytes(UTF_8)); SECP256K1.Signature expectedSignature = new SECP256K1.Signature( (byte) 1, new BigInteger("d2ce488f4da29e68f22cb05cac1b19b75df170a12b4ad1bdd4531b8e9115c6fb", 16), new BigInteger("75c1fe50a95e8ccffcbb5482a1e42fbbdd6324131dfe75c3b3b7f9a7c721eccb", 16)); SECP256K1.Signature actualSignature = SECP256K1.sign(data, keyPair); assertEquals(expectedSignature, actualSignature); }
public static Signature sign(byte[] data, KeyPair keyPair) { return signHashed(keccak256(data), keyPair); }
SECP256K1 { public static Signature sign(byte[] data, KeyPair keyPair) { return signHashed(keccak256(data), keyPair); } }
SECP256K1 { public static Signature sign(byte[] data, KeyPair keyPair) { return signHashed(keccak256(data), keyPair); } private  SECP256K1(); }
SECP256K1 { public static Signature sign(byte[] data, KeyPair keyPair) { return signHashed(keccak256(data), keyPair); } private  SECP256K1(); static Signature sign(byte[] data, KeyPair keyPair); static Signature sign(Bytes data, KeyPair keyPair); static Signature signHashed(byte[] hash, KeyPair keyPair); static Signature signHashed(Bytes32 hash, KeyPair keyPair); static boolean verify(byte[] data, Signature signature, PublicKey publicKey); static boolean verify(Bytes data, Signature signature, PublicKey publicKey); static boolean verifyHashed(Bytes32 hash, Signature signature, PublicKey publicKey); static boolean verifyHashed(byte[] hash, Signature signature, PublicKey publicKey); static Bytes32 calculateKeyAgreement(SecretKey privKey, PublicKey theirPubKey); }
SECP256K1 { public static Signature sign(byte[] data, KeyPair keyPair) { return signHashed(keccak256(data), keyPair); } private  SECP256K1(); static Signature sign(byte[] data, KeyPair keyPair); static Signature sign(Bytes data, KeyPair keyPair); static Signature signHashed(byte[] hash, KeyPair keyPair); static Signature signHashed(Bytes32 hash, KeyPair keyPair); static boolean verify(byte[] data, Signature signature, PublicKey publicKey); static boolean verify(Bytes data, Signature signature, PublicKey publicKey); static boolean verifyHashed(Bytes32 hash, Signature signature, PublicKey publicKey); static boolean verifyHashed(byte[] hash, Signature signature, PublicKey publicKey); static Bytes32 calculateKeyAgreement(SecretKey privKey, PublicKey theirPubKey);  }