#thread 'main' panicked at 'Error Reading public.key EOF',

22 messages · Page 1 of 1 (latest)

crude rock
#

I'm trying to read a pgp public key using the sequoia_openpgp but I get this error :/

fn main() -> io::Result<()> {
  let mut reader =           Reader::from_file("public.key",ReaderMode::Tolerant(Some(Kind::File)))?;
  
  let mut data = String::new();
  match reader.read_to_string(&mut data) {
        Err(why) => panic!("Error: {}", why),
        Ok(_) => print!("contains:\n\n{}", data),
    }

    Ok(())
}
crude rock
#

thread 'main' panicked at 'Error Reading public.key EOF',

ruby harness
#

looks like you file is too short or empty

#

that's all I can guess really

#

wait uhh, how is that error even possible

#

oh it's Reader, I see

#

can you print the error with {:?}?

crude rock
#
'Error: Custom { kind: UnexpectedEof, error: FileError { path: "public.asc", source: Custom { kind: UnexpectedEof, error: "EOF" } } }'
crude rock
#

any idea what the error means ??

ruby harness
crude rock
#

public.asc is the public key that I'm trying to read

ruby harness
#

isn't it public.key?

crude rock
#

the extension is not relevant

ruby harness
#

uhh

#

but that's what you showed in the code

crude rock
#

it produces the same error for both

ruby harness
#

are you sure these files are in the right format?

crude rock
#

yes

ruby harness
#

because it looks like it's trying to read something and can't

#

so something's missing

crude rock
#

Something's wrong definitely and I can't tell what exactly, but thx anyway for your time