Skip to content

Commit

Permalink
Use namespaced features for serde; MSRV 1.60 (#268)
Browse files Browse the repository at this point in the history
Reverts-the-revert from #254, reinstating #251

This reverts commit 26f38ad.

Since we need to upgrade `pkcs1` and `pkcs8`, which are MSRV 1.65, now
is a good time to start making brekaing changes again.
  • Loading branch information
tarcieri authored Mar 6, 2023
1 parent 39d3eb9 commit 99397db
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 33 deletions.
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.57.0 # MSRV
- 1.60.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand All @@ -37,7 +37,7 @@ jobs:
strategy:
matrix:
rust:
- 1.57.0 # MSRV
- 1.60.0 # MSRV
- stable
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 5 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rsa"
version = "0.8.2"
version = "0.9.0-pre"
authors = ["RustCrypto Developers", "dignifiedquire <[email protected]>"]
edition = "2021"
description = "Pure Rust RSA implementation"
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/RustCrypto/RSA"
keywords = ["rsa", "encryption", "security", "crypto"]
categories = ["cryptography"]
readme = "README.md"
rust-version = "1.57"
rust-version = "1.60"

[dependencies]
num-bigint = { version = "0.8.2", features = ["i128", "u64_digit", "prime", "zeroize"], default-features = false, package = "num-bigint-dig" }
Expand All @@ -23,22 +23,11 @@ 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, features = ["pkcs8", "alloc"] }
pkcs8 = { version = "0.9", default-features = false, features = ["alloc"] }
serde = { version = "1.0.103", optional = true, default-features = false, features = ["derive"] }
sha2 = { version = "0.10.6", optional = true, default-features = false, features = ["oid"] }
signature = { version = "2", default-features = false , features = ["digest", "rand_core"] }
zeroize = { version = "1", features = ["alloc"] }

[dependencies.sha2]
version = "0.10.6"
optional = true
default-features = false
features = ["oid"]

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

[dev-dependencies]
base64ct = { version = "1", features = ["alloc"] }
hex-literal = "0.3.3"
Expand All @@ -57,7 +46,7 @@ name = "key"
[features]
default = ["std", "pem"]
nightly = ["num-bigint/nightly"]
serde = ["num-bigint/serde", "serde_crate"]
serde = ["dep:serde", "num-bigint/serde"]
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]
![minimum rustc 1.57][msrv-image]
![MSRV][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.57 or higher. In future
All crates in this repository support Rust 1.60 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.57+-blue.svg
[msrv-image]: https://img.shields.io/badge/rustc-1.60+-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: 3 additions & 11 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_crate::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
use zeroize::Zeroize;

use crate::algorithms::{generate_multi_prime_key, generate_multi_prime_key_with_exp};
Expand Down Expand Up @@ -35,23 +35,15 @@ 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),
serde(crate = "serde_crate")
)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
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),
serde(crate = "serde_crate")
)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct RsaPrivateKey {
/// Public components of the private key.
pubkey_components: RsaPublicKey,
Expand Down

0 comments on commit 99397db

Please sign in to comment.