post quantum cryptography
Highly optimized implementation of the NTRUEncrypt algorithm
 All Data Structures Files Functions Variables Typedefs Macros Pages
Functions
ntru_keypair.c File Reference

key creation and operations More...

#include "ntru_ascii_poly.h"
#include "ntru_file.h"
#include "ntru_keypair.h"
#include "ntru_params.h"
#include "ntru_poly.h"
#include "ntru_poly_ascii.h"
#include "ntru_string.h"
#include <fmpz_poly.h>
#include <fmpz.h>
#include <stdbool.h>
#include <string.h>
Include dependency graph for ntru_keypair.c:

Go to the source code of this file.

Functions

bool ntru_create_keypair (fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
 
void export_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
 
void export_priv_key (char const *const filename, fmpz_poly_t priv, ntru_params *params)
 
void import_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
 
void import_priv_key (char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
 
void ntru_delete_keypair (keypair *pair)
 

Detailed Description

key creation and operations

This file handles the creation of the key pair and possibly common operations on them.

Definition in file ntru_keypair.c.

Function Documentation

void export_priv_key ( char const *const  filename,
fmpz_poly_t  priv,
ntru_params params 
)

Export the private key to a file.

Parameters
filenamethe file to save the private key into
privthe private key
paramsthe NTRU context

Definition at line 111 of file ntru_keypair.c.

void export_public_key ( char const *const  filename,
fmpz_poly_t  pub,
ntru_params params 
)

Export the public key to a file.

Parameters
filenamethe file to save the public key into
pubthe public key
paramsthe NTRU context

Definition at line 96 of file ntru_keypair.c.

void import_priv_key ( char const *const  filename,
fmpz_poly_t  priv,
fmpz_poly_t  priv_inv,
ntru_params params 
)

Import the private key from a file and store him along with his inverse.

Parameters
filenamethe file to get the private key from
privwhere to save the private key [out]
priv_invwhere to save the inverse of the private key [out]
paramsthe NTRU context

Definition at line 157 of file ntru_keypair.c.

void import_public_key ( char const *const  filename,
fmpz_poly_t  pub,
ntru_params params 
)

Import the public key from a file.

Parameters
filenamethe file to get the public key from
pubwhere to save the public key [out]
paramsthe NTRU context

Definition at line 132 of file ntru_keypair.c.

bool ntru_create_keypair ( fmpz_poly_t  f,
fmpz_poly_t  g,
keypair pair,
ntru_params params 
)

Creates an NTRU key pair, consisting of public and private components.

Parameters
fa random polynomial
ga random polynomial
pairstore private and public components here [out]
paramsthe NTRU context
Returns
true for success, false if f or g are not invertible (then the caller hast to try different ones)

Definition at line 47 of file ntru_keypair.c.

void ntru_delete_keypair ( keypair pair)

Used to free the inner structure of a keypair. This will not call free() on the pair itself.

Parameters
pairthe pair to free the inner structure of

Definition at line 197 of file ntru_keypair.c.