Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Revert "Use namespaced features for serde; MSRV 1.60 (#251)" #254

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
rust:
- 1.60.0 # MSRV
- 1.57.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -37,7 +37,7 @@ jobs:
strategy:
matrix:
rust:
- 1.60.0 # MSRV
- 1.57.0 # MSRV
- stable
steps:
- uses: actions/checkout@v3
Expand Down
12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/RustCrypto/RSA"
keywords = ["rsa", "encryption", "security", "crypto"]
categories = ["cryptography"]
readme = "README.md"
rust-version = "1.60"
rust-version = "1.57"

[dependencies]
num-bigint = { version = "0.8.2", features = ["i128", "u64_digit", "prime", "zeroize"], default-features = false, package = "num-bigint-dig" }
Expand All @@ -25,7 +25,13 @@ pkcs1 = { version = "0.4", default-features = false, features = ["pkcs8", "alloc
pkcs8 = { version = "0.9", default-features = false, features = ["alloc"] }
signature = { version = "2", default-features = false , features = ["digest", "rand_core"] }
zeroize = { version = "1", features = ["alloc"] }
serde = { version = "1.0.103", optional = true, default-features = false, features = ["derive"] }

[dependencies.serde_crate]
package = "serde"
optional = true
version = "1.0.103"
default-features = false
features = ["derive"]

[dev-dependencies]
base64ct = { version = "1", features = ["alloc"] }
Expand All @@ -45,7 +51,7 @@ name = "key"
[features]
default = ["std", "pem"]
nightly = ["num-bigint/nightly"]
serde = ["dep:serde", "num-bigint/serde"]
serde = ["num-bigint/serde", "serde_crate"]
expose-internals = []
std = ["digest/std", "pkcs1/std", "pkcs8/std", "rand_core/std", "signature/std"]
pem = ["pkcs1/pem", "pkcs8/pem"]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![crates.io][crate-image]][crate-link]
[![Documentation][doc-image]][doc-link]
[![Build Status][build-image]][build-link]
![MSRV][msrv-image]
![minimum rustc 1.57][msrv-image]
[![Project Chat][chat-image]][chat-link]
[![dependency status][deps-image]][deps-link]

Expand Down Expand Up @@ -70,7 +70,7 @@ There will be three phases before `1.0` 🚢 can be released.

## Minimum Supported Rust Version (MSRV)

All crates in this repository support Rust 1.60 or higher. In future
All crates in this repository support Rust 1.57 or higher. In future
minimally supported version of Rust can be changed, but it will be done with
a minor version bump.

Expand All @@ -97,7 +97,7 @@ dual licensed as above, without any additional terms or conditions.
[doc-link]: https://docs.rs/rsa
[build-image]: https://github.com/rustcrypto/RSA/workflows/CI/badge.svg
[build-link]: https://github.com/RustCrypto/RSA/actions?query=workflow%3ACI+branch%3Amaster
[msrv-image]: https://img.shields.io/badge/rustc-1.60+-blue.svg
[msrv-image]: https://img.shields.io/badge/rustc-1.57+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260047-RSA
[deps-image]: https://deps.rs/repo/github/RustCrypto/RSA/status.svg
Expand Down
14 changes: 11 additions & 3 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use num_bigint::{BigInt, BigUint};
use num_traits::{One, ToPrimitive};
use rand_core::CryptoRngCore;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use serde_crate::{Deserialize, Serialize};
use zeroize::Zeroize;

use crate::algorithms::{generate_multi_prime_key, generate_multi_prime_key_with_exp};
Expand Down Expand Up @@ -35,15 +35,23 @@ pub trait PrivateKey: DecryptionPrimitive + PublicKeyParts {}

/// Represents the public part of an RSA key.
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
pub struct RsaPublicKey {
n: BigUint,
e: BigUint,
}

/// Represents a whole RSA key, public and private parts.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(
feature = "serde",
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
pub struct RsaPrivateKey {
/// Public components of the private key.
pubkey_components: RsaPublicKey,
Expand Down