source: mod_gnutls/test/cert_helper.h

main
Last change on this file was 3c123cd, checked in by Fiona Klute <fiona.klute@…>, 5 years ago

Update my name, prepare changelog for the next release

  • 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 Fiona 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.