Newbie question - Importing keys
Rafael Martin
rafaelbuitre at yahoo.it
Mon May 8 10:57:21 CEST 2006
Hi,
I create a key pair using libgcrypt library:
gcry_ac_open (&handle, GCRY_AC_RSA, 0);
gcry_ac_key_pair_generate (handle, key_len, NULL, &key_pair, NULL);
then I extract public and private key:
key_sec = gcry_ac_key_pair_extract (key_pair, GCRY_AC_KEY_SECRET);
key_pub = gcry_ac_key_pair_extract (key_pair, GCRY_AC_KEY_PUBLIC);
and finally I write them to file:
data = gcry_ac_key_data_get(key_pub);
for (i=0; i<2; i++) {
gcry_ac_data_get_index(data,0,i,NULL,&tmp_mpi);
gcry_mpi_aprint(GCRYMPI_FMT_HEX,&value,&len,tmp_mpi);
fprintf(pub_fd," %s",value);
}
data = gcry_ac_key_data_get(key_sec);
for (i=0; i<6; i++) {
gcry_ac_data_get_index(data,0,i,NULL,&tmp_mpi);
gcry_mpi_aprint(GCRYMPI_FMT_HEX,&value,&len,tmp_mpi);
fprintf(priv_fd,"%s ",value);
}
fprintf(priv_fd,"\n");
fprintf(pub_fd,"\n");
Is it possible to use these keys with GnuPG(converting the format somehow)?
Thanks in advance!
Rafael Martin
More information about the Gcrypt-devel
mailing list