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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PGP - Encrypt a File ???

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I need to PGP encrypt a file to send to a client.

I have some code which used to work and I assume that it is still working since that client has not complained.

BUT now I have a new client who wants their file PGP encrypted prior to sending.

I took the original working code and merely substituted the new client's info (the cClientDNCEmail below), but now I am getting an error message which is giving me absolutely no hint as to how to resolve the problem.

Code:
cClientDNCEmail = "clients.secure.ftp@TheirDomain.com"
* --- Define Where KeyRings 'live' ---
cPGPKeyDir = ADDBS(mcCommonDir) + "PGP Keyrings" 
cPubRing = ADDBS(mcPGPKeyDir) + "PubRing.pkr"
cPrivRing = ADDBS(mcPGPKeyDir) + "SecRing.skr"
* --- Input File = non-encrypted fully-pathed file name ---
cInputFile = "C:\Temp\NonEncryptedFile.txt"
* --- Output = Destination encrypted fully-pathed file name ---
cOutputFile = "C:\Temp\EncryptedFile.pgp"

oPGP = CREATEOBJECT("NSDPGP3Lib.PGP")
cRecipientID = oPGP.GetKeyIDFromUserID(cPubRing,cPrivRing, cClientDNCEmail)
oPGP.EncryptFile(cPubRing,cPrivRing,cInputFile,cOutputFile,0,0,cRecipientID)
cStatus = oPGP.AnalyzeFile(cOutputFile)
RELEASE oPGP

When the cRecipientID line of code is executed, an error message it thrown:
Error opening keyrings..
or sometimes
No valid keys found..

Neither of which message REALLY tells me anything as it relates to resolving the problem. Especially when you consider that the other client information works with this code.

I have confirmed that the fully pathed Keyring files (.pkr & .skr) and its path are valid.

How do I go about resolving this?

Any assistance you can offer would be greatly appreciated.

Thanks,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top