pemutility

package
v0.0.0-...-2d4f0a5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateComponentsFromKey

func GenerateComponentsFromKey(genericKey any) ([]cdx.Component, error)

func GenerateComponentsFromPEMKeyBlock

func GenerateComponentsFromPEMKeyBlock(block *pem.Block) ([]cdx.Component, error)

Generate cyclonedx-go components from a block containing a key

func ParsePEMToBlocksWithTypeFilter

func ParsePEMToBlocksWithTypeFilter(raw []byte, filter Filter) map[*pem.Block]PEMBlockType

Just like ParsePEMToBlocksWithTypes but uses a filter for filtering

func ParsePEMToBlocksWithTypes

func ParsePEMToBlocksWithTypes(raw []byte) map[*pem.Block]PEMBlockType

Parse a the []byte of a PEM file to a map containing the *pem.Block and a PEMBlockType for each block

Types

type Filter

type Filter struct {
	FilterType PEMTypeFilterType
	List       []PEMBlockType
}

Filter that describes which PEMBlockTypes to allow

type PEMBlockType

type PEMBlockType string

A not complete list of PEMBlockTypes that can be detected currently

const (
	PEMBlockTypeCertificate         PEMBlockType = "CERTIFICATE"
	PEMBlockTypePrivateKey          PEMBlockType = "PRIVATE KEY"
	PEMBlockTypeEncryptedPrivateKey PEMBlockType = "ENCRYPTED PRIVATE KEY"
	PEMBlockTypePublicKey           PEMBlockType = "PUBLIC KEY"
	PEMBlockTypeECPrivateKey        PEMBlockType = "EC PRIVATE KEY"
	PEMBlockTypeRSAPrivateKey       PEMBlockType = "RSA PRIVATE KEY"
	PEMBlockTypeRSAPublicKey        PEMBlockType = "RSA PUBLIC KEY"
	PEMBlockTypeOPENSSHPrivateKey   PEMBlockType = "OPENSSH PRIVATE KEY"
)

type PEMTypeFilterType

type PEMTypeFilterType bool

Used to specify whether a filter is an allow- or blocklist

const (
	PEMTypeFilterTypeAllowlist PEMTypeFilterType = true  // Allow List
	PEMTypeFilterTypeBlocklist PEMTypeFilterType = false // Block List
)

Jump to

Keyboard shortcuts

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