diff options
Diffstat (limited to 'src/lib/libcrypto/man/CMS_encrypt.3')
| -rw-r--r-- | src/lib/libcrypto/man/CMS_encrypt.3 | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/CMS_encrypt.3 b/src/lib/libcrypto/man/CMS_encrypt.3 new file mode 100644 index 0000000000..5d7b0bf470 --- /dev/null +++ b/src/lib/libcrypto/man/CMS_encrypt.3 | |||
| @@ -0,0 +1,152 @@ | |||
| 1 | .Dd $Mdocdate: November 11 2015 $ | ||
| 2 | .Dt CMS_ENCRYPT 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm CMS_encrypt | ||
| 6 | .Nd create a CMS envelopedData structure | ||
| 7 | .Sh SYNOPSIS | ||
| 8 | .In openssl/cms.h | ||
| 9 | .Ft CMS_ContentInfo * | ||
| 10 | .Fo CMS_encrypt | ||
| 11 | .Fa "STACK_OF(X509) *certs" | ||
| 12 | .Fa "BIO *in" | ||
| 13 | .Fa "const EVP_CIPHER *cipher" | ||
| 14 | .Fa "unsigned int flags" | ||
| 15 | .Fc | ||
| 16 | .Sh DESCRIPTION | ||
| 17 | .Fn CMS_encrypt | ||
| 18 | creates and returns a CMS EnvelopedData structure. | ||
| 19 | .Fa certs | ||
| 20 | is a list of recipient certificates. | ||
| 21 | .Fa in | ||
| 22 | is the content to be encrypted. | ||
| 23 | .Fa cipher | ||
| 24 | is the symmetric cipher to use. | ||
| 25 | .Fa flags | ||
| 26 | is an optional set of flags. | ||
| 27 | .Sh NOTES | ||
| 28 | Only certificates carrying RSA keys are supported so the recipient | ||
| 29 | certificates supplied to this function must all contain RSA public keys, | ||
| 30 | though they do not have to be signed using the RSA algorithm. | ||
| 31 | .Pp | ||
| 32 | The algorithm passed in the | ||
| 33 | .Fa cipher | ||
| 34 | parameter must support ASN1 encoding of its parameters. | ||
| 35 | .Pp | ||
| 36 | Many browsers implement a "sign and encrypt" option which is simply an | ||
| 37 | S/MIME envelopedData containing an S/MIME signed message. | ||
| 38 | This can be readily produced by storing the S/MIME signed message in a | ||
| 39 | memory BIO and passing it to | ||
| 40 | .Fn CMS_encrypt . | ||
| 41 | .Pp | ||
| 42 | The following flags can be passed in the | ||
| 43 | .Fa flags | ||
| 44 | parameter: | ||
| 45 | .Pp | ||
| 46 | If the | ||
| 47 | .Dv CMS_TEXT | ||
| 48 | flag is set, MIME headers for type | ||
| 49 | .Sy text/plain | ||
| 50 | are prepended to the data. | ||
| 51 | .Pp | ||
| 52 | Normally the supplied content is translated into MIME canonical format | ||
| 53 | (as required by the S/MIME specifications); if | ||
| 54 | .Dv CMS_BINARY | ||
| 55 | is set, no translation occurs. | ||
| 56 | This option should be used if the supplied data is in binary format; | ||
| 57 | otherwise the translation will corrupt it. | ||
| 58 | If | ||
| 59 | .Dv CMS_BINARY | ||
| 60 | is set then | ||
| 61 | .Dv CMS_TEXT | ||
| 62 | is ignored. | ||
| 63 | .Pp | ||
| 64 | OpenSSL will by default identify recipient certificates using issuer | ||
| 65 | name and serial number. | ||
| 66 | If | ||
| 67 | .Dv CMS_USE_KEYID | ||
| 68 | is set, it will use the subject key identifier value instead. | ||
| 69 | An error occurs if all recipient certificates do not have a subject key | ||
| 70 | identifier extension. | ||
| 71 | .Pp | ||
| 72 | If the | ||
| 73 | .Dv CMS_STREAM | ||
| 74 | flag is set, a partial | ||
| 75 | .Vt CMS_ContentInfo | ||
| 76 | structure is returned suitable for streaming I/O: no data is read from the | ||
| 77 | .Vt BIO | ||
| 78 | .Fa in . | ||
| 79 | .Pp | ||
| 80 | If the | ||
| 81 | .Dv CMS_PARTIAL | ||
| 82 | flag is set, a partial | ||
| 83 | .Vt CMS_ContentInfo | ||
| 84 | structure is returned to which additional recipients and attributes can | ||
| 85 | be added before finalization. | ||
| 86 | .Pp | ||
| 87 | The data being encrypted is included in the | ||
| 88 | .Vt CMS_ContentInfo | ||
| 89 | structure, unless | ||
| 90 | .Dv CMS_DETACHED | ||
| 91 | is set, in which case it is omitted. | ||
| 92 | This is rarely used in practice and is not supported by | ||
| 93 | .Xr SMIME_write_CMS 3 . | ||
| 94 | .Pp | ||
| 95 | If the flag | ||
| 96 | .Dv CMS_STREAM | ||
| 97 | is set, the returned | ||
| 98 | .Vt CMS_ContentInfo | ||
| 99 | structure is | ||
| 100 | .Em not | ||
| 101 | complete and outputting its contents via a function that does not | ||
| 102 | properly finalize the | ||
| 103 | .Vt CMS_ContentInfo | ||
| 104 | structure will give unpredictable results. | ||
| 105 | .Pp | ||
| 106 | Several functions including | ||
| 107 | .Xr SMIME_write_CMS 3 , | ||
| 108 | .Xr i2d_CMS_bio_stream 3 , | ||
| 109 | .Xr PEM_write_bio_CMS_stream 3 | ||
| 110 | finalize the structure. | ||
| 111 | Alternatively finalization can be performed by obtaining the streaming | ||
| 112 | ASN1 | ||
| 113 | .Vt BIO | ||
| 114 | directly using | ||
| 115 | .Xr BIO_new_CMS 3 . | ||
| 116 | .Pp | ||
| 117 | The recipients specified in | ||
| 118 | .Fa certs | ||
| 119 | use a CMS KeyTransRecipientInfo info structure. | ||
| 120 | KEKRecipientInfo is also supported using the flag | ||
| 121 | .Dv CMS_PARTIAL | ||
| 122 | and | ||
| 123 | .Xr CMS_add0_recipient_key 3 . | ||
| 124 | .Pp | ||
| 125 | The parameter | ||
| 126 | .Fa certs | ||
| 127 | may be | ||
| 128 | .Dv NULL | ||
| 129 | if | ||
| 130 | .Dv CMS_PARTIAL | ||
| 131 | is set and recipients are added later using | ||
| 132 | .Xr CMS_add1_recipient_cert 3 | ||
| 133 | or | ||
| 134 | .Xr CMS_add0_recipient_key 3 . | ||
| 135 | .Sh RETURN VALUES | ||
| 136 | .Fn CMS_encrypt | ||
| 137 | returns either a | ||
| 138 | .Vt CMS_ContentInfo | ||
| 139 | structure or | ||
| 140 | .Dv NULL | ||
| 141 | if an error occurred. | ||
| 142 | The error can be obtained from | ||
| 143 | .Xr ERR_get_error 3 . | ||
| 144 | .Sh SEE ALSO | ||
| 145 | .Xr CMS_decrypt 3 , | ||
| 146 | .Xr ERR_get_error 3 | ||
| 147 | .Sh HISTORY | ||
| 148 | .Fn CMS_encrypt | ||
| 149 | was added to OpenSSL 0.9.8. | ||
| 150 | The | ||
| 151 | .Dv CMS_STREAM | ||
| 152 | flag was first supported in OpenSSL 1.0.0. | ||
