ca

package
v0.0.0-...-db8959b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrefixRoot     = "root/"
	PrefixMiddle   = "middle/"
	PrefixTerminal = "terminal/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

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

func NewCA

func NewCA(endpoints []string) (*CA, error)

NewCA new ca

func (*CA) CreateCaCertificate

func (ca *CA) CreateCaCertificate(bit int, cn string, root bool, option ...Option) ([]byte, []byte, error)

CreateCaCertificate create middle certificate and private key. Returns certPem, privatePem and error.

func (*CA) CreateServerCertificate

func (ca *CA) CreateServerCertificate(bit int, cn string, option ...Option) ([]byte, []byte, error)

CreateServerCertificate create terminal certificate and private key. Returns certPem, privatePem and error.

type Certificate

type Certificate struct {
	x509.Certificate
}

func NewCertificate

func NewCertificate(cn string, option ...Option) Certificate

NewCertificate new certificate with CommonName. To Add other information, use WithXXX().

type KeyPair

type KeyPair struct {
	Cert []byte
	Key  []byte
}

type Option

type Option func(*Certificate)

func WithIsCa

func WithIsCa(isCa bool) Option

WithIsCa set IsCa

func WithMaxPathLen

func WithMaxPathLen(len int) Option

WithMaxPathLen add max length for certificate link

func WithNotAfter

func WithNotAfter(t time.Time) Option

WithNotAfter set NotAfter

func WithSubjectCountry

func WithSubjectCountry(country []string) Option

WithSubjectCountry add country for Subject

func WithSubjectLocality

func WithSubjectLocality(locality []string) Option

WithSubjectLocality add locality for Subject

func WithSubjectOrganization

func WithSubjectOrganization(organization []string) Option

WithSubjectOrganization add organization for Subject

func WithSubjectOrganizationalUnit

func WithSubjectOrganizationalUnit(organizationalUnit []string) Option

WithSubjectOrganizationalUnit add organizationalUnit for Subject

func WithSubjectProvince

func WithSubjectProvince(province []string) Option

WithSubjectProvince add province for Subject

type Storage

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

func NewStorage

func NewStorage(endpoints []string) (*Storage, error)

func (*Storage) Close

func (s *Storage) Close() error

Close etcd connection

func (*Storage) Delete

func (s *Storage) Delete(CertificateId string, option ...clientv3.OpOption) error

Delete delete Certificate from etcd

func (*Storage) Get

func (s *Storage) Get(CertificateId string, option ...clientv3.OpOption) ([]*mvccpb.KeyValue, error)

Get Certificate from etcd

func (*Storage) Put

func (s *Storage) Put(CertificateId string, Certificate string, option ...clientv3.OpOption) error

Put Certificate into etcd

Jump to

Keyboard shortcuts

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