# OpenPGP tag 18/19 description confusion Continuation [closed]

After coming back to try to finish more of my OpenPGP implementation, I refound one of my questions http://stackoverflow.com/questions/6021360/openpgp-tag-18-19-description-confusion that I am still having trouble with.

This time however, I have been able to encrypt some data and get another program to decrypt it. The problem is, that I used tag 9 instead of tag 18+19. After rereading the answer to my question, it seemed quite straightforward. Unfortunately, my implementation disagrees with me.

MDC_hash = SHA-1(OpenPGP_CFB_extra_data + [plaintext] + "\xd3\x14")
encrypt(OpenPGP_CFB_extra_data + [plaintext] + "\xd3\x14" + MDC_hash)


what I am doing:

data (ASCII): 0123456789abcdef

after being placed inside a literal data packet:
plaintext = \xcb\x16\x74\x00\x00\x00\x00\x000123456789abcdef

"generated" prefix for CFB: \x51\x33\xc6\x4b\x4c\x77\x7b\x06\x4c\xfb\x71\xe3\xdd\xfb\xa1\x9f


here, tried hashing the data in 2 different ways (i think the correct data to hash is the second version):

sha1("\x51\x33\xc6\x4b\x4c\x77\x7b\x06\x4c\xfb\x71\xe3\xdd\xfb\xa1\x9f\xcb\x16\x74\x00\x00\x00\x00\x000123456789abcdef\xd3\x14") = (in hex) 8c2cf8ede9bd851d3dba76363ee32c4ca14e4643

and with the repeated last 2 prefix octets:

sha1("\x51\x33\xc6\x4b\x4c\x77\x7b\x06\x4c\xfb\x71\xe3\xdd\xfb\xa1\x9f\xa1\x9f\xcb\x16\x74\x00\x00\x00\x00\x000123456789abcdef\xd3\x14") = (in hex) 80f570ff8570ed11bea3e2afa826b10c66117fe4


then, I do the encryption on:

\x51\x33\xc6\x4b\x4c\x77\x7b\x06\x4c\xfb\x71\xe3\xdd\xfb\xa1\x9f\xa1\x9f\xcb\x16\x74\x00\x00\x00\x00\x000123456789abcdef\xd3\x14 + either hash


the result I get is PortablePGP/BouncyCastle complaining "unknown object in stream 15".

What am I doing wrong here? Is the error here in my thinking, or somewhere in my unposted code? I am fairly certain that my encrypt function is correct, since, as mentioned above, worked correctly, just not on packet type 18.

-

## closed as off-topic by Hendrik BrummermannJul 14 '13 at 9:50

• This question does not appear to be about cryptography within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

Hello calccrypto and welcome to Crypto SE. This site is about the mathematical concept behind cryptography, so I have migrated your question to StackOverflow. – Hendrik Brummermann Jul 14 '13 at 9:50