[Help-gnutls] Dynamically building the PSK keys
Ram G
mydevforums at gmail.com
Mon Jul 13 19:21:06 CEST 2009
Hi,
I'm working on the sample programs provided in the source examples folder
and I would like some help from you. I'm trying to do a DH key exchange with
PSK authentication.
The client sample (ex-client-psk.c) assigns the pre shared key as follows:
const gnutls_datum_t key = { (char*) "DEADBEEF", 8 };
The server sample (ex-serv-psk.c) does the key assignment in the callback
function pskfunc as follows:
key->data = gnutls_malloc (4);
key->data[0] = 0xDE;
key->data[1] = 0xAD;
key->data[2] = 0xBE;
key->data[3] = 0xEF;
key->size = 4;
I would like to assign the pre-shared key dynamically. If I assign the PSK
in the server as follows, it does not work. I get the error "Decryption has
failed".
char * somekey = "DEADBEEF";
key -> data = somekey;
My question is : since data in the struct gnutls_datum_t has been defined as
unsigned char, why doesn't this assignment work ?
Can you please help me how I can make the PSK keys to be dynamic and make
the authentication to succeed ?
I'll really appreciate your help.
Ram G
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20090713/89156d12/attachment.htm>
More information about the Gnutls-help
mailing list