Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

SecurityUtilities.h File Reference

#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  AlpPrvSpfSuPKCS5

Functions

void alp_prv_spf_su_rfc1113_encode (char *input, unsigned int input_length, char *output, unsigned int output_max_length, unsigned int *output_bytes_written)
 This function performs an rfc1113 encoding. That is, it takes binary data of a fixed length and converts it into ASCII printable data. Some people refer to this as "BASE64 encoding" thought the term RFC1113 encoding may be more accurate as RFC1113 specifies one particular BASE64 encoding that seems to be in near-universal use. The function takes a pointer to binary data you want to convert, along with an unsigned int indicating the length of the input. It also takes a pointer to where you want to put the converted data and an unsigned int indicating the size of the output buffer. The function will write at most output_length bytes to the output buffer. If the output_bytes_written parameter is non-null, the function will write the number of bytes it wrote to the unsigned int pointed to by this pointer.
void alp_prv_spf_su_rfc1113_decode (char *input, unsigned int input_length, char *output, unsigned int output_max_length, unsigned int *output_bytes_written)
 This function performs an rfc1113 decoding. That is, it takes RFC1113 encoded ASCII data and converts it back into binary data. The function takes a pointer to ASCII data you want to convert, along with an unsigned int indicating the length of the input. It also takes a pointer to where you want to put the binary output data and an unsigned int indicating the size of the output buffer. The function will write at most output_length bytes to the output buffer. If the output_bytes_written parameter is non-null, the function will write the number of bytes it wrote to the unsigned int pointed to by this pointer.
void alp_prv_spf_su_sha1 (char *input, unsigned int input_length, char *output)
 This is a simple convenience function that performs a SHA1 hash of a block of data. SHA1 hashes are 20 bytes long, so the function assumes that the output parameter points to (at least) a 20 byte buffer.
void alp_prv_spf_su_pkcs5_init_default (AlpPrvSpfSuPKCS5 **context, char *id)
 This function initializes a AlpPrvSpfSuPKCS5 context data structure with default parameters. The only parameter that we don't have a default for is the "id" parameter.
void alp_prv_spf_su_pkcs5_init (AlpPrvSpfSuPKCS5 **context, char *salt, unsigned int iteration, char *id)
void alp_prv_spf_su_pkcs5_fput (AlpPrvSpfSuPKCS5 *context, FILE *fp)
void alp_prv_spf_su_pkcs5_phrase_set (AlpPrvSpfSuPKCS5 *context, char *phrase)
void alp_prv_spf_su_pkcs5_phrase_test (AlpPrvSpfSuPKCS5 *context, char *phrase, unsigned int *success)


Function Documentation

void alp_prv_spf_su_pkcs5_fput AlpPrvSpfSuPKCS5 context,
FILE *  fp
 

void alp_prv_spf_su_pkcs5_init AlpPrvSpfSuPKCS5 **  context,
char *  salt,
unsigned int  iteration,
char *  id
 

void alp_prv_spf_su_pkcs5_init_default AlpPrvSpfSuPKCS5 **  context,
char *  id
 

This function initializes a AlpPrvSpfSuPKCS5 context data structure with default parameters. The only parameter that we don't have a default for is the "id" parameter.

Parameters:
in/out] context - this is a pointer to a pointer to a AlpPrvSpfSuPKCS5 data structure. If it is null, then the function will allocate a data structure on the caller's behalf, and will write the address of the new data structure into the pointer pointed to by this parameter. If the value is non-null, the function assumes it points to an AlpPrvSpfSuPKCS5 data structure and initializes it.
[in] id - the "id" of the context. Typical values include PIN and PUK.
Example
Here's a quick example of using this function. Function foo allows this init call to allocate the context while function bar allocates the context itself.
 #include <SecurityUtilities.c>
 
 void foo() {
   AlpPrvSpfSuPKCS5 *context = NULL;
 
   alp_prv_spf_su_pkcs5_init_default( &context, "foo" );
 }
 
 void bar() {
   AlpPrvSpfSuPKCS5 *context = malloc( sizeof( AlpPrvSpfSuPKCS5 ) );
 
   alp_prv_spf_su_pkcs5_init_default( &context, "bar" );
 }

void alp_prv_spf_su_pkcs5_phrase_set AlpPrvSpfSuPKCS5 context,
char *  phrase
 

void alp_prv_spf_su_pkcs5_phrase_test AlpPrvSpfSuPKCS5 context,
char *  phrase,
unsigned int *  success
 

void alp_prv_spf_su_rfc1113_decode char *  input,
unsigned int  input_length,
char *  output,
unsigned int  output_max_length,
unsigned int *  output_bytes_written
 

This function performs an rfc1113 decoding. That is, it takes RFC1113 encoded ASCII data and converts it back into binary data. The function takes a pointer to ASCII data you want to convert, along with an unsigned int indicating the length of the input. It also takes a pointer to where you want to put the binary output data and an unsigned int indicating the size of the output buffer. The function will write at most output_length bytes to the output buffer. If the output_bytes_written parameter is non-null, the function will write the number of bytes it wrote to the unsigned int pointed to by this pointer.

Parameters:
[in] input - This is a char pointer to the beginning of the ASCII data you want to decode.
[in] input_length - This is the length of the ASCII data pointed to by the "input" parameter.
[out] output - This is a pointer to the output buffer. Encoded data will be written here.
[in] output_max_length - This is the size of the output buffer. The function will write no more than this number of bytes to the output buffer.
[out] output_bytes_written - This is a pointer to an unsigned integer. Assuming this parameter is non-null, the function will write the number of bytes it wrote to the output buffer into the unsigned int pointed to by this parameter.

void alp_prv_spf_su_rfc1113_encode char *  input,
unsigned int  input_length,
char *  output,
unsigned int  output_max_length,
unsigned int *  output_bytes_written
 

This function performs an rfc1113 encoding. That is, it takes binary data of a fixed length and converts it into ASCII printable data. Some people refer to this as "BASE64 encoding" thought the term RFC1113 encoding may be more accurate as RFC1113 specifies one particular BASE64 encoding that seems to be in near-universal use. The function takes a pointer to binary data you want to convert, along with an unsigned int indicating the length of the input. It also takes a pointer to where you want to put the converted data and an unsigned int indicating the size of the output buffer. The function will write at most output_length bytes to the output buffer. If the output_bytes_written parameter is non-null, the function will write the number of bytes it wrote to the unsigned int pointed to by this pointer.

Parameters:
[in] input - This is a char pointer to the beginning of the binary data you want to encode.
[in] input_length - This is the length of the binary data pointed to by the "input" parameter. Remember, we may want to encode null bytes, so we can't use traditional null-terminated C "strings" here.
[out] output - This is a pointer to the output buffer. Encoded data will be written here.
[in] output_max_length - This is the size of the output buffer. The function will write no more than this number of bytes to the output buffer.
[out] output_bytes_written - This is a pointer to an unsigned integer. Assuming this parameter is non-null, the function will write the number of bytes it wrote to the output buffer into the unsigned int pointed to by this parameter.

void alp_prv_spf_su_sha1 char *  input,
unsigned int  input_length,
char *  output
 

This is a simple convenience function that performs a SHA1 hash of a block of data. SHA1 hashes are 20 bytes long, so the function assumes that the output parameter points to (at least) a 20 byte buffer.

Parameters:
[in] input - a pointer to the data to be hashed
[in] input_length - the length of the input data
[out] output - a pointer to a 20 byte output buffer into which the digest will be placed.


Generated on Sat Dec 16 20:29:49 2006 for hiker-0.9 by  doxygen 1.4.4