mattosaurus / PgpCore

.NET Core class library for using PGP
MIT License
245 stars 98 forks source link

Feature support old format (PGP 2.6.x) #205

Closed magks closed 11 months ago

magks commented 1 year ago

Legacy applications may need support for PGP 2.6.x.

BouncyCastle PgpLiteralDataGenerator supports PGP 2.6.x via a constructor taking a bool useOldFormat. Adding support in PgpCore to use that flag by adding a bool property to PGP class UseOldFormat (default false), and a bool arg useFormat to Utilties Write*LiteralData methods with a default value of false to not break any public usage of the methods.

( See https://github.com/neoeinstein/bouncycastle/blob/master/crypto/src/openpgp/PgpLiteralDataGenerator.cs ) PgpLiteralDataGenerator.cs: ///

/// Generates literal data objects in the old format. /// This is important if you need compatibility with PGP 2.6.x. /// /// If true, uses old format. public PgpLiteralDataGenerator( bool oldFormat) { this.oldFormat = oldFormat; }

magks commented 1 year ago

I just made this PR to illustrate how the support might be added and start a conversation about it. I was tasked with replacing a proprietary PGP package and I was looking into this one. I believe we require the old format support and was investigating how it could be added. I saw it there was a simple way, so requesting support to be added.

I see there is a failed check in my PR. I'm not sure if its related to my changes. I will look into it and fix it if so. But any word from maintainers on whether old format support like in this PR would be added would be much appreciated.

mattosaurus commented 1 year ago

Hi,

Thanks for submitting this, I hadn't realised there were issues with historical formats.

I think there's an issue with the threading of the tests that causes them to fail sometimes. I'll re-run and hope it passes this time.

I'll take a look at the PR in more detail next week when I've got some more free time.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

mattosaurus commented 11 months ago

Sorry for the delay in this. I've added this as an option in v6.2.0