Search for a model explaining the internal structure of a PGP-signed and encrypted file

I am trying to debug and extend an existing piece of Java code using BouncyCastle to decrypt and verify protected attachments.

I looked at the BouncyCastle samples, but it’s more difficult to extract from them a model of how attachments attached to PGP look. From the code and various errors, I can assume that there is something represented by PGPMarker, then you can find PGPCompressedData, inside which there is PGPOnePassSignatureList and so on. This does not clarify issues such as when to expect one against the other and whether a one-time signature is present when signing and encrypting separately (these were examples that I came across, but not the topic of the question). BC javadoc doesn't explain much (e.g. PGPOnePassSignature is a "one-pass signature object").

The time spent re-designing the model by trial and error, and since I could not successfully find a good resource, I hope someone else knows this.

Thanks in advance.

+3
source share
1 answer

The best resource I found was OpenPGP RFC. I used BouncyCastle for PGP and S / MIME, and I felt S / MIME was much more straight forward, although both standards do almost the same thing. Fortunately, in my case, I signed and encrypted, so my code should not have been prepared to work with any crazy structure that the PGP implementation could come up with.

+4
source

Source: https://habr.com/ru/post/1761388/


All Articles