Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET and PGP.

Status
Not open for further replies.

PogoWolf

Programmer
Mar 2, 2001
351
US
I hope this is the correct forum for this Question.
but here goes.

I've written an APP that creates two text files and then PGP encrpyts ONE of them.

However, now I need to encrypt the second file. Sounded like a simple matter. However, GpG (version: gpg (GnuPG) 1.2.1) can't find the second file after the first one is completed. If I wait a few moments, and then manually run the command line there isn't an issue in the world.

So, I believe I'm left with a caching issue.

Has anyone run into this problem before?


The PogoWolf
 
I have similar problem except it is opposite. I've decrypted many files and when I start decryption, error was raised that can not use the key because is already used. So I've solved with processes. Create a process for encryption job. Wait that process to end and then you can encrypt again.
 
I thought that might be an issue also, however in my Encrypt function, I so wait for the process to end.
with a Process.WaitForExit() command.

Though more testing it seems like .NET is calling the DOS command to quickly, so I've added a sleep timer between function calls.. but this also doesn't seem to work correctly...


The PogoWolf
 
GPG and PGP both have code in them to prevent their memory from being swapped to disk (if someone could read the swapfile, then they could potentially get your passphrase). So they both explicitly create a non-swappable memory region for their private use. Since the memory region is tied to the process name, this results in you only being able to run one copy at a time. If you try and call it too quickly, it thinks another copy is running and won't let you in.

The solution is to wait a moment and try again.

However, something you might try is copying the gpg executable to something like "gpg1.exe" and alternating your calls - first call the regular one, then call the copied one, and see how that works for you.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top