diff options
Diffstat (limited to 'src/lib/libcrypto/doc/EVP_SealInit.pod')
-rw-r--r-- | src/lib/libcrypto/doc/EVP_SealInit.pod | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/src/lib/libcrypto/doc/EVP_SealInit.pod b/src/lib/libcrypto/doc/EVP_SealInit.pod new file mode 100644 index 0000000000..b5e477e294 --- /dev/null +++ b/src/lib/libcrypto/doc/EVP_SealInit.pod | |||
@@ -0,0 +1,84 @@ | |||
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 | int EVP_SealUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, | ||
14 | int *outl, unsigned char *in, int inl); | ||
15 | int 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 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 B<ctx> for encryption | ||
26 | with cipher B<type> using a random secret key and IV. B<type> is normally | ||
27 | supplied by a function such as EVP_des_cbc(). The secret key is encrypted | ||
28 | using one or more public keys, this allows the same encrypted data to be | ||
29 | decrypted using any of the corresponding private keys. B<ek> is an array of | ||
30 | buffers where the public key encrypted secret key will be written, each buffer | ||
31 | must contain enough room for the corresponding encrypted key: that is | ||
32 | B<ek[i]> must have room for B<EVP_PKEY_size(pubk[i])> bytes. The actual | ||
33 | size of each encrypted secret key is written to the array B<ekl>. B<pubk> is | ||
34 | an array of B<npubk> public keys. | ||
35 | |||
36 | The B<iv> parameter is a buffer where the generated IV is written to. It must | ||
37 | contain enough room for the corresponding cipher's IV, as determined by (for | ||
38 | example) EVP_CIPHER_iv_length(type). | ||
39 | |||
40 | If the cipher does not require an IV then the B<iv> parameter is ignored | ||
41 | and can be B<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 L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual | ||
46 | page. | ||
47 | |||
48 | =head1 RETURN VALUES | ||
49 | |||
50 | EVP_SealInit() returns 0 on error or B<npubk> if successful. | ||
51 | |||
52 | EVP_SealUpdate() and EVP_SealFinal() return 1 for success and 0 for | ||
53 | failure. | ||
54 | |||
55 | =head1 NOTES | ||
56 | |||
57 | Because a random secret key is generated the random number generator | ||
58 | must be seeded before calling EVP_SealInit(). | ||
59 | |||
60 | The public key must be RSA because it is the only OpenSSL public key | ||
61 | algorithm that supports key transport. | ||
62 | |||
63 | Envelope encryption is the usual method of using public key encryption | ||
64 | on large amounts of data, this is because public key encryption is slow | ||
65 | but symmetric encryption is fast. So symmetric encryption is used for | ||
66 | bulk encryption and the small random symmetric key used is transferred | ||
67 | using public key encryption. | ||
68 | |||
69 | It is possible to call EVP_SealInit() twice in the same way as | ||
70 | EVP_EncryptInit(). The first call should have B<npubk> set to 0 | ||
71 | and (after setting any cipher parameters) it should be called again | ||
72 | with B<type> set to NULL. | ||
73 | |||
74 | =head1 SEE ALSO | ||
75 | |||
76 | L<evp(3)|evp(3)>, L<rand(3)|rand(3)>, | ||
77 | L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, | ||
78 | L<EVP_OpenInit(3)|EVP_OpenInit(3)> | ||
79 | |||
80 | =head1 HISTORY | ||
81 | |||
82 | EVP_SealFinal() did not return a value before OpenSSL 0.9.7. | ||
83 | |||
84 | =cut | ||