1EVP_SignInit(3)                     OpenSSL                    EVP_SignInit(3)
2
3
4

NAME

6       EVP_SignInit, EVP_SignUpdate, EVP_SignFinal - EVP signing functions
7

SYNOPSIS

9        #include <openssl/evp.h>
10
11        int EVP_SignInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
12        int EVP_SignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt);
13        int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *sig,unsigned int *s, EVP_PKEY *pkey);
14
15        void EVP_SignInit(EVP_MD_CTX *ctx, const EVP_MD *type);
16
17        int EVP_PKEY_size(EVP_PKEY *pkey);
18

DESCRIPTION

20       The EVP signature routines are a high level interface to digital signa‐
21       tures.
22
23       EVP_SignInit_ex() sets up signing context ctx to use digest type from
24       ENGINE impl. ctx must be initialized with EVP_MD_CTX_init() before
25       calling this function.
26
27       EVP_SignUpdate() hashes cnt bytes of data at d into the signature con‐
28       text ctx. This function can be called several times on the same ctx to
29       include additional data.
30
31       EVP_SignFinal() signs the data in ctx using the private key pkey and
32       places the signature in sig. The number of bytes of data written (i.e.
33       the length of the signature) will be written to the integer at s, at
34       most EVP_PKEY_size(pkey) bytes will be written.
35
36       EVP_SignInit() initializes a signing context ctx to use the default
37       implementation of digest type.
38
39       EVP_PKEY_size() returns the maximum size of a signature in bytes. The
40       actual signature returned by EVP_SignFinal() may be smaller.
41

RETURN VALUES

43       EVP_SignInit_ex(), EVP_SignUpdate() and EVP_SignFinal() return 1 for
44       success and 0 for failure.
45
46       EVP_PKEY_size() returns the maximum size of a signature in bytes.
47
48       The error codes can be obtained by ERR_get_error(3).
49

NOTES

51       The EVP interface to digital signatures should almost always be used in
52       preference to the low level interfaces. This is because the code then
53       becomes transparent to the algorithm used and much more flexible.
54
55       Due to the link between message digests and public key algorithms the
56       correct digest algorithm must be used with the correct public key type.
57       A list of algorithms and associated public key algorithms appears in
58       EVP_DigestInit(3).
59
60       When signing with DSA private keys the random number generator must be
61       seeded or the operation will fail. The random number generator does not
62       need to be seeded for RSA signatures.
63
64       The call to EVP_SignFinal() internally finalizes a copy of the digest
65       context.  This means that calls to EVP_SignUpdate() and EVP_SignFinal()
66       can be called later to digest and sign additional data.
67
68       Since only a copy of the digest context is ever finalized the context
69       must be cleaned up after use by calling EVP_MD_CTX_cleanup() or a mem‐
70       ory leak will occur.
71

BUGS

73       Older versions of this documentation wrongly stated that calls to
74       EVP_SignUpdate() could not be made after calling EVP_SignFinal().
75

SEE ALSO

77       EVP_VerifyInit(3), EVP_DigestInit(3), err(3), evp(3), hmac(3), md2(3),
78       md5(3), mdc2(3), ripemd(3), sha(3), dgst(1)
79

HISTORY

81       EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are available in
82       all versions of SSLeay and OpenSSL.
83
84       EVP_SignInit_ex() was added in OpenSSL 0.9.7.
85
86
87
880.9.8b                            2005-03-22                   EVP_SignInit(3)
Impressum