summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EVP_SealInit.3
diff options
context:
space:
mode:
authorschwarze <>2016-11-03 09:35:34 +0000
committerschwarze <>2016-11-03 09:35:34 +0000
commitca3058f44f6c221a5580f274a8d643470f5ffa0a (patch)
tree58d82d0d7f6aeee380eaadbcfaa231ecbe6b90a0 /src/lib/libcrypto/man/EVP_SealInit.3
parent13e48df1ecc456d07bff6a1552bb8ff8286b8b17 (diff)
downloadopenbsd-ca3058f44f6c221a5580f274a8d643470f5ffa0a.tar.gz
openbsd-ca3058f44f6c221a5580f274a8d643470f5ffa0a.tar.bz2
openbsd-ca3058f44f6c221a5580f274a8d643470f5ffa0a.zip
convert EVP manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/EVP_SealInit.3')
-rw-r--r--src/lib/libcrypto/man/EVP_SealInit.3131
1 files changed, 131 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/EVP_SealInit.3 b/src/lib/libcrypto/man/EVP_SealInit.3
new file mode 100644
index 0000000000..9511111486
--- /dev/null
+++ b/src/lib/libcrypto/man/EVP_SealInit.3
@@ -0,0 +1,131 @@
1.Dd $Mdocdate: November 3 2016 $
2.Dt EVP_SEALINIT 3
3.Os
4.Sh NAME
5.Nm EVP_SealInit ,
6.Nm EVP_SealUpdate ,
7.Nm EVP_SealFinal
8.Nd EVP envelope encryption
9.Sh SYNOPSIS
10.In openssl/evp.h
11.Ft int
12.Fo EVP_SealInit
13.Fa "EVP_CIPHER_CTX *ctx"
14.Fa "const EVP_CIPHER *type"
15.Fa "unsigned char **ek"
16.Fa "int *ekl"
17.Fa "unsigned char *iv"
18.Fa "EVP_PKEY **pubk"
19.Fa "int npubk"
20.Fc
21.Ft int
22.Fo EVP_SealUpdate
23.Fa "EVP_CIPHER_CTX *ctx"
24.Fa "unsigned char *out"
25.Fa "int *outl"
26.Fa "unsigned char *in"
27.Fa "int inl"
28.Fc
29.Ft int
30.Fo EVP_SealFinal
31.Fa "EVP_CIPHER_CTX *ctx"
32.Fa "unsigned char *out"
33.Fa "int *outl"
34.Fc
35.Sh DESCRIPTION
36The EVP envelope routines are a high level interface to envelope
37encryption.
38They generate a random key and IV (if required) then "envelope" it by
39using public key encryption.
40Data can then be encrypted using this key.
41.Pp
42.Fn EVP_SealInit
43initializes a cipher context
44.Fa ctx
45for encryption with cipher
46.Fa type
47using a random secret key and IV.
48.Fa type
49is normally supplied by a function such as
50.Fn EVP_aes_256_cbc 3 ;
51see
52.Xr EVP_EncryptInit 3
53for details.
54The secret key is encrypted using one or more public keys.
55This allows the same encrypted data to be decrypted using any of
56the corresponding private keys.
57.Fa ek
58is an array of buffers where the public key encrypted secret key will be
59written.
60Each buffer must contain enough room for the corresponding encrypted
61key: that is
62.Fa ek[i]
63must have room for
64.Fn EVP_PKEY_size pubk[i]
65bytes.
66The actual size of each encrypted secret key is written to the array
67.Fa ekl .
68.Fa pubk
69is an array of
70.Fa npubk
71public keys.
72.Pp
73The
74.Fa iv
75parameter is a buffer where the generated IV is written to.
76It must contain enough room for the corresponding cipher's IV, as
77determined by (for example)
78.Fn EVP_CIPHER_iv_length type .
79.Pp
80If the cipher does not require an IV then the
81.Fa iv
82parameter is ignored and can be
83.Dv NULL .
84.Pp
85.Fn EVP_SealUpdate
86and
87.Fn EVP_SealFinal
88have exactly the same properties as the
89.Xr EVP_EncryptUpdate 3
90and
91.Xr EVP_EncryptFinal 3
92routines.
93.Pp
94The public key must be RSA because it is the only OpenSSL public key
95algorithm that supports key transport.
96.Pp
97Envelope encryption is the usual method of using public key encryption
98on large amounts of data.
99This is because public key encryption is slow but symmetric encryption
100is fast.
101So symmetric encryption is used for bulk encryption and the small random
102symmetric key used is transferred using public key encryption.
103.Pp
104It is possible to call
105.Fn EVP_SealInit
106twice in the same way as
107.Xr EVP_EncryptInit 3 .
108The first call should have
109.Fa npubk
110set to 0 and (after setting any cipher parameters) it should be called
111again with
112.Fa type
113set to NULL.
114.Sh RETURN VALUES
115.Fn EVP_SealInit
116returns 0 on error or
117.Fa npubk
118if successful.
119.Pp
120.Fn EVP_SealUpdate
121and
122.Fn EVP_SealFinal
123return 1 for success and 0 for failure.
124.Sh SEE ALSO
125.Xr evp 3 ,
126.Xr EVP_EncryptInit 3 ,
127.Xr EVP_OpenInit 3 ,
128.Xr rand 3
129.Sh HISTORY
130.Fn EVP_SealFinal
131did not return a value before OpenSSL 0.9.7.