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/>.
21 #include <gnutls/gnutls.h>
22 #include <gnutls/x509.h>
24 #if !defined WIN32 && WITH_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
26 # include <libtasn1.h>
28 # include "rpc/virnettlscontext.h"
31 * This contains parameter about how to generate
34 struct testTLSCertReq
{
35 gnutls_x509_crt_t crt
;
39 /* Identifying information */
47 /* Basic constraints */
48 bool basicConstraintsEnable
;
49 bool basicConstraintsCritical
;
50 bool basicConstraintsIsCA
;
54 bool keyUsageCritical
;
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 */
65 /* zero for 24 hours from now, or non-zero for hours from now */
69 void testTLSGenerateCert(struct testTLSCertReq
*req
,
70 gnutls_x509_crt_t ca
);
71 void testTLSWriteCertChain(const char *filename
,
72 gnutls_x509_crt_t
*certs
,
74 void testTLSDiscardCert(struct testTLSCertReq
*req
);
76 void testTLSInit(const char *keyfile
);
77 void testTLSCleanup(const char *keyfile
);