EVP_PBE_CipherInit.3ossl 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "EVP_PBE_CIPHERINIT 3ossl"
  58. .TH EVP_PBE_CIPHERINIT 3ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex,
  65. EVP_PBE_find, EVP_PBE_find_ex,
  66. EVP_PBE_alg_add_type, EVP_PBE_alg_add \- Password based encryption routines
  67. .SH SYNOPSIS
  68. .IX Header "SYNOPSIS"
  69. .Vb 1
  70. \& #include <openssl/evp.h>
  71. \&
  72. \& int EVP_PBE_CipherInit(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
  73. \& ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
  74. \& int EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
  75. \& ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de,
  76. \& OSSL_LIB_CTX *libctx, const char *propq);
  77. \&
  78. \& int EVP_PBE_find(int type, int pbe_nid, int *pcnid, int *pmnid,
  79. \& EVP_PBE_KEYGEN **pkeygen);
  80. \& int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,
  81. \& EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex);
  82. \&
  83. \& int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
  84. \& int md_nid, EVP_PBE_KEYGEN *keygen);
  85. \& int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
  86. \& EVP_PBE_KEYGEN *keygen);
  87. .Ve
  88. .SH DESCRIPTION
  89. .IX Header "DESCRIPTION"
  90. .SS "PBE operations"
  91. .IX Subsection "PBE operations"
  92. \&\fBEVP_PBE_CipherInit()\fR and \fBEVP_PBE_CipherInit_ex()\fR initialise an \fBEVP_CIPHER_CTX\fR
  93. \&\fIctx\fR for encryption (\fIen_de\fR=1) or decryption (\fIen_de\fR=0) using the password
  94. \&\fIpass\fR of length \fIpasslen\fR. The PBE algorithm type and parameters are extracted
  95. from an OID \fIpbe_obj\fR and parameters \fIparam\fR.
  96. .PP
  97. \&\fBEVP_PBE_CipherInit_ex()\fR also allows the application to specify a library context
  98. \&\fIlibctx\fR and property query \fIpropq\fR to select appropriate algorithm
  99. implementations.
  100. .SS "PBE algorithm search"
  101. .IX Subsection "PBE algorithm search"
  102. \&\fBEVP_PBE_find()\fR and \fBEVP_PBE_find_ex()\fR search for a matching algorithm using two parameters:
  103. .PP
  104. 1. An algorithm type \fItype\fR which can be:
  105. .IP \(bu 4
  106. EVP_PBE_TYPE_OUTER \- A PBE algorithm
  107. .IP \(bu 4
  108. EVP_PBE_TYPE_PRF \- A pseudo-random function
  109. .IP \(bu 4
  110. EVP_PBE_TYPE_KDF \- A key derivation function
  111. .PP
  112. 2. A \fIpbe_nid\fR which can represent the algorithm identifier with parameters e.g.
  113. \&\fBNID_pbeWithSHA1AndRC2_CBC\fR or an algorithm class e.g. \fBNID_pbes2\fR.
  114. .PP
  115. They return the algorithm's cipher ID \fIpcnid\fR, digest ID \fIpmnid\fR and a key
  116. generation function for the algorithm \fIpkeygen\fR. \fBEVP_PBE_CipherInit_ex()\fR also
  117. returns an extended key generation function \fIkeygen_ex\fR which takes a library
  118. context and property query.
  119. .PP
  120. If a NULL is supplied for any of \fIpcnid\fR, \fIpmnid\fR, \fIpkeygen\fR or \fIpkeygen_ex\fR
  121. then this parameter is not returned.
  122. .SS "PBE algorithm add"
  123. .IX Subsection "PBE algorithm add"
  124. \&\fBEVP_PBE_alg_add_type()\fR and \fBEVP_PBE_alg_add()\fR add an algorithm to the list
  125. of known algorithms. Their parameters have the same meaning as for
  126. \&\fBEVP_PBE_find()\fR and \fBEVP_PBE_find_ex()\fR functions.
  127. .SH NOTES
  128. .IX Header "NOTES"
  129. The arguments \fIpbe_obj\fR and \fIparam\fR to \fBEVP_PBE_CipherInit()\fR and \fBEVP_PBE_CipherInit_ex()\fR
  130. together form an \fBX509_ALGOR\fR and can often be extracted directly from this structure.
  131. .SH "RETURN VALUES"
  132. .IX Header "RETURN VALUES"
  133. Return value is 1 for success and 0 if an error occurred.
  134. .SH "SEE ALSO"
  135. .IX Header "SEE ALSO"
  136. \&\fBPKCS5_PBE_keyivgen\fR\|(3),
  137. \&\fBPKCS12_PBE_keyivgen_ex\fR\|(3),
  138. \&\fBPKCS5_v2_PBE_keyivgen_ex\fR\|(3),
  139. \&\fBPKCS12_pbe_crypt_ex\fR\|(3),
  140. \&\fBPKCS12_create_ex\fR\|(3)
  141. .SH HISTORY
  142. .IX Header "HISTORY"
  143. \&\fBEVP_PBE_CipherInit_ex()\fR and \fBEVP_PBE_find_ex()\fR were added in OpenSSL 3.0.
  144. .SH COPYRIGHT
  145. .IX Header "COPYRIGHT"
  146. Copyright 2021 The OpenSSL Project Authors. All Rights Reserved.
  147. .PP
  148. Licensed under the Apache License 2.0 (the "License"). You may not use
  149. this file except in compliance with the License. You can obtain a copy
  150. in the file LICENSE in the source distribution or at
  151. <https://www.openssl.org/source/license.html>.