hu_ARC4Encrypt()

Encrypts a plaintext buffer using the given ARC4 context.

Synopsis:

#include "huarc4.h"
 
int hu_ARC4Encrypt(sb_Context arc4Context, size_t length, const unsigned char *plaintext, unsigned char *ciphertext, sb_GlobalCtx sbCtx)

Since:

BlackBerry 10.0.0

Arguments:

arc4Context

An ARC4 context object.

length

The length (in bytes) of plaintext.

plaintext

The plaintext buffer.

ciphertext

The ciphertext buffer.

sbCtx

A global context.

Library:

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

Description:

The plaintext and ciphertext buffers must be the same length. They may point to the same address in memory but must not otherwise overlap. This function can be called repeatedly to encrypt more blocks of plaintext.

Returns:

SB_ERR_NULL_CONTEXT

The arc4Context object is NULL.

SB_ERR_BAD_CONTEXT

The arc4Context object is invalid.

SB_ERR_NULL_INPUT_BUF

The plaintext buffer is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

The length of the plaintext buffer is invalid.

SB_ERR_NULL_OUTPUT_BUF

The ciphertext buffer is NULL.

SB_SUCCESS

Success.