source: mod_gnutls/test/cert_helper.h @ b0e4ce6

debian/masterdebian/stretch-backportsupstream
Last change on this file since b0e4ce6 was 42bee37, checked in by Thomas Klute <thomas2.klute@…>, 4 years ago

Test suite: OCSP index generation tool

gen_ocsp_index creates an index file in the format used by OpenSSL
from a list of certificates, e.g.:

./gen_ocsp_index server/x509.pem client/x509.pem

The purpose is to configure an OCSP responder for the test
environment.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 * Helper functions for certificate handling in the mod_gnutls test suite
3 *
4 * Copyright 2016 Thomas Klute
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you
7 * may not use this file except in compliance with the License.  You
8 * may obtain a copy of the License at
9 *
10 *      http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 * implied.  See the License for the specific language governing
16 * permissions and limitations under the License.
17 */
18#ifndef _MGS_CERT_HELPER_H_
19#define _MGS_CERT_HELPER_H_
20
21#include <gnutls/gnutls.h>
22
23
24
25/**
26 * Read the file "filename" into "cert", plus a NULL byte at the
27 * end. "filename" may be NULL, in that case input is read from
28 * stdin. The size field of data is set accordingly. The data field is
29 * allocated to the needed size, the caller must free it when no
30 * longer needed.
31 *
32 * Returns zero on success, or an error code (errno after the failed
33 * operation).
34 */
35size_t read_cert(const char* filename, gnutls_datum_t* cert);
36
37
38
39/**
40 * Transform a DER encoded X.509 certificate to PEM using GnuTLS
41 * import/export functions. The caller is responsible for releasing
42 * the returned data structure when it is no longer needed. A return
43 * value of NULL indicates an error.
44 */
45gnutls_datum_t* der_to_pem(const gnutls_datum_t* der);
46
47#endif /* _MGS_CERT_HELPER_H_ */
Note: See TracBrowser for help on using the repository browser.