Show / Hide Table of Contents

Class CycloneDXUtils

Class containing utility methods that operate on CycloneDX BOMs.

Inheritance
object
CycloneDXUtils
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: CycloneDX.Utils
Assembly: CycloneDX.Utils.dll
Syntax
public static class CycloneDXUtils

Methods

| Edit this page View Source

ComponentAnalysisIdentifier(Component)

Utility method to generate a component identifier that can be used when analysing two or more BOMs.

In general, a component BomRef should be used to identify a specific component within a BOM. However, it is not very useful when trying to compare components across BOMs. For example, when trying to identify components that have changed versions between two BOMs.

Declaration
public static string ComponentAnalysisIdentifier(Component component)
Parameters
Type Name Description
Component component
Returns
Type Description
string
| Edit this page View Source

ComponentVersionDiff(Bom, Bom)

Generates a component version diff between two BOMs.

Declaration
public static Dictionary<string, DiffItem<Component>> ComponentVersionDiff(Bom fromBom, Bom toBom)
Parameters
Type Name Description
Bom fromBom
Bom toBom
Returns
Type Description
Dictionary<string, DiffItem<Component>>
| Edit this page View Source

FlatMerge(Bom, Bom)

Performs a flat merge of two BOMs.

Useful for situations like building a consolidated BOM for a web application. Flat merge can combine the BOM for frontend code with the BOM for backend code and return a single, combined BOM.

For situations where system component hierarchy is required to be maintained refer to the HierarchicalMerge method.

Declaration
public static Bom FlatMerge(Bom bom1, Bom bom2)
Parameters
Type Name Description
Bom bom1
Bom bom2
Returns
Type Description
Bom
| Edit this page View Source

FlatMerge(IEnumerable<Bom>)

Performs a flat merge of multiple BOMs.

Useful for situations like building a consolidated BOM for a web application. Flat merge can combine the BOM for frontend code with the BOM for backend code and return a single, combined BOM.

For situations where system component hierarchy is required to be maintained refer to the HierarchicalMerge method.

Declaration
public static Bom FlatMerge(IEnumerable<Bom> boms)
Parameters
Type Name Description
IEnumerable<Bom> boms
Returns
Type Description
Bom
| Edit this page View Source

FlatMerge(IEnumerable<Bom>, Component)

Performs a flat merge of multiple BOMs.

Useful for situations like building a consolidated BOM for a web application. Flat merge can combine the BOM for frontend code with the BOM for backend code and return a single, combined BOM.

For situations where system component hierarchy is required to be maintained refer to the HierarchicalMerge method.

Declaration
public static Bom FlatMerge(IEnumerable<Bom> boms, Component bomSubject)
Parameters
Type Name Description
IEnumerable<Bom> boms
Component bomSubject
Returns
Type Description
Bom
| Edit this page View Source

GenerateSerialNumber()

Utility method to generate a valid, unique, CycloneDX formatted BOM serial number.

Declaration
public static string GenerateSerialNumber()
Returns
Type Description
string
| Edit this page View Source

HierarchicalMerge(IEnumerable<Bom>, Component)

Performs a hierarchical merge for multiple BOMs.

To retain system component hierarchy, top level BOM metadata component must be included in each BOM.

Declaration
public static Bom HierarchicalMerge(IEnumerable<Bom> boms, Component bomSubject)
Parameters
Type Name Description
IEnumerable<Bom> boms
Component bomSubject

The component described by the hierarchical merge being performed.

This will be included as the top level BOM metadata component in the returned BOM.

Returns
Type Description
Bom
| Edit this page View Source

MultipleComponentVersions(Bom)

Analyzes a BOM identifying when multiple versions of the same component have been included.

Declaration
public static Dictionary<string, List<Component>> MultipleComponentVersions(Bom bom)
Parameters
Type Name Description
Bom bom
Returns
Type Description
Dictionary<string, List<Component>>
| Edit this page View Source

RemoveInternalProperties(Bom)

Utility method to remove all properties from a BOM that are in the internal namespace.

This should be used on BOMs before sharing them externally to your organization.

Declaration
public static void RemoveInternalProperties(Bom bom)
Parameters
Type Name Description
Bom bom
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX