[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gnutls] Dynamically building the PSK keys

From: Ram G
Subject: [Help-gnutls] Dynamically building the PSK keys
Date: Mon, 13 Jul 2009 13:21:06 -0400


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 = "" (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 = "">

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]