🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.security.pgp
1 messages
1 total messages Started by C.J. Tue, 04 Sep 2001 18:34
[Q] : Cast5 PGP source function, help appreciated
#220
Author: C.J.
Date: Tue, 04 Sep 2001 18:34
48 lines
3416 bytes
Hello,

I am doing a program using the PGP 6.5.1i source code to do a tool that
brute-forces some private-key algorithms. I've read the OpenPGP RFC and
found that I should check the 9th and 10th bytes of plainttext in order to
check for a (maybe) correct password.

I've done that for IDEA with success, but now I am stick trying to do it
also for CAST5 (or CAST128). I am using the following code:

  // MD5 implementation, nextPass is the tried password
  MD5Init (&md5Context);
  MD5Update (&md5Context, (unsigned char*) nextPass, strlen(nextPass));
  MD5Final (&md5Context);

  // now we decrypt the first 10 bytes of the file, the random ones, using
CAST5  implementation from PGP source code
  // md5Context.digest is originally declared as byte[8] and byte as
"unsigned char*", the same as PGPUInt8*, but I'm using different source code
for the MD5 implementation (a fast one)
  CAST5schedule(xkey, (PGPUInt8*) md5Context.digest);
  CAST5decryptCFBdbl(xkey,0,0,0,0,lFirstTen,firstTenDeciphered,1);

Well, I've readed the PGP source code and learned the OpenPGP by heart and,
as far as I know, this should work (as it does for IDEA). But it doesn't.
Trying to decrypt a file ciphered with the "llois" password, I get:

Cast SBoxes Valid  (this is a test)
CAST5 test OK      (this is a general encryption-decription test, it does it
Ok)

MD5(llois) = C5 9B BF DB C6 D3 4E D2 DF 35 1B 69 F9 8B 1A FD  // MD5 for
"llois", checked
Key       = C5 9B BF DB C6 D3 4E D2 DF 35 1B 69 F9 8B 1A FD  // key used for
CAST5
10b       = F2 DF 6D 94 64 C9 A9 44 23 B8  // 10 bytes of the ciphered file,
they are the correct ones (checked)
CAST5-10b = 78 D0 F7 D7 A8 94 9F C4 A9 B7  // supposed plaintext once
decrypted

As you can see, the bytes aren't the same althoght the password is correct.
I have done a lot of testing but I must say that Im a little bit stuck by
now. Any help would be terribly appreciated.

Thanks in advance,

C. J.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads