Skip to content

Commit a8b1b9e

Browse files
committed
A functional rustls-cert-gen with basic parameters.
This is basically #185 minus #188 and #189. The structure also differs as sub modules have been inlined in `main.rs` and `cert.rs`. `anyhow` has also been added as a dependency to replace the `Result` alias. Closes #175 includes review fixes such as: * remove top-level rsa dependency * inline parse_san * Check for presence of EKU before pushing. * Replace `struct Signature` struct w/ `enum KeypairAlgorithm` * update some doc strings * make EndEntity and Ca public so they appear in the docs
1 parent 0318d2f commit a8b1b9e

File tree

8 files changed

+906
-51
lines changed

8 files changed

+906
-51
lines changed

Cargo.lock

Lines changed: 316 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ members = ["rcgen", "rustls-cert-gen"]
33
resolver = "2"
44

55
[workspace.dependencies]
6-
pem = { version = "3.0.2" }
6+
pem = "3.0.2"
7+
rand = "0.8"
8+
ring = "0.17"
9+
x509-parser = "0.15.1"
710

811
[workspace.package]
912
license = "MIT OR Apache-2.0"

rcgen/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ required-features = ["pem", "x509-parser"]
2323

2424
[dependencies]
2525
yasna = { version = "0.5.2", features = ["time", "std"] }
26-
ring = "0.17"
26+
ring = { workspace = true }
2727
pem = { workspace = true, optional = true }
2828
time = { version = "0.3.6", default-features = false }
29-
x509-parser = { version = "0.15", features = ["verify"], optional = true }
29+
x509-parser = { workspace = true, features = ["verify"], optional = true }
3030
zeroize = { version = "1.2", optional = true }
3131

3232
[features]
@@ -37,8 +37,8 @@ features = ["x509-parser"]
3737

3838
[dev-dependencies]
3939
openssl = "0.10"
40-
x509-parser = { version = "0.15", features = ["verify"] }
40+
x509-parser = { workspace = true, features = ["verify"] }
4141
rustls-webpki = { version = "0.101.0", features = ["std"] }
4242
botan = { version = "0.10", features = ["vendored"] }
43-
rand = "0.8"
44-
rsa = "0.9"
43+
rand = { workspace = true }
44+
rsa = { version = "0.9" }

rustls-cert-gen/Cargo.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,13 @@ edition.workspace = true
77
keywords.workspace = true
88

99
[dependencies]
10-
rcgen = { path = "../rcgen" }
10+
bpaf = { version = "0.9.5", features = ["derive"] }
1111
pem = { workspace = true }
12+
rcgen = { path = "../rcgen" }
13+
ring = { workspace = true }
14+
rand = { workspace = true }
15+
anyhow = "1.0.75"
16+
17+
[dev-dependencies]
18+
assert_fs = "1.0.13"
19+
x509-parser = { workspace = true, features = ["verify"] }

rustls-cert-gen/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# rustls-cert-gen
2+
3+
`rustls-cert-gen` is a tool to generate TLS certificates. In its
4+
current state it will generate a Root CA and an end-entity
5+
certificate, along with private keys. The end-entity certificate will
6+
be signed by the Root CA.
7+
8+
## Usage
9+
Having compiled the binary you can simply pass a path to output
10+
generated files.
11+
12+
cargo run -- -o output/dir
13+
14+
In the output directory you will find these files:
15+
16+
* `cert.pem` (end-entity's X.509 certificate, signed by `root-ca`'s key)
17+
* `cert.key.pem` (end-entity's private key)
18+
* `root-ca.pem` (ca's self-signed X.509 certificate)
19+
20+
For a complete list of supported options:
21+
22+
rustls-cert-gen --help
23+
24+
## FAQ
25+
26+
#### What signature schemes are available?
27+
28+
* `pkcs_ecdsa_p256_sha256`
29+
* `pkcs_ecdsa_p384_sha384`
30+
* `pkcs_ed25519`

0 commit comments

Comments
 (0)