diff options
Diffstat (limited to 'src/lib/libcrypto/man')
20 files changed, 2566 insertions, 20 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 8bc8ffb6aa..a76a03c78a 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.45 2016/11/04 10:17:17 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.46 2016/11/04 15:29:03 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
| 4 | 4 | ||
| @@ -153,49 +153,49 @@ MAN= \ | |||
| 153 | SMIME_read_PKCS7.3 \ | 153 | SMIME_read_PKCS7.3 \ |
| 154 | SMIME_write_PKCS7.3 \ | 154 | SMIME_write_PKCS7.3 \ |
| 155 | UI_new.3 \ | 155 | UI_new.3 \ |
| 156 | X509_NAME_ENTRY_get_object.3 \ | ||
| 157 | X509_NAME_add_entry_by_txt.3 \ | ||
| 158 | X509_NAME_get_index_by_NID.3 \ | ||
| 159 | X509_NAME_print_ex.3 \ | ||
| 160 | X509_STORE_CTX_get_error.3 \ | ||
| 161 | X509_STORE_CTX_get_ex_new_index.3 \ | ||
| 162 | X509_STORE_CTX_new.3 \ | ||
| 163 | X509_STORE_CTX_set_verify_cb.3 \ | ||
| 164 | X509_STORE_set_verify_cb_func.3 \ | ||
| 165 | X509_VERIFY_PARAM_set_flags.3 \ | ||
| 166 | X509_new.3 \ | ||
| 167 | X509_verify_cert.3 \ | ||
| 156 | bn_dump.3 \ | 168 | bn_dump.3 \ |
| 157 | crypto.3 \ | 169 | crypto.3 \ |
| 158 | d2i_ASN1_OBJECT.3 \ | 170 | d2i_ASN1_OBJECT.3 \ |
| 159 | d2i_PKCS8PrivateKey_bio.3 \ | 171 | d2i_PKCS8PrivateKey_bio.3 \ |
| 160 | d2i_RSAPublicKey.3 \ | 172 | d2i_RSAPublicKey.3 \ |
| 173 | d2i_X509.3 \ | ||
| 174 | d2i_X509_ALGOR.3 \ | ||
| 175 | d2i_X509_CRL.3 \ | ||
| 176 | d2i_X509_NAME.3 \ | ||
| 177 | d2i_X509_REQ.3 \ | ||
| 178 | d2i_X509_SIG.3 \ | ||
| 161 | des_read_pw.3 \ | 179 | des_read_pw.3 \ |
| 162 | evp.3 \ | 180 | evp.3 \ |
| 163 | i2d_PKCS7_bio_stream.3 \ | 181 | i2d_PKCS7_bio_stream.3 \ |
| 164 | lh_new.3 \ | 182 | lh_new.3 \ |
| 165 | rsa.3 \ | 183 | rsa.3 \ |
| 184 | x509.3 | ||
| 166 | 185 | ||
| 167 | GENMAN= \ | 186 | GENMAN= \ |
| 168 | RC4.3 \ | 187 | RC4.3 \ |
| 169 | RIPEMD160.3 \ | 188 | RIPEMD160.3 \ |
| 170 | SHA1.3 \ | 189 | SHA1.3 \ |
| 171 | X509_NAME_ENTRY_get_object.3 \ | ||
| 172 | X509_NAME_add_entry_by_txt.3 \ | ||
| 173 | X509_NAME_get_index_by_NID.3 \ | ||
| 174 | X509_NAME_print_ex.3 \ | ||
| 175 | X509_STORE_CTX_get_error.3 \ | ||
| 176 | X509_STORE_CTX_get_ex_new_index.3 \ | ||
| 177 | X509_STORE_CTX_new.3 \ | ||
| 178 | X509_STORE_CTX_set_verify_cb.3 \ | ||
| 179 | X509_STORE_set_verify_cb_func.3 \ | ||
| 180 | X509_VERIFY_PARAM_set_flags.3 \ | ||
| 181 | X509_new.3 \ | ||
| 182 | X509_verify_cert.3 \ | ||
| 183 | bn.3 \ | 190 | bn.3 \ |
| 184 | d2i_DHparams.3 \ | 191 | d2i_DHparams.3 \ |
| 185 | d2i_DSAPublicKey.3 \ | 192 | d2i_DSAPublicKey.3 \ |
| 186 | d2i_ECPKParameters.3 \ | 193 | d2i_ECPKParameters.3 \ |
| 187 | d2i_X509.3 \ | ||
| 188 | d2i_X509_ALGOR.3 \ | ||
| 189 | d2i_X509_CRL.3 \ | ||
| 190 | d2i_X509_NAME.3 \ | ||
| 191 | d2i_X509_REQ.3 \ | ||
| 192 | d2i_X509_SIG.3 \ | ||
| 193 | dh.3 \ | 194 | dh.3 \ |
| 194 | dsa.3 \ | 195 | dsa.3 \ |
| 195 | ec.3 \ | 196 | ec.3 \ |
| 196 | engine.3 \ | 197 | engine.3 \ |
| 197 | lh_stats.3 \ | 198 | lh_stats.3 \ |
| 198 | x509.3 \ | ||
| 199 | 199 | ||
| 200 | MAN+= ${GENMAN} | 200 | MAN+= ${GENMAN} |
| 201 | 201 | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 new file mode 100644 index 0000000000..97978ea542 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3 | |||
| @@ -0,0 +1,133 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_NAME_ENTRY_GET_OBJECT 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_NAME_ENTRY_get_object , | ||
| 6 | .Nm X509_NAME_ENTRY_get_data , | ||
| 7 | .Nm X509_NAME_ENTRY_set_object , | ||
| 8 | .Nm X509_NAME_ENTRY_set_data , | ||
| 9 | .Nm X509_NAME_ENTRY_create_by_txt , | ||
| 10 | .Nm X509_NAME_ENTRY_create_by_NID , | ||
| 11 | .Nm X509_NAME_ENTRY_create_by_OBJ | ||
| 12 | .Nd X509_NAME_ENTRY utility functions | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/x509.h | ||
| 15 | .Ft ASN1_OBJECT * | ||
| 16 | .Fo X509_NAME_ENTRY_get_object | ||
| 17 | .Fa "X509_NAME_ENTRY *ne" | ||
| 18 | .Fc | ||
| 19 | .Ft ASN1_STRING * | ||
| 20 | .Fo X509_NAME_ENTRY_get_data | ||
| 21 | .Fa "X509_NAME_ENTRY *ne" | ||
| 22 | .Fc | ||
| 23 | .Ft int | ||
| 24 | .Fo X509_NAME_ENTRY_set_object | ||
| 25 | .Fa "X509_NAME_ENTRY *ne" | ||
| 26 | .Fa "ASN1_OBJECT *obj" | ||
| 27 | .Fc | ||
| 28 | .Ft int | ||
| 29 | .Fo X509_NAME_ENTRY_set_data | ||
| 30 | .Fa "X509_NAME_ENTRY *ne" | ||
| 31 | .Fa "int type" | ||
| 32 | .Fa "const unsigned char *bytes" | ||
| 33 | .Fa "int len" | ||
| 34 | .Fc | ||
| 35 | .Ft X509_NAME_ENTRY * | ||
| 36 | .Fo X509_NAME_ENTRY_create_by_txt | ||
| 37 | .Fa "X509_NAME_ENTRY **ne" | ||
| 38 | .Fa "const char *field" | ||
| 39 | .Fa "int type" | ||
| 40 | .Fa "const unsigned char *bytes" | ||
| 41 | .Fa "int len" | ||
| 42 | .Fc | ||
| 43 | .Ft X509_NAME_ENTRY * | ||
| 44 | .Fo X509_NAME_ENTRY_create_by_NID | ||
| 45 | .Fa "X509_NAME_ENTRY **ne" | ||
| 46 | .Fa "int nid" | ||
| 47 | .Fa "int type" | ||
| 48 | .Fa "unsigned char *bytes" | ||
| 49 | .Fa "int len" | ||
| 50 | .Fc | ||
| 51 | .Ft X509_NAME_ENTRY * | ||
| 52 | .Fo X509_NAME_ENTRY_create_by_OBJ | ||
| 53 | .Fa "X509_NAME_ENTRY **ne" | ||
| 54 | .Fa "ASN1_OBJECT *obj" | ||
| 55 | .Fa "int type" | ||
| 56 | .Fa "const unsigned char *bytes" | ||
| 57 | .Fa "int len" | ||
| 58 | .Fc | ||
| 59 | .Sh DESCRIPTION | ||
| 60 | .Fn X509_NAME_ENTRY_get_object | ||
| 61 | retrieves the field name of | ||
| 62 | .Fa ne | ||
| 63 | in an | ||
| 64 | .Vt ASN1_OBJECT | ||
| 65 | structure. | ||
| 66 | .Pp | ||
| 67 | .Fn X509_NAME_ENTRY_get_data | ||
| 68 | retrieves the field value of | ||
| 69 | .Fa ne | ||
| 70 | in an | ||
| 71 | .Vt ASN1_STRING | ||
| 72 | structure. | ||
| 73 | .Pp | ||
| 74 | .Fn X509_NAME_ENTRY_set_object | ||
| 75 | sets the field name of | ||
| 76 | .Fa ne | ||
| 77 | to | ||
| 78 | .Fa obj . | ||
| 79 | .Pp | ||
| 80 | .Fn X509_NAME_ENTRY_set_data | ||
| 81 | sets the field value of | ||
| 82 | .Fa ne | ||
| 83 | to string type | ||
| 84 | .Fa type | ||
| 85 | and the value determined by | ||
| 86 | .Fa bytes | ||
| 87 | and | ||
| 88 | .Fa len . | ||
| 89 | .Pp | ||
| 90 | .Fn X509_NAME_ENTRY_create_by_txt , | ||
| 91 | .Fn X509_NAME_ENTRY_create_by_NID , | ||
| 92 | and | ||
| 93 | .Fn X509_NAME_ENTRY_create_by_OBJ | ||
| 94 | create and return an | ||
| 95 | .Vt X509_NAME_ENTRY | ||
| 96 | structure. | ||
| 97 | .Pp | ||
| 98 | .Fn X509_NAME_ENTRY_get_object | ||
| 99 | and | ||
| 100 | .Fn X509_NAME_ENTRY_get_data | ||
| 101 | can be used to examine an | ||
| 102 | .Vt X509_NAME_ENTRY | ||
| 103 | function as returned by | ||
| 104 | .Xr X509_NAME_get_entry 3 | ||
| 105 | for example. | ||
| 106 | .Pp | ||
| 107 | .Fn X509_NAME_ENTRY_create_by_txt , | ||
| 108 | .Fn X509_NAME_ENTRY_create_by_OBJ , | ||
| 109 | .Fn X509_NAME_ENTRY_create_by_NID , | ||
| 110 | and | ||
| 111 | .Fn X509_NAME_ENTRY_set_data | ||
| 112 | are seldom used in practice because | ||
| 113 | .Vt X509_NAME_ENTRY | ||
| 114 | structures are almost always part of | ||
| 115 | .Vt X509_NAME | ||
| 116 | structures and the corresponding X509_NAME functions are typically | ||
| 117 | used to create and add new entries in a single operation. | ||
| 118 | .Pp | ||
| 119 | The arguments of these functions support similar options to the | ||
| 120 | similarly named ones of the corresponding X509_NAME functions such as | ||
| 121 | .Xr X509_NAME_add_entry_by_txt 3 . | ||
| 122 | So for example | ||
| 123 | .Fa type | ||
| 124 | can be set to | ||
| 125 | .Dv MBSTRING_ASC , | ||
| 126 | but in the case of | ||
| 127 | .Fn X509_NAME_ENTRY_set_data | ||
| 128 | the field name must be set first so the relevant field information | ||
| 129 | can be looked up internally. | ||
| 130 | .Sh SEE ALSO | ||
| 131 | .Xr d2i_X509_NAME 3 , | ||
| 132 | .Xr ERR_get_error 3 , | ||
| 133 | .Xr OBJ_nid2obj 3 | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 new file mode 100644 index 0000000000..c77763cc68 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3 | |||
| @@ -0,0 +1,212 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_NAME_ADD_ENTRY_BY_TXT 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_NAME_add_entry_by_txt , | ||
| 6 | .Nm X509_NAME_add_entry_by_OBJ , | ||
| 7 | .Nm X509_NAME_add_entry_by_NID , | ||
| 8 | .Nm X509_NAME_add_entry , | ||
| 9 | .Nm X509_NAME_delete_entry | ||
| 10 | .Nd X509_NAME modification functions | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/x509.h | ||
| 13 | .Ft int | ||
| 14 | .Fo X509_NAME_add_entry_by_txt | ||
| 15 | .Fa "X509_NAME *name" | ||
| 16 | .Fa "const char *field" | ||
| 17 | .Fa "int type" | ||
| 18 | .Fa "const unsigned char *bytes" | ||
| 19 | .Fa "int len" | ||
| 20 | .Fa "int loc" | ||
| 21 | .Fa "int set" | ||
| 22 | .Fc | ||
| 23 | .Ft int | ||
| 24 | .Fo X509_NAME_add_entry_by_OBJ | ||
| 25 | .Fa "X509_NAME *name" | ||
| 26 | .Fa "ASN1_OBJECT *obj" | ||
| 27 | .Fa "int type" | ||
| 28 | .Fa "unsigned char *bytes" | ||
| 29 | .Fa "int len" | ||
| 30 | .Fa "int loc" | ||
| 31 | .Fa "int set" | ||
| 32 | .Fc | ||
| 33 | .Ft int | ||
| 34 | .Fo X509_NAME_add_entry_by_NID | ||
| 35 | .Fa "X509_NAME *name" | ||
| 36 | .Fa "int nid" | ||
| 37 | .Fa "int type" | ||
| 38 | .Fa "unsigned char *bytes" | ||
| 39 | .Fa "int len" | ||
| 40 | .Fa "int loc" | ||
| 41 | .Fa "int set" | ||
| 42 | .Fc | ||
| 43 | .Ft int | ||
| 44 | .Fo X509_NAME_add_entry | ||
| 45 | .Fa "X509_NAME *name" | ||
| 46 | .Fa "X509_NAME_ENTRY *ne" | ||
| 47 | .Fa "int loc" | ||
| 48 | .Fa "int set" | ||
| 49 | .Fc | ||
| 50 | .Ft X509_NAME_ENTRY * | ||
| 51 | .Fo X509_NAME_delete_entry | ||
| 52 | .Fa "X509_NAME *name" | ||
| 53 | .Fa "int loc" | ||
| 54 | .Fc | ||
| 55 | .Sh DESCRIPTION | ||
| 56 | .Fn X509_NAME_add_entry_by_txt , | ||
| 57 | .Fn X509_NAME_add_entry_by_OBJ , | ||
| 58 | and | ||
| 59 | .Fn X509_NAME_add_entry_by_NID | ||
| 60 | add a field whose name is defined by a string | ||
| 61 | .Fa field , | ||
| 62 | an object | ||
| 63 | .Fa obj | ||
| 64 | or a NID | ||
| 65 | .Fa nid , | ||
| 66 | respectively. | ||
| 67 | The field value to be added is in | ||
| 68 | .Fa bytes | ||
| 69 | of length | ||
| 70 | .Fa len . | ||
| 71 | If | ||
| 72 | .Fa len | ||
| 73 | is -1 then the field length is calculated internally using | ||
| 74 | .Fn strlen bytes . | ||
| 75 | .Pp | ||
| 76 | The type of field is determined by | ||
| 77 | .Fa type | ||
| 78 | which can either be a definition of the type of | ||
| 79 | .Fa bytes | ||
| 80 | (such as | ||
| 81 | .Dv MBSTRING_ASC ) | ||
| 82 | or a standard ASN1 type (such as | ||
| 83 | .Dv V_ASN1_IA5STRING ) . | ||
| 84 | The new entry is added to a position determined by | ||
| 85 | .Fa loc | ||
| 86 | and | ||
| 87 | .Fa set . | ||
| 88 | .Pp | ||
| 89 | .Fn X509_NAME_add_entry | ||
| 90 | adds a copy of a | ||
| 91 | .Vt X509_NAME_ENTRY | ||
| 92 | structure | ||
| 93 | .Fa ne | ||
| 94 | to | ||
| 95 | .Fa name . | ||
| 96 | The new entry is added to a position determined by | ||
| 97 | .Fa loc | ||
| 98 | and | ||
| 99 | .Fa set . | ||
| 100 | Since a copy of | ||
| 101 | .Fa ne | ||
| 102 | is added, | ||
| 103 | .Fa ne | ||
| 104 | must be freed up after the call. | ||
| 105 | .Pp | ||
| 106 | .Fn X509_NAME_delete_entry | ||
| 107 | deletes an entry from | ||
| 108 | .Fa name | ||
| 109 | at position | ||
| 110 | .Fa loc . | ||
| 111 | The deleted entry is returned and must be freed up. | ||
| 112 | .Pp | ||
| 113 | The use of string types such as | ||
| 114 | .Dv MBSTRING_ASC | ||
| 115 | or | ||
| 116 | .Dv MBSTRING_UTF8 | ||
| 117 | is strongly recommended for the | ||
| 118 | .Fa type | ||
| 119 | parameter. | ||
| 120 | This allows the internal code to correctly determine the type of the | ||
| 121 | field and to apply length checks according to the relevant standards. | ||
| 122 | This is done using | ||
| 123 | .Xr ASN1_STRING_set_by_NID 3 . | ||
| 124 | .Pp | ||
| 125 | If instead an ASN1 type is used, no checks are performed and the supplied | ||
| 126 | data in | ||
| 127 | .Fa bytes | ||
| 128 | is used directly. | ||
| 129 | .Pp | ||
| 130 | In | ||
| 131 | .Fn X509_NAME_add_entry_by_txt | ||
| 132 | the | ||
| 133 | .Fa field | ||
| 134 | string represents the field name using | ||
| 135 | .Fn OBJ_txt2obj field 0 . | ||
| 136 | .Pp | ||
| 137 | The | ||
| 138 | .Fa loc | ||
| 139 | and | ||
| 140 | .Fa set | ||
| 141 | parameters determine where a new entry should be added. | ||
| 142 | For almost all applications, | ||
| 143 | .Fa loc | ||
| 144 | can be set to -1 and | ||
| 145 | .Fa set | ||
| 146 | to 0. | ||
| 147 | This adds a new entry to the end of | ||
| 148 | .Fa name | ||
| 149 | as a single valued RelativeDistinguishedName (RDN). | ||
| 150 | .Pp | ||
| 151 | .Fa loc | ||
| 152 | actually determines the index where the new entry is inserted: | ||
| 153 | if it is -1 it is appended. | ||
| 154 | .Pp | ||
| 155 | .Fa set | ||
| 156 | determines how the new type is added. | ||
| 157 | If it is zero a new RDN is created. | ||
| 158 | .Pp | ||
| 159 | If | ||
| 160 | .Fa set | ||
| 161 | is -1 or 1 it is added to the previous or next RDN structure | ||
| 162 | respectively. | ||
| 163 | This will then be a multivalued RDN: since multivalues RDNs are very | ||
| 164 | seldom used, | ||
| 165 | .Fa set | ||
| 166 | is almost always set to zero. | ||
| 167 | .Sh RETURN VALUES | ||
| 168 | .Fn X509_NAME_add_entry_by_txt , | ||
| 169 | .Fn X509_NAME_add_entry_by_OBJ , | ||
| 170 | .Fn X509_NAME_add_entry_by_NID , | ||
| 171 | and | ||
| 172 | .Fn X509_NAME_add_entry | ||
| 173 | return 1 for success or 0 if an error occurred. | ||
| 174 | .Pp | ||
| 175 | .Fn X509_NAME_delete_entry | ||
| 176 | returns either the deleted | ||
| 177 | .Vt X509_NAME_ENTRY | ||
| 178 | structure or | ||
| 179 | .Dv NULL | ||
| 180 | if an error occurred. | ||
| 181 | .Sh EXAMPLES | ||
| 182 | Create an | ||
| 183 | .Vt X509_NAME | ||
| 184 | structure: | ||
| 185 | .Pp | ||
| 186 | .D1 C=UK, O=Disorganized Organization, CN=Joe Bloggs | ||
| 187 | .Bd -literal | ||
| 188 | X509_NAME *nm; | ||
| 189 | nm = X509_NAME_new(); | ||
| 190 | if (nm == NULL) | ||
| 191 | /* Some error */ | ||
| 192 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
| 193 | "C", "UK", -1, -1, 0)) | ||
| 194 | /* Error */ | ||
| 195 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
| 196 | "O", "Disorganized Organization", -1, -1, 0)) | ||
| 197 | /* Error */ | ||
| 198 | if (!X509_NAME_add_entry_by_txt(nm, MBSTRING_ASC, | ||
| 199 | "CN", "Joe Bloggs", -1, -1, 0)) | ||
| 200 | /* Error */ | ||
| 201 | .Ed | ||
| 202 | .Sh SEE ALSO | ||
| 203 | .Xr d2i_X509_NAME 3 , | ||
| 204 | .Xr ERR_get_error 3 | ||
| 205 | .Sh BUGS | ||
| 206 | .Fa type | ||
| 207 | can still be set to | ||
| 208 | .Dv V_ASN1_APP_CHOOSE | ||
| 209 | to use a different algorithm to determine field types. | ||
| 210 | Since this form does not understand multicharacter types, performs | ||
| 211 | no length checks, and can result in invalid field types, its use | ||
| 212 | is strongly discouraged. | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 new file mode 100644 index 0000000000..4710fd1ec2 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_get_index_by_NID.3 | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_NAME_GET_INDEX_BY_NID 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_NAME_get_index_by_NID , | ||
| 6 | .Nm X509_NAME_get_index_by_OBJ , | ||
| 7 | .Nm X509_NAME_get_entry , | ||
| 8 | .Nm X509_NAME_entry_count , | ||
| 9 | .Nm X509_NAME_get_text_by_NID , | ||
| 10 | .Nm X509_NAME_get_text_by_OBJ | ||
| 11 | .Nd X509_NAME lookup and enumeration functions | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/x509.h | ||
| 14 | .Ft int | ||
| 15 | .Fo X509_NAME_get_index_by_NID | ||
| 16 | .Fa "X509_NAME *name" | ||
| 17 | .Fa "int nid" | ||
| 18 | .Fa "int lastpos" | ||
| 19 | .Fc | ||
| 20 | .Ft int | ||
| 21 | .Fo X509_NAME_get_index_by_OBJ | ||
| 22 | .Fa "X509_NAME *name" | ||
| 23 | .Fa "ASN1_OBJECT *obj" | ||
| 24 | .Fa "int lastpos" | ||
| 25 | .Fc | ||
| 26 | .Ft int | ||
| 27 | .Fo X509_NAME_entry_count | ||
| 28 | .Fa "X509_NAME *name" | ||
| 29 | .Fc | ||
| 30 | .Ft X509_NAME_ENTRY * | ||
| 31 | .Fo X509_NAME_get_entry | ||
| 32 | .Fa "X509_NAME *name" | ||
| 33 | .Fa "int loc" | ||
| 34 | .Fc | ||
| 35 | .Ft int | ||
| 36 | .Fo X509_NAME_get_text_by_NID | ||
| 37 | .Fa "X509_NAME *name" | ||
| 38 | .Fa "int nid" | ||
| 39 | .Fa "char *buf" | ||
| 40 | .Fa "int len" | ||
| 41 | .Fc | ||
| 42 | .Ft int | ||
| 43 | .Fo X509_NAME_get_text_by_OBJ | ||
| 44 | .Fa "X509_NAME *name" | ||
| 45 | .Fa "ASN1_OBJECT *obj" | ||
| 46 | .Fa "char *buf" | ||
| 47 | .Fa "int len" | ||
| 48 | .Fc | ||
| 49 | .Sh DESCRIPTION | ||
| 50 | These functions allow an | ||
| 51 | .Vt X509_NAME | ||
| 52 | structure to be examined. | ||
| 53 | The | ||
| 54 | .Vt X509_NAME | ||
| 55 | structure is the same as the | ||
| 56 | .Sy Name | ||
| 57 | type defined in RFC2459 (and elsewhere) and used for example in | ||
| 58 | certificate subject and issuer names. | ||
| 59 | .Pp | ||
| 60 | .Fn X509_NAME_get_index_by_NID | ||
| 61 | and | ||
| 62 | .Fn X509_NAME_get_index_by_OBJ | ||
| 63 | retrieve the next index matching | ||
| 64 | .Fa nid | ||
| 65 | or | ||
| 66 | .Fa obj | ||
| 67 | after | ||
| 68 | .Fa lastpos . | ||
| 69 | .Fa lastpos | ||
| 70 | should initially be set to -1. | ||
| 71 | If there are no more entries, -1 is returned. | ||
| 72 | .Pp | ||
| 73 | .Fn X509_NAME_entry_count | ||
| 74 | returns the total number of entries in | ||
| 75 | .Fa name . | ||
| 76 | .Pp | ||
| 77 | .Fn X509_NAME_get_entry | ||
| 78 | retrieves the | ||
| 79 | .Vt X509_NAME_ENTRY | ||
| 80 | from | ||
| 81 | .Fa name | ||
| 82 | corresponding to index | ||
| 83 | .Fa loc . | ||
| 84 | Acceptable values for | ||
| 85 | .Fa loc | ||
| 86 | run from 0 to | ||
| 87 | .Fn X509_NAME_entry_count name | ||
| 88 | - 1. | ||
| 89 | The value returned is an internal pointer which must not be freed. | ||
| 90 | .Pp | ||
| 91 | .Fn X509_NAME_get_text_by_NID | ||
| 92 | and | ||
| 93 | .Fn X509_NAME_get_text_by_OBJ | ||
| 94 | retrieve the "text" from the first entry in | ||
| 95 | .Fa name | ||
| 96 | which matches | ||
| 97 | .Fa nid | ||
| 98 | or | ||
| 99 | .Fa obj . | ||
| 100 | If no such entry exists, -1 is returned. | ||
| 101 | At most | ||
| 102 | .Fa len | ||
| 103 | bytes will be written and the text written to | ||
| 104 | .Fa buf | ||
| 105 | will be NUL terminated. | ||
| 106 | The length of the output string written is returned excluding the | ||
| 107 | terminating NUL. | ||
| 108 | If | ||
| 109 | .Fa buf | ||
| 110 | is | ||
| 111 | .Dv NULL | ||
| 112 | then the amount of space needed in | ||
| 113 | .Fa buf | ||
| 114 | (excluding the final NUL) is returned. | ||
| 115 | .Sh RETURN VALUES | ||
| 116 | .Fn X509_NAME_get_index_by_NID | ||
| 117 | and | ||
| 118 | .Fn X509_NAME_get_index_by_OBJ | ||
| 119 | return the index of the next matching entry or -1 if not found. | ||
| 120 | .Pp | ||
| 121 | .Fn X509_NAME_entry_count | ||
| 122 | returns the total number of entries. | ||
| 123 | .Pp | ||
| 124 | .Fn X509_NAME_get_entry | ||
| 125 | returns an | ||
| 126 | .Vt X509_NAME | ||
| 127 | pointer to the requested entry or | ||
| 128 | .Dv NULL | ||
| 129 | if the index is invalid. | ||
| 130 | .Sh EXAMPLES | ||
| 131 | Process all entries: | ||
| 132 | .Bd -literal | ||
| 133 | int i; | ||
| 134 | X509_NAME_ENTRY *e; | ||
| 135 | |||
| 136 | for (i = 0; i < X509_NAME_entry_count(nm); i++) { | ||
| 137 | e = X509_NAME_get_entry(nm, i); | ||
| 138 | /* Do something with e */ | ||
| 139 | } | ||
| 140 | .Ed | ||
| 141 | .Pp | ||
| 142 | Process all commonName entries: | ||
| 143 | .Bd -literal | ||
| 144 | int loc; | ||
| 145 | X509_NAME_ENTRY *e; | ||
| 146 | |||
| 147 | loc = -1; | ||
| 148 | for (;;) { | ||
| 149 | lastpos = X509_NAME_get_index_by_NID(nm, NID_commonName, lastpos); | ||
| 150 | if (lastpos == -1) | ||
| 151 | break; | ||
| 152 | e = X509_NAME_get_entry(nm, lastpos); | ||
| 153 | /* Do something with e */ | ||
| 154 | } | ||
| 155 | .Ed | ||
| 156 | .Sh SEE ALSO | ||
| 157 | .Xr d2i_X509_NAME 3 , | ||
| 158 | .Xr ERR_get_error 3 | ||
| 159 | .Sh CAVEATS | ||
| 160 | .Fn X509_NAME_get_text_by_NID | ||
| 161 | and | ||
| 162 | .Fn X509_NAME_get_text_by_OBJ | ||
| 163 | are legacy functions which have various limitations which make them of | ||
| 164 | minimal use in practice. | ||
| 165 | They can only find the first matching entry and will copy the contents | ||
| 166 | of the field verbatim: this can be highly confusing if the target is a | ||
| 167 | multicharacter string type like a BMPString or a UTF8String. | ||
| 168 | .Pp | ||
| 169 | For a more general solution, | ||
| 170 | .Fn X509_NAME_get_index_by_NID | ||
| 171 | or | ||
| 172 | .Fn X509_NAME_get_index_by_OBJ | ||
| 173 | should be used, followed by | ||
| 174 | .Fn X509_NAME_get_entry | ||
| 175 | on any matching indices and then the various | ||
| 176 | .Vt X509_NAME_ENTRY | ||
| 177 | utility functions on the result. | ||
diff --git a/src/lib/libcrypto/man/X509_NAME_print_ex.3 b/src/lib/libcrypto/man/X509_NAME_print_ex.3 new file mode 100644 index 0000000000..ca5fc61e18 --- /dev/null +++ b/src/lib/libcrypto/man/X509_NAME_print_ex.3 | |||
| @@ -0,0 +1,199 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_NAME_PRINT_EX 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_NAME_print_ex , | ||
| 6 | .Nm X509_NAME_print_ex_fp , | ||
| 7 | .Nm X509_NAME_print , | ||
| 8 | .Nm X509_NAME_oneline | ||
| 9 | .Nd X509_NAME printing routines | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/x509.h | ||
| 12 | .Ft int | ||
| 13 | .Fo X509_NAME_print_ex | ||
| 14 | .Fa "BIO *out" | ||
| 15 | .Fa "X509_NAME *nm" | ||
| 16 | .Fa "int indent" | ||
| 17 | .Fa "unsigned long flags" | ||
| 18 | .Fc | ||
| 19 | .Ft int | ||
| 20 | .Fo X509_NAME_print_ex_fp | ||
| 21 | .Fa "FILE *fp" | ||
| 22 | .Fa "X509_NAME *nm" | ||
| 23 | .Fa "int indent" | ||
| 24 | .Fa "unsigned long flags" | ||
| 25 | .Fc | ||
| 26 | .Ft char * | ||
| 27 | .Fo X509_NAME_oneline | ||
| 28 | .Fa "X509_NAME *a" | ||
| 29 | .Fa "char *buf" | ||
| 30 | .Fa "int size" | ||
| 31 | .Fc | ||
| 32 | .Ft int | ||
| 33 | .Fo X509_NAME_print | ||
| 34 | .Fa "BIO *bp" | ||
| 35 | .Fa "X509_NAME *name" | ||
| 36 | .Fa "int obase" | ||
| 37 | .Fc | ||
| 38 | .Sh DESCRIPTION | ||
| 39 | .Fn X509_NAME_print_ex | ||
| 40 | prints a human readable version of | ||
| 41 | .Fa nm | ||
| 42 | to | ||
| 43 | .Vt BIO | ||
| 44 | .Fa out . | ||
| 45 | Each line (for multiline formats) is indented by | ||
| 46 | .Fa indent | ||
| 47 | spaces. | ||
| 48 | The output format can be extensively customised by use of the | ||
| 49 | .Fa flags | ||
| 50 | parameter. | ||
| 51 | .Pp | ||
| 52 | .Fn X509_NAME_print_ex_fp | ||
| 53 | is identical to | ||
| 54 | .Fn X509_NAME_print_ex | ||
| 55 | except the output is written to the | ||
| 56 | .Vt FILE | ||
| 57 | pointer | ||
| 58 | .Fa fp . | ||
| 59 | .Pp | ||
| 60 | .Fn X509_NAME_oneline | ||
| 61 | prints an ASCII version of | ||
| 62 | .Fa a | ||
| 63 | to | ||
| 64 | .Fa buf . | ||
| 65 | At most | ||
| 66 | .Fa size | ||
| 67 | bytes will be written. | ||
| 68 | If | ||
| 69 | .Fa buf | ||
| 70 | is | ||
| 71 | .Dv NULL , | ||
| 72 | then a buffer is dynamically allocated and returned, otherwise | ||
| 73 | .Fa buf | ||
| 74 | is returned. | ||
| 75 | .Pp | ||
| 76 | .Fn X509_NAME_print | ||
| 77 | prints out | ||
| 78 | .Fa name | ||
| 79 | to | ||
| 80 | .Fa bp | ||
| 81 | indenting each line by | ||
| 82 | .Fa obase | ||
| 83 | characters. | ||
| 84 | Multiple lines are used if the output (including indent) exceeds 80 | ||
| 85 | characters. | ||
| 86 | .Pp | ||
| 87 | The functions | ||
| 88 | .Fn X509_NAME_oneline | ||
| 89 | and | ||
| 90 | .Fn X509_NAME_print | ||
| 91 | are legacy functions which produce a non standard output form. | ||
| 92 | They don't handle multi character fields and have various quirks | ||
| 93 | and inconsistencies. | ||
| 94 | Their use is strongly discouraged in new applications. | ||
| 95 | .Pp | ||
| 96 | Although there are a large number of possible flags, for most purposes | ||
| 97 | .Dv XN_FLAG_ONELINE , | ||
| 98 | .Dv XN_FLAG_MULTILINE , | ||
| 99 | or | ||
| 100 | .Dv XN_FLAG_RFC2253 | ||
| 101 | will suffice. | ||
| 102 | As noted on the | ||
| 103 | .Xr ASN1_STRING_print_ex 3 | ||
| 104 | manual page, for UTF-8 terminals the | ||
| 105 | .Dv ASN1_STRFLGS_ESC_MSB | ||
| 106 | should be unset: so for example | ||
| 107 | .Dv XN_FLAG_ONELINE No & Pf ~ Dv ASN1_STRFLGS_ESC_MSB | ||
| 108 | would be used. | ||
| 109 | .Pp | ||
| 110 | The complete set of the flags supported by | ||
| 111 | .Dv X509_NAME_print_ex | ||
| 112 | is listed below. | ||
| 113 | .Pp | ||
| 114 | Several options can be OR'ed together. | ||
| 115 | .Pp | ||
| 116 | The options | ||
| 117 | .Dv XN_FLAG_SEP_COMMA_PLUS , | ||
| 118 | .Dv XN_FLAG_SEP_CPLUS_SPC , | ||
| 119 | .Dv XN_FLAG_SEP_SPLUS_SPC , | ||
| 120 | and | ||
| 121 | .Dv XN_FLAG_SEP_MULTILINE | ||
| 122 | determine the field separators to use. | ||
| 123 | Two distinct separators are used between distinct | ||
| 124 | RelativeDistinguishedName components and separate values in the same RDN | ||
| 125 | for a multi-valued RDN. | ||
| 126 | Multi-valued RDNs are currently very rare so the second separator | ||
| 127 | will hardly ever be used. | ||
| 128 | .Pp | ||
| 129 | .Dv XN_FLAG_SEP_COMMA_PLUS | ||
| 130 | uses comma and plus as separators. | ||
| 131 | .Dv XN_FLAG_SEP_CPLUS_SPC | ||
| 132 | uses comma and plus with spaces: | ||
| 133 | this is more readable that plain comma and plus. | ||
| 134 | .Dv XN_FLAG_SEP_SPLUS_SPC | ||
| 135 | uses spaced semicolon and plus. | ||
| 136 | .Dv XN_FLAG_SEP_MULTILINE | ||
| 137 | uses spaced newline and plus respectively. | ||
| 138 | .Pp | ||
| 139 | If | ||
| 140 | .Dv XN_FLAG_DN_REV | ||
| 141 | is set, the whole DN is printed in reversed order. | ||
| 142 | .Pp | ||
| 143 | The fields | ||
| 144 | .Dv XN_FLAG_FN_SN , | ||
| 145 | .Dv XN_FLAG_FN_LN , | ||
| 146 | .Dv XN_FLAG_FN_OID , | ||
| 147 | and | ||
| 148 | .Dv XN_FLAG_FN_NONE | ||
| 149 | determine how a field name is displayed. | ||
| 150 | It will use the short name (e.g. CN) the long name (e.g. commonName) | ||
| 151 | always use OID numerical form (normally OIDs are only used if the | ||
| 152 | field name is not recognised) and no field name respectively. | ||
| 153 | .Pp | ||
| 154 | If | ||
| 155 | .Dv XN_FLAG_SPC_EQ | ||
| 156 | is set, then spaces will be placed around the | ||
| 157 | .Ql = | ||
| 158 | character separating field names and values. | ||
| 159 | .Pp | ||
| 160 | If | ||
| 161 | .Dv XN_FLAG_DUMP_UNKNOWN_FIELDS | ||
| 162 | is set, then the encoding of unknown fields is printed instead of the | ||
| 163 | values. | ||
| 164 | .Pp | ||
| 165 | If | ||
| 166 | .Dv XN_FLAG_FN_ALIGN | ||
| 167 | is set, then field names are padded to 20 characters: | ||
| 168 | this is only of use for multiline format. | ||
| 169 | .Pp | ||
| 170 | Additionally, all the options supported by | ||
| 171 | .Xr ASN1_STRING_print_ex 3 | ||
| 172 | can be used to control how each field value is displayed. | ||
| 173 | .Pp | ||
| 174 | In addition a number options can be set for commonly used formats. | ||
| 175 | .Pp | ||
| 176 | .Dv XN_FLAG_RFC2253 | ||
| 177 | sets options which produce an output compatible with RFC2253. | ||
| 178 | It is equivalent to | ||
| 179 | .Dv ASN1_STRFLGS_RFC2253 | XN_FLAG_SEP_COMMA_PLUS | XN_FLAG_DN_REV | | ||
| 180 | .Dv XN_FLAG_FN_SN | XN_FLAG_DUMP_UNKNOWN_FIELDS . | ||
| 181 | .Pp | ||
| 182 | .Dv XN_FLAG_ONELINE | ||
| 183 | is a more readable one line format which is the same as: | ||
| 184 | .Dv ASN1_STRFLGS_RFC2253 | ASN1_STRFLGS_ESC_QUOTE | XN_FLAG_SEP_CPLUS_SPC | | ||
| 185 | .Dv XN_FLAG_SPC_EQ | XN_FLAG_FN_SN . | ||
| 186 | .Pp | ||
| 187 | .Dv XN_FLAG_MULTILINE | ||
| 188 | is a multiline format which is the same as: | ||
| 189 | .Dv ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | XN_FLAG_SEP_MULTILINE | | ||
| 190 | .Dv XN_FLAG_SPC_EQ | XN_FLAG_FN_LN | XN_FLAG_FN_ALIGN . | ||
| 191 | .Pp | ||
| 192 | .Dv XN_FLAG_COMPAT | ||
| 193 | uses a format identical to | ||
| 194 | .Fn X509_NAME_print : | ||
| 195 | in fact it calls | ||
| 196 | .Fn X509_NAME_print | ||
| 197 | internally. | ||
| 198 | .Sh SEE ALSO | ||
| 199 | .Xr ASN1_STRING_print_ex 3 | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 new file mode 100644 index 0000000000..f31e438cde --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_error.3 | |||
| @@ -0,0 +1,297 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_STORE_CTX_GET_ERROR 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_STORE_CTX_get_error , | ||
| 6 | .Nm X509_STORE_CTX_set_error , | ||
| 7 | .Nm X509_STORE_CTX_get_error_depth , | ||
| 8 | .Nm X509_STORE_CTX_get_current_cert , | ||
| 9 | .Nm X509_STORE_CTX_get1_chain , | ||
| 10 | .Nm X509_verify_cert_error_string | ||
| 11 | .Nd get or set certificate verification status information | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/x509.h | ||
| 14 | .In openssl/x509_vfy.h | ||
| 15 | .Ft int | ||
| 16 | .Fo X509_STORE_CTX_get_error | ||
| 17 | .Fa "X509_STORE_CTX *ctx" | ||
| 18 | .Fc | ||
| 19 | .Ft void | ||
| 20 | .Fo X509_STORE_CTX_set_error | ||
| 21 | .Fa "X509_STORE_CTX *ctx" | ||
| 22 | .Fa "int s" | ||
| 23 | .Fc | ||
| 24 | .Ft int | ||
| 25 | .Fo X509_STORE_CTX_get_error_depth | ||
| 26 | .Fa "X509_STORE_CTX *ctx" | ||
| 27 | .Fc | ||
| 28 | .Ft X509 * | ||
| 29 | .Fo X509_STORE_CTX_get_current_cert | ||
| 30 | .Fa "X509_STORE_CTX *ctx" | ||
| 31 | .Fc | ||
| 32 | .Ft STACK_OF(X509) * | ||
| 33 | .Fo X509_STORE_CTX_get1_chain | ||
| 34 | .Fa "X509_STORE_CTX *ctx" | ||
| 35 | .Fc | ||
| 36 | .Ft const char * | ||
| 37 | .Fo X509_verify_cert_error_string | ||
| 38 | .Fa "long n" | ||
| 39 | .Fc | ||
| 40 | .Sh DESCRIPTION | ||
| 41 | These functions are typically called after | ||
| 42 | .Xr X509_verify_cert 3 | ||
| 43 | has indicated an error or in a verification callback to determine the | ||
| 44 | nature of an error. | ||
| 45 | .Pp | ||
| 46 | .Fn X509_STORE_CTX_get_error | ||
| 47 | returns the error code of | ||
| 48 | .Fa ctx . | ||
| 49 | See the | ||
| 50 | .Sy ERROR CODES | ||
| 51 | section for a full description of all error codes. | ||
| 52 | .Pp | ||
| 53 | .Fn X509_STORE_CTX_set_error | ||
| 54 | sets the error code of | ||
| 55 | .Fa ctx | ||
| 56 | to | ||
| 57 | .Fa s . | ||
| 58 | For example it might be used in a verification callback to set an error | ||
| 59 | based on additional checks. | ||
| 60 | .Pp | ||
| 61 | .Fn X509_STORE_CTX_get_error_depth | ||
| 62 | returns the depth of the error. | ||
| 63 | This is a non-negative integer representing where in the certificate | ||
| 64 | chain the error occurred. | ||
| 65 | If it is zero, it occurred in the end entity certificate, one if it is | ||
| 66 | the certificate which signed the end entity certificate, and so on. | ||
| 67 | .Pp | ||
| 68 | .Fn X509_STORE_CTX_get_current_cert | ||
| 69 | returns the certificate in | ||
| 70 | .Fa ctx | ||
| 71 | which caused the error or | ||
| 72 | .Dv NULL | ||
| 73 | if no certificate is relevant. | ||
| 74 | .Pp | ||
| 75 | .Fn X509_STORE_CTX_get1_chain | ||
| 76 | returns a complete validate chain if a previous call to | ||
| 77 | .Xr X509_verify_cert 3 | ||
| 78 | is successful. | ||
| 79 | If the call to | ||
| 80 | .Xr X509_verify_cert 3 | ||
| 81 | is | ||
| 82 | .Sy not | ||
| 83 | successful, the returned chain may be incomplete or invalid. | ||
| 84 | The returned chain persists after the | ||
| 85 | .Fa ctx | ||
| 86 | structure is freed. | ||
| 87 | When it is no longer needed, it should be free up using | ||
| 88 | .Fn sk_X509_pop_free chain X509_free . | ||
| 89 | .Pp | ||
| 90 | .Fn X509_verify_cert_error_string | ||
| 91 | returns a human readable error string for verification error | ||
| 92 | .Fa n . | ||
| 93 | .Pp | ||
| 94 | The above functions should be used instead of directly referencing the | ||
| 95 | fields in the | ||
| 96 | .Sy X509_VERIFY_CTX | ||
| 97 | structure. | ||
| 98 | .Pp | ||
| 99 | In versions of OpenSSL before 1.0, the current certificate returned by | ||
| 100 | .Fn X509_STORE_CTX_get_current_cert | ||
| 101 | was never | ||
| 102 | .Dv NULL . | ||
| 103 | Applications should check the return value before printing out any | ||
| 104 | debugging information relating to the current certificate. | ||
| 105 | .Pp | ||
| 106 | If an unrecognised error code is passed to | ||
| 107 | .Fn X509_verify_cert_error_string , | ||
| 108 | the numerical value of the unknown code is returned in a static buffer. | ||
| 109 | This is not thread safe but will never happen unless an invalid code is | ||
| 110 | passed. | ||
| 111 | .Sh RETURN VALUES | ||
| 112 | .Fn X509_STORE_CTX_get_error | ||
| 113 | returns | ||
| 114 | .Dv X509_V_OK | ||
| 115 | or an error code. | ||
| 116 | .Pp | ||
| 117 | .Fn X509_STORE_CTX_get_error_depth | ||
| 118 | returns a non-negative error depth. | ||
| 119 | .Pp | ||
| 120 | .Fn X509_STORE_CTX_get_current_cert | ||
| 121 | returns the certificate which caused the error or | ||
| 122 | .Dv NULL | ||
| 123 | if no certificate is relevant to the error. | ||
| 124 | .Pp | ||
| 125 | .Fn X509_verify_cert_error_string | ||
| 126 | returns a human readable error string for verification error | ||
| 127 | .Fa n . | ||
| 128 | .Sh ERROR CODES | ||
| 129 | A list of error codes and messages is shown below. | ||
| 130 | Some of the error codes are defined but currently never returned: | ||
| 131 | these are described as "unused". | ||
| 132 | .Bl -tag -width Ds | ||
| 133 | .It Dv X509_V_OK : No ok | ||
| 134 | The operation was successful. | ||
| 135 | .It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT : \ | ||
| 136 | No unable to get issuer certificate | ||
| 137 | The issuer certificate could not be found: this occurs if the issuer | ||
| 138 | certificate of an untrusted certificate cannot be found. | ||
| 139 | .It Dv X509_V_ERR_UNABLE_TO_GET_CRL : No unable to get certificate CRL | ||
| 140 | The CRL of a certificate could not be found. | ||
| 141 | .It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE : \ | ||
| 142 | No unable to decrypt certificate's signature | ||
| 143 | The certificate signature could not be decrypted. | ||
| 144 | This means that the actual signature value could not be determined | ||
| 145 | rather than it not matching the expected value, this is only meaningful | ||
| 146 | for RSA keys. | ||
| 147 | .It Dv X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE : \ | ||
| 148 | No unable to decrypt CRL's signature | ||
| 149 | The CRL signature could not be decrypted: this means that the actual | ||
| 150 | signature value could not be determined rather than it not matching the | ||
| 151 | expected value. | ||
| 152 | Unused. | ||
| 153 | .It Dv X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY : \ | ||
| 154 | No unable to decode issuer public key | ||
| 155 | The public key in the certificate SubjectPublicKeyInfo could not be read. | ||
| 156 | .It Dv X509_V_ERR_CERT_SIGNATURE_FAILURE : No certificate signature failure | ||
| 157 | The signature of the certificate is invalid. | ||
| 158 | .It Dv X509_V_ERR_CRL_SIGNATURE_FAILURE : No CRL signature failure | ||
| 159 | The signature of the certificate is invalid. | ||
| 160 | .It Dv X509_V_ERR_CERT_NOT_YET_VALID : No certificate is not yet valid | ||
| 161 | The certificate is not yet valid: the notBefore date is after the | ||
| 162 | current time. | ||
| 163 | .It Dv X509_V_ERR_CERT_HAS_EXPIRED : No certificate has expired | ||
| 164 | The certificate has expired: that is the notAfter date is before the | ||
| 165 | current time. | ||
| 166 | .It Dv X509_V_ERR_CRL_NOT_YET_VALID : No CRL is not yet valid | ||
| 167 | The CRL is not yet valid. | ||
| 168 | .It Dv X509_V_ERR_CRL_HAS_EXPIRED : No CRL has expired | ||
| 169 | The CRL has expired. | ||
| 170 | .It Dv X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD : \ | ||
| 171 | No format error in certificate's notBefore field | ||
| 172 | The certificate notBefore field contains an invalid time. | ||
| 173 | .It Dv X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD : \ | ||
| 174 | No format error in certificate's notAfter field | ||
| 175 | The certificate notAfter field contains an invalid time. | ||
| 176 | .It Dv X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD : \ | ||
| 177 | No format error in CRL's lastUpdate field | ||
| 178 | The CRL lastUpdate field contains an invalid time. | ||
| 179 | .It Dv X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD : \ | ||
| 180 | No format error in CRL's nextUpdate field | ||
| 181 | The CRL nextUpdate field contains an invalid time. | ||
| 182 | .It Dv X509_V_ERR_OUT_OF_MEM : No out of memory | ||
| 183 | An error occurred trying to allocate memory. | ||
| 184 | This should never happen. | ||
| 185 | .It Dv X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT : No self signed certificate | ||
| 186 | The passed certificate is self signed and the same certificate cannot be | ||
| 187 | found in the list of trusted certificates. | ||
| 188 | .It Dv X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN : \ | ||
| 189 | No self signed certificate in certificate chain | ||
| 190 | The certificate chain could be built up using the untrusted certificates | ||
| 191 | but the root could not be found locally. | ||
| 192 | .It Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY : \ | ||
| 193 | No unable to get local issuer certificate | ||
| 194 | The issuer certificate of a locally looked up certificate could not be found. | ||
| 195 | This normally means the list of trusted certificates is not complete. | ||
| 196 | .It Dv X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE : \ | ||
| 197 | No unable to verify the first certificate | ||
| 198 | No signatures could be verified because the chain contains only one | ||
| 199 | certificate and it is not self signed. | ||
| 200 | .It Dv X509_V_ERR_CERT_CHAIN_TOO_LONG : No certificate chain too long | ||
| 201 | The certificate chain length is greater than the supplied maximum depth. | ||
| 202 | Unused. | ||
| 203 | .It Dv X509_V_ERR_CERT_REVOKED : No certificate revoked | ||
| 204 | The certificate has been revoked. | ||
| 205 | .It Dv X509_V_ERR_INVALID_CA : No invalid CA certificate | ||
| 206 | A CA certificate is invalid. | ||
| 207 | Either it is not a CA or its extensions are not consistent with the | ||
| 208 | supplied purpose. | ||
| 209 | .It Dv X509_V_ERR_PATH_LENGTH_EXCEEDED : No path length constraint exceeded | ||
| 210 | The basicConstraints pathlength parameter has been exceeded. | ||
| 211 | .It Dv X509_V_ERR_INVALID_PURPOSE : No unsupported certificate purpose | ||
| 212 | The supplied certificate cannot be used for the specified purpose. | ||
| 213 | .It Dv X509_V_ERR_CERT_UNTRUSTED : No certificate not trusted | ||
| 214 | The root CA is not marked as trusted for the specified purpose. | ||
| 215 | .It Dv X509_V_ERR_CERT_REJECTED : No certificate rejected | ||
| 216 | The root CA is marked to reject the specified purpose. | ||
| 217 | .It Dv X509_V_ERR_SUBJECT_ISSUER_MISMATCH : No subject issuer mismatch | ||
| 218 | The current candidate issuer certificate was rejected because its | ||
| 219 | subject name did not match the issuer name of the current certificate. | ||
| 220 | This is only set if issuer check debugging is enabled it is used for | ||
| 221 | status notification and is | ||
| 222 | .Sy not | ||
| 223 | in itself an error. | ||
| 224 | .It Dv X509_V_ERR_AKID_SKID_MISMATCH : \ | ||
| 225 | No authority and subject key identifier mismatch | ||
| 226 | The current candidate issuer certificate was rejected because its | ||
| 227 | subject key identifier was present and did not match the authority key | ||
| 228 | identifier current certificate. | ||
| 229 | This is only set if issuer check debugging is enabled it is used for | ||
| 230 | status notification and is | ||
| 231 | .Sy not | ||
| 232 | in itself an error. | ||
| 233 | .It Dv X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH : \ | ||
| 234 | Noauthority and issuer serial number mismatch | ||
| 235 | The current candidate issuer certificate was rejected because its issuer | ||
| 236 | name and serial number was present and did not match the authority key | ||
| 237 | identifier of the current certificate. | ||
| 238 | This is only set if issuer check debugging is enabled it is used for | ||
| 239 | status notification and is | ||
| 240 | .Sy not | ||
| 241 | in itself an error. | ||
| 242 | .It Dv X509_V_ERR_KEYUSAGE_NO_CERTSIGN : \ | ||
| 243 | No key usage does not include certificate signing | ||
| 244 | The current candidate issuer certificate was rejected because its | ||
| 245 | keyUsage extension does not permit certificate signing. | ||
| 246 | This is only set if issuer check debugging is enabled it is used for | ||
| 247 | status notification and is | ||
| 248 | .Sy not | ||
| 249 | in itself an error. | ||
| 250 | .It Dv X509_V_ERR_INVALID_EXTENSION : \ | ||
| 251 | No invalid or inconsistent certificate extension | ||
| 252 | A certificate extension had an invalid value (for example an incorrect | ||
| 253 | encoding) or some value inconsistent with other extensions. | ||
| 254 | .It Dv X509_V_ERR_INVALID_POLICY_EXTENSION : \ | ||
| 255 | No invalid or inconsistent certificate policy extension | ||
| 256 | A certificate policies extension had an invalid value (for example an | ||
| 257 | incorrect encoding) or some value inconsistent with other extensions. | ||
| 258 | This error only occurs if policy processing is enabled. | ||
| 259 | .It Dv X509_V_ERR_NO_EXPLICIT_POLICY : No no explicit policy | ||
| 260 | The verification flags were set to require and explicit policy but none | ||
| 261 | was present. | ||
| 262 | .It Dv X509_V_ERR_DIFFERENT_CRL_SCOPE : No different CRL scope | ||
| 263 | The only CRLs that could be found did not match the scope of the | ||
| 264 | certificate. | ||
| 265 | .It Dv X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE : \ | ||
| 266 | No unsupported extension feature | ||
| 267 | Some feature of a certificate extension is not supported. | ||
| 268 | Unused. | ||
| 269 | .It Dv X509_V_ERR_PERMITTED_VIOLATION : No permitted subtree violation | ||
| 270 | A name constraint violation occurred in the permitted subtrees. | ||
| 271 | .It Dv X509_V_ERR_EXCLUDED_VIOLATION : No excluded subtree violation | ||
| 272 | A name constraint violation occurred in the excluded subtrees. | ||
| 273 | .It Dv X509_V_ERR_SUBTREE_MINMAX : \ | ||
| 274 | No name constraints minimum and maximum not supported | ||
| 275 | A certificate name constraints extension included a minimum or maximum | ||
| 276 | field: this is not supported. | ||
| 277 | .It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE : \ | ||
| 278 | No unsupported name constraint type | ||
| 279 | An unsupported name constraint type was encountered. | ||
| 280 | OpenSSL currently only supports directory name, DNS name, email and URI | ||
| 281 | types. | ||
| 282 | .It Dv X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX : \ | ||
| 283 | No unsupported or invalid name constraint syntax | ||
| 284 | The format of the name constraint is not recognised: for example an | ||
| 285 | email address format of a form not mentioned in RFC3280. | ||
| 286 | This could be caused by a garbage extension or some new feature not | ||
| 287 | currently supported. | ||
| 288 | .It Dv X509_V_ERR_CRL_PATH_VALIDATION_ERROR : No CRL path validation error | ||
| 289 | An error occurred when attempting to verify the CRL path. | ||
| 290 | This error can only happen if extended CRL checking is enabled. | ||
| 291 | .It Dv X509_V_ERR_APPLICATION_VERIFICATION : \ | ||
| 292 | No application verification failure | ||
| 293 | An application specific error. | ||
| 294 | This will never be returned unless explicitly set by an application. | ||
| 295 | .El | ||
| 296 | .Sh SEE ALSO | ||
| 297 | .Xr X509_verify_cert 3 | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 new file mode 100644 index 0000000000..511933d4a1 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_get_ex_new_index.3 | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_STORE_CTX_GET_EX_NEW_INDEX 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_STORE_CTX_get_ex_new_index , | ||
| 6 | .Nm X509_STORE_CTX_set_ex_data , | ||
| 7 | .Nm X509_STORE_CTX_get_ex_data | ||
| 8 | .Nd add application specific data to X509_STORE_CTX structures | ||
| 9 | .Sh SYNOPSIS | ||
| 10 | .In openssl/x509_vfy.h | ||
| 11 | .Ft int | ||
| 12 | .Fo X509_STORE_CTX_get_ex_new_index | ||
| 13 | .Fa "long argl" | ||
| 14 | .Fa "void *argp" | ||
| 15 | .Fa "CRYPTO_EX_new *new_func" | ||
| 16 | .Fa "CRYPTO_EX_dup *dup_func" | ||
| 17 | .Fa "CRYPTO_EX_free *free_func" | ||
| 18 | .Fc | ||
| 19 | .Ft int | ||
| 20 | .Fo X509_STORE_CTX_set_ex_data | ||
| 21 | .Fa "X509_STORE_CTX *d" | ||
| 22 | .Fa "int idx" | ||
| 23 | .Fa "void *arg" | ||
| 24 | .Fc | ||
| 25 | .Ft void * | ||
| 26 | .Fo X509_STORE_CTX_get_ex_data | ||
| 27 | .Fa "X509_STORE_CTX *d" | ||
| 28 | .Fa "int idx" | ||
| 29 | .Fc | ||
| 30 | .Sh DESCRIPTION | ||
| 31 | These functions handle application specific data in | ||
| 32 | .Vt X509_STORE_CTX | ||
| 33 | structures. | ||
| 34 | Their usage is identical to that of | ||
| 35 | .Xr RSA_get_ex_new_index 3 , | ||
| 36 | .Xr RSA_set_ex_data 3 , | ||
| 37 | and | ||
| 38 | .Xr RSA_get_ex_data 3 . | ||
| 39 | .Pp | ||
| 40 | This mechanism is used internally by the | ||
| 41 | .Xr ssl 3 | ||
| 42 | library to store the | ||
| 43 | .Vt SSL | ||
| 44 | structure associated with a verification operation in an | ||
| 45 | .Vt X509_STORE_CTX | ||
| 46 | structure. | ||
| 47 | .Sh SEE ALSO | ||
| 48 | .Xr RSA_get_ex_new_index 3 | ||
| 49 | .Sh HISTORY | ||
| 50 | .Fn X509_STORE_CTX_get_ex_new_index , | ||
| 51 | .Fn X509_STORE_CTX_set_ex_data , | ||
| 52 | and | ||
| 53 | .Fn X509_STORE_CTX_get_ex_data | ||
| 54 | are available since OpenSSL 0.9.5. | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_new.3 b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 new file mode 100644 index 0000000000..6a4b9e3e53 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_new.3 | |||
| @@ -0,0 +1,229 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_STORE_CTX_NEW 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_STORE_CTX_new , | ||
| 6 | .Nm X509_STORE_CTX_cleanup , | ||
| 7 | .Nm X509_STORE_CTX_free , | ||
| 8 | .Nm X509_STORE_CTX_init , | ||
| 9 | .Nm X509_STORE_CTX_trusted_stack , | ||
| 10 | .Nm X509_STORE_CTX_set_cert , | ||
| 11 | .Nm X509_STORE_CTX_set_chain , | ||
| 12 | .Nm X509_STORE_CTX_set0_crls , | ||
| 13 | .Nm X509_STORE_CTX_get0_param , | ||
| 14 | .Nm X509_STORE_CTX_set0_param , | ||
| 15 | .Nm X509_STORE_CTX_set_default | ||
| 16 | .Nd X509_STORE_CTX initialisation | ||
| 17 | .Sh SYNOPSIS | ||
| 18 | .In openssl/x509_vfy.h | ||
| 19 | .Ft X509_STORE_CTX * | ||
| 20 | .Fn X509_STORE_CTX_new void | ||
| 21 | .Ft void | ||
| 22 | .Fo X509_STORE_CTX_cleanup | ||
| 23 | .Fa "X509_STORE_CTX *ctx" | ||
| 24 | .Fc | ||
| 25 | .Ft void | ||
| 26 | .Fo X509_STORE_CTX_free | ||
| 27 | .Fa "X509_STORE_CTX *ctx" | ||
| 28 | .Fc | ||
| 29 | .Ft int | ||
| 30 | .Fo X509_STORE_CTX_init | ||
| 31 | .Fa "X509_STORE_CTX *ctx" | ||
| 32 | .Fa "X509_STORE *store" | ||
| 33 | .Fa "X509 *x509" | ||
| 34 | .Fa "STACK_OF(X509) *chain" | ||
| 35 | .Fc | ||
| 36 | .Ft void | ||
| 37 | .Fo X509_STORE_CTX_trusted_stack | ||
| 38 | .Fa "X509_STORE_CTX *ctx" | ||
| 39 | .Fa "STACK_OF(X509) *sk" | ||
| 40 | .Fc | ||
| 41 | .Ft void | ||
| 42 | .Fo X509_STORE_CTX_set_cert | ||
| 43 | .Fa "X509_STORE_CTX *ctx" | ||
| 44 | .Fa "X509 *x" | ||
| 45 | .Fc | ||
| 46 | .Ft void | ||
| 47 | .Fo X509_STORE_CTX_set_chain | ||
| 48 | .Fa "X509_STORE_CTX *ctx" | ||
| 49 | .Fa "STACK_OF(X509) *sk" | ||
| 50 | .Fc | ||
| 51 | .Ft void | ||
| 52 | .Fo X509_STORE_CTX_set0_crls | ||
| 53 | .Fa "X509_STORE_CTX *ctx" | ||
| 54 | .Fa "STACK_OF(X509_CRL) *sk" | ||
| 55 | .Fc | ||
| 56 | .Ft X509_VERIFY_PARAM * | ||
| 57 | .Fo X509_STORE_CTX_get0_param | ||
| 58 | .Fa "X509_STORE_CTX *ctx" | ||
| 59 | .Fc | ||
| 60 | .Ft void | ||
| 61 | .Fo X509_STORE_CTX_set0_param | ||
| 62 | .Fa "X509_STORE_CTX *ctx" | ||
| 63 | .Fa "X509_VERIFY_PARAM *param" | ||
| 64 | .Fc | ||
| 65 | .Ft int | ||
| 66 | .Fo X509_STORE_CTX_set_default | ||
| 67 | .Fa "X509_STORE_CTX *ctx" | ||
| 68 | .Fa "const char *name" | ||
| 69 | .Fc | ||
| 70 | .Sh DESCRIPTION | ||
| 71 | These functions initialise an | ||
| 72 | .Vt X509_STORE_CTX | ||
| 73 | structure for subsequent use by | ||
| 74 | .Xr X509_verify_cert 3 . | ||
| 75 | .Pp | ||
| 76 | .Fn X509_STORE_CTX_new | ||
| 77 | returns a newly initialised | ||
| 78 | .Vt X509_STORE_CTX | ||
| 79 | structure. | ||
| 80 | .Pp | ||
| 81 | .Fn X509_STORE_CTX_cleanup | ||
| 82 | internally cleans up an | ||
| 83 | .Vt X509_STORE_CTX | ||
| 84 | structure. | ||
| 85 | The context can then be reused with an new call to | ||
| 86 | .Fn X509_STORE_CTX_init . | ||
| 87 | .Pp | ||
| 88 | .Fn X509_STORE_CTX_free | ||
| 89 | completely frees up | ||
| 90 | .Fa ctx . | ||
| 91 | After this call | ||
| 92 | .Fa ctx | ||
| 93 | is no longer valid. | ||
| 94 | .Pp | ||
| 95 | .Fn X509_STORE_CTX_init | ||
| 96 | sets up | ||
| 97 | .Fa ctx | ||
| 98 | for a subsequent verification operation. | ||
| 99 | The trusted certificate store is set to | ||
| 100 | .Fa store , | ||
| 101 | the end entity certificate to be verified is set to | ||
| 102 | .Fa x509 | ||
| 103 | and a set of additional certificates (which will be untrusted but may be | ||
| 104 | used to build the chain) in | ||
| 105 | .Fa chain . | ||
| 106 | Any or all of the | ||
| 107 | .Fa store , | ||
| 108 | .Fa x509 , | ||
| 109 | and | ||
| 110 | .Fa chain | ||
| 111 | parameters can be | ||
| 112 | .Dv NULL . | ||
| 113 | .Pp | ||
| 114 | .Fn X509_STORE_CTX_trusted_stack | ||
| 115 | sets the set of trusted certificates of | ||
| 116 | .Fa ctx | ||
| 117 | to | ||
| 118 | .Fa sk . | ||
| 119 | This is an alternative way of specifying trusted certificates instead of | ||
| 120 | using an | ||
| 121 | .Vt X509_STORE . | ||
| 122 | .Pp | ||
| 123 | .Fn X509_STORE_CTX_set_cert | ||
| 124 | sets the certificate to be verified in | ||
| 125 | .Fa ctx | ||
| 126 | to | ||
| 127 | .Fa x . | ||
| 128 | .Pp | ||
| 129 | .Fn X509_STORE_CTX_set_chain | ||
| 130 | sets the additional certificate chain used by | ||
| 131 | .Fa ctx | ||
| 132 | to | ||
| 133 | .Fa sk . | ||
| 134 | .Pp | ||
| 135 | .Fn X509_STORE_CTX_set0_crls | ||
| 136 | sets a set of CRLs to use to aid certificate verification to | ||
| 137 | .Fa sk . | ||
| 138 | These CRLs will only be used if CRL verification is enabled in the | ||
| 139 | associated | ||
| 140 | .Vt X509_VERIFY_PARAM | ||
| 141 | structure. | ||
| 142 | This might be used where additional "useful" CRLs are supplied as part | ||
| 143 | of a protocol, for example in a PKCS#7 structure. | ||
| 144 | .Pp | ||
| 145 | X509_VERIFY_PARAM | ||
| 146 | .Fn X509_STORE_CTX_get0_param | ||
| 147 | retrieves an internal pointer to the verification parameters associated | ||
| 148 | with | ||
| 149 | .Fa ctx . | ||
| 150 | .Pp | ||
| 151 | .Fn X509_STORE_CTX_set0_param | ||
| 152 | sets the internal verification parameter pointer to | ||
| 153 | .Fa param . | ||
| 154 | After this call | ||
| 155 | .Fa param | ||
| 156 | should not be used. | ||
| 157 | .Pp | ||
| 158 | .Fn X509_STORE_CTX_set_default | ||
| 159 | looks up and sets the default verification method to | ||
| 160 | .Fa name . | ||
| 161 | This uses the function | ||
| 162 | .Xr X509_VERIFY_PARAM_lookup 3 | ||
| 163 | to find an appropriate set of parameters from | ||
| 164 | .Fa name . | ||
| 165 | .Pp | ||
| 166 | The certificates and CRLs in a store are used internally and should | ||
| 167 | .Sy not | ||
| 168 | be freed up until after the associated | ||
| 169 | .Vt X509_STORE_CTX | ||
| 170 | is freed. | ||
| 171 | Legacy applications might implicitly use an | ||
| 172 | .Vt X509_STORE_CTX | ||
| 173 | like this: | ||
| 174 | .Bd -literal -offset indent | ||
| 175 | X509_STORE_CTX ctx; | ||
| 176 | X509_STORE_CTX_init(&ctx, store, cert, chain); | ||
| 177 | .Ed | ||
| 178 | .Pp | ||
| 179 | This is | ||
| 180 | .Sy not | ||
| 181 | recommended in new applications they should instead do: | ||
| 182 | .Bd -literal -offset indent | ||
| 183 | X509_STORE_CTX *ctx; | ||
| 184 | ctx = X509_STORE_CTX_new(); | ||
| 185 | if (ctx == NULL) | ||
| 186 | /* Bad error */ | ||
| 187 | X509_STORE_CTX_init(ctx, store, cert, chain); | ||
| 188 | .Ed | ||
| 189 | .Sh RETURN VALUES | ||
| 190 | .Fn X509_STORE_CTX_new | ||
| 191 | returns an newly allocates context or | ||
| 192 | .Dv NULL | ||
| 193 | if an error occurred. | ||
| 194 | .Pp | ||
| 195 | .Fn X509_STORE_CTX_init | ||
| 196 | returns 1 for success or 0 if an error occurred. | ||
| 197 | .Pp | ||
| 198 | .Fn X509_STORE_CTX_get0_param | ||
| 199 | returns a pointer to an | ||
| 200 | .Vt X509_VERIFY_PARAM | ||
| 201 | structure or | ||
| 202 | .Dv NULL | ||
| 203 | if an error occurred. | ||
| 204 | .Pp | ||
| 205 | .Fn X509_STORE_CTX_cleanup , | ||
| 206 | .Fn X509_STORE_CTX_free , | ||
| 207 | .Fn X509_STORE_CTX_trusted_stack , | ||
| 208 | .Fn X509_STORE_CTX_set_cert , | ||
| 209 | .Fn X509_STORE_CTX_set_chain , | ||
| 210 | .Fn X509_STORE_CTX_set0_crls , | ||
| 211 | and | ||
| 212 | .Fn X509_STORE_CTX_set0_param | ||
| 213 | do not return values. | ||
| 214 | .Pp | ||
| 215 | .Fn X509_STORE_CTX_set_default | ||
| 216 | returns 1 for success or 0 if an error occurred. | ||
| 217 | .Sh SEE ALSO | ||
| 218 | .Xr X509_verify_cert 3 , | ||
| 219 | .Xr X509_VERIFY_PARAM_set_flags 3 | ||
| 220 | .Sh HISTORY | ||
| 221 | .Fn X509_STORE_CTX_set0_crls | ||
| 222 | was first added to OpenSSL 1.0.0. | ||
| 223 | .Sh BUGS | ||
| 224 | The certificates and CRLs in a context are used internally and should | ||
| 225 | .Sy not | ||
| 226 | be freed up until after the associated | ||
| 227 | .Vt X509_STORE_CTX | ||
| 228 | is freed. | ||
| 229 | Copies should be made or reference counts increased instead. | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 new file mode 100644 index 0000000000..f588bd7d70 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_CTX_set_verify_cb.3 | |||
| @@ -0,0 +1,185 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_STORE_CTX_SET_VERIFY_CB 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_STORE_CTX_set_verify_cb | ||
| 6 | .Nd set verification callback | ||
| 7 | .Sh SYNOPSIS | ||
| 8 | .In openssl/x509_vfy.h | ||
| 9 | .Ft void | ||
| 10 | .Fo X509_STORE_CTX_set_verify_cb | ||
| 11 | .Fa "X509_STORE_CTX *ctx" | ||
| 12 | .Fa "int (*verify_cb)(int ok, X509_STORE_CTX *ctx)" | ||
| 13 | .Fc | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn X509_STORE_CTX_set_verify_cb | ||
| 16 | sets the verification callback of | ||
| 17 | .Fa ctx | ||
| 18 | to | ||
| 19 | .Fa verify_cb | ||
| 20 | overwriting any existing callback. | ||
| 21 | .Pp | ||
| 22 | The verification callback can be used to customise the operation of | ||
| 23 | certificate verification, either by overriding error conditions or | ||
| 24 | logging errors for debugging purposes. | ||
| 25 | .Pp | ||
| 26 | However a verification callback is | ||
| 27 | .Sy not | ||
| 28 | essential and the default operation is often sufficient. | ||
| 29 | .Pp | ||
| 30 | The | ||
| 31 | .Fa ok | ||
| 32 | parameter to the callback indicates the value the callback should return | ||
| 33 | to retain the default behaviour. | ||
| 34 | If it is zero then and error condition is indicated. | ||
| 35 | If it is 1 then no error occurred. | ||
| 36 | If the flag | ||
| 37 | .Dv X509_V_FLAG_NOTIFY_POLICY | ||
| 38 | is set, then | ||
| 39 | .Fa ok | ||
| 40 | is set to 2 to indicate the policy checking is complete. | ||
| 41 | .Pp | ||
| 42 | The | ||
| 43 | .Fa ctx | ||
| 44 | parameter to the callback is the | ||
| 45 | .Vt X509_STORE_CTX | ||
| 46 | structure that is performing the verification operation. | ||
| 47 | A callback can examine this structure and receive additional information | ||
| 48 | about the error, for example by calling | ||
| 49 | .Xr X509_STORE_CTX_get_current_cert 3 . | ||
| 50 | Additional application data can be passed to the callback via the | ||
| 51 | .Sy ex_data | ||
| 52 | mechanism. | ||
| 53 | .Pp | ||
| 54 | The verification callback can be set and inherited from the parent | ||
| 55 | structure performing the operation. | ||
| 56 | In some cases (such as S/MIME verification) the | ||
| 57 | .Vt X509_STORE_CTX | ||
| 58 | structure is created and destroyed internally and the only way to set a | ||
| 59 | custom verification callback is by inheriting it from the associated | ||
| 60 | .Vt X509_STORE . | ||
| 61 | .Sh RETURN VALUES | ||
| 62 | .Fn X509_STORE_CTX_set_verify_cb | ||
| 63 | does not return a value. | ||
| 64 | .Sh EXAMPLES | ||
| 65 | Default callback operation: | ||
| 66 | .Bd -literal | ||
| 67 | int | ||
| 68 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 69 | { | ||
| 70 | return ok; | ||
| 71 | } | ||
| 72 | .Ed | ||
| 73 | .Pp | ||
| 74 | Simple example, suppose a certificate in the chain is expired and we | ||
| 75 | wish to continue after this error: | ||
| 76 | .Bd -literal | ||
| 77 | int | ||
| 78 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 79 | { | ||
| 80 | /* Tolerate certificate expiration */ | ||
| 81 | if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED) | ||
| 82 | return 1; | ||
| 83 | /* Otherwise don't override */ | ||
| 84 | return ok; | ||
| 85 | } | ||
| 86 | .Ed | ||
| 87 | .Pp | ||
| 88 | More complex example, we don't wish to continue after | ||
| 89 | .Sy any | ||
| 90 | certificate has expired just one specific case: | ||
| 91 | .Bd -literal | ||
| 92 | int | ||
| 93 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 94 | { | ||
| 95 | int err = X509_STORE_CTX_get_error(ctx); | ||
| 96 | X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
| 97 | |||
| 98 | if (err == X509_V_ERR_CERT_HAS_EXPIRED) { | ||
| 99 | if (check_is_acceptable_expired_cert(err_cert) | ||
| 100 | return 1; | ||
| 101 | } | ||
| 102 | return ok; | ||
| 103 | } | ||
| 104 | .Ed | ||
| 105 | .Pp | ||
| 106 | Full featured logging callback. | ||
| 107 | In this case the | ||
| 108 | .Fa bio_err | ||
| 109 | is assumed to be a global logging | ||
| 110 | .Vt BIO , | ||
| 111 | an alternative would to store a | ||
| 112 | .Vt BIO | ||
| 113 | in | ||
| 114 | .Fa ctx | ||
| 115 | using | ||
| 116 | .Sy ex_data . | ||
| 117 | .Bd -literal | ||
| 118 | int | ||
| 119 | verify_callback(int ok, X509_STORE_CTX *ctx) | ||
| 120 | { | ||
| 121 | X509 *err_cert; | ||
| 122 | int err,depth; | ||
| 123 | |||
| 124 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
| 125 | err = X509_STORE_CTX_get_error(ctx); | ||
| 126 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
| 127 | |||
| 128 | BIO_printf(bio_err,"depth=%d ",depth); | ||
| 129 | if (err_cert) { | ||
| 130 | X509_NAME_print_ex(bio_err, | ||
| 131 | X509_get_subject_name(err_cert), 0, | ||
| 132 | XN_FLAG_ONELINE); | ||
| 133 | BIO_puts(bio_err, "\en"); | ||
| 134 | } else | ||
| 135 | BIO_puts(bio_err, "<no cert>\en"); | ||
| 136 | if (!ok) | ||
| 137 | BIO_printf(bio_err, "verify error:num=%d:%s\en", | ||
| 138 | err, X509_verify_cert_error_string(err)); | ||
| 139 | switch (err) { | ||
| 140 | case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: | ||
| 141 | BIO_puts(bio_err, "issuer= "); | ||
| 142 | X509_NAME_print_ex(bio_err, | ||
| 143 | X509_get_issuer_name(err_cert), 0, | ||
| 144 | XN_FLAG_ONELINE); | ||
| 145 | BIO_puts(bio_err, "\en"); | ||
| 146 | break; | ||
| 147 | case X509_V_ERR_CERT_NOT_YET_VALID: | ||
| 148 | case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: | ||
| 149 | BIO_printf(bio_err, "notBefore="); | ||
| 150 | ASN1_TIME_print(bio_err, | ||
| 151 | X509_get_notBefore(err_cert)); | ||
| 152 | BIO_printf(bio_err, "\en"); | ||
| 153 | break; | ||
| 154 | case X509_V_ERR_CERT_HAS_EXPIRED: | ||
| 155 | case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: | ||
| 156 | BIO_printf(bio_err, "notAfter="); | ||
| 157 | ASN1_TIME_print(bio_err, X509_get_notAfter(err_cert)); | ||
| 158 | BIO_printf(bio_err, "\en"); | ||
| 159 | break; | ||
| 160 | case X509_V_ERR_NO_EXPLICIT_POLICY: | ||
| 161 | policies_print(bio_err, ctx); | ||
| 162 | break; | ||
| 163 | } | ||
| 164 | if (err == X509_V_OK && ok == 2) | ||
| 165 | /* print out policies */ | ||
| 166 | |||
| 167 | BIO_printf(bio_err,"verify return:%d\en",ok); | ||
| 168 | return(ok); | ||
| 169 | } | ||
| 170 | .Ed | ||
| 171 | .Sh SEE ALSO | ||
| 172 | .Xr X509_STORE_CTX_get_error 3 , | ||
| 173 | .Xr X509_STORE_CTX_get_ex_new_index 3 , | ||
| 174 | .Xr X509_STORE_set_verify_cb_func 3 | ||
| 175 | .Sh HISTORY | ||
| 176 | .Fn X509_STORE_CTX_set_verify_cb | ||
| 177 | is available in all versions of SSLeay and OpenSSL. | ||
| 178 | .Sh CAVEATS | ||
| 179 | In general a verification callback should | ||
| 180 | .Sy NOT | ||
| 181 | unconditionally return 1 in all circumstances because this will allow | ||
| 182 | verification to succeed no matter what the error. | ||
| 183 | This effectively removes all security from the application because | ||
| 184 | .Sy any | ||
| 185 | certificate (including untrusted generated ones) will be accepted. | ||
diff --git a/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 new file mode 100644 index 0000000000..5db4313047 --- /dev/null +++ b/src/lib/libcrypto/man/X509_STORE_set_verify_cb_func.3 | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_STORE_SET_VERIFY_CB_FUNC 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_STORE_set_verify_cb_func , | ||
| 6 | .Nm X509_STORE_set_verify_cb | ||
| 7 | .Nd set verification callback | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/x509_vfy.h | ||
| 10 | .Ft void | ||
| 11 | .Fo X509_STORE_set_verify_cb | ||
| 12 | .Fa "X509_STORE *st" | ||
| 13 | .Fa "int (*verify_cb)(int ok, X509_STORE_CTX *ctx)" | ||
| 14 | .Fc | ||
| 15 | .Ft void | ||
| 16 | .Fo X509_STORE_set_verify_cb_func | ||
| 17 | .Fa "X509_STORE *st" | ||
| 18 | .Fa "int (*verify_cb)(int ok, X509_STORE_CTX *ctx)" | ||
| 19 | .Fc | ||
| 20 | .Sh DESCRIPTION | ||
| 21 | .Fn X509_STORE_set_verify_cb | ||
| 22 | sets the verification callback of | ||
| 23 | .Sy ctx | ||
| 24 | to | ||
| 25 | .Sy verify_cb | ||
| 26 | overwriting any existing callback. | ||
| 27 | .Pp | ||
| 28 | .Fn X509_STORE_set_verify_cb_func | ||
| 29 | also sets the verification callback but it is implemented as a macro. | ||
| 30 | .Pp | ||
| 31 | The verification callback from an | ||
| 32 | .Vt X509_STORE | ||
| 33 | is inherited by the corresponding | ||
| 34 | .Vt X509_STORE_CTX | ||
| 35 | structure when it is initialized. | ||
| 36 | This can be used to set the verification callback when the | ||
| 37 | .Vt X509_STORE_CTX | ||
| 38 | is otherwise inaccessible (for example during S/MIME verification). | ||
| 39 | .Sh RETURN VALUES | ||
| 40 | .Fn X509_STORE_set_verify_cb | ||
| 41 | and | ||
| 42 | .Fn X509_STORE_set_verify_cb_func | ||
| 43 | do not return a value. | ||
| 44 | .Sh SEE ALSO | ||
| 45 | .Xr X509_STORE_CTX_set_verify_cb 3 | ||
| 46 | .Sh HISTORY | ||
| 47 | .Fn X509_STORE_set_verify_cb_func | ||
| 48 | is available in all versions of SSLeay and OpenSSL. | ||
| 49 | .Pp | ||
| 50 | .Fn X509_STORE_set_verify_cb | ||
| 51 | was added to OpenSSL 1.0.0. | ||
| 52 | .Sh BUGS | ||
| 53 | The macro version of this function was the only one available before | ||
| 54 | OpenSSL 1.0.0. | ||
diff --git a/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 new file mode 100644 index 0000000000..66724ed169 --- /dev/null +++ b/src/lib/libcrypto/man/X509_VERIFY_PARAM_set_flags.3 | |||
| @@ -0,0 +1,271 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_VERIFY_PARAM_SET_FLAGS 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_VERIFY_PARAM_set_flags , | ||
| 6 | .Nm X509_VERIFY_PARAM_clear_flags , | ||
| 7 | .Nm X509_VERIFY_PARAM_get_flags , | ||
| 8 | .Nm X509_VERIFY_PARAM_set_purpose , | ||
| 9 | .Nm X509_VERIFY_PARAM_set_trust , | ||
| 10 | .Nm X509_VERIFY_PARAM_set_depth , | ||
| 11 | .Nm X509_VERIFY_PARAM_get_depth , | ||
| 12 | .Nm X509_VERIFY_PARAM_set_time , | ||
| 13 | .Nm X509_VERIFY_PARAM_add0_policy , | ||
| 14 | .Nm X509_VERIFY_PARAM_set1_policies | ||
| 15 | .Nd X509 verification parameters | ||
| 16 | .Sh SYNOPSIS | ||
| 17 | .In openssl/x509_vfy.h | ||
| 18 | .Ft int | ||
| 19 | .Fo X509_VERIFY_PARAM_set_flags | ||
| 20 | .Fa "X509_VERIFY_PARAM *param" | ||
| 21 | .Fa "unsigned long flags" | ||
| 22 | .Fc | ||
| 23 | .Ft int | ||
| 24 | .Fo X509_VERIFY_PARAM_clear_flags | ||
| 25 | .Fa "X509_VERIFY_PARAM *param" | ||
| 26 | .Fa "unsigned long flags" | ||
| 27 | .Fc | ||
| 28 | .Ft unsigned long | ||
| 29 | .Fo X509_VERIFY_PARAM_get_flags | ||
| 30 | .Fa "X509_VERIFY_PARAM *param" | ||
| 31 | .Fc | ||
| 32 | .Ft int | ||
| 33 | .Fo X509_VERIFY_PARAM_set_purpose | ||
| 34 | .Fa "X509_VERIFY_PARAM *param" | ||
| 35 | .Fa "int purpose" | ||
| 36 | .Fc | ||
| 37 | .Ft int | ||
| 38 | .Fo X509_VERIFY_PARAM_set_trust | ||
| 39 | .Fa "X509_VERIFY_PARAM *param" | ||
| 40 | .Fa "int trust" | ||
| 41 | .Fc | ||
| 42 | .Ft void | ||
| 43 | .Fo X509_VERIFY_PARAM_set_time | ||
| 44 | .Fa "X509_VERIFY_PARAM *param" | ||
| 45 | .Fa "time_t t" | ||
| 46 | .Fc | ||
| 47 | .Ft int | ||
| 48 | .Fo X509_VERIFY_PARAM_add0_policy | ||
| 49 | .Fa "X509_VERIFY_PARAM *param" | ||
| 50 | .Fa "ASN1_OBJECT *policy" | ||
| 51 | .Fc | ||
| 52 | .Ft int | ||
| 53 | .Fo X509_VERIFY_PARAM_set1_policies | ||
| 54 | .Fa "X509_VERIFY_PARAM *param" | ||
| 55 | .Fa "STACK_OF(ASN1_OBJECT) *policies" | ||
| 56 | .Fc | ||
| 57 | .Ft void | ||
| 58 | .Fo X509_VERIFY_PARAM_set_depth | ||
| 59 | .Fa "X509_VERIFY_PARAM *param" | ||
| 60 | .Fa "int depth" | ||
| 61 | .Fc | ||
| 62 | .Ft int | ||
| 63 | .Fo X509_VERIFY_PARAM_get_depth | ||
| 64 | .Fa "const X509_VERIFY_PARAM *param" | ||
| 65 | .Fc | ||
| 66 | .Sh DESCRIPTION | ||
| 67 | These functions manipulate the | ||
| 68 | .Vt X509_VERIFY_PARAM | ||
| 69 | structure associated with a certificate verification operation. | ||
| 70 | .Pp | ||
| 71 | The | ||
| 72 | .Fn X509_VERIFY_PARAM_set_flags | ||
| 73 | function sets the flags in | ||
| 74 | .Fa param | ||
| 75 | by OR'ing it with | ||
| 76 | .Fa flags . | ||
| 77 | See the | ||
| 78 | .Sx VERIFICATION FLAGS | ||
| 79 | section for a complete description of values the | ||
| 80 | .Fa flags | ||
| 81 | parameter can take. | ||
| 82 | .Pp | ||
| 83 | .Fn X509_VERIFY_PARAM_get_flags | ||
| 84 | returns the flags in | ||
| 85 | .Fa param . | ||
| 86 | .Pp | ||
| 87 | .Fn X509_VERIFY_PARAM_clear_flags | ||
| 88 | clears the flags | ||
| 89 | .Fa flags | ||
| 90 | in | ||
| 91 | .Fa param . | ||
| 92 | .Pp | ||
| 93 | .Fn X509_VERIFY_PARAM_set_purpose | ||
| 94 | sets the verification purpose in | ||
| 95 | .Fa param | ||
| 96 | to | ||
| 97 | .Fa purpose . | ||
| 98 | This determines the acceptable purpose of the certificate chain, for | ||
| 99 | example SSL client or SSL server. | ||
| 100 | .Pp | ||
| 101 | .Fn X509_VERIFY_PARAM_set_trust | ||
| 102 | sets the trust setting in | ||
| 103 | .Fa param | ||
| 104 | to | ||
| 105 | .Fa trust . | ||
| 106 | .Pp | ||
| 107 | .Fn X509_VERIFY_PARAM_set_time | ||
| 108 | sets the verification time in | ||
| 109 | .Fa param | ||
| 110 | to | ||
| 111 | .Fa t . | ||
| 112 | Normally the current time is used. | ||
| 113 | .Pp | ||
| 114 | .Fn X509_VERIFY_PARAM_add0_policy | ||
| 115 | enables policy checking (it is disabled by default) and adds | ||
| 116 | .Fa policy | ||
| 117 | to the acceptable policy set. | ||
| 118 | .Pp | ||
| 119 | .Fn X509_VERIFY_PARAM_set1_policies | ||
| 120 | enables policy checking (it is disabled by default) and sets the | ||
| 121 | acceptable policy set to | ||
| 122 | .Fa policies . | ||
| 123 | Any existing policy set is cleared. | ||
| 124 | The | ||
| 125 | .Fa policies | ||
| 126 | parameter can be | ||
| 127 | .Dv NULL | ||
| 128 | to clear an existing policy set. | ||
| 129 | .Pp | ||
| 130 | .Fn X509_VERIFY_PARAM_set_depth | ||
| 131 | sets the maximum verification depth to | ||
| 132 | .Fa depth . | ||
| 133 | That is the maximum number of untrusted CA certificates that can appear | ||
| 134 | in a chain. | ||
| 135 | .Pp | ||
| 136 | The above functions should be used to manipulate verification parameters | ||
| 137 | instead of legacy functions which work in specific structures such as | ||
| 138 | .Xr X509_STORE_CTX_set_flags 3 . | ||
| 139 | .Sh RETURN VALUES | ||
| 140 | .Fn X509_VERIFY_PARAM_set_flags , | ||
| 141 | .Fn X509_VERIFY_PARAM_clear_flags , | ||
| 142 | .Fn X509_VERIFY_PARAM_set_purpose , | ||
| 143 | .Fn X509_VERIFY_PARAM_set_trust , | ||
| 144 | .Fn X509_VERIFY_PARAM_add0_policy , | ||
| 145 | and | ||
| 146 | .Fn X509_VERIFY_PARAM_set1_policies | ||
| 147 | return 1 for success or 0 for failure. | ||
| 148 | .Pp | ||
| 149 | .Fn X509_VERIFY_PARAM_get_flags | ||
| 150 | returns the current verification flags. | ||
| 151 | .Pp | ||
| 152 | .Fn X509_VERIFY_PARAM_set_time | ||
| 153 | and | ||
| 154 | .Fn X509_VERIFY_PARAM_set_depth | ||
| 155 | do not return values. | ||
| 156 | .Pp | ||
| 157 | .Fn X509_VERIFY_PARAM_get_depth | ||
| 158 | returns the current verification depth. | ||
| 159 | .Sh VERIFICATION FLAGS | ||
| 160 | The verification flags consists of zero or more of the following | ||
| 161 | flags OR'ed together. | ||
| 162 | .Pp | ||
| 163 | .Dv X509_V_FLAG_CRL_CHECK | ||
| 164 | enables CRL checking for the certificate chain leaf certificate. | ||
| 165 | An error occurs if a suitable CRL cannot be found. | ||
| 166 | .Pp | ||
| 167 | .Dv X509_V_FLAG_CRL_CHECK_ALL | ||
| 168 | enables CRL checking for the entire certificate chain. | ||
| 169 | .Pp | ||
| 170 | .Dv X509_V_FLAG_IGNORE_CRITICAL | ||
| 171 | disabled critical extension checking. | ||
| 172 | By default any unhandled critical extensions in certificates or (if | ||
| 173 | checked) CRLs results in a fatal error. | ||
| 174 | If this flag is set unhandled critical extensions are ignored. | ||
| 175 | .Sy WARNING : | ||
| 176 | setting this option for anything other than debugging purposes can be a | ||
| 177 | security risk. | ||
| 178 | Finer control over which extensions are supported can be performed in | ||
| 179 | the verification callback. | ||
| 180 | .Pp | ||
| 181 | The | ||
| 182 | .Dv X509_V_FLAG_X509_STRICT | ||
| 183 | flag disables workarounds for some broken certificates and makes the | ||
| 184 | verification strictly apply X509 rules. | ||
| 185 | .Pp | ||
| 186 | .Dv X509_V_FLAG_ALLOW_PROXY_CERTS | ||
| 187 | enables proxy certificate verification. | ||
| 188 | .Pp | ||
| 189 | .Dv X509_V_FLAG_POLICY_CHECK | ||
| 190 | enables certificate policy checking, by default no policy checking is | ||
| 191 | performed. | ||
| 192 | Additional information is sent to the verification callback relating to | ||
| 193 | policy checking. | ||
| 194 | .Pp | ||
| 195 | .Dv X509_V_FLAG_EXPLICIT_POLICY , | ||
| 196 | .Dv X509_V_FLAG_INHIBIT_ANY , | ||
| 197 | and | ||
| 198 | .Dv X509_V_FLAG_INHIBIT_MAP | ||
| 199 | set the | ||
| 200 | .Dq require explicit policy , | ||
| 201 | .Dq inhibit any policy , | ||
| 202 | and | ||
| 203 | .Dq inhibit policy mapping | ||
| 204 | flags, respectively, as defined in RFC3280. | ||
| 205 | Policy checking is automatically enabled if any of these flags are set. | ||
| 206 | .Pp | ||
| 207 | If | ||
| 208 | .Dv X509_V_FLAG_NOTIFY_POLICY | ||
| 209 | is set and the policy checking is successful a special status code is | ||
| 210 | set to the verification callback. | ||
| 211 | This permits it to examine the valid policy tree and perform additional | ||
| 212 | checks or simply log it for debugging purposes. | ||
| 213 | .Pp | ||
| 214 | By default some additional features such as indirect CRLs and CRLs | ||
| 215 | signed by different keys are disabled. | ||
| 216 | If | ||
| 217 | .Dv X509_V_FLAG_EXTENDED_CRL_SUPPORT | ||
| 218 | is set they are enabled. | ||
| 219 | .Pp | ||
| 220 | If | ||
| 221 | .Dv X509_V_FLAG_USE_DELTAS | ||
| 222 | is set, delta CRLs (if present) are used to determine certificate | ||
| 223 | status. | ||
| 224 | If not set, deltas are ignored. | ||
| 225 | .Pp | ||
| 226 | .Dv X509_V_FLAG_CHECK_SS_SIGNATURE | ||
| 227 | enables checking of the root CA self signed certificate signature. | ||
| 228 | By default this check is disabled because it doesn't add any additional | ||
| 229 | security but in some cases applications might want to check the | ||
| 230 | signature anyway. | ||
| 231 | A side effect of not checking the root CA signature is that disabled or | ||
| 232 | unsupported message digests on the root CA are not treated as fatal | ||
| 233 | errors. | ||
| 234 | .Pp | ||
| 235 | The | ||
| 236 | .Dv X509_V_FLAG_CB_ISSUER_CHECK | ||
| 237 | flag enables debugging of certificate issuer checks. | ||
| 238 | It is | ||
| 239 | .Sy not | ||
| 240 | needed unless you are logging certificate verification. | ||
| 241 | If this flag is set then additional status codes will be sent to the | ||
| 242 | verification callback and it | ||
| 243 | .Sy must | ||
| 244 | be prepared to handle such cases without assuming they are hard errors. | ||
| 245 | .Sh EXAMPLES | ||
| 246 | Enable CRL checking when performing certificate verification during | ||
| 247 | SSL connections associated with an | ||
| 248 | .Vt SSL_CTX | ||
| 249 | structure | ||
| 250 | .Fa ctx : | ||
| 251 | .Bd -literal | ||
| 252 | X509_VERIFY_PARAM *param; | ||
| 253 | param = X509_VERIFY_PARAM_new(); | ||
| 254 | X509_VERIFY_PARAM_set_flags(param, X509_V_FLAG_CRL_CHECK); | ||
| 255 | SSL_CTX_set1_param(ctx, param); | ||
| 256 | X509_VERIFY_PARAM_free(param); | ||
| 257 | .Ed | ||
| 258 | .Sh SEE ALSO | ||
| 259 | .Xr X509_verify_cert 3 | ||
| 260 | .Sh BUGS | ||
| 261 | Delta CRL checking is currently primitive. | ||
| 262 | Only a single delta can be used and (partly due to limitations of | ||
| 263 | .Vt X509_STORE ) | ||
| 264 | constructed CRLs are not maintained. | ||
| 265 | .Pp | ||
| 266 | If CRLs checking is enabled, CRLs are expected to be available in | ||
| 267 | the corresponding | ||
| 268 | .Vt X509_STORE | ||
| 269 | structure. | ||
| 270 | No attempt is made to download CRLs from the CRL distribution points | ||
| 271 | extension. | ||
diff --git a/src/lib/libcrypto/man/X509_new.3 b/src/lib/libcrypto/man/X509_new.3 new file mode 100644 index 0000000000..26c46ae3a9 --- /dev/null +++ b/src/lib/libcrypto/man/X509_new.3 | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_NEW 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_new , | ||
| 6 | .Nm X509_free | ||
| 7 | .Nd X509 certificate ASN1 allocation functions | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/x509.h | ||
| 10 | .Ft X509 * | ||
| 11 | .Fn X509_new void | ||
| 12 | .Ft void | ||
| 13 | .Fo X509_free | ||
| 14 | .Fa "X509 *a" | ||
| 15 | .Fc | ||
| 16 | .Sh DESCRIPTION | ||
| 17 | The X509 ASN1 allocation routines allocate and free an | ||
| 18 | .Vt X509 | ||
| 19 | structure, which represents an X509 certificate. | ||
| 20 | .Pp | ||
| 21 | .Fn X509_new | ||
| 22 | allocates and initializes a X509 structure. | ||
| 23 | .Pp | ||
| 24 | .Fn X509_free | ||
| 25 | frees up the | ||
| 26 | .Vt X509 | ||
| 27 | structure | ||
| 28 | .Fa a . | ||
| 29 | If | ||
| 30 | .Fa a | ||
| 31 | is a | ||
| 32 | .Dv NULL | ||
| 33 | pointer, no action occurs. | ||
| 34 | .Sh RETURN VALUES | ||
| 35 | If the allocation fails, | ||
| 36 | .Fn X509_new | ||
| 37 | returns | ||
| 38 | .Dv NULL | ||
| 39 | and sets an error code that can be obtained by | ||
| 40 | .Xr ERR_get_error 3 . | ||
| 41 | Otherwise it returns a pointer to the newly allocated structure. | ||
| 42 | .Sh SEE ALSO | ||
| 43 | .Xr d2i_X509 3 , | ||
| 44 | .Xr ERR_get_error 3 | ||
| 45 | .Sh HISTORY | ||
| 46 | .Fn X509_new | ||
| 47 | and | ||
| 48 | .Fn X509_free | ||
| 49 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/X509_verify_cert.3 b/src/lib/libcrypto/man/X509_verify_cert.3 new file mode 100644 index 0000000000..fd3d6bebda --- /dev/null +++ b/src/lib/libcrypto/man/X509_verify_cert.3 | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509_VERIFY_CERT 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm X509_verify_cert | ||
| 6 | .Nd discover and verify X509 certificate chain | ||
| 7 | .Sh SYNOPSIS | ||
| 8 | .In openssl/x509.h | ||
| 9 | .Ft int | ||
| 10 | .Fo X509_verify_cert | ||
| 11 | .Fa "X509_STORE_CTX *ctx" | ||
| 12 | .Fc | ||
| 13 | .Sh DESCRIPTION | ||
| 14 | The | ||
| 15 | .Fn X509_verify_cert | ||
| 16 | function attempts to discover and validate a certificate chain based on | ||
| 17 | parameters in | ||
| 18 | .Fa ctx . | ||
| 19 | .Pp | ||
| 20 | Applications rarely call this function directly, but it is used by | ||
| 21 | OpenSSL internally for certificate validation, in both the S/MIME and | ||
| 22 | SSL/TLS code. | ||
| 23 | .Sh RETURN VALUES | ||
| 24 | If a complete chain can be built and validated this function returns 1, | ||
| 25 | otherwise it return 0. | ||
| 26 | .Pp | ||
| 27 | In exceptional circumstances, it can also return a negative code, | ||
| 28 | but only if no certificate is set in | ||
| 29 | .Fa ctx | ||
| 30 | due to a programming error or if a retry operation is requested | ||
| 31 | during internal lookups, which never happens with standard lookup | ||
| 32 | methods. | ||
| 33 | It is however recommended that application check for <= 0 return | ||
| 34 | value on error. | ||
| 35 | .Pp | ||
| 36 | If the function fails, additional error information can be obtained | ||
| 37 | by examining | ||
| 38 | .Fa ctx , | ||
| 39 | for example using | ||
| 40 | .Xr X509_STORE_CTX_get_error 3 . | ||
| 41 | .Sh SEE ALSO | ||
| 42 | .Xr X509_STORE_CTX_get_error 3 | ||
| 43 | and the | ||
| 44 | .Cm verify | ||
| 45 | entry in | ||
| 46 | .Xr openssl 1 | ||
| 47 | .Sh HISTORY | ||
| 48 | .Fn X509_verify_cert | ||
| 49 | is available in all versions of SSLeay and OpenSSL. | ||
| 50 | .Sh BUGS | ||
| 51 | This function uses the header | ||
| 52 | .In openssl/x509.h | ||
| 53 | as opposed to most chain verification functions which use | ||
| 54 | .In openssl/x509_vfy.h . | ||
diff --git a/src/lib/libcrypto/man/d2i_X509.3 b/src/lib/libcrypto/man/d2i_X509.3 new file mode 100644 index 0000000000..09c65afa58 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509.3 | |||
| @@ -0,0 +1,346 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt D2I_X509 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm d2i_X509 , | ||
| 6 | .Nm i2d_X509 , | ||
| 7 | .Nm d2i_X509_bio , | ||
| 8 | .Nm d2i_X509_fp , | ||
| 9 | .Nm i2d_X509_bio , | ||
| 10 | .Nm i2d_X509_fp | ||
| 11 | .Nd X509 encode and decode functions | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/x509.h | ||
| 14 | .Ft X509 * | ||
| 15 | .Fo d2i_X509 | ||
| 16 | .Fa "X509 **px" | ||
| 17 | .Fa "const unsigned char **in" | ||
| 18 | .Fa "int len" | ||
| 19 | .Fc | ||
| 20 | .Ft int | ||
| 21 | .Fo i2d_X509 | ||
| 22 | .Fa "X509 *x" | ||
| 23 | .Fa "unsigned char **out" | ||
| 24 | .Fc | ||
| 25 | .Ft X509 * | ||
| 26 | .Fo d2i_X509_bio | ||
| 27 | .Fa "BIO *bp" | ||
| 28 | .Fa "X509 **x" | ||
| 29 | .Fc | ||
| 30 | .Ft X509 * | ||
| 31 | .Fo d2i_X509_fp | ||
| 32 | .Fa "FILE *fp" | ||
| 33 | .Fa "X509 **x" | ||
| 34 | .Fc | ||
| 35 | .Ft int | ||
| 36 | .Fo i2d_X509_bio | ||
| 37 | .Fa "BIO *bp" | ||
| 38 | .Fa "X509 *x" | ||
| 39 | .Fc | ||
| 40 | .Ft int | ||
| 41 | .Fo i2d_X509_fp | ||
| 42 | .Fa "FILE *fp" | ||
| 43 | .Fa "X509 *x" | ||
| 44 | .Fc | ||
| 45 | .Sh DESCRIPTION | ||
| 46 | The X509 encode and decode routines encode and parse an | ||
| 47 | .Vt X509 | ||
| 48 | structure, which represents an X509 certificate. | ||
| 49 | .Pp | ||
| 50 | .Fn d2i_X509 | ||
| 51 | attempts to decode | ||
| 52 | .Fa len | ||
| 53 | bytes at | ||
| 54 | .Pf * Fa in . | ||
| 55 | If successful, a pointer to the | ||
| 56 | .Vt X509 | ||
| 57 | structure is returned. | ||
| 58 | If an error occurred, | ||
| 59 | .Dv NULL | ||
| 60 | is returned. | ||
| 61 | If | ||
| 62 | .Fa px | ||
| 63 | is not | ||
| 64 | .Dv NULL , | ||
| 65 | the returned structure is written to | ||
| 66 | .Pf * Fa px . | ||
| 67 | If | ||
| 68 | .Pf * Fa px | ||
| 69 | is not | ||
| 70 | .Dv NULL , | ||
| 71 | then it is assumed that | ||
| 72 | .Pf * Fa px | ||
| 73 | contains a valid | ||
| 74 | .Vt X509 | ||
| 75 | structure and an attempt is made to reuse it. | ||
| 76 | If the call is successful, | ||
| 77 | .Pf * Fa in | ||
| 78 | is incremented to the byte following the parsed data. | ||
| 79 | .Pp | ||
| 80 | .Fn i2d_X509 | ||
| 81 | encodes the structure pointed to by | ||
| 82 | .Fa x | ||
| 83 | into DER format. | ||
| 84 | If | ||
| 85 | .Fa out | ||
| 86 | is not | ||
| 87 | .Dv NULL , | ||
| 88 | it writes the DER encoded data to the buffer at | ||
| 89 | .Pf * Fa out | ||
| 90 | and increments it to point after the data just written. | ||
| 91 | If the return value is negative an error occurred, otherwise it returns | ||
| 92 | the length of the encoded data. | ||
| 93 | .Pp | ||
| 94 | For OpenSSL 0.9.7 and later if | ||
| 95 | .Pf * Fa out | ||
| 96 | is | ||
| 97 | .Dv NULL , | ||
| 98 | memory will be allocated for a buffer and the encoded data written to it. | ||
| 99 | In this case | ||
| 100 | .Pf * Fa out | ||
| 101 | is not incremented and it points to the start of the data just written. | ||
| 102 | .Pp | ||
| 103 | .Fn d2i_X509_bio | ||
| 104 | is similar to | ||
| 105 | .Fn d2i_X509 | ||
| 106 | except it attempts to parse data from | ||
| 107 | .Vt BIO | ||
| 108 | .Fa bp . | ||
| 109 | .Pp | ||
| 110 | .Fn d2i_X509_fp | ||
| 111 | is similar to | ||
| 112 | .Fn d2i_X509 | ||
| 113 | except it attempts to parse data from the | ||
| 114 | .Vt FILE | ||
| 115 | pointer | ||
| 116 | .Fa fp . | ||
| 117 | .Pp | ||
| 118 | .Fn i2d_X509_bio | ||
| 119 | is similar to | ||
| 120 | .Fn i2d_X509 | ||
| 121 | except it writes the encoding of the structure | ||
| 122 | .Fa x | ||
| 123 | to | ||
| 124 | .Vt BIO | ||
| 125 | .Fa bp | ||
| 126 | and it returns 1 for success or 0 for failure. | ||
| 127 | .Pp | ||
| 128 | .Fn i2d_X509_fp | ||
| 129 | is similar to | ||
| 130 | .Fn i2d_X509 | ||
| 131 | except it writes the encoding of the structure | ||
| 132 | .Fa x | ||
| 133 | to | ||
| 134 | .Vt BIO | ||
| 135 | .Fa bp | ||
| 136 | and it returns 1 for success or 0 for failure. | ||
| 137 | .Pp | ||
| 138 | The letters | ||
| 139 | .Sy i | ||
| 140 | and | ||
| 141 | .Sy d | ||
| 142 | in for example | ||
| 143 | .Fn i2d_X509 | ||
| 144 | stand for "internal" (that is an internal C structure) and "DER", | ||
| 145 | so that | ||
| 146 | .Fn i2d_X509 | ||
| 147 | converts from internal to DER. | ||
| 148 | .Pp | ||
| 149 | The functions can also understand BER forms. | ||
| 150 | .Pp | ||
| 151 | The actual | ||
| 152 | .Vt X509 | ||
| 153 | structure passed to | ||
| 154 | .Fn i2d_X509 | ||
| 155 | must be a valid populated | ||
| 156 | .Vt X509 | ||
| 157 | structure. | ||
| 158 | It cannot simply be fed with an empty structure such as that returned by | ||
| 159 | .Xr X509_new 3 . | ||
| 160 | .Pp | ||
| 161 | The encoded data is in binary form and may contain embedded zeroes. | ||
| 162 | Therefore any | ||
| 163 | .Vt FILE | ||
| 164 | pointers or | ||
| 165 | .Vt BIO Ns s | ||
| 166 | should be opened in binary mode. | ||
| 167 | Functions such as | ||
| 168 | .Xr strlen 3 | ||
| 169 | will | ||
| 170 | .Sy not | ||
| 171 | return the correct length of the encoded structure. | ||
| 172 | .Pp | ||
| 173 | The ways that | ||
| 174 | .Pf * Fa in | ||
| 175 | and | ||
| 176 | .Pf * Fa out | ||
| 177 | are incremented after the operation can trap the unwary. | ||
| 178 | See the | ||
| 179 | .Sx CAVEATS | ||
| 180 | section for some common errors. | ||
| 181 | .Pp | ||
| 182 | The reason for the auto increment behaviour is to reflect a typical | ||
| 183 | usage of ASN1 functions: after one structure is encoded or decoded, | ||
| 184 | another will processed after it. | ||
| 185 | .Sh RETURN VALUES | ||
| 186 | .Fn d2i_X509 , | ||
| 187 | .Fn d2i_X509_bio , | ||
| 188 | and | ||
| 189 | .Fn d2i_X509_fp | ||
| 190 | return a valid | ||
| 191 | .Vt X509 | ||
| 192 | structure or | ||
| 193 | .Dv NULL | ||
| 194 | if an error occurs. | ||
| 195 | .Pp | ||
| 196 | .Fn i2d_X509 | ||
| 197 | returns the number of bytes successfully encoded or a negative value if | ||
| 198 | an error occurs. | ||
| 199 | .Pp | ||
| 200 | .Fn i2d_X509_bio | ||
| 201 | and | ||
| 202 | .Fn i2d_X509_fp | ||
| 203 | return 1 for success or 0 if an error occurs. | ||
| 204 | .Pp | ||
| 205 | For all functions, the error code can be obtained by | ||
| 206 | .Xr ERR_get_error 3 . | ||
| 207 | .Sh EXAMPLES | ||
| 208 | Allocate and encode the DER encoding of an X509 structure: | ||
| 209 | .Bd -literal -offset indent | ||
| 210 | int len; | ||
| 211 | unsigned char *buf, *p; | ||
| 212 | |||
| 213 | len = i2d_X509(x, NULL); | ||
| 214 | buf = malloc(len); | ||
| 215 | if (buf == NULL) | ||
| 216 | /* error */ | ||
| 217 | p = buf; | ||
| 218 | i2d_X509(x, &p); | ||
| 219 | .Ed | ||
| 220 | .Pp | ||
| 221 | If you are using OpenSSL 0.9.7 or later then this can be simplified to: | ||
| 222 | .Bd -literal -offset indent | ||
| 223 | int len; | ||
| 224 | unsigned char *buf; | ||
| 225 | |||
| 226 | buf = NULL; | ||
| 227 | len = i2d_X509(x, &buf); | ||
| 228 | if (len < 0) | ||
| 229 | /* error */ | ||
| 230 | .Ed | ||
| 231 | .Pp | ||
| 232 | Attempt to decode a buffer: | ||
| 233 | .Bd -literal -offset indent | ||
| 234 | X509 *x; | ||
| 235 | unsigned char *buf, *p; | ||
| 236 | int len; | ||
| 237 | |||
| 238 | /* Something to setup buf and len */ | ||
| 239 | p = buf; | ||
| 240 | x = d2i_X509(NULL, &p, len); | ||
| 241 | if (x == NULL) | ||
| 242 | /* Some error */ | ||
| 243 | .Ed | ||
| 244 | .Pp | ||
| 245 | Alternative technique: | ||
| 246 | .Bd -literal -offset indent | ||
| 247 | X509 *x; | ||
| 248 | unsigned char *buf, *p; | ||
| 249 | int len; | ||
| 250 | |||
| 251 | /* Something to setup buf and len */ | ||
| 252 | p = buf; | ||
| 253 | x = NULL; | ||
| 254 | if(!d2i_X509(&x, &p, len)) | ||
| 255 | /* Some error */ | ||
| 256 | .Ed | ||
| 257 | .Sh SEE ALSO | ||
| 258 | .Xr ERR_get_error 3 | ||
| 259 | .Sh HISTORY | ||
| 260 | .Fn d2i_X509 , | ||
| 261 | .Fn i2d_X509 , | ||
| 262 | .Fn d2i_X509_bio , | ||
| 263 | .Fn d2i_X509_fp , | ||
| 264 | .Fn i2d_X509_bio , | ||
| 265 | and | ||
| 266 | .Fn i2d_X509_fp | ||
| 267 | are available in all versions of SSLeay and OpenSSL. | ||
| 268 | .Sh CAVEATS | ||
| 269 | The use of a temporary variable is mandatory. | ||
| 270 | A common mistake is to attempt to use a buffer directly as follows: | ||
| 271 | .Bd -literal -offset indent | ||
| 272 | int len; | ||
| 273 | unsigned char *buf; | ||
| 274 | |||
| 275 | len = i2d_X509(x, NULL); | ||
| 276 | buf = malloc(len); | ||
| 277 | if (buf == NULL) | ||
| 278 | /* error */ | ||
| 279 | i2d_X509(x, &buf); | ||
| 280 | /* Other stuff ... */ | ||
| 281 | free(buf); | ||
| 282 | .Ed | ||
| 283 | .Pp | ||
| 284 | This code will result in | ||
| 285 | .Fa buf | ||
| 286 | apparently containing garbage because it was incremented after the | ||
| 287 | call to point after the data just written. | ||
| 288 | Also | ||
| 289 | .Fa buf | ||
| 290 | will no longer contain the pointer allocated by | ||
| 291 | .Xr malloc 3 | ||
| 292 | and the subsequent call to | ||
| 293 | .Xr free 3 | ||
| 294 | may well crash. | ||
| 295 | .Pp | ||
| 296 | The auto allocation feature (setting | ||
| 297 | .Fa buf | ||
| 298 | to | ||
| 299 | .Dv NULL | ||
| 300 | only works on OpenSSL 0.9.7 and later. | ||
| 301 | Attempts to use it on earlier versions will typically cause a | ||
| 302 | segmentation violation. | ||
| 303 | .Pp | ||
| 304 | Another trap to avoid is misuse of the | ||
| 305 | .Fa px | ||
| 306 | argument to | ||
| 307 | .Sy d2i_X509() : | ||
| 308 | .Bd -literal -offset indent | ||
| 309 | X509 *x; | ||
| 310 | |||
| 311 | if (!d2i_X509(&x, &p, len)) | ||
| 312 | /* Some error */ | ||
| 313 | .Ed | ||
| 314 | .Pp | ||
| 315 | This will probably crash somewhere in | ||
| 316 | .Fn d2i_X509 . | ||
| 317 | The reason for this is that the variable | ||
| 318 | .Fa x | ||
| 319 | is uninitialized and an attempt will be made to interpret its (invalid) | ||
| 320 | value as an | ||
| 321 | .Vt X509 | ||
| 322 | structure, typically causing a segmentation violation. | ||
| 323 | If | ||
| 324 | .Fa x | ||
| 325 | is set to | ||
| 326 | .Dv NULL | ||
| 327 | first then this will not happen. | ||
| 328 | .Sh BUGS | ||
| 329 | In some versions of OpenSSL the "reuse" behaviour of | ||
| 330 | .Fn d2i_X509 | ||
| 331 | when | ||
| 332 | .Pf * Fa px | ||
| 333 | is valid is broken and some parts of the reused structure may persist | ||
| 334 | if they are not present in the new one. | ||
| 335 | As a result the use of this "reuse" behaviour is strongly discouraged. | ||
| 336 | .Pp | ||
| 337 | In many versions of OpenSSL, | ||
| 338 | .Fn i2d_X509 | ||
| 339 | will not return an error if mandatory fields are not initialized | ||
| 340 | due to a programming error. | ||
| 341 | Then the encoded structure may contain invalid data or omit the | ||
| 342 | fields entirely and will not be parsed by | ||
| 343 | .Fn d2i_X509 . | ||
| 344 | This may be fixed in future so code should not assume that | ||
| 345 | .Fn i2d_X509 | ||
| 346 | will always succeed. | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_ALGOR.3 b/src/lib/libcrypto/man/d2i_X509_ALGOR.3 new file mode 100644 index 0000000000..e17678019b --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_ALGOR.3 | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt D2I_X509_ALGOR 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm d2i_X509_ALGOR , | ||
| 6 | .Nm i2d_X509_ALGOR | ||
| 7 | .Nd AlgorithmIdentifier functions | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/x509.h | ||
| 10 | .Ft X509_ALGOR * | ||
| 11 | .Fo d2i_X509_ALGOR | ||
| 12 | .Fa "X509_ALGOR **a" | ||
| 13 | .Fa "unsigned char **pp" | ||
| 14 | .Fa "long length" | ||
| 15 | .Fc | ||
| 16 | .Ft int | ||
| 17 | .Fo i2d_X509_ALGOR | ||
| 18 | .Fa "X509_ALGOR *a" | ||
| 19 | .Fa "unsigned char **pp" | ||
| 20 | .Fc | ||
| 21 | .Sh DESCRIPTION | ||
| 22 | These functions decode and encode an | ||
| 23 | .Vt X509_ALGOR | ||
| 24 | structure which is equivalent to the | ||
| 25 | .Sy AlgorithmIdentifier | ||
| 26 | structure. | ||
| 27 | .Pp | ||
| 28 | Otherwise these behave in a way similar to | ||
| 29 | .Xr d2i_X509 3 | ||
| 30 | and | ||
| 31 | .Xr i2d_X509 3 . | ||
| 32 | .Sh SEE ALSO | ||
| 33 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_CRL.3 b/src/lib/libcrypto/man/d2i_X509_CRL.3 new file mode 100644 index 0000000000..e487da16d0 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_CRL.3 | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt D2I_X509_CRL 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm d2i_X509_CRL , | ||
| 6 | .Nm i2d_X509_CRL , | ||
| 7 | .Nm d2i_X509_CRL_bio , | ||
| 8 | .Nm d2i_X509_CRL_fp , | ||
| 9 | .Nm i2d_X509_CRL_bio , | ||
| 10 | .Nm i2d_X509_CRL_fp | ||
| 11 | .Nd PKCS#10 certificate request functions | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/x509.h | ||
| 14 | .Ft X509_CRL * | ||
| 15 | .Fo d2i_X509_CRL | ||
| 16 | .Fa "X509_CRL **a" | ||
| 17 | .Fa "const unsigned char **pp" | ||
| 18 | .Fa "long length" | ||
| 19 | .Fc | ||
| 20 | .Ft int | ||
| 21 | .Fo i2d_X509_CRL | ||
| 22 | .Fa "X509_CRL *a" | ||
| 23 | .Fa "unsigned char **pp" | ||
| 24 | .Fc | ||
| 25 | .Ft X509_CRL * | ||
| 26 | .Fo d2i_X509_CRL_bio | ||
| 27 | .Fa "BIO *bp" | ||
| 28 | .Fa "X509_CRL **x" | ||
| 29 | .Fc | ||
| 30 | .Ft X509_CRL * | ||
| 31 | .Fo d2i_X509_CRL_fp | ||
| 32 | .Fa "FILE *fp" | ||
| 33 | .Fa "X509_CRL **x" | ||
| 34 | .Fc | ||
| 35 | .Ft int | ||
| 36 | .Fo i2d_X509_CRL_bio | ||
| 37 | .Fa "BIO *bp" | ||
| 38 | .Fa "X509_CRL *x" | ||
| 39 | .Fc | ||
| 40 | .Ft int | ||
| 41 | .Fo i2d_X509_CRL_fp | ||
| 42 | .Fa "FILE *fp" | ||
| 43 | .Fa "X509_CRL *x" | ||
| 44 | .Fc | ||
| 45 | .Sh DESCRIPTION | ||
| 46 | These functions decode and encode an X509 CRL (certificate revocation | ||
| 47 | list). | ||
| 48 | .Pp | ||
| 49 | Otherwise the functions behave in a way similar to | ||
| 50 | .Xr d2i_X509 3 | ||
| 51 | and | ||
| 52 | .Xr i2d_X509 3 . | ||
| 53 | .Sh SEE ALSO | ||
| 54 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_NAME.3 b/src/lib/libcrypto/man/d2i_X509_NAME.3 new file mode 100644 index 0000000000..b145bf5b58 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_NAME.3 | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt D2I_X509_NAME 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm d2i_X509_NAME , | ||
| 6 | .Nm i2d_X509_NAME | ||
| 7 | .Nd X509_NAME encoding functions | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/x509.h | ||
| 10 | .Ft X509_NAME * | ||
| 11 | .Fo d2i_X509_NAME | ||
| 12 | .Fa "X509_NAME **a" | ||
| 13 | .Fa "unsigned char **pp" | ||
| 14 | .Fa "long length" | ||
| 15 | .Fc | ||
| 16 | .Ft int | ||
| 17 | .Fo i2d_X509_NAME | ||
| 18 | .Fa "X509_NAME *a" | ||
| 19 | .Fa "unsigned char **pp" | ||
| 20 | .Fc | ||
| 21 | .Sh DESCRIPTION | ||
| 22 | These functions decode and encode an | ||
| 23 | .Vt X509_NAME | ||
| 24 | structure which is the same as the | ||
| 25 | .Sy Name | ||
| 26 | type defined in RFC2459 (and elsewhere) and used for example in | ||
| 27 | certificate subject and issuer names. | ||
| 28 | .Pp | ||
| 29 | Otherwise the functions behave in a way similar to | ||
| 30 | .Xr d2i_X509 3 | ||
| 31 | and | ||
| 32 | .Xr i2d_X509 3 . | ||
| 33 | .Sh SEE ALSO | ||
| 34 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_REQ.3 b/src/lib/libcrypto/man/d2i_X509_REQ.3 new file mode 100644 index 0000000000..c69cd00fb1 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_REQ.3 | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt D2I_X509_REQ 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm d2i_X509_REQ , | ||
| 6 | .Nm i2d_X509_REQ , | ||
| 7 | .Nm d2i_X509_REQ_bio , | ||
| 8 | .Nm d2i_X509_REQ_fp , | ||
| 9 | .Nm i2d_X509_REQ_bio , | ||
| 10 | .Nm i2d_X509_REQ_fp | ||
| 11 | .Nd PKCS#10 certificate request functions | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/x509.h | ||
| 14 | .Ft X509_REQ * | ||
| 15 | .Fo d2i_X509_REQ | ||
| 16 | .Fa "X509_REQ **a" | ||
| 17 | .Fa "const unsigned char **pp" | ||
| 18 | .Fa "long length" | ||
| 19 | .Fc | ||
| 20 | .Ft int | ||
| 21 | .Fo i2d_X509_REQ | ||
| 22 | .Fa "X509_REQ *a" | ||
| 23 | .Fa "unsigned char **pp" | ||
| 24 | .Fc | ||
| 25 | .Ft X509_REQ * | ||
| 26 | .Fo d2i_X509_REQ_bio | ||
| 27 | .Fa "BIO *bp" | ||
| 28 | .Fa "X509_REQ **x" | ||
| 29 | .Fc | ||
| 30 | .Ft X509_REQ * | ||
| 31 | .Fo d2i_X509_REQ_fp | ||
| 32 | .Fa "FILE *fp" | ||
| 33 | .Fa "X509_REQ **x" | ||
| 34 | .Fc | ||
| 35 | .Ft int | ||
| 36 | .Fo i2d_X509_REQ_bio | ||
| 37 | .Fa "BIO *bp" | ||
| 38 | .Fa "X509_REQ *x" | ||
| 39 | .Fc | ||
| 40 | .Ft int | ||
| 41 | .Fo i2d_X509_REQ_fp | ||
| 42 | .Fa "FILE *fp" | ||
| 43 | .Fa "X509_REQ *x" | ||
| 44 | .Fc | ||
| 45 | .Sh DESCRIPTION | ||
| 46 | These functions decode and encode a PKCS#10 certificate request. | ||
| 47 | .Pp | ||
| 48 | Otherwise these behave in a way similar to | ||
| 49 | .Xr d2i_X509 3 | ||
| 50 | and | ||
| 51 | .Xr i2d_X509 3 . | ||
| 52 | .Sh SEE ALSO | ||
| 53 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/d2i_X509_SIG.3 b/src/lib/libcrypto/man/d2i_X509_SIG.3 new file mode 100644 index 0000000000..5356dd67de --- /dev/null +++ b/src/lib/libcrypto/man/d2i_X509_SIG.3 | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt D2I_X509_SIG 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm d2i_X509_SIG , | ||
| 6 | .Nm i2d_X509_SIG | ||
| 7 | .Nd DigestInfo functions | ||
| 8 | .Sh SYNOPSIS | ||
| 9 | .In openssl/x509.h | ||
| 10 | .Ft X509_SIG * | ||
| 11 | .Fo d2i_X509_SIG | ||
| 12 | .Fa "X509_SIG **a" | ||
| 13 | .Fa "unsigned char **pp" | ||
| 14 | .Fa "long length" | ||
| 15 | .Fc | ||
| 16 | .Ft int | ||
| 17 | .Fo i2d_X509_SIG | ||
| 18 | .Fa "X509_SIG *a" | ||
| 19 | .Fa "unsigned char **pp" | ||
| 20 | .Fc | ||
| 21 | .Sh DESCRIPTION | ||
| 22 | These functions decode and encode an | ||
| 23 | .Vt X509_SIG | ||
| 24 | structure which is equivalent to the | ||
| 25 | .Sy DigestInfo | ||
| 26 | structure defined in PKCS#1 and PKCS#7. | ||
| 27 | .Pp | ||
| 28 | Otherwise these behave in a way similar to | ||
| 29 | .Xr d2i_X509 3 | ||
| 30 | and | ||
| 31 | .Xr i2d_X509 3 . | ||
| 32 | .Sh SEE ALSO | ||
| 33 | .Xr d2i_X509 3 | ||
diff --git a/src/lib/libcrypto/man/x509.3 b/src/lib/libcrypto/man/x509.3 new file mode 100644 index 0000000000..1f7b7f4128 --- /dev/null +++ b/src/lib/libcrypto/man/x509.3 | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | .Dd $Mdocdate: November 4 2016 $ | ||
| 2 | .Dt X509 3 | ||
| 3 | .Os | ||
| 4 | .Sh NAME | ||
| 5 | .Nm x509 | ||
| 6 | .Nd X.509 certificate handling | ||
| 7 | .Sh SYNOPSIS | ||
| 8 | .In openssl/x509.h | ||
| 9 | .Sh DESCRIPTION | ||
| 10 | A X.509 certificate is a structured grouping of information about an | ||
| 11 | individual, a device, or anything one can imagine. | ||
| 12 | A X.509 CRL (certificate revocation list) is a tool to help determine if | ||
| 13 | a certificate is still valid. | ||
| 14 | The exact definition of those can be found in the X.509 document from | ||
| 15 | ITU-T, or in RFC3280 from PKIX. | ||
| 16 | In OpenSSL, the type | ||
| 17 | .Vt X509 | ||
| 18 | is used to express such a certificate, and the type | ||
| 19 | .Vt X509_CRL | ||
| 20 | is used to express a CRL. | ||
| 21 | .Pp | ||
| 22 | A related structure is a certificate request, defined in PKCS#10 from | ||
| 23 | RSA Security, Inc., also reflected in RFC2896. | ||
| 24 | In OpenSSL, the type | ||
| 25 | .Vt X509_REQ | ||
| 26 | is used to express such a certificate request. | ||
| 27 | .Pp | ||
| 28 | To handle some complex parts of a certificate, there are the types | ||
| 29 | .Vt X509_NAME | ||
| 30 | to express a certificate name, | ||
| 31 | .Vt X509_ATTRIBUTE | ||
| 32 | to express a certificate attribute, | ||
| 33 | .Vt X509_EXTENSION | ||
| 34 | to express a certificate extension, and a few more. | ||
| 35 | .Pp | ||
| 36 | Finally, there's the supertype | ||
| 37 | .Vt X509_INFO , | ||
| 38 | which can contain a CRL, a certificate, and a corresponding private key. | ||
| 39 | .Pp | ||
| 40 | The functions | ||
| 41 | .Fa X509_* , | ||
| 42 | .Fa d2i_X509_* , | ||
| 43 | and | ||
| 44 | .Fa i2d_X509_* | ||
| 45 | handle X.509 certificates, with some exceptions shown below. | ||
| 46 | .Pp | ||
| 47 | .Fa X509_CRL_* , | ||
| 48 | .Fa d2i_X509_CRL_* , | ||
| 49 | and | ||
| 50 | .Fa i2d_X509_CRL_* | ||
| 51 | handle X.509 CRLs. | ||
| 52 | .Pp | ||
| 53 | .Fa X509_REQ_* , | ||
| 54 | .Fa d2i_X509_REQ_* , | ||
| 55 | and | ||
| 56 | .Fa i2d_X509_REQ_* | ||
| 57 | handle PKCS#10 certificate requests. | ||
| 58 | .Pp | ||
| 59 | .Fa X509_NAME_* | ||
| 60 | handle certificate names. | ||
| 61 | .Pp | ||
| 62 | .Fa X509_ATTRIBUTE_* | ||
| 63 | handle certificate attributes. | ||
| 64 | .Pp | ||
| 65 | .Fa X509_EXTENSION_* | ||
| 66 | handle certificate extensions. | ||
| 67 | .Sh SEE ALSO | ||
| 68 | .Xr crypto 3 , | ||
| 69 | .Xr d2i_X509 3 , | ||
| 70 | .Xr d2i_X509_ALGOR 3 , | ||
| 71 | .Xr d2i_X509_CRL 3 , | ||
| 72 | .Xr d2i_X509_NAME 3 , | ||
| 73 | .Xr d2i_X509_REQ 3 , | ||
| 74 | .Xr d2i_X509_SIG 3 , | ||
| 75 | .Xr X509_NAME_add_entry_by_NID 3 , | ||
| 76 | .Xr X509_NAME_add_entry_by_txt 3 , | ||
| 77 | .Xr X509_NAME_ENTRY_get_object 3 , | ||
| 78 | .Xr X509_NAME_new 3 , | ||
| 79 | .Xr X509_NAME_print_ex 3 | ||
