Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using GPG with C?

Tags:

c

gnupg

I am writing a communication program in C and I am looking for the best way to use GnuPG encryption. I am already using symmetric encryption algorithms via the mcrypt library but wish to incorporate some public-key capabilities, preferably using GnuPG if possible. Is there a good library available to accomplish this? Would it be better to try to interact with GPG itself directly via the program to accomplish this? Any insight would be appreciated as I would like to keep this implementation as clean as possible. Thanks.

like image 516
majic bunnie Avatar asked Jan 05 '12 17:01

majic bunnie


1 Answers

Unfortunately, GnuPG is designed to be used interactively, and not as an API.

You mention that you are looking to incorporate some public-key capabilities. SSL and TLS are alternatives to GPG which see much more frequent use.

If public-key capabilities in general are what you seek, GnuTLS is an API for use in network based programs that provides exactly what you want. It enjoys a great deal of support, and provides SSL and TLS public-key encryption capabilities.

However, if you are dead set on using GPG, GPGME is a project that exists to wrap an API around GPG. I have not used it and cannot advise on its use, but suspect that it may be somewhat forced.

like image 133
Swiss Avatar answered Oct 01 '22 11:10

Swiss