Generates a shared secret that is the output of an ECDH key agreement using cofactor multiplication with optional y-coordinate output.
#include "huecc.h"
int hu_ECDHCofacRawXYSharedGen(sb_Params eccParams, sb_PrivateKey privateKey, sb_PublicKey remotePublicKey, size_t *secretLen, unsigned char *sharedSecretX, unsigned char *sharedSecretY, sb_GlobalCtx sbCtx)
BlackBerry 10.0.0
An ECC parameters object.
An ECC private key object.
An ECC public key object.
The length (in bytes) of the shared secret (x- or y- coordinate).
The shared secret buffer for x-coordinate.
The shared secret buffer for y-coordinate.
A global context.
The x-coordinate of the resultant elliptic curve point from the ECDH Cofactor operation is the raw shared secret. If the length of the shared secret is known, a pointer to a buffer large enough to hold the shared secret should be passed in sharedSecretX and its length in secretLen. This function will copy the shared secret (x-coordinate) into sharedSecretX and set the actual length of the shared secret (i.e. the x-coordinate) in secretLen.
If sharedSecretX is NULL, this function will set the correct length of the shared secret (i.e. the x-coordinate) in secretLen.
If sharedSecretX is not NULL but secretLen is too small, this function will return an error and set the correct length of the shared secret (i.e. the x-coordinate) in secretLen.
The output of y-coordinate is optional. Set sharedSecretY to NULL if the y-coordinate is not required. If sharedSecretX is NULL, this argument is ignored. Note that the length of x- and y-coordinates are the same. Therefore, secretLen is shared to contain the size of each buffer.
The length of the shared secret can also be determined by calling hu_ECCParamsGet() and retrieving the reducLen argument.
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 publicKey object is NULL.
The publicKey object is invalid.
The shared secret buffer is NULL.
The shared secret length is invalid.
Memory allocation failure.
Success.