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 "enve‐
22       lope" it by using public key encryption. Data can then be encrypted
23       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_des_cbc(). The secret key is encrypted using
28       one or more public keys, this allows the same encrypted data to be
29       decrypted using any of the corresponding private keys. ek is an array
30       of buffers where the public key encrypted secret key will be written,
31       each buffer must contain enough room for the corresponding encrypted
32       key: that is ek[i] must have room for EVP_PKEY_size(pubk[i]) bytes. The
33       actual size of each encrypted secret key is written to the array ekl.
34       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 deter‐
38       mined 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 docu‐
45       mented 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
790.9.8b                            2005-03-29                   EVP_SealInit(3)
Impressum