tlscredspsk.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * QEMU crypto TLS Pre-Shared Key (PSK) support
  3. *
  4. * Copyright (c) 2018 Red Hat, Inc.
  5. *
  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.
  10. *
  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.
  15. *
  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/>.
  18. *
  19. */
  20. #ifndef QCRYPTO_TLSCREDSPSK_H
  21. #define QCRYPTO_TLSCREDSPSK_H
  22. #include "crypto/tlscreds.h"
  23. #include "qom/object.h"
  24. #define TYPE_QCRYPTO_TLS_CREDS_PSK "tls-creds-psk"
  25. typedef struct QCryptoTLSCredsPSK QCryptoTLSCredsPSK;
  26. DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsPSK, QCRYPTO_TLS_CREDS_PSK,
  27. TYPE_QCRYPTO_TLS_CREDS_PSK)
  28. typedef struct QCryptoTLSCredsPSKClass QCryptoTLSCredsPSKClass;
  29. #define QCRYPTO_TLS_CREDS_PSKFILE "keys.psk"
  30. /**
  31. * QCryptoTLSCredsPSK:
  32. *
  33. * The QCryptoTLSCredsPSK object provides a representation
  34. * of the Pre-Shared Key credential used to perform a TLS handshake.
  35. *
  36. * This is a user creatable object, which can be instantiated
  37. * via object_new_propv():
  38. *
  39. * <example>
  40. * <title>Creating TLS-PSK credential objects in code</title>
  41. * <programlisting>
  42. * Object *obj;
  43. * Error *err = NULL;
  44. * obj = object_new_propv(TYPE_QCRYPTO_TLS_CREDS_PSK,
  45. * "tlscreds0",
  46. * &err,
  47. * "dir", "/path/to/dir",
  48. * "endpoint", "client",
  49. * NULL);
  50. * </programlisting>
  51. * </example>
  52. *
  53. * Or via QMP:
  54. *
  55. * <example>
  56. * <title>Creating TLS-PSK credential objects via QMP</title>
  57. * <programlisting>
  58. * {
  59. * "execute": "object-add", "arguments": {
  60. * "id": "tlscreds0",
  61. * "qom-type": "tls-creds-psk",
  62. * "props": {
  63. * "dir": "/path/to/dir",
  64. * "endpoint": "client"
  65. * }
  66. * }
  67. * }
  68. * </programlisting>
  69. * </example>
  70. *
  71. * Or via the CLI:
  72. *
  73. * <example>
  74. * <title>Creating TLS-PSK credential objects via CLI</title>
  75. * <programlisting>
  76. * qemu-system-x86_64 --object tls-creds-psk,id=tlscreds0,\
  77. * endpoint=client,dir=/path/to/dir[,username=qemu]
  78. * </programlisting>
  79. * </example>
  80. *
  81. * The PSK file can be created and managed using psktool.
  82. */
  83. struct QCryptoTLSCredsPSKClass {
  84. QCryptoTLSCredsClass parent_class;
  85. };
  86. #endif /* QCRYPTO_TLSCREDSPSK_H */