Import/export functions


Functions

void CST_import_PKCS12 (CST *st, FILE *file, cst_pkcs12_confirm_cb confirm_cb, cst_pkcs12_error_cb error_cb, unsigned char *password, void *user_data, GError **error)
int CST_import_cert (CST *st, FILE *file, unsigned char *password)
int CST_import_cert_DER (CST *st, FILE *file)
int CST_import_cert_f (CST *st, FILE *file, unsigned char *password, const cst_t_cert_folder folder)
int CST_import_cert_f_DER (CST *st, FILE *file, const cst_t_cert_folder folder)
cst_t_seqnum CST_import_cert_adv (CST *st, FILE *file, const cst_t_cert_folder folder, GError **error)
cst_t_seqnum CST_import_cert_adv_DER (CST *st, FILE *file, const cst_t_cert_folder folder, GError **error)
int CST_export_all (CST *st, FILE *file, const cst_t_cert_folder folder)
int CST_export_all_DER (CST *st, FILE *file, const cst_t_cert_folder folder)
int CST_export_cert (CST *st, X509 *cert, FILE *file)
int CST_export_cert_DER (CST *st, X509 *cert, FILE *file)
int CST_export_cert_by_id (CST *st, const cst_t_seqnum certID, FILE *file)
int CST_export_cert_by_id_DER (CST *st, const cst_t_seqnum certID, FILE *file)
int CST_import_priv_key (CST *st, X509_NAME *account, FILE *file, unsigned char *inpass, unsigned char *outpass)
int CST_import_priv_key_DER (CST *st, X509_NAME *account, FILE *file, unsigned char *outpass)
cst_t_seqnum CST_import_priv_key_adv (CST *st, X509_NAME *account, FILE *file, unsigned char *inpass, unsigned char *outpass, GError **error)
cst_t_seqnum CST_import_priv_key_adv_DER (CST *st, X509_NAME *account, FILE *file, unsigned char *outpass, GError **error)
int CST_export_priv_key (CST *st, EVP_PKEY *key, FILE *file, unsigned char *password)
int CST_export_priv_key_DER (CST *st, EVP_PKEY *key, FILE *file, unsigned char *password)
int CST_import_pub_key (CST *st, X509_NAME *account, FILE *file)
int CST_import_pub_key_DER (CST *st, X509_NAME *account, FILE *file)
cst_t_seqnum CST_import_pub_key_adv (CST *st, X509_NAME *account, FILE *file, GError **error)
cst_t_seqnum CST_import_pub_key_adv_DER (CST *st, X509_NAME *account, FILE *file, GError **error)
int CST_export_all_pub_key (CST *st, X509_NAME *account, FILE *file)
int CST_export_all_pub_key_DER (CST *st, X509_NAME *account, FILE *file)
int CST_export_pub_key (CST *st, EVP_PKEY *key, FILE *file)
int CST_export_pub_key_DER (CST *st, EVP_PKEY *key, FILE *file)

Function Documentation

int CST_export_all ( CST st,
FILE *  file,
const cst_t_cert_folder  folder 
)

Export all certificates to the file (PEM format).

Parameters:
st Pointer to storage structure
file Output file
folder Folder which need export
Returns:
Error code
Possible error: CST_ERROR_CREATE_FILE

int CST_export_all_DER ( CST st,
FILE *  file,
const cst_t_cert_folder  folder 
)

Export all certificates to the file (DER format).

Parameters:
st Pointer to storage structure
file Output file
folder Folder which need export
Returns:
Error code
Possible error: CST_ERROR_CREATE_FILE

int CST_export_all_pub_key ( CST st,
X509_NAME *  account,
FILE *  file 
)

Export all public keys with given account to file (PEM format)

Parameters:
st Pointer to storage structure
account Key for identify key
file Output file
Returns:
Error code
Possible error: CST_ERROR_NOT_FOUND, CST_ERROR_KEY_NOTFOUND

int CST_export_all_pub_key_DER ( CST st,
X509_NAME *  account,
FILE *  file 
)

Export all public keys with given account to file (DER format)

Parameters:
st Pointer to storage structure
account Key for identify key
file Output file
Returns:
Error code
Possible error: CST_ERROR_NOT_FOUND, CST_ERROR_KEY_NOTFOUND

int CST_export_cert ( CST st,
X509 *  cert,
FILE *  file 
)

Export selected certificate to the file (PEM format)

Parameters:
st Pointer to storage structure
cert Same cert (X509 structure)
file Output file
Returns:
Error code
Possible error: CST_ERROR_CREATE_FILE

int CST_export_cert_by_id ( CST st,
const cst_t_seqnum  certID,
FILE *  file 
)

Export selected certificate (by certID) to the file (PEM format)

