cadb

package
v0.0.0-...-b92b52e Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NonUnique = errors.New("Non Unique Serial")

NonUnique is an error that indicates a given serial number was not unique.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func Open

func Open() (*Conn, error)

func (*Conn) AddCert

func (conn *Conn) AddCert(id string, name string, serial *big.Int, keyId []byte, expiry time.Time, cert []byte) error

AddCert adds a newly generated certificate to the database.

func (*Conn) CertsByUUID

func (conn *Conn) CertsByUUID(id uuid.UUID) ([]big.Int, error)

CertsByUUID returns a list of valid certs associated with a UUID

func (*Conn) GetCertBySerial

func (conn *Conn) GetCertBySerial(serial *big.Int) ([]byte, error)

GetCertBySerial gets certificate for the given serial.

func (*Conn) GetSerial

func (conn *Conn) GetSerial() (*big.Int, error)

Generate a serial number for a certificate. The serial number is required to be unique for all certificates generated by a given authority. To help with this, we will use a timestamp for the signature. We scan the database to make sure that timestamp is not already taken (to protect against clock changes).

func (*Conn) MarkRegistered

func (conn *Conn) MarkRegistered(device string) error

MarkRegistered indicates that the given device has successfully been marked as registered with the Cloud service.

func (*Conn) SerialValid

func (conn *Conn) SerialValid(serial *big.Int) (bool, error)

SerialValid checks if a valid certificate exists for the specified serial

func (*Conn) UnregisteredDevices

func (conn *Conn) UnregisteredDevices() ([]string, error)

UnregisteredDevices returns a list of devices that have not been registered with the cloud. This may need to be extended to return certificate information, if we add support for a cloud service that does not support signed certificates.

Jump to

Keyboard shortcuts

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