Read DSA public key from file

Aki Tuomi cmouse at desteem.org
Mon Jan 3 12:27:36 CET 2011


On Sun, Jan 02, 2011 at 04:03:28PM +0100, Dirk Neumann wrote:
> Hi,
> 
> I try to create a S-expression which contains a DSA public key. As far
> as I understand the manual and the tests/, I have to use something like
> 
> error=gcry_sexp_build(&key_public,NULL,
>                       "(public-key(dsa(p%m)(q%m)(g%m)(y%m)))",
>                       p.size(),p.data(),q.size(),q.data(),
>                       g.size(),g.data(),y.size(),y.data());
> 
> All I have is an export of the DSA-public key from GPG. How can I
> decompose that stream into the components p,q,g,y? Is there a
> documentation of the format of GPG-exports (beside the GPG-source?) or
> a magic function which does that task?
> 
> 
> Thanks in advance,
> 
> Dirk.
> 

You could use GNUTLS to read the key:

http://www.gnu.org/software/gnutls/manual/html_node/Importing-OpenPGP-Keys-Guile-Example.html#Importing-OpenPGP-Keys-Guile-Example

Aki Tuomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: </pipermail/attachments/20110103/c4fbd89d/attachment.pgp>


More information about the Gcrypt-devel mailing list