Encrypt PDF in VFP

I need to be able to encrypt PDF documents in VFP programatically and then create a zip file with the encrypted PDF to email

Please assist.

Thanks
Shamina MaharajSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bbaoIT ConsultantCommented:
i would suggest this is to be done by calling command-line command from VFP instead of programming VFP to do so, simply because (1) VFP has been discontinued for a long while (10 years?) hence no update APIs or add-ons using latest algorithm in data encrypting, PDF generating and file compressing, and (2) not efficient to handle that using VFP.
0
Olaf DoschkeSoftware DeveloperCommented:
There are many levels on which encryption or cryptography could be applied. Are the specs really asking you to encrypt the whole PDF? Just like with XML can have encrypted values inside nonencrypted XML tags, a PDF can still be a PDF and have encrypted content, so it still opens in a PDF viewer and causes a login dialog there. VFP has no means to do that on its own, you depend on third-party PDF tools just like you generate PDF with a PDF printer and not with direct VFP code. It may even be just an option of a PDF printer to produce an encrypted PDF with a given key, certificate, or password. So look around and ask about such tools in general, this is not only for VFP.

To encrypt any files, that can be done separately or while zipping it. 7zip has options for that not only in its user interface, also as command options of 7z.exe, eg -ppassword for creating an AES encrypted zip archive.

If this is related to syncing files, notice anything you transfer via shared resources of a remote desktop connection is already protected with SSL as your typical remote connection is done via secured VPN SSL tunnel, so there actually is no need to encrypt files before transferring them, they are transfer encrypted anyway.

Bye, Olaf.
0
pcelbaCommented:
Free VFP Add-on libraries which can achieve your requirements exist already:

VFPEncryption can encrypt/decrypt any file or string: https://www.sweetpotatosoftware.com/blog/index.php/2009/08/09/major-vfp-encryption-update/

VFPCompression can create a ZIP file from string, file, or folder and also encrypt this ZIP in a way compatible with WinZIP:
https://www.sweetpotatosoftware.com/blog/index.php/2008/12/01/vfpcompression-update-fix-and-zipfile-comment-support/
0
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

jrbbldrCommented:
You need to ask yourself if you really need to ENCRYPT the PDF file itself or do you merely need to make it more difficult for the file to be opened and viewed.

If you only need to make it more difficult for the file to be opened and viewed - then you can Password protect the ZIP file containing the non-encrypted PDF.

However if you should need to actually ENCRYPT the PDF file itself, you might want to consider using GPGWin  ( https://www.gpg4win.org/GPGWin ).   It is a much easier to use version of the PGP encryption.
NOTE:  If you use it, you will need to share a 'key' with the recipient so that they can un-encrypt the file when they get it.

I used GPGWin on a project where the recipient was a LARGE company that felt that it needed to SECURE the file and its contents until they received it on their end.   On their end, they were using PGP and they had no difficulty handling the encrypted files that I sent to them.

Good Luck
0
Olaf DoschkeSoftware DeveloperCommented:
A password protected 7zip file just like WinZip means AES256 encryption. This is strong enough.

Bye, Olaf.
0
pcelbaCommented:
Additional option is to create PDF in VFP directly. You may use free FoxyPreviewer (https://archive.codeplex.com/?p=foxypreviewer) or paid XFRX (http://eqeus.com/) to generate encrypted PDFs from VFP report directly.

FoxyPreviewer should be moved to GitHub soon.
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pcelbaCommented:
Hi Shamina Maharaj,

did you find the solution from the answers? Do you have additional questions?

TIA
Pavel
0
pcelbaCommented:
Just for update - New Foxypreviewer web page is http://www.foxypreviewer.com/
1
Shamina MaharajSoftware DeveloperAuthor Commented:
Thanks guys, FoxyPreviewer has a built in encryption method which I've used to resolve the problem. Thank you for all the assistance
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Encryption

From novice to tech pro — start learning today.