60 lines
1.7 KiB
Text
60 lines
1.7 KiB
Text
#
|
|
# AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
#
|
|
msgid ""
|
|
msgstr ""
|
|
"Project-Id-Version: 0\n"
|
|
"POT-Creation-Date: 2013-08-13T01:54:52\n"
|
|
"PO-Revision-Date: 2013-08-13T01:54:52\n"
|
|
"Last-Translator: Automatically generated\n"
|
|
"Language-Team: None\n"
|
|
"MIME-Version: 1.0\n"
|
|
"Content-Type: application/x-publican; charset=UTF-8\n"
|
|
"Content-Transfer-Encoding: 8bit\n"
|
|
|
|
#. Tag: programlisting
|
|
#, no-c-format
|
|
msgid "\n"
|
|
"// Obtain the server certificate chain. The server certificate\n"
|
|
"// itself is stored in the first element of the array.\n"
|
|
"unsigned certslen = 0;\n"
|
|
"const gnutls_datum_t *const certs =\n"
|
|
" gnutls_certificate_get_peers(session, &certslen);\n"
|
|
"if (certs == NULL || certslen == 0) {\n"
|
|
" fprintf(stderr, \"error: could not obtain peer certificate\n"
|
|
"\");\n"
|
|
" exit(1);\n"
|
|
"}\n"
|
|
"\n"
|
|
"// Validate the certificate chain.\n"
|
|
"unsigned status = (unsigned)-1;\n"
|
|
"ret = gnutls_certificate_verify_peers2(session, &status);\n"
|
|
"if (ret != GNUTLS_E_SUCCESS) {\n"
|
|
" fprintf(stderr, \"error: gnutls_certificate_verify_peers2: %s\n"
|
|
"\",\n"
|
|
" gnutls_strerror(ret));\n"
|
|
" exit(1);\n"
|
|
"}\n"
|
|
"if (status != 0 && !certificate_validity_override(certs[0])) {\n"
|
|
" gnutls_datum_t msg;\n"
|
|
"#if GNUTLS_VERSION_AT_LEAST_3_1_4\n"
|
|
" int type = gnutls_certificate_type_get (session);\n"
|
|
" ret = gnutls_certificate_verification_status_print(status, type, &out, 0);\n"
|
|
"#else\n"
|
|
" ret = -1;\n"
|
|
"#endif\n"
|
|
" if (ret == 0) {\n"
|
|
" fprintf(stderr, \"error: %s\n"
|
|
"\", msg.data);\n"
|
|
" gnutls_free(msg.data);\n"
|
|
" exit(1);\n"
|
|
" } else {\n"
|
|
" fprintf(stderr, \"error: certificate validation failed with code 0x%x\n"
|
|
"\",\n"
|
|
" status);\n"
|
|
" exit(1);\n"
|
|
" }\n"
|
|
"}\n"
|
|
""
|
|
msgstr ""
|
|
|