ca

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APICertSignRequest

type APICertSignRequest struct {
	Hostname string `json:"hostname"`
	CSR      string `json:"certificate_request"`
}

type Bundle

type Bundle struct {
	PrivateKey  []byte
	Certificate []byte
	Bundled     []byte
	Fingerprint string // Hash of cert for identification
}

func (*Bundle) Combine

func (b *Bundle) Combine() []byte

type CertClient

type CertClient interface {
	GenerateCert(string) (*Bundle, error)
	StoreCert(*CertModel) (*CertModel, error)
	GetCertByFingerprint(string) (*CertModel, error)
	GetServerCertByLinkedAPIID(string) (*CertModel, error)
}

type CertModel

type CertModel struct {
	MID             bson.ObjectId `bson:"_id"`
	UID             string
	Bundle          *Bundle
	BundleHistory   []Bundle // On renewal, move bundle here
	Created         time.Time
	Expires         time.Time
	ClientEgressIDs []string // If cert is used as a client cert, IDs of APIs it is attached to
	ServiceID       string   // If cert is used as a server cert, ID of API it belongs to
	IsMeshCert      bool
}

func NewCertModel

func NewCertModel(bundle *Bundle) *CertModel

type Client

type Client struct {
	CA *Config
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) (*Client, error)

func (*Client) GenerateCert

func (c *Client) GenerateCert(CN string) (*Bundle, error)

func (*Client) GetCertByFingerprint

func (c *Client) GetCertByFingerprint(fp string) (*CertModel, error)

func (*Client) GetOrCreateMeshCertID

func (c *Client) GetOrCreateMeshCertID() (string, error)

func (*Client) GetServerCertByLinkedAPIID

func (c *Client) GetServerCertByLinkedAPIID(serviceID string) (*CertModel, error)

func (*Client) StoreCert

func (c *Client) StoreCert(cert *CertModel) (*CertModel, error)

type Config

type Config struct {
	Addr              string          `yaml:"addr"`
	Key               string          `yaml:"key"`
	DefaultNames      []csr.Name      `yaml:"defaultNames"`
	DefaultKeyRequest *csr.KeyRequest `yaml:"defaultKeyRequest"`
	MongoConnStr      string          `yaml:"mongoConnStr"`
	CertPath          string          `yaml:"certPath"`
	Secure            bool
	SkipCACheck       bool
}

type Mock

type Mock struct{}

func (*Mock) GenerateCert

func (m *Mock) GenerateCert(CN string) (*Bundle, error)

func (*Mock) GetCertByFingerprint

func (m *Mock) GetCertByFingerprint(fp string) (*CertModel, error)

func (*Mock) GetServerCertByLinkedAPIID

func (m *Mock) GetServerCertByLinkedAPIID(serviceID string) (*CertModel, error)

func (*Mock) StoreCert

func (m *Mock) StoreCert(cert *CertModel) (*CertModel, error)

Jump to

Keyboard shortcuts

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