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

NAME

6       EVP_SignInit, EVP_SignInit_ex, EVP_SignUpdate, EVP_SignFinal - EVP
7       signing functions
8

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUES

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

NOTES

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

BUGS

76       Older versions of this documentation wrongly stated that calls to
77       EVP_SignUpdate() could not be made after calling EVP_SignFinal().
78
79       Since the private key is passed in the call to EVP_SignFinal() any
80       error relating to the private key (for example an unsuitable key and
81       digest combination) will not be indicated until after potentially large
82       amounts of data have been passed through EVP_SignUpdate().
83
84       It is not possible to change the signing parameters using these
85       function.
86
87       The previous two bugs are fixed in the newer EVP_SignDigest*()
88       function.
89

SEE ALSO

91       EVP_VerifyInit(3), EVP_DigestInit(3), err(3), evp(3), hmac(3), md2(3),
92       md5(3), mdc2(3), ripemd(3), sha(3), dgst(1)
93

HISTORY

95       EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are available in
96       all versions of SSLeay and OpenSSL.
97
98       EVP_SignInit_ex() was added in OpenSSL 0.9.7.
99
100
101
1021.0.2k                            2017-01-26                   EVP_SignInit(3)
Impressum