summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
diff options
context:
space:
mode:
authorschwarze <>2020-06-15 14:13:14 +0000
committerschwarze <>2020-06-15 14:13:14 +0000
commit4bfe7a8142cca41be10b23d34ef9669f5c0f66a8 (patch)
treebc161df063488045bbf6766c8a9387db141fb561 /src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
parentb78ec3ca8833536a97dce6c4d3972368bd28c9f3 (diff)
downloadopenbsd-4bfe7a8142cca41be10b23d34ef9669f5c0f66a8.tar.gz
openbsd-4bfe7a8142cca41be10b23d34ef9669f5c0f66a8.tar.bz2
openbsd-4bfe7a8142cca41be10b23d34ef9669f5c0f66a8.zip
Document PEM_def_callback(3).
Move pem_password_cb(3) to the file PEM_read(3) and rewrite its description from scratch for precision and conciseness. Plus some minor improvements in the vicinity. Tweaks and OK tb@.
Diffstat (limited to 'src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3')
-rw-r--r--src/lib/libcrypto/man/PEM_read_bio_PrivateKey.382
1 files changed, 12 insertions, 70 deletions
diff --git a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
index 3799baa040..cc58640b1c 100644
--- a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
+++ b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.17 2020/06/12 11:37:42 schwarze Exp $ 1.\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.18 2020/06/15 14:13:14 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100 3.\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100
4.\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100 4.\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100
@@ -51,11 +51,10 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: June 12 2020 $ 54.Dd $Mdocdate: June 15 2020 $
55.Dt PEM_READ_BIO_PRIVATEKEY 3 55.Dt PEM_READ_BIO_PRIVATEKEY 3
56.Os 56.Os
57.Sh NAME 57.Sh NAME
58.Nm pem_password_cb ,
59.Nm PEM_read_bio_PrivateKey , 58.Nm PEM_read_bio_PrivateKey ,
60.Nm PEM_read_PrivateKey , 59.Nm PEM_read_PrivateKey ,
61.Nm PEM_write_bio_PrivateKey , 60.Nm PEM_write_bio_PrivateKey ,
@@ -149,13 +148,6 @@
149.Nd PEM routines 148.Nd PEM routines
150.Sh SYNOPSIS 149.Sh SYNOPSIS
151.In openssl/pem.h 150.In openssl/pem.h
152.Ft typedef int
153.Fo pem_password_cb
154.Fa "char *buf"
155.Fa "int size"
156.Fa "int rwflag"
157.Fa "void *u"
158.Fc
159.Ft EVP_PKEY * 151.Ft EVP_PKEY *
160.Fo PEM_read_bio_PrivateKey 152.Fo PEM_read_bio_PrivateKey
161.Fa "BIO *bp" 153.Fa "BIO *bp"
@@ -754,7 +746,9 @@
754.Sh DESCRIPTION 746.Sh DESCRIPTION
755The PEM functions read or write structures in PEM format. 747The PEM functions read or write structures in PEM format.
756In this sense PEM format is simply base64-encoded data surrounded by 748In this sense PEM format is simply base64-encoded data surrounded by
757header lines. 749header lines; see
750.Xr PEM_read 3
751for more details.
758.Pp 752.Pp
759For more details about the meaning of arguments see the 753For more details about the meaning of arguments see the
760.Sx PEM function arguments 754.Sx PEM function arguments
@@ -1050,10 +1044,14 @@ If this parameter is set to
1050.Dv NULL , 1044.Dv NULL ,
1051then the private key is written in unencrypted form. 1045then the private key is written in unencrypted form.
1052.Pp 1046.Pp
1053The 1047The optional arguments
1048.Fa u
1049and
1054.Fa cb 1050.Fa cb
1055argument is the callback to use when querying for the passphrase used 1051are a passphrase used for encrypting a PEM structure
1056for encrypted PEM structures (normally only private keys). 1052or a callback to obtain the passphrase; see
1053.Xr pem_password_cb 3
1054for details.
1057.Pp 1055.Pp
1058For the PEM write routines, if the 1056For the PEM write routines, if the
1059.Fa kstr 1057.Fa kstr
@@ -1066,62 +1064,6 @@ bytes at
1066are used as the passphrase and 1064are used as the passphrase and
1067.Fa cb 1065.Fa cb
1068is ignored. 1066is ignored.
1069.Pp
1070If the
1071.Fa cb
1072parameter is set to
1073.Dv NULL
1074and the
1075.Fa u
1076parameter is not
1077.Dv NULL ,
1078then the
1079.Fa u
1080parameter is interpreted as a null terminated string to use as the
1081passphrase.
1082If both
1083.Fa cb
1084and
1085.Fa u
1086are
1087.Dv NULL ,
1088then the default callback routine is used, which will typically
1089prompt for the passphrase on the current terminal with echoing
1090turned off.
1091.Pp
1092The default passphrase callback is sometimes inappropriate (for example
1093in a GUI application) so an alternative can be supplied.
1094The callback routine has the following form:
1095.Bd -filled -offset inset
1096.Ft int
1097.Fo cb
1098.Fa "char *buf"
1099.Fa "int size"
1100.Fa "int rwflag"
1101.Fa "void *u"
1102.Fc
1103.Ed
1104.Pp
1105.Fa buf
1106is the buffer to write the passphrase to.
1107.Fa size
1108is the maximum length of the passphrase, i.e. the size of
1109.Fa buf .
1110.Fa rwflag
1111is a flag which is set to 0 when reading and 1 when writing.
1112A typical routine will ask the user to verify the passphrase (for
1113example by prompting for it twice) if
1114.Fa rwflag
1115is 1.
1116The
1117.Fa u
1118parameter has the same value as the
1119.Fa u
1120parameter passed to the PEM routine.
1121It allows arbitrary data to be passed to the callback by the application
1122(for example a window handle in a GUI application).
1123The callback must return the number of characters in the passphrase
1124or -1 if an error occurred.
1125.Ss PEM encryption format 1067.Ss PEM encryption format
1126This old 1068This old
1127.Sy PrivateKey 1069.Sy PrivateKey