# Calculating PGP Symmetrically Encrypted Packet data

I have been trying to create a properly encrypted data packet using the format described in RFC 4880. However, I have been unable to verify any of my outputs due to the lack of examples to draw from (there are no "educational" PGP programs out there, only programs that are actually meant to be used) and the lack of information as to where my information is not correct.

Can anyone tell me where my data is not correctly constructed/calculated? Please do not tell me to just mess with GPG. Learning an entire program in order to figure out how to modify one function is a bit ridiculous.

For now, I hardcoded these values into my program, but I dont know if their outputs are correct.

Algorithm: AES256
data (ASCII): 0123456789abcdef
session key (hex): b51ba8901efd091d2afcd26b560ea8899d9e2ddbf6aa5c4edea8292704f2fcfc

SHA1 hash of data (hex): fe5567e8d769550852182cdf69d74bb16dff8e29
prefix for CFB mode (RFC4880 sec 13.9) (hex): 5133c64b4c777b064cfb71e3ddfba19f

output from OpenPGP CFB mode(hex): 5e963a759c48fbf2af931c5c575a27821323cd283c244900a60d7bf1147be20e84980021588fcfd85749468e64dfaae2541aabac23d7


I know that the output decrypts properly, but that does not mean that the input is correct. pgpdump is able to parse the packet, but that also means nothing, since only the format was followed, not the information

When I use a program built on top of bouncy castle, the Symmetrically Encrypted and MDC Packet packet is always 108 bytes, but mine are only 56 bytes. When I try to decrypt my packet in the program, it fails, but it doesnt give me any useful error message. i dont seem to be missing anything, and yet, I am.

otherwise, Public-Key Encrypted Session Key packets seem to be the same (except with different session keys since I cant control the program's generation of session keys).

my final PGP block is:

-----BEGIN PGP MESSAGE-----
Version: Test

wY4D+UDEMBpnd50QAf4vGqgfGk7qv5aeFEjO6w/Aw8tdXUuKn9yHvkPf6hNsq3Yo
2CdtwrtbdP7rTsX+eACJh4LYF2zSCItFaqV/wdV8Af4w90Ndc3juUw+90Xxve6j5
R9e6sY72oWDzr3IQCo/7q1n0mm6YnTguSL2MaoFpHZl7PA87fqwLFUmttiFmONxq
0jcBXpY6dZxI+/KvkxxcV1onghMjzSg8JEkApg178RR74g6EmAAhWI/P2FdJRo5k
36riVBqrrCPX
=w70P
-----END PGP MESSAGE-----


What did I miss?

-