Main Page   Data Structures   File List   Data Fields   Globals  

keyex.h File Reference

Asymmetric key-exchange support. More...

#include <cyfer/cyfer.h>

Go to the source code of this file.

Data Structures

struct  CYFER_KeyEx_t
 A structure describing supported key-exchange algorithms. More...


Defines

#define CYFER_KEYEX_NONE   0
#define CYFER_KEYEX_DH   1

Typedefs

typedef void CYFER_KEYEX_CTX
 Key-exchange algorithm context.


Functions

CYFER_KeyEx_tCYFER_KeyEx_Get_Supported (void)
 Returns a list of supported key-exchange algorithms.

int CYFER_KeyEx_Select (const char *name)
 Selects key-exchange algorithm to use.

CYFER_KEYEX_CTXCYFER_KeyEx_Init (int type)
 Creates and initializes algorithm context.

void CYFER_KeyEx_Finish (CYFER_KEYEX_CTX *ctx)
 Finalizes the algorithm, destroys and frees the context.

void CYFER_KeyEx_Generate_Key (CYFER_KEYEX_CTX *ctx)
 Generates new public/private key pair.

void CYFER_KeyEx_KeySize (CYFER_KEYEX_CTX *ctx, size_t *privlen, size_t *publen)
 Returns private and public key lengths.

bool CYFER_KeyEx_Compute_Key (CYFER_KEYEX_CTX *ctx, unsigned char *other, size_t len)
 Computes shared key.

void CYFER_KeyEx_Public_Key (CYFER_KEYEX_CTX *ctx, unsigned char *key)
 Exports public key.

void CYFER_KeyEx_Shared_Key (CYFER_KEYEX_CTX *ctx, unsigned char *key, size_t len)
 Returns shared key.


Detailed Description

Asymmetric key-exchange support.


Define Documentation

#define CYFER_KEYEX_DH   1
 

#define CYFER_KEYEX_NONE   0
 


Typedef Documentation

typedef void CYFER_KEYEX_CTX
 

Key-exchange algorithm context.


Function Documentation

bool CYFER_KeyEx_Compute_Key CYFER_KEYEX_CTX   ctx,
unsigned char *    other,
size_t    len
 

Computes shared key.

Parameters:
ctx Algorithm context
other Other side's public key
len Other side's public key length
Returns:
True if shared key was successfully computed, false otherwise

void CYFER_KeyEx_Finish CYFER_KEYEX_CTX   ctx
 

Finalizes the algorithm, destroys and frees the context.

Parameters:
ctx Algorithm context

void CYFER_KeyEx_Generate_Key CYFER_KEYEX_CTX   ctx
 

Generates new public/private key pair.

Parameters:
ctx Algorithm context

CYFER_KeyEx_t* CYFER_KeyEx_Get_Supported void   
 

Returns a list of supported key-exchange algorithms.

CYFER_KEYEX_CTX* CYFER_KeyEx_Init int    type
 

Creates and initializes algorithm context.

Parameters:
type An integer representing algorithm to use
Returns:
An initialized hash context, or NULL in case of error

void CYFER_KeyEx_KeySize CYFER_KEYEX_CTX   ctx,
size_t *    privlen,
size_t *    publen
 

Returns private and public key lengths.

Parameters:
ctx Algorithm context
privlen [output] Shared key length
publen [output] Public key length

void CYFER_KeyEx_Public_Key CYFER_KEYEX_CTX   ctx,
unsigned char *    key
 

Exports public key.

Parameters:
ctx Algorithm context
key [output] Buffer for public key data

int CYFER_KeyEx_Select const char *    name
 

Selects key-exchange algorithm to use.

Parameters:
name Algorithm name
Returns:
An integer representing the selected algorithm

void CYFER_KeyEx_Shared_Key CYFER_KEYEX_CTX   ctx,
unsigned char *    key,
size_t    len
 

Returns shared key.

Parameters:
ctx Algorithm context
key [output] Buffer for shared key data
len Desired length of shared key
Note:
If desired length is smaller than the shared key size, only a part of the key is returned. If it is larger, the key is repeated.


Generated on Sun Sep 26 13:53:58 2004 for Cyfer by doxygen1.3-rc3