Commit graph

58 commits

Author SHA1 Message Date
dignifiedquire
cf56e789ed bump MSRV to 1.60 and update to current curve25519-dalek 2022-12-09 15:35:49 +01:00
isis agora lovecruft
b6f7de1e4c
Merge pull request #71 from isislovecruft/feature/noise-secrets
Implement reused secret keys for Noise/X3DH/etc protocols
2021-09-14 22:47:04 +00:00
Isis Lovecruft
eef4de41c0
Disambiguate what kind of key in docstring. 2021-09-14 22:34:41 +00:00
Isis Lovecruft
edb9ec984e
Document that ReusableSecret is preferrable for Noise protocols. 2021-09-14 22:33:31 +00:00
Isis Lovecruft
588e48f8f2
Make ReusableSecret derive Clone. 2021-09-14 20:24:12 +00:00
Isis Lovecruft
3924797b59
Add note to StaticSecret that EphemeralSecret is recommended. 2021-09-14 20:23:38 +00:00
Isis Lovecruft
91babd286f
Add a #[must_use] to the was_contributory check. 2021-09-14 19:51:02 +00:00
Isis Lovecruft
c13e102f95
Implement optional check for contributory behaviour. 2021-09-13 21:31:54 +00:00
Isis Lovecruft
27c73fdb57
Feature gate reusable secrets and make the name more intuitive. 2021-04-20 21:33:32 +00:00
Isis Lovecruft
0a1023f4db
Implement reused secret keys for Noise protocol. 2021-04-14 20:00:41 +00:00
Isis Lovecruft
2333b52698
Move tests to a separate directory. 2021-04-14 19:45:36 +00:00
Isis Lovecruft
9e387372e6
Remove unused import from test suite. 2021-04-14 19:33:11 +00:00
Isis Lovecruft
0cca7977fc
Derive Zeroize for PublicKey. 2021-04-14 19:29:09 +00:00
Isis Lovecruft
fc945778ab
Fixups for doctest from #33. 2021-04-14 05:05:54 +00:00
Isis Lovecruft
cdd97559de
Merge remote-tracking branch 'zer0x64/master' into develop 2021-04-14 04:55:59 +00:00
Isis Lovecruft
1c39ff92e0
Update copyright years. 2021-04-14 04:32:20 +00:00
Jack Michaud
3c09664112 Feedback from @hdevalence - Added derive for Eq and Hash 2020-08-31 12:15:43 -07:00
Jack Michaud
48df927d7b Add PartialEq derive to PublicKey
Derives from the PartialEq impl for MontgomeryPoint
2020-08-30 17:41:54 -07:00
Henry de Valence
fb92cd82da Clarify Ephemeral/StaticSecret docs.
Also does a pass through the docs converting `TypeNames` to Rustdoc links, and
making sure that all the items have consistent summaries.

Closes #58
Closes $56
2020-08-17 19:25:12 -07:00
Henry de Valence
736f8dd313
Merge pull request #60 from dalek-cryptography/remove-rand-os-example
Remove rand os example
2020-08-17 19:22:21 -07:00
Henry de Valence
5d245dcefa
Merge pull request #43 from peat/master
Add .to_bytes() to PublicKey, SharedSecret
2020-08-17 18:55:18 -07:00
Henry de Valence
8287798aa1 Update doc examples to remove deprecated code and restore testing.
Closes #59.

The doc examples have code interspersed with text explaining the API.  Because
each doctest executes independently, when these code examples are run as
doctests, they have to include parts of the previous examples with # lines.
These lines are hidden from Rustdoc output and do not appear in the rendered
docs, but they do appear when viewing the README.md on Github.

