Closed filipnavara closed 3 years ago
The secret packet is incorrectly encoded and the unit test doesn't actually test the encoding.
A fix in SecretKeyPacket.Encode would likely look like this:
SecretKeyPacket.Encode
public override void Encode(Stream bcpgOut) { pubKeyPacket.Encode(bcpgOut); if (s2k != null) { bcpgOut.WriteByte((byte)s2kUsage); if (s2kUsage == S2kUsageTag.Checksum || s2kUsage == S2kUsageTag.Sha1) { bcpgOut.WriteByte((byte)encAlgorithm); s2k.Encode(bcpgOut); } } else { bcpgOut.WriteByte((byte)encAlgorithm); } if (iv != null) { bcpgOut.Write(iv); } if (secKeyData != null && secKeyData.Length > 0) { bcpgOut.Write(secKeyData); } }
The secret packet is incorrectly encoded and the unit test doesn't actually test the encoding.
A fix in
SecretKeyPacket.Encode
would likely look like this: