SYNOPSIS

DESCRIPTION

The EVP_PKEY_sign_init() function initializes a public key algorithm
context using key pkey for a signing operation.

The EVP_PKEY_sign() function performs a public key signing operation
using ctx. The data to be signed is specified using the tbs and
tbslen parameters. If sig is NULL then the maximum size of the output
buffer is written to the siglen parameter. If sig is not NULL then
before the call the siglen parameter should contain the length of the
sig buffer, if the call is successful the signature is written to
sig and the amount of data written to siglen.

NOTES

EVP_PKEY_sign() does not hash the data to be signed, and therefore is
normally used to sign digests. For signing arbitrary messages, see the
EVP_DigestSignInit(3) and
EVP_SignInit(3) signing interfaces instead.

After the call to EVP_PKEY_sign_init() algorithm specific control
operations can be performed to set any appropriate parameters for the
operation (see EVP_PKEY_CTX_ctrl(3)).

The function EVP_PKEY_sign() can be called more than once on the same
context if several operations are performed using the same parameters.

RETURN VALUES

EVP_PKEY_sign_init() and EVP_PKEY_sign() return 1 for success and 0
or a negative value for failure. In particular a return value of -2
indicates the operation is not supported by the public key algorithm.