commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
47b8aaae699a4d3c461dbc2cbd604080cf47f244 | Tony Arcieri | 2023-01-05T20:37:02 | Bump `signature` to v2.0.0-rc.0 (#242) | diff --git a/Cargo.toml b/Cargo.toml
index 140df9d..ef72d38 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ subtle = { version = "2.1.1", default-features = false }
digest = { version = "0.10.5", default-features = false, features = ["alloc", "oid"] }
pkcs1 = { version = "0.4", default-features = false, fe... | 1 | 1 | 1 |
b39752d4d8cda0c8e387f9f54e2d73d1d1fe628b | Dmitry Baryshkov | 2022-12-05T02:03:38 | feat: switch to version 2.0 (pre) of the signature crate (#217)
Rework the crate to implement traits from the preview of the signature
crate. Use `Vec<u8>` as `Self::Repr` type.
Drop the hand-crafted `From` traits, replacing them with the
implementation of the `Keypair` trait.
Signed-off-by: Dmitry Baryshkov ... | diff --git a/Cargo.toml b/Cargo.toml
index 03ae3cb..f96aab2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.7.2"
+version = "0.8.0-pre"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2021"
description = "Pure Rust RSA implem... | 6 | 245 | 265 |
35f7ae2d97a19d663d0c8c477cedb79c571c3cf1 | Tony Arcieri | 2022-11-21T15:28:25 | Remove `minimal-versions` workaround (#228)
Now that https://github.com/dignifiedquire/num-bigint/pull/42 has landed
it is no longer needed. | diff --git a/Cargo.toml b/Cargo.toml
index c834110..03ae3cb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ readme = "README.md"
rust-version = "1.57"
[dependencies]
-num-bigint = { version = "0.8.1", features = ["i128", "u64_digit", "prime", "zeroize"], default-features = false, package = "num-bigint-di... | 1 | 1 | 4 |
d0a755a35473efb8024d27d3db8dc25c785f65d3 | Tony Arcieri | 2022-11-14T03:25:44 | Re-export `signature` crate (#223)
It's needed to use the `SigningKey`/`VerifyingKey` types in the
`pkcs1v15` and `pss` modules.
Also updates the code examples to use the re-export. | diff --git a/src/lib.rs b/src/lib.rs
index 94c77bb..3089274 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -59,8 +59,8 @@
//! ```
//! use rsa::RsaPrivateKey;
//! use rsa::pkcs1v15::{SigningKey, VerifyingKey};
+//! use rsa::signature::{RandomizedSigner, Signature, Verifier};
//! use sha2::{Digest, Sha256};
-//! use sig... | 1 | 3 | 2 |
6800df5b371d6eba40bda8cfdbab3dd36c6f73ce | Tony Arcieri | 2022-11-13T01:43:30 | Linkify code examples in rustdoc (#222)
Makes each code example a linkable section of the rustdoc.
Uses these links to link from individual modules to code examples in the
toplevel rustdoc. | diff --git a/src/lib.rs b/src/lib.rs
index 039987a..94c77bb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,7 +11,7 @@
//!
//! # Usage
//!
-//! Using PKCS#1 v1.5.
+//! ## PKCS#1 v1.5 encryption
//! ```
//! use rsa::{PublicKey, RsaPrivateKey, RsaPublicKey, PaddingScheme};
//!
@@ -33,7 +33,7 @@
//! assert_eq!(&dat... | 3 | 12 | 4 |
b06a5ce30061f922975275de6d9b240336b139be | BrettMayson | 2022-11-11T14:46:06 | Add public accessor methods for `PrecomputedValues` (#221) | diff --git a/src/key.rs b/src/key.rs
index 6c0f1f9..86120dd 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -382,6 +382,21 @@ impl RsaPrivateKey {
self.precomputed = None;
}
+ /// Returns the precomputed dp value, D mod (P-1)
+ pub fn dp(&self) -> Option<&BigUint> {
+ self.precomputed.as_ref().... | 1 | 15 | 0 |
eeb18ee88d794a232325b489bb830de227738c9e | Tony Arcieri | 2022-10-31T20:15:52 | Add missing rustdoc comments; enable `missing_docs` lint (#216)
Several types and methods were missing documentation.
This commit adds document and enables warnings for `missing_docs`.
Additionally it updates all references to PKCS#1 RFCs to use RFC8017,
which documents the latest version of PKCS#1. | diff --git a/src/algorithms.rs b/src/algorithms.rs
index f14263c..bd252e3 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -1,4 +1,5 @@
-use alloc::vec;
+//! Useful algorithms related to RSA.
+
use digest::{Digest, DynDigest, FixedOutputReset};
use num_bigint::traits::ModInverse;
use num_bigint::{BigUint, R... | 8 | 201 | 66 |
a857c8f785032c153ab81b9289b0f96eec9ae76f | Guillaume Desmottes | 2022-10-24T19:27:35 | padding: ensure PaddingScheme is Send and Sync (#215)
It's more convenient for users.
Fix #214 | diff --git a/src/key.rs b/src/key.rs
index b43434d..12e60a7 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -930,7 +930,9 @@ mod tests {
}
}
- fn do_test_encrypt_decrypt_oaep<D: 'static + Digest + DynDigest>(prk: &RsaPrivateKey) {
+ fn do_test_encrypt_decrypt_oaep<D: 'static + Digest + DynDigest + Sen... | 2 | 18 | 14 |
ece83cbdadfd4b631fdce9bb56e592cde43ffd16 | Dmitry Baryshkov | 2022-10-08T20:38:43 | feat: add support for EncodePrivateKey (#208)
Implement encoding Signing keys to PKCS#8 DER format.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | diff --git a/src/pkcs1v15.rs b/src/pkcs1v15.rs
index dc9a94d..5fb377e 100644
--- a/src/pkcs1v15.rs
+++ b/src/pkcs1v15.rs
@@ -4,7 +4,7 @@ use core::fmt::{Debug, Display, Formatter, LowerHex, UpperHex};
use core::marker::PhantomData;
use core::ops::Deref;
use digest::Digest;
-use pkcs8::{AssociatedOid, Document, Encod... | 2 | 29 | 2 |
8a1026b379d3baafdd28fc4f763995463fb813a7 | Tony Arcieri | 2022-10-08T19:02:14 | Add `RsaPublicKey::new_unchecked` (#206)
Constructor for `RsaPublicKey` which bypasses all checks around the
modulus and public exponent size. | diff --git a/src/key.rs b/src/key.rs
index ab3351c..b43434d 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -250,10 +250,20 @@ impl RsaPublicKey {
/// Create a new public key from its components.
pub fn new_with_max_size(n: BigUint, e: BigUint, max_size: usize) -> Result<Self> {
- let k = RsaPublicKey { ... | 1 | 11 | 1 |
9066931701c8dcd8807508ef1e06a12a7e50c5d2 | Dmitry Baryshkov | 2022-10-08T19:01:19 | RSA: implement EncodePublicKey for VerifyingKeys (#207)
Implement key -> der conversion for public keys.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | diff --git a/src/pkcs1v15.rs b/src/pkcs1v15.rs
index a1cad1d..dc9a94d 100644
--- a/src/pkcs1v15.rs
+++ b/src/pkcs1v15.rs
@@ -4,7 +4,7 @@ use core::fmt::{Debug, Display, Formatter, LowerHex, UpperHex};
use core::marker::PhantomData;
use core::ops::Deref;
use digest::Digest;
-use pkcs8::AssociatedOid;
+use pkcs8::{Ass... | 2 | 20 | 1 |
2cac57a360bc4e5e89461b9b5cd97afdb037a9ae | Dmitry Baryshkov | 2022-10-06T17:31:12 | feat: implement hazmat signature traits for PSS keys (#202)
Implement PrehashSigner and PrehashVerifier traits for PSS
key structures.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | diff --git a/Cargo.toml b/Cargo.toml
index 9991c68..41c7855 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,7 @@ subtle = { version = "2.1.1", default-features = false }
digest = { version = "0.10.5", default-features = false, features = ["alloc", "oid"] }
pkcs1 = { version = "0.4", default-features = false, fe... | 2 | 120 | 1 |
7caba62e9bb484fb89d766a22c39c793e6658ea3 | Dirk Stolle | 2022-10-05T23:52:57 | chore: fix some typos (#196) | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 5e5738d..f14263c 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -65,7 +65,7 @@ pub fn generate_multi_prime_key_with_exp<R: RngCore + CryptoRng>(
let mut pi = prime_limit / (prime_limit.ln() - 1f64);
// Generated primes start with 0b11... | 2 | 2 | 2 |
bfd17e2ec695eb96d44b9b41b4e7a167f2673667 | Tony Arcieri | 2022-10-05T23:18:05 | v0.7.0-rc.1 (#204) | diff --git a/Cargo.toml b/Cargo.toml
index 93a5415..9991c68 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.7.0-rc.0"
+version = "0.7.0-rc.1"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2021"
description = "Pure Rust RSA ... | 1 | 1 | 1 |
cfc27dc85c8e69450ad9c49e964646dc7621328f | Tony Arcieri | 2022-10-05T22:57:59 | Fix `signature` version requirement (#203)
The crate is now using the `PrehashSigner`/`PrehashVerifier` traits,
which were added in `signature` v1.6.1.
However, that release was also yanked, so this commit pins to 1.6.2. | diff --git a/Cargo.toml b/Cargo.toml
index 5dcd885..93a5415 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,8 +23,7 @@ subtle = { version = "2.1.1", default-features = false }
digest = { version = "0.10.5", default-features = false, features = ["alloc", "oid"] }
pkcs1 = { version = "0.4", default-features = false, fe... | 1 | 1 | 2 |
c880e5fed882c05d2cee0e7984ba4704bfdddf2d | Nathaniel McCallum | 2022-09-27T21:42:36 | feat: enable extracting the inner key type (#201)
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com>
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com> | diff --git a/src/pkcs1v15.rs b/src/pkcs1v15.rs
index b4e813a..3ac0364 100644
--- a/src/pkcs1v15.rs
+++ b/src/pkcs1v15.rs
@@ -345,6 +345,15 @@ where
}
}
+impl<D> From<SigningKey<D>> for RsaPrivateKey
+where
+ D: Digest,
+{
+ fn from(key: SigningKey<D>) -> Self {
+ key.inner
+ }
+}
+
impl<D> Sign... | 2 | 45 | 0 |
6083c913f7aafa123b2228f22f08e3d0d6ed1ebe | Nathaniel McCallum | 2022-09-27T14:29:46 | feat: derive(Debug, Copy) for pss::BlindedSigningKey (#200)
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com> | diff --git a/src/pss.rs b/src/pss.rs
index 66e8d4c..7c8c2b6 100644
--- a/src/pss.rs
+++ b/src/pss.rs
@@ -607,6 +607,7 @@ where
}
}
+#[derive(Debug, Clone)]
pub struct BlindedSigningKey<D>
where
D: Digest, | 1 | 1 | 0 |
165f06f9cd5ab91722f0c6349d81423ea1b66097 | Dmitry Baryshkov | 2022-09-22T16:03:46 | feat: iplement hazmat signature traits for PKCS1v15 keys (#195)
Implement PrehashSigner and PrehashVerifier traits for PKCS1v15
structures.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | diff --git a/Cargo.toml b/Cargo.toml
index 2723fbf..5dcd885 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -54,6 +54,7 @@ name = "key"
[features]
default = ["std", "pem"]
+hazmat = ["signature/hazmat-preview"]
nightly = ["num-bigint/nightly"]
serde = ["num-bigint/serde", "serde_crate"]
expose-internals = []
diff --... | 2 | 30 | 10 |
a760b51b1ea79f5f94b158fb962592d70a6585c5 | Nathaniel McCallum | 2022-09-21T22:43:04 | feat: impl From for Signing/Verifying keys (#193)
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com> | diff --git a/src/pkcs1v15.rs b/src/pkcs1v15.rs
index ac19c0c..4f0db83 100644
--- a/src/pkcs1v15.rs
+++ b/src/pkcs1v15.rs
@@ -334,6 +334,15 @@ where
}
}
+impl<D> From<RsaPrivateKey> for SigningKey<D>
+where
+ D: Digest,
+{
+ fn from(key: RsaPrivateKey) -> Self {
+ Self::new(key)
+ }
+}
+
impl<D>... | 2 | 45 | 0 |
0332c659df9c6e794f692e9432cac961dfdda3aa | Nathaniel McCallum | 2022-09-21T22:42:29 | feat: impl AsRef for Signing/Verifying keys (#194)
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com> | diff --git a/src/pkcs1v15.rs b/src/pkcs1v15.rs
index caffd14..ac19c0c 100644
--- a/src/pkcs1v15.rs
+++ b/src/pkcs1v15.rs
@@ -347,6 +347,15 @@ where
}
}
+impl<D> AsRef<RsaPrivateKey> for SigningKey<D>
+where
+ D: Digest,
+{
+ fn as_ref(&self) -> &RsaPrivateKey {
+ &self.inner
+ }
+}
+
impl<D> Si... | 2 | 45 | 0 |
c2a57c640dfe9e600cc7d667f9bb70ba6ffb99b5 | Nathaniel McCallum | 2022-09-21T21:06:18 | chore: resolve numerous clippy lints
Signed-off-by: Nathaniel McCallum <nathaniel@profian.com> | diff --git a/src/internals.rs b/src/internals.rs
index 46b45ac..fc19516 100644
--- a/src/internals.rs
+++ b/src/internals.rs
@@ -98,7 +98,7 @@ pub fn decrypt<R: RngCore + CryptoRng>(
match ir {
Some(ref ir) => {
// unblind
- Ok(unblind(priv_key, &m, &ir))
+ Ok(unblind(pr... | 4 | 19 | 25 |
29ff2877528b27ed3f2de2b1ce1c4a27f958de6a | Xynnn_ | 2022-09-19T15:17:56 | feat: derive `Clone` and `Debug` for `SigningKey`/`VerifyingKey` (#191)
- added Clone and Debug for SigningKey & VerifyingKey
of pss and pkcs1v15
Signed-off-by: Xynnn007 <mading.ma@alibaba-inc.com> | diff --git a/src/pkcs1v15.rs b/src/pkcs1v15.rs
index b5ec29d..9a5ba16 100644
--- a/src/pkcs1v15.rs
+++ b/src/pkcs1v15.rs
@@ -303,6 +303,7 @@ fn non_zero_random_bytes<R: RngCore + CryptoRng>(rng: &mut R, data: &mut [u8]) {
}
}
+#[derive(Debug, Clone)]
pub struct SigningKey<D>
where
D: Digest,
@@ -403,6 +4... | 2 | 4 | 0 |
18da70ae576627ac59f9803cedb11c4fd2c8f5b9 | Tony Arcieri | 2022-09-16T17:46:43 | v0.7.0-rc.0 (#188) | diff --git a/Cargo.toml b/Cargo.toml
index 0558bfa..2723fbf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.7.0-pre"
+version = "0.7.0-rc.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2021"
description = "Pure Rust RSA i... | 1 | 2 | 2 |
88be36bef40851ecb72f0ba6ac8d015b0d8550df | Dmitry Baryshkov | 2022-09-16T17:25:33 | Drop reference boilerplate code (#185)
Drop boilerplate code which implements traits for references to key
types. The code can use references directly.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | diff --git a/src/internals.rs b/src/internals.rs
index 3178b63..46b45ac 100644
--- a/src/internals.rs
+++ b/src/internals.rs
@@ -168,7 +168,7 @@ pub fn blind<R: RngCore + CryptoRng, K: PublicKeyParts>(
}
/// Given an m and and unblinding factor, unblind the m.
-pub fn unblind(key: impl PublicKeyParts, m: &BigUint, ... | 3 | 1 | 57 |
92ef4c823b3ff389f2c3b77012f233ff5e0c0d16 | Dmitry Baryshkov | 2022-09-16T17:25:05 | pkcs1v15: use `AssociatedOid` for getting the RSA prefix (#183)
Drop internal implementation of `AssociatedHash` and use `AssociatedOid`
trait from `const_oid` to get the OID corresponding to the `Digest` and to
format the ASN.1 prefix.
Also removes the previous `Hash` enum as it was used for looking up OIDs.
... | diff --git a/Cargo.toml b/Cargo.toml
index a9397ab..0558bfa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ num-iter = { version = "0.1.37", default-features = false }
rand_core = { version = "0.6", default-features = false }
byteorder = { version = "1.3.1", default-features = false }
subtle = { version =... | 6 | 190 | 266 |
36df97adede3bb1c45999911db4018a2ba9982f2 | Dmitry Baryshkov | 2022-09-12T16:43:13 | Allow dereferencing Signature types (#182)
Implement Deref<Target = [u8]> for the Signature types to allow
automatically dereferencing Signature as byte slices.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | diff --git a/src/pkcs1v15.rs b/src/pkcs1v15.rs
index a5c9775..fb60aac 100644
--- a/src/pkcs1v15.rs
+++ b/src/pkcs1v15.rs
@@ -2,6 +2,7 @@ use alloc::vec;
use alloc::vec::Vec;
use core::fmt::{Debug, Display, Formatter, LowerHex, UpperHex};
use core::marker::PhantomData;
+use core::ops::Deref;
use digest::Digest;
use... | 2 | 18 | 0 |
98f50fd6a1ef7c4e2a1271370123a0b69308fe40 | Dmitry Baryshkov | 2022-09-10T19:56:06 | Drop unused Hash usage from doc-tests (#184)
Remove a leftover use rsa::Hash part from the crate's doc-tests.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> | diff --git a/src/lib.rs b/src/lib.rs
index 029849a..4d2c776 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -52,7 +52,7 @@
doc = r#"
Using PKCS1v15 signatures
```
-use rsa::{Hash, RsaPrivateKey};
+use rsa::RsaPrivateKey;
use rsa::pkcs1v15::{SigningKey, VerifyingKey};
use sha2::{Digest, Sha256};
use signature::{Ra... | 1 | 2 | 2 |
d68e2731dcc0c9d4043281b2629fc3535523f9bf | Dmitry Baryshkov | 2022-09-07T17:47:03 | Update RSA signature traits implementations (#179)
- Change the `SigningKey` and `VerifiyingKey` implementations accept raw
message rather than pre-hashed message.
- Implement the experimental (preview) `DigestSigner` and `DigestVerifier`
traits for the PKCS1v15 structs.
- Implement the experimental (preview) ... | diff --git a/Cargo.toml b/Cargo.toml
index cdf3337..a9397ab 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,12 +24,17 @@ digest = { version = "0.10.0", default-features = false, features = ["alloc"] }
pkcs1 = { version = "0.4", default-features = false, features = ["pkcs8", "alloc"] }
pkcs8 = { version = "0.9", defau... | 6 | 781 | 158 |
2ffd3aef61985d6a6cee231694c583a8f82654dc | Dmitry Baryshkov | 2022-08-29T18:57:29 | PaddingScheme: remove rng from PSS padding scheme (#172) (#173)
The passed rng is not necessary for PSS signature verification. Instead
of passing artificial unused RNG through the PaddingScheme, add new
sign_with_rng() API and pass rng directly. In the sign_blinded() use the
passed rng both for salt generation and... | diff --git a/src/key.rs b/src/key.rs
index 248f2f8..3d65d5c 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -512,18 +512,24 @@ impl RsaPrivateKey {
PaddingScheme::PKCS1v15Sign { ref hash } => {
pkcs1v15::sign::<DummyRng, _>(None, self, hash.as_ref(), digest_in)
}
+ _ =>... | 3 | 43 | 55 |
40242fbbb019cac4af216145bfa468a0d24d12ef | Dmitry Baryshkov | 2022-08-19T17:46:40 | Implement Signer/Verifier/Signature interfaces for the RSA signatures (#174)
Refactor the `rsa` crate to use the API defined by the signature crate.
This adds `pss` and `pkcs1v15` modules, each of them providing
`Signature`, `Verifier` and `Signer`/`RandomizedSigner` implementations.
Add tests for pkcs1v15 and ... | diff --git a/Cargo.toml b/Cargo.toml
index d740dbe..cdf3337 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,8 @@ subtle = { version = "2.1.1", default-features = false }
digest = { version = "0.10.0", default-features = false, features = ["alloc"] }
pkcs1 = { version = "0.4", default-features = false, features ... | 7 | 731 | 56 |
e7f48101a4440963c6c4d6cd88804ded045da1b7 | Tony Arcieri | 2022-08-09T14:24:01 | Add `RsaPublicKey::new_with_max_size`; 4096-bit default max (#176)
This constructor accepts a configurable maximum key size which can be
used in applications that need to deal with unusually large RSA public
keys, such as OpenPGP.
With the ability to configure an upper limit, this makes it possible to
lower the ... | diff --git a/src/errors.rs b/src/errors.rs
index ead6be1..666ada0 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -1,7 +1,7 @@
pub type Result<T> = core::result::Result<T, Error>;
/// Error types
-#[derive(Debug)]
+#[derive(Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum Error {
InvalidPaddingScheme,
dif... | 2 | 105 | 15 |
8d3fe537113f0e1240c3d77d62dbcc3b0a2b9a02 | Tony Arcieri | 2022-08-07T21:47:12 | `check_public` improvements (#170)
- Ensure modulus is 16384-bits or fewer. See #166
- Increase maximum public exponent. Closes #155 | diff --git a/src/errors.rs b/src/errors.rs
index 2752f4c..ead6be1 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -15,6 +15,7 @@ pub enum Error {
InvalidModulus,
InvalidExponent,
InvalidCoefficient,
+ ModulusTooLarge,
PublicExponentTooSmall,
PublicExponentTooLarge,
Pkcs1(pkcs1::Error)... | 2 | 12 | 5 |
4ccdcf92a956d407c0266522ddc3116e30ddb851 | Tony Arcieri | 2022-07-25T12:35:47 | Make `RsaPrivateKey::from_components` fallible (#167)
Adds an error case in the event the number of `primes` provides is fewer
than 2, which prevents panics when invoking methods which expect primes
to always be present at indices 0 and 1 (i.e. `p` and `q`)
Fixes #163 | diff --git a/Cargo.toml b/Cargo.toml
index c395c2e..d740dbe 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -63,3 +63,6 @@ getrandom = ["rand_core/getrandom"]
[package.metadata.docs.rs]
features = ["std", "pem", "serde", "expose-internals"]
rustdoc-args = ["--cfg", "docsrs"]
+
+[profile.dev]
+opt-level = 2
diff --git a/... | 6 | 20 | 14 |
b626d48a4f4f5246a5224762d118ff607e3ac248 | Tony Arcieri | 2022-05-24T03:29:10 | v0.7.0-pre (#164) | diff --git a/Cargo.toml b/Cargo.toml
index 986367a..c395c2e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.6.1"
+version = "0.7.0-pre"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2021"
description = "Pure Rust RSA implem... | 1 | 1 | 1 |
4b8fa4fb679fbf83a4ef0c19e62ef5d5b7b47715 | Tony Arcieri | 2022-04-11T13:43:19 | chore(rsa): release 0.6.1 | diff --git a/Cargo.toml b/Cargo.toml
index 3f6c52a..8a6cb7d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.6.0"
+version = "0.6.1"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2021"
description = "Pure Rust RSA implementa... | 1 | 1 | 1 |
c6dbce663492e3f570650ea4e75d3c664f0390fc | Tony Arcieri | 2022-04-11T06:20:37 | Add `RsaPrivateKey::crt_coefficient` (#158)
This method is useful for key serialization formats and is internally
useful within the context of the PKCS#1/PKCS#8 implementations.
Externally I'm working on adding support to the `ssh-key` crate. I could
implement this same thing by pulling in `num_bigint_dig::ModInv... | diff --git a/src/encoding.rs b/src/encoding.rs
index b13b985..81d311e 100644
--- a/src/encoding.rs
+++ b/src/encoding.rs
@@ -5,7 +5,6 @@
use crate::{key::PublicKeyParts, BigUint, RsaPrivateKey, RsaPublicKey};
use core::convert::{TryFrom, TryInto};
-use num_bigint::ModInverse;
use pkcs8::{
DecodePrivateKey, De... | 2 | 7 | 5 |
cc3c9e00401e820e004dfe3ac6fb1e3a170c2540 | dignifiedquire | 2022-04-08T14:24:49 | chore(rsa): release 0.6.0 | diff --git a/Cargo.toml b/Cargo.toml
index 29bac0e..3f6c52a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.6.0-pre"
+version = "0.6.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2021"
description = "Pure Rust RSA implem... | 1 | 1 | 1 |
bc44abf96e2dba99308501e114e483bb7414040b | Artyom Pavlov | 2022-03-22T14:38:12 | Address RUSTSEC-2021-0003 by bumping smallvec to 1.6.1 (#156) | diff --git a/Cargo.toml b/Cargo.toml
index 3baa552..29bac0e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,7 @@ pkcs8 = { version = "0.8", default-features = false, features = ["alloc"] }
zeroize = { version = "1", features = ["alloc"] }
# Temporary workaround until https://github.com/dignifiedquire/num-bigi... | 1 | 1 | 1 |
fb6016575a9fb377f3551b7187fad1e5a836e2b1 | Addison Crump | 2022-03-15T21:20:20 | zeroize plaintexts which are about to be encrypted (#154) | diff --git a/src/oaep.rs b/src/oaep.rs
index e330280..ee25b0a 100644
--- a/src/oaep.rs
+++ b/src/oaep.rs
@@ -5,6 +5,7 @@ use rand_core::{CryptoRng, RngCore};
use digest::DynDigest;
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
+use zeroize::Zeroizing;
use crate::algorithms::mgf1_xor;
... | 2 | 4 | 2 |
bbfd91120765ec8151627cd1858df74a03de24c9 | Artyom Pavlov | 2022-03-14T14:22:48 | Remove nondeterministic tests (#152) | diff --git a/Cargo.toml b/Cargo.toml
index 91ad679..3baa552 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -42,7 +42,7 @@ serde_test = "1.0.89"
rand_xorshift = "0.3"
rand_chacha = "0.3"
rand = "0.8"
-rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }
+rand_core = { version = "0.6", defa... | 5 | 13 | 13 |
56c02cfd24de3e9f2d4bb58b47be2374a06b4558 | Tony Arcieri | 2022-03-10T20:27:39 | v0.6.0-pre (#147) | diff --git a/Cargo.toml b/Cargo.toml
index 7209e3a..379d80d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.5.0"
+version = "0.6.0-pre"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2021"
description = "Pure Rust RSA implem... | 1 | 1 | 1 |
7395997c40b0f2c0bdb362b2998cbf9250408276 | Tony Arcieri | 2022-02-02T12:49:01 | Impl `zeroize` without using `zeroize_derive` (#143)
The `zeroize_derive` crate has quite a few dependencies, and in
particular `syn` is a fairly large one with not-insignificant compile
times.
Together with dignifiedquire/num-bigint#35, this will remove the
following dependencies from the dependency tree:
- ... | diff --git a/Cargo.toml b/Cargo.toml
index 666ac48..d245110 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,10 +22,7 @@ subtle = { version = "2.1.1", default-features = false }
digest = { version = "0.10.0", default-features = false }
pkcs1 = { version = "0.3.3", default-features = false, features = ["pkcs8"] }
pkcs... | 2 | 10 | 5 |
2d68db2e0fddbccb23a9fdcec26f4a23f6d844e4 | Trevor Arjeski | 2022-01-05T22:00:23 | feat(key): add fn to clear precomputed values on RsaPrivateKey | diff --git a/src/key.rs b/src/key.rs
index aab486d..52612cc 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -358,6 +358,11 @@ impl RsaPrivateKey {
Ok(())
}
+ /// Clears precomputed values by setting to None
+ pub fn clear_precomputed(&mut self) {
+ self.precomputed = None;
+ }
+
/// Ret... | 1 | 5 | 0 |
024a61b6edcf38dc8556d90f10760270d69339aa | Poliorcetics | 2022-01-05T21:59:20 | chore(deps): Update crypto crates
Co-authored-by: Alexis Bourget <alexis@harfanglab.fr> | diff --git a/Cargo.toml b/Cargo.toml
index 23a4b71..eb77e10 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ num-iter = { version = "0.1.37", default-features = false }
rand = { version = "0.8.0", features = ["std_rng"], default-features = false }
byteorder = { version = "1.3.1", default-features = false }
... | 1 | 4 | 4 |
1ad5f1c4df87d91b32c53de191bc21fdec9f4d1b | Expyron | 2021-12-07T00:08:36 | refactor: remove `lazy_static` dependency | diff --git a/Cargo.toml b/Cargo.toml
index 186dcb9..23a4b71 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,6 @@ num-bigint = { version = "0.7.0", features = ["i128", "u64_digit", "prime", "zer
num-traits = { version= "0.2.9", default-features = false, features = ["libm"] }
num-integer = { version = "0.1.39", d... | 2 | 7 | 9 |
fd1961dfe256d47a7ec783fdbb63e7ceacbc3265 | Luca Cominardi | 2021-09-30T12:26:22 | feat: derive Hash for `RsaPublicKey` | diff --git a/src/key.rs b/src/key.rs
index 74f607a..2a2dc5b 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -39,7 +39,7 @@ pub trait PublicKeyParts {
pub trait PrivateKey: DecryptionPrimitive + PublicKeyParts {}
/// Represents the public part of an RSA key.
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone... | 1 | 1 | 1 |
a1c1f2b8f0e6b95ccf130021d2d02fa9f8530357 | dignifiedquire | 2021-07-27T06:47:48 | chore(rsa): release 0.5.0 | diff --git a/Cargo.toml b/Cargo.toml
index e9435dc..186dcb9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.4.1"
+version = "0.5.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA implementa... | 1 | 1 | 1 |
dc103e1453b5c118b2434c94e3ee882862327c41 | dignifiedquire | 2021-07-26T20:45:43 | chore(rsa): release 0.4.1 | diff --git a/Cargo.toml b/Cargo.toml
index 3f0c308..04de051 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.4.0"
+version = "0.4.1"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA implementa... | 1 | 1 | 1 |
e4027b1b2b63cd6be69a7b6cd06adfb1e8cea892 | Tony Arcieri | 2021-07-26T00:31:48 | rustfmt (#107)
Applies `rustfmt` (again) with the following version:
rustfmt 1.4.37-stable (2a3635d5 2021-05-04) | diff --git a/src/key.rs b/src/key.rs
index 5309d86..e9380db 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -192,9 +192,11 @@ impl PublicKey for RSAPublicKey {
fn encrypt<R: Rng>(&self, rng: &mut R, padding: PaddingScheme, msg: &[u8]) -> Result<Vec<u8>> {
match padding {
PaddingScheme::PKCS1v15En... | 1 | 53 | 20 |
5d608e0de946019bce1c85c98e639cc016c3c2cd | Clenimar Souza | 2021-07-25T23:26:18 | add NULL parameter to AlgorithmIdentifier of encoded keys (#92)
as per the RFC 8017 [1], the NULL parameter MUST be present if the OID in
AlgorithmIdentifier is `rsaEncryption`. this commit adds an explicit
NULL to the AlgorithmIdentifier so that RSA key encoded by this crate
are compliant to the RFC:
> The obje... | diff --git a/src/encode.rs b/src/encode.rs
index 44ddf99..ebc942d 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -299,7 +299,7 @@ impl PrivateKeyEncoding for RSAPrivateKey {
fn to_pkcs8(&self) -> Result<Vec<u8>> {
let version = ASN1Block::Integer(0, to_bigint(&BigUint::zero()));
let oid = ASN1... | 1 | 6 | 6 |
9c75e90372547f1fa20e7430970c5c4715f75110 | Patrick Amrein | 2021-07-25T23:19:34 | Add possibility to allow a different hash function for MGF mask function (#101)
* add possibility to specify different mgf1 hash
* add documentation
* fix some typos
improve wording
* remove old line | diff --git a/src/key.rs b/src/key.rs
index dd1fa7f..5309d86 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -192,8 +192,8 @@ impl PublicKey for RSAPublicKey {
fn encrypt<R: Rng>(&self, rng: &mut R, padding: PaddingScheme, msg: &[u8]) -> Result<Vec<u8>> {
match padding {
PaddingScheme::PKCS1v15Enc... | 3 | 144 | 14 |
130ab2d165acb9f49243b4b9043b1f87358cd0ce | Tony Arcieri | 2021-07-25T23:17:30 | Remove `extern crate` directives (#106)
These are no longer needed as of the 2018 edition | diff --git a/src/key.rs b/src/key.rs
index b51693b..dd1fa7f 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -1,5 +1,6 @@
use alloc::vec::Vec;
use core::ops::Deref;
+use lazy_static::lazy_static;
use num_bigint::traits::ModInverse;
use num_bigint::Sign::Plus;
use num_bigint::{BigInt, BigUint};
diff --git a/src/lib.rs b... | 3 | 2 | 14 |
89a527c05f9b07e9de664a0a937717bd20351ae6 | Tony Arcieri | 2021-07-25T21:14:18 | rustfmt (#105)
Applies `rustfmt` with the following version:
rustfmt 1.4.37-stable (2a3635d5 2021-05-04) | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 66ac504..a9669a8 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -1,11 +1,11 @@
+use alloc::vec;
use digest::DynDigest;
use num_bigint::traits::ModInverse;
use num_bigint::{BigUint, RandPrime};
-use num_traits::{FromPrimitive, One, Zero};
#[allow(un... | 11 | 71 | 46 |
2ea84ba54b26c5e52a6e70d722e835131c9d6095 | Tony Arcieri | 2021-07-19T19:55:29 | Lock `zeroize` to v1.3
1.4 requires MSRV 1.51 | diff --git a/Cargo.toml b/Cargo.toml
index 55c29c7..3f0c308 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,7 +25,7 @@ pem = { version = "0.8", optional = true }
digest = { version = "0.9.0", default-features = false }
[dependencies.zeroize]
-version = "1.1.0"
+version = "=1.3" # zeroize 1.4 is MSRV 1.51+
features... | 1 | 1 | 1 |
c047ce9b3bb85eb25612c62a625e4e61b0cde3bf | dignifiedquire | 2021-03-28T17:40:33 | chore(rsa): release 0.4.0 | diff --git a/Cargo.toml b/Cargo.toml
index 23873b5..55c29c7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.3.0"
+version = "0.4.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA implementa... | 1 | 2 | 2 |
5d3a76c429a19658cf78280539a25e5b12eda200 | littledivy | 2021-03-22T04:45:28 | chores: upgrade to rand-0.8 | diff --git a/Cargo.toml b/Cargo.toml
index a2f492c..23873b5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,12 +12,12 @@ categories = ["cryptography"]
readme = "README.md"
[dependencies]
-num-bigint = { version = "0.6.1", features = ["i128", "u64_digit", "prime", "zeroize"], default-features = false, package = "num... | 2 | 4 | 4 |
55e6cc047113ba6e5d3348974a28786695c18f52 | dignifiedquire | 2020-12-02T16:48:19 | fix: bump num-bigint to fix nightly compiles | diff --git a/Cargo.toml b/Cargo.toml
index f210b84..a2f492c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ categories = ["cryptography"]
readme = "README.md"
[dependencies]
-num-bigint = { version = "0.6", features = ["i128", "u64_digit", "prime", "zeroize"], default-features = false, package = "num-big... | 1 | 1 | 1 |
cf044126a061c9b5fbb8b8b69e9e1175ca55e0d3 | dignifiedquire | 2020-12-02T16:13:28 | feat: remove deprecated serde1 feature | diff --git a/Cargo.toml b/Cargo.toml
index d501515..f210b84 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -58,7 +58,6 @@ name = "key"
default = ["std", "pem"]
nightly = ["subtle/nightly", "num-bigint/nightly"]
serde = ["num-bigint/serde", "serde_crate"]
-serde1 = ["serde"] # deprecated
expose-internals = []
std = ["... | 1 | 0 | 1 |
1d8ff05d608a6f9857de77be657d97005e821eb6 | Glitch | 2020-12-02T13:04:30 | feat: improve OpenSSL compatibility for encoding and decoding keys | diff --git a/src/encode.rs b/src/encode.rs
index b53cfd0..0658e28 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -4,18 +4,22 @@ use crate::{
parse::rsa_oid,
PublicKey, RSAPrivateKey, RSAPublicKey,
};
-use num_bigint::{BigUint, ToBigInt};
+use num_bigint::{BigUint, ToBigInt, ModInverse};
use num_traits::Z... | 1 | 42 | 10 |
4274e838d112a0aa194a2102ed4930fd9797f1eb | Austin Abell | 2020-07-29T10:41:53 | feat: add encoding of keys to PEM | diff --git a/src/encode.rs b/src/encode.rs
new file mode 100644
index 0000000..d2723e6
--- /dev/null
+++ b/src/encode.rs
@@ -0,0 +1,425 @@
+use crate::{
+ errors::{Error, Result},
+ key::PublicKeyParts,
+ parse::rsa_oid,
+ PublicKey, RSAPrivateKey, RSAPublicKey,
+};
+use num_bigint::{BigUint, ToBigInt};
+us... | 5 | 441 | 7 |
a649ce16e0c32968ae086aa1c4fc9ac3db41e914 | Jakub Konka | 2020-07-29T10:33:45 | feat: allow for custom public exponent value in keygen
This commit adds a function to `rsa::algorithms` called
`generate_multi_prime_key_with_exp` which allows the caller
to specify a custom value for the public key exponent.
This commit also adds a convenience routine to `rsa::RSAPrivateKey`
called `new_with_ex... | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 02b4d84..76c8c12 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -10,21 +10,46 @@ use crate::key::RSAPrivateKey;
/// Default exponent for RSA keys.
const EXP: u64 = 65537;
-// Generates a multi-prime RSA keypair of the given bit
-// size and the giv... | 2 | 50 | 14 |
02689d1b283473a0b5e8f94fa61a1bf048e78f8c | dignifiedquire | 2020-06-11T12:13:09 | chore(rsa): release 0.3.0 | diff --git a/Cargo.toml b/Cargo.toml
index 6ad34e8..24e95dc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.2.0"
+version = "0.3.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA implementa... | 1 | 1 | 1 |
a2bafc05a863031ebf7b2290645cbeb3f276b430 | dignifiedquire | 2020-06-11T11:37:34 | apply CR for pss implementation | diff --git a/src/pss.rs b/src/pss.rs
index 4487e40..76bbcc9 100644
--- a/src/pss.rs
+++ b/src/pss.rs
@@ -57,19 +57,17 @@ fn sign_pss_with_salt<T: Rng, SK: PrivateKey>(
digest: &mut dyn DynDigest,
) -> Result<Vec<u8>> {
let em_bits = priv_key.n().bits() - 1;
- let mut em = vec![0; (em_bits + 7) / 8];
- ... | 1 | 11 | 18 |
f3e99b434d30dd65fd94d085db32b4136b6b515a | dignifiedquire | 2020-06-11T11:24:03 | feat: update dependencies to rustcrypto 0.9 releases | diff --git a/Cargo.toml b/Cargo.toml
index fb30556..6ad34e8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,9 +22,9 @@ byteorder = "1.3.1"
thiserror = "1.0.11"
subtle = "2.0.0"
simple_asn1 = "0.4"
-pem = { version = "0.7", optional = true }
-digest = { version = "0.8.0", features = ["std"] }
-sha2 = "0.8.0"
+pem = {... | 4 | 21 | 21 |
84bfd0d9eb5e36285cdec18beaea08298297a419 | dignifiedquire | 2020-06-11T11:20:51 | fix benchmarks | diff --git a/benches/key.rs b/benches/key.rs
index 74977fb..68271aa 100644
--- a/benches/key.rs
+++ b/benches/key.rs
@@ -31,7 +31,9 @@ fn bench_rsa_2048_pkcsv1_decrypt(b: &mut Bencher) {
let x = base64::decode(DECRYPT_VAL).unwrap();
b.iter(|| {
- let res = priv_key.decrypt(PaddingScheme::new_pkcs1v15... | 1 | 4 | 2 |
f3f794d44b6a68dc99162aad1d3a6d8c1a1e809a | dignifiedquire | 2020-04-11T12:55:03 | CR for oaep | diff --git a/src/errors.rs b/src/errors.rs
index 949e39b..18d66a2 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -35,4 +35,6 @@ pub enum Error {
ParseError { reason: String },
#[error("internal error")]
Internal,
+ #[error("label too long")]
+ LabelTooLong,
}
diff --git a/src/oaep.rs b/src/oaep... | 2 | 29 | 28 |
2ae5f331b45db9ec4cf62ca364ce9728ca0d9ae9 | Friedel Ziegelmayer | 2020-04-11T12:35:24 | Update src/algorithms.rs
Co-Authored-By: str4d <thestr4d@gmail.com> | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 6998abc..2cd4df8 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -119,7 +119,7 @@ pub fn mgf1_xor(out: &mut [u8], digest: &mut dyn DynDigest, seed: &[u8]) {
let mut counter = [0u8; 4];
let mut i = 0;
- const MAX_LEN: u64 = u32::MAX as u64... | 1 | 1 | 1 |
40d7be0223627b94224c3e11721fc584e198e220 | dignifiedquire | 2020-04-10T12:36:10 | document padding schemes | diff --git a/src/padding.rs b/src/padding.rs
index 08b9464..6b5e2cc 100644
--- a/src/padding.rs
+++ b/src/padding.rs
@@ -7,14 +7,16 @@ use crate::hash::Hash;
/// Available padding schemes.
pub enum PaddingScheme {
+ /// Encryption and Decryption using PKCS1v15 padding.
PKCS1v15Encrypt,
- PKCS1v15Sign {
-... | 1 | 5 | 3 |
668e9ddfe4a535c5f59c8ad889add365f0b65dc7 | dignifiedquire | 2020-04-10T12:34:25 | apply CR | diff --git a/src/algorithms.rs b/src/algorithms.rs
index a02e884..6998abc 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -1,3 +1,4 @@
+use digest::DynDigest;
use num_bigint::traits::ModInverse;
use num_bigint::{BigUint, RandPrime};
use num_traits::{FromPrimitive, One, Zero};
@@ -110,3 +111,44 @@ pub fn ge... | 8 | 88 | 160 |
11500ed5e920b916a147107b89eaeced6dba0617 | dignifiedquire | 2020-03-06T22:10:55 | make oaep and pss generic over keys | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 5b6d385..a02e884 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -110,13 +110,3 @@ pub fn generate_multi_prime_key<R: Rng>(
primes,
))
}
-
-#[inline]
-pub fn copy_with_left_pad(dest: &mut [u8], src: &[u8]) {
- // left pad with zeros
- ... | 6 | 52 | 69 |
ff584d1bb8cfb59ed2aaa37ef028e92e3ba30096 | Jack Grigg | 2020-03-06T20:33:26 | pkcs1v15: Make decrypt() and sign() generic over PrivateKey | diff --git a/src/key.rs b/src/key.rs
index 8718829..b6f610a 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -544,7 +544,7 @@ impl RSAPrivateKey {
pub fn decrypt(&self, padding: PaddingScheme, ciphertext: &[u8]) -> Result<Vec<u8>> {
match padding {
// need to pass any Rng as the type arg, so the t... | 2 | 10 | 11 |
bc9749ea3d241c0383d28f05056c5ad90b030eaa | dignifiedquire | 2020-03-06T20:42:25 | update serde test | diff --git a/src/key.rs b/src/key.rs
index 914d5b8..4f27a10 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -760,7 +760,12 @@ mod tests {
let priv_tokens = [
Token::Struct {
name: "RSAPrivateKey",
- len: 4,
+ len: 3,
+ },
+ Token::St... | 1 | 7 | 1 |
062ab54739d68ab9b99caaed5771dc35cc62ab2c | dignifiedquire | 2020-03-06T20:24:09 | fix benches | diff --git a/benches/key.rs b/benches/key.rs
index 5afde12..74977fb 100644
--- a/benches/key.rs
+++ b/benches/key.rs
@@ -6,9 +6,7 @@ use base64;
use num_bigint::BigUint;
use num_traits::{FromPrimitive, Num};
use rand::{rngs::StdRng, SeedableRng};
-use rsa::hash::Hashes;
-use rsa::padding::PaddingScheme;
-use rsa::RS... | 1 | 3 | 6 |
79439a004e8dc5e23d240f124c406c74730395a8 | lucdew | 2019-04-01T16:11:40 | Add oaep encrypt and only with sha1 digest
Test assertion is manual and done with openssl | diff --git a/Cargo.toml b/Cargo.toml
index 661cd8e..38adeb2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,7 @@ thiserror = "1.0.11"
subtle = "2.0.0"
simple_asn1 = "0.4"
pem = { version = "0.7", optional = true }
+digest = { version = "0.8.0", features = ["std"] }
[dependencies.zeroize]
version = "1.1.0"
... | 5 | 373 | 2 |
d5b46789b295b7b372d002b7fb4c33cd5a1f6999 | dignifiedquire | 2020-03-06T17:09:21 | feat: implement From<&RSAPrivateKey> for RSAPublicKey | diff --git a/src/key.rs b/src/key.rs
index b70964f..8718829 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -35,7 +35,11 @@ pub trait PrivateKey: DecryptionPrimitive + PublicKeyParts {}
/// Represents the public part of an RSA key.
#[derive(Debug, Clone, PartialEq, Eq)]
-#[cfg_attr(feature = "serde", derive(Serialize, ... | 2 | 34 | 23 |
ea2a3bfeb87d8ff0763ce2f414a7405de7720608 | Jack Grigg | 2020-01-03T03:28:54 | Introduce key::{PrivateKey, PublicKeyParts}
RSAPrivateKey no longer implements PublicKey. Instead,
RSAPublicKey::from(RSAPrivateKey) should be used to obtain a public key. | diff --git a/src/internals.rs b/src/internals.rs
index 5c034f5..eb29128 100644
--- a/src/internals.rs
+++ b/src/internals.rs
@@ -5,11 +5,11 @@ use std::borrow::Cow;
use zeroize::Zeroize;
use crate::errors::{Error, Result};
-use crate::key::{PublicKey, RSAPrivateKey};
+use crate::key::{PublicKeyParts, RSAPrivateKey}... | 5 | 51 | 85 |
826ea300045a4c765b9047d2342bb710793d2fbe | Jack Grigg | 2020-01-03T02:51:43 | Introduce raw::{DecryptionPrimitive, EncryptionPrimitive} | diff --git a/src/key.rs b/src/key.rs
index 9b0eed1..2208f93 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -12,6 +12,7 @@ use crate::errors::{Error, Result};
use crate::hash::Hash;
use crate::padding::PaddingScheme;
use crate::pkcs1v15;
+use crate::raw::EncryptionPrimitive;
lazy_static! {
static ref MIN_PUB_EXP... | 4 | 96 | 54 |
092fc3b1dc8f42f8bcceae6fc9563af695a1b135 | Aaron Loucks | 2020-02-26T01:02:18 | Use `thiserror` instead of `failure`
Fixes #39 | diff --git a/Cargo.toml b/Cargo.toml
index 774f7b9..c34a58d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,7 +19,7 @@ num-iter = "0.1.37"
lazy_static = "1.3.0"
rand = "0.7.0"
byteorder = "1.3.1"
-failure = "0.1.5"
+thiserror = "1.0.11"
subtle = "2.0.0"
simple_asn1 = "0.4"
pem = { version = "0.7", optional = true... | 3 | 19 | 19 |
fab3789707081a3982f1c9eec5cb1db281df0e6c | Aaron Loucks | 2020-02-16T17:27:34 | Add doctest examples for key parsing | diff --git a/src/key.rs b/src/key.rs
index 98610a9..2aa691e 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -199,6 +199,30 @@ impl RSAPublicKey {
/// following a `-----BEGIN RSA PUBLIC KEY-----` header.
///
/// <https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem>
+ ///
+ /// # Exa... | 2 | 148 | 0 |
3d4500036fa2c4070628890f5a52116ef5868c46 | Aaron Loucks | 2020-02-26T01:33:20 | Rename `serde1` feature to `serde` | diff --git a/Cargo.toml b/Cargo.toml
index c1a0745..dfc0bc4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,8 @@ subtle = "2.0.0"
version = "1.1.0"
features = ["alloc", "zeroize_derive"]
-[dependencies.serde]
+[dependencies.serde_crate]
+package = "serde"
optional = true
version = "1.0.89"
default-features... | 3 | 12 | 10 |
0f61eff8ec5f245bd95b1d796bf44ed395eb6710 | Aaron Loucks | 2020-02-15T16:10:55 | Remove use statements for parse functions in lib.rs | diff --git a/src/key.rs b/src/key.rs
index 9f47ee3..98610a9 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -200,7 +200,7 @@ impl RSAPublicKey {
///
/// <https://tls.mbed.org/kb/cryptography/asn1-key-structures-in-der-and-pem>
pub fn from_pkcs1(der: &[u8]) -> Result<RSAPublicKey> {
- crate::parse_publ... | 2 | 4 | 5 |
bb3a0e23f2cbf6deac3ecc121fbb6e51af681530 | Aaron Loucks | 2020-02-14T23:37:36 | Replace public parse functions with factory constructors | diff --git a/src/key.rs b/src/key.rs
index f9e71ae..9f47ee3 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -192,6 +192,26 @@ impl RSAPublicKey {
Ok(k)
}
+
+ /// Parse a `PKCS1` encoded RSA Public Key.
+ ///
+ /// The `der` data is expected to be the `base64` decoded content
+ /// following a `-... | 2 | 41 | 1 |
783b82d4939ce24398b1dcd43ac98b01c9b0b099 | Aaron Loucks | 2020-02-13T22:50:44 | Add parsing for pkcs1 and pkcs8 encoded rsa keys
Fixes #37 | diff --git a/Cargo.toml b/Cargo.toml
index c1a0745..774f7b9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,8 @@ rand = "0.7.0"
byteorder = "1.3.1"
failure = "0.1.5"
subtle = "2.0.0"
+simple_asn1 = "0.4"
+pem = { version = "0.7", optional = true }
[dependencies.zeroize]
version = "1.1.0"
@@ -39,7 +41,7 @@ ... | 4 | 418 | 2 |
d2efb8489aa568db9e531ddd0cc993c9165d3bac | Benoît CORTIER | 2020-01-09T20:23:01 | Add regression test for panic on invalid coeff | diff --git a/src/key.rs b/src/key.rs
index 42a41ba..f9e71ae 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -637,4 +637,28 @@ mod tests {
];
assert_tokens(&RSAPublicKey::from(priv_key), &priv_tokens);
}
+
+ #[test]
+ fn invalid_coeff_private_key_regression() {
+ let n = base64::decode("w... | 1 | 24 | 0 |
ba0542ba913f65c539b1f49e9ecdc9228b70ef04 | Benoît CORTIER | 2020-01-09T19:58:23 | Make precompute return a result instead of panicking on invalid coeff | diff --git a/src/errors.rs b/src/errors.rs
index a789a7d..a6f65f6 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -23,6 +23,8 @@ pub enum Error {
InvalidModulus,
#[fail(display = "invalid exponent")]
InvalidExponent,
+ #[fail(display = "invalid coefficient")]
+ InvalidCoefficient,
#[fail(dis... | 2 | 17 | 13 |
3818b74b52b950688c1ebde024991682efce1e4f | dignifiedquire | 2019-12-11T00:16:23 | chore(rsa): release 0.2.0 | diff --git a/Cargo.toml b/Cargo.toml
index 9021dca..c1a0745 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.4"
+version = "0.2.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA implementa... | 1 | 1 | 1 |
fcd1e537d5fb3a800302d6e8b2f81b737a87b204 | dignifiedquire | 2019-10-13T14:32:39 | chore(rsa): release 0.1.4 | diff --git a/Cargo.toml b/Cargo.toml
index 9693237..c829156 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.4-alpha.0"
+version = "0.1.4"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA im... | 1 | 1 | 1 |
6f6076702ac54fc28ad626a9296a80714405a9ba | dignifiedquire | 2019-10-13T14:31:11 | feat(deps): update to the latest | diff --git a/Cargo.toml b/Cargo.toml
index a9415be..9693237 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ categories = ["cryptography"]
readme = "README.md"
[dependencies]
-num-bigint = { version = "0.4", features = ["rand", "i128", "u64_digit", "prime", "zeroize"], package = "num-bigint-dig" }
+num-bi... | 2 | 20 | 8 |
610c4cc95f614dad40651e585756858cca4f6e20 | roblabla | 2019-09-26T13:22:46 | Move copy_with_left_pad to algorithms | diff --git a/src/algorithms.rs b/src/algorithms.rs
index a02e884..5b6d385 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -110,3 +110,13 @@ pub fn generate_multi_prime_key<R: Rng>(
primes,
))
}
+
+#[inline]
+pub fn copy_with_left_pad(dest: &mut [u8], src: &[u8]) {
+ // left pad with zeros
+ ... | 3 | 12 | 11 |
30220cfd4484ec14e27c21cefb1652d401e3ce67 | roblabla | 2019-09-26T13:16:25 | Fix the tests | diff --git a/Cargo.toml b/Cargo.toml
index 272b636..2e77bb5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,9 +21,7 @@ rand = "0.6.5"
byteorder = "1.3.1"
failure = "0.1.5"
subtle = "2.0.0"
-signature = { version = "0.2.0" }
-sha2 = { version = "0.8" }
-sha-1 = { version = "0.8.1" }
+digest = "0.8"
[dependencies.z... | 5 | 15 | 27 |
b821cc6cc2adb7fd94c367ef330f18076c8ea5d6 | roblabla | 2019-09-26T13:15:04 | Add new sign_pss/verify_pss | diff --git a/src/key.rs b/src/key.rs
index 0dd67cd..128733e 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -7,11 +7,11 @@ use rand::{rngs::ThreadRng, Rng};
#[cfg(feature = "serde1")]
use serde::{Deserialize, Serialize};
use zeroize::{Zeroize, ZeroizeOnDrop};
+use digest::Digest;
use crate::algorithms::generate_multi... | 2 | 69 | 44 |
527acfca3156ddb7eaec79f502c472b97222d948 | roblabla | 2019-09-26T12:43:56 | Use separate functions for different padding schemes | diff --git a/src/key.rs b/src/key.rs
index 4c2290c..0dd67cd 100644
--- a/src/key.rs
+++ b/src/key.rs
@@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use zeroize::{Zeroize, ZeroizeOnDrop};
use crate::algorithms::generate_multi_prime_key;
-use crate::errors::{Error, Result};
+use crate::errors::{Error, Result as... | 1 | 29 | 56 |
071f07f6c8288efea12f557fe226749450e3f5bd | roblabla | 2019-09-26T12:42:54 | Avoid using vectors to store the asn1 prefixes | diff --git a/src/hash.rs b/src/hash.rs
index 6af2ae5..71dbc63 100644
--- a/src/hash.rs
+++ b/src/hash.rs
@@ -5,7 +5,7 @@ pub trait Hash {
fn size(&self) -> usize;
/// Returns the ASN1 DER prefix for the the hash function.
- fn asn1_prefix(&self) -> Vec<u8>;
+ fn asn1_prefix(&self) -> &'static [u8];
}... | 2 | 15 | 15 |
2462f1dd56f79deb211efe7e298a9d8c2b2b8d61 | roblabla | 2019-09-26T12:40:43 | Remove PublicKey trait, use deref.
Removes the PublicKey trait, using Deref to provide the RSAPublicKey
methods to RSAPrivateKey. | diff --git a/src/internals.rs b/src/internals.rs
index 5c034f5..ecc1219 100644
--- a/src/internals.rs
+++ b/src/internals.rs
@@ -5,11 +5,11 @@ use std::borrow::Cow;
use zeroize::Zeroize;
use crate::errors::{Error, Result};
-use crate::key::{PublicKey, RSAPrivateKey};
+use crate::key::{RSAPublicKey, RSAPrivateKey};
... | 4 | 50 | 134 |
5d28baf32a30173ebef0ab0c5d9cd2e98c522074 | roblabla | 2019-08-21T09:33:50 | Implement PSS | diff --git a/Cargo.toml b/Cargo.toml
index a9415be..272b636 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,9 @@ rand = "0.6.5"
byteorder = "1.3.1"
failure = "0.1.5"
subtle = "2.0.0"
+signature = { version = "0.2.0" }
+sha2 = { version = "0.8" }
+sha-1 = { version = "0.8.1" }
[dependencies.zeroize]
version... | 5 | 403 | 20 |
cf9f1b48e93998b94c0ff07eccac3b5dbf10bfb6 | Robin Lambertz | 2019-08-27T10:45:19 | feat: reexport `BigUint` | diff --git a/src/lib.rs b/src/lib.rs
index da92e8c..42799cd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -46,6 +46,8 @@ extern crate hex;
#[cfg(all(test, feature = "serde1"))]
extern crate serde_test;
+pub use num_bigint::BigUint;
+
/// Useful algorithms.
pub mod algorithms; | 1 | 2 | 0 |
41897b747293f8dd21e5200c052ae997a8e1ce16 | dignifiedquire | 2019-03-26T14:24:53 | (cargo-release) start next development iteration 0.1.3 | diff --git a/Cargo.toml b/Cargo.toml
index 08c7835..a9415be 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.3"
+version = "0.1.4-alpha.0"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA im... | 1 | 1 | 1 |
380c7e34b7231543decf20ef9eba98c16bd67eb7 | dignifiedquire | 2019-03-26T14:24:35 | (cargo-release) version 0.1.3 | diff --git a/Cargo.toml b/Cargo.toml
index a295060..08c7835 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "rsa"
-version = "0.1.3-alpha.0"
+version = "0.1.3"
authors = ["RustCrypto Developers", "dignifiedquire <dignifiedquire@gmail.com>"]
edition = "2018"
description = "Pure Rust RSA im... | 1 | 1 | 1 |
021ae799da601e359554953675fcc5cf79aa5d05 | dignifiedquire | 2019-03-26T13:53:53 | feat: implement zeroing using the zeroize crate | diff --git a/Cargo.toml b/Cargo.toml
index 1a2a449..a295060 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@ categories = ["cryptography"]
readme = "README.md"
[dependencies]
-num-bigint = { version = "0.3", features = ["rand", "i128", "u64_digit", "prime"], package = "num-bigint-dig" }
+num-bigint = { ve... | 5 | 101 | 48 |
8e5ce15e181d3f85687f51b2cf86a7023fcfd1ea | Patrick D Hayes | 2019-03-25T15:40:55 | feat(deps): update dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 251940d..1a2a449 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,25 +16,25 @@ num-bigint = { version = "0.3", features = ["rand", "i128", "u64_digit", "prime"
num-traits = "0.2.6"
num-integer = "0.1.39"
num-iter = "0.1.37"
-lazy_static = "1.2.0"
-rand = "0.5.5"
-byteorder =... | 3 | 11 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.