[Help-gnutls] Dynamically building the PSK keys

Nikos Mavrogiannopoulos nmav at gnutls.org
Thu Jul 16 21:48:00 CEST 2009


Ram G wrote:
> Finally I could complete the handshake using DHE-PSK. I followed the samples
> ex-client-psk.c and ex-serv-psk.c but instead of hardcoded keys, I
> dynamically assigned the keys as follows:
> 
> char * dynamickeys; //Could be any string with hex characters like DEADBEEF
> atohx(key->data,dynamickeys);

If you want to use passwords for psk please use
gnutls_psk_netconf_derive_key(). If you just want to convert hex to
binary data you can just use gnutls_hex_encode and decode. PSK works
with keys (not passwords) that are usually derived from a device such as
/dev/(u)random.

regards,
Nikos





More information about the Gnutls-help mailing list