From c30453064acdecc7c4a1cd7e45292403b5617323 Mon Sep 17 00:00:00 2001 From: Joachim Vandersmissen Date: Fri, 15 May 2026 08:42:35 -0500 Subject: [PATCH 1/2] Add outputLength property to schema Signed-off-by: Joachim Vandersmissen --- .../cyclonedx-cryptography-2.0.schema.json | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/schema/2.0/model/cyclonedx-cryptography-2.0.schema.json b/schema/2.0/model/cyclonedx-cryptography-2.0.schema.json index 898f994b9..2d2c35050 100644 --- a/schema/2.0/model/cyclonedx-cryptography-2.0.schema.json +++ b/schema/2.0/model/cyclonedx-cryptography-2.0.schema.json @@ -321,6 +321,46 @@ "$ref": "#/$defs/cryptographicFunction" } }, + "outputLength": { + "title": "Output length", + "description": "The output length provided by the cryptographic algorithm (in bits). For example: XOF output length, MAC tag length, derived key length for KDF.", + "oneOf": [ + { + "type": "integer", + "minimum": 0 + }, + { + "type": "object", + "anyOf": [ + { + "required": [ + "min" + ] + }, + { + "required": [ + "max" + ] + } + ], + "additionalProperties": false, + "properties": { + "min": { + "type": "integer", + "title": "Minimum output length", + "description": "The minimum output length provided by the cryptographic algorithm (in bits).", + "minimum": 0 + }, + "max": { + "type": "integer", + "title": "Maximum output length", + "description": "The maximum output length provided by the cryptographic algorithm (in bits).", + "minimum": 0 + } + } + } + ] + }, "classicalSecurityLevel": { "type": "integer", "title": "classical security level", From 5dbc81460241ee0bca7b36a0d54f2c0f1a50586f Mon Sep 17 00:00:00 2001 From: Joachim Vandersmissen Date: Sat, 29 Aug 2026 15:51:56 -0500 Subject: [PATCH 2/2] Add unit tests --- .../2.0/invalid-cryptography-outlen-2.0.json | 26 ++++++ .../2.0/valid-cryptography-outlen-2.0.json | 84 +++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 tools/src/test/resources/2.0/invalid-cryptography-outlen-2.0.json create mode 100644 tools/src/test/resources/2.0/valid-cryptography-outlen-2.0.json diff --git a/tools/src/test/resources/2.0/invalid-cryptography-outlen-2.0.json b/tools/src/test/resources/2.0/invalid-cryptography-outlen-2.0.json new file mode 100644 index 000000000..d931d5399 --- /dev/null +++ b/tools/src/test/resources/2.0/invalid-cryptography-outlen-2.0.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79", + "version": 1, + "components": [ + { + "type": "cryptographic-asset", + "bom-ref": "3a453d48-59bd-4b17-ac84-d5d03bc02c7c", + "name": "HMAC-SHA3-512", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "mac", + "algorithmFamily": "HMAC", + "parameterSetIdentifier": "512", + "cryptoFunctions": ["tag"], + "outputLength": {}, + "classicalSecurityLevel": 512, + "nistQuantumSecurityLevel": 5 + } + } + } + ] +} diff --git a/tools/src/test/resources/2.0/valid-cryptography-outlen-2.0.json b/tools/src/test/resources/2.0/valid-cryptography-outlen-2.0.json new file mode 100644 index 000000000..1cf81c831 --- /dev/null +++ b/tools/src/test/resources/2.0/valid-cryptography-outlen-2.0.json @@ -0,0 +1,84 @@ +{ + "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79", + "version": 1, + "components": [ + { + "type": "cryptographic-asset", + "bom-ref": "3a453d48-59bd-4b17-ac84-d5d03bc02c7c", + "name": "HMAC-SHA3-512", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "mac", + "algorithmFamily": "HMAC", + "parameterSetIdentifier": "512", + "cryptoFunctions": ["tag"], + "outputLength": 512, + "classicalSecurityLevel": 512, + "nistQuantumSecurityLevel": 5 + } + } + }, + { + "type": "cryptographic-asset", + "bom-ref": "dd5bb8cc-8a9d-4f7d-84d9-02e7e0269c3a", + "name": "HMAC-SHA3-512", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "mac", + "algorithmFamily": "HMAC", + "parameterSetIdentifier": "512", + "cryptoFunctions": ["tag"], + "outputLength": { + "min": 128 + }, + "classicalSecurityLevel": 512, + "nistQuantumSecurityLevel": 5 + } + } + }, + { + "type": "cryptographic-asset", + "bom-ref": "d2b05d42-bf36-4768-931c-44bd0a33b4d1", + "name": "HMAC-SHA3-512", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "mac", + "algorithmFamily": "HMAC", + "parameterSetIdentifier": "512", + "cryptoFunctions": ["tag"], + "outputLength": { + "max": 256 + }, + "classicalSecurityLevel": 512, + "nistQuantumSecurityLevel": 5 + } + } + }, + { + "type": "cryptographic-asset", + "bom-ref": "451ca708-2c25-4ae9-a7ba-49605128b95d", + "name": "HMAC-SHA3-512", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "mac", + "algorithmFamily": "HMAC", + "parameterSetIdentifier": "512", + "cryptoFunctions": ["tag"], + "outputLength": { + "min": 128, + "max": 256 + }, + "classicalSecurityLevel": 512, + "nistQuantumSecurityLevel": 5 + } + } + } + ] +}