1EVP_SealInit(3)                     OpenSSL                    EVP_SealInit(3)
2
3
4

NAME

6       EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption
7

SYNOPSIS

9        #include <openssl/evp.h>
10
11        int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
12                         unsigned char **ek, int *ekl, unsigned char *iv,
13                         EVP_PKEY **pubk, int npubk);
14        int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
15                int *outl, unsigned char *in, int inl);
16        int EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
17                int *outl);
18

DESCRIPTION

20       The EVP envelope routines are a high level interface to envelope
21       encryption. They generate a random key and IV (if required) then
22       "envelope" it by using public key encryption. Data can then be
23       encrypted using this key.
24
25       EVP_SealInit() initializes a cipher context ctx for encryption with
26       cipher type using a random secret key and IV. type is normally supplied
27       by a function such as EVP_aes_256_cbc(). The secret key is encrypted
28       using one or more public keys, this allows the same encrypted data to
29       be decrypted using any of the corresponding private keys. ek is an
30       array of buffers where the public key encrypted secret key will be
31       written, each buffer must contain enough room for the corresponding
32       encrypted key: that is ek[i] must have room for EVP_PKEY_size(pubk[i])
33       bytes. The actual size of each encrypted secret key is written to the
34       array ekl. pubk is an array of npubk public keys.
35
36       The iv parameter is a buffer where the generated IV is written to. It
37       must contain enough room for the corresponding cipher's IV, as
38       determined by (for example) EVP_CIPHER_iv_length(type).
39
40       If the cipher does not require an IV then the iv parameter is ignored
41       and can be NULL.
42
43       EVP_SealUpdate() and EVP_SealFinal() have exactly the same properties
44       as the EVP_EncryptUpdate() and EVP_EncryptFinal() routines, as
45       documented on the EVP_EncryptInit(3) manual page.
46

RETURN VALUES

48       EVP_SealInit() returns 0 on error or npubk if successful.
49
50       EVP_SealUpdate() and EVP_SealFinal() return 1 for success and 0 for
51       failure.
52

NOTES

54       Because a random secret key is generated the random number generator
55       must be seeded before calling EVP_SealInit().
56
57       The public key must be RSA because it is the only OpenSSL public key
58       algorithm that supports key transport.
59
60       Envelope encryption is the usual method of using public key encryption
61       on large amounts of data, this is because public key encryption is slow
62       but symmetric encryption is fast. So symmetric encryption is used for
63       bulk encryption and the small random symmetric key used is transferred
64       using public key encryption.
65
66       It is possible to call EVP_SealInit() twice in the same way as
67       EVP_EncryptInit(). The first call should have npubk set to 0 and (after
68       setting any cipher parameters) it should be called again with type set
69       to NULL.
70

SEE ALSO

72       evp(3), rand(3), EVP_EncryptInit(3), EVP_OpenInit(3)
73

HISTORY

75       EVP_SealFinal() did not return a value before OpenSSL 0.9.7.
76
77
78
791.0.2o                            2018-03-27                   EVP_SealInit(3)
Impressum