From 59112c9b5fab621aae92ba6178da9927ce19f36f Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Tue, 15 Aug 2023 22:42:53 +0200 Subject: [PATCH] ensure ed25519 pkcs8 is consumed --- russh-keys/src/format/pkcs8.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/russh-keys/src/format/pkcs8.rs b/russh-keys/src/format/pkcs8.rs index df2504ee..a9cbb96d 100644 --- a/russh-keys/src/format/pkcs8.rs +++ b/russh-keys/src/format/pkcs8.rs @@ -154,6 +154,10 @@ fn read_key_v1(reader: &mut BERReaderSeq) -> Result { .ok_or(Error::KeyIsCorrupt) .and_then(|s| SigningKey::try_from(s).map_err(|_| Error::CouldNotReadKey))? }; + // Consume the public key + reader + .next() + .read_tagged(yasna::Tag::context(1), |reader| reader.read_bitvec())?; Ok(key::KeyPair::Ed25519(secret)) } else { Err(Error::CouldNotReadKey)