Parameters:
st Pointer to storage structure
certID Certificate ID
file Output file
Returns:
Error code
Possible error: CST_ERROR_CREATE_FILE

int CST_export_cert_by_id_DER ( CST st,
const cst_t_seqnum  certID,
FILE *  file 
)

Export selected certificate (by certID) to the file (DER format)

Parameters:
st Pointer to storage structure
certID Certificate ID
file Output file
Returns:
Error code
Possible error: CST_ERROR_CREATE_FILE

int CST_export_cert_DER ( CST st,
X509 *  cert,
FILE *  file 
)

Export selected certificate to the file (DER format)

Parameters:
st Pointer to storage structure
cert Same cert (X509 structure)
file Output file
Returns:
Error code
Possible error: CST_ERROR_CREATE_FILE

int CST_export_priv_key ( CST st,
EVP_PKEY *  key,
FILE *  file,
unsigned char *  password 
)

Export private key with given account to file (PEM format)

Parameters:
st Pointer to storage structure
key Pointer to key
file Output file
password Password for exported keys
Returns:
Error code
Possible error: CST_ERROR_NOT_FOUND

int CST_export_priv_key_DER ( CST st,
EVP_PKEY *  key,
FILE *  file,
unsigned char *  password 
)

Export private key with given account to file (DER format)

Parameters:
st Pointer to storage structure
key Pointer to key
file Output file
password Password for exported keys
Returns:
Error code
Possible error: CST_ERROR_NOT_FOUND

int CST_export_pub_key ( CST st,
EVP_PKEY *  key,
FILE *  file 
)

Export public key with given account to file (PEM format)

Parameters:
st Pointer to storage structure
key Pointer to key
file Output file
Returns:
Error code
Possible error: CST_ERROR_NOT_FOUND, CST_ERROR_KEY_NOTFOUND

int CST_export_pub_key_DER ( CST st,
EVP_PKEY *  key,
FILE *  file 
)

Export public key with given account to file (DER format)

Parameters:
st Pointer to storage structure
key Pointer to key
file Output file
Returns:
Error code
Possible error: CST_ERROR_NOT_FOUND, CST_ERROR_KEY_NOTFOUND

int CST_import_cert ( CST st,
FILE *  file,
unsigned char *  password 
)

Import certificate from the file (PEM format).

Parameters:
st Pointer to storage structure
file Input file
password Password for open file or NULL if password is empty
Returns:
Error code
Possible error:

CST_ERROR_NOT_FOUND - certificate not found in file or format incorrect

CST_ERROR_DBSTRUCTURE_CORRUPT - db-file structure corrupt

CST_ERROR_IO - I/O error

CST_ERROR_NOSPC - no space left on device

cst_t_seqnum CST_import_cert_adv ( CST st,
FILE *  file,
const cst_t_cert_folder  folder,
GError **  error 
)

Import certificate from the file and set folder (PEM format). If folder incorrect cert placed in default folder (CST_FOLDER_UNKNOWN) and error returned.

Parameters:
st Pointer to storage structure
file Name of input file
folder Folder code
error Used to return error code (if NULL then ignored)
Returns:
ID imported certificate or 0 if error
Possible error: see. CST_import_cert()

cst_t_seqnum CST_import_cert_adv_DER ( CST st,
FILE *  file,
const cst_t_cert_folder  folder,
GError **  error 
)

Import all certificates from the file and set folder (DER format). If folder incorrect cert placed in default folder (CST_FOLDER_UNKNOWN) and error returned.

Parameters:
st Pointer to storage structure
file Name of input file
folder Folder code
error Used to return error code (if NULL then ignored)
Returns:
ID imported certificate or 0 if error
Possible error: see. CST_import_cert()

int CST_import_cert_DER ( CST st,
FILE *  file 
)

Import certificate from the file (DER format).

Parameters:
st Pointer to storage structure
file Input file
Returns:
Error code
Possible error: see. CST_import_cert()

int CST_import_cert_f ( CST st,
FILE *  file,
unsigned char *  password,
const cst_t_cert_folder  folder 
)

Import certificate from the file and set folder (PEM format). If folder incorrect cert placed in default folder (CST_FOLDER_UNKNOWN) and error returned.

Parameters:
st Pointer to storage structure
file Input file
password Password for open file or NULL if password is empty
folder Folder code
Returns:
Error code
Possible error: see. CST_import_cert()

int CST_import_cert_f_DER ( CST st,
FILE *  file,
const cst_t_cert_folder  folder 
)

Import certificate from the file and set folder (DER format). If folder incorrect cert placed in default folder (CST_FOLDER_UNKNOWN) and error returned.

Parameters:
st Pointer to storage structure
file Name of input file
folder Folder code
Returns:
Error code
Possible error: see. CST_import_cert()

