hu_MACKeySet()

Creates a key object for the specified MAC algorithm from the given key value.

Synopsis:

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

Since:

BlackBerry 10.0.0

Arguments:

macAlgId

The MAC algorithm identifier.

keyLen

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

key

The MAC key value.

macKey

The MAC key object pointer.

sbCtx

A global context.

Library:

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

Description:

macAlgId should be one of the algorithm identifiers defined in this file (e.g. HU_DIGEST_SHA1, HU_MAC_XCBC_AES).

For HMAC algorithms, if keyLen is larger than the block size of the specified hash function, the key will first be hashed and the resulting digest will be used as the key (as described in RFC 2104). hu_MACKeyGet() will return this digest as the key value.

For cipher-based MAC algorithms, keyLen must be the appropriate length for a key of the underlying cipher.

Returns:

SB_ERR_BAD_MAC_TYPE

macAlgId is unknown.

SB_ERR_NULL_KEY_PTR

macKey is NULL.

SB_ERR_NULL_INPUT_BUF

key is NULL.

Last modified: 2014-05-14



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

comments powered by Disqus