Documentation ¶
Index ¶
- Constants
- type Descriptor
- type FetchMethod
- type OSManifest
- type OSPackage
- func (osp *OSPackage) ArchiveBytes() ([]byte, error)
- func (osp *OSPackage) ArchiveHash() [32]byte
- func (osp *OSPackage) DescriptorBytes() ([]byte, error)
- func (osp *OSPackage) DescriptorHash() [32]byte
- func (osp *OSPackage) LinuxImage() (boot.LinuxImage, error)
- func (osp *OSPackage) Sign(signer crypto.Signer, certDER []byte) error
- func (osp *OSPackage) Verify(rootCert *x509.Certificate) (found, valid int, err error)
Constants ¶
const ( DescriptorVersion int = 1 // DescriptorExt is the file extension of OS package descriptor file. DescriptorExt string = ".json" )
const ( ManifestVersion int = 1 // ManifestName is the name of OS packages' internal configuration file. ManifestName string = "manifest.json" )
const ( // DefaultOSPackageName is the file name of the archive, which is expected to contain // the stboot configuration file along with the corresponding files. DefaultOSPackageName string = "ospkg.zip" // OSPackageExt is the file extension of OS packages. OSPackageExt string = ".zip" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Descriptor ¶
type Descriptor struct { Version int `json:"version"` PkgURL string `json:"os_pkg_url"` Certificates [][]byte `json:"certificates"` Signatures [][]byte `json:"signatures"` }
Descriptor represents the descriptor JSON file of an OS package.
func DescriptorFromBytes ¶
func DescriptorFromBytes(data []byte) (*Descriptor, error)
DescriptorFromBytes parses a manifest from a byte slice.
func (*Descriptor) Bytes ¶
func (d *Descriptor) Bytes() ([]byte, error)
Bytes serializes a manifest stuct into a byte slice.
func (*Descriptor) Validate ¶
func (d *Descriptor) Validate() error
Validate returns true if d has valid content.
type FetchMethod ¶ added in v0.1.0
type FetchMethod int
FetchMethod controls where to load the OS package from.
const ( FetchFromNetwork FetchMethod = iota + 1 FetchFromInitramfs )
Supported methods to fetch an OS package.
func (FetchMethod) IsValid ¶ added in v0.1.0
func (f FetchMethod) IsValid() bool
IsValid returns true if b is a defined FetchMethod value.
func (FetchMethod) MarshalJSON ¶ added in v0.1.0
func (f FetchMethod) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (FetchMethod) String ¶ added in v0.1.0
func (f FetchMethod) String() string
String implements fmt.Stringer.
func (*FetchMethod) UnmarshalJSON ¶ added in v0.1.0
func (f *FetchMethod) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type OSManifest ¶
type OSManifest struct { Version int `json:"version"` Label string `json:"label"` KernelPath string `json:"kernel"` InitramfsPath string `json:"initramfs"` Cmdline string `json:"cmdline"` }
OSManifest describes the content and configuration of an OS package loaded by stboot.
func OSManifestFromBytes ¶
func OSManifestFromBytes(data []byte) (*OSManifest, error)
OSManifestFromBytes parses a manifest from a byte slice.
func (*OSManifest) Bytes ¶
func (m *OSManifest) Bytes() ([]byte, error)
Bytes serializes a manifest stuct into a byte slice.
type OSPackage ¶
type OSPackage struct {
// contains filtered or unexported fields
}
OSPackage represents an OS package ZIP archive and related data.
func CreateOSPackage ¶
CreateOSPackage constructs a OSPackage from the passed files.
func CreateOSPackageCtx ¶ added in v0.3.0
func NewOSPackage ¶
NewOSPackage constructs a new OSPackage initialized with raw bytes and valid internal state.
func (*OSPackage) ArchiveBytes ¶
ArchiveBytes returns the zip compressed archive part of osp.
func (*OSPackage) ArchiveHash ¶ added in v0.2.1
func (*OSPackage) DescriptorBytes ¶
DescriptorBytes returns the descriptor part of osp as serialized bytes.
func (*OSPackage) DescriptorHash ¶ added in v0.2.1
func (*OSPackage) LinuxImage ¶
func (osp *OSPackage) LinuxImage() (boot.LinuxImage, error)
OSImage returns a LinuxImage from osp. LinuxImage implements boot.