Decrypts ciphertext using ECIES with KDF-XOR cipher, based on IEEE 1363A and SEC1 Version 1.7.
#include "huecc.h"
int hu_ECIESKDFXORDecrypt(sb_Params eccParams, sb_PrivateKey privateKey, int eciesMode, int ecdhMode, int macAlgId, size_t addInfoMACLen, const unsigned char *addInfoMAC, int kdfAlgId, size_t addInfoKDFLen, const unsigned char *addInfoKDF, size_t ciphertextLen, const unsigned char *ciphertext, size_t *plaintextLen, unsigned char *plaintext, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
An ECC parameters object.
An ECC private key object.
ECIES mode. It selects SEC1 normal, IEEE DHAES or SEC1 backwards compatibility mode (equivalent to IEEE non-DHAES mode).
ECDH Mode. It selects standard ECDH or cofactor version of ECDH.
MAC Algorithm ID.
The length (in bytes) of additional information for MAC. (Optional)
Additional information for MAC. (Optional - set to NULL if not used.)
KDF Algorithm ID.
The length (in bytes) of additional information for KDF. (Optional)
Additional information for KDF. (Optional - set to NULL if not used.)
The length (in bytes) of the ciphertext.
The ciphertext.
The length (in bytes) of the plaintext.
The plaintext.
A global context.
The IEEE KDF is not supported.
If the length of the plaintext is known, a pointer to a buffer large enough to hold the plaintext should be passed in plaintext and its length in plaintextLen. This function will place the plaintext into plaintext and set the actual length of the plaintext in plaintextLen.
If plaintext is NULL, this function will set the correct length of the plaintext in plaintextLen. If plaintext is not NULL but plaintextLen is too small, this function will return an error.
If this function returns SB_FAIL_ECIES_HMAC, the integrity check on the ciphertext failed. Such a failure can be caused by altered ciphertext or MAC tag, or a wrong private key.
The eccParams object is NULL.
The tag for the params object is not of the expected type.
The privateKey object NULL.
The privateKey object invalid.
The ciphertext buffer is NULL.
The length of the ciphertext buffer length is invalid.
The plaintext buffer is NULL.
The length of the plaintext buffer is invalid.
The ephemeral public key in the ciphertext is invalid.
The ciphertext integrity check failed.
Memory allocation failure.
Success.