EldoS | Feel safer!

Software components for data protection, secure storage and transfer

encrypted session key is bad? 3rd party decrypt

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
#504
Posted: 06/21/2006 11:41:58
by George Freeman (Basic support level)
Joined: 06/16/2006
Posts: 9

I'm trying to encrypt a file using a 3rd parties public key. When decrypting, they get the message
"encrypted session key is bad".

Using my code and secureblack box, I am able to encrypt and decrypt. I am able to encrypt with secure black box and decrypt in gnupg with keys (2048 bit elgamal) generated by secure black box and via gnupg but the 3rd party is unable to decrypt it.

Their key was generated in PGP 6.5.3 and that is what they're using for decryption.

Any suggestions?

I've seen somewhat similar messages on google and they emply the encryption method or signature may be out of sink. Is there a way to set this?

Are there other parameters that I should be setting?

Here is the code I'm using taken almost directly from the PGPFilesDemo.
public void Encrypt(string keyFile, string sourceFile, string targetFile)
{

SBUtils.Unit.SetLicenseKey(SBUtils.Unit.BytesOfString("..."));

SBPGP.TElPGPWriter pgpWriter;
SBPGPKeys.TElPGPKeyring pubKeyring;
SBPGPKeys.TElPGPKeyring keyring ;

pgpWriter = new SBPGP.TElPGPWriter();
pgpWriter.Armor = false;
pgpWriter.ArmorBoundary = null;
pgpWriter.Compress = false;
pgpWriter.CompressionAlgorithm = 1;
pgpWriter.CompressionLevel = 9;
pgpWriter.EncryptingKeys = null;
pgpWriter.EncryptionType = SBPGP.TSBPGPEncryptionType.etPublicKey;
pgpWriter.Filename = null;
pgpWriter.InputIsText = false;
pgpWriter.Protection = SBPGPConstants.TSBPGPProtectionType.ptNormal;
pgpWriter.SignBufferingMethod = SBPGP.TSBPGPSignBufferingMethod.sbmRewind;
pgpWriter.SigningKeys = null;
pgpWriter.TextCompatibilityMode = true;
pgpWriter.Timestamp = new System.DateTime(((long)(0)));
pgpWriter.UseNewFeatures = true;
pgpWriter.UseOldPackets = false;

pubKeyring = new SBPGPKeys.TElPGPKeyring();
keyring = new SBPGPKeys.TElPGPKeyring();
pubKeyring.Clear();
keyring.Load(keyFile,"",true);
//string name = "";
int i;
for(i = 0; i < keyring.PublicCount; i++)
{
pubKeyring.AddPublicKey(keyring.get_PublicKeys(i));
}

pgpWriter.EncryptingKeys = pubKeyring;
System.IO.FileInfo info = new System.IO.FileInfo(targetFile);
pgpWriter.Filename = info.FullName ;

System.IO.FileStream inF = new System.IO.FileStream(sourceFile, FileMode.Open);
System.IO.FileStream outF = null;
try
{
System.IO.FileInfo tmpFI = new System.IO.FileInfo(targetFile);
if (tmpFI.Exists)
{
tmpFI.Delete();
}

outF = new System.IO.FileStream(targetFile, FileMode.Create);
try
{
pgpWriter.Encrypt(inF, outF, 0);
}
finally
{
outF.Close();
}
}
finally
{
inF.Close();
}

}



Any suggestions?

#505
Posted: 06/21/2006 12:00:42
by Eugene Mayevski (EldoS Corp.)

Hmm, and why do you address the question to us, and not to 3rdparty software maker? If gnupg can decrypt it, then the file is written correctly.


Sincerely yours
Eugene Mayevski
#506
Posted: 06/21/2006 12:33:53
by George Freeman (Basic support level)
Joined: 06/16/2006
Posts: 9

I'm addressing it to you since you have more experience in this area than I do, I was hoping you had some insight into what I could do on my end to attempt to make it more compatible and since I'm contemplating buying your product -- if I can get it to work with this 3rd party.

I've seen a couple of comments about compatability with versions and implementations specificially regarding the usenewfeatures, useoldpackets, TextCompatibilityMode, TSBPGPProtectionType, etc properties and wondered if you had any suggestions.

#507
Posted: 06/21/2006 13:30:46
by Eugene Mayevski (EldoS Corp.)

Quote
George Freeman wrote:
I'm addressing it to you since you have more experience in this area than I do, I was hoping you had some insight into what I could do on my end to attempt to make it more compatible and since I'm contemplating buying your product -- if I can get it to work with this 3rd party.


1) I don't say that you must be left without help. But if the valid data (and they are valid since they can be handled by GnuPG and PGP) can't be read by some unknown software, it's not our job to track the bug, but the job of the makers of that software. This is what I tried to explain.

2) Without complete information about what the software is, the keys and *everything* else that is needed to reproduce the issue (encrypted files, sample project etc.) we won't be able to help you.

The only idea that comes to my mind is set UseNewFeatures to False and UseOldPackets to true.


Sincerely yours
Eugene Mayevski
#513
Posted: 06/21/2006 14:36:13
by George Freeman (Basic support level)
Joined: 06/16/2006
Posts: 9

Quote
The only idea that comes to my mind is set UseNewFeatures to False and UseOldPackets to true.


This is what I was looking for.

The 3rd party is now able to decrypt a small file when I use
pgpWriter.UseNewFeatures = false;
pgpWriter.UseOldPackets = false;

So if I'm reading the docs right, it appears their version is compatable and not compatable with pgp 2.6 :)

I'll try one with your suggestions and see if that works as well.
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

Topic viewed 6299 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!