tfPresharedKeyAdd

Jump to: navigation, search

Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference


#include <trsocket.h>


int tfPresharedKeyAdd (
char TM_FAR * idPtr,
char TM_FAR * keyDataPtr,
int options
);


Function Description

This function adds an entry to the pre-shared key database. The user must define TM_USE_IKE to use this function.


Parameters

  • idPtr
    Pointer to the Identity of the IKE peer, with which we are going to use the preshared key. It could be a valid null-terminated IPv4, IPv6 address string, or fully qualified domain name string or username string.
  • keyDataPtr
    Pointer to the pre-shared key null-ended string. Although pre-shared key is not necessarily ASCII string, there is no obvious disadvantage to use ASCII string to be pre-shared key.
  • options
    Not currently used


Returns

  • TM_ENOERROR
    Success.
  • TM_ENOBUFS
    No memory available.


Example This example adds a pre-shared key entry for peer "2.2.2.1", so that whenever we negotiate SA’s with peer "2.2.2.1", we are going to use pre-shared key "GasdfHOPS99adfsad323$$$"

 
{
    ...
    errorCode = tfPresharedKeyAdd("2.2.2.1", 
                                  "GasdfHOPS99adfsad323$$$", 
                                  0);
    ... 
}
 
 

Table of Contents >> IPsec/IKE Programmer's Reference >> IPsec/IKE Function Reference