diff options
Diffstat (limited to 'src/lib/libssl/src/doc')
59 files changed, 6083 insertions, 23 deletions
diff --git a/src/lib/libssl/src/doc/apps/cms.pod b/src/lib/libssl/src/doc/apps/cms.pod new file mode 100644 index 0000000000..a09588a18d --- /dev/null +++ b/src/lib/libssl/src/doc/apps/cms.pod | |||
| @@ -0,0 +1,602 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | cms - CMS utility | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | B<openssl> B<cms> | ||
| 10 | [B<-encrypt>] | ||
| 11 | [B<-decrypt>] | ||
| 12 | [B<-sign>] | ||
| 13 | [B<-verify>] | ||
| 14 | [B<-cmsout>] | ||
| 15 | [B<-resign>] | ||
| 16 | [B<-data_create>] | ||
| 17 | [B<-data_out>] | ||
| 18 | [B<-digest_create>] | ||
| 19 | [B<-digest_verify>] | ||
| 20 | [B<-compress>] | ||
| 21 | [B<-uncompress>] | ||
| 22 | [B<-EncryptedData_encrypt>] | ||
| 23 | [B<-sign_receipt>] | ||
| 24 | [B<-verify_receipt receipt>] | ||
| 25 | [B<-in filename>] | ||
| 26 | [B<-inform SMIME|PEM|DER>] | ||
| 27 | [B<-rctform SMIME|PEM|DER>] | ||
| 28 | [B<-out filename>] | ||
| 29 | [B<-outform SMIME|PEM|DER>] | ||
| 30 | [B<-stream -indef -noindef>] | ||
| 31 | [B<-noindef>] | ||
| 32 | [B<-content filename>] | ||
| 33 | [B<-text>] | ||
| 34 | [B<-noout>] | ||
| 35 | [B<-print>] | ||
| 36 | [B<-CAfile file>] | ||
| 37 | [B<-CApath dir>] | ||
| 38 | [B<-md digest>] | ||
| 39 | [B<-[cipher]>] | ||
| 40 | [B<-nointern>] | ||
| 41 | [B<-no_signer_cert_verify>] | ||
| 42 | [B<-nocerts>] | ||
| 43 | [B<-noattr>] | ||
| 44 | [B<-nosmimecap>] | ||
| 45 | [B<-binary>] | ||
| 46 | [B<-nodetach>] | ||
| 47 | [B<-certfile file>] | ||
| 48 | [B<-certsout file>] | ||
| 49 | [B<-signer file>] | ||
| 50 | [B<-recip file>] | ||
| 51 | [B<-keyid>] | ||
| 52 | [B<-receipt_request_all -receipt_request_first>] | ||
| 53 | [B<-receipt_request_from emailaddress>] | ||
| 54 | [B<-receipt_request_to emailaddress>] | ||
| 55 | [B<-receipt_request_print>] | ||
| 56 | [B<-secretkey key>] | ||
| 57 | [B<-secretkeyid id>] | ||
| 58 | [B<-econtent_type type>] | ||
| 59 | [B<-inkey file>] | ||
| 60 | [B<-passin arg>] | ||
| 61 | [B<-rand file(s)>] | ||
| 62 | [B<cert.pem...>] | ||
| 63 | [B<-to addr>] | ||
| 64 | [B<-from addr>] | ||
| 65 | [B<-subject subj>] | ||
| 66 | [cert.pem]... | ||
| 67 | |||
| 68 | =head1 DESCRIPTION | ||
| 69 | |||
| 70 | The B<cms> command handles S/MIME v3.1 mail. It can encrypt, decrypt, sign and | ||
| 71 | verify, compress and uncompress S/MIME messages. | ||
| 72 | |||
| 73 | =head1 COMMAND OPTIONS | ||
| 74 | |||
| 75 | There are fourteen operation options that set the type of operation to be | ||
| 76 | performed. The meaning of the other options varies according to the operation | ||
| 77 | type. | ||
| 78 | |||
| 79 | =over 4 | ||
| 80 | |||
| 81 | =item B<-encrypt> | ||
| 82 | |||
| 83 | encrypt mail for the given recipient certificates. Input file is the message | ||
| 84 | to be encrypted. The output file is the encrypted mail in MIME format. The | ||
| 85 | actual CMS type is <B>EnvelopedData<B>. | ||
| 86 | |||
| 87 | =item B<-decrypt> | ||
| 88 | |||
| 89 | decrypt mail using the supplied certificate and private key. Expects an | ||
| 90 | encrypted mail message in MIME format for the input file. The decrypted mail | ||
| 91 | is written to the output file. | ||
| 92 | |||
| 93 | =item B<-sign> | ||
| 94 | |||
| 95 | sign mail using the supplied certificate and private key. Input file is | ||
| 96 | the message to be signed. The signed message in MIME format is written | ||
| 97 | to the output file. | ||
| 98 | |||
| 99 | =item B<-verify> | ||
| 100 | |||
| 101 | verify signed mail. Expects a signed mail message on input and outputs | ||
| 102 | the signed data. Both clear text and opaque signing is supported. | ||
| 103 | |||
| 104 | =item B<-cmsout> | ||
| 105 | |||
| 106 | takes an input message and writes out a PEM encoded CMS structure. | ||
| 107 | |||
| 108 | =item B<-resign> | ||
| 109 | |||
| 110 | resign a message: take an existing message and one or more new signers. | ||
| 111 | |||
| 112 | =item B<-data_create> | ||
| 113 | |||
| 114 | Create a CMS B<Data> type. | ||
| 115 | |||
| 116 | =item B<-data_out> | ||
| 117 | |||
| 118 | B<Data> type and output the content. | ||
| 119 | |||
| 120 | =item B<-digest_create> | ||
| 121 | |||
| 122 | Create a CMS B<DigestedData> type. | ||
| 123 | |||
| 124 | =item B<-digest_verify> | ||
| 125 | |||
| 126 | Verify a CMS B<DigestedData> type and output the content. | ||
| 127 | |||
| 128 | =item B<-compress> | ||
| 129 | |||
| 130 | Create a CMS B<CompressedData> type. OpenSSL must be compiled with B<zlib> | ||
| 131 | support for this option to work, otherwise it will output an error. | ||
| 132 | |||
| 133 | =item B<-uncompress> | ||
| 134 | |||
| 135 | Uncompress a CMS B<CompressedData> type and output the content. OpenSSL must be | ||
| 136 | compiled with B<zlib> support for this option to work, otherwise it will | ||
| 137 | output an error. | ||
| 138 | |||
| 139 | =item B<-EncryptedData_encrypt> | ||
| 140 | |||
| 141 | Encrypt suppled content using supplied symmetric key and algorithm using a CMS | ||
| 142 | B<EncrytedData> type and output the content. | ||
| 143 | |||
| 144 | =item B<-sign_receipt> | ||
| 145 | |||
| 146 | Generate and output a signed receipt for the supplied message. The input | ||
| 147 | message B<must> contain a signed receipt request. Functionality is otherwise | ||
| 148 | similar to the B<-sign> operation. | ||
| 149 | |||
| 150 | =item B<-verify_receipt receipt> | ||
| 151 | |||
| 152 | Verify a signed receipt in filename B<receipt>. The input message B<must> | ||
| 153 | contain the original receipt request. Functionality is otherwise similar | ||
| 154 | to the B<-verify> operation. | ||
| 155 | |||
| 156 | =item B<-in filename> | ||
| 157 | |||
| 158 | the input message to be encrypted or signed or the message to be decrypted | ||
| 159 | or verified. | ||
| 160 | |||
| 161 | =item B<-inform SMIME|PEM|DER> | ||
| 162 | |||
| 163 | this specifies the input format for the CMS structure. The default | ||
| 164 | is B<SMIME> which reads an S/MIME format message. B<PEM> and B<DER> | ||
| 165 | format change this to expect PEM and DER format CMS structures | ||
| 166 | instead. This currently only affects the input format of the CMS | ||
| 167 | structure, if no CMS structure is being input (for example with | ||
| 168 | B<-encrypt> or B<-sign>) this option has no effect. | ||
| 169 | |||
| 170 | =item B<-rctform SMIME|PEM|DER> | ||
| 171 | |||
| 172 | specify the format for a signed receipt for use with the B<-receipt_verify> | ||
| 173 | operation. | ||
| 174 | |||
| 175 | =item B<-out filename> | ||
| 176 | |||
| 177 | the message text that has been decrypted or verified or the output MIME | ||
| 178 | format message that has been signed or verified. | ||
| 179 | |||
| 180 | =item B<-outform SMIME|PEM|DER> | ||
| 181 | |||
| 182 | this specifies the output format for the CMS structure. The default | ||
| 183 | is B<SMIME> which writes an S/MIME format message. B<PEM> and B<DER> | ||
| 184 | format change this to write PEM and DER format CMS structures | ||
| 185 | instead. This currently only affects the output format of the CMS | ||
| 186 | structure, if no CMS structure is being output (for example with | ||
| 187 | B<-verify> or B<-decrypt>) this option has no effect. | ||
| 188 | |||
| 189 | =item B<-stream -indef -noindef> | ||
| 190 | |||
| 191 | the B<-stream> and B<-indef> options are equivalent and enable streaming I/O | ||
| 192 | for encoding operations. This permits single pass processing of data without | ||
| 193 | the need to hold the entire contents in memory, potentially supporting very | ||
| 194 | large files. Streaming is automatically set for S/MIME signing with detached | ||
| 195 | data if the output format is B<SMIME> it is currently off by default for all | ||
| 196 | other operations. | ||
| 197 | |||
| 198 | =item B<-noindef> | ||
| 199 | |||
| 200 | disable streaming I/O where it would produce and indefinite length constructed | ||
| 201 | encoding. This option currently has no effect. In future streaming will be | ||
| 202 | enabled by default on all relevant operations and this option will disable it. | ||
| 203 | |||
| 204 | =item B<-content filename> | ||
| 205 | |||
| 206 | This specifies a file containing the detached content, this is only | ||
| 207 | useful with the B<-verify> command. This is only usable if the CMS | ||
| 208 | structure is using the detached signature form where the content is | ||
| 209 | not included. This option will override any content if the input format | ||
| 210 | is S/MIME and it uses the multipart/signed MIME content type. | ||
| 211 | |||
| 212 | =item B<-text> | ||
| 213 | |||
| 214 | this option adds plain text (text/plain) MIME headers to the supplied | ||
| 215 | message if encrypting or signing. If decrypting or verifying it strips | ||
| 216 | off text headers: if the decrypted or verified message is not of MIME | ||
| 217 | type text/plain then an error occurs. | ||
| 218 | |||
| 219 | =item B<-noout> | ||
| 220 | |||
| 221 | for the B<-cmsout> operation do not output the parsed CMS structure. This | ||
| 222 | is useful when combined with the B<-print> option or if the syntax of the CMS | ||
| 223 | structure is being checked. | ||
| 224 | |||
| 225 | =item B<-print> | ||
| 226 | |||
| 227 | for the B<-cmsout> operation print out all fields of the CMS structure. This | ||
| 228 | is mainly useful for testing purposes. | ||
| 229 | |||
| 230 | =item B<-CAfile file> | ||
| 231 | |||
| 232 | a file containing trusted CA certificates, only used with B<-verify>. | ||
| 233 | |||
| 234 | =item B<-CApath dir> | ||
| 235 | |||
| 236 | a directory containing trusted CA certificates, only used with | ||
| 237 | B<-verify>. This directory must be a standard certificate directory: that | ||
| 238 | is a hash of each subject name (using B<x509 -hash>) should be linked | ||
| 239 | to each certificate. | ||
| 240 | |||
| 241 | =item B<-md digest> | ||
| 242 | |||
| 243 | digest algorithm to use when signing or resigning. If not present then the | ||
| 244 | default digest algorithm for the signing key will be used (usually SHA1). | ||
| 245 | |||
| 246 | =item B<-[cipher]> | ||
| 247 | |||
| 248 | the encryption algorithm to use. For example triple DES (168 bits) - B<-des3> | ||
| 249 | or 256 bit AES - B<-aes256>. Any standard algorithm name (as used by the | ||
| 250 | EVP_get_cipherbyname() function) can also be used preceded by a dash, for | ||
| 251 | example B<-aes_128_cbc>. See L<B<enc>|enc(1)> for a list of ciphers | ||
| 252 | supported by your version of OpenSSL. | ||
| 253 | |||
| 254 | If not specified triple DES is used. Only used with B<-encrypt> and | ||
| 255 | B<-EncryptedData_create> commands. | ||
| 256 | |||
| 257 | =item B<-nointern> | ||
| 258 | |||
| 259 | when verifying a message normally certificates (if any) included in | ||
| 260 | the message are searched for the signing certificate. With this option | ||
| 261 | only the certificates specified in the B<-certfile> option are used. | ||
| 262 | The supplied certificates can still be used as untrusted CAs however. | ||
| 263 | |||
| 264 | =item B<-no_signer_cert_verify> | ||
| 265 | |||
| 266 | do not verify the signers certificate of a signed message. | ||
| 267 | |||
| 268 | =item B<-nocerts> | ||
| 269 | |||
| 270 | when signing a message the signer's certificate is normally included | ||
| 271 | with this option it is excluded. This will reduce the size of the | ||
| 272 | signed message but the verifier must have a copy of the signers certificate | ||
| 273 | available locally (passed using the B<-certfile> option for example). | ||
| 274 | |||
| 275 | =item B<-noattr> | ||
| 276 | |||
| 277 | normally when a message is signed a set of attributes are included which | ||
| 278 | include the signing time and supported symmetric algorithms. With this | ||
| 279 | option they are not included. | ||
| 280 | |||
| 281 | =item B<-nosmimecap> | ||
| 282 | |||
| 283 | exclude the list of supported algorithms from signed attributes, other options | ||
| 284 | such as signing time and content type are still included. | ||
| 285 | |||
| 286 | =item B<-binary> | ||
| 287 | |||
| 288 | normally the input message is converted to "canonical" format which is | ||
| 289 | effectively using CR and LF as end of line: as required by the S/MIME | ||
| 290 | specification. When this option is present no translation occurs. This | ||
| 291 | is useful when handling binary data which may not be in MIME format. | ||
| 292 | |||
| 293 | =item B<-nodetach> | ||
| 294 | |||
| 295 | when signing a message use opaque signing: this form is more resistant | ||
| 296 | to translation by mail relays but it cannot be read by mail agents that | ||
| 297 | do not support S/MIME. Without this option cleartext signing with | ||
| 298 | the MIME type multipart/signed is used. | ||
| 299 | |||
| 300 | =item B<-certfile file> | ||
| 301 | |||
| 302 | allows additional certificates to be specified. When signing these will | ||
| 303 | be included with the message. When verifying these will be searched for | ||
| 304 | the signers certificates. The certificates should be in PEM format. | ||
| 305 | |||
| 306 | =item B<-certsout file> | ||
| 307 | |||
| 308 | any certificates contained in the message are written to B<file>. | ||
| 309 | |||
| 310 | =item B<-signer file> | ||
| 311 | |||
| 312 | a signing certificate when signing or resigning a message, this option can be | ||
| 313 | used multiple times if more than one signer is required. If a message is being | ||
| 314 | verified then the signers certificates will be written to this file if the | ||
| 315 | verification was successful. | ||
| 316 | |||
| 317 | =item B<-recip file> | ||
| 318 | |||
| 319 | the recipients certificate when decrypting a message. This certificate | ||
| 320 | must match one of the recipients of the message or an error occurs. | ||
| 321 | |||
| 322 | =item B<-keyid> | ||
| 323 | |||
| 324 | use subject key identifier to identify certificates instead of issuer name and | ||
| 325 | serial number. The supplied certificate B<must> include a subject key | ||
| 326 | identifier extension. Supported by B<-sign> and B<-encrypt> options. | ||
| 327 | |||
| 328 | =item B<-receipt_request_all -receipt_request_first> | ||
| 329 | |||
| 330 | for B<-sign> option include a signed receipt request. Indicate requests should | ||
| 331 | be provided by all receipient or first tier recipients (those mailed directly | ||
| 332 | and not from a mailing list). Ignored it B<-receipt_request_from> is included. | ||
| 333 | |||
| 334 | =item B<-receipt_request_from emailaddress> | ||
| 335 | |||
| 336 | for B<-sign> option include a signed receipt request. Add an explicit email | ||
| 337 | address where receipts should be supplied. | ||
| 338 | |||
| 339 | =item B<-receipt_request_to emailaddress> | ||
| 340 | |||
| 341 | Add an explicit email address where signed receipts should be sent to. This | ||
| 342 | option B<must> but supplied if a signed receipt it requested. | ||
| 343 | |||
| 344 | =item B<-receipt_request_print> | ||
| 345 | |||
| 346 | For the B<-verify> operation print out the contents of any signed receipt | ||
| 347 | requests. | ||
| 348 | |||
| 349 | =item B<-secretkey key> | ||
| 350 | |||
| 351 | specify symmetric key to use. The key must be supplied in hex format and be | ||
| 352 | consistent with the algorithm used. Supported by the B<-EncryptedData_encrypt> | ||
| 353 | B<-EncrryptedData_decrypt>, B<-encrypt> and B<-decrypt> options. When used | ||
| 354 | with B<-encrypt> or B<-decrypt> the supplied key is used to wrap or unwrap the | ||
| 355 | content encryption key using an AES key in the B<KEKRecipientInfo> type. | ||
| 356 | |||
| 357 | =item B<-secretkeyid id> | ||
| 358 | |||
| 359 | the key identifier for the supplied symmetric key for B<KEKRecipientInfo> type. | ||
| 360 | This option B<must> be present if the B<-secretkey> option is used with | ||
| 361 | B<-encrypt>. With B<-decrypt> operations the B<id> is used to locate the | ||
| 362 | relevant key if it is not supplied then an attempt is used to decrypt any | ||
| 363 | B<KEKRecipientInfo> structures. | ||
| 364 | |||
| 365 | =item B<-econtent_type type> | ||
| 366 | |||
| 367 | set the encapsulated content type to B<type> if not supplied the B<Data> type | ||
| 368 | is used. The B<type> argument can be any valid OID name in either text or | ||
| 369 | numerical format. | ||
| 370 | |||
| 371 | =item B<-inkey file> | ||
| 372 | |||
| 373 | the private key to use when signing or decrypting. This must match the | ||
| 374 | corresponding certificate. If this option is not specified then the | ||
| 375 | private key must be included in the certificate file specified with | ||
| 376 | the B<-recip> or B<-signer> file. When signing this option can be used | ||
| 377 | multiple times to specify successive keys. | ||
| 378 | |||
| 379 | =item B<-passin arg> | ||
| 380 | |||
| 381 | the private key password source. For more information about the format of B<arg> | ||
| 382 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
| 383 | |||
| 384 | =item B<-rand file(s)> | ||
| 385 | |||
| 386 | a file or files containing random data used to seed the random number | ||
| 387 | generator, or an EGD socket (see L<RAND_egd(3)|RAND_egd(3)>). | ||
| 388 | Multiple files can be specified separated by a OS-dependent character. | ||
| 389 | The separator is B<;> for MS-Windows, B<,> for OpenVMS, and B<:> for | ||
| 390 | all others. | ||
| 391 | |||
| 392 | =item B<cert.pem...> | ||
| 393 | |||
| 394 | one or more certificates of message recipients: used when encrypting | ||
| 395 | a message. | ||
| 396 | |||
| 397 | =item B<-to, -from, -subject> | ||
| 398 | |||
| 399 | the relevant mail headers. These are included outside the signed | ||
| 400 | portion of a message so they may be included manually. If signing | ||
| 401 | then many S/MIME mail clients check the signers certificate's email | ||
| 402 | address matches that specified in the From: address. | ||
| 403 | |||
| 404 | =item B<-purpose, -ignore_critical, -issuer_checks, -crl_check, -crl_check_all, -policy_check, -extended_crl, -x509_strict, -policy -check_ss_sig> | ||
| 405 | |||
| 406 | Set various certificate chain valiadition option. See the | ||
| 407 | L<B<verify>|verify(1)> manual page for details. | ||
| 408 | |||
| 409 | =back | ||
| 410 | |||
| 411 | =head1 NOTES | ||
| 412 | |||
| 413 | The MIME message must be sent without any blank lines between the | ||
| 414 | headers and the output. Some mail programs will automatically add | ||
| 415 | a blank line. Piping the mail directly to sendmail is one way to | ||
| 416 | achieve the correct format. | ||
| 417 | |||
| 418 | The supplied message to be signed or encrypted must include the | ||
| 419 | necessary MIME headers or many S/MIME clients wont display it | ||
| 420 | properly (if at all). You can use the B<-text> option to automatically | ||
| 421 | add plain text headers. | ||
| 422 | |||
| 423 | A "signed and encrypted" message is one where a signed message is | ||
| 424 | then encrypted. This can be produced by encrypting an already signed | ||
| 425 | message: see the examples section. | ||
| 426 | |||
| 427 | This version of the program only allows one signer per message but it | ||
| 428 | will verify multiple signers on received messages. Some S/MIME clients | ||
| 429 | choke if a message contains multiple signers. It is possible to sign | ||
| 430 | messages "in parallel" by signing an already signed message. | ||
| 431 | |||
| 432 | The options B<-encrypt> and B<-decrypt> reflect common usage in S/MIME | ||
| 433 | clients. Strictly speaking these process CMS enveloped data: CMS | ||
| 434 | encrypted data is used for other purposes. | ||
| 435 | |||
| 436 | The B<-resign> option uses an existing message digest when adding a new | ||
| 437 | signer. This means that attributes must be present in at least one existing | ||
| 438 | signer using the same message digest or this operation will fail. | ||
| 439 | |||
| 440 | The B<-stream> and B<-indef> options enable experimental streaming I/O support. | ||
| 441 | As a result the encoding is BER using indefinite length constructed encoding | ||
| 442 | and no longer DER. Streaming is supported for the B<-encrypt> operation and the | ||
| 443 | B<-sign> operation if the content is not detached. | ||
| 444 | |||
| 445 | Streaming is always used for the B<-sign> operation with detached data but | ||
| 446 | since the content is no longer part of the CMS structure the encoding | ||
| 447 | remains DER. | ||
| 448 | |||
| 449 | =head1 EXIT CODES | ||
| 450 | |||
| 451 | =over 4 | ||
| 452 | |||
| 453 | =item 0 | ||
| 454 | |||
| 455 | the operation was completely successfully. | ||
| 456 | |||
| 457 | =item 1 | ||
| 458 | |||
| 459 | an error occurred parsing the command options. | ||
| 460 | |||
| 461 | =item 2 | ||
| 462 | |||
| 463 | one of the input files could not be read. | ||
| 464 | |||
| 465 | =item 3 | ||
| 466 | |||
| 467 | an error occurred creating the CMS file or when reading the MIME | ||
| 468 | message. | ||
| 469 | |||
| 470 | =item 4 | ||
| 471 | |||
| 472 | an error occurred decrypting or verifying the message. | ||
| 473 | |||
| 474 | =item 5 | ||
| 475 | |||
| 476 | the message was verified correctly but an error occurred writing out | ||
| 477 | the signers certificates. | ||
| 478 | |||
| 479 | =back | ||
| 480 | |||
| 481 | =head1 COMPATIBILITY WITH PKCS#7 format. | ||
| 482 | |||
| 483 | The B<smime> utility can only process the older B<PKCS#7> format. The B<cms> | ||
| 484 | utility supports Cryptographic Message Syntax format. Use of some features | ||
| 485 | will result in messages which cannot be processed by applications which only | ||
| 486 | support the older format. These are detailed below. | ||
| 487 | |||
| 488 | The use of the B<-keyid> option with B<-sign> or B<-encrypt>. | ||
| 489 | |||
| 490 | The B<-outform PEM> option uses different headers. | ||
| 491 | |||
| 492 | The B<-compress> option. | ||
| 493 | |||
| 494 | The B<-secretkey> option when used with B<-encrypt>. | ||
| 495 | |||
| 496 | Additionally the B<-EncryptedData_create> and B<-data_create> type cannot | ||
| 497 | be processed by the older B<smime> command. | ||
| 498 | |||
| 499 | =head1 EXAMPLES | ||
| 500 | |||
| 501 | Create a cleartext signed message: | ||
| 502 | |||
| 503 | openssl cms -sign -in message.txt -text -out mail.msg \ | ||
| 504 | -signer mycert.pem | ||
| 505 | |||
| 506 | Create an opaque signed message | ||
| 507 | |||
| 508 | openssl cms -sign -in message.txt -text -out mail.msg -nodetach \ | ||
| 509 | -signer mycert.pem | ||
| 510 | |||
| 511 | Create a signed message, include some additional certificates and | ||
| 512 | read the private key from another file: | ||
| 513 | |||
| 514 | openssl cms -sign -in in.txt -text -out mail.msg \ | ||
| 515 | -signer mycert.pem -inkey mykey.pem -certfile mycerts.pem | ||
| 516 | |||
| 517 | Create a signed message with two signers, use key identifier: | ||
| 518 | |||
| 519 | openssl cms -sign -in message.txt -text -out mail.msg \ | ||
| 520 | -signer mycert.pem -signer othercert.pem -keyid | ||
| 521 | |||
| 522 | Send a signed message under Unix directly to sendmail, including headers: | ||
| 523 | |||
| 524 | openssl cms -sign -in in.txt -text -signer mycert.pem \ | ||
| 525 | -from steve@openssl.org -to someone@somewhere \ | ||
| 526 | -subject "Signed message" | sendmail someone@somewhere | ||
| 527 | |||
| 528 | Verify a message and extract the signer's certificate if successful: | ||
| 529 | |||
| 530 | openssl cms -verify -in mail.msg -signer user.pem -out signedtext.txt | ||
| 531 | |||
| 532 | Send encrypted mail using triple DES: | ||
| 533 | |||
| 534 | openssl cms -encrypt -in in.txt -from steve@openssl.org \ | ||
| 535 | -to someone@somewhere -subject "Encrypted message" \ | ||
| 536 | -des3 user.pem -out mail.msg | ||
| 537 | |||
| 538 | Sign and encrypt mail: | ||
| 539 | |||
| 540 | openssl cms -sign -in ml.txt -signer my.pem -text \ | ||
| 541 | | openssl cms -encrypt -out mail.msg \ | ||
| 542 | -from steve@openssl.org -to someone@somewhere \ | ||
| 543 | -subject "Signed and Encrypted message" -des3 user.pem | ||
| 544 | |||
| 545 | Note: the encryption command does not include the B<-text> option because the | ||
| 546 | message being encrypted already has MIME headers. | ||
| 547 | |||
| 548 | Decrypt mail: | ||
| 549 | |||
| 550 | openssl cms -decrypt -in mail.msg -recip mycert.pem -inkey key.pem | ||
| 551 | |||
| 552 | The output from Netscape form signing is a PKCS#7 structure with the | ||
| 553 | detached signature format. You can use this program to verify the | ||
| 554 | signature by line wrapping the base64 encoded structure and surrounding | ||
| 555 | it with: | ||
| 556 | |||
| 557 | -----BEGIN PKCS7----- | ||
| 558 | -----END PKCS7----- | ||
| 559 | |||
| 560 | and using the command, | ||
| 561 | |||
| 562 | openssl cms -verify -inform PEM -in signature.pem -content content.txt | ||
| 563 | |||
| 564 | alternatively you can base64 decode the signature and use | ||
| 565 | |||
| 566 | openssl cms -verify -inform DER -in signature.der -content content.txt | ||
| 567 | |||
| 568 | Create an encrypted message using 128 bit Camellia: | ||
| 569 | |||
| 570 | openssl cms -encrypt -in plain.txt -camellia128 -out mail.msg cert.pem | ||
| 571 | |||
| 572 | Add a signer to an existing message: | ||
| 573 | |||
| 574 | openssl cms -resign -in mail.msg -signer newsign.pem -out mail2.msg | ||
| 575 | |||
| 576 | =head1 BUGS | ||
| 577 | |||
| 578 | The MIME parser isn't very clever: it seems to handle most messages that I've | ||
| 579 | thrown at it but it may choke on others. | ||
| 580 | |||
| 581 | The code currently will only write out the signer's certificate to a file: if | ||
| 582 | the signer has a separate encryption certificate this must be manually | ||
| 583 | extracted. There should be some heuristic that determines the correct | ||
| 584 | encryption certificate. | ||
| 585 | |||
| 586 | Ideally a database should be maintained of a certificates for each email | ||
| 587 | address. | ||
| 588 | |||
| 589 | The code doesn't currently take note of the permitted symmetric encryption | ||
| 590 | algorithms as supplied in the SMIMECapabilities signed attribute. this means the | ||
| 591 | user has to manually include the correct encryption algorithm. It should store | ||
| 592 | the list of permitted ciphers in a database and only use those. | ||
| 593 | |||
| 594 | No revocation checking is done on the signer's certificate. | ||
| 595 | |||
| 596 | =head1 HISTORY | ||
| 597 | |||
| 598 | The use of multiple B<-signer> options and the B<-resign> command were first | ||
| 599 | added in OpenSSL 1.0.0 | ||
| 600 | |||
| 601 | |||
| 602 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/ec.pod b/src/lib/libssl/src/doc/apps/ec.pod index 1d4a36dbf4..ba6dc4689b 100644 --- a/src/lib/libssl/src/doc/apps/ec.pod +++ b/src/lib/libssl/src/doc/apps/ec.pod | |||
| @@ -130,7 +130,7 @@ is currently not implemented in OpenSSL. | |||
| 130 | 130 | ||
| 131 | =item B<-engine id> | 131 | =item B<-engine id> |
| 132 | 132 | ||
| 133 | specifying an engine (by it's unique B<id> string) will cause B<req> | 133 | specifying an engine (by its unique B<id> string) will cause B<ec> |
| 134 | to attempt to obtain a functional reference to the specified engine, | 134 | to attempt to obtain a functional reference to the specified engine, |
| 135 | thus initialising it if needed. The engine will then be set as the default | 135 | thus initialising it if needed. The engine will then be set as the default |
| 136 | for all available algorithms. | 136 | for all available algorithms. |
diff --git a/src/lib/libssl/src/doc/apps/ecparam.pod b/src/lib/libssl/src/doc/apps/ecparam.pod index 1a12105da7..788c074d7b 100644 --- a/src/lib/libssl/src/doc/apps/ecparam.pod +++ b/src/lib/libssl/src/doc/apps/ecparam.pod | |||
| @@ -121,7 +121,7 @@ all others. | |||
| 121 | 121 | ||
| 122 | =item B<-engine id> | 122 | =item B<-engine id> |
| 123 | 123 | ||
| 124 | specifying an engine (by it's unique B<id> string) will cause B<req> | 124 | specifying an engine (by its unique B<id> string) will cause B<ecparam> |
| 125 | to attempt to obtain a functional reference to the specified engine, | 125 | to attempt to obtain a functional reference to the specified engine, |
| 126 | thus initialising it if needed. The engine will then be set as the default | 126 | thus initialising it if needed. The engine will then be set as the default |
| 127 | for all available algorithms. | 127 | for all available algorithms. |
diff --git a/src/lib/libssl/src/doc/apps/genpkey.pod b/src/lib/libssl/src/doc/apps/genpkey.pod new file mode 100644 index 0000000000..1611b5ca78 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/genpkey.pod | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | genpkey - generate a private key | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | B<openssl> B<genpkey> | ||
| 10 | [B<-out filename>] | ||
| 11 | [B<-outform PEM|DER>] | ||
| 12 | [B<-pass arg>] | ||
| 13 | [B<-cipher>] | ||
| 14 | [B<-engine id>] | ||
| 15 | [B<-paramfile file>] | ||
| 16 | [B<-algorithm alg>] | ||
| 17 | [B<-pkeyopt opt:value>] | ||
| 18 | [B<-genparam>] | ||
| 19 | [B<-text>] | ||
| 20 | |||
| 21 | =head1 DESCRIPTION | ||
| 22 | |||
| 23 | The B<genpkey> command generates a private key. | ||
| 24 | |||
| 25 | =head1 OPTIONS | ||
| 26 | |||
| 27 | =over 4 | ||
| 28 | |||
| 29 | =item B<-out filename> | ||
| 30 | |||
| 31 | the output filename. If this argument is not specified then standard output is | ||
| 32 | used. | ||
| 33 | |||
| 34 | =item B<-outform DER|PEM> | ||
| 35 | |||
| 36 | This specifies the output format DER or PEM. | ||
| 37 | |||
| 38 | =item B<-pass arg> | ||
| 39 | |||
| 40 | the output file password source. For more information about the format of B<arg> | ||
| 41 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
| 42 | |||
| 43 | =item B<-cipher> | ||
| 44 | |||
| 45 | This option encrypts the private key with the supplied cipher. Any algorithm | ||
| 46 | name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>. | ||
| 47 | |||
| 48 | =item B<-engine id> | ||
| 49 | |||
| 50 | specifying an engine (by its unique B<id> string) will cause B<genpkey> | ||
| 51 | to attempt to obtain a functional reference to the specified engine, | ||
| 52 | thus initialising it if needed. The engine will then be set as the default | ||
| 53 | for all available algorithms. If used this option should precede all other | ||
| 54 | options. | ||
| 55 | |||
| 56 | =item B<-algorithm alg> | ||
| 57 | |||
| 58 | public key algorithm to use such as RSA, DSA or DH. If used this option must | ||
| 59 | precede any B<-pkeyopt> options. The options B<-paramfile> and B<-algorithm> | ||
| 60 | are mutually exclusive. | ||
| 61 | |||
| 62 | =item B<-pkeyopt opt:value> | ||
| 63 | |||
| 64 | set the public key algorithm option B<opt> to B<value>. The precise set of | ||
| 65 | options supported depends on the public key algorithm used and its | ||
| 66 | implementation. See B<KEY GENERATION OPTIONS> below for more details. | ||
| 67 | |||
| 68 | =item B<-genparam> | ||
| 69 | |||
| 70 | generate a set of parameters instead of a private key. If used this option must | ||
| 71 | precede and B<-algorithm>, B<-paramfile> or B<-pkeyopt> options. | ||
| 72 | |||
| 73 | =item B<-paramfile filename> | ||
| 74 | |||
| 75 | Some public key algorithms generate a private key based on a set of parameters. | ||
| 76 | They can be supplied using this option. If this option is used the public key | ||
| 77 | algorithm used is determined by the parameters. If used this option must | ||
| 78 | precede and B<-pkeyopt> options. The options B<-paramfile> and B<-algorithm> | ||
| 79 | are mutually exclusive. | ||
| 80 | |||
| 81 | =item B<-text> | ||
| 82 | |||
| 83 | Print an (unencrypted) text representation of private and public keys and | ||
| 84 | parameters along with the PEM or DER structure. | ||
| 85 | |||
| 86 | =back | ||
| 87 | |||
| 88 | =head1 KEY GENERATION OPTIONS | ||
| 89 | |||
| 90 | The options supported by each algorith and indeed each implementation of an | ||
| 91 | algorithm can vary. The options for the OpenSSL implementations are detailed | ||
| 92 | below. | ||
| 93 | |||
| 94 | =head1 RSA KEY GENERATION OPTIONS | ||
| 95 | |||
| 96 | =over 4 | ||
| 97 | |||
| 98 | =item B<rsa_keygen_bits:numbits> | ||
| 99 | |||
| 100 | The number of bits in the generated key. If not specified 1024 is used. | ||
| 101 | |||
| 102 | =item B<rsa_keygen_pubexp:value> | ||
| 103 | |||
| 104 | The RSA public exponent value. This can be a large decimal or | ||
| 105 | hexadecimal value if preceded by B<0x>. Default value is 65537. | ||
| 106 | |||
| 107 | =back | ||
| 108 | |||
| 109 | =head1 DSA PARAMETER GENERATION OPTIONS | ||
| 110 | |||
| 111 | =over 4 | ||
| 112 | |||
| 113 | =item B<dsa_paramgen_bits:numbits> | ||
| 114 | |||
| 115 | The number of bits in the generated parameters. If not specified 1024 is used. | ||
| 116 | |||
| 117 | =head1 DH PARAMETER GENERATION OPTIONS | ||
| 118 | |||
| 119 | =over 4 | ||
| 120 | |||
| 121 | =item B<dh_paramgen_prime_len:numbits> | ||
| 122 | |||
| 123 | The number of bits in the prime parameter B<p>. | ||
| 124 | |||
| 125 | =item B<dh_paramgen_generator:value> | ||
| 126 | |||
| 127 | The value to use for the generator B<g>. | ||
| 128 | |||
| 129 | =back | ||
| 130 | |||
| 131 | =head1 EC PARAMETER GENERATION OPTIONS | ||
| 132 | |||
| 133 | =over 4 | ||
| 134 | |||
| 135 | =item B<ec_paramgen_curve:curve> | ||
| 136 | |||
| 137 | the EC curve to use. | ||
| 138 | |||
| 139 | =back | ||
| 140 | |||
| 141 | =head1 GOST2001 KEY GENERATION AND PARAMETER OPTIONS | ||
| 142 | |||
| 143 | Gost 2001 support is not enabled by default. To enable this algorithm, | ||
| 144 | one should load the ccgost engine in the OpenSSL configuration file. | ||
| 145 | See README.gost file in the engines/ccgost directiry of the source | ||
| 146 | distribution for more details. | ||
| 147 | |||
| 148 | Use of a parameter file for the GOST R 34.10 algorithm is optional. | ||
| 149 | Parameters can be specified during key generation directly as well as | ||
| 150 | during generation of parameter file. | ||
| 151 | |||
| 152 | =over 4 | ||
| 153 | |||
| 154 | =item B<paramset:name> | ||
| 155 | |||
| 156 | Specifies GOST R 34.10-2001 parameter set according to RFC 4357. | ||
| 157 | Parameter set can be specified using abbreviated name, object short name or | ||
| 158 | numeric OID. Following parameter sets are supported: | ||
| 159 | |||
| 160 | paramset OID Usage | ||
| 161 | A 1.2.643.2.2.35.1 Signature | ||
| 162 | B 1.2.643.2.2.35.2 Signature | ||
| 163 | C 1.2.643.2.2.35.3 Signature | ||
| 164 | XA 1.2.643.2.2.36.0 Key exchange | ||
| 165 | XB 1.2.643.2.2.36.1 Key exchange | ||
| 166 | test 1.2.643.2.2.35.0 Test purposes | ||
| 167 | |||
| 168 | =back | ||
| 169 | |||
| 170 | |||
| 171 | |||
| 172 | =head1 NOTES | ||
| 173 | |||
| 174 | The use of the genpkey program is encouraged over the algorithm specific | ||
| 175 | utilities because additional algorithm options and ENGINE provided algorithms | ||
| 176 | can be used. | ||
| 177 | |||
| 178 | =head1 EXAMPLES | ||
| 179 | |||
| 180 | Generate an RSA private key using default parameters: | ||
| 181 | |||
| 182 | openssl genpkey -algorithm RSA -out key.pem | ||
| 183 | |||
| 184 | Encrypt output private key using 128 bit AES and the passphrase "hello": | ||
| 185 | |||
| 186 | openssl genpkey -algorithm RSA -out key.pem -aes-128-cbc -pass pass:hello | ||
| 187 | |||
| 188 | Generate a 2048 bit RSA key using 3 as the public exponent: | ||
| 189 | |||
| 190 | openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048 \ | ||
| 191 | -pkeyopt rsa_keygen_pubexp:3 | ||
| 192 | |||
| 193 | Generate 1024 bit DSA parameters: | ||
| 194 | |||
| 195 | openssl genpkey -genparam -algorithm DSA -out dsap.pem \ | ||
| 196 | -pkeyopt dsa_paramgen_bits:1024 | ||
| 197 | |||
| 198 | Generate DSA key from parameters: | ||
| 199 | |||
| 200 | openssl genpkey -paramfile dsap.pem -out dsakey.pem | ||
| 201 | |||
| 202 | Generate 1024 bit DH parameters: | ||
| 203 | |||
| 204 | openssl genpkey -genparam -algorithm DH -out dhp.pem \ | ||
| 205 | -pkeyopt dh_paramgen_prime_len:1024 | ||
| 206 | |||
| 207 | Generate DH key from parameters: | ||
| 208 | |||
| 209 | openssl genpkey -paramfile dhp.pem -out dhkey.pem | ||
| 210 | |||
| 211 | |||
| 212 | =cut | ||
| 213 | |||
diff --git a/src/lib/libssl/src/doc/apps/pkey.pod b/src/lib/libssl/src/doc/apps/pkey.pod new file mode 100644 index 0000000000..4851223f3f --- /dev/null +++ b/src/lib/libssl/src/doc/apps/pkey.pod | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | |||
| 2 | =pod | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | pkey - public or private key processing tool | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | B<openssl> B<pkey> | ||
| 11 | [B<-inform PEM|DER>] | ||
| 12 | [B<-outform PEM|DER>] | ||
| 13 | [B<-in filename>] | ||
| 14 | [B<-passin arg>] | ||
| 15 | [B<-out filename>] | ||
| 16 | [B<-passout arg>] | ||
| 17 | [B<-cipher>] | ||
| 18 | [B<-text>] | ||
| 19 | [B<-text_pub>] | ||
| 20 | [B<-noout>] | ||
| 21 | [B<-pubin>] | ||
| 22 | [B<-pubout>] | ||
| 23 | [B<-engine id>] | ||
| 24 | |||
| 25 | =head1 DESCRIPTION | ||
| 26 | |||
| 27 | The B<pkey> command processes public or private keys. They can be converted | ||
| 28 | between various forms and their components printed out. | ||
| 29 | |||
| 30 | =head1 COMMAND OPTIONS | ||
| 31 | |||
| 32 | =over 4 | ||
| 33 | |||
| 34 | =item B<-inform DER|PEM> | ||
| 35 | |||
| 36 | This specifies the input format DER or PEM. | ||
| 37 | |||
| 38 | =item B<-outform DER|PEM> | ||
| 39 | |||
| 40 | This specifies the output format, the options have the same meaning as the | ||
| 41 | B<-inform> option. | ||
| 42 | |||
| 43 | =item B<-in filename> | ||
| 44 | |||
| 45 | This specifies the input filename to read a key from or standard input if this | ||
| 46 | option is not specified. If the key is encrypted a pass phrase will be | ||
| 47 | prompted for. | ||
| 48 | |||
| 49 | =item B<-passin arg> | ||
| 50 | |||
| 51 | the input file password source. For more information about the format of B<arg> | ||
| 52 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
| 53 | |||
| 54 | =item B<-out filename> | ||
| 55 | |||
| 56 | This specifies the output filename to write a key to or standard output if this | ||
| 57 | option is not specified. If any encryption options are set then a pass phrase | ||
| 58 | will be prompted for. The output filename should B<not> be the same as the input | ||
| 59 | filename. | ||
| 60 | |||
| 61 | =item B<-passout password> | ||
| 62 | |||
| 63 | the output file password source. For more information about the format of B<arg> | ||
| 64 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
| 65 | |||
| 66 | =item B<-cipher> | ||
| 67 | |||
| 68 | These options encrypt the private key with the supplied cipher. Any algorithm | ||
| 69 | name accepted by EVP_get_cipherbyname() is acceptable such as B<des3>. | ||
| 70 | |||
| 71 | =item B<-text> | ||
| 72 | |||
| 73 | prints out the various public or private key components in | ||
| 74 | plain text in addition to the encoded version. | ||
| 75 | |||
| 76 | =item B<-text_pub> | ||
| 77 | |||
| 78 | print out only public key components even if a private key is being processed. | ||
| 79 | |||
| 80 | =item B<-noout> | ||
| 81 | |||
| 82 | do not output the encoded version of the key. | ||
| 83 | |||
| 84 | =item B<-pubin> | ||
| 85 | |||
| 86 | by default a private key is read from the input file: with this | ||
| 87 | option a public key is read instead. | ||
| 88 | |||
| 89 | =item B<-pubout> | ||
| 90 | |||
| 91 | by default a private key is output: with this option a public | ||
| 92 | key will be output instead. This option is automatically set if | ||
| 93 | the input is a public key. | ||
| 94 | |||
| 95 | =item B<-engine id> | ||
| 96 | |||
| 97 | specifying an engine (by its unique B<id> string) will cause B<pkey> | ||
| 98 | to attempt to obtain a functional reference to the specified engine, | ||
| 99 | thus initialising it if needed. The engine will then be set as the default | ||
| 100 | for all available algorithms. | ||
| 101 | |||
| 102 | =back | ||
| 103 | |||
| 104 | =head1 EXAMPLES | ||
| 105 | |||
| 106 | To remove the pass phrase on an RSA private key: | ||
| 107 | |||
| 108 | openssl pkey -in key.pem -out keyout.pem | ||
| 109 | |||
| 110 | To encrypt a private key using triple DES: | ||
| 111 | |||
| 112 | openssl pkey -in key.pem -des3 -out keyout.pem | ||
| 113 | |||
| 114 | To convert a private key from PEM to DER format: | ||
| 115 | |||
| 116 | openssl pkey -in key.pem -outform DER -out keyout.der | ||
| 117 | |||
| 118 | To print out the components of a private key to standard output: | ||
| 119 | |||
| 120 | openssl pkey -in key.pem -text -noout | ||
| 121 | |||
| 122 | To print out the public components of a private key to standard output: | ||
| 123 | |||
| 124 | openssl pkey -in key.pem -text_pub -noout | ||
| 125 | |||
| 126 | To just output the public part of a private key: | ||
| 127 | |||
| 128 | openssl pkey -in key.pem -pubout -out pubkey.pem | ||
| 129 | |||
| 130 | =head1 SEE ALSO | ||
| 131 | |||
| 132 | L<genpkey(1)|genpkey(1)>, L<rsa(1)|rsa(1)>, L<pkcs8(1)|pkcs8(1)>, | ||
| 133 | L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, L<gendsa(1)|gendsa(1)> | ||
| 134 | |||
| 135 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/pkeyparam.pod b/src/lib/libssl/src/doc/apps/pkeyparam.pod new file mode 100644 index 0000000000..154f6721af --- /dev/null +++ b/src/lib/libssl/src/doc/apps/pkeyparam.pod | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | |||
| 2 | =pod | ||
| 3 | |||
| 4 | =head1 NAME | ||
| 5 | |||
| 6 | pkeyparam - public key algorithm parameter processing tool | ||
| 7 | |||
| 8 | =head1 SYNOPSIS | ||
| 9 | |||
| 10 | B<openssl> B<pkeyparam> | ||
| 11 | [B<-in filename>] | ||
| 12 | [B<-out filename>] | ||
| 13 | [B<-text>] | ||
| 14 | [B<-noout>] | ||
| 15 | [B<-engine id>] | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | The B<pkey> command processes public or private keys. They can be converted | ||
| 20 | between various forms and their components printed out. | ||
| 21 | |||
| 22 | =head1 COMMAND OPTIONS | ||
| 23 | |||
| 24 | =over 4 | ||
| 25 | |||
| 26 | =item B<-in filename> | ||
| 27 | |||
| 28 | This specifies the input filename to read parameters from or standard input if | ||
| 29 | this option is not specified. | ||
| 30 | |||
| 31 | =item B<-out filename> | ||
| 32 | |||
| 33 | This specifies the output filename to write parameters to or standard output if | ||
| 34 | this option is not specified. | ||
| 35 | |||
| 36 | =item B<-text> | ||
| 37 | |||
| 38 | prints out the parameters in plain text in addition to the encoded version. | ||
| 39 | |||
| 40 | =item B<-noout> | ||
| 41 | |||
| 42 | do not output the encoded version of the parameters. | ||
| 43 | |||
| 44 | =item B<-engine id> | ||
| 45 | |||
| 46 | specifying an engine (by its unique B<id> string) will cause B<pkeyparam> | ||
| 47 | to attempt to obtain a functional reference to the specified engine, | ||
| 48 | thus initialising it if needed. The engine will then be set as the default | ||
| 49 | for all available algorithms. | ||
| 50 | |||
| 51 | =back | ||
| 52 | |||
| 53 | =head1 EXAMPLE | ||
| 54 | |||
| 55 | Print out text version of parameters: | ||
| 56 | |||
| 57 | openssl pkeyparam -in param.pem -text | ||
| 58 | |||
| 59 | =head1 NOTES | ||
| 60 | |||
| 61 | There are no B<-inform> or B<-outform> options for this command because only | ||
| 62 | PEM format is supported because the key type is determined by the PEM headers. | ||
| 63 | |||
| 64 | =head1 SEE ALSO | ||
| 65 | |||
| 66 | L<genpkey(1)|genpkey(1)>, L<rsa(1)|rsa(1)>, L<pkcs8(1)|pkcs8(1)>, | ||
| 67 | L<dsa(1)|dsa(1)>, L<genrsa(1)|genrsa(1)>, L<gendsa(1)|gendsa(1)> | ||
| 68 | |||
| 69 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/pkeyutl.pod b/src/lib/libssl/src/doc/apps/pkeyutl.pod new file mode 100644 index 0000000000..27be9a9007 --- /dev/null +++ b/src/lib/libssl/src/doc/apps/pkeyutl.pod | |||
| @@ -0,0 +1,222 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | pkeyutl - public key algorithm utility | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | B<openssl> B<pkeyutl> | ||
| 10 | [B<-in file>] | ||
| 11 | [B<-out file>] | ||
| 12 | [B<-sigfile file>] | ||
| 13 | [B<-inkey file>] | ||
| 14 | [B<-keyform PEM|DER>] | ||
| 15 | [B<-passin arg>] | ||
| 16 | [B<-peerkey file>] | ||
| 17 | [B<-peerform PEM|DER>] | ||
| 18 | [B<-pubin>] | ||
| 19 | [B<-certin>] | ||
| 20 | [B<-rev>] | ||
| 21 | [B<-sign>] | ||
| 22 | [B<-verify>] | ||
| 23 | [B<-verifyrecover>] | ||
| 24 | [B<-encrypt>] | ||
| 25 | [B<-decrypt>] | ||
| 26 | [B<-derive>] | ||
| 27 | [B<-pkeyopt opt:value>] | ||
| 28 | [B<-hexdump>] | ||
| 29 | [B<-asn1parse>] | ||
| 30 | [B<-engine id>] | ||
| 31 | |||
| 32 | =head1 DESCRIPTION | ||
| 33 | |||
| 34 | The B<pkeyutl> command can be used to perform public key operations using | ||
| 35 | any supported algorithm. | ||
| 36 | |||
| 37 | =head1 COMMAND OPTIONS | ||
| 38 | |||
| 39 | =over 4 | ||
| 40 | |||
| 41 | =item B<-in filename> | ||
| 42 | |||
| 43 | This specifies the input filename to read data from or standard input | ||
| 44 | if this option is not specified. | ||
| 45 | |||
| 46 | =item B<-out filename> | ||
| 47 | |||
| 48 | specifies the output filename to write to or standard output by | ||
| 49 | default. | ||
| 50 | |||
| 51 | =item B<-inkey file> | ||
| 52 | |||
| 53 | the input key file, by default it should be a private key. | ||
| 54 | |||
| 55 | =item B<-keyform PEM|DER> | ||
| 56 | |||
| 57 | the key format PEM, DER or ENGINE. | ||
| 58 | |||
| 59 | =item B<-passin arg> | ||
| 60 | |||
| 61 | the input key password source. For more information about the format of B<arg> | ||
| 62 | see the B<PASS PHRASE ARGUMENTS> section in L<openssl(1)|openssl(1)>. | ||
| 63 | |||
| 64 | |||
| 65 | =item B<-peerkey file> | ||
| 66 | |||
| 67 | the peer key file, used by key derivation (agreement) operations. | ||
| 68 | |||
| 69 | =item B<-peerform PEM|DER> | ||
| 70 | |||
| 71 | the peer key format PEM, DER or ENGINE. | ||
| 72 | |||
| 73 | =item B<-engine id> | ||
| 74 | |||
| 75 | specifying an engine (by its unique B<id> string) will cause B<pkeyutl> | ||
| 76 | to attempt to obtain a functional reference to the specified engine, | ||
| 77 | thus initialising it if needed. The engine will then be set as the default | ||
| 78 | for all available algorithms. | ||
| 79 | |||
| 80 | |||
| 81 | =item B<-pubin> | ||
| 82 | |||
| 83 | the input file is a public key. | ||
| 84 | |||
| 85 | =item B<-certin> | ||
| 86 | |||
| 87 | the input is a certificate containing a public key. | ||
| 88 | |||
| 89 | =item B<-rev> | ||
| 90 | |||
| 91 | reverse the order of the input buffer. This is useful for some libraries | ||
| 92 | (such as CryptoAPI) which represent the buffer in little endian format. | ||
| 93 | |||
| 94 | =item B<-sign> | ||
| 95 | |||
| 96 | sign the input data and output the signed result. This requires | ||
| 97 | a private key. | ||
| 98 | |||
| 99 | =item B<-verify> | ||
| 100 | |||
| 101 | verify the input data against the signature file and indicate if the | ||
| 102 | verification succeeded or failed. | ||
| 103 | |||
| 104 | =item B<-verifyrecover> | ||
| 105 | |||
| 106 | verify the input data and output the recovered data. | ||
| 107 | |||
| 108 | =item B<-encrypt> | ||
| 109 | |||
| 110 | encrypt the input data using a public key. | ||
| 111 | |||
| 112 | =item B<-decrypt> | ||
| 113 | |||
| 114 | decrypt the input data using a private key. | ||
| 115 | |||
| 116 | =item B<-derive> | ||
| 117 | |||
| 118 | derive a shared secret using the peer key. | ||
| 119 | |||
| 120 | =item B<-hexdump> | ||
| 121 | |||
| 122 | hex dump the output data. | ||
| 123 | |||
| 124 | =item B<-asn1parse> | ||
| 125 | |||
| 126 | asn1parse the output data, this is useful when combined with the | ||
| 127 | B<-verifyrecover> option when an ASN1 structure is signed. | ||
| 128 | |||
| 129 | =back | ||
| 130 | |||
| 131 | =head1 NOTES | ||
| 132 | |||
| 133 | The operations and options supported vary according to the key algorithm | ||
| 134 | and its implementation. The OpenSSL operations and options are indicated below. | ||
| 135 | |||
| 136 | Unless otherwise mentioned all algorithms support the B<digest:alg> option | ||
| 137 | which specifies the digest in use for sign, verify and verifyrecover operations. | ||
| 138 | The value B<alg> should represent a digest name as used in the | ||
| 139 | EVP_get_digestbyname() function for example B<sha1>. | ||
| 140 | |||
| 141 | =head1 RSA ALGORITHM | ||
| 142 | |||
| 143 | The RSA algorithm supports encrypt, decrypt, sign, verify and verifyrecover | ||
| 144 | operations in general. Some padding modes only support some of these | ||
| 145 | operations however. | ||
| 146 | |||
| 147 | =over 4 | ||
| 148 | |||
| 149 | =item -B<rsa_padding_mode:mode> | ||
| 150 | |||
| 151 | This sets the RSA padding mode. Acceptable values for B<mode> are B<pkcs1> for | ||
| 152 | PKCS#1 padding, B<sslv23> for SSLv23 padding, B<none> for no padding, B<oaep> | ||
| 153 | for B<OAEP> mode, B<x931> for X9.31 mode and B<pss> for PSS. | ||
| 154 | |||
| 155 | In PKCS#1 padding if the message digest is not set then the supplied data is | ||
| 156 | signed or verified directly instead of using a B<DigestInfo> structure. If a | ||
| 157 | digest is set then the a B<DigestInfo> structure is used and its the length | ||
| 158 | must correspond to the digest type. | ||
| 159 | |||
| 160 | For B<oeap> mode only encryption and decryption is supported. | ||
| 161 | |||
| 162 | For B<x931> if the digest type is set it is used to format the block data | ||
| 163 | otherwise the first byte is used to specify the X9.31 digest ID. Sign, | ||
| 164 | verify and verifyrecover are can be performed in this mode. | ||
| 165 | |||
| 166 | For B<pss> mode only sign and verify are supported and the digest type must be | ||
| 167 | specified. | ||
| 168 | |||
| 169 | =item B<rsa_pss_saltlen:len> | ||
| 170 | |||
| 171 | For B<pss> mode only this option specifies the salt length. Two special values | ||
| 172 | are supported: -1 sets the salt length to the digest length. When signing -2 | ||
| 173 | sets the salt length to the maximum permissible value. When verifying -2 causes | ||
| 174 | the salt length to be automatically determined based on the B<PSS> block | ||
| 175 | structure. | ||
| 176 | |||
| 177 | =back | ||
| 178 | |||
| 179 | =head1 DSA ALGORITHM | ||
| 180 | |||
| 181 | The DSA algorithm supports signing and verification operations only. Currently | ||
| 182 | there are no additional options other than B<digest>. Only the SHA1 | ||
| 183 | digest can be used and this digest is assumed by default. | ||
| 184 | |||
| 185 | =head1 DH ALGORITHM | ||
| 186 | |||
| 187 | The DH algorithm only supports the derivation operation and no additional | ||
| 188 | options. | ||
| 189 | |||
| 190 | =head1 EC ALGORITHM | ||
| 191 | |||
| 192 | The EC algorithm supports sign, verify and derive operations. The sign and | ||
| 193 | verify operations use ECDSA and derive uses ECDH. Currently there are no | ||
| 194 | additional options other than B<digest>. Only the SHA1 digest can be used and | ||
| 195 | this digest is assumed by default. | ||
| 196 | |||
| 197 | =head1 EXAMPLES | ||
| 198 | |||
| 199 | Sign some data using a private key: | ||
| 200 | |||
| 201 | openssl pkeyutl -sign -in file -inkey key.pem -out sig | ||
| 202 | |||
| 203 | Recover the signed data (e.g. if an RSA key is used): | ||
| 204 | |||
| 205 | openssl pkeyutl -verifyrecover -in sig -inkey key.pem | ||
| 206 | |||
| 207 | Verify the signature (e.g. a DSA key): | ||
| 208 | |||
| 209 | openssl pkeyutl -verify -in file -sigfile sig -inkey key.pem | ||
| 210 | |||
| 211 | Sign data using a message digest value (this is currently only valid for RSA): | ||
| 212 | |||
| 213 | openssl pkeyutl -sign -in file -inkey key.pem -out sig -pkeyopt digest:sha256 | ||
| 214 | |||
| 215 | Derive a shared secret value: | ||
| 216 | |||
| 217 | openssl pkeyutl -derive -inkey key.pem -peerkey pubkey.pem -out secret | ||
| 218 | |||
| 219 | =head1 SEE ALSO | ||
| 220 | |||
| 221 | L<genpkey(1)|genpkey(1)>, L<pkey(1)|pkey(1)>, L<rsautl(1)|rsautl(1)> | ||
| 222 | L<dgst(1)|dgst(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)> | ||
diff --git a/src/lib/libssl/src/doc/apps/ts.pod b/src/lib/libssl/src/doc/apps/ts.pod new file mode 100644 index 0000000000..7fb6caa96e --- /dev/null +++ b/src/lib/libssl/src/doc/apps/ts.pod | |||
| @@ -0,0 +1,594 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | ts - Time Stamping Authority tool (client/server) | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | B<openssl> B<ts> | ||
| 10 | B<-query> | ||
| 11 | [B<-rand> file:file...] | ||
| 12 | [B<-config> configfile] | ||
| 13 | [B<-data> file_to_hash] | ||
| 14 | [B<-digest> digest_bytes] | ||
| 15 | [B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...>] | ||
| 16 | [B<-policy> object_id] | ||
| 17 | [B<-no_nonce>] | ||
| 18 | [B<-cert>] | ||
| 19 | [B<-in> request.tsq] | ||
| 20 | [B<-out> request.tsq] | ||
| 21 | [B<-text>] | ||
| 22 | |||
| 23 | B<openssl> B<ts> | ||
| 24 | B<-reply> | ||
| 25 | [B<-config> configfile] | ||
| 26 | [B<-section> tsa_section] | ||
| 27 | [B<-queryfile> request.tsq] | ||
| 28 | [B<-passin> password_src] | ||
| 29 | [B<-signer> tsa_cert.pem] | ||
| 30 | [B<-inkey> private.pem] | ||
| 31 | [B<-chain> certs_file.pem] | ||
| 32 | [B<-policy> object_id] | ||
| 33 | [B<-in> response.tsr] | ||
| 34 | [B<-token_in>] | ||
| 35 | [B<-out> response.tsr] | ||
| 36 | [B<-token_out>] | ||
| 37 | [B<-text>] | ||
| 38 | [B<-engine> id] | ||
| 39 | |||
| 40 | B<openssl> B<ts> | ||
| 41 | B<-verify> | ||
| 42 | [B<-data> file_to_hash] | ||
| 43 | [B<-digest> digest_bytes] | ||
| 44 | [B<-queryfile> request.tsq] | ||
| 45 | [B<-in> response.tsr] | ||
| 46 | [B<-token_in>] | ||
| 47 | [B<-CApath> trusted_cert_path] | ||
| 48 | [B<-CAfile> trusted_certs.pem] | ||
| 49 | [B<-untrusted> cert_file.pem] | ||
| 50 | |||
| 51 | =head1 DESCRIPTION | ||
| 52 | |||
| 53 | The B<ts> command is a basic Time Stamping Authority (TSA) client and server | ||
| 54 | application as specified in RFC 3161 (Time-Stamp Protocol, TSP). A | ||
| 55 | TSA can be part of a PKI deployment and its role is to provide long | ||
| 56 | term proof of the existence of a certain datum before a particular | ||
| 57 | time. Here is a brief description of the protocol: | ||
| 58 | |||
| 59 | =over 4 | ||
| 60 | |||
| 61 | =item 1. | ||
| 62 | |||
| 63 | The TSA client computes a one-way hash value for a data file and sends | ||
| 64 | the hash to the TSA. | ||
| 65 | |||
| 66 | =item 2. | ||
| 67 | |||
| 68 | The TSA attaches the current date and time to the received hash value, | ||
| 69 | signs them and sends the time stamp token back to the client. By | ||
| 70 | creating this token the TSA certifies the existence of the original | ||
| 71 | data file at the time of response generation. | ||
| 72 | |||
| 73 | =item 3. | ||
| 74 | |||
| 75 | The TSA client receives the time stamp token and verifies the | ||
| 76 | signature on it. It also checks if the token contains the same hash | ||
| 77 | value that it had sent to the TSA. | ||
| 78 | |||
| 79 | =back | ||
| 80 | |||
| 81 | There is one DER encoded protocol data unit defined for transporting a time | ||
| 82 | stamp request to the TSA and one for sending the time stamp response | ||
| 83 | back to the client. The B<ts> command has three main functions: | ||
| 84 | creating a time stamp request based on a data file, | ||
| 85 | creating a time stamp response based on a request, verifying if a | ||
| 86 | response corresponds to a particular request or a data file. | ||
| 87 | |||
| 88 | There is no support for sending the requests/responses automatically | ||
| 89 | over HTTP or TCP yet as suggested in RFC 3161. The users must send the | ||
| 90 | requests either by ftp or e-mail. | ||
| 91 | |||
| 92 | =head1 OPTIONS | ||
| 93 | |||
| 94 | =head2 Time Stamp Request generation | ||
| 95 | |||
| 96 | The B<-query> switch can be used for creating and printing a time stamp | ||
| 97 | request with the following options: | ||
| 98 | |||
| 99 | =over 4 | ||
| 100 | |||
| 101 | =item B<-rand> file:file... | ||
| 102 | |||
| 103 | The files containing random data for seeding the random number | ||
| 104 | generator. Multiple files can be specified, the separator is B<;> for | ||
| 105 | MS-Windows, B<,> for VMS and B<:> for all other platforms. (Optional) | ||
| 106 | |||
| 107 | =item B<-config> configfile | ||
| 108 | |||
| 109 | The configuration file to use, this option overrides the | ||
| 110 | B<OPENSSL_CONF> environment variable. Only the OID section | ||
| 111 | of the config file is used with the B<-query> command. (Optional) | ||
| 112 | |||
| 113 | =item B<-data> file_to_hash | ||
| 114 | |||
| 115 | The data file for which the time stamp request needs to be | ||
| 116 | created. stdin is the default if neither the B<-data> nor the B<-digest> | ||
| 117 | parameter is specified. (Optional) | ||
| 118 | |||
| 119 | =item B<-digest> digest_bytes | ||
| 120 | |||
| 121 | It is possible to specify the message imprint explicitly without the data | ||
| 122 | file. The imprint must be specified in a hexadecimal format, two characters | ||
| 123 | per byte, the bytes optionally separated by colons (e.g. 1A:F6:01:... or | ||
| 124 | 1AF601...). The number of bytes must match the message digest algorithm | ||
| 125 | in use. (Optional) | ||
| 126 | |||
| 127 | =item B<-md2>|B<-md4>|B<-md5>|B<-sha>|B<-sha1>|B<-mdc2>|B<-ripemd160>|B<...> | ||
| 128 | |||
| 129 | The message digest to apply to the data file, it supports all the message | ||
| 130 | digest algorithms that are supported by the openssl B<dgst> command. | ||
| 131 | The default is SHA-1. (Optional) | ||
| 132 | |||
| 133 | =item B<-policy> object_id | ||
| 134 | |||
| 135 | The policy that the client expects the TSA to use for creating the | ||
| 136 | time stamp token. Either the dotted OID notation or OID names defined | ||
| 137 | in the config file can be used. If no policy is requested the TSA will | ||
| 138 | use its own default policy. (Optional) | ||
| 139 | |||
| 140 | =item B<-no_nonce> | ||
| 141 | |||
| 142 | No nonce is specified in the request if this option is | ||
| 143 | given. Otherwise a 64 bit long pseudo-random none is | ||
| 144 | included in the request. It is recommended to use nonce to | ||
| 145 | protect against replay-attacks. (Optional) | ||
| 146 | |||
| 147 | =item B<-cert> | ||
| 148 | |||
| 149 | The TSA is expected to include its signing certificate in the | ||
| 150 | response. (Optional) | ||
| 151 | |||
| 152 | =item B<-in> request.tsq | ||
| 153 | |||
| 154 | This option specifies a previously created time stamp request in DER | ||
| 155 | format that will be printed into the output file. Useful when you need | ||
| 156 | to examine the content of a request in human-readable | ||
| 157 | |||
| 158 | format. (Optional) | ||
| 159 | |||
| 160 | =item B<-out> request.tsq | ||
| 161 | |||
| 162 | Name of the output file to which the request will be written. Default | ||
| 163 | is stdout. (Optional) | ||
| 164 | |||
| 165 | =item B<-text> | ||
| 166 | |||
| 167 | If this option is specified the output is human-readable text format | ||
| 168 | instead of DER. (Optional) | ||
| 169 | |||
| 170 | =back | ||
| 171 | |||
| 172 | =head2 Time Stamp Response generation | ||
| 173 | |||
| 174 | A time stamp response (TimeStampResp) consists of a response status | ||
| 175 | and the time stamp token itself (ContentInfo), if the token generation was | ||
| 176 | successful. The B<-reply> command is for creating a time stamp | ||
| 177 | response or time stamp token based on a request and printing the | ||
| 178 | response/token in human-readable format. If B<-token_out> is not | ||
| 179 | specified the output is always a time stamp response (TimeStampResp), | ||
| 180 | otherwise it is a time stamp token (ContentInfo). | ||
| 181 | |||
| 182 | =over 4 | ||
| 183 | |||
| 184 | =item B<-config> configfile | ||
| 185 | |||
| 186 | The configuration file to use, this option overrides the | ||
| 187 | B<OPENSSL_CONF> environment variable. See B<CONFIGURATION FILE | ||
| 188 | OPTIONS> for configurable variables. (Optional) | ||
| 189 | |||
| 190 | =item B<-section> tsa_section | ||
| 191 | |||
| 192 | The name of the config file section conatining the settings for the | ||
| 193 | response generation. If not specified the default TSA section is | ||
| 194 | used, see B<CONFIGURATION FILE OPTIONS> for details. (Optional) | ||
| 195 | |||
| 196 | =item B<-queryfile> request.tsq | ||
| 197 | |||
| 198 | The name of the file containing a DER encoded time stamp request. (Optional) | ||
| 199 | |||
| 200 | =item B<-passin> password_src | ||
| 201 | |||
| 202 | Specifies the password source for the private key of the TSA. See | ||
| 203 | B<PASS PHRASE ARGUMENTS> in L<openssl(1)|openssl(1)>. (Optional) | ||
| 204 | |||
| 205 | =item B<-signer> tsa_cert.pem | ||
| 206 | |||
| 207 | The signer certificate of the TSA in PEM format. The TSA signing | ||
| 208 | certificate must have exactly one extended key usage assigned to it: | ||
| 209 | timeStamping. The extended key usage must also be critical, otherwise | ||
| 210 | the certificate is going to be refused. Overrides the B<signer_cert> | ||
| 211 | variable of the config file. (Optional) | ||
| 212 | |||
| 213 | =item B<-inkey> private.pem | ||
| 214 | |||
| 215 | The signer private key of the TSA in PEM format. Overrides the | ||
| 216 | B<signer_key> config file option. (Optional) | ||
| 217 | |||
| 218 | =item B<-chain> certs_file.pem | ||
| 219 | |||
| 220 | The collection of certificates in PEM format that will all | ||
| 221 | be included in the response in addition to the signer certificate if | ||
| 222 | the B<-cert> option was used for the request. This file is supposed to | ||
| 223 | contain the certificate chain for the signer certificate from its | ||
| 224 | issuer upwards. The B<-reply> command does not build a certificate | ||
| 225 | chain automatically. (Optional) | ||
| 226 | |||
| 227 | =item B<-policy> object_id | ||
| 228 | |||
| 229 | The default policy to use for the response unless the client | ||
| 230 | explicitly requires a particular TSA policy. The OID can be specified | ||
| 231 | either in dotted notation or with its name. Overrides the | ||
| 232 | B<default_policy> config file option. (Optional) | ||
| 233 | |||
| 234 | =item B<-in> response.tsr | ||
| 235 | |||
| 236 | Specifies a previously created time stamp response or time stamp token | ||
| 237 | (if B<-token_in> is also specified) in DER format that will be written | ||
| 238 | to the output file. This option does not require a request, it is | ||
| 239 | useful e.g. when you need to examine the content of a response or | ||
| 240 | token or you want to extract the time stamp token from a response. If | ||
| 241 | the input is a token and the output is a time stamp response a default | ||
| 242 | 'granted' status info is added to the token. (Optional) | ||
| 243 | |||
| 244 | =item B<-token_in> | ||
| 245 | |||
| 246 | This flag can be used together with the B<-in> option and indicates | ||
| 247 | that the input is a DER encoded time stamp token (ContentInfo) instead | ||
| 248 | of a time stamp response (TimeStampResp). (Optional) | ||
| 249 | |||
| 250 | =item B<-out> response.tsr | ||
| 251 | |||
| 252 | The response is written to this file. The format and content of the | ||
| 253 | file depends on other options (see B<-text>, B<-token_out>). The default is | ||
| 254 | stdout. (Optional) | ||
| 255 | |||
| 256 | =item B<-token_out> | ||
| 257 | |||
| 258 | The output is a time stamp token (ContentInfo) instead of time stamp | ||
| 259 | response (TimeStampResp). (Optional) | ||
| 260 | |||
| 261 | =item B<-text> | ||
| 262 | |||
| 263 | If this option is specified the output is human-readable text format | ||
| 264 | instead of DER. (Optional) | ||
| 265 | |||
| 266 | =item B<-engine> id | ||
| 267 | |||
| 268 | Specifying an engine (by its unique B<id> string) will cause B<ts> | ||
| 269 | to attempt to obtain a functional reference to the specified engine, | ||
| 270 | thus initialising it if needed. The engine will then be set as the default | ||
| 271 | for all available algorithms. Default is builtin. (Optional) | ||
| 272 | |||
| 273 | =back | ||
| 274 | |||
| 275 | =head2 Time Stamp Response verification | ||
| 276 | |||
| 277 | The B<-verify> command is for verifying if a time stamp response or time | ||
| 278 | stamp token is valid and matches a particular time stamp request or | ||
| 279 | data file. The B<-verify> command does not use the configuration file. | ||
| 280 | |||
| 281 | =over 4 | ||
| 282 | |||
| 283 | =item B<-data> file_to_hash | ||
| 284 | |||
| 285 | The response or token must be verified against file_to_hash. The file | ||
| 286 | is hashed with the message digest algorithm specified in the token. | ||
| 287 | The B<-digest> and B<-queryfile> options must not be specified with this one. | ||
| 288 | (Optional) | ||
| 289 | |||
| 290 | =item B<-digest> digest_bytes | ||
| 291 | |||
| 292 | The response or token must be verified against the message digest specified | ||
| 293 | with this option. The number of bytes must match the message digest algorithm | ||
| 294 | specified in the token. The B<-data> and B<-queryfile> options must not be | ||
| 295 | specified with this one. (Optional) | ||
| 296 | |||
| 297 | =item B<-queryfile> request.tsq | ||
| 298 | |||
| 299 | The original time stamp request in DER format. The B<-data> and B<-digest> | ||
| 300 | options must not be specified with this one. (Optional) | ||
| 301 | |||
| 302 | =item B<-in> response.tsr | ||
| 303 | |||
| 304 | The time stamp response that needs to be verified in DER format. (Mandatory) | ||
| 305 | |||
| 306 | =item B<-token_in> | ||
| 307 | |||
| 308 | This flag can be used together with the B<-in> option and indicates | ||
| 309 | that the input is a DER encoded time stamp token (ContentInfo) instead | ||
| 310 | of a time stamp response (TimeStampResp). (Optional) | ||
| 311 | |||
| 312 | =item B<-CApath> trusted_cert_path | ||
| 313 | |||
| 314 | The name of the directory containing the trused CA certificates of the | ||
| 315 | client. See the similar option of L<verify(1)|verify(1)> for additional | ||
| 316 | details. Either this option or B<-CAfile> must be specified. (Optional) | ||
| 317 | |||
| 318 | |||
| 319 | =item B<-CAfile> trusted_certs.pem | ||
| 320 | |||
| 321 | The name of the file containing a set of trusted self-signed CA | ||
| 322 | certificates in PEM format. See the similar option of | ||
| 323 | L<verify(1)|verify(1)> for additional details. Either this option | ||
| 324 | or B<-CApath> must be specified. | ||
| 325 | (Optional) | ||
| 326 | |||
| 327 | =item B<-untrusted> cert_file.pem | ||
| 328 | |||
| 329 | Set of additional untrusted certificates in PEM format which may be | ||
| 330 | needed when building the certificate chain for the TSA's signing | ||
| 331 | certificate. This file must contain the TSA signing certificate and | ||
| 332 | all intermediate CA certificates unless the response includes them. | ||
| 333 | (Optional) | ||
| 334 | |||
| 335 | =back | ||
| 336 | |||
| 337 | =head1 CONFIGURATION FILE OPTIONS | ||
| 338 | |||
| 339 | The B<-query> and B<-reply> commands make use of a configuration file | ||
| 340 | defined by the B<OPENSSL_CONF> environment variable. See L<config(5)|config(5)> | ||
| 341 | for a general description of the syntax of the config file. The | ||
| 342 | B<-query> command uses only the symbolic OID names section | ||
| 343 | and it can work without it. However, the B<-reply> command needs the | ||
| 344 | config file for its operation. | ||
| 345 | |||
| 346 | When there is a command line switch equivalent of a variable the | ||
| 347 | switch always overrides the settings in the config file. | ||
| 348 | |||
| 349 | =over 4 | ||
| 350 | |||
| 351 | =item B<tsa> section, B<default_tsa> | ||
| 352 | |||
| 353 | This is the main section and it specifies the name of another section | ||
| 354 | that contains all the options for the B<-reply> command. This default | ||
| 355 | section can be overriden with the B<-section> command line switch. (Optional) | ||
| 356 | |||
| 357 | =item B<oid_file> | ||
| 358 | |||
| 359 | See L<ca(1)|ca(1)> for description. (Optional) | ||
| 360 | |||
| 361 | =item B<oid_section> | ||
| 362 | |||
| 363 | See L<ca(1)|ca(1)> for description. (Optional) | ||
| 364 | |||
| 365 | =item B<RANDFILE> | ||
| 366 | |||
| 367 | See L<ca(1)|ca(1)> for description. (Optional) | ||
| 368 | |||
| 369 | =item B<serial> | ||
| 370 | |||
| 371 | The name of the file containing the hexadecimal serial number of the | ||
| 372 | last time stamp response created. This number is incremented by 1 for | ||
| 373 | each response. If the file does not exist at the time of response | ||
| 374 | generation a new file is created with serial number 1. (Mandatory) | ||
| 375 | |||
| 376 | =item B<crypto_device> | ||
| 377 | |||
| 378 | Specifies the OpenSSL engine that will be set as the default for | ||
| 379 | all available algorithms. The default value is builtin, you can specify | ||
| 380 | any other engines supported by OpenSSL (e.g. use chil for the NCipher HSM). | ||
| 381 | (Optional) | ||
| 382 | |||
| 383 | =item B<signer_cert> | ||
| 384 | |||
| 385 | TSA signing certificate in PEM format. The same as the B<-signer> | ||
| 386 | command line option. (Optional) | ||
| 387 | |||
| 388 | =item B<certs> | ||
| 389 | |||
| 390 | A file containing a set of PEM encoded certificates that need to be | ||
| 391 | included in the response. The same as the B<-chain> command line | ||
| 392 | option. (Optional) | ||
| 393 | |||
| 394 | =item B<signer_key> | ||
| 395 | |||
| 396 | The private key of the TSA in PEM format. The same as the B<-inkey> | ||
| 397 | command line option. (Optional) | ||
| 398 | |||
| 399 | =item B<default_policy> | ||
| 400 | |||
| 401 | The default policy to use when the request does not mandate any | ||
| 402 | policy. The same as the B<-policy> command line option. (Optional) | ||
| 403 | |||
| 404 | =item B<other_policies> | ||
| 405 | |||
| 406 | Comma separated list of policies that are also acceptable by the TSA | ||
| 407 | and used only if the request explicitly specifies one of them. (Optional) | ||
| 408 | |||
| 409 | =item B<digests> | ||
| 410 | |||
| 411 | The list of message digest algorithms that the TSA accepts. At least | ||
| 412 | one algorithm must be specified. (Mandatory) | ||
| 413 | |||
| 414 | =item B<accuracy> | ||
| 415 | |||
| 416 | The accuracy of the time source of the TSA in seconds, milliseconds | ||
| 417 | and microseconds. E.g. secs:1, millisecs:500, microsecs:100. If any of | ||
| 418 | the components is missing zero is assumed for that field. (Optional) | ||
| 419 | |||
| 420 | =item B<clock_precision_digits> | ||
| 421 | |||
| 422 | Specifies the maximum number of digits, which represent the fraction of | ||
| 423 | seconds, that need to be included in the time field. The trailing zeroes | ||
| 424 | must be removed from the time, so there might actually be fewer digits, | ||
| 425 | or no fraction of seconds at all. Supported only on UNIX platforms. | ||
| 426 | The maximum value is 6, default is 0. | ||
| 427 | (Optional) | ||
| 428 | |||
| 429 | =item B<ordering> | ||
| 430 | |||
| 431 | If this option is yes the responses generated by this TSA can always | ||
| 432 | be ordered, even if the time difference between two responses is less | ||
| 433 | than the sum of their accuracies. Default is no. (Optional) | ||
| 434 | |||
| 435 | =item B<tsa_name> | ||
| 436 | |||
| 437 | Set this option to yes if the subject name of the TSA must be included in | ||
| 438 | the TSA name field of the response. Default is no. (Optional) | ||
| 439 | |||
| 440 | =item B<ess_cert_id_chain> | ||
| 441 | |||
| 442 | The SignedData objects created by the TSA always contain the | ||
| 443 | certificate identifier of the signing certificate in a signed | ||
| 444 | attribute (see RFC 2634, Enhanced Security Services). If this option | ||
| 445 | is set to yes and either the B<certs> variable or the B<-chain> option | ||
| 446 | is specified then the certificate identifiers of the chain will also | ||
| 447 | be included in the SigningCertificate signed attribute. If this | ||
| 448 | variable is set to no, only the signing certificate identifier is | ||
| 449 | included. Default is no. (Optional) | ||
| 450 | |||
| 451 | =back | ||
| 452 | |||
| 453 | =head1 ENVIRONMENT VARIABLES | ||
| 454 | |||
| 455 | B<OPENSSL_CONF> contains the path of the configuration file and can be | ||
| 456 | overriden by the B<-config> command line option. | ||
| 457 | |||
| 458 | =head1 EXAMPLES | ||
| 459 | |||
| 460 | All the examples below presume that B<OPENSSL_CONF> is set to a proper | ||
| 461 | configuration file, e.g. the example configuration file | ||
| 462 | openssl/apps/openssl.cnf will do. | ||
| 463 | |||
| 464 | =head2 Time Stamp Request | ||
| 465 | |||
| 466 | To create a time stamp request for design1.txt with SHA-1 | ||
| 467 | without nonce and policy and no certificate is required in the response: | ||
| 468 | |||
| 469 | openssl ts -query -data design1.txt -no_nonce \ | ||
| 470 | -out design1.tsq | ||
| 471 | |||
| 472 | To create a similar time stamp request with specifying the message imprint | ||
| 473 | explicitly: | ||
| 474 | |||
| 475 | openssl ts -query -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \ | ||
| 476 | -no_nonce -out design1.tsq | ||
| 477 | |||
| 478 | To print the content of the previous request in human readable format: | ||
| 479 | |||
| 480 | openssl ts -query -in design1.tsq -text | ||
| 481 | |||
| 482 | To create a time stamp request which includes the MD-5 digest | ||
| 483 | of design2.txt, requests the signer certificate and nonce, | ||
| 484 | specifies a policy id (assuming the tsa_policy1 name is defined in the | ||
| 485 | OID section of the config file): | ||
| 486 | |||
| 487 | openssl ts -query -data design2.txt -md5 \ | ||
| 488 | -policy tsa_policy1 -cert -out design2.tsq | ||
| 489 | |||
| 490 | =head2 Time Stamp Response | ||
| 491 | |||
| 492 | Before generating a response a signing certificate must be created for | ||
| 493 | the TSA that contains the B<timeStamping> critical extended key usage extension | ||
| 494 | without any other key usage extensions. You can add the | ||
| 495 | 'extendedKeyUsage = critical,timeStamping' line to the user certificate section | ||
| 496 | of the config file to generate a proper certificate. See L<req(1)|req(1)>, | ||
| 497 | L<ca(1)|ca(1)>, L<x509(1)|x509(1)> for instructions. The examples | ||
| 498 | below assume that cacert.pem contains the certificate of the CA, | ||
| 499 | tsacert.pem is the signing certificate issued by cacert.pem and | ||
| 500 | tsakey.pem is the private key of the TSA. | ||
| 501 | |||
| 502 | To create a time stamp response for a request: | ||
| 503 | |||
| 504 | openssl ts -reply -queryfile design1.tsq -inkey tsakey.pem \ | ||
| 505 | -signer tsacert.pem -out design1.tsr | ||
| 506 | |||
| 507 | If you want to use the settings in the config file you could just write: | ||
| 508 | |||
| 509 | openssl ts -reply -queryfile design1.tsq -out design1.tsr | ||
| 510 | |||
| 511 | To print a time stamp reply to stdout in human readable format: | ||
| 512 | |||
| 513 | openssl ts -reply -in design1.tsr -text | ||
| 514 | |||
| 515 | To create a time stamp token instead of time stamp response: | ||
| 516 | |||
| 517 | openssl ts -reply -queryfile design1.tsq -out design1_token.der -token_out | ||
| 518 | |||
| 519 | To print a time stamp token to stdout in human readable format: | ||
| 520 | |||
| 521 | openssl ts -reply -in design1_token.der -token_in -text -token_out | ||
| 522 | |||
| 523 | To extract the time stamp token from a response: | ||
| 524 | |||
| 525 | openssl ts -reply -in design1.tsr -out design1_token.der -token_out | ||
| 526 | |||
| 527 | To add 'granted' status info to a time stamp token thereby creating a | ||
| 528 | valid response: | ||
| 529 | |||
| 530 | openssl ts -reply -in design1_token.der -token_in -out design1.tsr | ||
| 531 | |||
| 532 | =head2 Time Stamp Verification | ||
| 533 | |||
| 534 | To verify a time stamp reply against a request: | ||
| 535 | |||
| 536 | openssl ts -verify -queryfile design1.tsq -in design1.tsr \ | ||
| 537 | -CAfile cacert.pem -untrusted tsacert.pem | ||
| 538 | |||
| 539 | To verify a time stamp reply that includes the certificate chain: | ||
| 540 | |||
| 541 | openssl ts -verify -queryfile design2.tsq -in design2.tsr \ | ||
| 542 | -CAfile cacert.pem | ||
| 543 | |||
| 544 | To verify a time stamp token against the original data file: | ||
| 545 | openssl ts -verify -data design2.txt -in design2.tsr \ | ||
| 546 | -CAfile cacert.pem | ||
| 547 | |||
| 548 | To verify a time stamp token against a message imprint: | ||
| 549 | openssl ts -verify -digest b7e5d3f93198b38379852f2c04e78d73abdd0f4b \ | ||
| 550 | -in design2.tsr -CAfile cacert.pem | ||
| 551 | |||
| 552 | You could also look at the 'test' directory for more examples. | ||
| 553 | |||
| 554 | =head1 BUGS | ||
| 555 | |||
| 556 | If you find any bugs or you have suggestions please write to | ||
| 557 | Zoltan Glozik <zglozik@opentsa.org>. Known issues: | ||
| 558 | |||
| 559 | =over 4 | ||
| 560 | |||
| 561 | =item * No support for time stamps over SMTP, though it is quite easy | ||
| 562 | to implement an automatic e-mail based TSA with L<procmail(1)|procmail(1)> | ||
| 563 | and L<perl(1)|perl(1)>. HTTP server support is provided in the form of | ||
| 564 | a separate apache module. HTTP client support is provided by | ||
| 565 | L<tsget(1)|tsget(1)>. Pure TCP/IP protocol is not supported. | ||
| 566 | |||
| 567 | =item * The file containing the last serial number of the TSA is not | ||
| 568 | locked when being read or written. This is a problem if more than one | ||
| 569 | instance of L<openssl(1)|openssl(1)> is trying to create a time stamp | ||
| 570 | response at the same time. This is not an issue when using the apache | ||
| 571 | server module, it does proper locking. | ||
| 572 | |||
| 573 | =item * Look for the FIXME word in the source files. | ||
| 574 | |||
| 575 | =item * The source code should really be reviewed by somebody else, too. | ||
| 576 | |||
| 577 | =item * More testing is needed, I have done only some basic tests (see | ||
| 578 | test/testtsa). | ||
| 579 | |||
| 580 | =back | ||
| 581 | |||
| 582 | =cut | ||
| 583 | |||
| 584 | =head1 AUTHOR | ||
| 585 | |||
| 586 | Zoltan Glozik <zglozik@opentsa.org>, OpenTSA project (http://www.opentsa.org) | ||
| 587 | |||
| 588 | =head1 SEE ALSO | ||
| 589 | |||
| 590 | L<tsget(1)|tsget(1)>, L<openssl(1)|openssl(1)>, L<req(1)|req(1)>, | ||
| 591 | L<x509(1)|x509(1)>, L<ca(1)|ca(1)>, L<genrsa(1)|genrsa(1)>, | ||
| 592 | L<config(5)|config(5)> | ||
| 593 | |||
| 594 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/tsget.pod b/src/lib/libssl/src/doc/apps/tsget.pod new file mode 100644 index 0000000000..b05957beea --- /dev/null +++ b/src/lib/libssl/src/doc/apps/tsget.pod | |||
| @@ -0,0 +1,194 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | tsget - Time Stamping HTTP/HTTPS client | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | B<tsget> | ||
| 10 | B<-h> server_url | ||
| 11 | [B<-e> extension] | ||
| 12 | [B<-o> output] | ||
| 13 | [B<-v>] | ||
| 14 | [B<-d>] | ||
| 15 | [B<-k> private_key.pem] | ||
| 16 | [B<-p> key_password] | ||
| 17 | [B<-c> client_cert.pem] | ||
| 18 | [B<-C> CA_certs.pem] | ||
| 19 | [B<-P> CA_path] | ||
| 20 | [B<-r> file:file...] | ||
| 21 | [B<-g> EGD_socket] | ||
| 22 | [request]... | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | The B<tsget> command can be used for sending a time stamp request, as | ||
| 27 | specified in B<RFC 3161>, to a time stamp server over HTTP or HTTPS and storing | ||
| 28 | the time stamp response in a file. This tool cannot be used for creating the | ||
| 29 | requests and verifying responses, you can use the OpenSSL B<ts(1)> command to | ||
| 30 | do that. B<tsget> can send several requests to the server without closing | ||
| 31 | the TCP connection if more than one requests are specified on the command | ||
| 32 | line. | ||
| 33 | |||
| 34 | The tool sends the following HTTP request for each time stamp request: | ||
| 35 | |||
| 36 | POST url HTTP/1.1 | ||
| 37 | User-Agent: OpenTSA tsget.pl/<version> | ||
| 38 | Host: <host>:<port> | ||
| 39 | Pragma: no-cache | ||
| 40 | Content-Type: application/timestamp-query | ||
| 41 | Accept: application/timestamp-reply | ||
| 42 | Content-Length: length of body | ||
| 43 | |||
| 44 | ...binary request specified by the user... | ||
| 45 | |||
| 46 | B<tsget> expects a response of type application/timestamp-reply, which is | ||
| 47 | written to a file without any interpretation. | ||
| 48 | |||
| 49 | =head1 OPTIONS | ||
| 50 | |||
| 51 | =over 4 | ||
| 52 | |||
| 53 | =item B<-h> server_url | ||
| 54 | |||
| 55 | The URL of the HTTP/HTTPS server listening for time stamp requests. | ||
| 56 | |||
| 57 | =item B<-e> extension | ||
| 58 | |||
| 59 | If the B<-o> option is not given this argument specifies the extension of the | ||
| 60 | output files. The base name of the output file will be the same as those of | ||
| 61 | the input files. Default extension is '.tsr'. (Optional) | ||
| 62 | |||
| 63 | =item B<-o> output | ||
| 64 | |||
| 65 | This option can be specified only when just one request is sent to the | ||
| 66 | server. The time stamp response will be written to the given output file. '-' | ||
| 67 | means standard output. In case of multiple time stamp requests or the absence | ||
| 68 | of this argument the names of the output files will be derived from the names | ||
| 69 | of the input files and the default or specified extension argument. (Optional) | ||
| 70 | |||
| 71 | =item B<-v> | ||
| 72 | |||
| 73 | The name of the currently processed request is printed on standard | ||
| 74 | error. (Optional) | ||
| 75 | |||
| 76 | =item B<-d> | ||
| 77 | |||
| 78 | Switches on verbose mode for the underlying B<curl> library. You can see | ||
| 79 | detailed debug messages for the connection. (Optional) | ||
| 80 | |||
| 81 | =item B<-k> private_key.pem | ||
| 82 | |||
| 83 | (HTTPS) In case of certificate-based client authentication over HTTPS | ||
| 84 | <private_key.pem> must contain the private key of the user. The private key | ||
| 85 | file can optionally be protected by a passphrase. The B<-c> option must also | ||
| 86 | be specified. (Optional) | ||
| 87 | |||
| 88 | =item B<-p> key_password | ||
| 89 | |||
| 90 | (HTTPS) Specifies the passphrase for the private key specified by the B<-k> | ||
| 91 | argument. If this option is omitted and the key is passphrase protected B<tsget> | ||
| 92 | will ask for it. (Optional) | ||
| 93 | |||
| 94 | =item B<-c> client_cert.pem | ||
| 95 | |||
| 96 | (HTTPS) In case of certificate-based client authentication over HTTPS | ||
| 97 | <client_cert.pem> must contain the X.509 certificate of the user. The B<-k> | ||
| 98 | option must also be specified. If this option is not specified no | ||
| 99 | certificate-based client authentication will take place. (Optional) | ||
| 100 | |||
| 101 | =item B<-C> CA_certs.pem | ||
| 102 | |||
| 103 | (HTTPS) The trusted CA certificate store. The certificate chain of the peer's | ||
| 104 | certificate must include one of the CA certificates specified in this file. | ||
| 105 | Either option B<-C> or option B<-P> must be given in case of HTTPS. (Optional) | ||
| 106 | |||
| 107 | =item B<-P> CA_path | ||
| 108 | |||
| 109 | (HTTPS) The path containing the trusted CA certificates to verify the peer's | ||
| 110 | certificate. The directory must be prepared with the B<c_rehash> | ||
| 111 | OpenSSL utility. Either option B<-C> or option B<-P> must be given in case of | ||
| 112 | HTTPS. (Optional) | ||
| 113 | |||
| 114 | =item B<-rand> file:file... | ||
| 115 | |||
| 116 | The files containing random data for seeding the random number | ||
| 117 | generator. Multiple files can be specified, the separator is B<;> for | ||
| 118 | MS-Windows, B<,> for VMS and B<:> for all other platforms. (Optional) | ||
| 119 | |||
| 120 | =item B<-g> EGD_socket | ||
| 121 | |||
| 122 | The name of an EGD socket to get random data from. (Optional) | ||
| 123 | |||
| 124 | =item [request]... | ||
| 125 | |||
| 126 | List of files containing B<RFC 3161> DER-encoded time stamp requests. If no | ||
| 127 | requests are specifed only one request will be sent to the server and it will be | ||
| 128 | read from the standard input. (Optional) | ||
| 129 | |||
| 130 | =back | ||
| 131 | |||
| 132 | =head1 ENVIRONMENT VARIABLES | ||
| 133 | |||
| 134 | The B<TSGET> environment variable can optionally contain default | ||
| 135 | arguments. The content of this variable is added to the list of command line | ||
| 136 | arguments. | ||
| 137 | |||
| 138 | =head1 EXAMPLES | ||
| 139 | |||
| 140 | The examples below presume that B<file1.tsq> and B<file2.tsq> contain valid | ||
| 141 | time stamp requests, tsa.opentsa.org listens at port 8080 for HTTP requests | ||
| 142 | and at port 8443 for HTTPS requests, the TSA service is available at the /tsa | ||
| 143 | absolute path. | ||
| 144 | |||
| 145 | Get a time stamp response for file1.tsq over HTTP, output is written to | ||
| 146 | file1.tsr: | ||
| 147 | |||
| 148 | tsget -h http://tsa.opentsa.org:8080/tsa file1.tsq | ||
| 149 | |||
| 150 | Get a time stamp response for file1.tsq and file2.tsq over HTTP showing | ||
| 151 | progress, output is written to file1.reply and file2.reply respectively: | ||
| 152 | |||
| 153 | tsget -h http://tsa.opentsa.org:8080/tsa -v -e .reply \ | ||
| 154 | file1.tsq file2.tsq | ||
| 155 | |||
| 156 | Create a time stamp request, write it to file3.tsq, send it to the server and | ||
| 157 | write the response to file3.tsr: | ||
| 158 | |||
| 159 | openssl ts -query -data file3.txt -cert | tee file3.tsq \ | ||
| 160 | | tsget -h http://tsa.opentsa.org:8080/tsa \ | ||
| 161 | -o file3.tsr | ||
| 162 | |||
| 163 | Get a time stamp response for file1.tsq over HTTPS without client | ||
| 164 | authentication: | ||
| 165 | |||
| 166 | tsget -h https://tsa.opentsa.org:8443/tsa \ | ||
| 167 | -C cacerts.pem file1.tsq | ||
| 168 | |||
| 169 | Get a time stamp response for file1.tsq over HTTPS with certificate-based | ||
| 170 | client authentication (it will ask for the passphrase if client_key.pem is | ||
| 171 | protected): | ||
| 172 | |||
| 173 | tsget -h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \ | ||
| 174 | -k client_key.pem -c client_cert.pem file1.tsq | ||
| 175 | |||
| 176 | You can shorten the previous command line if you make use of the B<TSGET> | ||
| 177 | environment variable. The following commands do the same as the previous | ||
| 178 | example: | ||
| 179 | |||
| 180 | TSGET='-h https://tsa.opentsa.org:8443/tsa -C cacerts.pem \ | ||
| 181 | -k client_key.pem -c client_cert.pem' | ||
| 182 | export TSGET | ||
| 183 | tsget file1.tsq | ||
| 184 | |||
| 185 | =head1 AUTHOR | ||
| 186 | |||
| 187 | Zoltan Glozik <zglozik@opentsa.org>, OpenTSA project (http://www.opentsa.org) | ||
| 188 | |||
| 189 | =head1 SEE ALSO | ||
| 190 | |||
| 191 | L<openssl(1)|openssl(1)>, L<ts(1)|ts(1)>, L<curl(1)|curl(1)>, | ||
| 192 | B<RFC 3161> | ||
| 193 | |||
| 194 | =cut | ||
diff --git a/src/lib/libssl/src/doc/apps/x509v3_config.pod b/src/lib/libssl/src/doc/apps/x509v3_config.pod index 38c46e85c4..0450067cf1 100644 --- a/src/lib/libssl/src/doc/apps/x509v3_config.pod +++ b/src/lib/libssl/src/doc/apps/x509v3_config.pod | |||
| @@ -52,7 +52,7 @@ use is defined by the extension code itself: check out the certificate | |||
| 52 | policies extension for an example. | 52 | policies extension for an example. |
| 53 | 53 | ||
| 54 | If an extension type is unsupported then the I<arbitrary> extension syntax | 54 | If an extension type is unsupported then the I<arbitrary> extension syntax |
| 55 | must be used, see the L<ARBITRART EXTENSIONS|/"ARBITRARY EXTENSIONS"> section for more details. | 55 | must be used, see the L<ARBITRARY EXTENSIONS|/"ARBITRARY EXTENSIONS"> section for more details. |
| 56 | 56 | ||
| 57 | =head1 STANDARD EXTENSIONS | 57 | =head1 STANDARD EXTENSIONS |
| 58 | 58 | ||
| @@ -178,7 +178,7 @@ preceeding the name with a B<+> character. | |||
| 178 | 178 | ||
| 179 | otherName can include arbitrary data associated with an OID: the value | 179 | otherName can include arbitrary data associated with an OID: the value |
| 180 | should be the OID followed by a semicolon and the content in standard | 180 | should be the OID followed by a semicolon and the content in standard |
| 181 | ASN1_generate_nconf() format. | 181 | L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)> format. |
| 182 | 182 | ||
| 183 | Examples: | 183 | Examples: |
| 184 | 184 | ||
| @@ -226,21 +226,82 @@ Example: | |||
| 226 | 226 | ||
| 227 | =head2 CRL distribution points. | 227 | =head2 CRL distribution points. |
| 228 | 228 | ||
| 229 | This is a multi-valued extension that supports all the literal options of | 229 | This is a multi-valued extension whose options can be either in name:value pair |
| 230 | subject alternative name. Of the few software packages that currently interpret | 230 | using the same form as subject alternative name or a single value representing |
| 231 | this extension most only interpret the URI option. | 231 | a section name containing all the distribution point fields. |
| 232 | 232 | ||
| 233 | Currently each option will set a new DistributionPoint with the fullName | 233 | For a name:value pair a new DistributionPoint with the fullName field set to |
| 234 | field set to the given value. | 234 | the given value both the cRLissuer and reasons fields are omitted in this case. |
| 235 | 235 | ||
| 236 | Other fields like cRLissuer and reasons cannot currently be set or displayed: | 236 | In the single option case the section indicated contains values for each |
| 237 | at this time no examples were available that used these fields. | 237 | field. In this section: |
| 238 | 238 | ||
| 239 | Examples: | 239 | If the name is "fullname" the value field should contain the full name |
| 240 | of the distribution point in the same format as subject alternative name. | ||
| 241 | |||
| 242 | If the name is "relativename" then the value field should contain a section | ||
| 243 | name whose contents represent a DN fragment to be placed in this field. | ||
| 244 | |||
| 245 | The name "CRLIssuer" if present should contain a value for this field in | ||
| 246 | subject alternative name format. | ||
| 247 | |||
| 248 | If the name is "reasons" the value field should consist of a comma | ||
| 249 | separated field containing the reasons. Valid reasons are: "keyCompromise", | ||
| 250 | "CACompromise", "affiliationChanged", "superseded", "cessationOfOperation", | ||
| 251 | "certificateHold", "privilegeWithdrawn" and "AACompromise". | ||
| 252 | |||
| 253 | |||
| 254 | Simple examples: | ||
| 240 | 255 | ||
| 241 | crlDistributionPoints=URI:http://myhost.com/myca.crl | 256 | crlDistributionPoints=URI:http://myhost.com/myca.crl |
| 242 | crlDistributionPoints=URI:http://my.com/my.crl,URI:http://oth.com/my.crl | 257 | crlDistributionPoints=URI:http://my.com/my.crl,URI:http://oth.com/my.crl |
| 243 | 258 | ||
| 259 | Full distribution point example: | ||
| 260 | |||
| 261 | crlDistributionPoints=crldp1_section | ||
| 262 | |||
| 263 | [crldp1_section] | ||
| 264 | |||
| 265 | fullname=URI:http://myhost.com/myca.crl | ||
| 266 | CRLissuer=dirName:issuer_sect | ||
| 267 | reasons=keyCompromise, CACompromise | ||
| 268 | |||
| 269 | [issuer_sect] | ||
| 270 | C=UK | ||
| 271 | O=Organisation | ||
| 272 | CN=Some Name | ||
| 273 | |||
| 274 | =head2 Issuing Distribution Point | ||
| 275 | |||
| 276 | This extension should only appear in CRLs. It is a multi valued extension | ||
| 277 | whose syntax is similar to the "section" pointed to by the CRL distribution | ||
| 278 | points extension with a few differences. | ||
| 279 | |||
| 280 | The names "reasons" and "CRLissuer" are not recognized. | ||
| 281 | |||
| 282 | The name "onlysomereasons" is accepted which sets this field. The value is | ||
| 283 | in the same format as the CRL distribution point "reasons" field. | ||
| 284 | |||
| 285 | The names "onlyuser", "onlyCA", "onlyAA" and "indirectCRL" are also accepted | ||
| 286 | the values should be a boolean value (TRUE or FALSE) to indicate the value of | ||
| 287 | the corresponding field. | ||
| 288 | |||
| 289 | Example: | ||
| 290 | |||
| 291 | issuingDistributionPoint=critical, @idp_section | ||
| 292 | |||
| 293 | [idp_section] | ||
| 294 | |||
| 295 | fullname=URI:http://myhost.com/myca.crl | ||
| 296 | indirectCRL=TRUE | ||
| 297 | onlysomereasons=keyCompromise, CACompromise | ||
| 298 | |||
| 299 | [issuer_sect] | ||
| 300 | C=UK | ||
| 301 | O=Organisation | ||
| 302 | CN=Some Name | ||
| 303 | |||
| 304 | |||
| 244 | =head2 Certificate Policies. | 305 | =head2 Certificate Policies. |
| 245 | 306 | ||
| 246 | This is a I<raw> extension. All the fields of this extension can be set by | 307 | This is a I<raw> extension. All the fields of this extension can be set by |
| @@ -329,6 +390,16 @@ Examples: | |||
| 329 | nameConstraints=permitted;email:.somedomain.com | 390 | nameConstraints=permitted;email:.somedomain.com |
| 330 | 391 | ||
| 331 | nameConstraints=excluded;email:.com | 392 | nameConstraints=excluded;email:.com |
| 393 | issuingDistributionPoint = idp_section | ||
| 394 | |||
| 395 | =head2 OCSP No Check | ||
| 396 | |||
| 397 | The OCSP No Check extension is a string extension but its value is ignored. | ||
| 398 | |||
| 399 | Example: | ||
| 400 | |||
| 401 | noCheck = ignored | ||
| 402 | |||
| 332 | 403 | ||
| 333 | =head1 DEPRECATED EXTENSIONS | 404 | =head1 DEPRECATED EXTENSIONS |
| 334 | 405 | ||
| @@ -370,7 +441,8 @@ the data is formatted correctly for the given extension type. | |||
| 370 | There are two ways to encode arbitrary extensions. | 441 | There are two ways to encode arbitrary extensions. |
| 371 | 442 | ||
| 372 | The first way is to use the word ASN1 followed by the extension content | 443 | The first way is to use the word ASN1 followed by the extension content |
| 373 | using the same syntax as ASN1_generate_nconf(). For example: | 444 | using the same syntax as L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)>. |
| 445 | For example: | ||
| 374 | 446 | ||
| 375 | 1.2.3.4=critical,ASN1:UTF8String:Some random data | 447 | 1.2.3.4=critical,ASN1:UTF8String:Some random data |
| 376 | 448 | ||
| @@ -450,7 +522,8 @@ for arbitrary extensions was added in OpenSSL 0.9.8 | |||
| 450 | 522 | ||
| 451 | =head1 SEE ALSO | 523 | =head1 SEE ALSO |
| 452 | 524 | ||
| 453 | L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)> | 525 | L<req(1)|req(1)>, L<ca(1)|ca(1)>, L<x509(1)|x509(1)>, |
| 526 | L<ASN1_generate_nconf(3)|ASN1_generate_nconf(3)> | ||
| 454 | 527 | ||
| 455 | 528 | ||
| 456 | =cut | 529 | =cut |
diff --git a/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod b/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod index 1157cff510..542fd1579a 100644 --- a/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod +++ b/src/lib/libssl/src/doc/crypto/ASN1_generate_nconf.pod | |||
| @@ -6,6 +6,8 @@ ASN1_generate_nconf, ASN1_generate_v3 - ASN1 generation functions | |||
| 6 | 6 | ||
| 7 | =head1 SYNOPSIS | 7 | =head1 SYNOPSIS |
| 8 | 8 | ||
| 9 | #include <openssl/asn1.h> | ||
| 10 | |||
| 9 | ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); | 11 | ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf); |
| 10 | ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); | 12 | ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf); |
| 11 | 13 | ||
| @@ -101,7 +103,8 @@ bits is set to zero. | |||
| 101 | =item B<UNIVERSALSTRING>, B<UNIV>, B<IA5>, B<IA5STRING>, B<UTF8>, | 103 | =item B<UNIVERSALSTRING>, B<UNIV>, B<IA5>, B<IA5STRING>, B<UTF8>, |
| 102 | B<UTF8String>, B<BMP>, B<BMPSTRING>, B<VISIBLESTRING>, | 104 | B<UTF8String>, B<BMP>, B<BMPSTRING>, B<VISIBLESTRING>, |
| 103 | B<VISIBLE>, B<PRINTABLESTRING>, B<PRINTABLE>, B<T61>, | 105 | B<VISIBLE>, B<PRINTABLESTRING>, B<PRINTABLE>, B<T61>, |
| 104 | B<T61STRING>, B<TELETEXSTRING>, B<GeneralString> | 106 | B<T61STRING>, B<TELETEXSTRING>, B<GeneralString>, B<NUMERICSTRING>, |
| 107 | B<NUMERIC> | ||
| 105 | 108 | ||
| 106 | These encode the corresponding string types. B<value> represents the | 109 | These encode the corresponding string types. B<value> represents the |
| 107 | contents of this structure. The format can be B<ASCII> or B<UTF8>. | 110 | contents of this structure. The format can be B<ASCII> or B<UTF8>. |
| @@ -175,7 +178,7 @@ An IA5String explicitly tagged using APPLICATION tagging: | |||
| 175 | 178 | ||
| 176 | A BITSTRING with bits 1 and 5 set and all others zero: | 179 | A BITSTRING with bits 1 and 5 set and all others zero: |
| 177 | 180 | ||
| 178 | FORMAT=BITLIST,BITSTRING:1,5 | 181 | FORMAT:BITLIST,BITSTRING:1,5 |
| 179 | 182 | ||
| 180 | A more complex example using a config file to produce a | 183 | A more complex example using a config file to produce a |
| 181 | SEQUENCE consiting of a BOOL an OID and a UTF8String: | 184 | SEQUENCE consiting of a BOOL an OID and a UTF8String: |
diff --git a/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod b/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod new file mode 100644 index 0000000000..9e3a4b7f89 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/BIO_new_CMS.pod | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | BIO_new_CMS - CMS streaming filter BIO | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | BIO_new_CMS() returns a streaming filter BIO chain based on B<cms>. The output | ||
| 16 | of the filter is written to B<out>. Any data written to the chain is | ||
| 17 | automatically translated to a BER format CMS structure of the appropriate type. | ||
| 18 | |||
| 19 | =head1 NOTES | ||
| 20 | |||
| 21 | The chain returned by this function behaves like a standard filter BIO. It | ||
| 22 | supports non blocking I/O. Content is processed and streamed on the fly and not | ||
| 23 | all held in memory at once: so it is possible to encode very large structures. | ||
| 24 | After all content has been written through the chain BIO_flush() must be called | ||
| 25 | to finalise the structure. | ||
| 26 | |||
| 27 | The B<CMS_STREAM> flag must be included in the corresponding B<flags> | ||
| 28 | parameter of the B<cms> creation function. | ||
| 29 | |||
| 30 | If an application wishes to write additional data to B<out> BIOs should be | ||
| 31 | removed from the chain using BIO_pop() and freed with BIO_free() until B<out> | ||
| 32 | is reached. If no additional data needs to be written BIO_free_all() can be | ||
| 33 | called to free up the whole chain. | ||
| 34 | |||
| 35 | Any content written through the filter is used verbatim: no canonical | ||
| 36 | translation is performed. | ||
| 37 | |||
| 38 | It is possible to chain multiple BIOs to, for example, create a triple wrapped | ||
| 39 | signed, enveloped, signed structure. In this case it is the applications | ||
| 40 | responsibility to set the inner content type of any outer CMS_ContentInfo | ||
| 41 | structures. | ||
| 42 | |||
| 43 | Large numbers of small writes through the chain should be avoided as this will | ||
| 44 | produce an output consisting of lots of OCTET STRING structures. Prepending | ||
| 45 | a BIO_f_buffer() buffering BIO will prevent this. | ||
| 46 | |||
| 47 | =head1 BUGS | ||
| 48 | |||
| 49 | There is currently no corresponding inverse BIO: i.e. one which can decode | ||
| 50 | a CMS structure on the fly. | ||
| 51 | |||
| 52 | =head1 RETURN VALUES | ||
| 53 | |||
| 54 | BIO_new_CMS() returns a BIO chain when successful or NULL if an error | ||
| 55 | occurred. The error can be obtained from ERR_get_error(3). | ||
| 56 | |||
| 57 | =head1 SEE ALSO | ||
| 58 | |||
| 59 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 60 | L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 61 | |||
| 62 | =head1 HISTORY | ||
| 63 | |||
| 64 | BIO_new_CMS() was added to OpenSSL 1.0.0 | ||
| 65 | |||
| 66 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod b/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod index 7b087f7288..5f51fdb470 100644 --- a/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod +++ b/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod | |||
| @@ -22,8 +22,11 @@ functions. | |||
| 22 | BN_CTX *ctx); | 22 | BN_CTX *ctx); |
| 23 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, | 23 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, |
| 24 | BN_CTX *ctx); | 24 | BN_CTX *ctx); |
| 25 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 25 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); | 26 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); |
| 26 | void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); | 27 | void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); |
| 28 | #endif | ||
| 29 | CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); | ||
| 27 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); | 30 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); |
| 28 | void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); | 31 | void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); |
| 29 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | 32 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, |
| @@ -54,11 +57,11 @@ BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper | |||
| 54 | functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() | 57 | functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() |
| 55 | with B<r> set to NULL. | 58 | with B<r> set to NULL. |
| 56 | 59 | ||
| 57 | BN_BLINDING_set_thread_id() and BN_BLINDING_get_thread_id() | 60 | BN_BLINDING_thread_id() provides access to the B<CRYPTO_THREADID> |
| 58 | set and get the "thread id" value of the B<BN_BLINDING> structure, | 61 | object within the B<BN_BLINDING> structure. This is to help users |
| 59 | a field provided to users of B<BN_BLINDING> structure to help them | 62 | provide proper locking if needed for multi-threaded use. The "thread |
| 60 | provide proper locking if needed for multi-threaded use. The | 63 | id" object of a newly allocated B<BN_BLINDING> structure is |
| 61 | "thread id" of a newly allocated B<BN_BLINDING> structure is zero. | 64 | initialised to the thread id in which BN_BLINDING_new() was called. |
| 62 | 65 | ||
| 63 | BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently | 66 | BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently |
| 64 | there are two supported flags: B<BN_BLINDING_NO_UPDATE> and | 67 | there are two supported flags: B<BN_BLINDING_NO_UPDATE> and |
| @@ -83,8 +86,8 @@ BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(), | |||
| 83 | BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on | 86 | BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on |
| 84 | success and 0 if an error occured. | 87 | success and 0 if an error occured. |
| 85 | 88 | ||
| 86 | BN_BLINDING_get_thread_id() returns the thread id (a B<unsigned long> | 89 | BN_BLINDING_thread_id() returns a pointer to the thread id object |
| 87 | value) or 0 if not set. | 90 | within a B<BN_BLINDING> object. |
| 88 | 91 | ||
| 89 | BN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags | 92 | BN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags |
| 90 | (a B<unsigned long> value). | 93 | (a B<unsigned long> value). |
| @@ -98,6 +101,9 @@ L<bn(3)|bn(3)> | |||
| 98 | 101 | ||
| 99 | =head1 HISTORY | 102 | =head1 HISTORY |
| 100 | 103 | ||
| 104 | BN_BLINDING_thread_id was first introduced in OpenSSL 1.0.0, and it | ||
| 105 | deprecates BN_BLINDING_set_thread_id and BN_BLINDING_get_thread_id. | ||
| 106 | |||
| 101 | BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id, | 107 | BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id, |
| 102 | BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags | 108 | BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags |
| 103 | and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8 | 109 | and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8 |
diff --git a/src/lib/libssl/src/doc/crypto/CMS_add0_cert.pod b/src/lib/libssl/src/doc/crypto/CMS_add0_cert.pod new file mode 100644 index 0000000000..9c13f488f6 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_add0_cert.pod | |||
| @@ -0,0 +1,66 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_crls, - CMS certificate and CRL utility functions | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert); | ||
| 12 | int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert); | ||
| 13 | STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms); | ||
| 14 | |||
| 15 | int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl); | ||
| 16 | int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl); | ||
| 17 | STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms); | ||
| 18 | |||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | CMS_add0_cert() and CMS_add1_cert() add certificate B<cert> to B<cms>. | ||
| 23 | must be of type signed data or enveloped data. | ||
| 24 | |||
| 25 | CMS_get1_certs() returns all certificates in B<cms>. | ||
| 26 | |||
| 27 | CMS_add0_crl() and CMS_add1_crl() add CRL B<crl> to B<cms>. CMS_get1_crls() | ||
| 28 | returns any CRLs in B<cms>. | ||
| 29 | |||
| 30 | =head1 NOTES | ||
| 31 | |||
| 32 | The CMS_ContentInfo structure B<cms> must be of type signed data or enveloped | ||
| 33 | data or an error will be returned. | ||
| 34 | |||
| 35 | For signed data certificates and CRLs are added to the B<certificates> and | ||
| 36 | B<crls> fields of SignedData structure. For enveloped data they are added to | ||
| 37 | B<OriginatorInfo>. | ||
| 38 | |||
| 39 | As the B<0> implies CMS_add0_cert() adds B<cert> internally to B<cms> and it | ||
| 40 | must not be freed up after the call as opposed to CMS_add1_cert() where B<cert> | ||
| 41 | must be freed up. | ||
| 42 | |||
| 43 | The same certificate or CRL must not be added to the same cms structure more | ||
| 44 | than once. | ||
| 45 | |||
| 46 | =head1 RETURN VALUES | ||
| 47 | |||
| 48 | CMS_add0_cert(), CMS_add1_cert() and CMS_add0_crl() and CMS_add1_crl() return | ||
| 49 | 1 for success and 0 for failure. | ||
| 50 | |||
| 51 | CMS_get1_certs() and CMS_get1_crls() return the STACK of certificates or CRLs | ||
| 52 | or NULL if there are none or an error occurs. The only error which will occur | ||
| 53 | in practice is if the B<cms> type is invalid. | ||
| 54 | |||
| 55 | =head1 SEE ALSO | ||
| 56 | |||
| 57 | L<ERR_get_error(3)|ERR_get_error(3)>, | ||
| 58 | L<CMS_sign(3)|CMS_sign(3)>, | ||
| 59 | L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 60 | |||
| 61 | =head1 HISTORY | ||
| 62 | |||
| 63 | CMS_add0_cert(), CMS_add1_cert(), CMS_get1_certs(), CMS_add0_crl() | ||
| 64 | and CMS_get1_crls() were all first added to OpenSSL 0.9.8 | ||
| 65 | |||
| 66 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_add1_recipient_cert.pod b/src/lib/libssl/src/doc/crypto/CMS_add1_recipient_cert.pod new file mode 100644 index 0000000000..d7d8e2532c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_add1_recipient_cert.pod | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_add1_recipient_cert, CMS_add0_recipient_key - add recipients to a CMS enveloped data structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms, X509 *recip, unsigned int flags); | ||
| 12 | |||
| 13 | CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid, unsigned char *key, size_t keylen, unsigned char *id, size_t idlen, ASN1_GENERALIZEDTIME *date, ASN1_OBJECT *otherTypeId, ASN1_TYPE *otherType); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | CMS_add1_recipient_cert() adds recipient B<recip> to CMS_ContentInfo enveloped | ||
| 18 | data structure B<cms> as a KeyTransRecipientInfo structure. | ||
| 19 | |||
| 20 | CMS_add0_recipient_key() adds symmetric key B<key> of length B<keylen> using | ||
| 21 | wrapping algorithm B<nid>, identifier B<id> of length B<idlen> and optional | ||
| 22 | values B<date>, B<otherTypeId> and B<otherType> to CMS_ContentInfo enveloped | ||
| 23 | data structure B<cms> as a KEKRecipientInfo structure. | ||
| 24 | |||
| 25 | The CMS_ContentInfo structure should be obtained from an initial call to | ||
| 26 | CMS_encrypt() with the flag B<CMS_PARTIAL> set. | ||
| 27 | |||
| 28 | =head1 NOTES | ||
| 29 | |||
| 30 | The main purpose of this function is to provide finer control over a CMS | ||
| 31 | enveloped data structure where the simpler CMS_encrypt() function defaults are | ||
| 32 | not appropriate. For example if one or more KEKRecipientInfo structures | ||
| 33 | need to be added. New attributes can also be added using the returned | ||
| 34 | CMS_RecipientInfo structure and the CMS attribute utility functions. | ||
| 35 | |||
| 36 | OpenSSL will by default identify recipient certificates using issuer name | ||
| 37 | and serial number. If B<CMS_USE_KEYID> is set it will use the subject key | ||
| 38 | identifier value instead. An error occurs if all recipient certificates do not | ||
| 39 | have a subject key identifier extension. | ||
| 40 | |||
| 41 | Currently only AES based key wrapping algorithms are supported for B<nid>, | ||
| 42 | specifically: NID_id_aes128_wrap, NID_id_aes192_wrap and NID_id_aes256_wrap. | ||
| 43 | If B<nid> is set to B<NID_undef> then an AES wrap algorithm will be used | ||
| 44 | consistent with B<keylen>. | ||
| 45 | |||
| 46 | =head1 RETURN VALUES | ||
| 47 | |||
| 48 | CMS_add1_recipient_cert() and CMS_add0_recipient_key() return an internal | ||
| 49 | pointer to the CMS_RecipientInfo structure just added or NULL if an error | ||
| 50 | occurs. | ||
| 51 | |||
| 52 | =head1 SEE ALSO | ||
| 53 | |||
| 54 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)>, | ||
| 55 | L<CMS_final(3)|CMS_final(3)>, | ||
| 56 | |||
| 57 | =head1 HISTORY | ||
| 58 | |||
| 59 | CMS_add1_recipient_cert() and CMS_add0_recipient_key() were added to OpenSSL | ||
| 60 | 0.9.8 | ||
| 61 | |||
| 62 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_compress.pod b/src/lib/libssl/src/doc/crypto/CMS_compress.pod new file mode 100644 index 0000000000..0a0715271d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_compress.pod | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_compress - create a CMS CompressedData structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_compress() creates and returns a CMS CompressedData structure. B<comp_nid> | ||
| 16 | is the compression algorithm to use or B<NID_undef> to use the default | ||
| 17 | algorithm (zlib compression). B<in> is the content to be compressed. | ||
| 18 | B<flags> is an optional set of flags. | ||
| 19 | |||
| 20 | =head1 NOTES | ||
| 21 | |||
| 22 | The only currently supported compression algorithm is zlib using the NID | ||
| 23 | NID_zlib_compression. | ||
| 24 | |||
| 25 | If zlib support is not compiled into OpenSSL then CMS_compress() will return | ||
| 26 | an error. | ||
| 27 | |||
| 28 | If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are | ||
| 29 | prepended to the data. | ||
| 30 | |||
| 31 | Normally the supplied content is translated into MIME canonical format (as | ||
| 32 | required by the S/MIME specifications) if B<CMS_BINARY> is set no translation | ||
| 33 | occurs. This option should be used if the supplied data is in binary format | ||
| 34 | otherwise the translation will corrupt it. If B<CMS_BINARY> is set then | ||
| 35 | B<CMS_TEXT> is ignored. | ||
| 36 | |||
| 37 | If the B<CMS_STREAM> flag is set a partial B<CMS_ContentInfo> structure is | ||
| 38 | returned suitable for streaming I/O: no data is read from the BIO B<in>. | ||
| 39 | |||
| 40 | The compressed data is included in the CMS_ContentInfo structure, unless | ||
| 41 | B<CMS_DETACHED> is set in which case it is omitted. This is rarely used in | ||
| 42 | practice and is not supported by SMIME_write_CMS(). | ||
| 43 | |||
| 44 | =head1 NOTES | ||
| 45 | |||
| 46 | If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure is | ||
| 47 | B<not> complete and outputting its contents via a function that does not | ||
| 48 | properly finalize the B<CMS_ContentInfo> structure will give unpredictable | ||
| 49 | results. | ||
| 50 | |||
| 51 | Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), | ||
| 52 | PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization | ||
| 53 | can be performed by obtaining the streaming ASN1 B<BIO> directly using | ||
| 54 | BIO_new_CMS(). | ||
| 55 | |||
| 56 | Additional compression parameters such as the zlib compression level cannot | ||
| 57 | currently be set. | ||
| 58 | |||
| 59 | =head1 RETURN VALUES | ||
| 60 | |||
| 61 | CMS_compress() returns either a CMS_ContentInfo structure or NULL if an error | ||
| 62 | occurred. The error can be obtained from ERR_get_error(3). | ||
| 63 | |||
| 64 | =head1 SEE ALSO | ||
| 65 | |||
| 66 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_uncompress(3)|CMS_uncompress(3)> | ||
| 67 | |||
| 68 | =head1 HISTORY | ||
| 69 | |||
| 70 | CMS_compress() was added to OpenSSL 0.9.8 | ||
| 71 | The B<CMS_STREAM> flag was first supported in OpenSSL 1.0.0. | ||
| 72 | |||
| 73 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_decrypt.pod b/src/lib/libssl/src/doc/crypto/CMS_decrypt.pod new file mode 100644 index 0000000000..d857e4f93f --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_decrypt.pod | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_decrypt - decrypt content from a CMS envelopedData structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert, BIO *dcont, BIO *out, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_decrypt() extracts and decrypts the content from a CMS EnvelopedData | ||
| 16 | structure. B<pkey> is the private key of the recipient, B<cert> is the | ||
| 17 | recipient's certificate, B<out> is a BIO to write the content to and | ||
| 18 | B<flags> is an optional set of flags. | ||
| 19 | |||
| 20 | The B<dcont> parameter is used in the rare case where the encrypted content | ||
| 21 | is detached. It will normally be set to NULL. | ||
| 22 | |||
| 23 | =head1 NOTES | ||
| 24 | |||
| 25 | OpenSSL_add_all_algorithms() (or equivalent) should be called before using this | ||
| 26 | function or errors about unknown algorithms will occur. | ||
| 27 | |||
| 28 | Although the recipients certificate is not needed to decrypt the data it is | ||
| 29 | needed to locate the appropriate (of possible several) recipients in the CMS | ||
| 30 | structure. If B<cert> is set to NULL all possible recipients are tried. | ||
| 31 | |||
| 32 | It is possible to determine the correct recipient key by other means (for | ||
| 33 | example looking them up in a database) and setting them in the CMS structure | ||
| 34 | in advance using the CMS utility functions such as CMS_set1_pkey(). In this | ||
| 35 | case both B<cert> and B<pkey> should be set to NULL. | ||
| 36 | |||
| 37 | To process KEKRecipientInfo types CMS_set1_key() or CMS_RecipientInfo_set0_key() | ||
| 38 | and CMS_ReceipientInfo_decrypt() should be called before CMS_decrypt() and | ||
| 39 | B<cert> and B<pkey> set to NULL. | ||
| 40 | |||
| 41 | The following flags can be passed in the B<flags> parameter. | ||
| 42 | |||
| 43 | If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted | ||
| 44 | from the content. If the content is not of type B<text/plain> then an error is | ||
| 45 | returned. | ||
| 46 | |||
| 47 | =head1 RETURN VALUES | ||
| 48 | |||
| 49 | CMS_decrypt() returns either 1 for success or 0 for failure. | ||
| 50 | The error can be obtained from ERR_get_error(3) | ||
| 51 | |||
| 52 | =head1 BUGS | ||
| 53 | |||
| 54 | The lack of single pass processing and the need to hold all data in memory as | ||
| 55 | mentioned in CMS_verify() also applies to CMS_decrypt(). | ||
| 56 | |||
| 57 | =head1 SEE ALSO | ||
| 58 | |||
| 59 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 60 | |||
| 61 | =head1 HISTORY | ||
| 62 | |||
| 63 | CMS_decrypt() was added to OpenSSL 0.9.8 | ||
| 64 | |||
| 65 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_encrypt.pod b/src/lib/libssl/src/doc/crypto/CMS_encrypt.pod new file mode 100644 index 0000000000..1ee5b275ec --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_encrypt.pod | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_encrypt - create a CMS envelopedData structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_encrypt() creates and returns a CMS EnvelopedData structure. B<certs> | ||
| 16 | is a list of recipient certificates. B<in> is the content to be encrypted. | ||
| 17 | B<cipher> is the symmetric cipher to use. B<flags> is an optional set of flags. | ||
| 18 | |||
| 19 | =head1 NOTES | ||
| 20 | |||
| 21 | Only certificates carrying RSA keys are supported so the recipient certificates | ||
| 22 | supplied to this function must all contain RSA public keys, though they do not | ||
| 23 | have to be signed using the RSA algorithm. | ||
| 24 | |||
| 25 | EVP_des_ede3_cbc() (triple DES) is the algorithm of choice for S/MIME use | ||
| 26 | because most clients will support it. | ||
| 27 | |||
| 28 | The algorithm passed in the B<cipher> parameter must support ASN1 encoding of | ||
| 29 | its parameters. | ||
| 30 | |||
| 31 | Many browsers implement a "sign and encrypt" option which is simply an S/MIME | ||
| 32 | envelopedData containing an S/MIME signed message. This can be readily produced | ||
| 33 | by storing the S/MIME signed message in a memory BIO and passing it to | ||
| 34 | CMS_encrypt(). | ||
| 35 | |||
| 36 | The following flags can be passed in the B<flags> parameter. | ||
| 37 | |||
| 38 | If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are | ||
| 39 | prepended to the data. | ||
| 40 | |||
| 41 | Normally the supplied content is translated into MIME canonical format (as | ||
| 42 | required by the S/MIME specifications) if B<CMS_BINARY> is set no translation | ||
| 43 | occurs. This option should be used if the supplied data is in binary format | ||
| 44 | otherwise the translation will corrupt it. If B<CMS_BINARY> is set then | ||
| 45 | B<CMS_TEXT> is ignored. | ||
| 46 | |||
| 47 | OpenSSL will by default identify recipient certificates using issuer name | ||
| 48 | and serial number. If B<CMS_USE_KEYID> is set it will use the subject key | ||
| 49 | identifier value instead. An error occurs if all recipient certificates do not | ||
| 50 | have a subject key identifier extension. | ||
| 51 | |||
| 52 | If the B<CMS_STREAM> flag is set a partial B<CMS_ContentInfo> structure is | ||
| 53 | returned suitable for streaming I/O: no data is read from the BIO B<in>. | ||
| 54 | |||
| 55 | If the B<CMS_PARTIAL> flag is set a partial B<CMS_ContentInfo> structure is | ||
| 56 | returned to which additional recipients and attributes can be added before | ||
| 57 | finalization. | ||
| 58 | |||
| 59 | The data being encrypted is included in the CMS_ContentInfo structure, unless | ||
| 60 | B<CMS_DETACHED> is set in which case it is omitted. This is rarely used in | ||
| 61 | practice and is not supported by SMIME_write_CMS(). | ||
| 62 | |||
| 63 | =head1 NOTES | ||
| 64 | |||
| 65 | If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure is | ||
| 66 | B<not> complete and outputting its contents via a function that does not | ||
| 67 | properly finalize the B<CMS_ContentInfo> structure will give unpredictable | ||
| 68 | results. | ||
| 69 | |||
| 70 | Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), | ||
| 71 | PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization | ||
| 72 | can be performed by obtaining the streaming ASN1 B<BIO> directly using | ||
| 73 | BIO_new_CMS(). | ||
| 74 | |||
| 75 | The recipients specified in B<certs> use a CMS KeyTransRecipientInfo info | ||
| 76 | structure. KEKRecipientInfo is also supported using the flag B<CMS_PARTIAL> | ||
| 77 | and CMS_add0_recipient_key(). | ||
| 78 | |||
| 79 | The parameter B<certs> may be NULL if B<CMS_PARTIAL> is set and recipients | ||
| 80 | added later using CMS_add1_recipient_cert() or CMS_add0_recipient_key(). | ||
| 81 | |||
| 82 | =head1 RETURN VALUES | ||
| 83 | |||
| 84 | CMS_encrypt() returns either a CMS_ContentInfo structure or NULL if an error | ||
| 85 | occurred. The error can be obtained from ERR_get_error(3). | ||
| 86 | |||
| 87 | =head1 SEE ALSO | ||
| 88 | |||
| 89 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)> | ||
| 90 | |||
| 91 | =head1 HISTORY | ||
| 92 | |||
| 93 | CMS_decrypt() was added to OpenSSL 0.9.8 | ||
| 94 | The B<CMS_STREAM> flag was first supported in OpenSSL 1.0.0. | ||
| 95 | |||
| 96 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_final.pod b/src/lib/libssl/src/doc/crypto/CMS_final.pod new file mode 100644 index 0000000000..36cf96b8a0 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_final.pod | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_final - finalise a CMS_ContentInfo structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_final() finalises the structure B<cms>. It's purpose is to perform any | ||
| 16 | operations necessary on B<cms> (digest computation for example) and set the | ||
| 17 | appropriate fields. The parameter B<data> contains the content to be | ||
| 18 | processed. The B<dcont> parameter contains a BIO to write content to after | ||
| 19 | processing: this is only used with detached data and will usually be set to | ||
| 20 | NULL. | ||
| 21 | |||
| 22 | =head1 NOTES | ||
| 23 | |||
| 24 | This function will normally be called when the B<CMS_PARTIAL> flag is used. It | ||
| 25 | should only be used when streaming is not performed because the streaming | ||
| 26 | I/O functions perform finalisation operations internally. | ||
| 27 | |||
| 28 | =head1 RETURN VALUES | ||
| 29 | |||
| 30 | CMS_final() returns 1 for success or 0 for failure. | ||
| 31 | |||
| 32 | =head1 SEE ALSO | ||
| 33 | |||
| 34 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 35 | L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 36 | |||
| 37 | =head1 HISTORY | ||
| 38 | |||
| 39 | CMS_final() was added to OpenSSL 0.9.8 | ||
| 40 | |||
| 41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get0_RecipientInfos.pod b/src/lib/libssl/src/doc/crypto/CMS_get0_RecipientInfos.pod new file mode 100644 index 0000000000..e0355423e6 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_get0_RecipientInfos.pod | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt - CMS envelopedData RecipientInfo routines | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms); | ||
| 12 | int CMS_RecipientInfo_type(CMS_RecipientInfo *ri); | ||
| 13 | |||
| 14 | int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); | ||
| 15 | int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert); | ||
| 16 | int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey); | ||
| 17 | |||
| 18 | int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri, X509_ALGOR **palg, ASN1_OCTET_STRING **pid, ASN1_GENERALIZEDTIME **pdate, ASN1_OBJECT **potherid, ASN1_TYPE **pothertype); | ||
| 19 | int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri, const unsigned char *id, size_t idlen); | ||
| 20 | int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri, unsigned char *key, size_t keylen); | ||
| 21 | |||
| 22 | int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | The function CMS_get0_RecipientInfos() returns all the CMS_RecipientInfo | ||
| 27 | structures associated with a CMS EnvelopedData structure. | ||
| 28 | |||
| 29 | CMS_RecipientInfo_type() returns the type of CMS_RecipientInfo structure B<ri>. | ||
| 30 | It will currently return CMS_RECIPINFO_TRANS, CMS_RECIPINFO_AGREE, | ||
| 31 | CMS_RECIPINFO_KEK, CMS_RECIPINFO_PASS, or CMS_RECIPINFO_OTHER. | ||
| 32 | |||
| 33 | CMS_RecipientInfo_ktri_get0_signer_id() retrieves the certificate recipient | ||
| 34 | identifier associated with a specific CMS_RecipientInfo structure B<ri>, which | ||
| 35 | must be of type CMS_RECIPINFO_TRANS. Either the keyidentifier will be set in | ||
| 36 | B<keyid> or B<both> issuer name and serial number in B<issuer> and B<sno>. | ||
| 37 | |||
| 38 | CMS_RecipientInfo_ktri_cert_cmp() compares the certificate B<cert> against the | ||
| 39 | CMS_RecipientInfo structure B<ri>, which must be of type CMS_RECIPINFO_TRANS. | ||
| 40 | It returns zero if the comparison is successful and non zero if not. | ||
| 41 | |||
| 42 | CMS_RecipientInfo_set0_pkey() associates the private key B<pkey> with | ||
| 43 | the CMS_RecipientInfo structure B<ri>, which must be of type | ||
| 44 | CMS_RECIPINFO_TRANS. | ||
| 45 | |||
| 46 | CMS_RecipientInfo_kekri_get0_id() retrieves the key information from the | ||
| 47 | CMS_RecipientInfo structure B<ri> which must be of type CMS_RECIPINFO_KEK. Any | ||
| 48 | of the remaining parameters can be NULL if the application is not interested in | ||
| 49 | the value of a field. Where a field is optional and absent NULL will be written | ||
| 50 | to the corresponding parameter. The keyEncryptionAlgorithm field is written to | ||
| 51 | B<palg>, the B<keyIdentifier> field is written to B<pid>, the B<date> field if | ||
| 52 | present is written to B<pdate>, if the B<other> field is present the components | ||
| 53 | B<keyAttrId> and B<keyAttr> are written to parameters B<potherid> and | ||
| 54 | B<pothertype>. | ||
| 55 | |||
| 56 | CMS_RecipientInfo_kekri_id_cmp() compares the ID in the B<id> and B<idlen> | ||
| 57 | parameters against the B<keyIdentifier> CMS_RecipientInfo structure B<ri>, | ||
| 58 | which must be of type CMS_RECIPINFO_KEK. It returns zero if the comparison is | ||
| 59 | successful and non zero if not. | ||
| 60 | |||
| 61 | CMS_RecipientInfo_set0_key() associates the symmetric key B<key> of length | ||
| 62 | B<keylen> with the CMS_RecipientInfo structure B<ri>, which must be of type | ||
| 63 | CMS_RECIPINFO_KEK. | ||
| 64 | |||
| 65 | CMS_RecipientInfo_decrypt() attempts to decrypt CMS_RecipientInfo structure | ||
| 66 | B<ri> in structure B<cms>. A key must have been associated with the structure | ||
| 67 | first. | ||
| 68 | |||
| 69 | =head1 NOTES | ||
| 70 | |||
| 71 | The main purpose of these functions is to enable an application to lookup | ||
| 72 | recipient keys using any appropriate technique when the simpler method | ||
| 73 | of CMS_decrypt() is not appropriate. | ||
| 74 | |||
| 75 | In typical usage and application will retrieve all CMS_RecipientInfo structures | ||
| 76 | using CMS_get0_RecipientInfos() and check the type of each using | ||
| 77 | CMS_RecpientInfo_type(). Depending on the type the CMS_RecipientInfo structure | ||
| 78 | can be ignored or its key identifier data retrieved using an appropriate | ||
| 79 | function. Then if the corresponding secret or private key can be obtained by | ||
| 80 | any appropriate means it can then associated with the structure and | ||
| 81 | CMS_RecpientInfo_decrypt() called. If successful CMS_decrypt() can be called | ||
| 82 | with a NULL key to decrypt the enveloped content. | ||
| 83 | |||
| 84 | =head1 RETURN VALUES | ||
| 85 | |||
| 86 | CMS_get0_RecipientInfos() returns all CMS_RecipientInfo structures, or NULL if | ||
| 87 | an error occurs. | ||
| 88 | |||
| 89 | CMS_RecipientInfo_ktri_get0_signer_id(), CMS_RecipientInfo_set0_pkey(), | ||
| 90 | CMS_RecipientInfo_kekri_get0_id(), CMS_RecipientInfo_set0_key() and | ||
| 91 | CMS_RecipientInfo_decrypt() return 1 for success or 0 if an error occurs. | ||
| 92 | |||
| 93 | CMS_RecipientInfo_ktri_cert_cmp() and CMS_RecipientInfo_kekri_cmp() return 0 | ||
| 94 | for a successful comparison and non zero otherwise. | ||
| 95 | |||
| 96 | Any error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. | ||
| 97 | |||
| 98 | =head1 SEE ALSO | ||
| 99 | |||
| 100 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_decrypt(3)|CMS_decrypt(3)> | ||
| 101 | |||
| 102 | =head1 HISTORY | ||
| 103 | |||
| 104 | These functions were first was added to OpenSSL 0.9.8 | ||
| 105 | |||
| 106 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get0_SignerInfos.pod b/src/lib/libssl/src/doc/crypto/CMS_get0_SignerInfos.pod new file mode 100644 index 0000000000..47f6d2a047 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_get0_SignerInfos.pod | |||
| @@ -0,0 +1,75 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_cert_cmp, CMS_set1_signer_certs - CMS signedData signer functions. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms); | ||
| 12 | |||
| 13 | int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si, ASN1_OCTET_STRING **keyid, X509_NAME **issuer, ASN1_INTEGER **sno); | ||
| 14 | int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert); | ||
| 15 | void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer); | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | The function CMS_get0_SignerInfos() returns all the CMS_SignerInfo structures | ||
| 20 | associated with a CMS signedData structure. | ||
| 21 | |||
| 22 | CMS_SignerInfo_get0_signer_id() retrieves the certificate signer identifier | ||
| 23 | associated with a specific CMS_SignerInfo structure B<si>. Either the | ||
| 24 | keyidentifier will be set in B<keyid> or B<both> issuer name and serial number | ||
| 25 | in B<issuer> and B<sno>. | ||
| 26 | |||
| 27 | CMS_SignerInfo_cert_cmp() compares the certificate B<cert> against the signer | ||
| 28 | identifier B<si>. It returns zero if the comparison is successful and non zero | ||
| 29 | if not. | ||
| 30 | |||
| 31 | CMS_SignerInfo_set1_signer_cert() sets the signers certificate of B<si> to | ||
| 32 | B<signer>. | ||
| 33 | |||
| 34 | =head1 NOTES | ||
| 35 | |||
| 36 | The main purpose of these functions is to enable an application to lookup | ||
| 37 | signers certificates using any appropriate technique when the simpler method | ||
| 38 | of CMS_verify() is not appropriate. | ||
| 39 | |||
| 40 | In typical usage and application will retrieve all CMS_SignerInfo structures | ||
| 41 | using CMS_get0_SignerInfo() and retrieve the identifier information using | ||
| 42 | CMS. It will then obtain the signer certificate by some unspecified means | ||
| 43 | (or return and error if it cannot be found) and set it using | ||
| 44 | CMS_SignerInfo_set1_signer_cert(). | ||
| 45 | |||
| 46 | Once all signer certificates have been set CMS_verify() can be used. | ||
| 47 | |||
| 48 | Although CMS_get0_SignerInfos() can return NULL is an error occur B<or> if | ||
| 49 | there are no signers this is not a problem in practice because the only | ||
| 50 | error which can occur is if the B<cms> structure is not of type signedData | ||
| 51 | due to application error. | ||
| 52 | |||
| 53 | =head1 RETURN VALUES | ||
| 54 | |||
| 55 | CMS_get0_SignerInfos() returns all CMS_SignerInfo structures, or NULL there | ||
| 56 | are no signers or an error occurs. | ||
| 57 | |||
| 58 | CMS_SignerInfo_get0_signer_id() returns 1 for success and 0 for failure. | ||
| 59 | |||
| 60 | CMS_SignerInfo_cert_cmp() returns 0 for a successful comparison and non | ||
| 61 | zero otherwise. | ||
| 62 | |||
| 63 | CMS_SignerInfo_set1_signer_cert() does not return a value. | ||
| 64 | |||
| 65 | Any error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> | ||
| 66 | |||
| 67 | =head1 SEE ALSO | ||
| 68 | |||
| 69 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_verify(3)|CMS_verify(3)> | ||
| 70 | |||
| 71 | =head1 HISTORY | ||
| 72 | |||
| 73 | These functions were first was added to OpenSSL 0.9.8 | ||
| 74 | |||
| 75 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get0_type.pod b/src/lib/libssl/src/doc/crypto/CMS_get0_type.pod new file mode 100644 index 0000000000..8ff1c3115c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_get0_type.pod | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_get0_type, CMS_set1_eContentType, CMS_get0_eContentType - get and set CMS content types | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | const ASN1_OBJECT *CMS_get0_type(CMS_ContentInfo *cms); | ||
| 12 | int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid); | ||
| 13 | const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | CMS_get0_type() returns the content type of a CMS_ContentInfo structure as | ||
| 18 | and ASN1_OBJECT pointer. An application can then decide how to process the | ||
| 19 | CMS_ContentInfo structure based on this value. | ||
| 20 | |||
| 21 | CMS_set1_eContentType() sets the embedded content type of a CMS_ContentInfo | ||
| 22 | structure. It should be called with CMS functions with the B<CMS_PARTIAL> | ||
| 23 | flag and B<before> the structure is finalised, otherwise the results are | ||
| 24 | undefined. | ||
| 25 | |||
| 26 | ASN1_OBJECT *CMS_get0_eContentType() returns a pointer to the embedded | ||
| 27 | content type. | ||
| 28 | |||
| 29 | =head1 NOTES | ||
| 30 | |||
| 31 | As the B<0> implies CMS_get0_type() and CMS_get0_eContentType() return internal | ||
| 32 | pointers which should B<not> be freed up. CMS_set1_eContentType() copies the | ||
| 33 | supplied OID and it B<should> be freed up after use. | ||
| 34 | |||
| 35 | The B<ASN1_OBJECT> values returned can be converted to an integer B<NID> value | ||
| 36 | using OBJ_obj2nid(). For the currently supported content types the following | ||
| 37 | values are returned: | ||
| 38 | |||
| 39 | NID_pkcs7_data | ||
| 40 | NID_pkcs7_signed | ||
| 41 | NID_pkcs7_digest | ||
| 42 | NID_id_smime_ct_compressedData: | ||
| 43 | NID_pkcs7_encrypted | ||
| 44 | NID_pkcs7_enveloped | ||
| 45 | |||
| 46 | |||
| 47 | =head1 RETURN VALUES | ||
| 48 | |||
| 49 | CMS_get0_type() and CMS_get0_eContentType() return and ASN1_OBJECT structure. | ||
| 50 | |||
| 51 | CMS_set1_eContentType() returns 1 for success or 0 if an error occurred. The | ||
| 52 | error can be obtained from ERR_get_error(3). | ||
| 53 | |||
| 54 | =head1 SEE ALSO | ||
| 55 | |||
| 56 | L<ERR_get_error(3)|ERR_get_error(3)> | ||
| 57 | |||
| 58 | =head1 HISTORY | ||
| 59 | |||
| 60 | CMS_get0_type(), CMS_set1_eContentType() and CMS_get0_eContentType() were all | ||
| 61 | first added to OpenSSL 0.9.8 | ||
| 62 | |||
| 63 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_get1_ReceiptRequest.pod b/src/lib/libssl/src/doc/crypto/CMS_get1_ReceiptRequest.pod new file mode 100644 index 0000000000..f546376a1e --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_get1_ReceiptRequest.pod | |||
| @@ -0,0 +1,69 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_ReceiptRequest_create0, CMS_add1_ReceiptRequest, CMS_get1_ReceiptRequest, CMS_ReceiptRequest_get0_values - CMS signed receipt request functions. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen, int allorfirst, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo); | ||
| 12 | int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr); | ||
| 13 | int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr); | ||
| 14 | void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING **pcid, int *pallorfirst, STACK_OF(GENERAL_NAMES) **plist, STACK_OF(GENERAL_NAMES) **prto); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | CMS_ReceiptRequest_create0() creates a signed receipt request structure. The | ||
| 19 | B<signedContentIdentifier> field is set using B<id> and B<idlen>, or it is set | ||
| 20 | to 32 bytes of pseudo random data if B<id> is NULL. If B<receiptList> is NULL | ||
| 21 | the allOrFirstTier option in B<receiptsFrom> is used and set to the value of | ||
| 22 | the B<allorfirst> parameter. If B<receiptList> is not NULL the B<receiptList> | ||
| 23 | option in B<receiptsFrom> is used. The B<receiptsTo> parameter specifies the | ||
| 24 | B<receiptsTo> field value. | ||
| 25 | |||
| 26 | The CMS_add1_ReceiptRequest() function adds a signed receipt request B<rr> | ||
| 27 | to SignerInfo structure B<si>. | ||
| 28 | |||
| 29 | int CMS_get1_ReceiptRequest() looks for a signed receipt request in B<si>, if | ||
| 30 | any is found it is decoded and written to B<prr>. | ||
| 31 | |||
| 32 | CMS_ReceiptRequest_get0_values() retrieves the values of a receipt request. | ||
| 33 | The signedContentIdentifier is copied to B<pcid>. If the B<allOrFirstTier> | ||
| 34 | option of B<receiptsFrom> is used its value is copied to B<pallorfirst> | ||
| 35 | otherwise the B<receiptList> field is copied to B<plist>. The B<receiptsTo> | ||
| 36 | parameter is copied to B<prto>. | ||
| 37 | |||
| 38 | =head1 NOTES | ||
| 39 | |||
| 40 | For more details of the meaning of the fields see RFC2634. | ||
| 41 | |||
| 42 | The contents of a signed receipt should only be considered meaningful if the | ||
| 43 | corresponding CMS_ContentInfo structure can be successfully verified using | ||
| 44 | CMS_verify(). | ||
| 45 | |||
| 46 | =head1 RETURN VALUES | ||
| 47 | |||
| 48 | CMS_ReceiptRequest_create0() returns a signed receipt request structure or | ||
| 49 | NULL if an error occurred. | ||
| 50 | |||
| 51 | CMS_add1_ReceiptRequest() returns 1 for success or 0 is an error occurred. | ||
| 52 | |||
| 53 | CMS_get1_ReceiptRequest() returns 1 is a signed receipt request is found and | ||
| 54 | decoded. It returns 0 if a signed receipt request is not present and -1 if | ||
| 55 | it is present but malformed. | ||
| 56 | |||
| 57 | =head1 SEE ALSO | ||
| 58 | |||
| 59 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 60 | L<CMS_sign_receipt(3)|CMS_sign_receipt(3)>, L<CMS_verify(3)|CMS_verify(3)> | ||
| 61 | L<CMS_verify_receipt(3)|CMS_verify_receipt(3)> | ||
| 62 | |||
| 63 | =head1 HISTORY | ||
| 64 | |||
| 65 | CMS_ReceiptRequest_create0(), CMS_add1_ReceiptRequest(), | ||
| 66 | CMS_get1_ReceiptRequest() and CMS_ReceiptRequest_get0_values() were added to | ||
| 67 | OpenSSL 0.9.8 | ||
| 68 | |||
| 69 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_sign.pod b/src/lib/libssl/src/doc/crypto/CMS_sign.pod new file mode 100644 index 0000000000..2cc72de327 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_sign.pod | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_sign - create a CMS SignedData structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, BIO *data, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_sign() creates and returns a CMS SignedData structure. B<signcert> is | ||
| 16 | the certificate to sign with, B<pkey> is the corresponding private key. | ||
| 17 | B<certs> is an optional additional set of certificates to include in the CMS | ||
| 18 | structure (for example any intermediate CAs in the chain). Any or all of | ||
| 19 | these parameters can be B<NULL>, see B<NOTES> below. | ||
| 20 | |||
| 21 | The data to be signed is read from BIO B<data>. | ||
| 22 | |||
| 23 | B<flags> is an optional set of flags. | ||
| 24 | |||
| 25 | =head1 NOTES | ||
| 26 | |||
| 27 | Any of the following flags (ored together) can be passed in the B<flags> | ||
| 28 | parameter. | ||
| 29 | |||
| 30 | Many S/MIME clients expect the signed content to include valid MIME headers. If | ||
| 31 | the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are prepended | ||
| 32 | to the data. | ||
| 33 | |||
| 34 | If B<CMS_NOCERTS> is set the signer's certificate will not be included in the | ||
| 35 | CMS_ContentInfo structure, the signer's certificate must still be supplied in | ||
| 36 | the B<signcert> parameter though. This can reduce the size of the signature if | ||
| 37 | the signers certificate can be obtained by other means: for example a | ||
| 38 | previously signed message. | ||
| 39 | |||
| 40 | The data being signed is included in the CMS_ContentInfo structure, unless | ||
| 41 | B<CMS_DETACHED> is set in which case it is omitted. This is used for | ||
| 42 | CMS_ContentInfo detached signatures which are used in S/MIME plaintext signed | ||
| 43 | messages for example. | ||
| 44 | |||
| 45 | Normally the supplied content is translated into MIME canonical format (as | ||
| 46 | required by the S/MIME specifications) if B<CMS_BINARY> is set no translation | ||
| 47 | occurs. This option should be used if the supplied data is in binary format | ||
| 48 | otherwise the translation will corrupt it. | ||
| 49 | |||
| 50 | The SignedData structure includes several CMS signedAttributes including the | ||
| 51 | signing time, the CMS content type and the supported list of ciphers in an | ||
| 52 | SMIMECapabilities attribute. If B<CMS_NOATTR> is set then no signedAttributes | ||
| 53 | will be used. If B<CMS_NOSMIMECAP> is set then just the SMIMECapabilities are | ||
| 54 | omitted. | ||
| 55 | |||
| 56 | If present the SMIMECapabilities attribute indicates support for the following | ||
| 57 | algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192 | ||
| 58 | bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. | ||
| 59 | If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is | ||
| 60 | not loaded. | ||
| 61 | |||
| 62 | OpenSSL will by default identify signing certificates using issuer name | ||
| 63 | and serial number. If B<CMS_USE_KEYID> is set it will use the subject key | ||
| 64 | identifier value instead. An error occurs if the signing certificate does not | ||
| 65 | have a subject key identifier extension. | ||
| 66 | |||
| 67 | If the flags B<CMS_STREAM> is set then the returned B<CMS_ContentInfo> | ||
| 68 | structure is just initialized ready to perform the signing operation. The | ||
| 69 | signing is however B<not> performed and the data to be signed is not read from | ||
| 70 | the B<data> parameter. Signing is deferred until after the data has been | ||
| 71 | written. In this way data can be signed in a single pass. | ||
| 72 | |||
| 73 | If the B<CMS_PARTIAL> flag is set a partial B<CMS_ContentInfo> structure is | ||
| 74 | output to which additional signers and capabilities can be added before | ||
| 75 | finalization. | ||
| 76 | |||
| 77 | If the flag B<CMS_STREAM> is set the returned B<CMS_ContentInfo> structure is | ||
| 78 | B<not> complete and outputting its contents via a function that does not | ||
| 79 | properly finalize the B<CMS_ContentInfo> structure will give unpredictable | ||
| 80 | results. | ||
| 81 | |||
| 82 | Several functions including SMIME_write_CMS(), i2d_CMS_bio_stream(), | ||
| 83 | PEM_write_bio_CMS_stream() finalize the structure. Alternatively finalization | ||
| 84 | can be performed by obtaining the streaming ASN1 B<BIO> directly using | ||
| 85 | BIO_new_CMS(). | ||
| 86 | |||
| 87 | If a signer is specified it will use the default digest for the signing | ||
| 88 | algorithm. This is B<SHA1> for both RSA and DSA keys. | ||
| 89 | |||
| 90 | If B<signcert> and B<pkey> are NULL then a certificates only CMS structure is | ||
| 91 | output. | ||
| 92 | |||
| 93 | The function CMS_sign() is a basic CMS signing function whose output will be | ||
| 94 | suitable for many purposes. For finer control of the output format the | ||
| 95 | B<certs>, B<signcert> and B<pkey> parameters can all be B<NULL> and the | ||
| 96 | B<CMS_PARTIAL> flag set. Then one or more signers can be added using the | ||
| 97 | function CMS_sign_add1_signer(), non default digests can be used and custom | ||
| 98 | attributes added. B<CMS_final()> must then be called to finalize the | ||
| 99 | structure if streaming is not enabled. | ||
| 100 | |||
| 101 | =head1 BUGS | ||
| 102 | |||
| 103 | Some attributes such as counter signatures are not supported. | ||
| 104 | |||
| 105 | =head1 RETURN VALUES | ||
| 106 | |||
| 107 | CMS_sign() returns either a valid CMS_ContentInfo structure or NULL if an error | ||
| 108 | occurred. The error can be obtained from ERR_get_error(3). | ||
| 109 | |||
| 110 | =head1 SEE ALSO | ||
| 111 | |||
| 112 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_verify(3)|CMS_verify(3)> | ||
| 113 | |||
| 114 | =head1 HISTORY | ||
| 115 | |||
| 116 | CMS_sign() was added to OpenSSL 0.9.8 | ||
| 117 | |||
| 118 | The B<CMS_STREAM> flag is only supported for detached data in OpenSSL 0.9.8, | ||
| 119 | it is supported for embedded data in OpenSSL 1.0.0 and later. | ||
| 120 | |||
| 121 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_sign_add1_signer.pod b/src/lib/libssl/src/doc/crypto/CMS_sign_add1_signer.pod new file mode 100644 index 0000000000..bda3ca2adb --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_sign_add1_signer.pod | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_sign_add1_signer, CMS_SignerInfo_sign - add a signer to a CMS_ContentInfo signed data structure. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_SignerInfo *CMS_sign_add1_signer(CMS_ContentInfo *cms, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, unsigned int flags); | ||
| 12 | |||
| 13 | int CMS_SignerInfo_sign(CMS_SignerInfo *si); | ||
| 14 | |||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | CMS_sign_add1_signer() adds a signer with certificate B<signcert> and private | ||
| 19 | key B<pkey> using message digest B<md> to CMS_ContentInfo SignedData | ||
| 20 | structure B<cms>. | ||
| 21 | |||
| 22 | The CMS_ContentInfo structure should be obtained from an initial call to | ||
| 23 | CMS_sign() with the flag B<CMS_PARTIAL> set or in the case or re-signing a | ||
| 24 | valid CMS_ContentInfo SignedData structure. | ||
| 25 | |||
| 26 | If the B<md> parameter is B<NULL> then the default digest for the public | ||
| 27 | key algorithm will be used. | ||
| 28 | |||
| 29 | Unless the B<CMS_REUSE_DIGEST> flag is set the returned CMS_ContentInfo | ||
| 30 | structure is not complete and must be finalized either by streaming (if | ||
| 31 | applicable) or a call to CMS_final(). | ||
| 32 | |||
| 33 | The CMS_SignerInfo_sign() function will explicitly sign a CMS_SignerInfo | ||
| 34 | structure, its main use is when B<CMS_REUSE_DIGEST> and B<CMS_PARTIAL> flags | ||
| 35 | are both set. | ||
| 36 | |||
| 37 | =head1 NOTES | ||
| 38 | |||
| 39 | The main purpose of CMS_sign_add1_signer() is to provide finer control | ||
| 40 | over a CMS signed data structure where the simpler CMS_sign() function defaults | ||
| 41 | are not appropriate. For example if multiple signers or non default digest | ||
| 42 | algorithms are needed. New attributes can also be added using the returned | ||
| 43 | CMS_SignerInfo structure and the CMS attribute utility functions or the | ||
| 44 | CMS signed receipt request functions. | ||
| 45 | |||
| 46 | Any of the following flags (ored together) can be passed in the B<flags> | ||
| 47 | parameter. | ||
| 48 | |||
| 49 | If B<CMS_REUSE_DIGEST> is set then an attempt is made to copy the content | ||
| 50 | digest value from the CMS_ContentInfo structure: to add a signer to an existing | ||
| 51 | structure. An error occurs if a matching digest value cannot be found to copy. | ||
| 52 | The returned CMS_ContentInfo structure will be valid and finalized when this | ||
| 53 | flag is set. | ||
| 54 | |||
| 55 | If B<CMS_PARTIAL> is set in addition to B<CMS_REUSE_DIGEST> then the | ||
| 56 | CMS_SignerInfo structure will not be finalized so additional attributes | ||
| 57 | can be added. In this case an explicit call to CMS_SignerInfo_sign() is | ||
| 58 | needed to finalize it. | ||
| 59 | |||
| 60 | If B<CMS_NOCERTS> is set the signer's certificate will not be included in the | ||
| 61 | CMS_ContentInfo structure, the signer's certificate must still be supplied in | ||
| 62 | the B<signcert> parameter though. This can reduce the size of the signature if | ||
| 63 | the signers certificate can be obtained by other means: for example a | ||
| 64 | previously signed message. | ||
| 65 | |||
| 66 | The SignedData structure includes several CMS signedAttributes including the | ||
| 67 | signing time, the CMS content type and the supported list of ciphers in an | ||
| 68 | SMIMECapabilities attribute. If B<CMS_NOATTR> is set then no signedAttributes | ||
| 69 | will be used. If B<CMS_NOSMIMECAP> is set then just the SMIMECapabilities are | ||
| 70 | omitted. | ||
| 71 | |||
| 72 | OpenSSL will by default identify signing certificates using issuer name | ||
| 73 | and serial number. If B<CMS_USE_KEYID> is set it will use the subject key | ||
| 74 | identifier value instead. An error occurs if the signing certificate does not | ||
| 75 | have a subject key identifier extension. | ||
| 76 | |||
| 77 | If present the SMIMECapabilities attribute indicates support for the following | ||
| 78 | algorithms in preference order: 256 bit AES, Gost R3411-94, Gost 28147-89, 192 | ||
| 79 | bit AES, 128 bit AES, triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. | ||
| 80 | If any of these algorithms is not available then it will not be included: for example the GOST algorithms will not be included if the GOST ENGINE is | ||
| 81 | not loaded. | ||
| 82 | |||
| 83 | CMS_sign_add1_signer() returns an internal pointer to the CMS_SignerInfo | ||
| 84 | structure just added, this can be used to set additional attributes | ||
| 85 | before it is finalized. | ||
| 86 | |||
| 87 | =head1 RETURN VALUES | ||
| 88 | |||
| 89 | CMS_sign1_add_signers() returns an internal pointer to the CMS_SignerInfo | ||
| 90 | structure just added or NULL if an error occurs. | ||
| 91 | |||
| 92 | =head1 SEE ALSO | ||
| 93 | |||
| 94 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 95 | L<CMS_final(3)|CMS_final(3)>, | ||
| 96 | |||
| 97 | =head1 HISTORY | ||
| 98 | |||
| 99 | CMS_sign_add1_signer() was added to OpenSSL 0.9.8 | ||
| 100 | |||
| 101 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_sign_receipt.pod b/src/lib/libssl/src/doc/crypto/CMS_sign_receipt.pod new file mode 100644 index 0000000000..cae1f83384 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_sign_receipt.pod | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_sign_receipt - create a CMS signed receipt | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_sign_receipt() creates and returns a CMS signed receipt structure. B<si> is | ||
| 16 | the B<CMS_SignerInfo> structure containing the signed receipt request. | ||
| 17 | B<signcert> is the certificate to sign with, B<pkey> is the corresponding | ||
| 18 | private key. B<certs> is an optional additional set of certificates to include | ||
| 19 | in the CMS structure (for example any intermediate CAs in the chain). | ||
| 20 | |||
| 21 | B<flags> is an optional set of flags. | ||
| 22 | |||
| 23 | =head1 NOTES | ||
| 24 | |||
| 25 | This functions behaves in a similar way to CMS_sign() except the flag values | ||
| 26 | B<CMS_DETACHED>, B<CMS_BINARY>, B<CMS_NOATTR>, B<CMS_TEXT> and B<CMS_STREAM> | ||
| 27 | are not supported since they do not make sense in the context of signed | ||
| 28 | receipts. | ||
| 29 | |||
| 30 | =head1 RETURN VALUES | ||
| 31 | |||
| 32 | CMS_sign_receipt() returns either a valid CMS_ContentInfo structure or NULL if | ||
| 33 | an error occurred. The error can be obtained from ERR_get_error(3). | ||
| 34 | |||
| 35 | =head1 SEE ALSO | ||
| 36 | |||
| 37 | L<ERR_get_error(3)|ERR_get_error(3)>, | ||
| 38 | L<CMS_verify_receipt(3)|CMS_verify_receipt(3)>, | ||
| 39 | L<CMS_sign(3)|CMS_sign(3)> | ||
| 40 | |||
| 41 | =head1 HISTORY | ||
| 42 | |||
| 43 | CMS_sign_receipt() was added to OpenSSL 0.9.8 | ||
| 44 | |||
| 45 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_uncompress.pod b/src/lib/libssl/src/doc/crypto/CMS_uncompress.pod new file mode 100644 index 0000000000..c6056b027d --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_uncompress.pod | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_uncompress - uncompress a CMS CompressedData structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_uncompress() extracts and uncompresses the content from a CMS | ||
| 16 | CompressedData structure B<cms>. B<data> is a BIO to write the content to and | ||
| 17 | B<flags> is an optional set of flags. | ||
| 18 | |||
| 19 | The B<dcont> parameter is used in the rare case where the compressed content | ||
| 20 | is detached. It will normally be set to NULL. | ||
| 21 | |||
| 22 | =head1 NOTES | ||
| 23 | |||
| 24 | The only currently supported compression algorithm is zlib: if the structure | ||
| 25 | indicates the use of any other algorithm an error is returned. | ||
| 26 | |||
| 27 | If zlib support is not compiled into OpenSSL then CMS_uncompress() will always | ||
| 28 | return an error. | ||
| 29 | |||
| 30 | The following flags can be passed in the B<flags> parameter. | ||
| 31 | |||
| 32 | If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted | ||
| 33 | from the content. If the content is not of type B<text/plain> then an error is | ||
| 34 | returned. | ||
| 35 | |||
| 36 | =head1 RETURN VALUES | ||
| 37 | |||
| 38 | CMS_uncompress() returns either 1 for success or 0 for failure. The error can | ||
| 39 | be obtained from ERR_get_error(3) | ||
| 40 | |||
| 41 | =head1 BUGS | ||
| 42 | |||
| 43 | The lack of single pass processing and the need to hold all data in memory as | ||
| 44 | mentioned in CMS_verify() also applies to CMS_decompress(). | ||
| 45 | |||
| 46 | =head1 SEE ALSO | ||
| 47 | |||
| 48 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_compress(3)|CMS_compress(3)> | ||
| 49 | |||
| 50 | =head1 HISTORY | ||
| 51 | |||
| 52 | CMS_uncompress() was added to OpenSSL 0.9.8 | ||
| 53 | |||
| 54 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_verify.pod b/src/lib/libssl/src/doc/crypto/CMS_verify.pod new file mode 100644 index 0000000000..8f26fdab09 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_verify.pod | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_verify - verify a CMS SignedData structure | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, X509_STORE *store, BIO *indata, BIO *out, unsigned int flags); | ||
| 12 | |||
| 13 | STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | CMS_verify() verifies a CMS SignedData structure. B<cms> is the CMS_ContentInfo | ||
| 18 | structure to verify. B<certs> is a set of certificates in which to search for | ||
| 19 | the signing certificate(s). B<store> is a trusted certificate store used for | ||
| 20 | chain verification. B<indata> is the detached content if the content is not | ||
| 21 | present in B<cms>. The content is written to B<out> if it is not NULL. | ||
| 22 | |||
| 23 | B<flags> is an optional set of flags, which can be used to modify the verify | ||
| 24 | operation. | ||
| 25 | |||
| 26 | CMS_get0_signers() retrieves the signing certificate(s) from B<cms>, it must | ||
| 27 | be called after a successful CMS_verify() operation. | ||
| 28 | |||
| 29 | =head1 VERIFY PROCESS | ||
| 30 | |||
| 31 | Normally the verify process proceeds as follows. | ||
| 32 | |||
| 33 | Initially some sanity checks are performed on B<cms>. The type of B<cms> must | ||
| 34 | be SignedData. There must be at least one signature on the data and if | ||
| 35 | the content is detached B<indata> cannot be B<NULL>. | ||
| 36 | |||
| 37 | An attempt is made to locate all the signing certificate(s), first looking in | ||
| 38 | the B<certs> parameter (if it is not NULL) and then looking in any | ||
| 39 | certificates contained in the B<cms> structure itself. If any signing | ||
| 40 | certificate cannot be located the operation fails. | ||
| 41 | |||
| 42 | Each signing certificate is chain verified using the B<smimesign> purpose and | ||
| 43 | the supplied trusted certificate store. Any internal certificates in the message | ||
| 44 | are used as untrusted CAs. If CRL checking is enabled in B<store> any internal | ||
| 45 | CRLs are used in addition to attempting to look them up in B<store>. If any | ||
| 46 | chain verify fails an error code is returned. | ||
| 47 | |||
| 48 | Finally the signed content is read (and written to B<out> is it is not NULL) | ||
| 49 | and the signature's checked. | ||
| 50 | |||
| 51 | If all signature's verify correctly then the function is successful. | ||
| 52 | |||
| 53 | Any of the following flags (ored together) can be passed in the B<flags> | ||
| 54 | parameter to change the default verify behaviour. | ||
| 55 | |||
| 56 | If B<CMS_NOINTERN> is set the certificates in the message itself are not | ||
| 57 | searched when locating the signing certificate(s). This means that all the | ||
| 58 | signing certificates must be in the B<certs> parameter. | ||
| 59 | |||
| 60 | If B<CMS_NOCRL> is set and CRL checking is enabled in B<store> then any | ||
| 61 | CRLs in the message itself are ignored. | ||
| 62 | |||
| 63 | If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are deleted | ||
| 64 | from the content. If the content is not of type B<text/plain> then an error is | ||
| 65 | returned. | ||
| 66 | |||
| 67 | If B<CMS_NO_SIGNER_CERT_VERIFY> is set the signing certificates are not | ||
| 68 | verified. | ||
| 69 | |||
| 70 | If B<CMS_NO_ATTR_VERIFY> is set the signed attributes signature is not | ||
| 71 | verified. | ||
| 72 | |||
| 73 | If B<CMS_NO_CONTENT_VERIFY> is set then the content digest is not checked. | ||
| 74 | |||
| 75 | =head1 NOTES | ||
| 76 | |||
| 77 | One application of B<CMS_NOINTERN> is to only accept messages signed by | ||
| 78 | a small number of certificates. The acceptable certificates would be passed | ||
| 79 | in the B<certs> parameter. In this case if the signer is not one of the | ||
| 80 | certificates supplied in B<certs> then the verify will fail because the | ||
| 81 | signer cannot be found. | ||
| 82 | |||
| 83 | In some cases the standard techniques for looking up and validating | ||
| 84 | certificates are not appropriate: for example an application may wish to | ||
| 85 | lookup certificates in a database or perform customised verification. This | ||
| 86 | can be achieved by setting and verifying the signers certificates manually | ||
| 87 | using the signed data utility functions. | ||
| 88 | |||
| 89 | Care should be taken when modifying the default verify behaviour, for example | ||
| 90 | setting B<CMS_NO_CONTENT_VERIFY> will totally disable all content verification | ||
| 91 | and any modified content will be considered valid. This combination is however | ||
| 92 | useful if one merely wishes to write the content to B<out> and its validity | ||
| 93 | is not considered important. | ||
| 94 | |||
| 95 | Chain verification should arguably be performed using the signing time rather | ||
| 96 | than the current time. However since the signing time is supplied by the | ||
| 97 | signer it cannot be trusted without additional evidence (such as a trusted | ||
| 98 | timestamp). | ||
| 99 | |||
| 100 | =head1 RETURN VALUES | ||
| 101 | |||
| 102 | CMS_verify() returns 1 for a successful verification and zero if an error | ||
| 103 | occurred. | ||
| 104 | |||
| 105 | CMS_get0_signers() returns all signers or NULL if an error occurred. | ||
| 106 | |||
| 107 | The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> | ||
| 108 | |||
| 109 | =head1 BUGS | ||
| 110 | |||
| 111 | The trusted certificate store is not searched for the signing certificate, | ||
| 112 | this is primarily due to the inadequacies of the current B<X509_STORE> | ||
| 113 | functionality. | ||
| 114 | |||
| 115 | The lack of single pass processing means that the signed content must all | ||
| 116 | be held in memory if it is not detached. | ||
| 117 | |||
| 118 | =head1 SEE ALSO | ||
| 119 | |||
| 120 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)> | ||
| 121 | |||
| 122 | =head1 HISTORY | ||
| 123 | |||
| 124 | CMS_verify() was added to OpenSSL 0.9.8 | ||
| 125 | |||
| 126 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/CMS_verify_receipt.pod b/src/lib/libssl/src/doc/crypto/CMS_verify_receipt.pod new file mode 100644 index 0000000000..9283e0e04b --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/CMS_verify_receipt.pod | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | CMS_verify_receipt - verify a CMS signed receipt | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms, STACK_OF(X509) *certs, X509_STORE *store, unsigned int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | CMS_verify_receipt() verifies a CMS signed receipt. B<rcms> is the signed | ||
| 16 | receipt to verify. B<ocms> is the original SignedData structure containing the | ||
| 17 | receipt request. B<certs> is a set of certificates in which to search for the | ||
| 18 | signing certificate. B<store> is a trusted certificate store (used for chain | ||
| 19 | verification). | ||
| 20 | |||
| 21 | B<flags> is an optional set of flags, which can be used to modify the verify | ||
| 22 | operation. | ||
| 23 | |||
| 24 | =head1 NOTES | ||
| 25 | |||
| 26 | This functions behaves in a similar way to CMS_verify() except the flag values | ||
| 27 | B<CMS_DETACHED>, B<CMS_BINARY>, B<CMS_TEXT> and B<CMS_STREAM> are not | ||
| 28 | supported since they do not make sense in the context of signed receipts. | ||
| 29 | |||
| 30 | =head1 RETURN VALUES | ||
| 31 | |||
| 32 | CMS_verify_receipt() returns 1 for a successful verification and zero if an | ||
| 33 | error occurred. | ||
| 34 | |||
| 35 | The error can be obtained from L<ERR_get_error(3)|ERR_get_error(3)> | ||
| 36 | |||
| 37 | =head1 SEE ALSO | ||
| 38 | |||
| 39 | L<ERR_get_error(3)|ERR_get_error(3)>, | ||
| 40 | L<CMS_sign_receipt(3)|CMS_sign_receipt(3)>, | ||
| 41 | L<CMS_verify(3)|CMS_verify(3)>, | ||
| 42 | |||
| 43 | =head1 HISTORY | ||
| 44 | |||
| 45 | CMS_verify_receipt() was added to OpenSSL 0.9.8 | ||
| 46 | |||
| 47 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestSignInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestSignInit.pod new file mode 100644 index 0000000000..37d960e3b2 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_DigestSignInit.pod | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_DigestSignInit, EVP_DigestSignUpdate, EVP_DigestSignFinal - EVP signing functions | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | ||
| 12 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | ||
| 13 | int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | ||
| 14 | int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | The EVP signature routines are a high level interface to digital signatures. | ||
| 19 | |||
| 20 | EVP_DigestSignInit() sets up signing context B<ctx> to use digest B<type> from | ||
| 21 | ENGINE B<impl> and private key B<pkey>. B<ctx> must be initialized with | ||
| 22 | EVP_MD_CTX_init() before calling this function. If B<pctx> is not NULL the | ||
| 23 | EVP_PKEY_CTX of the signing operation will be written to B<*pctx>: this can | ||
| 24 | be used to set alternative signing options. | ||
| 25 | |||
| 26 | EVP_DigestSignUpdate() hashes B<cnt> bytes of data at B<d> into the | ||
| 27 | signature context B<ctx>. This function can be called several times on the | ||
| 28 | same B<ctx> to include additional data. This function is currently implemented | ||
| 29 | usig a macro. | ||
| 30 | |||
| 31 | EVP_DigestSignFinal() signs the data in B<ctx> places the signature in B<sig>. | ||
| 32 | If B<sig> is B<NULL> then the maximum size of the output buffer is written to | ||
| 33 | the B<siglen> parameter. If B<sig> is not B<NULL> then before the call the | ||
| 34 | B<siglen> parameter should contain the length of the B<sig> buffer, if the | ||
| 35 | call is successful the signature is written to B<sig> and the amount of data | ||
| 36 | written to B<siglen>. | ||
| 37 | |||
| 38 | =head1 RETURN VALUES | ||
| 39 | |||
| 40 | EVP_DigestSignInit() EVP_DigestSignUpdate() and EVP_DigestSignaFinal() return | ||
| 41 | 1 for success and 0 or a negative value for failure. In particular a return | ||
| 42 | value of -2 indicates the operation is not supported by the public key | ||
| 43 | algorithm. | ||
| 44 | |||
| 45 | The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. | ||
| 46 | |||
| 47 | =head1 NOTES | ||
| 48 | |||
| 49 | The B<EVP> interface to digital signatures should almost always be used in | ||
| 50 | preference to the low level interfaces. This is because the code then becomes | ||
| 51 | transparent to the algorithm used and much more flexible. | ||
| 52 | |||
| 53 | In previous versions of OpenSSL there was a link between message digest types | ||
| 54 | and public key algorithms. This meant that "clone" digests such as EVP_dss1() | ||
| 55 | needed to be used to sign using SHA1 and DSA. This is no longer necessary and | ||
| 56 | the use of clone digest is now discouraged. | ||
| 57 | |||
| 58 | For some key types and parameters the random number generator must be seeded | ||
| 59 | or the operation will fail. | ||
| 60 | |||
| 61 | The call to EVP_DigestSignFinal() internally finalizes a copy of the digest | ||
| 62 | context. This means that calls to EVP_DigestSignUpdate() and | ||
| 63 | EVP_DigestSignFinal() can be called later to digest and sign additional data. | ||
| 64 | |||
| 65 | Since only a copy of the digest context is ever finalized the context must | ||
| 66 | be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak | ||
| 67 | will occur. | ||
| 68 | |||
| 69 | The use of EVP_PKEY_size() with these functions is discouraged because some | ||
| 70 | signature operations may have a signature length which depends on the | ||
| 71 | parameters set. As a result EVP_PKEY_size() would have to return a value | ||
| 72 | which indicates the maximum possible signature for any set of parameters. | ||
| 73 | |||
| 74 | =head1 SEE ALSO | ||
| 75 | |||
| 76 | L<EVP_DigestVerifyInit(3)|EVP_DigestVerifyInit(3)>, | ||
| 77 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, | ||
| 78 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | ||
| 79 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | ||
| 80 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> | ||
| 81 | |||
| 82 | =head1 HISTORY | ||
| 83 | |||
| 84 | EVP_DigestSignInit(), EVP_DigestSignUpdate() and EVP_DigestSignFinal() | ||
| 85 | were first added to OpenSSL 1.0.0. | ||
| 86 | |||
| 87 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestVerifyInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestVerifyInit.pod new file mode 100644 index 0000000000..f224488978 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_DigestVerifyInit.pod | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_DigestVerifyInit, EVP_DigestVerifyUpdate, EVP_DigestVerifyFinal - EVP signature verification functions | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, | ||
| 12 | const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); | ||
| 13 | int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *d, unsigned int cnt); | ||
| 14 | int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, unsigned char *sig, size_t siglen); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | The EVP signature routines are a high level interface to digital signatures. | ||
| 19 | |||
| 20 | EVP_DigestVerifyInit() sets up verification context B<ctx> to use digest | ||
| 21 | B<type> from ENGINE B<impl> and public key B<pkey>. B<ctx> must be initialized | ||
| 22 | with EVP_MD_CTX_init() before calling this function. If B<pctx> is not NULL the | ||
| 23 | EVP_PKEY_CTX of the verification operation will be written to B<*pctx>: this | ||
| 24 | can be used to set alternative verification options. | ||
| 25 | |||
| 26 | EVP_DigestVerifyUpdate() hashes B<cnt> bytes of data at B<d> into the | ||
| 27 | verification context B<ctx>. This function can be called several times on the | ||
| 28 | same B<ctx> to include additional data. This function is currently implemented | ||
| 29 | using a macro. | ||
| 30 | |||
| 31 | EVP_DigestVerifyFinal() verifies the data in B<ctx> against the signature in | ||
| 32 | B<sig> of length B<siglen>. | ||
| 33 | |||
| 34 | =head1 RETURN VALUES | ||
| 35 | |||
| 36 | EVP_DigestVerifyInit() and EVP_DigestVerifyUpdate() return 1 for success and 0 | ||
| 37 | or a negative value for failure. In particular a return value of -2 indicates | ||
| 38 | the operation is not supported by the public key algorithm. | ||
| 39 | |||
| 40 | Unlike other functions the return value 0 from EVP_DigestVerifyFinal() only | ||
| 41 | indicates that the signature did not not verify successfully (that is tbs did | ||
| 42 | not match the original data or the signature was of invalid form) it is not an | ||
| 43 | indication of a more serious error. | ||
| 44 | |||
| 45 | The error codes can be obtained from L<ERR_get_error(3)|ERR_get_error(3)>. | ||
| 46 | |||
| 47 | =head1 NOTES | ||
| 48 | |||
| 49 | The B<EVP> interface to digital signatures should almost always be used in | ||
| 50 | preference to the low level interfaces. This is because the code then becomes | ||
| 51 | transparent to the algorithm used and much more flexible. | ||
| 52 | |||
| 53 | In previous versions of OpenSSL there was a link between message digest types | ||
| 54 | and public key algorithms. This meant that "clone" digests such as EVP_dss1() | ||
| 55 | needed to be used to sign using SHA1 and DSA. This is no longer necessary and | ||
| 56 | the use of clone digest is now discouraged. | ||
| 57 | |||
| 58 | For some key types and parameters the random number generator must be seeded | ||
| 59 | or the operation will fail. | ||
| 60 | |||
| 61 | The call to EVP_DigestVerifyFinal() internally finalizes a copy of the digest | ||
| 62 | context. This means that calls to EVP_VerifyUpdate() and EVP_VerifyFinal() can | ||
| 63 | be called later to digest and verify additional data. | ||
| 64 | |||
| 65 | Since only a copy of the digest context is ever finalized the context must | ||
| 66 | be cleaned up after use by calling EVP_MD_CTX_cleanup() or a memory leak | ||
| 67 | will occur. | ||
| 68 | |||
| 69 | =head1 SEE ALSO | ||
| 70 | |||
| 71 | L<EVP_DigestSignInit(3)|EVP_DigestSignInit(3)>, | ||
| 72 | L<EVP_DigestInit(3)|EVP_DigestInit(3)>, L<err(3)|err(3)>, | ||
| 73 | L<evp(3)|evp(3)>, L<hmac(3)|hmac(3)>, L<md2(3)|md2(3)>, | ||
| 74 | L<md5(3)|md5(3)>, L<mdc2(3)|mdc2(3)>, L<ripemd(3)|ripemd(3)>, | ||
| 75 | L<sha(3)|sha(3)>, L<dgst(1)|dgst(1)> | ||
| 76 | |||
| 77 | =head1 HISTORY | ||
| 78 | |||
| 79 | EVP_DigestVerifyInit(), EVP_DigestVerifyUpdate() and EVP_DigestVerifyFinal() | ||
| 80 | were first added to OpenSSL 1.0.0. | ||
| 81 | |||
| 82 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_ctrl.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_ctrl.pod new file mode 100644 index 0000000000..f2f455990f --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_ctrl.pod | |||
| @@ -0,0 +1,128 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_ctrl, EVP_PKEY_ctrl_str - algorithm specific control operations | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype, | ||
| 12 | int cmd, int p1, void *p2); | ||
| 13 | int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, | ||
| 14 | const char *value); | ||
| 15 | |||
| 16 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); | ||
| 17 | |||
| 18 | #include <openssl/rsa.h> | ||
| 19 | |||
| 20 | int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md); | ||
| 21 | |||
| 22 | int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad); | ||
| 23 | int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int len); | ||
| 24 | int EVP_PKEY_CTX_set_rsa_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits); | ||
| 25 | int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp); | ||
| 26 | |||
| 27 | #include <openssl/dsa.h> | ||
| 28 | int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits); | ||
| 29 | |||
| 30 | #include <openssl/dh.h> | ||
| 31 | int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len); | ||
| 32 | int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen); | ||
| 33 | |||
| 34 | #include <openssl/ec.h> | ||
| 35 | int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid); | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | The function EVP_PKEY_CTX_ctrl() sends a control operation to the context | ||
| 40 | B<ctx>. The key type used must match B<keytype> if it is not -1. The parameter | ||
| 41 | B<optype> is a mask indicating which operations the control can be applied to. | ||
| 42 | The control command is indicated in B<cmd> and any additional arguments in | ||
| 43 | B<p1> and B<p2>. | ||
| 44 | |||
| 45 | Applications will not normally call EVP_PKEY_CTX_ctrl() directly but will | ||
| 46 | instead call one of the algorithm specific macros below. | ||
| 47 | |||
| 48 | The function EVP_PKEY_ctrl_str() allows an application to send an algorithm | ||
| 49 | specific control operation to a context B<ctx> in string form. This is | ||
| 50 | intended to be used for options specified on the command line or in text | ||
| 51 | files. The commands supported are documented in the openssl utility | ||
| 52 | command line pages for the option B<-pkeyopt> which is supported by the | ||
| 53 | B<pkeyutl>, B<genpkey> and B<req> commands. | ||
| 54 | |||
| 55 | All the remaining "functions" are implemented as macros. | ||
| 56 | |||
| 57 | The EVP_PKEY_CTX_set_signature_md() macro sets the message digest type used | ||
| 58 | in a signature. It can be used with any public key algorithm supporting | ||
| 59 | signature operations. | ||
| 60 | |||
| 61 | The macro EVP_PKEY_CTX_set_rsa_padding() sets the RSA padding mode for B<ctx>. | ||
| 62 | The B<pad> parameter can take the value RSA_PKCS1_PADDING for PKCS#1 padding, | ||
| 63 | RSA_SSLV23_PADDING for SSLv23 padding, RSA_NO_PADDING for no padding, | ||
| 64 | RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt only), | ||
| 65 | RSA_X931_PADDING for X9.31 padding (signature operations only) and | ||
| 66 | RSA_PKCS1_PSS_PADDING (sign and verify only). | ||
| 67 | |||
| 68 | Two RSA padding modes behave differently if EVP_PKEY_CTX_set_signature_md() | ||
| 69 | is used. If this macro is called for PKCS#1 padding the plaintext buffer is | ||
| 70 | an actual digest value and is encapsulated in a DigestInfo structure according | ||
| 71 | to PKCS#1 when signing and this structure is expected (and stripped off) when | ||
| 72 | verifying. If this control is not used with RSA and PKCS#1 padding then the | ||
| 73 | supplied data is used directly and not encapsulated. In the case of X9.31 | ||
| 74 | padding for RSA the algorithm identifier byte is added or checked and removed | ||
| 75 | if this control is called. If it is not called then the first byte of the plaintext buffer is expected to be the algorithm identifier byte. | ||
| 76 | |||
| 77 | The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro sets the RSA PSS salt length to | ||
| 78 | B<len> as its name implies it is only supported for PSS padding. Two special | ||
| 79 | values are supported: -1 sets the salt length to the digest length. When | ||
| 80 | signing -2 sets the salt length to the maximum permissible value. When | ||
| 81 | verifying -2 causes the salt length to be automatically determined based on the | ||
| 82 | B<PSS> block structure. If this macro is not called a salt length value of -2 | ||
| 83 | is used by default. | ||
| 84 | |||
| 85 | The EVP_PKEY_CTX_set_rsa_rsa_keygen_bits() macro sets the RSA key length for | ||
| 86 | RSA key genration to B<bits>. If not specified 1024 bits is used. | ||
| 87 | |||
| 88 | The EVP_PKEY_CTX_set_rsa_keygen_pubexp() macro sets the public exponent value | ||
| 89 | for RSA key generation to B<pubexp> currently it should be an odd integer. The | ||
| 90 | B<pubexp> pointer is used internally by this function so it should not be | ||
| 91 | modified or free after the call. If this macro is not called then 65537 is used. | ||
| 92 | |||
| 93 | The macro EVP_PKEY_CTX_set_dsa_paramgen_bits() sets the number of bits used | ||
| 94 | for DSA parameter generation to B<bits>. If not specified 1024 is used. | ||
| 95 | |||
| 96 | The macro EVP_PKEY_CTX_set_dh_paramgen_prime_len() sets the length of the DH | ||
| 97 | prime parameter B<p> for DH parameter generation. If this macro is not called | ||
| 98 | then 1024 is used. | ||
| 99 | |||
| 100 | The EVP_PKEY_CTX_set_dh_paramgen_generator() macro sets DH generator to B<gen> | ||
| 101 | for DH parameter generation. If not specified 2 is used. | ||
| 102 | |||
| 103 | The EVP_PKEY_CTX_set_ec_paramgen_curve_nid() sets the EC curve for EC parameter | ||
| 104 | generation to B<nid>. For EC parameter generation this macro must be called | ||
| 105 | or an error occurs because there is no default curve. | ||
| 106 | |||
| 107 | =head1 RETURN VALUES | ||
| 108 | |||
| 109 | EVP_PKEY_CTX_ctrl() and its macros return a positive value for success and 0 | ||
| 110 | or a negative value for failure. In particular a return value of -2 | ||
| 111 | indicates the operation is not supported by the public key algorithm. | ||
| 112 | |||
| 113 | =head1 SEE ALSO | ||
| 114 | |||
| 115 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 116 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
| 117 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
| 118 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 119 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 120 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 121 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
| 122 | L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)> | ||
| 123 | |||
| 124 | =head1 HISTORY | ||
| 125 | |||
| 126 | These functions were first added to OpenSSL 1.0.0. | ||
| 127 | |||
| 128 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_new.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_new.pod new file mode 100644 index 0000000000..a9af867580 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_CTX_new.pod | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free - public key algorithm context functions. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); | ||
| 12 | EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e); | ||
| 13 | EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx); | ||
| 14 | void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | The EVP_PKEY_CTX_new() function allocates public key algorithm context using | ||
| 19 | the algorithm specified in B<pkey> and ENGINE B<e>. | ||
| 20 | |||
| 21 | The EVP_PKEY_CTX_new_id() function allocates public key algorithm context | ||
| 22 | using the algorithm specified by B<id> and ENGINE B<e>. It is normally used | ||
| 23 | when no B<EVP_PKEY> structure is associated with the operations, for example | ||
| 24 | during parameter generation of key genration for some algorithms. | ||
| 25 | |||
| 26 | EVP_PKEY_CTX_dup() duplicates the context B<ctx>. | ||
| 27 | |||
| 28 | EVP_PKEY_CTX_free() frees up the context B<ctx>. | ||
| 29 | |||
| 30 | =head1 NOTES | ||
| 31 | |||
| 32 | The B<EVP_PKEY_CTX> structure is an opaque public key algorithm context used | ||
| 33 | by the OpenSSL high level public key API. Contexts B<MUST NOT> be shared between | ||
| 34 | threads: that is it is not permissible to use the same context simultaneously | ||
| 35 | in two threads. | ||
| 36 | |||
| 37 | =head1 RETURN VALUES | ||
| 38 | |||
| 39 | EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() returns either | ||
| 40 | the newly allocated B<EVP_PKEY_CTX> structure of B<NULL> if an error occurred. | ||
| 41 | |||
| 42 | EVP_PKEY_CTX_free() does not return a value. | ||
| 43 | |||
| 44 | =head1 SEE ALSO | ||
| 45 | |||
| 46 | L<EVP_PKEY_new(3)|EVP_PKEY_new(3)> | ||
| 47 | |||
| 48 | =head1 HISTORY | ||
| 49 | |||
| 50 | These functions were first added to OpenSSL 1.0.0. | ||
| 51 | |||
| 52 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_cmp.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_cmp.pod new file mode 100644 index 0000000000..4f8185e36c --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_cmp.pod | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_copy_parameters, EVP_PKEY_missing_parameters, EVP_PKEY_cmp_parameters, EVP_PKEY_cmp - public key parameter and comparison functions | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey); | ||
| 12 | int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from); | ||
| 13 | |||
| 14 | int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b); | ||
| 15 | int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b); | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | The function EVP_PKEY_missing_parameters() returns 1 if the public key | ||
| 20 | parameters of B<pkey> are missing and 0 if they are present or the algorithm | ||
| 21 | doesn't use parameters. | ||
| 22 | |||
| 23 | The function EVP_PKEY_copy_parameters() copies the parameters from key | ||
| 24 | B<from> to key B<to>. | ||
| 25 | |||
| 26 | The funcion EVP_PKEY_cmp_parameters() compares the parameters of keys | ||
| 27 | B<a> and B<b>. | ||
| 28 | |||
| 29 | The funcion EVP_PKEY_cmp() compares the public key components and paramters | ||
| 30 | (if present) of keys B<a> and B<b>. | ||
| 31 | |||
| 32 | =head1 NOTES | ||
| 33 | |||
| 34 | The main purpose of the functions EVP_PKEY_missing_parameters() and | ||
| 35 | EVP_PKEY_copy_parameters() is to handle public keys in certificates where the | ||
| 36 | parameters are sometimes omitted from a public key if they are inherited from | ||
| 37 | the CA that signed it. | ||
| 38 | |||
| 39 | Since OpenSSL private keys contain public key components too the function | ||
| 40 | EVP_PKEY_cmp() can also be used to determine if a private key matches | ||
| 41 | a public key. | ||
| 42 | |||
| 43 | =head1 RETURN VALUES | ||
| 44 | |||
| 45 | The function EVP_PKEY_missing_parameters() returns 1 if the public key | ||
| 46 | parameters of B<pkey> are missing and 0 if they are present or the algorithm | ||
| 47 | doesn't use parameters. | ||
| 48 | |||
| 49 | These functions EVP_PKEY_copy_parameters() returns 1 for success and 0 for | ||
| 50 | failure. | ||
| 51 | |||
| 52 | The function EVP_PKEY_cmp_parameters() and EVP_PKEY_cmp() return 1 if the | ||
| 53 | keys match, 0 if they don't match, -1 if the key types are different and | ||
| 54 | -2 if the operation is not supported. | ||
| 55 | |||
| 56 | =head1 SEE ALSO | ||
| 57 | |||
| 58 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 59 | L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)> | ||
| 60 | |||
| 61 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod new file mode 100644 index 0000000000..42b2a8c44e --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_decrypt.pod | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_decrypt_init, EVP_PKEY_decrypt - decrypt using a public key algorithm | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx); | ||
| 12 | int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, | ||
| 13 | unsigned char *out, size_t *outlen, | ||
| 14 | const unsigned char *in, size_t inlen); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | The EVP_PKEY_decrypt_init() function initializes a public key algorithm | ||
| 19 | context using key B<pkey> for a decryption operation. | ||
| 20 | |||
| 21 | The EVP_PKEY_decrypt() function performs a public key decryption operation | ||
| 22 | using B<ctx>. The data to be decrypted is specified using the B<in> and | ||
| 23 | B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the output | ||
| 24 | buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then | ||
| 25 | before the call the B<outlen> parameter should contain the length of the | ||
| 26 | B<out> buffer, if the call is successful the decrypted data is written to | ||
| 27 | B<out> and the amount of data written to B<outlen>. | ||
| 28 | |||
| 29 | =head1 NOTES | ||
| 30 | |||
| 31 | After the call to EVP_PKEY_decrypt_init() algorithm specific control | ||
| 32 | operations can be performed to set any appropriate parameters for the | ||
| 33 | operation. | ||
| 34 | |||
| 35 | The function EVP_PKEY_decrypt() can be called more than once on the same | ||
| 36 | context if several operations are performed using the same parameters. | ||
| 37 | |||
| 38 | =head1 RETURN VALUES | ||
| 39 | |||
| 40 | EVP_PKEY_decrypt_init() and EVP_PKEY_decrypt() return 1 for success and 0 | ||
| 41 | or a negative value for failure. In particular a return value of -2 | ||
| 42 | indicates the operation is not supported by the public key algorithm. | ||
| 43 | |||
| 44 | =head1 EXAMPLE | ||
| 45 | |||
| 46 | Decrypt data using OAEP (for RSA keys): | ||
| 47 | |||
| 48 | #include <openssl/evp.h> | ||
| 49 | #include <openssl/rsa.h> | ||
| 50 | |||
| 51 | EVP_PKEY_CTX *ctx; | ||
| 52 | unsigned char *out, *in; | ||
| 53 | size_t outlen, inlen; | ||
| 54 | EVP_PKEY *key; | ||
| 55 | /* NB: assumes key in, inlen are already set up | ||
| 56 | * and that key is an RSA private key | ||
| 57 | */ | ||
| 58 | ctx = EVP_PKEY_CTX_new(key); | ||
| 59 | if (!ctx) | ||
| 60 | /* Error occurred */ | ||
| 61 | if (EVP_PKEY_decrypt_init(ctx) <= 0) | ||
| 62 | /* Error */ | ||
| 63 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <= 0) | ||
| 64 | /* Error */ | ||
| 65 | |||
| 66 | /* Determine buffer length */ | ||
| 67 | if (EVP_PKEY_decrypt(ctx, NULL, &outlen, in, inlen) <= 0) | ||
| 68 | /* Error */ | ||
| 69 | |||
| 70 | out = OPENSSL_malloc(outlen); | ||
| 71 | |||
| 72 | if (!out) | ||
| 73 | /* malloc failure */ | ||
| 74 | |||
| 75 | if (EVP_PKEY_decrypt(ctx, out, &outlen, in, inlen) <= 0) | ||
| 76 | /* Error */ | ||
| 77 | |||
| 78 | /* Decrypted data is outlen bytes written to buffer out */ | ||
| 79 | |||
| 80 | =head1 SEE ALSO | ||
| 81 | |||
| 82 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 83 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
| 84 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 85 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 86 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 87 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
| 88 | |||
| 89 | =head1 HISTORY | ||
| 90 | |||
| 91 | These functions were first added to OpenSSL 1.0.0. | ||
| 92 | |||
| 93 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod new file mode 100644 index 0000000000..d9d6d76c72 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_derive.pod | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_derive_init, EVP_PKEY_derive_set_peer, EVP_PKEY_derive - derive public key algorithm shared secret. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); | ||
| 12 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); | ||
| 13 | int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | The EVP_PKEY_derive_init() function initializes a public key algorithm | ||
| 18 | context using key B<pkey> for shared secret derivation. | ||
| 19 | |||
| 20 | The EVP_PKEY_derive_set_peer() function sets the peer key: this will normally | ||
| 21 | be a public key. | ||
| 22 | |||
| 23 | The EVP_PKEY_derive() derives a shared secret using B<ctx>. | ||
| 24 | If B<key> is B<NULL> then the maximum size of the output buffer is written to | ||
| 25 | the B<keylen> parameter. If B<key> is not B<NULL> then before the call the | ||
| 26 | B<keylen> parameter should contain the length of the B<key> buffer, if the call | ||
| 27 | is successful the shared secret is written to B<key> and the amount of data | ||
| 28 | written to B<keylen>. | ||
| 29 | |||
| 30 | =head1 NOTES | ||
| 31 | |||
| 32 | After the call to EVP_PKEY_derive_init() algorithm specific control | ||
| 33 | operations can be performed to set any appropriate parameters for the | ||
| 34 | operation. | ||
| 35 | |||
| 36 | The function EVP_PKEY_derive() can be called more than once on the same | ||
| 37 | context if several operations are performed using the same parameters. | ||
| 38 | |||
| 39 | =head1 RETURN VALUES | ||
| 40 | |||
| 41 | EVP_PKEY_derive_init() and EVP_PKEY_derive() return 1 for success and 0 | ||
| 42 | or a negative value for failure. In particular a return value of -2 | ||
| 43 | indicates the operation is not supported by the public key algorithm. | ||
| 44 | |||
| 45 | =head1 EXAMPLE | ||
| 46 | |||
| 47 | Derive shared secret (for example DH or EC keys): | ||
| 48 | |||
| 49 | #include <openssl/evp.h> | ||
| 50 | #include <openssl/rsa.h> | ||
| 51 | |||
| 52 | EVP_PKEY_CTX *ctx; | ||
| 53 | unsigned char *skey; | ||
| 54 | size_t skeylen; | ||
| 55 | EVP_PKEY *pkey, *peerkey; | ||
| 56 | /* NB: assumes pkey, peerkey have been already set up */ | ||
| 57 | |||
| 58 | ctx = EVP_PKEY_CTX_new(pkey); | ||
| 59 | if (!ctx) | ||
| 60 | /* Error occurred */ | ||
| 61 | if (EVP_PKEY_derive_init(ctx) <= 0) | ||
| 62 | /* Error */ | ||
| 63 | if (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0) | ||
| 64 | /* Error */ | ||
| 65 | |||
| 66 | /* Determine buffer length */ | ||
| 67 | if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) | ||
| 68 | /* Error */ | ||
| 69 | |||
| 70 | skey = OPENSSL_malloc(skeylen); | ||
| 71 | |||
| 72 | if (!skey) | ||
| 73 | /* malloc failure */ | ||
| 74 | |||
| 75 | if (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0) | ||
| 76 | /* Error */ | ||
| 77 | |||
| 78 | /* Shared secret is skey bytes written to buffer skey */ | ||
| 79 | |||
| 80 | =head1 SEE ALSO | ||
| 81 | |||
| 82 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 83 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
| 84 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
| 85 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 86 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 87 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 88 | |||
| 89 | =head1 HISTORY | ||
| 90 | |||
| 91 | These functions were first added to OpenSSL 1.0.0. | ||
| 92 | |||
| 93 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod new file mode 100644 index 0000000000..91c9c5d0a5 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_encrypt.pod | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_encrypt_init, EVP_PKEY_encrypt - encrypt using a public key algorithm | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx); | ||
| 12 | int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, | ||
| 13 | unsigned char *out, size_t *outlen, | ||
| 14 | const unsigned char *in, size_t inlen); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | The EVP_PKEY_encrypt_init() function initializes a public key algorithm | ||
| 19 | context using key B<pkey> for an encryption operation. | ||
| 20 | |||
| 21 | The EVP_PKEY_encrypt() function performs a public key encryption operation | ||
| 22 | using B<ctx>. The data to be encrypted is specified using the B<in> and | ||
| 23 | B<inlen> parameters. If B<out> is B<NULL> then the maximum size of the output | ||
| 24 | buffer is written to the B<outlen> parameter. If B<out> is not B<NULL> then | ||
| 25 | before the call the B<outlen> parameter should contain the length of the | ||
| 26 | B<out> buffer, if the call is successful the encrypted data is written to | ||
| 27 | B<out> and the amount of data written to B<outlen>. | ||
| 28 | |||
| 29 | =head1 NOTES | ||
| 30 | |||
| 31 | After the call to EVP_PKEY_encrypt_init() algorithm specific control | ||
| 32 | operations can be performed to set any appropriate parameters for the | ||
| 33 | operation. | ||
| 34 | |||
| 35 | The function EVP_PKEY_encrypt() can be called more than once on the same | ||
| 36 | context if several operations are performed using the same parameters. | ||
| 37 | |||
| 38 | =head1 RETURN VALUES | ||
| 39 | |||
| 40 | EVP_PKEY_encrypt_init() and EVP_PKEY_encrypt() return 1 for success and 0 | ||
| 41 | or a negative value for failure. In particular a return value of -2 | ||
| 42 | indicates the operation is not supported by the public key algorithm. | ||
| 43 | |||
| 44 | =head1 EXAMPLE | ||
| 45 | |||
| 46 | Encrypt data using OAEP (for RSA keys): | ||
| 47 | |||
| 48 | #include <openssl/evp.h> | ||
| 49 | #include <openssl/rsa.h> | ||
| 50 | |||
| 51 | EVP_PKEY_CTX *ctx; | ||
| 52 | unsigned char *out, *in; | ||
| 53 | size_t outlen, inlen; | ||
| 54 | EVP_PKEY *key; | ||
| 55 | /* NB: assumes key in, inlen are already set up | ||
| 56 | * and that key is an RSA public key | ||
| 57 | */ | ||
| 58 | ctx = EVP_PKEY_CTX_new(key); | ||
| 59 | if (!ctx) | ||
| 60 | /* Error occurred */ | ||
| 61 | if (EVP_PKEY_encrypt_init(ctx) <= 0) | ||
| 62 | /* Error */ | ||
| 63 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_OAEP_PADDING) <= 0) | ||
| 64 | /* Error */ | ||
| 65 | |||
| 66 | /* Determine buffer length */ | ||
| 67 | if (EVP_PKEY_encrypt(ctx, NULL, &outlen, in, inlen) <= 0) | ||
| 68 | /* Error */ | ||
| 69 | |||
| 70 | out = OPENSSL_malloc(outlen); | ||
| 71 | |||
| 72 | if (!out) | ||
| 73 | /* malloc failure */ | ||
| 74 | |||
| 75 | if (EVP_PKEY_encrypt(ctx, out, &outlen, in, inlen) <= 0) | ||
| 76 | /* Error */ | ||
| 77 | |||
| 78 | /* Encrypted data is outlen bytes written to buffer out */ | ||
| 79 | |||
| 80 | =head1 SEE ALSO | ||
| 81 | |||
| 82 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 83 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
| 84 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 85 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 86 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 87 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
| 88 | |||
| 89 | =head1 HISTORY | ||
| 90 | |||
| 91 | These functions were first added to OpenSSL 1.0.0. | ||
| 92 | |||
| 93 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_get_default_digest.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_get_default_digest.pod new file mode 100644 index 0000000000..1a9c7954c5 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_get_default_digest.pod | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_get_default_digest_nid - get default signature digest | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid); | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | The EVP_PKEY_get_default_digest_nid() function sets B<pnid> to the default | ||
| 15 | message digest NID for the public key signature operations associated with key | ||
| 16 | B<pkey>. | ||
| 17 | |||
| 18 | =head1 NOTES | ||
| 19 | |||
| 20 | For all current standard OpenSSL public key algorithms SHA1 is returned. | ||
| 21 | |||
| 22 | =head1 RETURN VALUES | ||
| 23 | |||
| 24 | The EVP_PKEY_get_default_digest_nid() function returns 1 if the message digest | ||
| 25 | is advisory (that is other digests can be used) and 2 if it is mandatory (other | ||
| 26 | digests can not be used). It returns 0 or a negative value for failure. In | ||
| 27 | particular a return value of -2 indicates the operation is not supported by the | ||
| 28 | public key algorithm. | ||
| 29 | |||
| 30 | =head1 SEE ALSO | ||
| 31 | |||
| 32 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 33 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 34 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 35 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 36 | |||
| 37 | =head1 HISTORY | ||
| 38 | |||
| 39 | This function was first added to OpenSSL 1.0.0. | ||
| 40 | |||
| 41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_keygen.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_keygen.pod new file mode 100644 index 0000000000..37c6fe9503 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_keygen.pod | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_keygen_init, EVP_PKEY_keygen, EVP_PKEY_paramgen_init, EVP_PKEY_paramgen, EVP_PKEY_CTX_set_cb, EVP_PKEY_CTX_get_cb, EVP_PKEY_CTX_get_keygen_info, EVP_PKEVP_PKEY_CTX_set_app_data, EVP_PKEY_CTX_get_app_data - key and parameter generation functions | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx); | ||
| 12 | int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | ||
| 13 | int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx); | ||
| 14 | int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey); | ||
| 15 | |||
| 16 | typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx); | ||
| 17 | |||
| 18 | void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb); | ||
| 19 | EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx); | ||
| 20 | |||
| 21 | int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx); | ||
| 22 | |||
| 23 | void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data); | ||
| 24 | void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx); | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | The EVP_PKEY_keygen_init() function initializes a public key algorithm | ||
| 29 | context using key B<pkey> for a key genration operation. | ||
| 30 | |||
| 31 | The EVP_PKEY_keygen() function performs a key generation operation, the | ||
| 32 | generated key is written to B<ppkey>. | ||
| 33 | |||
| 34 | The functions EVP_PKEY_paramgen_init() and EVP_PKEY_paramgen() are similar | ||
| 35 | except parameters are generated. | ||
| 36 | |||
| 37 | The function EVP_PKEY_set_cb() sets the key or parameter generation callback | ||
| 38 | to B<cb>. The function EVP_PKEY_CTX_get_cb() returns the key or parameter | ||
| 39 | generation callback. | ||
| 40 | |||
| 41 | The function EVP_PKEY_CTX_get_keygen_info() returns parameters associated | ||
| 42 | with the generation operation. If B<idx> is -1 the total number of | ||
| 43 | parameters available is returned. Any non negative value returns the value of | ||
| 44 | that parameter. EVP_PKEY_CTX_gen_keygen_info() with a non-negative value for | ||
| 45 | B<idx> should only be called within the generation callback. | ||
| 46 | |||
| 47 | If the callback returns 0 then the key genration operation is aborted and an | ||
| 48 | error occurs. This might occur during a time consuming operation where | ||
| 49 | a user clicks on a "cancel" button. | ||
| 50 | |||
| 51 | The functions EVP_PKEY_CTX_set_app_data() and EVP_PKEY_CTX_get_app_data() set | ||
| 52 | and retrieve an opaque pointer. This can be used to set some application | ||
| 53 | defined value which can be retrieved in the callback: for example a handle | ||
| 54 | which is used to update a "progress dialog". | ||
| 55 | |||
| 56 | =head1 NOTES | ||
| 57 | |||
| 58 | After the call to EVP_PKEY_keygen_init() or EVP_PKEY_paramgen_init() algorithm | ||
| 59 | specific control operations can be performed to set any appropriate parameters | ||
| 60 | for the operation. | ||
| 61 | |||
| 62 | The functions EVP_PKEY_keygen() and EVP_PKEY_paramgen() can be called more than | ||
| 63 | once on the same context if several operations are performed using the same | ||
| 64 | parameters. | ||
| 65 | |||
| 66 | The meaning of the parameters passed to the callback will depend on the | ||
| 67 | algorithm and the specifiic implementation of the algorithm. Some might not | ||
| 68 | give any useful information at all during key or parameter generation. Others | ||
| 69 | might not even call the callback. | ||
| 70 | |||
| 71 | The operation performed by key or parameter generation depends on the algorithm | ||
| 72 | used. In some cases (e.g. EC with a supplied named curve) the "generation" | ||
| 73 | option merely sets the appropriate fields in an EVP_PKEY structure. | ||
| 74 | |||
| 75 | In OpenSSL an EVP_PKEY structure containing a private key also contains the | ||
| 76 | public key components and parameters (if any). An OpenSSL private key is | ||
| 77 | equivalent to what some libraries call a "key pair". A private key can be used | ||
| 78 | in functions which require the use of a public key or parameters. | ||
| 79 | |||
| 80 | =head1 RETURN VALUES | ||
| 81 | |||
| 82 | EVP_PKEY_keygen_init(), EVP_PKEY_paramgen_init(), EVP_PKEY_keygen() and | ||
| 83 | EVP_PKEY_paramgen() return 1 for success and 0 or a negative value for failure. | ||
| 84 | In particular a return value of -2 indicates the operation is not supported by | ||
| 85 | the public key algorithm. | ||
| 86 | |||
| 87 | =head1 EXAMPLES | ||
| 88 | |||
| 89 | Generate a 2048 bit RSA key: | ||
| 90 | |||
| 91 | #include <openssl/evp.h> | ||
| 92 | #include <openssl/rsa.h> | ||
| 93 | |||
| 94 | EVP_PKEY_CTX *ctx; | ||
| 95 | EVP_PKEY *pkey = NULL; | ||
| 96 | ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL); | ||
| 97 | if (!ctx) | ||
| 98 | /* Error occurred */ | ||
| 99 | if (EVP_PKEY_keygen_init(ctx) <= 0) | ||
| 100 | /* Error */ | ||
| 101 | if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, 2048) <= 0) | ||
| 102 | /* Error */ | ||
| 103 | |||
| 104 | /* Generate key */ | ||
| 105 | if (EVP_PKEY_keygen(ctx, &pkey) <= 0) | ||
| 106 | /* Error */ | ||
| 107 | |||
| 108 | Generate a key from a set of parameters: | ||
| 109 | |||
| 110 | #include <openssl/evp.h> | ||
| 111 | #include <openssl/rsa.h> | ||
| 112 | |||
| 113 | EVP_PKEY_CTX *ctx; | ||
| 114 | EVP_PKEY *pkey = NULL, *param; | ||
| 115 | /* Assumed param is set up already */ | ||
| 116 | ctx = EVP_PKEY_CTX_new(param); | ||
| 117 | if (!ctx) | ||
| 118 | /* Error occurred */ | ||
| 119 | if (EVP_PKEY_keygen_init(ctx) <= 0) | ||
| 120 | /* Error */ | ||
| 121 | |||
| 122 | /* Generate key */ | ||
| 123 | if (EVP_PKEY_keygen(ctx, &pkey) <= 0) | ||
| 124 | /* Error */ | ||
| 125 | |||
| 126 | Example of generation callback for OpenSSL public key implementations: | ||
| 127 | |||
| 128 | /* Application data is a BIO to output status to */ | ||
| 129 | |||
| 130 | EVP_PKEY_CTX_set_app_data(ctx, status_bio); | ||
| 131 | |||
| 132 | static int genpkey_cb(EVP_PKEY_CTX *ctx) | ||
| 133 | { | ||
| 134 | char c='*'; | ||
| 135 | BIO *b = EVP_PKEY_CTX_get_app_data(ctx); | ||
| 136 | int p; | ||
| 137 | p = EVP_PKEY_CTX_get_keygen_info(ctx, 0); | ||
| 138 | if (p == 0) c='.'; | ||
| 139 | if (p == 1) c='+'; | ||
| 140 | if (p == 2) c='*'; | ||
| 141 | if (p == 3) c='\n'; | ||
| 142 | BIO_write(b,&c,1); | ||
| 143 | (void)BIO_flush(b); | ||
| 144 | return 1; | ||
| 145 | } | ||
| 146 | |||
| 147 | =head1 SEE ALSO | ||
| 148 | |||
| 149 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 150 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
| 151 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
| 152 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 153 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 154 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 155 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
| 156 | |||
| 157 | =head1 HISTORY | ||
| 158 | |||
| 159 | These functions were first added to OpenSSL 1.0.0. | ||
| 160 | |||
| 161 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_print_private.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_print_private.pod new file mode 100644 index 0000000000..ce9d70d7a7 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_print_private.pod | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_print_public, EVP_PKEY_print_private, EVP_PKEY_print_params - public key algorithm printing routines. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey, | ||
| 12 | int indent, ASN1_PCTX *pctx); | ||
| 13 | int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey, | ||
| 14 | int indent, ASN1_PCTX *pctx); | ||
| 15 | int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey, | ||
| 16 | int indent, ASN1_PCTX *pctx); | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | The functions EVP_PKEY_print_public(), EVP_PKEY_print_private() and | ||
| 21 | EVP_PKEY_print_params() print out the public, private or parameter components | ||
| 22 | of key B<pkey> respectively. The key is sent to BIO B<out> in human readable | ||
| 23 | form. The parameter B<indent> indicated how far the printout should be indented. | ||
| 24 | |||
| 25 | The B<pctx> parameter allows the print output to be finely tuned by using | ||
| 26 | ASN1 printing options. If B<pctx> is set to NULL then default values will | ||
| 27 | be used. | ||
| 28 | |||
| 29 | =head1 NOTES | ||
| 30 | |||
| 31 | Currently no public key algorithms include any options in the B<pctx> parameter | ||
| 32 | parameter. | ||
| 33 | |||
| 34 | If the key does not include all the components indicated by the function then | ||
| 35 | only those contained in the key will be printed. For example passing a public | ||
| 36 | key to EVP_PKEY_print_private() will only print the public components. | ||
| 37 | |||
| 38 | =head1 RETURN VALUES | ||
| 39 | |||
| 40 | These functions all return 1 for success and 0 or a negative value for failure. | ||
| 41 | In particular a return value of -2 indicates the operation is not supported by | ||
| 42 | the public key algorithm. | ||
| 43 | |||
| 44 | =head1 SEE ALSO | ||
| 45 | |||
| 46 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 47 | L<EVP_PKEY_keygen(3)|EVP_PKEY_keygen(3)> | ||
| 48 | |||
| 49 | =head1 HISTORY | ||
| 50 | |||
| 51 | These functions were first added to OpenSSL 1.0.0. | ||
| 52 | |||
| 53 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod new file mode 100644 index 0000000000..2fb52c3486 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_sign.pod | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_sign_init, EVP_PKEY_sign - sign using a public key algorithm | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx); | ||
| 12 | int EVP_PKEY_sign(EVP_PKEY_CTX *ctx, | ||
| 13 | unsigned char *sig, size_t *siglen, | ||
| 14 | const unsigned char *tbs, size_t tbslen); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | The EVP_PKEY_sign_init() function initializes a public key algorithm | ||
| 19 | context using key B<pkey> for a signing operation. | ||
| 20 | |||
| 21 | The EVP_PKEY_sign() function performs a public key signing operation | ||
| 22 | using B<ctx>. The data to be signed is specified using the B<tbs> and | ||
| 23 | B<tbslen> parameters. If B<sig> is B<NULL> then the maximum size of the output | ||
| 24 | buffer is written to the B<siglen> parameter. If B<sig> is not B<NULL> then | ||
| 25 | before the call the B<siglen> parameter should contain the length of the | ||
| 26 | B<sig> buffer, if the call is successful the signature is written to | ||
| 27 | B<sig> and the amount of data written to B<siglen>. | ||
| 28 | |||
| 29 | =head1 NOTES | ||
| 30 | |||
| 31 | After the call to EVP_PKEY_sign_init() algorithm specific control | ||
| 32 | operations can be performed to set any appropriate parameters for the | ||
| 33 | operation. | ||
| 34 | |||
| 35 | The function EVP_PKEY_sign() can be called more than once on the same | ||
| 36 | context if several operations are performed using the same parameters. | ||
| 37 | |||
| 38 | =head1 RETURN VALUES | ||
| 39 | |||
| 40 | EVP_PKEY_sign_init() and EVP_PKEY_sign() return 1 for success and 0 | ||
| 41 | or a negative value for failure. In particular a return value of -2 | ||
| 42 | indicates the operation is not supported by the public key algorithm. | ||
| 43 | |||
| 44 | =head1 EXAMPLE | ||
| 45 | |||
| 46 | Sign data using RSA with PKCS#1 padding and SHA256 digest: | ||
| 47 | |||
| 48 | #include <openssl/evp.h> | ||
| 49 | #include <openssl/rsa.h> | ||
| 50 | |||
| 51 | EVP_PKEY_CTX *ctx; | ||
| 52 | unsigned char *md, *sig; | ||
| 53 | size_t mdlen, siglen; | ||
| 54 | EVP_PKEY *signing_key; | ||
| 55 | /* NB: assumes signing_key, md and mdlen are already set up | ||
| 56 | * and that signing_key is an RSA private key | ||
| 57 | */ | ||
| 58 | ctx = EVP_PKEY_CTX_new(signing_key); | ||
| 59 | if (!ctx) | ||
| 60 | /* Error occurred */ | ||
| 61 | if (EVP_PKEY_sign_init(ctx) <= 0) | ||
| 62 | /* Error */ | ||
| 63 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) | ||
| 64 | /* Error */ | ||
| 65 | if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) | ||
| 66 | /* Error */ | ||
| 67 | |||
| 68 | /* Determine buffer length */ | ||
| 69 | if (EVP_PKEY_sign(ctx, NULL, &siglen, md, mdlen) <= 0) | ||
| 70 | /* Error */ | ||
| 71 | |||
| 72 | sig = OPENSSL_malloc(siglen); | ||
| 73 | |||
| 74 | if (!sig) | ||
| 75 | /* malloc failure */ | ||
| 76 | |||
| 77 | if (EVP_PKEY_sign(ctx, sig, &siglen, md, mdlen) <= 0) | ||
| 78 | /* Error */ | ||
| 79 | |||
| 80 | /* Signature is siglen bytes written to buffer sig */ | ||
| 81 | |||
| 82 | |||
| 83 | =head1 SEE ALSO | ||
| 84 | |||
| 85 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 86 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
| 87 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
| 88 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
| 89 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 90 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
| 91 | |||
| 92 | =head1 HISTORY | ||
| 93 | |||
| 94 | These functions were first added to OpenSSL 1.0.0. | ||
| 95 | |||
| 96 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_PKEY_verify.pod b/src/lib/libssl/src/doc/crypto/EVP_PKEY_verify.pod new file mode 100644 index 0000000000..10633da3f2 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/EVP_PKEY_verify.pod | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | EVP_PKEY_verify_init, EVP_PKEY_verify - signature verification using a public key algorithm | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/evp.h> | ||
| 10 | |||
| 11 | int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx); | ||
| 12 | int EVP_PKEY_verify(EVP_PKEY_CTX *ctx, | ||
| 13 | const unsigned char *sig, size_t siglen, | ||
| 14 | const unsigned char *tbs, size_t tbslen); | ||
| 15 | |||
| 16 | =head1 DESCRIPTION | ||
| 17 | |||
| 18 | The EVP_PKEY_verify_init() function initializes a public key algorithm | ||
| 19 | context using key B<pkey> for a signature verification operation. | ||
| 20 | |||
| 21 | The EVP_PKEY_verify() function performs a public key verification operation | ||
| 22 | using B<ctx>. The signature is specified using the B<sig> and | ||
| 23 | B<siglen> parameters. The verified data (i.e. the data believed originally | ||
| 24 | signed) is specified using the B<tbs> and B<tbslen> parameters. | ||
| 25 | |||
| 26 | =head1 NOTES | ||
| 27 | |||
| 28 | After the call to EVP_PKEY_verify_init() algorithm specific control | ||
| 29 | operations can be performed to set any appropriate parameters for the | ||
| 30 | operation. | ||
| 31 | |||
| 32 | The function EVP_PKEY_verify() can be called more than once on the same | ||
| 33 | context if several operations are performed using the same parameters. | ||
| 34 | |||
| 35 | =head1 RETURN VALUES | ||
| 36 | |||
| 37 | EVP_PKEY_verify_init() and EVP_PKEY_verify() return 1 if the verification was | ||
| 38 | successful and 0 if it failed. Unlike other functions the return value 0 from | ||
| 39 | EVP_PKEY_verify() only indicates that the signature did not not verify | ||
| 40 | successfully (that is tbs did not match the original data or the signature was | ||
| 41 | of invalid form) it is not an indication of a more serious error. | ||
| 42 | |||
| 43 | A negative value indicates an error other that signature verification failure. | ||
| 44 | In particular a return value of -2 indicates the operation is not supported by | ||
| 45 | the public key algorithm. | ||
| 46 | |||
| 47 | =head1 EXAMPLE | ||
| 48 | |||
| 49 | Verify signature using PKCS#1 and SHA256 digest: | ||
| 50 | |||
| 51 | #include <openssl/evp.h> | ||
| 52 | #include <openssl/rsa.h> | ||
| 53 | |||
| 54 | EVP_PKEY_CTX *ctx; | ||
| 55 | unsigned char *md, *sig; | ||
| 56 | size_t mdlen, siglen; | ||
| 57 | EVP_PKEY *verify_key; | ||
| 58 | /* NB: assumes verify_key, sig, siglen md and mdlen are already set up | ||
| 59 | * and that verify_key is an RSA public key | ||
| 60 | */ | ||
| 61 | ctx = EVP_PKEY_CTX_new(verify_key); | ||
| 62 | if (!ctx) | ||
| 63 | /* Error occurred */ | ||
| 64 | if (EVP_PKEY_verify_init(ctx) <= 0) | ||
| 65 | /* Error */ | ||
| 66 | if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0) | ||
| 67 | /* Error */ | ||
| 68 | if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) | ||
| 69 | /* Error */ | ||
| 70 | |||
| 71 | /* Perform operation */ | ||
| 72 | ret = EVP_PKEY_verify(ctx, md, mdlen, sig, siglen); | ||
| 73 | |||
| 74 | /* ret == 1 indicates success, 0 verify failure and < 0 for some | ||
| 75 | * other error. | ||
| 76 | */ | ||
| 77 | |||
| 78 | =head1 SEE ALSO | ||
| 79 | |||
| 80 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
| 81 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
| 82 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
| 83 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
| 84 | L<EVP_PKEY_verifyrecover(3)|EVP_PKEY_verifyrecover(3)>, | ||
| 85 | L<EVP_PKEY_derive(3)|EVP_PKEY_derive(3)> | ||
| 86 | |||
| 87 | =head1 HISTORY | ||
| 88 | |||
| 89 | These functions were first added to OpenSSL 1.0.0. | ||
| 90 | |||
| 91 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/PEM_write_bio_CMS_stream.pod b/src/lib/libssl/src/doc/crypto/PEM_write_bio_CMS_stream.pod new file mode 100644 index 0000000000..e070c45c2e --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/PEM_write_bio_CMS_stream.pod | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | PEM_write_bio_CMS_stream - output CMS_ContentInfo structure in PEM format. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | #include <openssl/pem.h> | ||
| 11 | |||
| 12 | int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags); | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | PEM_write_bio_CMS_stream() outputs a CMS_ContentInfo structure in PEM format. | ||
| 17 | |||
| 18 | It is otherwise identical to the function SMIME_write_CMS(). | ||
| 19 | |||
| 20 | =head1 NOTES | ||
| 21 | |||
| 22 | This function is effectively a version of the PEM_write_bio_CMS() supporting | ||
| 23 | streaming. | ||
| 24 | |||
| 25 | =head1 RETURN VALUES | ||
| 26 | |||
| 27 | PEM_write_bio_CMS_stream() returns 1 for success or 0 for failure. | ||
| 28 | |||
| 29 | =head1 SEE ALSO | ||
| 30 | |||
| 31 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 32 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 33 | L<CMS_decrypt(3)|CMS_decrypt(3)>, | ||
| 34 | L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>, | ||
| 35 | L<i2d_CMS_bio_stream(3)|i2d_CMS_bio_stream(3)> | ||
| 36 | |||
| 37 | =head1 HISTORY | ||
| 38 | |||
| 39 | PEM_write_bio_CMS_stream() was added to OpenSSL 1.0.0 | ||
| 40 | |||
| 41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/PEM_write_bio_PKCS7_stream.pod b/src/lib/libssl/src/doc/crypto/PEM_write_bio_PKCS7_stream.pod new file mode 100644 index 0000000000..16fc9b6845 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/PEM_write_bio_PKCS7_stream.pod | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | PEM_write_bio_PKCS7_stream - output PKCS7 structure in PEM format. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/pkcs7.h> | ||
| 10 | #include <openssl/pem.h> | ||
| 11 | |||
| 12 | int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *data, int flags); | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | PEM_write_bio_PKCS7_stream() outputs a PKCS7 structure in PEM format. | ||
| 17 | |||
| 18 | It is otherwise identical to the function SMIME_write_PKCS7(). | ||
| 19 | |||
| 20 | =head1 NOTES | ||
| 21 | |||
| 22 | This function is effectively a version of the PEM_write_bio_PKCS7() supporting | ||
| 23 | streaming. | ||
| 24 | |||
| 25 | =head1 RETURN VALUES | ||
| 26 | |||
| 27 | PEM_write_bio_PKCS7_stream() returns 1 for success or 0 for failure. | ||
| 28 | |||
| 29 | =head1 SEE ALSO | ||
| 30 | |||
| 31 | L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, | ||
| 32 | L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)> | ||
| 33 | L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>, | ||
| 34 | L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>, | ||
| 35 | L<i2d_PKCS7_bio_stream(3)|i2d_PKCS7_bio_stream(3)> | ||
| 36 | |||
| 37 | =head1 HISTORY | ||
| 38 | |||
| 39 | PEM_write_bio_PKCS7_stream() was added to OpenSSL 1.0.0 | ||
| 40 | |||
| 41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/PKCS7_sign_add_signer.pod b/src/lib/libssl/src/doc/crypto/PKCS7_sign_add_signer.pod new file mode 100644 index 0000000000..ebec4d57de --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/PKCS7_sign_add_signer.pod | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | PKCS7_sign_add_signer - add a signer PKCS7 signed data structure. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/pkcs7.h> | ||
| 10 | |||
| 11 | PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7, X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md, int flags); | ||
| 12 | |||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | PKCS7_sign_add_signer() adds a signer with certificate B<signcert> and private | ||
| 17 | key B<pkey> using message digest B<md> to a PKCS7 signed data structure | ||
| 18 | B<p7>. | ||
| 19 | |||
| 20 | The PKCS7 structure should be obtained from an initial call to PKCS7_sign() | ||
| 21 | with the flag B<PKCS7_PARTIAL> set or in the case or re-signing a valid PKCS7 | ||
| 22 | signed data structure. | ||
| 23 | |||
| 24 | If the B<md> parameter is B<NULL> then the default digest for the public | ||
| 25 | key algorithm will be used. | ||
| 26 | |||
| 27 | Unless the B<PKCS7_REUSE_DIGEST> flag is set the returned PKCS7 structure | ||
| 28 | is not complete and must be finalized either by streaming (if applicable) or | ||
| 29 | a call to PKCS7_final(). | ||
| 30 | |||
| 31 | |||
| 32 | =head1 NOTES | ||
| 33 | |||
| 34 | The main purpose of this function is to provide finer control over a PKCS#7 | ||
| 35 | signed data structure where the simpler PKCS7_sign() function defaults are | ||
| 36 | not appropriate. For example if multiple signers or non default digest | ||
| 37 | algorithms are needed. | ||
| 38 | |||
| 39 | Any of the following flags (ored together) can be passed in the B<flags> | ||
| 40 | parameter. | ||
| 41 | |||
| 42 | If B<PKCS7_REUSE_DIGEST> is set then an attempt is made to copy the content | ||
| 43 | digest value from the PKCS7 struture: to add a signer to an existing structure. | ||
| 44 | An error occurs if a matching digest value cannot be found to copy. The | ||
| 45 | returned PKCS7 structure will be valid and finalized when this flag is set. | ||
| 46 | |||
| 47 | If B<PKCS7_PARTIAL> is set in addition to B<PKCS7_REUSE_DIGEST> then the | ||
| 48 | B<PKCS7_SIGNER_INO> structure will not be finalized so additional attributes | ||
| 49 | can be added. In this case an explicit call to PKCS7_SIGNER_INFO_sign() is | ||
| 50 | needed to finalize it. | ||
| 51 | |||
| 52 | If B<PKCS7_NOCERTS> is set the signer's certificate will not be included in the | ||
| 53 | PKCS7 structure, the signer's certificate must still be supplied in the | ||
| 54 | B<signcert> parameter though. This can reduce the size of the signature if the | ||
| 55 | signers certificate can be obtained by other means: for example a previously | ||
| 56 | signed message. | ||
| 57 | |||
| 58 | The signedData structure includes several PKCS#7 autenticatedAttributes | ||
| 59 | including the signing time, the PKCS#7 content type and the supported list of | ||
| 60 | ciphers in an SMIMECapabilities attribute. If B<PKCS7_NOATTR> is set then no | ||
| 61 | authenticatedAttributes will be used. If B<PKCS7_NOSMIMECAP> is set then just | ||
| 62 | the SMIMECapabilities are omitted. | ||
| 63 | |||
| 64 | If present the SMIMECapabilities attribute indicates support for the following | ||
| 65 | algorithms: triple DES, 128 bit RC2, 64 bit RC2, DES and 40 bit RC2. If any of | ||
| 66 | these algorithms is disabled then it will not be included. | ||
| 67 | |||
| 68 | |||
| 69 | PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO | ||
| 70 | structure just added, this can be used to set additional attributes | ||
| 71 | before it is finalized. | ||
| 72 | |||
| 73 | =head1 RETURN VALUES | ||
| 74 | |||
| 75 | PKCS7_sign_add_signers() returns an internal pointer to the PKCS7_SIGNER_INFO | ||
| 76 | structure just added or NULL if an error occurs. | ||
| 77 | |||
| 78 | =head1 SEE ALSO | ||
| 79 | |||
| 80 | L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, | ||
| 81 | L<PKCS7_final(3)|PKCS7_final(3)>, | ||
| 82 | |||
| 83 | =head1 HISTORY | ||
| 84 | |||
| 85 | PPKCS7_sign_add_signer() was added to OpenSSL 1.0.0 | ||
| 86 | |||
| 87 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/SMIME_read_CMS.pod b/src/lib/libssl/src/doc/crypto/SMIME_read_CMS.pod new file mode 100644 index 0000000000..acc5524c14 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/SMIME_read_CMS.pod | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | SMIME_read_CMS - parse S/MIME message. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | CMS_ContentInfo *SMIME_read_CMS(BIO *in, BIO **bcont); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | SMIME_read_CMS() parses a message in S/MIME format. | ||
| 16 | |||
| 17 | B<in> is a BIO to read the message from. | ||
| 18 | |||
| 19 | If cleartext signing is used then the content is saved in a memory bio which is | ||
| 20 | written to B<*bcont>, otherwise B<*bcont> is set to NULL. | ||
| 21 | |||
| 22 | The parsed CMS_ContentInfo structure is returned or NULL if an | ||
| 23 | error occurred. | ||
| 24 | |||
| 25 | =head1 NOTES | ||
| 26 | |||
| 27 | If B<*bcont> is not NULL then the message is clear text signed. B<*bcont> can | ||
| 28 | then be passed to CMS_verify() with the B<CMS_DETACHED> flag set. | ||
| 29 | |||
| 30 | Otherwise the type of the returned structure can be determined | ||
| 31 | using CMS_get0_type(). | ||
| 32 | |||
| 33 | To support future functionality if B<bcont> is not NULL B<*bcont> should be | ||
| 34 | initialized to NULL. For example: | ||
| 35 | |||
| 36 | BIO *cont = NULL; | ||
| 37 | CMS_ContentInfo *cms; | ||
| 38 | |||
| 39 | cms = SMIME_read_CMS(in, &cont); | ||
| 40 | |||
| 41 | =head1 BUGS | ||
| 42 | |||
| 43 | The MIME parser used by SMIME_read_CMS() is somewhat primitive. While it will | ||
| 44 | handle most S/MIME messages more complex compound formats may not work. | ||
| 45 | |||
| 46 | The parser assumes that the CMS_ContentInfo structure is always base64 encoded | ||
| 47 | and will not handle the case where it is in binary format or uses quoted | ||
| 48 | printable format. | ||
| 49 | |||
| 50 | The use of a memory BIO to hold the signed content limits the size of message | ||
| 51 | which can be processed due to memory restraints: a streaming single pass option | ||
| 52 | should be available. | ||
| 53 | |||
| 54 | =head1 RETURN VALUES | ||
| 55 | |||
| 56 | SMIME_read_CMS() returns a valid B<CMS_ContentInfo> structure or B<NULL> | ||
| 57 | if an error occurred. The error can be obtained from ERR_get_error(3). | ||
| 58 | |||
| 59 | =head1 SEE ALSO | ||
| 60 | |||
| 61 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_type(3)|CMS_type(3)> | ||
| 62 | L<SMIME_read_CMS(3)|SMIME_read_CMS(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 63 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 64 | L<CMS_decrypt(3)|CMS_decrypt(3)> | ||
| 65 | |||
| 66 | =head1 HISTORY | ||
| 67 | |||
| 68 | SMIME_read_CMS() was added to OpenSSL 0.9.8 | ||
| 69 | |||
| 70 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/SMIME_write_CMS.pod b/src/lib/libssl/src/doc/crypto/SMIME_write_CMS.pod new file mode 100644 index 0000000000..04bedfb429 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/SMIME_write_CMS.pod | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | SMIME_write_CMS - convert CMS structure to S/MIME format. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int SMIME_write_CMS(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | SMIME_write_CMS() adds the appropriate MIME headers to a CMS | ||
| 16 | structure to produce an S/MIME message. | ||
| 17 | |||
| 18 | B<out> is the BIO to write the data to. B<cms> is the appropriate | ||
| 19 | B<CMS_ContentInfo> structure. If streaming is enabled then the content must be | ||
| 20 | supplied in the B<data> argument. B<flags> is an optional set of flags. | ||
| 21 | |||
| 22 | =head1 NOTES | ||
| 23 | |||
| 24 | The following flags can be passed in the B<flags> parameter. | ||
| 25 | |||
| 26 | If B<CMS_DETACHED> is set then cleartext signing will be used, this option only | ||
| 27 | makes sense for SignedData where B<CMS_DETACHED> is also set when CMS_sign() is | ||
| 28 | called. | ||
| 29 | |||
| 30 | If the B<CMS_TEXT> flag is set MIME headers for type B<text/plain> are added to | ||
| 31 | the content, this only makes sense if B<CMS_DETACHED> is also set. | ||
| 32 | |||
| 33 | If the B<CMS_STREAM> flag is set streaming is performed. This flag should only | ||
| 34 | be set if B<CMS_STREAM> was also set in the previous call to a CMS_ContentInfo | ||
| 35 | creation function. | ||
| 36 | |||
| 37 | If cleartext signing is being used and B<CMS_STREAM> not set then the data must | ||
| 38 | be read twice: once to compute the signature in CMS_sign() and once to output | ||
| 39 | the S/MIME message. | ||
| 40 | |||
| 41 | If streaming is performed the content is output in BER format using indefinite | ||
| 42 | length constructed encoding except in the case of signed data with detached | ||
| 43 | content where the content is absent and DER format is used. | ||
| 44 | |||
| 45 | =head1 BUGS | ||
| 46 | |||
| 47 | SMIME_write_CMS() always base64 encodes CMS structures, there should be an | ||
| 48 | option to disable this. | ||
| 49 | |||
| 50 | =head1 RETURN VALUES | ||
| 51 | |||
| 52 | SMIME_write_CMS() returns 1 for success or 0 for failure. | ||
| 53 | |||
| 54 | =head1 SEE ALSO | ||
| 55 | |||
| 56 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 57 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 58 | L<CMS_decrypt(3)|CMS_decrypt(3)> | ||
| 59 | |||
| 60 | =head1 HISTORY | ||
| 61 | |||
| 62 | SMIME_write_CMS() was added to OpenSSL 0.9.8 | ||
| 63 | |||
| 64 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_error.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_error.pod new file mode 100644 index 0000000000..a883f6c097 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_error.pod | |||
| @@ -0,0 +1,303 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | X509_STORE_CTX_get_error, X509_STORE_CTX_set_error, X509_STORE_CTX_get_error_depth, X509_STORE_CTX_get_current_cert, X509_STORE_CTX_get1_chain, X509_verify_cert_error_string - get or set certificate verification status information | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509.h> | ||
| 10 | #include <openssl/x509_vfy.h> | ||
| 11 | |||
| 12 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); | ||
| 13 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); | ||
| 14 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); | ||
| 15 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); | ||
| 16 | |||
| 17 | STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); | ||
| 18 | |||
| 19 | const char *X509_verify_cert_error_string(long n); | ||
| 20 | |||
| 21 | =head1 DESCRIPTION | ||
| 22 | |||
| 23 | These functions are typically called after X509_verify_cert() has indicated | ||
| 24 | an error or in a verification callback to determine the nature of an error. | ||
| 25 | |||
| 26 | X509_STORE_CTX_get_error() returns the error code of B<ctx>, see | ||
| 27 | the B<ERROR CODES> section for a full description of all error codes. | ||
| 28 | |||
| 29 | X509_STORE_CTX_set_error() sets the error code of B<ctx> to B<s>. For example | ||
| 30 | it might be used in a verification callback to set an error based on additional | ||
| 31 | checks. | ||
| 32 | |||
| 33 | X509_STORE_CTX_get_error_depth() returns the B<depth> of the error. This is a | ||
| 34 | non-negative integer representing where in the certificate chain the error | ||
| 35 | occurred. If it is zero it occured in the end entity certificate, one if | ||
| 36 | it is the certificate which signed the end entity certificate and so on. | ||
| 37 | |||
| 38 | X509_STORE_CTX_get_current_cert() returns the certificate in B<ctx> which | ||
| 39 | caused the error or B<NULL> if no certificate is relevant. | ||
| 40 | |||
| 41 | X509_STORE_CTX_get1_chain() returns a complete validate chain if a previous | ||
| 42 | call to X509_verify_cert() is successful. If the call to X509_verify_cert() | ||
| 43 | is B<not> successful the returned chain may be incomplete or invalid. The | ||
| 44 | returned chain persists after the B<ctx> structure is freed, when it is | ||
| 45 | no longer needed it should be free up using: | ||
| 46 | |||
| 47 | sk_X509_pop_free(chain, X509_free); | ||
| 48 | |||
| 49 | X509_verify_cert_error_string() returns a human readable error string for | ||
| 50 | verification error B<n>. | ||
| 51 | |||
| 52 | =head1 RETURN VALUES | ||
| 53 | |||
| 54 | X509_STORE_CTX_get_error() returns B<X509_V_OK> or an error code. | ||
| 55 | |||
| 56 | X509_STORE_CTX_get_error_depth() returns a non-negative error depth. | ||
| 57 | |||
| 58 | X509_STORE_CTX_get_current_cert() returns the cerificate which caused the | ||
| 59 | error or B<NULL> if no certificate is relevant to the error. | ||
| 60 | |||
| 61 | X509_verify_cert_error_string() returns a human readable error string for | ||
| 62 | verification error B<n>. | ||
| 63 | |||
| 64 | =head1 ERROR CODES | ||
| 65 | |||
| 66 | A list of error codes and messages is shown below. Some of the | ||
| 67 | error codes are defined but currently never returned: these are described as | ||
| 68 | "unused". | ||
| 69 | |||
| 70 | =over 4 | ||
| 71 | |||
| 72 | =item B<X509_V_OK: ok> | ||
| 73 | |||
| 74 | the operation was successful. | ||
| 75 | |||
| 76 | =item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: unable to get issuer certificate> | ||
| 77 | |||
| 78 | the issuer certificate could not be found: this occurs if the issuer certificate | ||
| 79 | of an untrusted certificate cannot be found. | ||
| 80 | |||
| 81 | =item B<X509_V_ERR_UNABLE_TO_GET_CRL: unable to get certificate CRL> | ||
| 82 | |||
| 83 | the CRL of a certificate could not be found. | ||
| 84 | |||
| 85 | =item B<X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE: unable to decrypt certificate's signature> | ||
| 86 | |||
| 87 | the certificate signature could not be decrypted. This means that the actual | ||
| 88 | signature value could not be determined rather than it not matching the | ||
| 89 | expected value, this is only meaningful for RSA keys. | ||
| 90 | |||
| 91 | =item B<X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE: unable to decrypt CRL's signature> | ||
| 92 | |||
| 93 | the CRL signature could not be decrypted: this means that the actual signature | ||
| 94 | value could not be determined rather than it not matching the expected value. | ||
| 95 | Unused. | ||
| 96 | |||
| 97 | =item B<X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY: unable to decode issuer public key> | ||
| 98 | |||
| 99 | the public key in the certificate SubjectPublicKeyInfo could not be read. | ||
| 100 | |||
| 101 | =item B<X509_V_ERR_CERT_SIGNATURE_FAILURE: certificate signature failure> | ||
| 102 | |||
| 103 | the signature of the certificate is invalid. | ||
| 104 | |||
| 105 | =item B<X509_V_ERR_CRL_SIGNATURE_FAILURE: CRL signature failure> | ||
| 106 | |||
| 107 | the signature of the certificate is invalid. | ||
| 108 | |||
| 109 | =item B<X509_V_ERR_CERT_NOT_YET_VALID: certificate is not yet valid> | ||
| 110 | |||
| 111 | the certificate is not yet valid: the notBefore date is after the current time. | ||
| 112 | |||
| 113 | =item B<X509_V_ERR_CERT_HAS_EXPIRED: certificate has expired> | ||
| 114 | |||
| 115 | the certificate has expired: that is the notAfter date is before the current time. | ||
| 116 | |||
| 117 | =item B<X509_V_ERR_CRL_NOT_YET_VALID: CRL is not yet valid> | ||
| 118 | |||
| 119 | the CRL is not yet valid. | ||
| 120 | |||
| 121 | =item B<X509_V_ERR_CRL_HAS_EXPIRED: CRL has expired> | ||
| 122 | |||
| 123 | the CRL has expired. | ||
| 124 | |||
| 125 | =item B<X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: format error in certificate's notBefore field> | ||
| 126 | |||
| 127 | the certificate notBefore field contains an invalid time. | ||
| 128 | |||
| 129 | =item B<X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: format error in certificate's notAfter field> | ||
| 130 | |||
| 131 | the certificate notAfter field contains an invalid time. | ||
| 132 | |||
| 133 | =item B<X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD: format error in CRL's lastUpdate field> | ||
| 134 | |||
| 135 | the CRL lastUpdate field contains an invalid time. | ||
| 136 | |||
| 137 | =item B<X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD: format error in CRL's nextUpdate field> | ||
| 138 | |||
| 139 | the CRL nextUpdate field contains an invalid time. | ||
| 140 | |||
| 141 | =item B<X509_V_ERR_OUT_OF_MEM: out of memory> | ||
| 142 | |||
| 143 | an error occurred trying to allocate memory. This should never happen. | ||
| 144 | |||
| 145 | =item B<X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT: self signed certificate> | ||
| 146 | |||
| 147 | the passed certificate is self signed and the same certificate cannot be found | ||
| 148 | in the list of trusted certificates. | ||
| 149 | |||
| 150 | =item B<X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN: self signed certificate in certificate chain> | ||
| 151 | |||
| 152 | the certificate chain could be built up using the untrusted certificates but | ||
| 153 | the root could not be found locally. | ||
| 154 | |||
| 155 | =item B<X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY: unable to get local issuer certificate> | ||
| 156 | |||
| 157 | the issuer certificate of a locally looked up certificate could not be found. | ||
| 158 | This normally means the list of trusted certificates is not complete. | ||
| 159 | |||
| 160 | =item B<X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE: unable to verify the first certificate> | ||
| 161 | |||
| 162 | no signatures could be verified because the chain contains only one certificate | ||
| 163 | and it is not self signed. | ||
| 164 | |||
| 165 | =item B<X509_V_ERR_CERT_CHAIN_TOO_LONG: certificate chain too long> | ||
| 166 | |||
| 167 | the certificate chain length is greater than the supplied maximum depth. Unused. | ||
| 168 | |||
| 169 | =item B<X509_V_ERR_CERT_REVOKED: certificate revoked> | ||
| 170 | |||
| 171 | the certificate has been revoked. | ||
| 172 | |||
| 173 | =item B<X509_V_ERR_INVALID_CA: invalid CA certificate> | ||
| 174 | |||
| 175 | a CA certificate is invalid. Either it is not a CA or its extensions are not | ||
| 176 | consistent with the supplied purpose. | ||
| 177 | |||
| 178 | =item B<X509_V_ERR_PATH_LENGTH_EXCEEDED: path length constraint exceeded> | ||
| 179 | |||
| 180 | the basicConstraints pathlength parameter has been exceeded. | ||
| 181 | |||
| 182 | =item B<X509_V_ERR_INVALID_PURPOSE: unsupported certificate purpose> | ||
| 183 | |||
| 184 | the supplied certificate cannot be used for the specified purpose. | ||
| 185 | |||
| 186 | =item B<X509_V_ERR_CERT_UNTRUSTED: certificate not trusted> | ||
| 187 | |||
| 188 | the root CA is not marked as trusted for the specified purpose. | ||
| 189 | |||
| 190 | =item B<X509_V_ERR_CERT_REJECTED: certificate rejected> | ||
| 191 | |||
| 192 | the root CA is marked to reject the specified purpose. | ||
| 193 | |||
| 194 | =item B<X509_V_ERR_SUBJECT_ISSUER_MISMATCH: subject issuer mismatch> | ||
| 195 | |||
| 196 | the current candidate issuer certificate was rejected because its subject name | ||
| 197 | did not match the issuer name of the current certificate. This is only set | ||
| 198 | if issuer check debugging is enabled it is used for status notification and | ||
| 199 | is B<not> in itself an error. | ||
| 200 | |||
| 201 | =item B<X509_V_ERR_AKID_SKID_MISMATCH: authority and subject key identifier mismatch> | ||
| 202 | |||
| 203 | the current candidate issuer certificate was rejected because its subject key | ||
| 204 | identifier was present and did not match the authority key identifier current | ||
| 205 | certificate. This is only set if issuer check debugging is enabled it is used | ||
| 206 | for status notification and is B<not> in itself an error. | ||
| 207 | |||
| 208 | =item B<X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH: authority and issuer serial number mismatch> | ||
| 209 | |||
| 210 | the current candidate issuer certificate was rejected because its issuer name | ||
| 211 | and serial number was present and did not match the authority key identifier of | ||
| 212 | the current certificate. This is only set if issuer check debugging is enabled | ||
| 213 | it is used for status notification and is B<not> in itself an error. | ||
| 214 | |||
| 215 | =item B<X509_V_ERR_KEYUSAGE_NO_CERTSIGN:key usage does not include certificate signing> | ||
| 216 | |||
| 217 | the current candidate issuer certificate was rejected because its keyUsage | ||
| 218 | extension does not permit certificate signing. This is only set if issuer check | ||
| 219 | debugging is enabled it is used for status notification and is B<not> in itself | ||
| 220 | an error. | ||
| 221 | |||
| 222 | =item B<X509_V_ERR_INVALID_EXTENSION: invalid or inconsistent certificate extension> | ||
| 223 | |||
| 224 | A certificate extension had an invalid value (for example an incorrect | ||
| 225 | encoding) or some value inconsistent with other extensions. | ||
| 226 | |||
| 227 | |||
| 228 | =item B<X509_V_ERR_INVALID_POLICY_EXTENSION: invalid or inconsistent certificate policy extension> | ||
| 229 | |||
| 230 | A certificate policies extension had an invalid value (for example an incorrect | ||
| 231 | encoding) or some value inconsistent with other extensions. This error only | ||
| 232 | occurs if policy processing is enabled. | ||
| 233 | |||
| 234 | =item B<X509_V_ERR_NO_EXPLICIT_POLICY: no explicit policy> | ||
| 235 | |||
| 236 | The verification flags were set to require and explicit policy but none was | ||
| 237 | present. | ||
| 238 | |||
| 239 | =item B<X509_V_ERR_DIFFERENT_CRL_SCOPE: Different CRL scope> | ||
| 240 | |||
| 241 | The only CRLs that could be found did not match the scope of the certificate. | ||
| 242 | |||
| 243 | =item B<X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE: Unsupported extension feature> | ||
| 244 | |||
| 245 | Some feature of a certificate extension is not supported. Unused. | ||
| 246 | |||
| 247 | =item B<X509_V_ERR_PERMITTED_VIOLATION: permitted subtree violation> | ||
| 248 | |||
| 249 | A name constraint violation occured in the permitted subtrees. | ||
| 250 | |||
| 251 | =item B<X509_V_ERR_EXCLUDED_VIOLATION: excluded subtree violation> | ||
| 252 | |||
| 253 | A name constraint violation occured in the excluded subtrees. | ||
| 254 | |||
| 255 | =item B<X509_V_ERR_SUBTREE_MINMAX: name constraints minimum and maximum not supported> | ||
| 256 | |||
| 257 | A certificate name constraints extension included a minimum or maximum field: | ||
| 258 | this is not supported. | ||
| 259 | |||
| 260 | =item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE: unsupported name constraint type> | ||
| 261 | |||
| 262 | An unsupported name constraint type was encountered. OpenSSL currently only | ||
| 263 | supports directory name, DNS name, email and URI types. | ||
| 264 | |||
| 265 | =item B<X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX: unsupported or invalid name constraint syntax> | ||
| 266 | |||
| 267 | The format of the name constraint is not recognised: for example an email | ||
| 268 | address format of a form not mentioned in RFC3280. This could be caused by | ||
| 269 | a garbage extension or some new feature not currently supported. | ||
| 270 | |||
| 271 | =item B<X509_V_ERR_CRL_PATH_VALIDATION_ERROR: CRL path validation error> | ||
| 272 | |||
| 273 | An error occured when attempting to verify the CRL path. This error can only | ||
| 274 | happen if extended CRL checking is enabled. | ||
| 275 | |||
| 276 | =item B<X509_V_ERR_APPLICATION_VERIFICATION: application verification failure> | ||
| 277 | |||
| 278 | an application specific error. This will never be returned unless explicitly | ||
| 279 | set by an application. | ||
| 280 | |||
| 281 | =head1 NOTES | ||
| 282 | |||
| 283 | The above functions should be used instead of directly referencing the fields | ||
| 284 | in the B<X509_VERIFY_CTX> structure. | ||
| 285 | |||
| 286 | In versions of OpenSSL before 1.0 the current certificate returned by | ||
| 287 | X509_STORE_CTX_get_current_cert() was never B<NULL>. Applications should | ||
| 288 | check the return value before printing out any debugging information relating | ||
| 289 | to the current certificate. | ||
| 290 | |||
| 291 | If an unrecognised error code is passed to X509_verify_cert_error_string() the | ||
| 292 | numerical value of the unknown code is returned in a static buffer. This is not | ||
| 293 | thread safe but will never happen unless an invalid code is passed. | ||
| 294 | |||
| 295 | =head1 SEE ALSO | ||
| 296 | |||
| 297 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
| 298 | |||
| 299 | =head1 HISTORY | ||
| 300 | |||
| 301 | TBA | ||
| 302 | |||
| 303 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod new file mode 100644 index 0000000000..8d6b9dda47 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_get_ex_new_index.pod | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | X509_STORE_CTX_get_ex_new_index, X509_STORE_CTX_set_ex_data, X509_STORE_CTX_get_ex_data - add application specific data to X509_STORE_CTX structures | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509_vfy.h> | ||
| 10 | |||
| 11 | int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, | ||
| 12 | CRYPTO_EX_new *new_func, | ||
| 13 | CRYPTO_EX_dup *dup_func, | ||
| 14 | CRYPTO_EX_free *free_func); | ||
| 15 | |||
| 16 | int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg); | ||
| 17 | |||
| 18 | char *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx); | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | These functions handle application specific data in X509_STORE_CTX structures. | ||
| 23 | Their usage is identical to that of RSA_get_ex_new_index(), RSA_set_ex_data() | ||
| 24 | and RSA_get_ex_data() as described in L<RSA_get_ex_new_index(3)>. | ||
| 25 | |||
| 26 | =head1 NOTES | ||
| 27 | |||
| 28 | This mechanism is used internally by the B<ssl> library to store the B<SSL> | ||
| 29 | structure associated with a verification operation in an B<X509_STORE_CTX> | ||
| 30 | structure. | ||
| 31 | |||
| 32 | =head1 SEE ALSO | ||
| 33 | |||
| 34 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)> | ||
| 35 | |||
| 36 | =head1 HISTORY | ||
| 37 | |||
| 38 | X509_STORE_CTX_get_ex_new_index(), X509_STORE_CTX_set_ex_data() and | ||
| 39 | X509_STORE_CTX_get_ex_data() are available since OpenSSL 0.9.5. | ||
| 40 | |||
| 41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_new.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_new.pod new file mode 100644 index 0000000000..b17888f149 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_new.pod | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | X509_STORE_CTX_new, X509_STORE_CTX_cleanup, X509_STORE_CTX_free, X509_STORE_CTX_init, X509_STORE_CTX_trusted_stack, X509_STORE_CTX_set_cert, X509_STORE_CTX_set_chain, X509_STORE_CTX_set0_crls, X509_STORE_CTX_get0_param, X509_STORE_CTX_set0_param, X509_STORE_CTX_set_default - X509_STORE_CTX initialisation | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509_vfy.h> | ||
| 10 | |||
| 11 | X509_STORE_CTX *X509_STORE_CTX_new(void); | ||
| 12 | void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); | ||
| 13 | void X509_STORE_CTX_free(X509_STORE_CTX *ctx); | ||
| 14 | |||
| 15 | int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, | ||
| 16 | X509 *x509, STACK_OF(X509) *chain); | ||
| 17 | |||
| 18 | void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); | ||
| 19 | |||
| 20 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx,X509 *x); | ||
| 21 | void X509_STORE_CTX_set_chain(X509_STORE_CTX *ctx,STACK_OF(X509) *sk); | ||
| 22 | void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk); | ||
| 23 | |||
| 24 | X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); | ||
| 25 | void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); | ||
| 26 | int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); | ||
| 27 | |||
| 28 | =head1 DESCRIPTION | ||
| 29 | |||
| 30 | These functions initialise an B<X509_STORE_CTX> structure for subsequent use | ||
| 31 | by X509_verify_cert(). | ||
| 32 | |||
| 33 | X509_STORE_CTX_new() returns a newly initialised B<X509_STORE_CTX> structure. | ||
| 34 | |||
| 35 | X509_STORE_CTX_cleanup() internally cleans up an B<X509_STORE_CTX> structure. | ||
| 36 | The context can then be reused with an new call to X509_STORE_CTX_init(). | ||
| 37 | |||
| 38 | X509_STORE_CTX_free() completely frees up B<ctx>. After this call B<ctx> | ||
| 39 | is no longer valid. | ||
| 40 | |||
| 41 | X509_STORE_CTX_init() sets up B<ctx> for a subsequent verification operation. | ||
| 42 | The trusted certificate store is set to B<store>, the end entity certificate | ||
| 43 | to be verified is set to B<x509> and a set of additional certificates (which | ||
| 44 | will be untrusted but may be used to build the chain) in B<chain>. Any or | ||
| 45 | all of the B<store>, B<x509> and B<chain> parameters can be B<NULL>. | ||
| 46 | |||
| 47 | X509_STORE_CTX_trusted_stack() sets the set of trusted certificates of B<ctx> | ||
| 48 | to B<sk>. This is an alternative way of specifying trusted certificates | ||
| 49 | instead of using an B<X509_STORE>. | ||
| 50 | |||
| 51 | X509_STORE_CTX_set_cert() sets the certificate to be vertified in B<ctx> to | ||
| 52 | B<x>. | ||
| 53 | |||
| 54 | X509_STORE_CTX_set_chain() sets the additional certificate chain used by B<ctx> | ||
| 55 | to B<sk>. | ||
| 56 | |||
| 57 | X509_STORE_CTX_set0_crls() sets a set of CRLs to use to aid certificate | ||
| 58 | verification to B<sk>. These CRLs will only be used if CRL verification is | ||
| 59 | enabled in the associated B<X509_VERIFY_PARAM> structure. This might be | ||
| 60 | used where additional "useful" CRLs are supplied as part of a protocol, | ||
| 61 | for example in a PKCS#7 structure. | ||
| 62 | |||
| 63 | X509_VERIFY_PARAM *X509_STORE_CTX_get0_param() retrieves an intenal pointer | ||
| 64 | to the verification parameters associated with B<ctx>. | ||
| 65 | |||
| 66 | X509_STORE_CTX_set0_param() sets the intenal verification parameter pointer | ||
| 67 | to B<param>. After this call B<param> should not be used. | ||
| 68 | |||
| 69 | X509_STORE_CTX_set_default() looks up and sets the default verification | ||
| 70 | method to B<name>. This uses the function X509_VERIFY_PARAM_lookup() to | ||
| 71 | find an appropriate set of parameters from B<name>. | ||
| 72 | |||
| 73 | =head1 NOTES | ||
| 74 | |||
| 75 | The certificates and CRLs in a store are used internally and should B<not> | ||
| 76 | be freed up until after the associated B<X509_STORE_CTX> is freed. Legacy | ||
| 77 | applications might implicitly use an B<X509_STORE_CTX> like this: | ||
| 78 | |||
| 79 | X509_STORE_CTX ctx; | ||
| 80 | X509_STORE_CTX_init(&ctx, store, cert, chain); | ||
| 81 | |||
| 82 | this is B<not> recommended in new applications they should instead do: | ||
| 83 | |||
| 84 | X509_STORE_CTX *ctx; | ||
| 85 | ctx = X509_STORE_CTX_new(); | ||
| 86 | if (ctx == NULL) | ||
| 87 | /* Bad error */ | ||
| 88 | X509_STORE_CTX_init(ctx, store, cert, chain); | ||
| 89 | |||
| 90 | =head1 BUGS | ||
| 91 | |||
| 92 | The certificates and CRLs in a context are used internally and should B<not> | ||
| 93 | be freed up until after the associated B<X509_STORE_CTX> is freed. Copies | ||
| 94 | should be made or reference counts increased instead. | ||
| 95 | |||
| 96 | =head1 RETURN VALUES | ||
| 97 | |||
| 98 | X509_STORE_CTX_new() returns an newly allocates context or B<NULL> is an | ||
| 99 | error occurred. | ||
| 100 | |||
| 101 | X509_STORE_CTX_init() returns 1 for success or 0 if an error occurred. | ||
| 102 | |||
| 103 | X509_STORE_CTX_get0_param() returns a pointer to an B<X509_VERIFY_PARAM> | ||
| 104 | structure or B<NULL> if an error occurred. | ||
| 105 | |||
| 106 | X509_STORE_CTX_cleanup(), X509_STORE_CTX_free(), X509_STORE_CTX_trusted_stack(), | ||
| 107 | X509_STORE_CTX_set_cert(), X509_STORE_CTX_set_chain(), | ||
| 108 | X509_STORE_CTX_set0_crls() and X509_STORE_CTX_set0_param() do not return | ||
| 109 | values. | ||
| 110 | |||
| 111 | X509_STORE_CTX_set_default() returns 1 for success or 0 if an error occurred. | ||
| 112 | |||
| 113 | =head1 SEE ALSO | ||
| 114 | |||
| 115 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
| 116 | L<X509_VERIFY_PARAM_set_flags(3)|X509_VERIFY_PARAM_set_flags(3)> | ||
| 117 | |||
| 118 | =head1 HISTORY | ||
| 119 | |||
| 120 | X509_STORE_CTX_set0_crls() was first added to OpenSSL 1.0.0 | ||
| 121 | |||
| 122 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_set_verify_cb.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_set_verify_cb.pod new file mode 100644 index 0000000000..b9787a6ca6 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/X509_STORE_CTX_set_verify_cb.pod | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | X509_STORE_CTX_set_verify_cb - set verification callback | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509_vfy.h> | ||
| 10 | |||
| 11 | void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, | ||
| 12 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | X509_STORE_CTX_set_verify_cb() sets the verification callback of B<ctx> to | ||
| 17 | B<verify_cb> overwriting any existing callback. | ||
| 18 | |||
| 19 | The verification callback can be used to customise the operation of certificate | ||
| 20 | verification, either by overriding error conditions or logging errors for | ||
| 21 | debugging purposes. | ||
| 22 | |||
| 23 | However a verification callback is B<not> essential and the default operation | ||
| 24 | is often sufficient. | ||
| 25 | |||
| 26 | The B<ok> parameter to the callback indicates the value the callback should | ||
| 27 | return to retain the default behaviour. If it is zero then and error condition | ||
| 28 | is indicated. If it is 1 then no error occurred. If the flag | ||
| 29 | B<X509_V_FLAG_NOTIFY_POLICY> is set then B<ok> is set to 2 to indicate the | ||
| 30 | policy checking is complete. | ||
| 31 | |||
| 32 | The B<ctx> parameter to the callback is the B<X509_STORE_CTX> structure that | ||
| 33 | is performing the verification operation. A callback can examine this | ||
| 34 | structure and receive additional information about the error, for example | ||
| 35 | by calling X509_STORE_CTX_get_current_cert(). Additional application data can | ||
| 36 | be passed to the callback via the B<ex_data> mechanism. | ||
| 37 | |||
| 38 | =head1 WARNING | ||
| 39 | |||
| 40 | In general a verification callback should B<NOT> unconditionally return 1 in | ||
| 41 | all circumstances because this will allow verification to succeed no matter | ||
| 42 | what the error. This effectively removes all security from the application | ||
| 43 | because B<any> certificate (including untrusted generated ones) will be | ||
| 44 | accepted. | ||
| 45 | |||
| 46 | =head1 NOTES | ||
| 47 | |||
| 48 | The verification callback can be set and inherited from the parent structure | ||
| 49 | performing the operation. In some cases (such as S/MIME verification) the | ||
| 50 | B<X509_STORE_CTX> structure is created and destroyed internally and the | ||
| 51 | only way to set a custom verification callback is by inheriting it from the | ||
| 52 | associated B<X509_STORE>. | ||
| 53 | |||
| 54 | =head1 RETURN VALUES | ||
| 55 | |||
| 56 | X509_STORE_CTX_set_verify_cb() does not return a value. | ||
| 57 | |||
| 58 | =head1 EXAMPLES | ||
| 59 | |||
| 60 | Default callback operation: | ||
| 61 | |||
| 62 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 63 | { | ||
| 64 | return ok; | ||
| 65 | } | ||
| 66 | |||
| 67 | Simple example, suppose a certificate in the chain is expired and we wish | ||
| 68 | to continue after this error: | ||
| 69 | |||
| 70 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 71 | { | ||
| 72 | /* Tolerate certificate expiration */ | ||
| 73 | if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED) | ||
| 74 | return 1; | ||
| 75 | /* Otherwise don't override */ | ||
| 76 | return ok; | ||
| 77 | } | ||
| 78 | |||
| 79 | More complex example, we don't wish to continue after B<any> certificate has | ||
| 80 | expired just one specific case: | ||
| 81 | |||
| 82 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 83 | { | ||
| 84 | int err = X509_STORE_CTX_get_error(ctx); | ||
| 85 | X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
| 86 | if (err == X509_V_ERR_CERT_HAS_EXPIRED) | ||
| 87 | { | ||
| 88 | if (check_is_acceptable_expired_cert(err_cert) | ||
| 89 | return 1; | ||
| 90 | } | ||
| 91 | return ok; | ||
| 92 | } | ||
| 93 | |||
| 94 | Full featured logging callback. In this case the B<bio_err> is assumed to be | ||
| 95 | a global logging B<BIO>, an alternative would to store a BIO in B<ctx> using | ||
| 96 | B<ex_data>. | ||
| 97 | |||
| 98 | int verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 99 | { | ||
| 100 | X509 *err_cert; | ||
| 101 | int err,depth; | ||
| 102 | |||
| 103 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
| 104 | err = X509_STORE_CTX_get_error(ctx); | ||
| 105 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
| 106 | |||
| 107 | BIO_printf(bio_err,"depth=%d ",depth); | ||
| 108 | if (err_cert) | ||
| 109 | { | ||
| 110 | X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert), | ||
| 111 | 0, XN_FLAG_ONELINE); | ||
| 112 | BIO_puts(bio_err, "\n"); | ||
| 113 | } | ||
| 114 | else | ||
| 115 | BIO_puts(bio_err, "<no cert>\n"); | ||
| 116 | if (!ok) | ||
| 117 | BIO_printf(bio_err,"verify error:num=%d:%s\n",err, | ||
| 118 | X509_verify_cert_error_string(err)); | ||
| 119 | switch (err) | ||
| 120 | { | ||
| 121 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: | ||
| 122 | BIO_puts(bio_err,"issuer= "); | ||
| 123 | X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert), | ||
| 124 | 0, XN_FLAG_ONELINE); | ||
| 125 | BIO_puts(bio_err, "\n"); | ||
| 126 | break; | ||
| 127 | case X509_V_ERR_CERT_NOT_YET_VALID: | ||
| 128 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: | ||
| 129 | BIO_printf(bio_err,"notBefore="); | ||
| 130 | ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert)); | ||
| 131 | BIO_printf(bio_err,"\n"); | ||
| 132 | break; | ||
| 133 | case X509_V_ERR_CERT_HAS_EXPIRED: | ||
| 134 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: | ||
| 135 | BIO_printf(bio_err,"notAfter="); | ||
| 136 | ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert)); | ||
| 137 | BIO_printf(bio_err,"\n"); | ||
| 138 | break; | ||
| 139 | case X509_V_ERR_NO_EXPLICIT_POLICY: | ||
| 140 | policies_print(bio_err, ctx); | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | if (err == X509_V_OK && ok == 2) | ||
| 144 | /* print out policies */ | ||
| 145 | |||
| 146 | BIO_printf(bio_err,"verify return:%d\n",ok); | ||
| 147 | return(ok); | ||
| 148 | } | ||
| 149 | |||
| 150 | =head1 SEE ALSO | ||
| 151 | |||
| 152 | L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)> | ||
| 153 | L<X509_STORE_set_verify_cb_func(3)|X509_STORE_set_verify_cb_func(3)> | ||
| 154 | L<X509_STORE_CTX_get_ex_new_index(3)|X509_STORE_CTX_get_ex_new_index(3)> | ||
| 155 | |||
| 156 | =head1 HISTORY | ||
| 157 | |||
| 158 | X509_STORE_CTX_set_verify_cb() is available in all versions of SSLeay and | ||
| 159 | OpenSSL. | ||
| 160 | |||
| 161 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/X509_STORE_set_verify_cb_func.pod b/src/lib/libssl/src/doc/crypto/X509_STORE_set_verify_cb_func.pod new file mode 100644 index 0000000000..29e3bbe3bc --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/X509_STORE_set_verify_cb_func.pod | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | X509_STORE_set_verify_cb_func, X509_STORE_set_verify_cb - set verification callback | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509_vfy.h> | ||
| 10 | |||
| 11 | void X509_STORE_set_verify_cb(X509_STORE *st, | ||
| 12 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
| 13 | |||
| 14 | void X509_STORE_set_verify_cb_func(X509_STORE *st, | ||
| 15 | int (*verify_cb)(int ok, X509_STORE_CTX *ctx)); | ||
| 16 | |||
| 17 | =head1 DESCRIPTION | ||
| 18 | |||
| 19 | X509_STORE_set_verify_cb() sets the verification callback of B<ctx> to | ||
| 20 | B<verify_cb> overwriting any existing callback. | ||
| 21 | |||
| 22 | X509_STORE_set_verify_cb_func() also sets the verification callback but it | ||
| 23 | is implemented as a macro. | ||
| 24 | |||
| 25 | =head1 NOTES | ||
| 26 | |||
| 27 | The verification callback from an B<X509_STORE> is inherited by | ||
| 28 | the corresponding B<X509_STORE_CTX> structure when it is initialized. This can | ||
| 29 | be used to set the verification callback when the B<X509_STORE_CTX> is | ||
| 30 | otherwise inaccessible (for example during S/MIME verification). | ||
| 31 | |||
| 32 | =head1 BUGS | ||
| 33 | |||
| 34 | The macro version of this function was the only one available before | ||
| 35 | OpenSSL 1.0.0. | ||
| 36 | |||
| 37 | =head1 RETURN VALUES | ||
| 38 | |||
| 39 | X509_STORE_set_verify_cb() and X509_STORE_set_verify_cb_func() do not return | ||
| 40 | a value. | ||
| 41 | |||
| 42 | =head1 SEE ALSO | ||
| 43 | |||
| 44 | L<X509_STORE_CTX_set_verify_cb(3)|X509_STORE_CTX_set_verify_cb(3)> | ||
| 45 | L<CMS_verify(3)|CMS_verify(3)> | ||
| 46 | |||
| 47 | =head1 HISTORY | ||
| 48 | |||
| 49 | X509_STORE_set_verify_cb_func() is available in all versions of SSLeay and | ||
| 50 | OpenSSL. | ||
| 51 | |||
| 52 | X509_STORE_set_verify_cb() was added to OpenSSL 1.0.0. | ||
| 53 | |||
| 54 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/X509_VERIFY_PARAM_set_flags.pod b/src/lib/libssl/src/doc/crypto/X509_VERIFY_PARAM_set_flags.pod new file mode 100644 index 0000000000..b68eece033 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/X509_VERIFY_PARAM_set_flags.pod | |||
| @@ -0,0 +1,171 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | X509_VERIFY_PARAM_set_flags, X509_VERIFY_PARAM_clear_flags, X509_VERIFY_PARAM_get_flags, X509_VERIFY_PARAM_set_purpose, X509_VERIFY_PARAM_set_trust, X509_VERIFY_PARAM_set_depth, X509_VERIFY_PARAM_get_depth, X509_VERIFY_PARAM_set_time, X509_VERIFY_PARAM_add0_policy, X509_VERIFY_PARAM_set1_policies - X509 verification parameters | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509_vfy.h> | ||
| 10 | |||
| 11 | int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); | ||
| 12 | int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, | ||
| 13 | unsigned long flags); | ||
| 14 | unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); | ||
| 15 | |||
| 16 | int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); | ||
| 17 | int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); | ||
| 18 | |||
| 19 | void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); | ||
| 20 | |||
| 21 | int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, | ||
| 22 | ASN1_OBJECT *policy); | ||
| 23 | int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, | ||
| 24 | STACK_OF(ASN1_OBJECT) *policies); | ||
| 25 | |||
| 26 | void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); | ||
| 27 | int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); | ||
| 28 | |||
| 29 | =head1 DESCRIPTION | ||
| 30 | |||
| 31 | These functions manipulate the B<X509_VERIFY_PARAM> structure associated with | ||
| 32 | a certificate verification operation. | ||
| 33 | |||
| 34 | The X509_VERIFY_PARAM_set_flags() function sets the flags in B<param> by oring | ||
| 35 | it with B<flags>. See the B<VERIFICATION FLAGS> section for a complete | ||
| 36 | description of values the B<flags> parameter can take. | ||
| 37 | |||
| 38 | X509_VERIFY_PARAM_get_flags() returns the flags in B<param>. | ||
| 39 | |||
| 40 | X509_VERIFY_PARAM_clear_flags() clears the flags B<flags> in B<param>. | ||
| 41 | |||
| 42 | X509_VERIFY_PARAM_set_purpose() sets the verification purpose in B<param> | ||
| 43 | to B<purpose>. This determines the acceptable purpose of the certificate | ||
| 44 | chain, for example SSL client or SSL server. | ||
| 45 | |||
| 46 | X509_VERIFY_PARAM_set_trust() sets the trust setting in B<param> to | ||
| 47 | B<trust>. | ||
| 48 | |||
| 49 | X509_VERIFY_PARAM_set_time() sets the verification time in B<param> to | ||
| 50 | B<t>. Normally the current time is used. | ||
| 51 | |||
| 52 | X509_VERIFY_PARAM_add0_policy() enables policy checking (it is disabled | ||
| 53 | by default) and adds B<policy> to the acceptable policy set. | ||
| 54 | |||
| 55 | X509_VERIFY_PARAM_set1_policies() enables policy checking (it is disabled | ||
| 56 | by default) and sets the acceptable policy set to B<policies>. Any existing | ||
| 57 | policy set is cleared. The B<policies> parameter can be B<NULL> to clear | ||
| 58 | an existing policy set. | ||
| 59 | |||
| 60 | X509_VERIFY_PARAM_set_depth() sets the maximum verification depth to B<depth>. | ||
| 61 | That is the maximum number of untrusted CA certificates that can appear in a | ||
| 62 | chain. | ||
| 63 | |||
| 64 | =head1 RETURN VALUES | ||
| 65 | |||
| 66 | X509_VERIFY_PARAM_set_flags(), X509_VERIFY_PARAM_clear_flags(), | ||
| 67 | X509_VERIFY_PARAM_set_purpose(), X509_VERIFY_PARAM_set_trust(), | ||
| 68 | X509_VERIFY_PARAM_add0_policy() and X509_VERIFY_PARAM_set1_policies() return 1 | ||
| 69 | for success and 0 for failure. | ||
| 70 | |||
| 71 | X509_VERIFY_PARAM_get_flags() returns the current verification flags. | ||
| 72 | |||
| 73 | X509_VERIFY_PARAM_set_time() and X509_VERIFY_PARAM_set_depth() do not return | ||
| 74 | values. | ||
| 75 | |||
| 76 | X509_VERIFY_PARAM_get_depth() returns the current verification depth. | ||
| 77 | |||
| 78 | =head1 VERIFICATION FLAGS | ||
| 79 | |||
| 80 | The verification flags consists of zero or more of the following flags | ||
| 81 | ored together. | ||
| 82 | |||
| 83 | B<X509_V_FLAG_CRL_CHECK> enables CRL checking for the certificate chain leaf | ||
| 84 | certificate. An error occurs if a suitable CRL cannot be found. | ||
| 85 | |||
| 86 | B<X509_V_FLAG_CRL_CHECK_ALL> enables CRL checking for the entire certificate | ||
| 87 | chain. | ||
| 88 | |||
| 89 | B<X509_V_FLAG_IGNORE_CRITICAL> disabled critical extension checking. By default | ||
| 90 | any unhandled critical extensions in certificates or (if checked) CRLs results | ||
| 91 | in a fatal error. If this flag is set unhandled critical extensions are | ||
| 92 | ignored. B<WARNING> setting this option for anything other than debugging | ||
| 93 | purposes can be a security risk. Finer control over which extensions are | ||
| 94 | supported can be performed in the verification callback. | ||
| 95 | |||
| 96 | THe B<X509_V_FLAG_X509_STRICT> flag disables workarounds for some broken | ||
| 97 | certificates and makes the verification strictly apply B<X509> rules. | ||
| 98 | |||
| 99 | B<X509_V_FLAG_ALLOW_PROXY_CERTS> enables proxy certificate verification. | ||
| 100 | |||
| 101 | B<X509_V_FLAG_POLICY_CHECK> enables certificate policy checking, by default | ||
| 102 | no policy checking is peformed. Additional information is sent to the | ||
| 103 | verification callback relating to policy checking. | ||
| 104 | |||
| 105 | B<X509_V_FLAG_EXPLICIT_POLICY>, B<X509_V_FLAG_INHIBIT_ANY> and | ||
| 106 | B<X509_V_FLAG_INHIBIT_MAP> set the B<require explicit policy>, B<inhibit any | ||
| 107 | policy> and B<inhibit policy mapping> flags respectively as defined in | ||
| 108 | B<RFC3280>. Policy checking is automatically enabled if any of these flags | ||
| 109 | are set. | ||
| 110 | |||
| 111 | If B<X509_V_FLAG_NOTIFY_POLICY> is set and the policy checking is successful | ||
| 112 | a special status code is set to the verification callback. This permits it | ||
| 113 | to examine the valid policy tree and perform additional checks or simply | ||
| 114 | log it for debugging purposes. | ||
| 115 | |||
| 116 | By default some addtional features such as indirect CRLs and CRLs signed by | ||
| 117 | different keys are disabled. If B<X509_V_FLAG_EXTENDED_CRL_SUPPORT> is set | ||
| 118 | they are enabled. | ||
| 119 | |||
| 120 | If B<X509_V_FLAG_USE_DELTAS> ise set delta CRLs (if present) are used to | ||
| 121 | determine certificate status. If not set deltas are ignored. | ||
| 122 | |||
| 123 | B<X509_V_FLAG_CHECK_SS_SIGNATURE> enables checking of the root CA self signed | ||
| 124 | cerificate signature. By default this check is disabled because it doesn't | ||
| 125 | add any additional security but in some cases applications might want to | ||
| 126 | check the signature anyway. A side effect of not checking the root CA | ||
| 127 | signature is that disabled or unsupported message digests on the root CA | ||
| 128 | are not treated as fatal errors. | ||
| 129 | |||
| 130 | The B<X509_V_FLAG_CB_ISSUER_CHECK> flag enables debugging of certificate | ||
| 131 | issuer checks. It is B<not> needed unless you are logging certificate | ||
| 132 | verification. If this flag is set then additional status codes will be sent | ||
| 133 | to the verification callback and it B<must> be prepared to handle such cases | ||
| 134 | without assuming they are hard errors. | ||
| 135 | |||
| 136 | =head1 NOTES | ||
| 137 | |||
| 138 | The above functions should be used to manipulate verification parameters | ||
| 139 | instead of legacy functions which work in specific structures such as | ||
| 140 | X509_STORE_CTX_set_flags(). | ||
| 141 | |||
| 142 | =head1 BUGS | ||
| 143 | |||
| 144 | Delta CRL checking is currently primitive. Only a single delta can be used and | ||
| 145 | (partly due to limitations of B<X509_STORE>) constructed CRLs are not | ||
| 146 | maintained. | ||
| 147 | |||
| 148 | If CRLs checking is enable CRLs are expected to be available in the | ||
| 149 | corresponding B<X509_STORE> structure. No attempt is made to download | ||
| 150 | CRLs from the CRL distribution points extension. | ||
| 151 | |||
| 152 | =head1 EXAMPLE | ||
| 153 | |||
| 154 | Enable CRL checking when performing certificate verification during SSL | ||
| 155 | connections associated with an B<SSL_CTX> structure B<ctx>: | ||
| 156 | |||
| 157 | X509_VERIFY_PARAM *param; | ||
| 158 | param = X509_VERIFY_PARAM_new(); | ||
| 159 | X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK); | ||
| 160 | SSL_CTX_set1_param(ctx, param); | ||
| 161 | X509_VERIFY_PARAM_free(param); | ||
| 162 | |||
| 163 | =head1 SEE ALSO | ||
| 164 | |||
| 165 | L<X509_verify_cert(3)|X509_verify_cert(3)> | ||
| 166 | |||
| 167 | =head1 HISTORY | ||
| 168 | |||
| 169 | TBA | ||
| 170 | |||
| 171 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/X509_verify_cert.pod b/src/lib/libssl/src/doc/crypto/X509_verify_cert.pod new file mode 100644 index 0000000000..5253bdcd70 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/X509_verify_cert.pod | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | X509_verify_cert - discover and verify X509 certificte chain | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/x509.h> | ||
| 10 | |||
| 11 | int X509_verify_cert(X509_STORE_CTX *ctx); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | The X509_verify_cert() function attempts to discover and validate a | ||
| 16 | certificate chain based on parameters in B<ctx>. A complete description of | ||
| 17 | the process is contained in the L<verify(1)|verify(1)> manual page. | ||
| 18 | |||
| 19 | =head1 RETURN VALUES | ||
| 20 | |||
| 21 | If a complete chain can be built and validated this function returns 1, | ||
| 22 | otherwise it return zero, in exceptional circumstances it can also | ||
| 23 | return a negative code. | ||
| 24 | |||
| 25 | If the function fails additional error information can be obtained by | ||
| 26 | examining B<ctx> using, for example X509_STORE_CTX_get_error(). | ||
| 27 | |||
| 28 | =head1 NOTES | ||
| 29 | |||
| 30 | Applications rarely call this function directly but it is used by | ||
| 31 | OpenSSL internally for certificate validation, in both the S/MIME and | ||
| 32 | SSL/TLS code. | ||
| 33 | |||
| 34 | The negative return value from X509_verify_cert() can only occur if no | ||
| 35 | certificate is set in B<ctx> (due to a programming error) or if a retry | ||
| 36 | operation is requested during internal lookups (which never happens with | ||
| 37 | standard lookup methods). It is however recommended that application check | ||
| 38 | for <= 0 return value on error. | ||
| 39 | |||
| 40 | =head1 BUGS | ||
| 41 | |||
| 42 | This function uses the header B<x509.h> as opposed to most chain verification | ||
| 43 | functiosn which use B<x509_vfy.h>. | ||
| 44 | |||
| 45 | =head1 SEE ALSO | ||
| 46 | |||
| 47 | L<X509_STORE_CTX_get_error(3)|X509_STORE_CTX_get_error(3)> | ||
| 48 | |||
| 49 | =head1 HISTORY | ||
| 50 | |||
| 51 | X509_verify_cert() is available in all versions of SSLeay and OpenSSL. | ||
| 52 | |||
| 53 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/i2d_CMS_bio_stream.pod b/src/lib/libssl/src/doc/crypto/i2d_CMS_bio_stream.pod new file mode 100644 index 0000000000..558bdd0812 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/i2d_CMS_bio_stream.pod | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | i2d_CMS_bio_stream - output CMS_ContentInfo structure in BER format. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/cms.h> | ||
| 10 | |||
| 11 | int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format. | ||
| 16 | |||
| 17 | It is otherwise identical to the function SMIME_write_CMS(). | ||
| 18 | |||
| 19 | =head1 NOTES | ||
| 20 | |||
| 21 | This function is effectively a version of the i2d_CMS_bio() supporting | ||
| 22 | streaming. | ||
| 23 | |||
| 24 | =head1 BUGS | ||
| 25 | |||
| 26 | The prefix "i2d" is arguably wrong because the function outputs BER format. | ||
| 27 | |||
| 28 | =head1 RETURN VALUES | ||
| 29 | |||
| 30 | i2d_CMS_bio_stream() returns 1 for success or 0 for failure. | ||
| 31 | |||
| 32 | =head1 SEE ALSO | ||
| 33 | |||
| 34 | L<ERR_get_error(3)|ERR_get_error(3)>, L<CMS_sign(3)|CMS_sign(3)>, | ||
| 35 | L<CMS_verify(3)|CMS_verify(3)>, L<CMS_encrypt(3)|CMS_encrypt(3)> | ||
| 36 | L<CMS_decrypt(3)|CMS_decrypt(3)>, | ||
| 37 | L<SMIME_write_CMS(3)|SMIME_write_CMS(3)>, | ||
| 38 | L<PEM_write_bio_CMS_stream(3)|PEM_write_bio_CMS_stream(3)> | ||
| 39 | |||
| 40 | =head1 HISTORY | ||
| 41 | |||
| 42 | i2d_CMS_bio_stream() was added to OpenSSL 1.0.0 | ||
| 43 | |||
| 44 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/i2d_PKCS7_bio_stream.pod b/src/lib/libssl/src/doc/crypto/i2d_PKCS7_bio_stream.pod new file mode 100644 index 0000000000..dc4d884c59 --- /dev/null +++ b/src/lib/libssl/src/doc/crypto/i2d_PKCS7_bio_stream.pod | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | i2d_PKCS7_bio_stream - output PKCS7 structure in BER format. | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/pkcs7.h> | ||
| 10 | |||
| 11 | int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags); | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format. | ||
| 16 | |||
| 17 | It is otherwise identical to the function SMIME_write_PKCS7(). | ||
| 18 | |||
| 19 | =head1 NOTES | ||
| 20 | |||
| 21 | This function is effectively a version of the d2i_PKCS7_bio() supporting | ||
| 22 | streaming. | ||
| 23 | |||
| 24 | =head1 BUGS | ||
| 25 | |||
| 26 | The prefix "d2i" is arguably wrong because the function outputs BER format. | ||
| 27 | |||
| 28 | =head1 RETURN VALUES | ||
| 29 | |||
| 30 | i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure. | ||
| 31 | |||
| 32 | =head1 SEE ALSO | ||
| 33 | |||
| 34 | L<ERR_get_error(3)|ERR_get_error(3)>, L<PKCS7_sign(3)|PKCS7_sign(3)>, | ||
| 35 | L<PKCS7_verify(3)|PKCS7_verify(3)>, L<PKCS7_encrypt(3)|PKCS7_encrypt(3)> | ||
| 36 | L<PKCS7_decrypt(3)|PKCS7_decrypt(3)>, | ||
| 37 | L<SMIME_write_PKCS7(3)|SMIME_write_PKCS7(3)>, | ||
| 38 | L<PEM_write_bio_PKCS7_stream(3)|PEM_write_bio_PKCS7_stream(3)> | ||
| 39 | |||
| 40 | =head1 HISTORY | ||
| 41 | |||
| 42 | i2d_PKCS7_bio_stream() was added to OpenSSL 1.0.0 | ||
| 43 | |||
| 44 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod new file mode 100644 index 0000000000..573f89a922 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =begin comment | ||
| 4 | |||
| 5 | Copyright 2005 Nokia. All rights reserved. | ||
| 6 | |||
| 7 | The portions of the attached software ("Contribution") is developed by | ||
| 8 | Nokia Corporation and is licensed pursuant to the OpenSSL open source | ||
| 9 | license. | ||
| 10 | |||
| 11 | The Contribution, originally written by Mika Kousa and Pasi Eronen of | ||
| 12 | Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites | ||
| 13 | support (see RFC 4279) to OpenSSL. | ||
| 14 | |||
| 15 | No patent licenses or other rights except those expressly stated in | ||
| 16 | the OpenSSL open source license shall be deemed granted or received | ||
| 17 | expressly, by implication, estoppel, or otherwise. | ||
| 18 | |||
| 19 | No assurances are provided by Nokia that the Contribution does not | ||
| 20 | infringe the patent or other intellectual property rights of any third | ||
| 21 | party or that the license provides you with all the necessary rights | ||
| 22 | to make use of the Contribution. | ||
| 23 | |||
| 24 | THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN | ||
| 25 | ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA | ||
| 26 | SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY | ||
| 27 | OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR | ||
| 28 | OTHERWISE. | ||
| 29 | |||
| 30 | =end comment | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK client callback | ||
| 35 | |||
| 36 | =head1 SYNOPSIS | ||
| 37 | |||
| 38 | #include <openssl/ssl.h> | ||
| 39 | |||
| 40 | void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, | ||
| 41 | unsigned int (*callback)(SSL *ssl, const char *hint, | ||
| 42 | char *identity, unsigned int max_identity_len, | ||
| 43 | unsigned char *psk, unsigned int max_psk_len)); | ||
| 44 | void SSL_set_psk_client_callback(SSL *ssl, | ||
| 45 | unsigned int (*callback)(SSL *ssl, const char *hint, | ||
| 46 | char *identity, unsigned int max_identity_len, | ||
| 47 | unsigned char *psk, unsigned int max_psk_len)); | ||
| 48 | |||
| 49 | |||
| 50 | =head1 DESCRIPTION | ||
| 51 | |||
| 52 | A client application must provide a callback function which is called | ||
| 53 | when the client is sending the ClientKeyExchange message to the server. | ||
| 54 | |||
| 55 | The purpose of the callback function is to select the PSK identity and | ||
| 56 | the pre-shared key to use during the connection setup phase. | ||
| 57 | |||
| 58 | The callback is set using functions SSL_CTX_set_psk_client_callback() | ||
| 59 | or SSL_set_psk_client_callback(). The callback function is given the | ||
| 60 | connection in parameter B<ssl>, a B<NULL>-terminated PSK identity hint | ||
| 61 | sent by the server in parameter B<hint>, a buffer B<identity> of | ||
| 62 | length B<max_identity_len> bytes where the the resulting | ||
| 63 | B<NULL>-terminated identity is to be stored, and a buffer B<psk> of | ||
| 64 | length B<max_psk_len> bytes where the resulting pre-shared key is to | ||
| 65 | be stored. | ||
| 66 | |||
| 67 | =head1 NOTES | ||
| 68 | |||
| 69 | Note that parameter B<hint> given to the callback may be B<NULL>. | ||
| 70 | |||
| 71 | =head1 RETURN VALUES | ||
| 72 | |||
| 73 | Return values from the client callback are interpreted as follows: | ||
| 74 | |||
| 75 | On success (callback found a PSK identity and a pre-shared key to use) | ||
| 76 | the length (> 0) of B<psk> in bytes is returned. | ||
| 77 | |||
| 78 | Otherwise or on errors callback should return 0. In this case | ||
| 79 | the connection setup fails. | ||
| 80 | |||
| 81 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod new file mode 100644 index 0000000000..b80e25be7e --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =begin comment | ||
| 4 | |||
| 5 | Copyright 2005 Nokia. All rights reserved. | ||
| 6 | |||
| 7 | The portions of the attached software ("Contribution") is developed by | ||
| 8 | Nokia Corporation and is licensed pursuant to the OpenSSL open source | ||
| 9 | license. | ||
| 10 | |||
| 11 | The Contribution, originally written by Mika Kousa and Pasi Eronen of | ||
| 12 | Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites | ||
| 13 | support (see RFC 4279) to OpenSSL. | ||
| 14 | |||
| 15 | No patent licenses or other rights except those expressly stated in | ||
| 16 | the OpenSSL open source license shall be deemed granted or received | ||
| 17 | expressly, by implication, estoppel, or otherwise. | ||
| 18 | |||
| 19 | No assurances are provided by Nokia that the Contribution does not | ||
| 20 | infringe the patent or other intellectual property rights of any third | ||
| 21 | party or that the license provides you with all the necessary rights | ||
| 22 | to make use of the Contribution. | ||
| 23 | |||
| 24 | THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN | ||
| 25 | ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA | ||
| 26 | SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY | ||
| 27 | OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR | ||
| 28 | OTHERWISE. | ||
| 29 | |||
| 30 | =end comment | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint, | ||
| 35 | SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback - set PSK | ||
| 36 | identity hint to use | ||
| 37 | |||
| 38 | |||
| 39 | =head1 SYNOPSIS | ||
| 40 | |||
| 41 | #include <openssl/ssl.h> | ||
| 42 | |||
| 43 | int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint); | ||
| 44 | int SSL_use_psk_identity_hint(SSL *ssl, const char *hint); | ||
| 45 | |||
| 46 | void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, | ||
| 47 | unsigned int (*callback)(SSL *ssl, const char *identity, | ||
| 48 | unsigned char *psk, int max_psk_len)); | ||
| 49 | void SSL_set_psk_server_callback(SSL *ssl, | ||
| 50 | unsigned int (*callback)(SSL *ssl, const char *identity, | ||
| 51 | unsigned char *psk, int max_psk_len)); | ||
| 52 | |||
| 53 | |||
| 54 | =head1 DESCRIPTION | ||
| 55 | |||
| 56 | SSL_CTX_use_psk_identity_hint() sets the given B<NULL>-terminated PSK | ||
| 57 | identity hint B<hint> to SSL context object | ||
| 58 | B<ctx>. SSL_use_psk_identity_hint() sets the given B<NULL>-terminated | ||
| 59 | PSK identity hint B<hint> to SSL connection object B<ssl>. If B<hint> | ||
| 60 | is B<NULL> the current hint from B<ctx> or B<ssl> is deleted. | ||
| 61 | |||
| 62 | In the case where PSK identity hint is B<NULL>, the server | ||
| 63 | does not send the ServerKeyExchange message to the client. | ||
| 64 | |||
| 65 | A server application must provide a callback function which is called | ||
| 66 | when the server receives the ClientKeyExchange message from the | ||
| 67 | client. The purpose of the callback function is to validate the | ||
| 68 | received PSK identity and to fetch the pre-shared key used during the | ||
| 69 | connection setup phase. The callback is set using functions | ||
| 70 | SSL_CTX_set_psk_server_callback() or | ||
| 71 | SSL_set_psk_server_callback(). The callback function is given the | ||
| 72 | connection in parameter B<ssl>, B<NULL>-terminated PSK identity sent | ||
| 73 | by the client in parameter B<identity>, and a buffer B<psk> of length | ||
| 74 | B<max_psk_len> bytes where the pre-shared key is to be stored. | ||
| 75 | |||
| 76 | |||
| 77 | =head1 RETURN VALUES | ||
| 78 | |||
| 79 | SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return | ||
| 80 | 1 on success, 0 otherwise. | ||
| 81 | |||
| 82 | Return values from the server callback are interpreted as follows: | ||
| 83 | |||
| 84 | =item > 0 | ||
| 85 | |||
| 86 | PSK identity was found and the server callback has provided the PSK | ||
| 87 | successfully in parameter B<psk>. Return value is the length of | ||
| 88 | B<psk> in bytes. It is an error to return a value greater than | ||
| 89 | B<max_psk_len>. | ||
| 90 | |||
| 91 | If the PSK identity was not found but the callback instructs the | ||
| 92 | protocol to continue anyway, the callback must provide some random | ||
| 93 | data to B<psk> and return the length of the random data, so the | ||
| 94 | connection will fail with decryption_error before it will be finished | ||
| 95 | completely. | ||
| 96 | |||
| 97 | =item 0 | ||
| 98 | |||
| 99 | PSK identity was not found. An "unknown_psk_identity" alert message | ||
| 100 | will be sent and the connection setup fails. | ||
| 101 | |||
| 102 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod b/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod new file mode 100644 index 0000000000..fe6291649c --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =begin comment | ||
| 4 | |||
| 5 | Copyright 2005 Nokia. All rights reserved. | ||
| 6 | |||
| 7 | The portions of the attached software ("Contribution") is developed by | ||
| 8 | Nokia Corporation and is licensed pursuant to the OpenSSL open source | ||
| 9 | license. | ||
| 10 | |||
| 11 | The Contribution, originally written by Mika Kousa and Pasi Eronen of | ||
| 12 | Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites | ||
| 13 | support (see RFC 4279) to OpenSSL. | ||
| 14 | |||
| 15 | No patent licenses or other rights except those expressly stated in | ||
| 16 | the OpenSSL open source license shall be deemed granted or received | ||
| 17 | expressly, by implication, estoppel, or otherwise. | ||
| 18 | |||
| 19 | No assurances are provided by Nokia that the Contribution does not | ||
| 20 | infringe the patent or other intellectual property rights of any third | ||
| 21 | party or that the license provides you with all the necessary rights | ||
| 22 | to make use of the Contribution. | ||
| 23 | |||
| 24 | THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN | ||
| 25 | ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA | ||
| 26 | SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY | ||
| 27 | OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR | ||
| 28 | OTHERWISE. | ||
| 29 | |||
| 30 | =end comment | ||
| 31 | |||
| 32 | =head1 NAME | ||
| 33 | |||
| 34 | SSL_get_psk_identity, SSL_get_psk_identity_hint - get PSK client identity and hint | ||
| 35 | |||
| 36 | |||
| 37 | =head1 SYNOPSIS | ||
| 38 | |||
| 39 | #include <openssl/ssl.h> | ||
| 40 | |||
| 41 | const char *SSL_get_psk_identity_hint(const SSL *ssl); | ||
| 42 | const char *SSL_get_psk_identity(const SSL *ssl); | ||
| 43 | |||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | SSL_get_psk_identity_hint() is used to retrieve the PSK identity hint | ||
| 48 | used during the connection setup related to SSL object | ||
| 49 | B<ssl>. Similarly, SSL_get_psk_identity() is used to retrieve the PSK | ||
| 50 | identity used during the connection setup. | ||
| 51 | |||
| 52 | |||
| 53 | =head1 RETURN VALUES | ||
| 54 | |||
| 55 | If non-B<NULL>, SSL_get_psk_identity_hint() returns the PSK identity | ||
| 56 | hint and SSL_get_psk_identity() returns the PSK identity. Both are | ||
| 57 | B<NULL>-terminated. SSL_get_psk_identity_hint() may return B<NULL> if | ||
| 58 | no PSK identity hint was used during the connection setup. | ||
| 59 | |||
| 60 | Note that the return value is valid only during the lifetime of the | ||
| 61 | SSL object B<ssl>. | ||
| 62 | |||
| 63 | =cut | ||
