From 8def5056fbc5b8e49727fd950ae5080f60f7a7a9 Mon Sep 17 00:00:00 2001
From: Tudyx <56633664+Tudyx@users.noreply.github.com>
Date: Wed, 14 Feb 2024 23:52:47 +0100
Subject: [PATCH] add certificate signing request
---
Cargo.toml | 2 +-
src/lib.rs | 29 ++++++++++++++++++++++++++---
src/pemfile.rs | 10 ++++++++--
tests/data/csr.pem | 18 ++++++++++++++++++
tests/data/zen.pem | 18 ++++++++++++++++++
tests/integration.rs | 14 +++++++++++++-
6 files changed, 84 insertions(+), 7 deletions(-)
create mode 100644 tests/data/csr.pem
diff --git a/Cargo.toml b/Cargo.toml
index 19139a6..3e7c976 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@ categories = ["network-programming", "cryptography"]
[dependencies]
base64 = { version = "0.21", default-features = false, features = ["alloc"] }
-pki-types = { package = "rustls-pki-types", version = "1" }
+pki-types = { package = "rustls-pki-types", version = "1.3" }
[dev-dependencies]
bencher = "0.1.5"
diff --git a/src/lib.rs b/src/lib.rs
index 9c5f993..1cdd426 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -30,6 +30,7 @@
//! match item.unwrap() {
//! Item::X509Certificate(cert) => println!("certificate {:?}", cert),
//! Item::Crl(crl) => println!("certificate revocation list: {:?}", crl),
+//! Item::Csr(csr) => println!("certificate signing request: {:?}", csr),
//! Item::Pkcs1Key(key) => println!("rsa pkcs1 key {:?}", key),
//! Item::Pkcs8Key(key) => println!("pkcs8 key {:?}", key),
//! Item::Sec1Key(key) => println!("sec1 ec key {:?}", key),
@@ -67,8 +68,8 @@ pub use pemfile::{read_one_from_slice, Error, Item};
use pki_types::PrivateKeyDer;
#[cfg(feature = "std")]
use pki_types::{
- CertificateDer, CertificateRevocationListDer, PrivatePkcs1KeyDer, PrivatePkcs8KeyDer,
- PrivateSec1KeyDer,
+ CertificateDer, CertificateRevocationListDer, CertificateSigningRequestDer, PrivatePkcs1KeyDer,
+ PrivatePkcs8KeyDer, PrivateSec1KeyDer,
};
#[cfg(feature = "std")]
@@ -103,7 +104,29 @@ pub fn private_key(rd: &mut dyn io::BufRead) -> Result