hu_MACKeyGet()

Retrieves the algorithm identifier, key length and value from a MAC key object.

Synopsis:

#include "humac.h"
 
int hu_MACKeyGet(sb_Key macKey, int *macAlgId, size_t *keyLen, unsigned char *key, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

macKey

The MAC key object.

macAlgId

The MAC algorithm identifier.

keyLen

The length (in bytes) of the MAC key value.

key

The key value.

sbCtx

A global context.

Library:

libhuapi (For the qcc command, use the -l huapi option to link against this library)

Description:

If the length of the key value is known, a pointer to a buffer large enough to hold the key value should be passed in key and its length in keyLen. This function will copy the key value into key and set the actual length of the key value in keyLen.

If key is NULL, then this function will set the correct length of the key value in keyLen. If key is not NULL but keyLen is too small, this function will return an error and also will set the correct length of the key value in keyLen.

For HMAC algorithms, the maximum value of keyLen will be the underlying hash algorithm's block size.

For cipher-based MAC algorithms, the maximum value of keyLen will be the length for a key of the underlying cipher.

Returns:

SB_ERR_NULL_KEY

macKey is NULL.

SB_ERR_BAD_KEY

macKey is invalid.

SB_ERR_NULL_KEY_LEN

keyLen is NULL.

SB_ERR_BAD_OUTPUT_BUF_LEN

keyLen is invalid.

SB_ERR_SYM_KEY_NOT_EXPORTABLE

macKey cannot be exported.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus