diff --git a/src/cmd_encrypt.rs b/src/cmd_encrypt.rs index 3ccac26..b18adb9 100644 --- a/src/cmd_encrypt.rs +++ b/src/cmd_encrypt.rs @@ -88,11 +88,11 @@ fn encrypt_single(path: &PathBuf, envelops: &[&TinyEncryptConfigEnvelop], cmd_en if cmd_encrypt.compatible_with_1_0 { if let Some(envelops) = &encrypt_meta.envelops { for envelop in envelops { - if envelop.r#type == TinyEncryptEnvelopType::Pgp { + if (envelop.r#type == TinyEncryptEnvelopType::Pgp) && encrypt_meta.pgp_envelop.is_none() { encrypt_meta.pgp_fingerprint = Some(format!("KID:{}", envelop.kid)); encrypt_meta.pgp_envelop = Some(envelop.encrypted_key.clone()); } - if envelop.r#type == TinyEncryptEnvelopType::Ecdh { + if (envelop.r#type == TinyEncryptEnvelopType::Ecdh) && encrypt_meta.ecdh_envelop.is_none() { encrypt_meta.ecdh_point = Some(format!("KID:{}", envelop.kid)); encrypt_meta.ecdh_envelop = Some(envelop.encrypted_key.clone()); }