[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reading private key file
From: |
Nikos Mavrogiannopoulos |
Subject: |
Re: reading private key file |
Date: |
Thu, 1 Dec 2011 17:39:17 +0100 |
On Thu, Dec 1, 2011 at 5:24 PM, Rainer Gerhards <address@hidden> 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