# How to properly format a PGP Message Block? [closed]

As sort of a follow up to my (currently) unanswered question, if it is correct, how do i properly calculate and format the packet that actually stores the data being encrypted? I thought I knew what I was doing, but something here causes bouncycastle to freak out.

Using data from the first post and:

AES256 (pgp value 9)

Data (ASCII): 0123456789abcdef

Data + SHA1 Hash (hex): 30313233343536373839616263646566fe5567e8d769550852182cdf69d74bb16dff8e29

random data used in cfb as prefix (hex): 5133c64b4c777b064cfb71e3ddfba19f

Encrypted data (hex): 5e963a759c48fbf2af931c5c575a27821323cd283c244900a60d7bf1147be20e84980021588fcfd85749468e64dfaae2541aabac23d7

packet 2 (tag 18) in hex: = 01 + (Encrypted Data)


According to what i understand, this data will result in the output (both session key packet (tag 1) and encrypted data packet (tag 18)) of:

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

wY4D+UDEMBpnd50QAf92cuXMV6qhSz/aBd7gLs7einXuy4EwYCJMOQ5I84071BAx
ydRlm/qjYkavFFkwpI2LXcVhi0UG+1X2NH1b3f/AAf9F8VuE6Oe5Xf7wtSrOoQrv
TCCz/JuPfG8kh7LkO4v69d3rrt3AVkPDSOt4VVn6fddPdUK0Ss43Rtgp+/H2OSpT
0jcBXpY6dZxI+/KvkxxcV1onghMjzSg8JEkApg178RR74g6EmAAhWI/P2FdJRo5k
36riVBqrrCPX
=I+T/
-----END PGP MESSAGE-----


Can anyone tell me what I did wrong and how to fix it?

Anybody?

## closed as off-topic by e-sushiDec 7 '17 at 7:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Programming questions are off-topic even if you are writing or debugging cryptographic code. Unless your question is specifically about how the cryptographic algorithm, protocol or side-channel (mitigation) works, you should look into asking on Stack Overflow instead." – e-sushi
If this question can be reworded to fit the rules in the help center, please edit the question.