From fa84a2ae5fa28fa4648863a74ea7d3406e58d8a9 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 8 Aug 2024 00:35:41 -0400 Subject: [PATCH] keyfork-shard: Be less strict about keys Rationale: Keyfork Shard runs on Airgap systems. The biggest impact of using StandardPolicy and checking whether keys are "alive" is the drift between different Airgap systems where the keys may not be valid at the same time. Because of this, it is impossible to shard a secret to all keys at once using a StandardPolicy. However, we consider these keys to be a trusted input, whether created by a previous system or generated directly by Keyfork. Because of this, we can use a NullPolicy to blanketly permit all keys, the same way we blanketly permit all keys when reconstituting the sharded secret, and disable the check for whether keys are alive (though, we are still denying revoked keys). --- crates/keyfork-shard/src/openpgp.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/keyfork-shard/src/openpgp.rs b/crates/keyfork-shard/src/openpgp.rs index be4ec47..11f759a 100644 --- a/crates/keyfork-shard/src/openpgp.rs +++ b/crates/keyfork-shard/src/openpgp.rs @@ -25,7 +25,7 @@ use openpgp::{ stream::{DecryptionHelper, DecryptorBuilder, VerificationHelper}, Parse, }, - policy::{NullPolicy, Policy, StandardPolicy}, + policy::{NullPolicy, Policy}, serialize::{ stream::{ArbitraryWriter, Encryptor2, LiteralWriter, Message, Recipient, Signer}, Marshal, @@ -276,7 +276,7 @@ impl Format for OpenPGP

{ key_data: &[Self::PublicKey], threshold: u8, ) -> Result { - let policy = StandardPolicy::new(); + let policy = NullPolicy::new(); let mut pp = vec![SHARD_METADATA_VERSION, threshold]; // Note: Sequoia does not export private keys on a Cert, only on a TSK signing_key @@ -362,7 +362,7 @@ impl Format for OpenPGP

{ public_key: &Cert, signing_key: &mut Self::SigningKey, ) -> Result { - let policy = StandardPolicy::new(); + let policy = NullPolicy::new(); let valid_cert = public_key .with_policy(&policy, None) .map_err(Error::Sequoia)?; @@ -577,7 +577,8 @@ fn get_encryption_keys<'a>( openpgp::packet::key::UnspecifiedRole, > { cert.keys() - .alive() + // NOTE: this causes complications on Airgap systems + // .alive() .revoked(false) .supported() .for_storage_encryption()