common

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreLicensesValid added in v1.0.0

func AreLicensesValid(licenses []licenses.License) bool

func CheckAuthors

func CheckAuthors(authors []sbom.GetAuthor) (string, bool)

func CheckCopyright

func CheckCopyright(cp string) (string, bool)

func CheckCpes

func CheckCpes(cpes []cpe.CPE) (string, bool)

func CheckHash

func CheckHash(checksums []sbom.GetChecksum) (string, bool, bool)

func CheckManufacturer

func CheckManufacturer(manufacturer sbom.GetManufacturer) (string, bool)

func CheckOmnibor

func CheckOmnibor(omni []omniborid.OMNIBORID) (string, bool)

func CheckPrimaryDependenciesInComponentList

func CheckPrimaryDependenciesInComponentList(dependencies []string, componentList map[string]bool) bool

CheckPrimaryDependenciesInComponentList checks if all primary dependencies are part of the component list.

func CheckPurls

func CheckPurls(purls []purl.PURL) (string, bool)

func CheckSupplier

func CheckSupplier(supplier sbom.GetSupplier) (string, bool)

func CheckSwhid

func CheckSwhid(swhid []swhid.SWHID) (string, bool)

func CheckSwid

func CheckSwid(swid []swid.SWID) (string, bool)

func CheckTimestamp

func CheckTimestamp(timestamp string) (string, bool)

func CheckTools

func CheckTools(tools []sbom.GetTool) (string, bool)

func ColorTable added in v1.0.0

func ColorTable(table *tablewriter.Table, elementID, id string, elementResult string, dataFields string, score float64, columnWidth int) *tablewriter.Table

func ComponentsLists

func ComponentsLists(doc sbom.Document) map[string]bool

ComponentsLists return component lists as a map

func ComponentsNamesMapToIDs

func ComponentsNamesMapToIDs(doc sbom.Document) map[string]string

ComponentsNamesMapToIDs returns map of component ID as key and component Name as value

func ConvertMapToString

func ConvertMapToString(m map[string]string) string

ConvertMapToString converts a map of type map[string]string into a string representation where each key-value pair is formatted as "key:value".

func DecodeBase64URLEncodingToInt added in v1.0.0

func DecodeBase64URLEncodingToInt(input string) int

func DecodeBigInt added in v1.0.0

func DecodeBigInt(input []byte) *big.Int

func GetAllPrimaryComponentDependencies

func GetAllPrimaryComponentDependencies(doc sbom.Document) []string

GetAllPrimaryComponentDependencies return all list of primary component dependencies by it's ID.

func GetDependenciesByName

func GetDependenciesByName(dependencies []string, compIDWithName map[string]string) []string

GetDependenciesByName returns the names of all dependencies based on their IDs.

func GetID

func GetID(componentID string) string

func GetScoreColor added in v1.0.0

func GetScoreColor(score float64) tablewriter.Colors

func GetSignatureBundle added in v1.0.8

func GetSignatureBundle(ctx context.Context, sbomFile, signature, publicKey string) (string, string, string, error)

func HashSBOM added in v1.0.0

func HashSBOM(sbomPath string) ([]byte, error)

func IsComponentPartOfPrimaryDependency

func IsComponentPartOfPrimaryDependency(primaryCompDeps []string, comp string) bool

func MapPrimaryDependencies

func MapPrimaryDependencies(doc sbom.Document) map[string]bool

MapPrimaryDependencies returns a map of all primary dependencies with bool. Primary dependencies marked as true else false.

func PublicKeyToPEM added in v1.0.0

func PublicKeyToPEM(pub *rsa.PublicKey) []byte

func RemoveFileIfExists added in v1.0.0

func RemoveFileIfExists(filePath string)

func RetrieveSignatureFromSBOM added in v1.0.0

func RetrieveSignatureFromSBOM(ctx context.Context, sbomFile string) (string, string, string, error)

func SetHeaderColor added in v1.0.0

func SetHeaderColor(table *tablewriter.Table, header int)

func UniqueElementID

func UniqueElementID(component sbom.GetComponent) string

func VerifySignature added in v1.0.0

func VerifySignature(pubKeyData []byte, sbomPath, signaturePath string) (bool, error)

func WrapLongTextIntoMulti added in v1.0.4

func WrapLongTextIntoMulti(input string, maxWidth int) string

convert long text into multiple lines

func WrapText added in v1.0.0

func WrapText(input string, maxWidth int) string

Types

type PublicKey added in v1.0.0

type PublicKey struct {
	Kty string `json:"kty"`
	N   string `json:"n"`
	E   string `json:"e"`
}

type SBOM added in v1.0.0

type SBOM struct {
	Signature *Signature             `json:"signature"`
	OtherData map[string]interface{} `json:"-"` // Holds the remaining SBOM data
}

type Signature added in v1.0.0

type Signature struct {
	Algorithm string     `json:"algorithm"`
	Value     string     `json:"value"`
	PublicKey *PublicKey `json:"publicKey"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL