Always use created date from YubiKey certificate

This commit is contained in:
Jack Grigg
2021-04-12 18:22:54 +12:00
parent 4e33ac1267
commit 771cad885a
3 changed files with 5 additions and 4 deletions
Generated
-1
View File
@@ -51,7 +51,6 @@ dependencies = [
"age-plugin",
"base64",
"bech32",
"chrono",
"console",
"dialoguer",
"env_logger",
-1
View File
@@ -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"
+5 -2
View File
@@ -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,
))
}
}