keyfork-shard: limit size of encrypted payload, can fit at max a 256 bit shard

This commit is contained in:
Ryan Heywood 2024-02-10 00:37:53 -05:00
parent 1879a250c8
commit af230f55df
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
2 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ pub struct InvalidData;
/// 1 byte: Version /// 1 byte: Version
/// 1 byte: Threshold /// 1 byte: Threshold
/// Data: &[u8] /// Data: &[u8]
pub(crate) const HUNK_VERSION: u8 = 1; pub(crate) const HUNK_VERSION: u8 = 2;
pub(crate) const HUNK_OFFSET: usize = 2; pub(crate) const HUNK_OFFSET: usize = 2;
const QRCODE_PROMPT: &str = "Press enter, then present QR code to camera."; const QRCODE_PROMPT: &str = "Press enter, then present QR code to camera.";
@ -129,7 +129,7 @@ pub fn remote_decrypt(w: &mut impl Write) -> Result<(), Box<dyn std::error::Erro
(Some(pubkey), Some(payload)) => (pubkey, payload), (Some(pubkey), Some(payload)) => (pubkey, payload),
_ => { _ => {
let validator = MnemonicSetValidator { let validator = MnemonicSetValidator {
word_lengths: [24, 48], word_lengths: [24, 39],
}; };
let [pubkey_mnemonic, payload_mnemonic] = pm.prompt_validated_wordlist( let [pubkey_mnemonic, payload_mnemonic] = pm.prompt_validated_wordlist(

View File

@ -62,7 +62,7 @@ use super::{
}; };
// 256 bit share is 49 bytes + some amount of hunk bytes, gives us reasonable padding // 256 bit share is 49 bytes + some amount of hunk bytes, gives us reasonable padding
const ENC_LEN: u8 = 4 * 16; const ENC_LEN: u8 = 52;
/// Errors encountered while performing operations using OpenPGP. /// Errors encountered while performing operations using OpenPGP.
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]