diff options
| author | bentley <> | 2014-10-12 09:33:04 +0000 |
|---|---|---|
| committer | bentley <> | 2014-10-12 09:33:04 +0000 |
| commit | 78332233d01faa45e0bb0b1583d47cb5ad1ddc19 (patch) | |
| tree | a5087bf8d016a6041c2b6822fbecfd8f6c5e70b1 /src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 | |
| parent | 4e737c824fafe5f105e5f4849a9db2569b5d53d8 (diff) | |
| download | openbsd-78332233d01faa45e0bb0b1583d47cb5ad1ddc19.tar.gz openbsd-78332233d01faa45e0bb0b1583d47cb5ad1ddc19.tar.bz2 openbsd-78332233d01faa45e0bb0b1583d47cb5ad1ddc19.zip | |
Convert libssl manpages from pod to mdoc(7).
libcrypto has not been started yet.
ok schwarze@ miod@
Diffstat (limited to 'src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3')
| -rw-r--r-- | src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 b/src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 new file mode 100644 index 0000000000..2c35ed501c --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | .Dd $Mdocdate: October 12 2014 $ | ||
| 2 | .Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm SSL_CTX_set_default_passwd_cb , | ||
| 6 | .Nm SSL_CTX_set_default_passwd_cb_userdata | ||
| 7 | .Nd set passwd callback for encrypted PEM file handling | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/ssl.h | ||
| 10 | .Ft void | ||
| 11 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | ||
| 12 | .Ft void | ||
| 13 | .Fn SSL_CTX_set_default_passwd_cb_userdata "SSL_CTX *ctx" "void *u" | ||
| 14 | .Ft int | ||
| 15 | .Fn pem_passwd_cb "char *buf" "int size" "int rwflag" "void *userdata" | ||
| 16 | .Sh DESCRIPTION | ||
| 17 | .Fn SSL_CTX_set_default_passwd_cb | ||
| 18 | sets the default password callback called when loading/storing a PEM | ||
| 19 | certificate with encryption. | ||
| 20 | .Pp | ||
| 21 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
| 22 | sets a pointer to userdata | ||
| 23 | .Fa u | ||
| 24 | which will be provided to the password callback on invocation. | ||
| 25 | .Pp | ||
| 26 | The | ||
| 27 | .Fn pem_passwd_cb , | ||
| 28 | which must be provided by the application, | ||
| 29 | hands back the password to be used during decryption. | ||
| 30 | On invocation a pointer to | ||
| 31 | .Fa userdata | ||
| 32 | is provided. | ||
| 33 | The pem_passwd_cb must write the password into the provided buffer | ||
| 34 | .Fa buf | ||
| 35 | which is of size | ||
| 36 | .Fa size . | ||
| 37 | The actual length of the password must be returned to the calling function. | ||
| 38 | .Fa rwflag | ||
| 39 | indicates whether the callback is used for reading/decryption | ||
| 40 | .Pq Fa rwflag No = 0 | ||
| 41 | or writing/encryption | ||
| 42 | .Pq Fa rwflag No = 1 . | ||
| 43 | .Sh NOTES | ||
| 44 | When loading or storing private keys, a password might be supplied to protect | ||
| 45 | the private key. | ||
| 46 | The way this password can be supplied may depend on the application. | ||
| 47 | If only one private key is handled, it can be practical to have | ||
| 48 | .Fn pem_passwd_cb | ||
| 49 | handle the password dialog interactively. | ||
| 50 | If several keys have to be handled, it can be practical to ask for the password | ||
| 51 | once, then keep it in memory and use it several times. | ||
| 52 | In the last case, the password could be stored into the | ||
| 53 | .Fa userdata | ||
| 54 | storage and the | ||
| 55 | .Fn pem_passwd_cb | ||
| 56 | only returns the password already stored. | ||
| 57 | .Pp | ||
| 58 | When asking for the password interactively, | ||
| 59 | .Fn pem_passwd_cb | ||
| 60 | can use | ||
| 61 | .Fa rwflag | ||
| 62 | to check whether an item shall be encrypted | ||
| 63 | .Pq Fa rwflag No = 1 . | ||
| 64 | In this case the password dialog may ask for the same password twice for | ||
| 65 | comparison in order to catch typos which would make decryption impossible. | ||
| 66 | .Pp | ||
| 67 | Other items in PEM formatting (certificates) can also be encrypted; it is | ||
| 68 | however atypical, as certificate information is considered public. | ||
| 69 | .Sh RETURN VALUES | ||
| 70 | .Fn SSL_CTX_set_default_passwd_cb | ||
| 71 | and | ||
| 72 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
| 73 | do not provide diagnostic information. | ||
| 74 | .Sh EXAMPLES | ||
| 75 | The following example returns the password provided as | ||
| 76 | .Fa userdata | ||
| 77 | to the calling function. | ||
| 78 | The password is considered to be a | ||
| 79 | .Sq \e0 | ||
| 80 | terminated string. | ||
| 81 | If the password does not fit into the buffer, the password is truncated. | ||
| 82 | .Bd -literal | ||
| 83 | int pem_passwd_cb(char *buf, int size, int rwflag, void *password) | ||
| 84 | { | ||
| 85 | strncpy(buf, (char *)password, size); | ||
| 86 | buf[size - 1] = '\e0'; | ||
| 87 | return strlen(buf); | ||
| 88 | } | ||
| 89 | .Ed | ||
| 90 | .Sh SEE ALSO | ||
| 91 | .Xr ssl 3 , | ||
| 92 | .Xr SSL_CTX_use_certificate 3 | ||
