lamassuca

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MPL-2.0 Imports: 16 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlreadyRevokedError added in v1.0.19

type AlreadyRevokedError struct {
	CaName       string
	SerialNumber string
}

func (*AlreadyRevokedError) Error added in v1.0.19

func (e *AlreadyRevokedError) Error() string

type BaseClient

type BaseClient interface {
	NewRequest(method string, path string, body interface{}) (*http.Request, error)
	Do(req *http.Request) (interface{}, *http.Response, error)
}

func NewBaseClient

func NewBaseClient(url *url.URL, httpClient *http.Client) BaseClient

type CAImport

type CAImport struct {
	PEMBundle string `json:"pem_bundle"`
	TTL       int    `json:"ttl"`
}

type Cert

type Cert struct {
	// The status of the CA
	// required: true
	// example: issued | expired
	Status string `json:"status,omitempty"`

	// The serial number of the CA
	// required: true
	// example: 7e:36:13:a5:31:9f:4a:76:10:64:2e:9b:0a:11:07:b7:e6:3e:cf:94
	SerialNumber string `json:"serial_number,omitempty"`

	// The name/alias of the CA
	// required: true
	// example: Lamassu-CA
	CAName string `json:"name,omitempty"`

	KeyMetadata KeyInfo `json:"key_metadata"`

	Subject Subject `json:"subject"`

	CertContent CertContent `json:"certificate"`

	// Expiration period of the new emmited CA
	// required: true
	// example: 262800h
	CaTTL int `json:"ca_ttl,omitempty"`

	EnrollerTTL int `json:"enroller_ttl,omitempty"`

	ValidFrom           string `json:"valid_from"`
	ValidTo             string `json:"valid_to"`
	RevocationTimestamp int64  `json:"revocation_timestamp,omitempty"`
}

type CertContent

type CertContent struct {
	CerificateBase64 string `json:"pem_base64, omitempty"`
	PublicKeyBase64  string `json:"public_key_base64"`
}

type Certificate

type Certificate struct {
	Cert string `json:"crt"`
}

type Certs

type Certs struct {
	Certs []Cert `json:"certs"`
}

CAs represents a list of CAs with minimum information swagger:model

type ClientConfig

type ClientConfig struct {
	BaseURL *url.URL
	// contains filtered or unexported fields
}

func (*ClientConfig) Do

func (c *ClientConfig) Do(req *http.Request) (interface{}, *http.Response, error)

func (*ClientConfig) NewRequest

func (c *ClientConfig) NewRequest(method string, path string, body interface{}) (*http.Request, error)

type KeyInfo

type KeyInfo struct {
	// Algorithm used to create CA key
	// required: true
	// example: RSA
	KeyType string `json:"type"`

	// Length used to create CA key
	// required: true
	// example: 4096
	KeyBits int `json:"bits"`

	// Strength of the key used to the create CA
	// required: true
	// example: low
	KeyStrength string `json:"strength"`
}

type LamassuCaClient

type LamassuCaClient interface {
	GetCAs(ctx context.Context, caType string) (Certs, error)
	SignCertificateRequest(ctx context.Context, signingCaName string, csr *x509.CertificateRequest, caType string, signVerbatim bool) (*x509.Certificate, error)
	RevokeCert(ctx context.Context, IssuerName string, serialNumberToRevoke string, caType string) error
	GetCert(ctx context.Context, IssuerName string, SerialNumber string, caType string) (Cert, error)
}

func NewLamassuCaClient

func NewLamassuCaClient(lamassuCaUrl string, lamassuCaCert string, clientCertFile string, clientCertKey string, logger log.Logger) (LamassuCaClient, error)

type LamassuCaClientConfig

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

func (*LamassuCaClientConfig) GetCAs

func (c *LamassuCaClientConfig) GetCAs(ctx context.Context, caType string) (Certs, error)

func (*LamassuCaClientConfig) GetCert

func (c *LamassuCaClientConfig) GetCert(ctx context.Context, IssuerName string, SerialNumber string, caType string) (Cert, error)

func (*LamassuCaClientConfig) RevokeCert

func (c *LamassuCaClientConfig) RevokeCert(ctx context.Context, IssuerName string, serialNumberToRevoke string, caType string) error

func (*LamassuCaClientConfig) SignCertificateRequest

func (c *LamassuCaClientConfig) SignCertificateRequest(ctx context.Context, signingCaName string, csr *x509.CertificateRequest, caType string, signVerbatim bool) (*x509.Certificate, error)

type Subject

type Subject struct {
	// Common name of the CA certificate
	// required: true
	// example: Lamassu-Root-CA1-RSA4096
	CN string `json:"common_name"`

	// Organization of the CA certificate
	// required: true
	// example: Lamassu IoT
	O string `json:"organization"`

	// Organization Unit of the CA certificate
	// required: true
	// example: Lamassu IoT department 1
	OU string `json:"organization_unit"`

	// Country Name of the CA certificate
	// required: true
	// example: ES
	C string `json:"country"`

	// State of the CA certificate
	// required: true
	// example: Guipuzcoa
	ST string `json:"state"`

	// Locality of the CA certificate
	// required: true
	// example: Arrasate
	L string `json:"locality"`
}

Jump to

Keyboard shortcuts

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