Next: , Previous: Session Functions, Up: Top


10 Utilities

gsasl_saslprep

— Function: int gsasl_saslprep (const char * in, Gsasl_saslprep_flags flags, char ** out, int * stringpreprc)

in: a UTF-8 encoded string.

flags: any SASLprep flag, e.g., GSASL_ALLOW_UNASSIGNED.

out: on exit, contains newly allocated output string.

stringpreprc: if non-NULL, will hold precise stringprep return code.

Prepare string using SASLprep. On success, the out variable must be deallocated by the caller.

Return value: Returns GSASL_OK on success, or GSASL_SASLPREP_ERROR on error.

Since: 0.2.3

gsasl_base64_to

— Function: int gsasl_base64_to (const char * in, size_t inlen, char ** out, size_t * outlen)

in: input byte array

inlen: size of input byte array

out: pointer to newly allocated output byte array

outlen: pointer to size of newly allocated output byte array

Encode data as base64. The string is zero terminated, and OUTLEN holds the length excluding the terminating zero. The OUT buffer must be deallocated by the caller.

Return value: Returns GSASL_OK on success, or GSASL_MALLOC_ERROR if input was too large or memory allocation fail.

Since: 0.2.2

gsasl_base64_from

— Function: int gsasl_base64_from (const char * in, size_t inlen, char ** out, size_t * outlen)

in: input byte array

inlen: size of input byte array

out: pointer to newly allocated output byte array

outlen: pointer to size of newly allocated output byte array

Decode Base64 data. The OUT buffer must be deallocated by the caller.

Return value: Returns GSASL_OK on success, GSASL_BASE64_ERROR if input was invalid, and GSASL_MALLOC_ERROR on memory allocation errors.

Since: 0.2.2

gsasl_simple_getpass

— Function: int gsasl_simple_getpass (const char * filename, const char * username, char ** key)

filename: filename of file containing passwords.

username: username string.

key: newly allocated output character array.

Retrieve password for user from specified file. The buffer key contain the password if this function is successful. The caller is responsible for deallocating it.

The file should be on the UoW "MD5 Based Authentication" format, which means it is in text format with comments denoted by # first on the line, with user entries looking as "usernameTABpassword". This function removes CR and LF at the end of lines before processing. TAB, CR, and LF denote ASCII values 9, 13, and 10, respectively.

Return value: Return GSASL_OK if output buffer contains the password, GSASL_AUTHENTICATION_ERROR if the user could not be found, or other error code.

gsasl_nonce

— Function: int gsasl_nonce (char * data, size_t datalen)

data: output array to be filled with unpredictable random data.

datalen: size of output array.

Store unpredictable data of given size in the provided buffer.

Return value: Returns GSASL_OK iff successful.

gsasl_random

— Function: int gsasl_random (char * data, size_t datalen)

data: output array to be filled with strong random data.

datalen: size of output array.

Store cryptographically strong random data of given size in the provided buffer.

Return value: Returns GSASL_OK iff successful.

gsasl_md5

— Function: int gsasl_md5 (const char * in, size_t inlen, char * out[16])

in: input character array of data to hash.

inlen: length of input character array of data to hash.

Compute hash of data using MD5. The out buffer must be deallocated by the caller.

Return value: Returns GSASL_OK iff successful.

gsasl_hmac_md5

— Function: int gsasl_hmac_md5 (const char * key, size_t keylen, const char * in, size_t inlen, char * outhash[16])

key: input character array with key to use.

keylen: length of input character array with key to use.

in: input character array of data to hash.

inlen: length of input character array of data to hash.

Compute keyed checksum of data using HMAC-MD5. The outhash buffer must be deallocated by the caller.

Return value: Returns GSASL_OK iff successful.