1# -*- Mode: Python -*- 2# vim: filetype=python 3# 4 5## 6# = Cryptography 7## 8 9## 10# @QCryptoTLSCredsEndpoint: 11# 12# The type of network endpoint that will be using the credentials. 13# Most types of credential require different setup / structures 14# depending on whether they will be used in a server versus a client. 15# 16# @client: the network endpoint is acting as the client 17# 18# @server: the network endpoint is acting as the server 19# 20# Since: 2.5 21## 22{ 'enum': 'QCryptoTLSCredsEndpoint', 23 'data': ['client', 'server']} 24 25## 26# @QCryptoSecretFormat: 27# 28# The data format that the secret is provided in 29# 30# @raw: raw bytes. When encoded in JSON only valid UTF-8 sequences 31# can be used 32# 33# @base64: arbitrary base64 encoded binary data 34# 35# Since: 2.6 36## 37{ 'enum': 'QCryptoSecretFormat', 38 'data': ['raw', 'base64']} 39 40## 41# @QCryptoHashAlgorithm: 42# 43# The supported algorithms for computing content digests 44# 45# @md5: MD5. Should not be used in any new code, legacy compat only 46# 47# @sha1: SHA-1. Should not be used in any new code, legacy compat only 48# 49# @sha224: SHA-224. (since 2.7) 50# 51# @sha256: SHA-256. Current recommended strong hash. 52# 53# @sha384: SHA-384. (since 2.7) 54# 55# @sha512: SHA-512. (since 2.7) 56# 57# @ripemd160: RIPEMD-160. (since 2.7) 58# 59# Since: 2.6 60## 61{ 'enum': 'QCryptoHashAlgorithm', 62 'prefix': 'QCRYPTO_HASH_ALG', 63 'data': ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'ripemd160']} 64 65## 66# @QCryptoCipherAlgorithm: 67# 68# The supported algorithms for content encryption ciphers 69# 70# @aes-128: AES with 128 bit / 16 byte keys 71# 72# @aes-192: AES with 192 bit / 24 byte keys 73# 74# @aes-256: AES with 256 bit / 32 byte keys 75# 76# @des: DES with 56 bit / 8 byte keys. Do not use except in VNC. 77# (since 6.1) 78# 79# @3des: 3DES(EDE) with 192 bit / 24 byte keys (since 2.9) 80# 81# @cast5-128: Cast5 with 128 bit / 16 byte keys 82# 83# @serpent-128: Serpent with 128 bit / 16 byte keys 84# 85# @serpent-192: Serpent with 192 bit / 24 byte keys 86# 87# @serpent-256: Serpent with 256 bit / 32 byte keys 88# 89# @twofish-128: Twofish with 128 bit / 16 byte keys 90# 91# @twofish-192: Twofish with 192 bit / 24 byte keys 92# 93# @twofish-256: Twofish with 256 bit / 32 byte keys 94# 95# @sm4: SM4 with 128 bit / 16 byte keys (since 9.0) 96# 97# Since: 2.6 98## 99{ 'enum': 'QCryptoCipherAlgorithm', 100 'prefix': 'QCRYPTO_CIPHER_ALG', 101 'data': ['aes-128', 'aes-192', 'aes-256', 102 'des', '3des', 103 'cast5-128', 104 'serpent-128', 'serpent-192', 'serpent-256', 105 'twofish-128', 'twofish-192', 'twofish-256', 106 'sm4']} 107 108## 109# @QCryptoCipherMode: 110# 111# The supported modes for content encryption ciphers 112# 113# @ecb: Electronic Code Book 114# 115# @cbc: Cipher Block Chaining 116# 117# @xts: XEX with tweaked code book and ciphertext stealing 118# 119# @ctr: Counter (Since 2.8) 120# 121# Since: 2.6 122## 123{ 'enum': 'QCryptoCipherMode', 124 'data': ['ecb', 'cbc', 'xts', 'ctr']} 125 126## 127# @QCryptoIVGenAlgorithm: 128# 129# The supported algorithms for generating initialization vectors for 130# full disk encryption. The 'plain' generator should not be used for 131# disks with sector numbers larger than 2^32, except where 132# compatibility with pre-existing Linux dm-crypt volumes is required. 133# 134# @plain: 64-bit sector number truncated to 32-bits 135# 136# @plain64: 64-bit sector number 137# 138# @essiv: 64-bit sector number encrypted with a hash of the encryption 139# key 140# 141# Since: 2.6 142## 143{ 'enum': 'QCryptoIVGenAlgorithm', 144 'prefix': 'QCRYPTO_IVGEN_ALG', 145 'data': ['plain', 'plain64', 'essiv']} 146 147## 148# @QCryptoBlockFormat: 149# 150# The supported full disk encryption formats 151# 152# @qcow: QCow/QCow2 built-in AES-CBC encryption. Use only for 153# liberating data from old images. 154# 155# @luks: LUKS encryption format. Recommended for new images 156# 157# Since: 2.6 158## 159{ 'enum': 'QCryptoBlockFormat', 160 'prefix': 'Q_CRYPTO_BLOCK_FORMAT', # TODO drop 161 'data': ['qcow', 'luks']} 162 163## 164# @QCryptoBlockOptionsBase: 165# 166# The common options that apply to all full disk encryption formats 167# 168# @format: the encryption format 169# 170# Since: 2.6 171## 172{ 'struct': 'QCryptoBlockOptionsBase', 173 'data': { 'format': 'QCryptoBlockFormat' }} 174 175## 176# @QCryptoBlockOptionsQCow: 177# 178# The options that apply to QCow/QCow2 AES-CBC encryption format 179# 180# @key-secret: the ID of a QCryptoSecret object providing the 181# decryption key. Mandatory except when probing image for 182# metadata only. 183# 184# Since: 2.6 185## 186{ 'struct': 'QCryptoBlockOptionsQCow', 187 'data': { '*key-secret': 'str' }} 188 189## 190# @QCryptoBlockOptionsLUKS: 191# 192# The options that apply to LUKS encryption format 193# 194# @key-secret: the ID of a QCryptoSecret object providing the 195# decryption key. Mandatory except when probing image for 196# metadata only. 197# 198# Since: 2.6 199## 200{ 'struct': 'QCryptoBlockOptionsLUKS', 201 'data': { '*key-secret': 'str' }} 202 203## 204# @QCryptoBlockCreateOptionsLUKS: 205# 206# The options that apply to LUKS encryption format initialization 207# 208# @cipher-alg: the cipher algorithm for data encryption Currently 209# defaults to 'aes-256'. 210# 211# @cipher-mode: the cipher mode for data encryption Currently defaults 212# to 'xts' 213# 214# @ivgen-alg: the initialization vector generator Currently defaults 215# to 'plain64' 216# 217# @ivgen-hash-alg: the initialization vector generator hash Currently 218# defaults to 'sha256' 219# 220# @hash-alg: the master key hash algorithm Currently defaults to 221# 'sha256' 222# 223# @iter-time: number of milliseconds to spend in PBKDF passphrase 224# processing. Currently defaults to 2000. (since 2.8) 225# 226# Since: 2.6 227## 228{ 'struct': 'QCryptoBlockCreateOptionsLUKS', 229 'base': 'QCryptoBlockOptionsLUKS', 230 'data': { '*cipher-alg': 'QCryptoCipherAlgorithm', 231 '*cipher-mode': 'QCryptoCipherMode', 232 '*ivgen-alg': 'QCryptoIVGenAlgorithm', 233 '*ivgen-hash-alg': 'QCryptoHashAlgorithm', 234 '*hash-alg': 'QCryptoHashAlgorithm', 235 '*iter-time': 'int' }} 236 237## 238# @QCryptoBlockOpenOptions: 239# 240# The options that are available for all encryption formats when 241# opening an existing volume 242# 243# Since: 2.6 244## 245{ 'union': 'QCryptoBlockOpenOptions', 246 'base': 'QCryptoBlockOptionsBase', 247 'discriminator': 'format', 248 'data': { 'qcow': 'QCryptoBlockOptionsQCow', 249 'luks': 'QCryptoBlockOptionsLUKS' } } 250 251## 252# @QCryptoBlockCreateOptions: 253# 254# The options that are available for all encryption formats when 255# initializing a new volume 256# 257# Since: 2.6 258## 259{ 'union': 'QCryptoBlockCreateOptions', 260 'base': 'QCryptoBlockOptionsBase', 261 'discriminator': 'format', 262 'data': { 'qcow': 'QCryptoBlockOptionsQCow', 263 'luks': 'QCryptoBlockCreateOptionsLUKS' } } 264 265## 266# @QCryptoBlockInfoBase: 267# 268# The common information that applies to all full disk encryption 269# formats 270# 271# @format: the encryption format 272# 273# Since: 2.7 274## 275{ 'struct': 'QCryptoBlockInfoBase', 276 'data': { 'format': 'QCryptoBlockFormat' }} 277 278## 279# @QCryptoBlockInfoLUKSSlot: 280# 281# Information about the LUKS block encryption key slot options 282# 283# @active: whether the key slot is currently in use 284# 285# @key-offset: offset to the key material in bytes 286# 287# @iters: number of PBKDF2 iterations for key material 288# 289# @stripes: number of stripes for splitting key material 290# 291# Since: 2.7 292## 293{ 'struct': 'QCryptoBlockInfoLUKSSlot', 294 'data': {'active': 'bool', 295 '*iters': 'int', 296 '*stripes': 'int', 297 'key-offset': 'int' } } 298 299## 300# @QCryptoBlockInfoLUKS: 301# 302# Information about the LUKS block encryption options 303# 304# @cipher-alg: the cipher algorithm for data encryption 305# 306# @cipher-mode: the cipher mode for data encryption 307# 308# @ivgen-alg: the initialization vector generator 309# 310# @ivgen-hash-alg: the initialization vector generator hash 311# 312# @hash-alg: the master key hash algorithm 313# 314# @detached-header: whether the LUKS header is detached (Since 9.0) 315# 316# @payload-offset: offset to the payload data in bytes 317# 318# @master-key-iters: number of PBKDF2 iterations for key material 319# 320# @uuid: unique identifier for the volume 321# 322# @slots: information about each key slot 323# 324# Since: 2.7 325## 326{ 'struct': 'QCryptoBlockInfoLUKS', 327 'data': {'cipher-alg': 'QCryptoCipherAlgorithm', 328 'cipher-mode': 'QCryptoCipherMode', 329 'ivgen-alg': 'QCryptoIVGenAlgorithm', 330 '*ivgen-hash-alg': 'QCryptoHashAlgorithm', 331 'hash-alg': 'QCryptoHashAlgorithm', 332 'detached-header': 'bool', 333 'payload-offset': 'int', 334 'master-key-iters': 'int', 335 'uuid': 'str', 336 'slots': [ 'QCryptoBlockInfoLUKSSlot' ] }} 337 338## 339# @QCryptoBlockInfo: 340# 341# Information about the block encryption options 342# 343# Since: 2.7 344## 345{ 'union': 'QCryptoBlockInfo', 346 'base': 'QCryptoBlockInfoBase', 347 'discriminator': 'format', 348 'data': { 'luks': 'QCryptoBlockInfoLUKS' } } 349 350## 351# @QCryptoBlockLUKSKeyslotState: 352# 353# Defines state of keyslots that are affected by the update 354# 355# @active: The slots contain the given password and marked as active 356# 357# @inactive: The slots are erased (contain garbage) and marked as 358# inactive 359# 360# Since: 5.1 361## 362{ 'enum': 'QCryptoBlockLUKSKeyslotState', 363 'prefix': 'Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE', # TODO drop 364 'data': [ 'active', 'inactive' ] } 365 366## 367# @QCryptoBlockAmendOptionsLUKS: 368# 369# This struct defines the update parameters that activate/de-activate 370# set of keyslots 371# 372# @state: the desired state of the keyslots 373# 374# @new-secret: The ID of a QCryptoSecret object providing the password 375# to be written into added active keyslots 376# 377# @old-secret: Optional (for deactivation only) If given will 378# deactivate all keyslots that match password located in 379# QCryptoSecret with this ID 380# 381# @iter-time: Optional (for activation only) Number of milliseconds to 382# spend in PBKDF passphrase processing for the newly activated 383# keyslot. Currently defaults to 2000. 384# 385# @keyslot: Optional. ID of the keyslot to activate/deactivate. For 386# keyslot activation, keyslot should not be active already (this 387# is unsafe to update an active keyslot), but possible if 'force' 388# parameter is given. If keyslot is not given, first free keyslot 389# will be written. 390# 391# For keyslot deactivation, this parameter specifies the exact 392# keyslot to deactivate 393# 394# @secret: Optional. The ID of a QCryptoSecret object providing the 395# password to use to retrieve current master key. Defaults to the 396# same secret that was used to open the image 397# 398# Since: 5.1 399## 400{ 'struct': 'QCryptoBlockAmendOptionsLUKS', 401 'data': { 'state': 'QCryptoBlockLUKSKeyslotState', 402 '*new-secret': 'str', 403 '*old-secret': 'str', 404 '*keyslot': 'int', 405 '*iter-time': 'int', 406 '*secret': 'str' } } 407 408## 409# @QCryptoBlockAmendOptions: 410# 411# The options that are available for all encryption formats when 412# amending encryption settings 413# 414# Since: 5.1 415## 416{ 'union': 'QCryptoBlockAmendOptions', 417 'base': 'QCryptoBlockOptionsBase', 418 'discriminator': 'format', 419 'data': { 420 'luks': 'QCryptoBlockAmendOptionsLUKS' } } 421 422## 423# @SecretCommonProperties: 424# 425# Properties for objects of classes derived from secret-common. 426# 427# @loaded: if true, the secret is loaded immediately when applying 428# this option and will probably fail when processing the next 429# option. Don't use; only provided for compatibility. 430# (default: false) 431# 432# @format: the data format that the secret is provided in 433# (default: raw) 434# 435# @keyid: the name of another secret that should be used to decrypt 436# the provided data. If not present, the data is assumed to be 437# unencrypted. 438# 439# @iv: the random initialization vector used for encryption of this 440# particular secret. Should be a base64 encrypted string of the 441# 16-byte IV. Mandatory if @keyid is given. Ignored if @keyid is 442# absent. 443# 444# Features: 445# 446# @deprecated: Member @loaded is deprecated. Setting true doesn't 447# make sense, and false is already the default. 448# 449# Since: 2.6 450## 451{ 'struct': 'SecretCommonProperties', 452 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] }, 453 '*format': 'QCryptoSecretFormat', 454 '*keyid': 'str', 455 '*iv': 'str' } } 456 457## 458# @SecretProperties: 459# 460# Properties for secret objects. 461# 462# Either @data or @file must be provided, but not both. 463# 464# @data: the associated with the secret from 465# 466# @file: the filename to load the data associated with the secret from 467# 468# Since: 2.6 469## 470{ 'struct': 'SecretProperties', 471 'base': 'SecretCommonProperties', 472 'data': { '*data': 'str', 473 '*file': 'str' } } 474 475## 476# @SecretKeyringProperties: 477# 478# Properties for secret_keyring objects. 479# 480# @serial: serial number that identifies a key to get from the kernel 481# 482# Since: 5.1 483## 484{ 'struct': 'SecretKeyringProperties', 485 'base': 'SecretCommonProperties', 486 'data': { 'serial': 'int32' }, 487 'if': 'CONFIG_SECRET_KEYRING' } 488 489## 490# @TlsCredsProperties: 491# 492# Properties for objects of classes derived from tls-creds. 493# 494# @verify-peer: if true the peer credentials will be verified once the 495# handshake is completed. This is a no-op for anonymous 496# credentials. (default: true) 497# 498# @dir: the path of the directory that contains the credential files 499# 500# @endpoint: whether the QEMU network backend that uses the 501# credentials will be acting as a client or as a server 502# (default: client) 503# 504# @priority: a gnutls priority string as described at 505# https://gnutls.org/manual/html_node/Priority-Strings.html 506# 507# Since: 2.5 508## 509{ 'struct': 'TlsCredsProperties', 510 'data': { '*verify-peer': 'bool', 511 '*dir': 'str', 512 '*endpoint': 'QCryptoTLSCredsEndpoint', 513 '*priority': 'str' } } 514 515## 516# @TlsCredsAnonProperties: 517# 518# Properties for tls-creds-anon objects. 519# 520# @loaded: if true, the credentials are loaded immediately when 521# applying this option and will ignore options that are processed 522# later. Don't use; only provided for compatibility. 523# (default: false) 524# 525# Features: 526# 527# @deprecated: Member @loaded is deprecated. Setting true doesn't 528# make sense, and false is already the default. 529# 530# Since: 2.5 531## 532{ 'struct': 'TlsCredsAnonProperties', 533 'base': 'TlsCredsProperties', 534 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] } } } 535 536## 537# @TlsCredsPskProperties: 538# 539# Properties for tls-creds-psk objects. 540# 541# @loaded: if true, the credentials are loaded immediately when 542# applying this option and will ignore options that are processed 543# later. Don't use; only provided for compatibility. 544# (default: false) 545# 546# @username: the username which will be sent to the server. For 547# clients only. If absent, "qemu" is sent and the property will 548# read back as an empty string. 549# 550# Features: 551# 552# @deprecated: Member @loaded is deprecated. Setting true doesn't 553# make sense, and false is already the default. 554# 555# Since: 3.0 556## 557{ 'struct': 'TlsCredsPskProperties', 558 'base': 'TlsCredsProperties', 559 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] }, 560 '*username': 'str' } } 561 562## 563# @TlsCredsX509Properties: 564# 565# Properties for tls-creds-x509 objects. 566# 567# @loaded: if true, the credentials are loaded immediately when 568# applying this option and will ignore options that are processed 569# later. Don't use; only provided for compatibility. 570# (default: false) 571# 572# @sanity-check: if true, perform some sanity checks before using the 573# credentials (default: true) 574# 575# @passwordid: For the server-key.pem and client-key.pem files which 576# contain sensitive private keys, it is possible to use an 577# encrypted version by providing the @passwordid parameter. This 578# provides the ID of a previously created secret object containing 579# the password for decryption. 580# 581# Features: 582# 583# @deprecated: Member @loaded is deprecated. Setting true doesn't 584# make sense, and false is already the default. 585# 586# Since: 2.5 587## 588{ 'struct': 'TlsCredsX509Properties', 589 'base': 'TlsCredsProperties', 590 'data': { '*loaded': { 'type': 'bool', 'features': ['deprecated'] }, 591 '*sanity-check': 'bool', 592 '*passwordid': 'str' } } 593## 594# @QCryptoAkCipherAlgorithm: 595# 596# The supported algorithms for asymmetric encryption ciphers 597# 598# @rsa: RSA algorithm 599# 600# Since: 7.1 601## 602{ 'enum': 'QCryptoAkCipherAlgorithm', 603 'prefix': 'QCRYPTO_AKCIPHER_ALG', 604 'data': ['rsa']} 605 606## 607# @QCryptoAkCipherKeyType: 608# 609# The type of asymmetric keys. 610# 611# Since: 7.1 612## 613{ 'enum': 'QCryptoAkCipherKeyType', 614 'prefix': 'QCRYPTO_AKCIPHER_KEY_TYPE', 615 'data': ['public', 'private']} 616 617## 618# @QCryptoRSAPaddingAlgorithm: 619# 620# The padding algorithm for RSA. 621# 622# @raw: no padding used 623# 624# @pkcs1: pkcs1#v1.5 625# 626# Since: 7.1 627## 628{ 'enum': 'QCryptoRSAPaddingAlgorithm', 629 'prefix': 'QCRYPTO_RSA_PADDING_ALG', 630 'data': ['raw', 'pkcs1']} 631 632## 633# @QCryptoAkCipherOptionsRSA: 634# 635# Specific parameters for RSA algorithm. 636# 637# @hash-alg: QCryptoHashAlgorithm 638# 639# @padding-alg: QCryptoRSAPaddingAlgorithm 640# 641# Since: 7.1 642## 643{ 'struct': 'QCryptoAkCipherOptionsRSA', 644 'data': { 'hash-alg':'QCryptoHashAlgorithm', 645 'padding-alg': 'QCryptoRSAPaddingAlgorithm'}} 646 647## 648# @QCryptoAkCipherOptions: 649# 650# The options that are available for all asymmetric key algorithms 651# when creating a new QCryptoAkCipher. 652# 653# @alg: encryption cipher algorithm 654# 655# Since: 7.1 656## 657{ 'union': 'QCryptoAkCipherOptions', 658 'base': { 'alg': 'QCryptoAkCipherAlgorithm' }, 659 'discriminator': 'alg', 660 'data': { 'rsa': 'QCryptoAkCipherOptionsRSA' }} 661