Commit graph

23 commits

Author SHA1 Message Date
Tony Arcieri
55620dcde5
PKCS#8 support (#224)
Adds optional integration with `ed25519::pkcs8` with support for
decoding/encoding `Keypair` from/to PKCS#8-encoded documents as well as
`PublicKey` from/to SPKI-encoded documents.

Includes test vectors generated for the `ed25519` crate from:
https://github.com/RustCrypto/signatures/tree/master/ed25519/tests/examples
2022-12-13 18:19:31 -05:00
Tony Arcieri
cfcdf536a0
Cargo.toml: compatibility updates for curve25519-dalek and ed25519 (#236)
curve25519-dalek:

- Enables `digest` and `rand_core` features
- Removes transitive `nightly`, `simd_backend`, and `std` features

ed25519:

- `AsRef` impl for `Signature` has been removed; uses `to_bytes`
- Uses `try_from` for `InternalSignature` conversion
2022-12-09 21:14:38 -05:00
Tony Arcieri
01ad6305f2
Edition fixups: remove extern crate, add idioms lint (#231)
Rust editions 2018+ do not require `extern crate` except for linking
`alloc` and `std`.
2022-12-08 02:39:48 -05:00
Tony Arcieri
ae4bd2c81e
Fix warnings and add -D warnings check in CI (#226) 2022-11-20 22:28:09 -05:00
Tony Arcieri
f7cbeee7f6
Bump curve25519-dalek to v4.0.0-pre (via git) (#223)
Also bumps these corresponding dependencies which are needed for everything to compile with this update:

* `merlin` v3.0
* `rand` v0.8
* `rand_core` v0.6
* `sha2` v0.10
2022-11-20 15:08:05 -05:00
Alex Xiong
9638ab40a5
Made ExpandedSecretKey private to avoid signing key oracle (#205)
This fix eliminates a scenario where a user misuses the `ExpandedSecretKey` API
in a way that leaks the user's secret key. In short, if a user sends
`ExpandedSecretKey::sign(sk, msg, pk1)` followed by
`ExpandedSecretKey::sign(sk, msg, pk2)`, where `pk1 != pk2`, a passive
adversary [can easily][0] derive `sk`. To mitigate this, we remove the API
entirely.

[0]: https://github.com/MystenLabs/ed25519-unsafe-libs
2022-10-15 15:04:03 -04:00
François Garillot
da6c7e114f
[test-only] Add test showing the non-repudiation property of the signature verifications used in PublicKey::verify and PublicKey::verify_strict.
This PR is a follow-up of #98, which aims to demonstrate the issue brought by small-order public keys. It shows an example of crafting a (public_key, signature) that verifies against two distinct messages using `verify`, but fails using `verify_strict`.
This has consequences on the possibility to repudiate a signed contract of blockchain transactions.

For more details, see:
https://eprint.iacr.org/2020/1244

Joint work with @kchalkias @valerini
2020-10-14 17:28:51 -04:00
Cheng XU
008c9680f6
Update tests for serde
* Upgrade bincode to 1.0
* Add more serde tests including json serialization.
2020-09-21 18:26:59 -07:00
Isis Lovecruft
1c97dac4dc
Update to curve25519-dalek version 3. 2020-08-20 21:19:21 +00:00
Isis Lovecruft
7243d7151d
Fix handling of external error types. 2020-07-16 22:19:40 +00:00
Isis Lovecruft
b8f36d48d8
Fix proc_macro crate name resolution for serde integration tests. 2020-07-15 17:39:23 +00:00
Isis Lovecruft
e7a88c2c7f
Try compiling tests using serde_crate instead. 2020-07-14 23:58:35 +00:00
Isis Lovecruft
3a9435df94
Fixup serde and ed25519 trait errors in tests/benches. 2020-07-13 23:16:30 +00:00
Isis Lovecruft
84047448da
Merge remote-tracking branch 'tarcieri/ed25519-crate' into develop 2020-07-13 23:00:23 +00:00
Isis Lovecruft
9e247c493c
Add additional tests for keypair (de)serialisation. 2020-06-30 22:40:24 +00:00
Tony Arcieri
6e0667d429 Use ed25519 + signature interop crates
The `signature` crate provides `Signer` and `Verifier` traits generic
over signature types:

https://github.com/RustCrypto/traits/tree/master/signature

There's presently an open call to stabilize the parts of its API needed
by Ed25519 signatures and release a 1.0 version:

https://github.com/RustCrypto/traits/issues/78

The `ed25519` crate, based on the `signature` crate, provides an
`ed25519::Signature` type which can be shared across multiple Ed25519
crates (e.g. it is also used by the `yubihsm` crate):

https://github.com/RustCrypto/signatures/tree/master/ed25519

This commit integrates the `ed25519::Signature` type, and changes the
existing `sign` and `verify` methods (where applicable) to use the
`Signer` and `Verifier` traits from the `signature` crate. Additionally,
it replaces `SignatureError` with the `signature` crate's error type.

This has the drawback of requiring the `Signer` and/or `Verifier` traits
are in scope in order to create and/or verify signatures, but with the
benefit of supporting interoperability with other Ed25519 crates which
also make use of these traits.
2020-04-20 09:15:10 -07:00
Michael Lodder
c3f4c7a67e Update to latest rand
Signed-off-by: Michael Lodder <redmike7@gmail.com>
2019-10-21 09:03:08 -06:00
Isis Lovecruft
d31df0aaa8
Remove sha2 dep; limit rand depends; fixes after PR#68 merge.
* ADD new "batch" feature for feature-gating ed25519 batch verification; off by
   default. The "batch" feature is the only thing which depends on all of the
   `rand` crate, since it requires the functionality of `rand::thread_rng()`.
   Without batch verification, the rest of ed25519-dalek only depends on
   `rand_os` and `rand_core`.
2019-04-02 01:46:23 +00:00
Isis Lovecruft
ae8764fbef
Update copyright year to 2019 and destroy capitalism. 2019-01-18 04:59:12 +00:00
Isis Lovecruft
42b571eb24
Remove unused clear_on_drop import from tests. 2018-12-30 04:26:56 +00:00
Isis Lovecruft
144e87bfc8
Remove unnecessary tests/mod.rs file. 2018-12-30 04:01:39 +00:00
Isis Lovecruft
eb8ab9f06b
Organise integration tests into modules. 2018-12-30 02:32:21 +00:00
Isis Lovecruft
e88da5ea85
Move integration tests to their own directory. 2018-12-30 02:32:21 +00:00