EldoS | Feel safer!

Software components for data protection, secure storage and transfer


Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
Posted: 07/13/2006 15:57:54
by Bob Hope (Basic support level)
Joined: 07/12/2006
Posts: 13

I've been going through the examples, but they include a lot of extra code and controls that aren't relative to my current situation.
I could really use a simple example of EncryptAndSign. I'm afraid I don't have a firm grasp on PGP and any help would be greatly appreciated.
I have to send an encrypted and signed file. I have a partner's public key. I have my secret key.
I have loaded 2 keyrings. One has the partner's public key for encryption, one has my secret key for signing.
I set my passphrase for the secret key I am signing with.
When I call EncryptAndSign I get "Signing failed (secret key mismatch/passphrase not provided?)"

pgpWriter = new TElPGPWriter();
pgpWriter.Filename = fsOutput.Name;
pgpWriter.Timestamp = DateTime.Now;
pgpWriter.Compress = true;
pgpWriter.CompressionLevel = 9;
pgpWriter.UseNewFeatures = true;
pgpWriter.UseOldPackets = false;
pgpWriter.EncryptingKeys = pubKeyRing;
pgpWriter.SigningKeys = secKeyRing;
pgpWriter.SigningKeys.get_SecretKeys( 0 ).Passphrase = m_keyPassPhrase;
pgpWriter.EncryptionType = TSBPGPEncryptionType.etPublicKey;

//encrypt and write to the output file
pgpWriter.EncryptAndSign( fsInput, fsOutput, 0 );

I've tried for hours working through the examples. I'm not sure what I'm doing wrong...
Posted: 07/13/2006 16:09:30
by Ken Ivanov (EldoS Corp.)

You are doing everything right. Would you be so kind to provide us a call stack that takes place when the exception is thrown (please remember to switch on the 'show non-user/external code' checkbox)?
Posted: 07/13/2006 16:32:42
by Bob Hope (Basic support level)
Joined: 07/12/2006
Posts: 13

Thank you for your help. Not sure if this will be of much help to you. I turned on the checkbox. This problem is killing me. lol
I executed the pgpWriter.SigningKeys.get_SecretKeys(0).PassphraseValid() method directly before calling EncryptAndSign and it returned true.
Does that mean the only thing left is a mismatch error?
I know I'm doing something wrong because I can run these keys and encrypt the file with your demo and it works fine...
Your help is greatly appreciated.

[ Download ]
Posted: 07/13/2006 16:55:14
by Bob Hope (Basic support level)
Joined: 07/12/2006
Posts: 13

Here is the stacktrace

at SBPGP.TElPGPWriter.@12$CalculateSignatures$SignWithKey(TElPGPWriter Self, TElPGPCustomSecretKey Key)

at SBPGP.TElPGPWriter.CalculateSignatures()

at SBPGP.TElPGPWriter.EncryptAndSign(Stream ASourceStream, Stream ADestStream, Int32 Count)

at SMC_PGP.Manager.EncryptSingle(String fileName, String outputFileName, String partnerPublicKey) in E:\\Projects\\SMC_PGP\\Manager.cs:line 406
Posted: 07/13/2006 17:14:30
by Ken Ivanov (EldoS Corp.)

We re-checked the code. The error you described is fired in the following situations:
a) the supplied passphrase does not match the key,
b) unknown hash or public key algorithm is attempted to be used (does not seem to be your case).

Please try to pass the passphrase via OnKeyPassphrase event instead of assigning it directly to a key and check if it helps.
Posted: 07/13/2006 17:45:14
by Bob Hope (Basic support level)
Joined: 07/12/2006
Posts: 13

Using the OnKeyPassphrase worked! Thank you for the help.
Posted: 07/13/2006 18:00:04
by Ken Ivanov (EldoS Corp.)

Thank you for letting us know about it. From our side, we will check what prevents the document from being correctly signed if password is passed via ElPGPSecretKey.Passphrase property.
Posted: 07/14/2006 03:18:07
by Ken Ivanov (EldoS Corp.)

Would you be so kind to check, does this problem appear with sample keys included to the distribution too? The sample keys are located in %INSTALLDIR%\PGPKeys folder.
Posted: 07/14/2006 09:34:16
by Bob Hope (Basic support level)
Joined: 07/12/2006
Posts: 13

Hey - I used the sample keys by setting the Passphrase property and it works fine. Weird!
No matter how I sign with SecureBlackBox, Desktop PGP says the signature is invalid...
I hope this helps.
Posted: 07/14/2006 09:48:25
by Eugene Mayevski (EldoS Corp.)

1) Does PGP complain about the broken signature even with sample keys or only with your keys?
2) Can you please send the public keyring and the signed file to support@eldos.com or post it directly to HelpDesk (http://www.eldos.com/support/ticket_list.php)?

Sincerely yours
Eugene Mayevski
Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.



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