Skip to content

Commit

Permalink
Remove the standalone feature
Browse files Browse the repository at this point in the history
As discussed in #2, ring is not mature enough to replace OpenSSL. Hence,
the standalone mode which has been made to implement such a replacement
has to be removed until ring becomes usable.
  • Loading branch information
breard-r committed Jun 25, 2019
1 parent 5a1aaa4 commit 4ea4951
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 59 deletions.
7 changes: 1 addition & 6 deletions acme_common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@ include = ["src/**/*", "Cargo.toml", "Licence_*.txt"]
[lib]
name = "acme_common"

[features]
default = ["openssl"]
standalone = ["ring"]

[dependencies]
base64 = "0.10"
daemonize = "0.4"
env_logger = "0.6"
handlebars = "2.0.0-beta.2"
http_req = "0.5"
log = "0.4"
openssl = { version = "0.10", optional = true }
ring = { version = "0.14", optional = true }
openssl = "0.10"
serde_json = "1.0"
syslog = "4.0"
time = "0.1"
Expand Down
17 changes: 2 additions & 15 deletions acme_common/src/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
mod key_type;
mod openssl_certificate;

#[cfg(not(feature = "standalone"))]
mod openssl_hash;
#[cfg(feature = "standalone")]
mod standalone_hash;

mod openssl_keys;
mod key_type;

#[cfg(not(feature = "standalone"))]
pub const DEFAULT_ALGO: &str = "rsa2048";
#[cfg(feature = "standalone")]
pub const DEFAULT_ALGO: &str = "ecdsa_p256";

pub use key_type::KeyType;
pub use openssl_certificate::{Csr, X509Certificate};

#[cfg(not(feature = "standalone"))]
pub use openssl_hash::sha256;
#[cfg(feature = "standalone")]
pub use standalone_hash::sha256;

pub use openssl_keys::{gen_keypair, KeyPair};
pub use key_type::KeyType;
8 changes: 2 additions & 6 deletions acme_common/src/crypto/openssl_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ impl KeyPair {

pub fn sign(&self, data: &[u8]) -> Result<Vec<u8>, Error> {
match self.key_type {
KeyType::Curve25519 => {
Err("Curve25519 signatures are not implemented yet".into())
},
KeyType::Curve25519 => Err("Curve25519 signatures are not implemented yet".into()),
KeyType::EcdsaP256 | KeyType::EcdsaP384 => {
let signature = EcdsaSig::sign(data, self.inner_key.ec_key()?.as_ref())?;
let r = signature.r().to_vec();
Expand All @@ -81,9 +79,7 @@ impl KeyPair {
pub fn get_jwk_thumbprint(&self) -> Result<String, Error> {
// TODO: implement Curve25519 and RSA JWK thumbprint
match self.key_type {
KeyType::Curve25519 => {
Err("Curve25519 thumbprint are not implemented yet".into())
},
KeyType::Curve25519 => Err("Curve25519 thumbprint are not implemented yet".into()),
KeyType::EcdsaP256 | KeyType::EcdsaP384 => self.get_nist_ec_jwk(),
KeyType::Rsa2048 | KeyType::Rsa4096 => {
Err("RSA jwk thumbprint are not implemented yet".into())
Expand Down
5 changes: 0 additions & 5 deletions acme_common/src/crypto/standalone_hash.rs

This file was deleted.

6 changes: 1 addition & 5 deletions acmed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ license = "MIT OR Apache-2.0"
include = ["src/**/*", "Cargo.toml", "LICENSE-*.txt"]
build = "build.rs"

[features]
default = ["openssl-sys"]
standalone = []

[dependencies]
acme_common = { path = "../acme_common" }
clap = "2.32"
handlebars = "2.0.0-beta.2"
http_req = "0.5"
log = "0.4"
nom = "5.0"
openssl-sys = { version = "0.9", optional = true }
openssl-sys = "0.9"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
time = "0.1"
Expand Down
6 changes: 1 addition & 5 deletions tacd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ readme = "../README.md"
license = "MIT OR Apache-2.0"
include = ["src/**/*", "Cargo.toml", "LICENSE-*.txt"]

[features]
default = ["openssl"]
standalone = []

[dependencies]
acme_common = { path = "../acme_common" }
clap = "2.32"
log = "0.4"
openssl = { version = "0.10", optional = true }
openssl = "0.10"
8 changes: 1 addition & 7 deletions tacd/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#[cfg(not(feature = "standalone"))]
mod openssl_server;
#[cfg(not(feature = "standalone"))]
use openssl_server::start as server_start;
#[cfg(feature = "standalone")]
mod standalone_server;
#[cfg(feature = "standalone")]
use standalone_server::start as server_start;

use crate::openssl_server::start as server_start;
use acme_common::crypto::X509Certificate;
use acme_common::error::Error;
use clap::{App, Arg, ArgMatches};
Expand Down
10 changes: 0 additions & 10 deletions tacd/src/standalone_server.rs

This file was deleted.

0 comments on commit 4ea4951

Please sign in to comment.