reading private key file
Nikos Mavrogiannopoulos
nmav at gnutls.org
Thu Dec 1 17:39:17 CET 2011
On Thu, Dec 1, 2011 at 5:24 PM, Rainer Gerhards <rgerhards at gmail.com> wrote:
> Hi all,
>
> I am banging my head for quite some while now and hope to find some
> help here. I am unable to read a private key that I have generated
> with certtool.
> I do this
>
> $ certtool --generate-privkey --outfile test.key
> then I call my (test) program and make it try to read/import test.key
> via these statements:
>
> data.size = fread (buffer, 1, sizeof (buffer) - 1, infile);
> buffer[data.size] = 0;
> data.data = buffer;
> r = gnutls_x509_privkey_init(&key);
I don't know what is wrong with your program, but certtool uses the
same idea to load a key (see privkey_info()), so if certtool can read
the key so should you (unless you provide bad data, or you didn't call
gnutls_global_init()).provide to the function.
regards,
Nikos
More information about the Gnutls-help
mailing list