Correction.
[openssl.git] / doc / crypto / EVP_SealInit.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_SealInit, EVP_SealUpdate, EVP_SealFinal - EVP envelope encryption
6
7 =head1 SYNOPSIS
8
9  #include <openssl/evp.h>
10
11  int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek,
12                 int *ekl, unsigned char *iv,EVP_PKEY **pubk, int npubk);
13  void EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
14          int *outl, unsigned char *in, int inl);
15  void EVP_SealFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
16          int *outl);
17
18 =head1 DESCRIPTION
19
20 The EVP envelope routines are a high level interface to envelope
21 encryption. They generate a random key and then "envelope" it by
22 using public key encryption. Data can then be encrypted using this
23 key.
24
25 EVP_SealInit() initialises a cipher context B<ctx> for encryption
26 with cipher B<type> using a random secret key and IV supplied in
27 the B<iv> parameter. B<type> is normally supplied by a function such
28 as EVP_des_cbc(). The secret key is encrypted using one or more public
29 keys, this allows the same encrypted data to be decrypted using any
30 of the corresponding private keys. B<ek> is an array of buffers where
31 the public key encrypted secret key will be written, each buffer must
32 contain enough room for the corresponding encrypted key: that is
33 B<ek[i]> must have room for B<EVP_PKEY_size(pubk[i])> bytes. The actual
34 size of each encrypted secret key is written to the array B<ekl>. B<pubk> is
35 an array of B<npubk> public keys.
36
37 EVP_SealUpdate() and EVP_SealFinal() have exactly the same properties
38 as the EVP_EncryptUpdate() and EVP_EncryptFinal() routines, as 
39 documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual
40 page. 
41
42 =head1 RETURN VALUES
43
44 EVP_SealInit() returns -1 on error or B<npubk> if successful.
45
46 EVP_SealUpdate() and EVP_SealFinal() do not return values.
47
48 =head1 NOTES
49
50 Because a random secret key is generated the random number generator
51 must be seeded before calling EVP_SealInit().
52
53 The public key must be RSA because it is the only OpenSSL public key
54 algorithm that supports key transport.
55
56 Envelope encryption is the usual method of using public key encryption
57 on large amounts of data, this is because public key encryption is slow
58 but symmetric encryption is fast. So symmetric encryption is used for
59 bulk encryption and the small random symmetric key used is transferred
60 using public key encryption.
61
62 =head1 SEE ALSO
63
64 L<evp(3)|evp(3)>,L<rand(3)|rand(3)>
65 L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>,
66 L<EVP_OpenInit(3)|EVP_OpenInit(3)>
67
68 =head1 HISTORY
69
70 =cut