



@deftypefun {int} {gnutls_privkey_derive_secret} (gnutls_privkey_t @var{privkey}, gnutls_pubkey_t @var{pubkey}, const gnutls_datum_t * @var{nonce}, gnutls_datum_t * @var{secret}, unsigned int @var{flags})
@var{privkey}: a private key of type @code{gnutls_privkey_t} 

@var{pubkey}: a public key of type @code{gnutls_pubkey_t} 

@var{nonce}: an optional nonce value

@var{secret}: where shared secret will be stored

@var{flags}: must be zero

This function will calculate a shared secret from our  @code{privkey} and
peer's  @code{pubkey} . The result will be stored in  @code{secret} , whose data
member should be freed after use using @code{gnutls_free()} .  @code{privkey} and
 @code{pubkey} must be backed by the X.509 keys.

@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
negative error value.

@strong{Since:} 3.8.2
@end deftypefun
