xref: /onnv-gate/usr/src/common/openssl/doc/crypto/EVP_OpenInit.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/evp.h>
10*2175Sjp161948
11*2175Sjp161948 int EVP_OpenInit(EVP_CIPHER_CTX *ctx,EVP_CIPHER *type,unsigned char *ek,
12*2175Sjp161948		int ekl,unsigned char *iv,EVP_PKEY *priv);
13*2175Sjp161948 int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
14*2175Sjp161948         int *outl, unsigned char *in, int inl);
15*2175Sjp161948 int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
16*2175Sjp161948         int *outl);
17*2175Sjp161948
18*2175Sjp161948=head1 DESCRIPTION
19*2175Sjp161948
20*2175Sjp161948The EVP envelope routines are a high level interface to envelope
21*2175Sjp161948decryption. They decrypt a public key encrypted symmetric key and
22*2175Sjp161948then decrypt data using it.
23*2175Sjp161948
24*2175Sjp161948EVP_OpenInit() initializes a cipher context B<ctx> for decryption
25*2175Sjp161948with cipher B<type>. It decrypts the encrypted symmetric key of length
26*2175Sjp161948B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>.
27*2175Sjp161948The IV is supplied in the B<iv> parameter.
28*2175Sjp161948
29*2175Sjp161948EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties
30*2175Sjp161948as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as
31*2175Sjp161948documented on the L<EVP_EncryptInit(3)|EVP_EncryptInit(3)> manual
32*2175Sjp161948page.
33*2175Sjp161948
34*2175Sjp161948=head1 NOTES
35*2175Sjp161948
36*2175Sjp161948It is possible to call EVP_OpenInit() twice in the same way as
37*2175Sjp161948EVP_DecryptInit(). The first call should have B<priv> set to NULL
38*2175Sjp161948and (after setting any cipher parameters) it should be called again
39*2175Sjp161948with B<type> set to NULL.
40*2175Sjp161948
41*2175Sjp161948If the cipher passed in the B<type> parameter is a variable length
42*2175Sjp161948cipher then the key length will be set to the value of the recovered
43*2175Sjp161948key length. If the cipher is a fixed length cipher then the recovered
44*2175Sjp161948key length must match the fixed cipher length.
45*2175Sjp161948
46*2175Sjp161948=head1 RETURN VALUES
47*2175Sjp161948
48*2175Sjp161948EVP_OpenInit() returns 0 on error or a non zero integer (actually the
49*2175Sjp161948recovered secret key size) if successful.
50*2175Sjp161948
51*2175Sjp161948EVP_OpenUpdate() returns 1 for success or 0 for failure.
52*2175Sjp161948
53*2175Sjp161948EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success.
54*2175Sjp161948
55*2175Sjp161948=head1 SEE ALSO
56*2175Sjp161948
57*2175Sjp161948L<evp(3)|evp(3)>, L<rand(3)|rand(3)>,
58*2175Sjp161948L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>,
59*2175Sjp161948L<EVP_SealInit(3)|EVP_SealInit(3)>
60*2175Sjp161948
61*2175Sjp161948=head1 HISTORY
62*2175Sjp161948
63*2175Sjp161948=cut
64