61 'bomFormat' =>
'CycloneDX',
62 '$schema' =>
'http://cyclonedx.org/schema/bom-1.4.schema.json',
63 'specVersion' =>
'1.4',
65 'serialNumber' =>
'urn:uuid:'. uuid_create(UUID_TYPE_TIME),
67 'timestamp' => date(
'c'),
70 'vendor' =>
'FOSSology',
71 'name' =>
'FOSSology',
72 'version' => $bomdata[
'tool-version']
75 'component' => $bomdata[
'maincomponent']
77 'components' => $bomdata[
'components']
90 'type' => $componentData[
'type'],
91 'name' => $componentData[
'name']
94 if (array_key_exists(
'mimeType', $componentData) && !empty($componentData[
'mimeType'])) {
95 $component[
'mime-type'] = $componentData[
'mimeType'];
98 if (array_key_exists(
'bomref', $componentData) && !empty($componentData[
'bomref'])) {
99 $component[
'bom-ref'] = $componentData[
'bomref'];
106 if (array_key_exists(
'scope', $componentData) && !empty($componentData[
'scope'])) {
107 $component[
'scope'] = $componentData[
'scope'];
109 $component[
'scope'] =
'required';
112 if (array_key_exists(
'hashes', $componentData) && !empty($componentData[
'hashes'])) {
113 $component[
'hashes'] = $componentData[
'hashes'];
116 if (array_key_exists(
'licenses', $componentData) && !empty($componentData[
'licenses'])) {
117 $component[
'licenses'] = $componentData[
'licenses'];
120 if (array_key_exists(
'copyright', $componentData) && !empty($componentData[
'copyright'])) {
121 $component[
'copyright'] = $componentData[
'copyright'];
124 if (array_key_exists(
'description', $componentData) && !empty($componentData[
'description'])) {
125 $component[
'description'] = $componentData[
'description'];
142 if (array_key_exists(
'id', $licenseData) && !empty($licenseData[
'id']) &&
143 stripos($licenseData[
'id'], LicenseRef::SPDXREF_PREFIX) === 0) {
144 $license[
'expression'] = $licenseData[
'id'];
148 if (array_key_exists(
'id', $licenseData) && !empty($licenseData[
'id'])) {
149 $license[
'license'][
'id'] = $licenseData[
'id'];
150 }
else if (array_key_exists(
'name', $licenseData) && !empty($licenseData[
'name'])) {
151 $license[
'license'][
'name'] = $licenseData[
'name'];
154 if (array_key_exists(
'url', $licenseData) && !empty($licenseData[
'url'])) {
155 $license[
'license'][
'url'] = $licenseData[
'url'];
158 if (array_key_exists(
'textContent', $licenseData) && !empty($licenseData[
'textContent'])) {
159 $license[
'license'][
'text'] = [
160 'content' => $licenseData[
'textContent'],
161 'contentType' => $licenseData[
'textContentType'],
162 'encoding' =>
'base64'
176 private function generateHash(
string $algorithm,
string $content): array
180 'content' => $content
createHash($algorithm, $content)
generateLicense(array $licenseData)
generateHash(string $algorithm, string $content)
createComponent(array $componentData)
createLicense(array $licenseData)
generateComponent(array $componentData)
Namespace used by CycloneDX agent.