.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "fr::crypto::X509_STORE_CTX_set_verify_cb 3SSL" .TH fr::crypto::X509_STORE_CTX_set_verify_cb 3SSL "2015-12-31" "1.0.2a 1.0.2c" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NOM" .IX Header "NOM" X509_STORE_CTX_set_verify_cb \- Définir un rappel de vérification .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include .Ve .PP \&\fB void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *\fR\fIctx\fR\fB,\fR \fBint (*verify_cb)(int\fR \fIok\fR\fB, X509_STORE_CTX *\fR\fIctx\fR\fB));\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBX509_STORE_CTX_set_verify_cb\fR() définit le rappel de vérification de \&\fIctx\fR à \fIverify_cb\fR en écrasant tout rappel existant. .PP Le rappel de vérification peut être utilisé pour personnaliser l'opération de vérification de certificat, soit en écrasant les conditions d'erreur, soit en journalisant les erreurs dans un but de débogage. .PP Cependant, un rappel de vérification n'est \fBpas\fR essentiel, et l'opération par défaut est souvent suffisante. .PP Le paramètre \fIok\fR du rappel indique la valeur que le rappel devrait retourner pour conserver le comportement par défaut. Si c'est zéro, alors un état d'erreur est indiqué. Si c'est 1, alors aucune erreur n'est arrivée. Si le drapeau \fBX509_V_FLAG_NOTIFY_POLICY\fR est activé, alors \fIok\fR est mis à 2 pour indiquer que la vérification de politique est terminée. .PP Le paramètre \fIctx\fR du rappel est la structure \fBX509_STORE_CTX\fR qui réalise l'opération de vérification. Un rappel peut examiner cette structure et recevoir des informations supplémentaires sur l'erreur, par exemple en appelant \fBX509_STORE_CTX_get_current_cert\fR(). Des données d'application supplémentaires peuvent être passées au rappel par le mécanisme \fIex_data\fR. .SH "AVERTISSEMENT" .IX Header "AVERTISSEMENT" En général, un rappel de vérification ne devrait \fBpas\fR renvoyer 1 sans condition en toutes circonstances, parce que cela permettrait à la vérification de réussir quelque soit l'erreur. Cela retire effectivement toute la sécurité de l'application parce que \fBtous\fR les certificats (y compris ceux générés qui ne sont pas de confiance) seront acceptés. .SH "NOTES" .IX Header "NOTES" Le rappel de vérification peut être défini et hérité de la structure mère réalisant l'opération. Dans certains cas (comme une vérification S/MIME), la structure \fBX509_STORE_CTX\fR est créée et détruite en interne et la seule façon de définir un rappel de vérification personnalisé est par héritage de la structure \fBX509_STORE\fR associée. .SH "VALEURS DE RETOUR" .IX Header "VALEURS DE RETOUR" \&\fBX509_STORE_CTX_set_verify_cb\fR() ne renvoie aucune valeur. .SH "EXEMPLES" .IX Header "EXEMPLES" Opération de rappel par défaut : .PP .Vb 4 \& int verify_callback(int ok, X509_STORE_CTX *ctx) \& { \& return ok; \& } .Ve .PP Exemple simple, supposez qu'un certificat de la chaîne soit expiré, et que le but est de continuer après cette erreur : .PP .Vb 8 \& int verify_callback(int ok, X509_STORE_CTX *ctx) \& { \& /* Tolérer l\*(Aqexpiration de certificat */ \& if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_HAS_EXPIRED) \& return 1; \& /* Sinon ne rien écraser */ \& return ok; \& } .Ve .PP Exemple plus compliqué, où le but est de ne pas continuer après \fBn'importe quel\fR certificat expiré, mais seulement dans un cas particulier : .PP .Vb 11 \& int verify_callback(int ok, X509_STORE_CTX *ctx) \& { \& int err = X509_STORE_CTX_get_error(ctx); \& X509 *err_cert = X509_STORE_CTX_get_current_cert(ctx); \& if (err == X509_V_ERR_CERT_HAS_EXPIRED) \& { \& if (check_is_acceptable_expired_cert(err_cert) \& return 1; \& } \& return ok; \& } .Ve .PP Rappel avec journalisation complète. Dans ce cas, le \fIbio_err\fR est supposé être un \fB\s-1BIO\s0\fR de journalisation globale, une alternative serait de conserver un \s-1BIO \s0 dans \fIctx\fR en utilisant \fIex_data\fR. .PP .Vb 4 \& int verify_callback(int ok, X509_STORE_CTX *ctx) \& { \& X509 *err_cert; \& int err,depth; \& \& err_cert = X509_STORE_CTX_get_current_cert(ctx); \& err = X509_STORE_CTX_get_error(ctx); \& depth = X509_STORE_CTX_get_error_depth(ctx); \& \& BIO_printf(bio_err,"depth=%d ",depth); \& if (err_cert) \& { \& X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert), \& 0, XN_FLAG_ONELINE); \& BIO_puts(bio_err, "\en"); \& } \& else \& BIO_puts(bio_err, "\en"); \& if S<( !ok)> \& BIO_printf(bio_err,"verify error:num=%d:%s\en",err, \& X509_verify_cert_error_string(err)); \& switch (err) \& { \& case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: \& BIO_puts(bio_err,"issuer= "); \& X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert), \& 0, XN_FLAG_ONELINE); \& BIO_puts(bio_err, "\en"); \& break; \& case X509_V_ERR_CERT_NOT_YET_VALID: \& case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD: \& BIO_printf(bio_err,"notBefore="); \& ASN1_TIME_print(bio_err,X509_get_notBefore(err_cert)); \& BIO_printf(bio_err,"\en"); \& break; \& case X509_V_ERR_CERT_HAS_EXPIRED: \& case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD: \& BIO_printf(bio_err,"notAfter="); \& ASN1_TIME_print(bio_err,X509_get_notAfter(err_cert)); \& BIO_printf(bio_err,"\en"); \& break; \& case X509_V_ERR_NO_EXPLICIT_POLICY: \& policies_print(bio_err, ctx); \& break; \& } \& if (err == X509_V_OK && ok == 2) \& /* afficher les politiques */ \& \& BIO_printf(bio_err,"verify return:%d\en",ok); \& return(ok); \& } .Ve .SH "VOIR AUSSI" .IX Header "VOIR AUSSI" \&\fBX509_STORE_CTX_get_error\fR(3), \&\fBX509_STORE_CTX_get_ex_new_index\fR(3)(3)>, \&\fBX509_STORE_set_verify_cb_func\fR(3) .SH "HISTORIQUE" .IX Header "HISTORIQUE" \&\fBX509_STORE_CTX_set_verify_cb\fR() est disponible dans toutes les versions de SSLeay et d'OpenSSL. .SH "TRADUCTION" .IX Header "TRADUCTION" La traduction de cette page de manuel est maintenue par les membres de la liste . Veuillez signaler toute erreur de traduction par un rapport de bogue sur le paquet manpages-fr-extra.