In order to hide these on Github, the code blocks were made non-executable,
with their content moved to a unit test.  However, this meant that the example
API usage was not tested, and so when the unit test was updated to remove the
deprecated `rand_os`, there was no check that the examples stayed in sync with
the test, causing #59.  To prevent this from reocurring in the future, go back
to executable tests of the API examples.
2020-08-17 18:47:31 -07:00
Henry de Valence
5d91bd8f22 Make bound on csprng more general.
`rand_core` defines a blanket impl of `RngCore + CryptoRng` for `&mut T` where
`T: RngCore + CryptoRng`, so rather than requiring a borrowed RNG, it's better
to require an owned RNG, as this allows passing either owned or borrowed
values.  In particular, this makes `OsRng` usage much more ergonomic, because
the caller is not forced to do `&mut OsRng` on the zero-sized struct.
2020-08-17 18:44:48 -07:00
DebugSteven
be82bcb15b update rand_core version
Co-authored-by: Greg <gregory.mkv@gmail.com>
2019-11-26 14:28:34 -07:00
DebugSteven
de5d79388b use zeroize instead of clear_on_drop 2019-11-26 13:44:50 -07:00
DebugSteven
0c3981d87a support for serde serialize and deserialize 2019-11-11 10:46:28 -05:00
Peat Bakke
1d61e1ba46 Add .to_bytes() to PublicKey, so that it has similar capabilities to the ed25519 PublicKey impl. Also to SharedSecret for consistency. 2019-06-05 12:20:02 -07:00
Bodo Junglas
0f187b4670
Ensure that all data of StaticSecret is cleared on drop 2019-04-12 08:34:41 +02:00
Michael Rosenberg
935f6e8e35
Made StaticSecret cloneable 2019-03-22 12:50:55 -04:00
Isis Lovecruft
23e61b7063
Merge remote-tracking branch 'rozbb/master' into develop 2019-02-27 21:51:37 +00:00
Isis Lovecruft
60f276db72
Fix README examples and doctests. 2019-02-27 20:45:55 +00:00
Michael Rosenberg
2a58e35b23
PublicKey now derives Copy, Clone, Debug 2019-02-27 12:40:14 -05:00
Henry de Valence
aee783ae82
use clamp_scalar for StaticSecret
This ensures that the `StaticSecret`'s scalar always has the X25519 bit-twiddles applied.

Co-Authored-By: DebugSteven <debugsteven@gmail.com>
2019-02-16 16:31:05 -05:00
DebugSteven
6797c0969f summarize how types are used & how they relate to one another 2019-02-16 10:57:42 -07:00
DebugSteven
29edaa17ac informative doc comments 2019-02-16 10:22:06 -07:00
DebugSteven
ad670a4d03 methods to convert a StaticSecret to and from bytes 2019-02-16 09:42:56 -07:00
DebugSteven
4caffdcca0 impl StaticSecret & create DH method that borrows our StaticSecret 2019-02-16 09:14:43 -07:00
DebugSteven
9fe535dcc7 rename EphemeralPublic to PublicKey 2019-02-16 08:57:09 -07:00
Philippe Dugre
1d23a1d30d Added doc example for x25519() 2019-01-25 17:08:48 -05:00
Henry de Valence
1117184a02 Add EphemeralPublic::as_bytes 2019-01-22 14:11:44 -08:00
Henry de Valence
dd8b61da4a Add an X25519 basepoint constant 2019-01-15 21:44:56 -08:00
Isis Lovecruft
c9a1ef6a36
Credit @DebugSteven as an author. 2019-01-12 23:34:49 +00:00
DebugSteven
d3b7ccf030 byte-oriented x25519 function 2018-12-16 11:30:32 -07:00
DebugSteven
ff0e1f286b From<[u8; 32]> for Ephemeral Public, fix to benches 2018-12-07 17:51:08 -05:00
DebugSteven
8730bfbba6 move implementation of x25519 into diffie_hellman 2018-12-07 17:07:24 -05:00
DebugSteven
ccf7e5bb57 remove mul; remove derive default on SharedSecret; rename decode to clamp 2018-12-03 13:27:35 -05:00
DebugSteven
7f822ff3dd explicit lifetimes 2018-12-03 12:20:33 -05:00
DebugSteven
734abac70b wrap MontgomeryPoint in EphemeralPublic, impl From; remove byte fns for EphemeralSecret 2018-12-02 14:23:09 -05:00
DebugSteven
a599644406 remove pub from x25519 fn 2018-11-27 17:02:38 -05:00
DebugSteven
4c6498ec69 change impl Drop for SharedSecret to use clear directly 2018-11-18 15:19:58 -05:00