[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] ERROR: encrypted session key is bad (when trying
From:       David Hook <dgh () bund ! com ! au>
Date:       2008-02-12 23:38:28
Message-ID: 1202859508.3600.307.camel () echidna
[Download RAW message or body]


Something else you could try - does introducing/leaving out compression
make any difference? If you do a "gpg --list-packets" on the KGPG files
and the BC files are there any obvious differences?

Regards,

David

On Tue, 2008-02-12 at 17:53 -0500, Gabriel Alejandro Gomez Alegria
wrote:
> *David,
> 
> *
> 
> Thanks for your reply.
> 
> > Take a message generated by 6.5.8 and modify the BC source so you can
> > analyze the encrypted message produced by 6.5.8. Once you've picked up
> > on the difference it should be straightforward to tailor the BC code to
> > produce 6.5.8 messages.
> >   
> To be honest... this is the last thing i wanna do... so i'm leaving it 
> as a last resource
> > The other incompatibility below makes me wonder about one other thing -
> > does 6.5.8 only support ElGamal for encryption.
> >   
> well, this is what i did and what i obtained...
> 
> KGPG = PGP Linux
> PGPD = PGP Desktop
> NAPGP = Network Associates PGP 6.5.8
> BC = BouncyCastle
> 
> 1. Created 1 RSA and 1 DSS keypair in each PGP app, so i ended up with 8 
> keyrings
> 2. Exported priv and pub keys for each keyring and imported each of them 
> into every app. This way every app will have everybody keys
> 3. Tested different scenarios. These are the results
> 
> 3.1. Can each app encrypt and decrypt using its own keys (the ones 
> generated by each app)?
> KGPG = Yes
> PGPD = Yes
> NAPGP = Yes
> BC = Yes
> 
> 3.2. Can each app encrypt and decrypt using other apps private and 
> public keyrings (the ones imported)?
> KGPG = Yes, it can encrypt and decrypt using bot imported keyrings
> PGPD = Yes, it can encrypt and decrypt using bot imported keyrings
> NAPGP =  Can encrypt but CANT decrypt. When trying to decrypt using 
> imported keys (RSA and DSS) NAPGP produced the following error: "The 
> passphrase you entered does not match any of the usable listed keys.". I 
> double and tripple checked (disabling hide typing checkbox) ...password 
> was correct but NAPGP keept saying it wasn't. This happened for KGPG, 
> PGPD and BC keyrings.
> BC = Yes, it can using each pub and priv keyring file.
> 
> 3.3. Can each app decrypt files encrypted by other apps using shared 
> public keys?
> KGPG = Yes, it can decrypt files encrypted by PGPD, NAPGP and BC
> PGPD = Yes, it can decrypt files encrypted by KGPG, NAPGP and BC
> NAPGP =  Yes, it can decrypt  KGPG encrypted files.
> -When trying to decrypt PGPD encrypted files, NAPGP produced a windows 
> error saying: "PGP Encryption/Decryption has encountered a problem and 
> need to close". Decrypted file was 0k in size.
> -When trying to decrypt BC encrypted files, NAPGP produced "ERROR: 
> encrypted session key is bad"
> 
> BC= Yes, it can decrypt files encrypted by PGPD, NAPGP and KGPG
> 
> 3.3.1. Did these results change when enabling or disabling ASCII armor 
> or integrity check?
> No
> 3.3.2. Did these results change when changing Symmetric algorithm used?
> No
> 
> Hope this tests shed some ligth in the subject and maibe point to some 
> solution that doesn't involve digging deep into BC code and tailor a 
> particular solution for this version (i'm leaving it as a last resource ).
> 
> Thanks in advance.
> 
> > Regards,
> >
> > David
> >
> > On Mon, 2008-02-11 at 12:27 -0500, Gabriel Alejandro Gomez Alegria
> > wrote:
> >   
> >> David,
> >>
> >> Thanks for your reply.
> >>     
> >>> Unfortunately you'll need to see what's going on in the decryption step
> >>> as that's probably where 6.5.8 is picking up there is a session key
> >>> issue. You'll need to modify the source of the BC code to tell you what
> >>> is going on (as in what byte values are produced) when decryption takes
> >>> place.
> >>>   
> >>>       
> >> I'm officially lost here. How would I be able to see what Network 
> >> Associates PGP 6.5.8 is doing in the decryption step (Since 6.5.8 is not 
> >> open source). Or what you're telling me is to analize the encryption 
> >> process of BouncyCastle and based on that try to figure out what could 
> >> BC is doing wrong or different (for the record, I dont thinks BC is 
> >> doing anything wrong is that 6.5.8 is just too old! )??
> >>
> >> As i sayd earlier... Network associates PDP 6.5.8 can't decrypt what BC 
> >> encrypts. Also Network associates PDP 6.5.8 can't decrypt what Network 
> >> associates PDP 6.5.8  encrypts using  a RSA/DSSKeyring generated via BC.
> >>
> >>     
> >>> One other thing, some of the PGP products will produce errors like this
> >>> simply because they don't implement the symmetric key algorithm used. If
> >>> you haven't tested a couple of different algorithms it would be worth
> >>> doing that too.
> >>>       
> >> I tried this with every Simm algorithm offered by PGPEncryptedData.
> >>
> >>             PGPEncryptedDataGenerator   cPk = new PGPEncryptedDataGenerator(
> >>                     PGPEncryptedData.AES_128, //AES_192, AES_256, 
> >> Blowfish, cast5, DEs, idea, tripleDes, Twofish
> >>                     withIntegrityCheck,
> >>                     new SecureRandom(), "BC");
> >> but no good.
> >>
> >> I also did a mixed test with the above and
> >>
> >> (438) inLineIv[inLineIv.length - 3] = 0;
> >> (439) inLineIv[inLineIv.length - 4] = 0;
> >>
> >> but still no luck. Error keeps showing up :S
> >>
> >> Any more suggestions?
> >>
> >> Thanks in advance for any input you can give me.
> >>
> >>
> >>     
> >
> >
> >   
> 
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic