diff --git a/Cargo.lock b/Cargo.lock index dbb90d3..1eab04d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,7 +51,6 @@ dependencies = [ "age-plugin", "base64", "bech32", - "chrono", "console", "dialoguer", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 67f00e4..0849b1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ age-core = "0.5" age-plugin = "0.0" base64 = "0.13" bech32 = "0.8" -chrono = "0.4" console = "0.14" dialoguer = "0.8" env_logger = "0.8" diff --git a/src/builder.rs b/src/builder.rs index 2176fe0..f4aff2d 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -123,7 +123,7 @@ impl IdentityBuilder { .name .unwrap_or(format!("age identity {}", hex::encode(stub.tag))); - Certificate::generate_self_signed( + let cert = Certificate::generate_self_signed( yubikey, SlotId::Retired(slot), serial, @@ -140,10 +140,13 @@ impl IdentityBuilder { )], )?; + let (_, cert) = x509_parser::parse_x509_certificate(cert.as_ref()).unwrap(); + let created = cert.validity().not_before.to_rfc2822(); + Ok(( Stub::new(yubikey.serial(), slot, &recipient), recipient, - chrono::Local::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true), + created, )) } }