Parent topic:MPLAB® Harmony Crypto Library
int CRYPT_ECC_PublicImport(
CRYPT_ECC_CTX* ecc,
const unsigned char* in,
unsigned int inSz
);
This function imports a public key in ANSI X9.63 format into the ECC context.
The ECC context must have previously been initialized with a call to CRYPT_ECC_Initialize.
Parameters | Description |
---|---|
ecc | Pointer to context which saves state between calls. |
in | Input buffer that holds the public key. |
inSz | Size of the input buffer, in bytes. |
-
BAD_FUNC_ARG - An invalid pointer was passed to the function.
-
MEMORY_E - Memory could not be allocated for the key.
-
ASN_PARSE_E - There was a parse error while going through the key.
-
0 - An invalid ppointer was not passed to the function.
None.
CRYPT_ECC_CTX userB;
int ret;
byte sharedA[100];
unsigned int aSz = (unsigned int)sizeof(sharedA);
unsigned int usedA;
ret = CRYPT_ECC_Initialize(&userB);
...
ret = CRYPT_ECC_PublicImport(&userB, sharedA, usedA);