12 Commits

Author SHA1 Message Date
Fabrice Drouin
f242b4ffe8
Check arguments passed to secp256k1 methods (#94)
* Check arguments passed to secp256k1 methods

Illegal arguments will trigger an internal callback that prints to stderr and calls abort.
We already check arguments in our JNI and kotlin native code but had missed 2 checks (recid in ecdsaRecover, empty arrays in pubkeyCombine).

* Implement the same "tweak" checks in the native code and JNI code

The native code was missing checks on the "tweak" size (which must be 32 bytes)
2023-12-13 13:42:14 +01:00
Fabrice Drouin
118c72064c
Update secp256k1 sources (#52)
We're now at 8746600eec5e7fcd35dabd480839a3a4bdfee87b, same as bitcoin core at 747cdf1d652d8587e9f2e3d4436c3ecdbf56d0a5
2022-04-11 13:34:59 +02:00
Fabrice Drouin
ac7d4983d5
Export Schnorr signature API (#32)
Implement Schnorr signatures (BIP 340)
2021-11-23 17:38:46 +01:00
Bastien Teinturier
2ae6abcf93
Clarify public key encoding and enrich tests (#37)
Don't throw in `seckey_verify`: it's inconsistent to have this function throw
for some invalid inputs and return false for other invalid inputs.

Document public key compression and add tests.
2021-11-05 10:45:49 +01:00
Bastien Teinturier
f695e7453d
Clean up and enrich tests (#35)
* Harmonize parameter names
* Document methods
* Replace pubKeyAdd with pubKeyCombine
* Clean-up tests
2021-10-26 17:16:36 +02:00
sstone
6a67dbe9f6
signatureNormalize: relax check on signature size
Checking that the sig size is >= 64 is enough, this is just a quick check before the actual library method is called.
2020-09-10 20:21:58 +02:00
Fabrice Drouin
0cc4c251f9
Fixup for #6 (native signature format detection) (#8)
* Fixup for #6

Behaviour was changed in the JNI wapper but not in Kotlin native code.

* Set version to 0.2.1-1.4-M3
2020-07-09 20:16:39 +02:00
sstone
08d1692932 Add compact2der() method 2020-07-02 21:39:33 +02:00
Fabrice Drouin
3ee2635d93
Upgrade JNI interface (#1)
* Upgrade JNI interface

* Input signatures can be DER or compact format, output signatures are always in compact format

* Input public keys can be compressed or uncompressed, output public keys are always uncompressed

* Name and parameters match libsecp256k1's

* JNI implementation is now straightforward

  No more ByteBuffers
  Exceptions are thrown in case of failures

* Update src/nativeMain/kotlin/fr/acinq/secp256k1/Secp256k1Native.kt

* Add public key compression method

Co-authored-by: Salomon BRYS <salomon.brys@gmail.com>
2020-07-02 17:52:21 +02:00
Salomon BRYS
720637ec24 JNI Implementation in their own package 2020-07-01 12:56:48 +02:00
Salomon BRYS
4bdc836556 Explicit Signature & PubKey formats + bug fixes 2020-06-29 17:10:58 +02:00
Salomon BRYS
08b6d16836 Native & iOS implementation 2020-06-26 17:10:48 +02:00