EVP_OpenInit.pod 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. =pod
  2. =head1 NAME
  3. EVP_OpenInit, EVP_OpenUpdate, EVP_OpenFinal - EVP envelope decryption
  4. =head1 SYNOPSIS
  5. #include <openssl/evp.h>
  6. int EVP_OpenInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char *ek,
  7. int ekl, unsigned char *iv, EVP_PKEY *priv);
  8. int EVP_OpenUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
  9. int *outl, unsigned char *in, int inl);
  10. int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
  11. =head1 DESCRIPTION
  12. The EVP envelope routines are a high level interface to envelope
  13. decryption. They decrypt a public key encrypted symmetric key and
  14. then decrypt data using it.
  15. EVP_OpenInit() initializes a cipher context B<ctx> for decryption
  16. with cipher B<type>. It decrypts the encrypted symmetric key of length
  17. B<ekl> bytes passed in the B<ek> parameter using the private key B<priv>.
  18. The IV is supplied in the B<iv> parameter.
  19. EVP_OpenUpdate() and EVP_OpenFinal() have exactly the same properties
  20. as the EVP_DecryptUpdate() and EVP_DecryptFinal() routines, as
  21. documented on the L<EVP_EncryptInit(3)> manual
  22. page.
  23. =head1 NOTES
  24. It is possible to call EVP_OpenInit() twice in the same way as
  25. EVP_DecryptInit(). The first call should have B<priv> set to NULL
  26. and (after setting any cipher parameters) it should be called again
  27. with B<type> set to NULL.
  28. If the cipher passed in the B<type> parameter is a variable length
  29. cipher then the key length will be set to the value of the recovered
  30. key length. If the cipher is a fixed length cipher then the recovered
  31. key length must match the fixed cipher length.
  32. =head1 RETURN VALUES
  33. EVP_OpenInit() returns 0 on error or a non zero integer (actually the
  34. recovered secret key size) if successful.
  35. EVP_OpenUpdate() returns 1 for success or 0 for failure.
  36. EVP_OpenFinal() returns 0 if the decrypt failed or 1 for success.
  37. =head1 SEE ALSO
  38. L<evp(7)>, L<RAND_bytes(3)>,
  39. L<EVP_EncryptInit(3)>,
  40. L<EVP_SealInit(3)>
  41. =head1 COPYRIGHT
  42. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  43. Licensed under the Apache License 2.0 (the "License"). You may not use
  44. this file except in compliance with the License. You can obtain a copy
  45. in the file LICENSE in the source distribution or at
  46. L<https://www.openssl.org/source/license.html>.
  47. =cut