🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.security.pgp
Article #220

[Q] : Cast5 PGP source function, help appreciated

#220
From: 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.
Technical Details
Message-ID: <9n36bv$olq$1@diana.bcn.ttd.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeeds.belnet.be!news.belnet.be!newsmi-eu.news.garr.it!newsmi-us.news.garr.it!NewsITBone-GARR!newsfeed.mad.ttd.net!news.mad.ttd.net!news.bcn.ttd.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fa6b9,2637886d3119c327,start
X-Google-Attributes: gidfa6b9,public
X-Google-Thread: 1157a3,2637886d3119c327,start
X-Google-Attributes: gid1157a3,public
X-Google-Thread: fbd70,2637886d3119c327,start
X-Google-Attributes: gidfbd70,public
X-Google-Thread: f7e0e,2637886d3119c327,start
X-Google-Attributes: gidf7e0e,public
X-Google-Thread: 10304d,2637886d3119c327,start
X-Google-Attributes: gid10304d,public
X-Google-Thread: 1382bc,2637886d3119c327,start
X-Google-Attributes: gid1382bc,public
X-Google-ArrivalTime: 2001-09-04 11:39:22 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newsfeeds.belnet.be!news.belnet.be!newsmi-eu.news.garr.it!newsmi-us.news.garr.it!NewsITBone-GARR!newsfeed.mad.ttd.net!news.mad.ttd.net!news.bcn.ttd.net!not-for-mail
From: "C.J." <no@spam.com>
Newsgroups: alt.security.pgp,comp.security.pgp.tech,es.comp.seguridad.pgp,fido.belg.pgp,it.comp.sicurezza.pgp,japan.security.pgp
Subject: [Q] : Cast5 PGP source function, help appreciated
Date: Tue, 4 Sep 2001 20:34:01 +0200
Organization: Telefonica Transmision de Datos
Lines: 51
Message-ID: <9n36bv$olq$1@diana.bcn.ttd.net>
NNTP-Posting-Host: 213.4.19.224
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400