EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Basic Questions

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#5164
Posted: 02/25/2008 09:46:11
by Michael Smith (Basic support level)
Joined: 02/25/2008
Posts: 3

Hi all,

I am new to using SBB. In my first attempt, I’m using SBB to pgp encrypt a file for a customer using their public key. The code appears to work, in that it outputs the pgp file and doesn’t error, however my client insist that they cannot open the file.

I am hoping that I am missing something basic in the code posted below. I really appreciate anyone's time and effort to look at this.

One thing I'm suspicous about is the second parameter in the keyring.Load call. It seems that this parameter "Secret Key" is required, but I dont need to use it (I dont think), so I'm passing in the public key again there.


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

keyring = new TElPGPKeyring();
keyring.Load(HttpRuntime.AppDomainAppPath + PGP_PUBLICKEY_PATH, HttpRuntime.AppDomainAppPath + PGP_PUBLICKEY_PATH, true);

publicKey = new TElPGPKeyring();
publicKey.AddPublicKey(keyring.get_PublicKeys(0));

Stream s = File.Open(ExportFilePath, FileMode.Open);
StreamReader sr = new StreamReader(s);

ExportFilePath = ExportFilePath + ".pgp";
fileName = fileName + ".pgp";

FileStream outF = new FileStream(ExportFilePath, FileMode.Create);

TElPGPWriter writer = new TElPGPWriter();
writer.EncryptingKeys = publicKey;
writer.UseNewFeatures = false;
writer.UseOldPackets = true;
writer.EncryptionType = SBPGP.TSBPGPEncryptionType.etPublicKey;
writer.Timestamp = DateTime.Now;
writer.Encrypt(sr.BaseStream, outF, 0);
------------

Thanks in advance for your help :)

Mike
#5166
Posted: 02/25/2008 09:57:02
by Eugene Mayevski (EldoS Corp.)

0) Pass empty string as the second parameter. Private ("secret") keys are not needed for encryption of the data.

As for the user who can't decrypt -
1) remove StreamReader from equation. It's buggy. This is stated in the FAQ.
2) try running the sample application and see if it works for the customer.
3) if the sample application works, then copy the code from there.
4) it can be (and this was discussed in the forum) that the data is encrypted for the key and for it's subkey. If you do the search in the forum for "subkey" word, you will probably find some information that will help you.
5) ask the customer about what exactly software (name and version are necessary) he uses to decrypt the data.

At the moment we can't help you further because the above steps must be taken by you.


Sincerely yours
Eugene Mayevski
#5188
Posted: 02/27/2008 16:37:21
by Michael Smith (Basic support level)
Joined: 02/25/2008
Posts: 3

Thanks for the feedback Eugene.

I've taken the following steps:

0) Complete
1) StreamReader replaced with MemoryStream
2) Encrypted file using sample application. Customer was unable to decrypt using PGP vers. 8.0 for Windows.

Are there any known compatibility problems with SBB and PGP vers. 8.0 for Windows?

Thanks,

Mike
#5189
Posted: 02/28/2008 02:11:33
by Eugene Mayevski (EldoS Corp.)

None. PGP 8.0 was our main testing platform for some time.

What exactly error message does the client get when decrypting the data? Without knowing this it's hard to guess the reasons.


Sincerely yours
Eugene Mayevski
#5263
Posted: 03/03/2008 15:50:23
by Michael Smith (Basic support level)
Joined: 02/25/2008
Posts: 3

I've just learned that the error they are getting isnt actually an error,. A prompt during their automatic decryption is causing the failure.

Assuming there is nothing special I can do to surpress prompts (warning that the file is encrypted), the problem appears to be with their decryption.

Mike
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.

Reply

Statistics

Topic viewed 2002 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!