backup: Wire up qemu full pull backup commands over QMP
[libvirt/ericb.git] / tests / virnettlshelpers.h
blob4c6f5e8c3139e80d6844a633a637aa9e54e2ba65
1 /*
2 * Copyright (C) 2011-2013 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see
16 * <http://www.gnu.org/licenses/>.
19 #pragma once
21 #include <gnutls/gnutls.h>
22 #include <gnutls/x509.h>
24 #if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
26 # include <libtasn1.h>
28 # include "rpc/virnettlscontext.h"
31 * This contains parameter about how to generate
32 * certificates.
34 struct testTLSCertReq {
35 gnutls_x509_crt_t crt;
37 const char *filename;
39 /* Identifying information */
40 const char *country;
41 const char *cn;
42 const char *altname1;
43 const char *altname2;
44 const char *ipaddr1;
45 const char *ipaddr2;
47 /* Basic constraints */
48 bool basicConstraintsEnable;
49 bool basicConstraintsCritical;
50 bool basicConstraintsIsCA;
52 /* Key usage */
53 bool keyUsageEnable;
54 bool keyUsageCritical;
55 int keyUsageValue;
57 /* Key purpose (aka Extended key usage) */
58 bool keyPurposeEnable;
59 bool keyPurposeCritical;
60 const char *keyPurposeOID1;
61 const char *keyPurposeOID2;
63 /* zero for current time, or non-zero for hours from now */
64 int start_offset;
65 /* zero for 24 hours from now, or non-zero for hours from now */
66 int expire_offset;
69 void testTLSGenerateCert(struct testTLSCertReq *req,
70 gnutls_x509_crt_t ca);
71 void testTLSWriteCertChain(const char *filename,
72 gnutls_x509_crt_t *certs,
73 size_t ncerts);
74 void testTLSDiscardCert(struct testTLSCertReq *req);
76 void testTLSInit(const char *keyfile);
77 void testTLSCleanup(const char *keyfile);
79 #endif