store

package
v0.0.0-...-4d45f13 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNoBackupMade is returned if no backup of a certificate store can be found
	ErrNoBackupMade = errors.New("unable to make backup of store")
)

Functions

func GetApps

func GetApps() []string

GetApps returns an array the supported app names

Types

type Info

type Info struct {
	Name    string
	Version string
}

Info represents high-level information about a certificate store There are no guarantees of machine parsing on this data, but it should be easily human readable.

type ListOptions

type ListOptions struct {
	// Include "trusted" certificates
	// This represents what'a good acting application or would return
	Trusted bool

	// Include certificates specifically untrusted by a user/admin
	Untrusted bool
}

type Store

type Store interface {
	// GetInfo returns basic information about the store
	GetInfo() *Info

	// List returns the currently trusted X509 certificates contained
	// within the cert store
	List(opts *ListOptions) ([]*x509.Certificate, error)

	// Add certificate(s) into the store
	Add([]*x509.Certificate) error

	// Remove will distrust the certificate in the store
	//
	// Note: This may not actually delete the certificate, but modify
	// the store such that the certificate is no longer trusted.
	// This is done when possible to limit the actual deletions to
	// preserve restore capabilities
	Remove(whitelist.Whitelist) error

	// Backup will attempt to save a backup of the certificate store
	// on the local system
	Backup() error

	// GetLatestBackup returns the latest directory (or file) backup
	// of a certificate store.
	//
	// If the path is non-empty the directory or file is guaranteed
	// to exist.
	GetLatestBackup() (string, error)

	// Restore will bring the system back to it's previous state
	// if a backup exists, otherwise it will attempt to bring the
	// cert trust status to the system's default state
	//
	// Optionally, this can take a specific filepath to use as the
	// restore point. This may not be supported on all stores.
	//
	// Note: It is strongly advised that any additional certs installed
	// be verified are still properly installed and working after
	// Restore() is called.
	Restore(where string) error
}

Store represents a certificate store (set of x509 Certificates) and has operations on it which can mutate the underlying state (e.g. a file or directory).

func FirefoxStore

func FirefoxStore() Store

FirefoxStore returns a Mozilla Firefox implementation of Store

func ForApp

func ForApp(app string) (Store, error)

ForApp returns a `Store` instance for the given app

func JavaStore

func JavaStore() Store

JavaStore returns an implementation of Store for Java certificate stores

Docs: - https://docs.oracle.com/cd/E19830-01/819-4712/ablqw/index.html - https://www.sslshopper.com/article-most-common-java-keytool-keystore-commands.html

func OpenSSLStore

func OpenSSLStore() Store

OpenSSLStore returns an implementation of Store for OpenSSL certificate stores

func Platform

func Platform() Store

Platform returns a new instance of Store for the running os/platform

Jump to

Keyboard shortcuts

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