void CST_import_PKCS12 ( CST st,
FILE *  file,
cst_pkcs12_confirm_cb  confirm_cb,
cst_pkcs12_error_cb  error_cb,
unsigned char *  password,
void *  user_data,
GError **  error 
)

Import certificate and private key from the file (PKCS12 format).

Parameters:
st Pointer to storage structure
file Input file
confirm_cb Callback function to confirm import of certificate or key
error_cb Callback function to inform about error
password Password of input file
user_data User data, that need in both callback functions
error Error code
Returns:
Error code
Possible error: CST_ERROR_PASSWORD_WRONG, CST_ERROR_STRUCTURE_CORRUPT, CST_ERROR_CANCEL. Other errors check in error_cb (see error codes of CST_import_cert(), CST_assign(), CST_import_priv_key()).

Callback function confirm_cb must return TRUE to import and FALSE to skip. Callback function confirm_cb use following parameters: is_pair - TRUE if need confirm import of private key and corresponding certificate; xcert - certificate to import; folder - use to set folder, by default equal to CST_FOLDER_CA (is_pair == FALSE) or CST_FOLDER_PERSONAL (is_pair == TRUE), purpose - use to set purpose of certificate, by default equal to CST_PURPOSE_NONE; out_password - use to set private key password, need only if is_pair equal to TRUE; cancel - set TRUE to stop import, by default FALSE; data - user data. Example 3. Using CST_import_PKCS12().

Callback function error_cb must return FALSE if need stop import and TRUE to skip and continue import. Callback function error_cb use following parameters: xcert - certificate on which error; error - error code; data - user data;

int CST_import_priv_key ( CST st,
X509_NAME *  account,
FILE *  file,
unsigned char *  inpass,
unsigned char *  outpass 
)

Import private key from PEM encoded file If private key with same eaccount exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input PEM encoded file
account Distinguished name for identify imported key
inpass Password for imported keys
outpass Password for key in storage
Returns:
Error code
Possible error: see. CST_import_cert()

cst_t_seqnum CST_import_priv_key_adv ( CST st,
X509_NAME *  account,
FILE *  file,
unsigned char *  inpass,
unsigned char *  outpass,
GError **  error 
)

Import private key from PEM encoded file If private key with same eaccount exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input PEM encoded file
account Distinguished name for identify imported key
inpass Password for imported keys
outpass Password for key in storage
error Used to return error code (if NULL then ignored)
Returns:
Id of imported key or 0 on error
Possible error: see. CST_import_cert()

cst_t_seqnum CST_import_priv_key_adv_DER ( CST st,
X509_NAME *  account,
FILE *  file,
unsigned char *  outpass,
GError **  error 
)

Import private key from DER encoded file If private key with same eaccount exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input DER encoded file
account Distinguished name for identify imported key
outpass Password for key in storage
error Used to return error code (if NULL then ignored)
Returns:
Id of imported key or 0 on error
Possible error: see. CST_import_cert()

int CST_import_priv_key_DER ( CST st,
X509_NAME *  account,
FILE *  file,
unsigned char *  outpass 
)

Import private key from DER encoded file If private key with same eaccount exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input DER encoded file
account Distinguished name for identify imported key
outpass Password for key in storage
Returns:
Error code
Possible error: see. CST_import_cert()

int CST_import_pub_key ( CST st,
X509_NAME *  account,
FILE *  file 
)

Import public key from file If public key with same account exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input file
account Distinguished name Key for identify imported key
Returns:
Error code
Possible error: see. CST_import_cert()

cst_t_seqnum CST_import_pub_key_adv ( CST st,
X509_NAME *  account,
FILE *  file,
GError **  error 
)

Import public key from file If public key with same account exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input file
account Distinguished name Key for identify imported key
error Used to return error code (if NULL then ignored)
Returns:
Id of imported key or 0 on error
Possible error: see. CST_import_cert()

cst_t_seqnum CST_import_pub_key_adv_DER ( CST st,
X509_NAME *  account,
FILE *  file,
GError **  error 
)

Import public key from file If public key with same account exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input file
account Distinguished name Key for identify imported key
error Used to return error code (if NULL then ignored)
Returns:
Id of imported key or 0 on error
Possible error: see. CST_import_cert()

int CST_import_pub_key_DER ( CST st,
X509_NAME *  account,
FILE *  file 
)

Import public key from file If public key with same account exist in storage then key appended.

Parameters:
st Pointer to storage structure
file Input file
account Distinguished name Key for identify imported key
Returns:
Error code
Possible error: see. CST_import_cert()


Generated on Wed Mar 5 08:20:44 2008 for Certman by  doxygen 1.5.1