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
21       signatures.
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
28       context ctx. This function can be called several times on the same ctx
29       to 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
70       memory 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
76       Since the private key is passed in the call to EVP_SignFinal() any
77       error relating to the private key (for example an unsuitable key and
78       digest combination) will not be indicated until after potentially large
79       amounts of data have been passed through EVP_SignUpdate().
80
81       It is not possible to change the signing parameters using these
82       function.
83
84       The previous two bugs are fixed in the newer EVP_SignDigest*()
85       function.
86

SEE ALSO

88       EVP_VerifyInit(3), EVP_DigestInit(3), err(3), evp(3), hmac(3), md2(3),
89       md5(3), mdc2(3), ripemd(3), sha(3), dgst(1)
90

HISTORY

92       EVP_SignInit(), EVP_SignUpdate() and EVP_SignFinal() are available in
93       all versions of SSLeay and OpenSSL.
94
95       EVP_SignInit_ex() was added in OpenSSL 0.9.7.
96
97
98
991.0.1e                            2013-02-11                   EVP_SignInit(3)
Impressum