bolt

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDB = "netlive_mdm"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

type CA struct {
	Chain  [][]byte `bson:"chain"`
	Key    []byte   `bson:"key"`
	Serial []byte   `bson:"serial"`
}

type CompanyCert

type CompanyCert struct {
	CompanyID  primitive.ObjectID `bson:"company_id"`
	Cert       CA                 `bson:"cert"`
	CommonName map[string][]byte  `bson:"common_name"`
}

type Depot

type Depot struct {
	Client                      *mongo.Client
	DBName                      string
	CollSCEPCertificates        *mongo.Collection
	CollCompanySCEPCertificates *mongo.Collection
	// contains filtered or unexported fields
}

Depot implements a SCEP certifiacte store using boltdb. https://github.com/boltdb/bolt

func NewMongoDepot

func NewMongoDepot(client *mongo.Client, dbName string) (*Depot, error)

NewMongoDepot creates a depot.Depot backed by BoltDB.

func (*Depot) CA

func (db *Depot) CA(pass []byte) ([]*x509.Certificate, *rsa.PrivateKey, error)

func (*Depot) CompanyCA

func (db *Depot) CompanyCA(pass []byte, companyID string) ([]*x509.Certificate, *rsa.PrivateKey, error)

func (*Depot) CompanyPut

func (db *Depot) CompanyPut(cn string, crt *x509.Certificate, companyID string) error

func (*Depot) CreateOrLoadCA

func (db *Depot) CreateOrLoadCA(key *rsa.PrivateKey, years int, org, country string) (*x509.Certificate, error)

func (*Depot) CreateOrLoadCompanyCA

func (db *Depot) CreateOrLoadCompanyCA(key *rsa.PrivateKey, years int, org, country string, companyID string) (*x509.Certificate, error)

func (*Depot) CreateOrLoadCompanyKey

func (db *Depot) CreateOrLoadCompanyKey(bits int, companyID string) (*rsa.PrivateKey, error)

func (*Depot) CreateOrLoadKey

func (db *Depot) CreateOrLoadKey(bits int) (*rsa.PrivateKey, error)

func (*Depot) HasCN

func (db *Depot) HasCN(cn string, allowTime int, cert *x509.Certificate, revokeOldCertificate bool) (bool, error)

func (*Depot) HasCompanyCertCN

func (db *Depot) HasCompanyCertCN(cn string, allowTime int, cert *x509.Certificate, revokeOldCertificate bool, companyID string) (bool, error)

func (*Depot) Put

func (db *Depot) Put(cn string, crt *x509.Certificate) error

func (*Depot) Serial

func (db *Depot) Serial() (*big.Int, error)

type DepotBolt

type DepotBolt struct {
	*bolt.DB
	// contains filtered or unexported fields
}

Depot implements a SCEP certifiacte store using boltdb. https://github.com/boltdb/bolt

func NewBoltDepot

func NewBoltDepot(db *bolt.DB) (*DepotBolt, error)

NewBoltDepot creates a depot.Depot backed by BoltDB.

func (*DepotBolt) CA

func (db *DepotBolt) CA(pass []byte) ([]*x509.Certificate, *rsa.PrivateKey, error)

func (*DepotBolt) CreateOrLoadCA

func (db *DepotBolt) CreateOrLoadCA(key *rsa.PrivateKey, years int, org, country string) (*x509.Certificate, error)

func (*DepotBolt) CreateOrLoadKey

func (db *DepotBolt) CreateOrLoadKey(bits int) (*rsa.PrivateKey, error)

func (*DepotBolt) HasCN

func (db *DepotBolt) HasCN(cn string, allowTime int, cert *x509.Certificate, revokeOldCertificate bool) (bool, error)

func (*DepotBolt) Put

func (db *DepotBolt) Put(cn string, crt *x509.Certificate) error

func (*DepotBolt) Serial

func (db *DepotBolt) Serial() (*big.Int, error)

type KeyValue

type KeyValue struct {
	Key   string `bson:"key"`
	Value []byte `bson:"value"`
}

Jump to

Keyboard shortcuts

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