# eric7.CycloneDXInterface.CycloneDXUtilities

Module implementing the interface to CycloneDX.

### Global Attributes

None

### Classes

CycloneDXEnvironmentParser | Class implementing a parser to get package data for a named environment.

### Functions

_addCycloneDXDependency | Function to add a dependency to the given list of components.
_amendMetaData | Function to amend the SBOM meta data according the given data.
_prettifyJSON | Function to prettify the SBOM JSON output generated by CycloneDX.
_prettifyXML | Function to prettify the SBOM XML output generated by CycloneDX.
addCycloneDXDependencies | Function to add dependency data to the list of created components.
addCycloneDXVulnerabilities | Function to add vulnerability data to the list of created components.
createCycloneDXFile | Function to create a CyccloneDX SBOM file.
findCyccloneDXComponent | Function to find a component in a given list of components.

## CycloneDXEnvironmentParser

Class implementing a parser to get package data for a named environment.

### Derived from

BaseParser

### Class Attributes

None

### Class Methods

None

### Methods

CycloneDXEnvironmentParser | Constructor

### Static Methods

None

#### CycloneDXEnvironmentParser (Constructor)

CycloneDXEnvironmentParser(venvName)

Constructor

venvName (str)
  name of the virtual environment

Up

## _addCycloneDXDependency

_addCycloneDXDependency(dependency, components)

Function to add a dependency to the given list of components.

dependency (dict)
  dependency to be added
components (list of Component)
  list of components

Up

## _amendMetaData

_amendMetaData(bomMetaData, metadataDict)

Function to amend the SBOM meta data according the given data.

The modifications done are:

- add eric7 to the tools

bomMetaData (BomMetaData)
  reference to the SBOM meta data object
metadataDict (dict)
  dictionary containing additional meta data

Return:
  reference to the modified SBOM meta data object

Return Type:
  BomMetaData

Up

## _prettifyJSON

_prettifyJSON(inputStr)

Function to prettify the SBOM JSON output generated by CycloneDX.

inputStr (str)
  output generated by CycloneDX

Return:
  prettified SBOM string

Return Type:
  str

Up

## _prettifyXML

_prettifyXML(inputStr)

Function to prettify the SBOM XML output generated by CycloneDX.

Note: Prettifying an XML tree works only with Python 3.9 and above!

inputStr (str)
  output generated by CycloneDX

Return:
  prettified SBOM string

Return Type:
  str

Up

## addCycloneDXDependencies

addCycloneDXDependencies(parser, venvName)

Function to add dependency data to the list of created components.

parser (BaseParser)
  reference to the parser object containing the list of components
venvName (str)
  name of the virtual environment

Up

## addCycloneDXVulnerabilities

addCycloneDXVulnerabilities(parser)

Function to add vulnerability data to the list of created components.

parser (BaseParser)
  reference to the parser object containing the list of components

Up

## createCycloneDXFile

createCycloneDXFile(venvName)

Function to create a CyccloneDX SBOM file.

venvName (str)
  name of the virtual environment

Raises RuntimeError:
  raised to indicate illegal creation parameters

Up

## findCyccloneDXComponent

findCyccloneDXComponent(components, name)

Function to find a component in a given list of components.

components (list of Component)
  list of components to scan
name (str)
  name of the component to search for

Return:
  reference to the found component or None

Return Type:
  Component or None

Up