2 * QEMU crypto TLS Pre-Shared Key (PSK) support
4 * Copyright (c) 2018 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QCRYPTO_TLSCREDSPSK_H
22 #define QCRYPTO_TLSCREDSPSK_H
24 #include "crypto/tlscreds.h"
25 #include "qom/object.h"
27 #define TYPE_QCRYPTO_TLS_CREDS_PSK "tls-creds-psk"
28 typedef struct QCryptoTLSCredsPSK QCryptoTLSCredsPSK
;
29 DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsPSK
, QCRYPTO_TLS_CREDS_PSK
,
30 TYPE_QCRYPTO_TLS_CREDS_PSK
)
32 typedef struct QCryptoTLSCredsPSKClass QCryptoTLSCredsPSKClass
;
34 #define QCRYPTO_TLS_CREDS_PSKFILE "keys.psk"
39 * The QCryptoTLSCredsPSK object provides a representation
40 * of the Pre-Shared Key credential used to perform a TLS handshake.
42 * This is a user creatable object, which can be instantiated
43 * via object_new_propv():
46 * <title>Creating TLS-PSK credential objects in code</title>
50 * obj = object_new_propv(TYPE_QCRYPTO_TLS_CREDS_PSK,
53 * "dir", "/path/to/dir",
54 * "endpoint", "client",
62 * <title>Creating TLS-PSK credential objects via QMP</title>
65 * "execute": "object-add", "arguments": {
67 * "qom-type": "tls-creds-psk",
69 * "dir": "/path/to/dir",
70 * "endpoint": "client"
80 * <title>Creating TLS-PSK credential objects via CLI</title>
82 * qemu-system-x86_64 --object tls-creds-psk,id=tlscreds0,\
83 * endpoint=client,dir=/path/to/dir[,username=qemu]
87 * The PSK file can be created and managed using psktool.
90 struct QCryptoTLSCredsPSKClass
{
91 QCryptoTLSCredsClass parent_class
;
95 #endif /* QCRYPTO_TLSCREDSPSK_H */