diff --git a/schema/2.0/modules/cyclonedx-cryptography-2.0.schema.json b/schema/2.0/modules/cyclonedx-cryptography-2.0.schema.json index e84ef647e..49a823ac6 100644 --- a/schema/2.0/modules/cyclonedx-cryptography-2.0.schema.json +++ b/schema/2.0/modules/cyclonedx-cryptography-2.0.schema.json @@ -752,6 +752,59 @@ } } }, + "sshAlgorithms": { + "type": "object", + "title": "SSH Algorithms", + "description": "The SSH algorithms, grouped by the name-list categories of the key exchange initialization message (`SSH_MSG_KEXINIT`) defined in [RFC 4253 section 7.1](https://www.rfc-editor.org/rfc/rfc4253#section-7.1), as configured or observed for the subject of this BOM. Array order does not convey negotiation preference. The lists do not identify which algorithms were selected in a particular connection. Name-lists that SSH negotiates separately for each direction (encryption, MAC, and compression) are recorded here without distinguishing the direction. Algorithms used for user authentication ([RFC 4252](https://www.rfc-editor.org/rfc/rfc4252)) are not part of these lists.", + "additionalProperties": false, + "properties": { + "kex": { + "type": "array", + "title": "Key Exchange Algorithms", + "description": "SSH key exchange methods (`kex_algorithms`). Extension indicators carried in the same name-list, such as `ext-info-s` ([RFC 8308](https://www.rfc-editor.org/rfc/rfc8308)), are not key exchange methods and are not recorded here.", + "items": { + "$ref": "#/$defs/sshAlgorithm", + "title": "Key Exchange Algorithm" + } + }, + "hostKey": { + "type": "array", + "title": "Host Key Algorithms", + "description": "SSH server host key algorithms (`server_host_key_algorithms`): the algorithms a server offers, or a client accepts, for authenticating the server.", + "items": { + "$ref": "#/$defs/sshAlgorithm", + "title": "Host Key Algorithm" + } + }, + "encryption": { + "type": "array", + "title": "Encryption Algorithms", + "description": "SSH encryption algorithms (`encryption_algorithms_client_to_server` and `encryption_algorithms_server_to_client`).", + "items": { + "$ref": "#/$defs/sshAlgorithm", + "title": "Encryption Algorithm" + } + }, + "mac": { + "type": "array", + "title": "MAC Algorithms", + "description": "SSH message authentication code algorithms (`mac_algorithms_client_to_server` and `mac_algorithms_server_to_client`).", + "items": { + "$ref": "#/$defs/sshAlgorithm", + "title": "MAC Algorithm" + } + }, + "compression": { + "type": "array", + "title": "Compression Algorithms", + "description": "SSH compression algorithms (`compression_algorithms_client_to_server` and `compression_algorithms_server_to_client`).", + "items": { + "$ref": "#/$defs/sshAlgorithm", + "title": "Compression Algorithm" + } + } + } + }, "relatedCryptographicAssets": { "$ref": "#/$defs/relatedCryptographicAssets" } @@ -937,6 +990,34 @@ } } }, + "sshAlgorithm": { + "type": "object", + "title": "SSH Algorithm", + "description": "Object representing an algorithm name as it appears in an SSH name-list.", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "The algorithm name as it appears in the SSH name-list. Where a registered name exists, the name from the IANA Secure Shell (SSH) Protocol Parameters registry should be used.", + "examples": [ + "mlkem768x25519-sha256", + "ssh-ed25519", + "aes256-gcm@openssh.com", + "hmac-sha2-256", + "none" + ] + }, + "algorithm": { + "$ref": "cyclonedx-common-2.0.schema.json#/$defs/refLinkType", + "title": "Algorithm reference", + "description": "The `refId` to algorithm cryptographic asset." + } + } + }, "cryptographicFunction": { "title": "Cryptographic Function", "description": "A cryptographic function or usage.", diff --git a/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-item-type-2.0.json b/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-item-type-2.0.json new file mode 100644 index 000000000..5de98386e --- /dev/null +++ b/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-item-type-2.0.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "definitions": { + "components": [ + { + "type": "cryptographic-asset", + "name": "SSH server", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ssh", + "sshAlgorithms": { + "kex": [ + "curve25519-sha256" + ] + } + } + } + } + ] + } +} diff --git a/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-missing-name-2.0.json b/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-missing-name-2.0.json new file mode 100644 index 000000000..53260ca28 --- /dev/null +++ b/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-missing-name-2.0.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "definitions": { + "components": [ + { + "type": "cryptographic-asset", + "name": "SSH server", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ssh", + "sshAlgorithms": { + "hostKey": [ + { + "algorithm": "alg-ed25519" + } + ] + } + } + } + } + ] + } +} diff --git a/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-unknown-category-2.0.json b/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-unknown-category-2.0.json new file mode 100644 index 000000000..a2265550c --- /dev/null +++ b/tools/src/test/resources/2.0/invalid-cryptography-ssh-algorithms-unknown-category-2.0.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "definitions": { + "components": [ + { + "type": "cryptographic-asset", + "name": "SSH server", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ssh", + "sshAlgorithms": { + "keyExchange": [ + { + "name": "curve25519-sha256" + } + ] + } + } + } + } + ] + } +} diff --git a/tools/src/test/resources/2.0/valid-cryptography-ssh-algorithms-2.0.json b/tools/src/test/resources/2.0/valid-cryptography-ssh-algorithms-2.0.json new file mode 100644 index 000000000..e7076e899 --- /dev/null +++ b/tools/src/test/resources/2.0/valid-cryptography-ssh-algorithms-2.0.json @@ -0,0 +1,93 @@ +{ + "$schema": "https://cyclonedx.org/schema/2.0/cyclonedx-2.0.schema.json", + "specFormat": "CycloneDX", + "specVersion": "2.0", + "definitions": { + "components": [ + { + "type": "cryptographic-asset", + "refId": "alg-ed25519", + "name": "Ed25519", + "cryptoProperties": { + "assetType": "algorithm", + "algorithmProperties": { + "primitive": "signature", + "algorithmFamily": "EdDSA", + "cryptoFunctions": [ + "sign", + "verify" + ] + } + } + }, + { + "type": "cryptographic-asset", + "name": "SSH server KEXINIT", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ssh", + "version": "2.0", + "sshAlgorithms": { + "kex": [ + { + "name": "mlkem768x25519-sha256" + }, + { + "name": "curve25519-sha256" + } + ], + "hostKey": [ + { + "name": "ssh-ed25519", + "algorithm": "alg-ed25519" + }, + { + "name": "rsa-sha2-512" + } + ], + "encryption": [ + { + "name": "chacha20-poly1305@openssh.com" + }, + { + "name": "aes256-gcm@openssh.com" + } + ], + "mac": [ + { + "name": "hmac-sha2-256" + } + ], + "compression": [ + { + "name": "none" + }, + { + "name": "zlib@openssh.com" + } + ] + } + } + } + }, + { + "type": "cryptographic-asset", + "name": "SSH host key only", + "cryptoProperties": { + "assetType": "protocol", + "protocolProperties": { + "type": "ssh", + "sshAlgorithms": { + "hostKey": [ + { + "name": "ssh-ed25519" + } + ] + } + } + } + } + ] + } +}