generator

package
Version: v1.65.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: BSD-3-Clause Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CAConfig added in v1.65.2

type CAConfig struct {
	CommonName string `yaml:"CommonName"`
	Country    string `yaml:"Country"`
	Province   string `yaml:"Province"`
	Locality   string `yaml:"Locality"`
	Expire     int    `yaml:"Expire"`
}

type CAGenerator

type CAGenerator interface {
	SignCertificate(baseDir, fileName string, sans []string, pub interface{}, isCA bool) (*x509.Certificate, error)

	GenerateLocalOrg(baseDir, fileName string, orgCfg *CertConfig) (CAGenerator, error)

	GenerateLocalUser(baseDir, fileName string) error
}

CAGenerator CA生成器接口

func NewCA added in v1.65.2

func NewCA(baseDir string, cacfg *CertConfig, signType int) (CAGenerator, error)

NewCA 根据类型生成CA生成器

type CertConfig added in v1.65.2

type CertConfig struct {
	Name string       `yaml:"Name"`
	CA   CAConfig     `yaml:"CA"`
	User []UserConfig `yaml:"User"`
}

type EcdsaCA added in v1.65.2

type EcdsaCA struct {
	Name       string
	Signer     crypto.Signer
	SignCert   *x509.Certificate
	CertConfig *CertConfig
}

EcdsaCA ecdsa CA结构

func (*EcdsaCA) GenerateLocalOrg added in v1.65.2

func (ca *EcdsaCA) GenerateLocalOrg(baseDir, fileName string, orgCfg *CertConfig) (CAGenerator, error)

GenerateLocalOrg 生成组织证书

func (*EcdsaCA) GenerateLocalUser added in v1.65.2

func (ca *EcdsaCA) GenerateLocalUser(baseDir, fileName string) error

GenerateLocalUser 生成本地用户

func (*EcdsaCA) SignCertificate added in v1.65.2

func (ca *EcdsaCA) SignCertificate(baseDir, fileName string, sans []string, pub interface{}, isCA bool) (*x509.Certificate, error)

SignCertificate 证书签名

type GenConfig added in v1.65.2

type GenConfig struct {
	SignType      string       `yaml:"SignType"`
	Root          CertConfig   `yaml:"Root"`
	Organizations []CertConfig `yaml:"Organizations"`
}

func (*GenConfig) GetOrgCertConfig added in v1.65.2

func (cfg *GenConfig) GetOrgCertConfig(orgName string) *CertConfig

type SM2CA added in v1.65.2

type SM2CA struct {
	Name       string
	Signer     crypto.Signer
	SignCert   *sm2.Certificate
	Sm2Key     csp.Key
	CertConfig *CertConfig
}

SM2CA SM2 CA结构

func (*SM2CA) GenerateLocalOrg added in v1.65.2

func (ca *SM2CA) GenerateLocalOrg(baseDir, fileName string, orgCfg *CertConfig) (CAGenerator, error)

GenerateLocalOrg 生成组织证书

func (*SM2CA) GenerateLocalUser added in v1.65.2

func (ca *SM2CA) GenerateLocalUser(baseDir, fileName string) error

GenerateLocalUser 生成本地用户

func (*SM2CA) SignCertificate added in v1.65.2

func (ca *SM2CA) SignCertificate(baseDir, fileName string, sans []string, pub interface{}, isCA bool) (*x509.Certificate, error)

SignCertificate 证书签名

type UserConfig added in v1.65.2

type UserConfig struct {
	Name string `yaml:"Name"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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