hu_ECPVSRecoverDecrypt()

Decrypts a message using ECPVS.

Synopsis:

#include "huecpvs.h"
 
int hu_ECPVSRecoverDecrypt(sb_Context ecpvsContext, size_t rLen, const unsigned char *rValue, size_t *recoverableMessageLen, unsigned char *recoverableMessage, sb_GlobalCtx sbCtx)

Arguments:

ecpvsContext

ECPVS context object pointer.

rLen

The length (in bytes) of rValue.

rValue

The r component from the signature computation.

recoverableMessageLen

The length (in bytes) of recoverableMessage.

recoverableMessage

The recoverable part of the message.

sbCtx

A global context.

Library:

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

Description:

This is the third API function to be called during the ECPVS recovery process. It can be called multiple times to decrypt parts of the message; this is useful if the message is particularly large.

The first call to this function must have an rValue whose length (i.e. rLen) is at least that of the length of the padding. If the entire padding is not passed in the initial call to this function, i.e. rLen is less than the length of the padding, then the error SB_ERR_BAD_INPUT_BUF_LEN will be returned as the expected padding was not found.

If the length of the recoverable part of the message is known, a pointer to a buffer large enough to hold this part should be passed in recoverableMessage and its length in recoverableMessageLen. This function will copy the recovered data into recoverableMessage and set the actual length of it in recoverableMessageLen.

If there is no recoverable data - or you just want to check the padding - set both recoverableMessage and recoverableMessageLen to NULL.

The total recoverable message is a concatenation of all output recoverableMessage, in order, by this function.

Returns:

SB_ERR_NULL_CONTEXT

Context object is NULL.

SB_ERR_BAD_CONTEXT

Context object is invalid.

SB_ERR_NULL_OUTPUT_BUF_LEN_PTR

The recoverable message length is NULL.

SB_ERR_NULL_GLOBAL_CTX

Global context is NULL.

SB_ERR_BAD_INPUT_BUF_LEN

rValue does not contain the entire padding on the initial call to this function.

SB_ERR_BAD_OUTPUT_BUF_LEN

The recoverable message length is invalid.

SB_ERR_BAD_OUTPUT_BUF_LEN

The recoverable message length is invalid.

SB_FAIL_INVALID_SIGNATURE

Redundancy check failed. The padding value did not match the expected result.

SB_FAIL_ALLOC

Memory allocation failure.

SB_SUCCESS

Success.

Last modified: 2014-05-14



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

comments powered by Disqus