1.29 CRYPT_ECC_PrivateImport Function

C

int CRYPT_ECC_PrivateImport(
    CRYPT_ECC_CTX* ecc, 
    const unsigned char* priv, 
    unsigned int privSz, 
    const unsigned char* pub, 
    unsigned int pubSz
);

Description

This function imports a public/private key pair in X9.63 format.

Preconditions

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

Parameters

ParametersDescription
eccPointer to context which saves state between calls.
privPointer to the private key.
privSzSize of the private key, in bytes.
pubPointer to the public key.
pubSzSize of the public key, in bytes.

Returns

  • BAD_FUNC_ARG - An invalid pointer was passed to the function.

  • 0 - An invalid pointer was not passed to the function.

Example

CRYPT_ECC_CTX ecc;

CRYPT_ECC_Initialize(&ecc);
...
CRYPT_ECC_PrivateImport(&ecc, priv_key, sizeof(priv_key), pub_key, sizeof(pub_key));