EldoS | Feel safer!

Software components for data protection, secure storage and transfer

EncryptAndSignFile Freezes

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.
Posted: 11/26/2008 13:45:05
by Patrick Ferre (Basic support level)
Joined: 11/24/2008
Posts: 3

I am writing a simple app in Deplhi 5 that will go through all the files in a given directory and encrypt them. For the actual file encryption, I used the logic for the ProtectFile function in the Files Example program. It worked just fine. Then I tried to comment out the call to EncryptFile and replace it with EncryptAndSignFile since the client wants the files signed as well as encrypted. Now it dies. I have traced it in debug and it gets to the function call then stops cold. It does not throw any exception I can catch. I am new to the whole encryption game so any insight you might have would be appreciated. Below is my modified ProtectFile function. The various pgp writer properties are read in from registry settings, and I have verified they are all being set correctly. The key files I am using, I created in the Keys Example program, and they load into the pgp keyring successfully. Thanks.

procedure ZTaskWormhole.ProtectFile(const SourceFile, DestFile: string);
i, j : Integer;
FpgpWriter.Armor := true;
FpgpWriter.ArmorHeaders.Add('Version: EldoS OpenPGPBlackbox');
FpgpWriter.ArmorBoundary := 'PGP MESSAGE';
FpgpWriter.Compress := FCompressionAlgorithm <> SB_PGP_ALGORITHM_CM_UNCOMPRESSED;
FpgpWriter.EncryptingKeys := FpgpKeyring;
FpgpWriter.SigningKeys := FpgpKeyring;
FpgpWriter.CompressionLevel := 9;
FpgpWriter.CompressionAlgorithm := FCompressionAlgorithm;

if FPassphrase = '' then
FpgpWriter.EncryptionType := etPublicKey
FpgpWriter.EncryptionType := FEncryptionType;;

FpgpWriter.Filename := SourceFile;
FpgpWriter.InputIsText := False;
if FPassphrase <> '' then

FpgpWriter.Protection := FProtection;
FpgpWriter.HashAlgorithm := FHashAlgorithm;
FpgpWriter.SignBufferingMethod := sbmRewind;
FpgpWriter.SymmetricKeyAlgorithm := FSymmetricKeyAlgorithm;

FpgpWriter.Timestamp := Now;
FpgpWriter.UseNewFeatures := False;
FpgpWriter.UseOldPackets := false;

//FpgpWriter.EncryptFile(SourceFile, DestFile);
for i := 0 to FpgpKeyring.SecretCount -1 do begin
FpgpKeyring.SecretKeys[i].Enabled := True;
for j := 0 to FpgpKeyring.SecretKeys[i].SubkeyCount-1 do
FpgpKeyring.SecretKeys[i].Subkeys[j].Enabled := True;
FpgpWriter.EncryptAndSignFile(SourceFile, DestFile);
on e : Exception do ShowMessage(e.Message);
Posted: 11/27/2008 04:47:29
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 450

Hi, thank you for interest in our product.
What is the size of the input file? Have you set the passphrase for the secret key(s) which you are using for signing? Does it happen with every file, or with a particular one? How many keys in the keyring?



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