1.31 CRYPT_ECC_PublicImport Function

C

int CRYPT_ECC_PublicImport(
    CRYPT_ECC_CTX* ecc, 
    const unsigned char* in, 
    unsigned int inSz
);

Description

This function imports a public key in ANSI X9.63 format into the ECC context.

Preconditions

The ECC context must have previously been initialized with a call to CRYPT_ECC_Initialize.

Parameters

ParametersDescription
eccPointer to context which saves state between calls.
inInput buffer that holds the public key.
inSzSize of the input buffer, in bytes.

Returns

  • 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.

Remarks

None.

Example

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);