ca

package
v1.0.2076 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CA

type CA struct {

	// 错误
	Errors []error
	// contains filtered or unexported fields
}

*

  • CA *
  • @create 2022-7-22
  • @author deatil

func New added in v1.0.1018

func New() CA

构造函数

func NewCA

func NewCA() CA

构造函数

func (CA) AppendError added in v1.0.1026

func (this CA) AppendError(err ...error) CA

添加错误

func (CA) CreateCA

func (this CA) CreateCA() CA

CA 证书

func (CA) CreateCSR

func (this CA) CreateCSR() CA

证书请求

func (CA) CreateCert

func (this CA) CreateCert(ca any) CA

自签名证书

func (CA) CreatePKCS12Cert

func (this CA) CreatePKCS12Cert(caCerts []*x509.Certificate, pwd string) CA

pkcs12 密钥 caCerts 通常保留为空 支持 [rsa | ecdsa | sm2]

func (CA) CreatePKCS12CertTrustStore

func (this CA) CreatePKCS12CertTrustStore(certs []*x509.Certificate, password string) CA

pkcs12 密钥

func (CA) CreatePrivateKey

func (this CA) CreatePrivateKey() CA

私钥

func (CA) Error

func (this CA) Error() error

获取错误

func (CA) FromCert

func (this CA) FromCert(cert *x509.Certificate) CA

证书

func (CA) FromCertRequest

func (this CA) FromCertRequest(cert *x509.CertificateRequest) CA

证书请求

func (CA) FromCertificateDer

func (this CA) FromCertificateDer(der []byte) CA

解析证书导入

func (CA) FromCertificateRequestDer

func (this CA) FromCertificateRequestDer(asn1Data []byte) CA

解析证书导入

func (CA) FromPKCS12Cert

func (this CA) FromPKCS12Cert(pfxData []byte, password string) CA

pkcs12

func (CA) FromPrivateKey

func (this CA) FromPrivateKey(key any) CA

私钥 可用 [*rsa.PrivateKey | *ecdsa.PrivateKey | ed25519.PrivateKey | *sm2.PrivateKey]

func (CA) FromPublicKey

func (this CA) FromPublicKey(key any) CA

公钥 可用 [*rsa.PublicKey | *ecdsa.PublicKey | ed25519.PublicKey | *sm2.PublicKey]

func (CA) FromSM2PKCS12Cert

func (this CA) FromSM2PKCS12Cert(pfxData []byte, password string) CA

pkcs12

func (CA) GenerateECDSAKey added in v1.0.2015

func (this CA) GenerateECDSAKey(curve string) CA

生成密钥 Ecdsa 可选 [P521 | P384 | P256 | P224]

func (CA) GenerateEdDSAKey

func (this CA) GenerateEdDSAKey() CA

生成密钥 EdDSA

func (CA) GenerateRSAKey added in v1.0.2015

func (this CA) GenerateRSAKey(bits int) CA

生成密钥 RSA 可选 [512 | 1024 | 2048 | 4096]

func (CA) GenerateSM2Key

func (this CA) GenerateSM2Key() CA

生成密钥 SM2

func (CA) GetCert

func (this CA) GetCert() any

获取 cert

func (CA) GetCertRequest

func (this CA) GetCertRequest() any

获取 certRequest

func (CA) GetErrors added in v1.0.1026

func (this CA) GetErrors() []error

获取错误

func (CA) GetKeyData

func (this CA) GetKeyData() []byte

获取 keyData

func (CA) GetPrivateKey

func (this CA) GetPrivateKey() any

获取 PrivateKey

func (CA) GetPublicKey

func (this CA) GetPublicKey() any

获取 publicKey

func (CA) MakeCA

func (this CA) MakeCA(
	subject *pkix.Name,
	expire int,
	signAlgName string,
) CA

生成 CA 证书

func (CA) MakeCSR

func (this CA) MakeCSR(
	country []string,
	organization []string,
	organizationalUnit []string,
	locality []string,
	province []string,
	streetAddress []string,
	postalCode []string,
	commonName string,
) CA

生成证书请求

func (CA) MakeCert

func (this CA) MakeCert(
	subject *pkix.Name,
	expire int,
	dns []string,
	ip []net.IP,
	signAlgName string,
) CA

生成自签名证书

func (CA) MakeSM2CA

func (this CA) MakeSM2CA(
	subject *pkix.Name,
	expire int,
	signAlgName string,
) CA

生成 CA 证书

func (CA) MakeSM2CSR

func (this CA) MakeSM2CSR(
	country []string,
	organization []string,
	organizationalUnit []string,
	locality []string,
	province []string,
	streetAddress []string,
	postalCode []string,
	commonName string,
) CA

生成证书请求

func (CA) MakeSM2Cert

func (this CA) MakeSM2Cert(
	subject *pkix.Name,
	expire int,
	dns []string,
	ip []net.IP,
	signAlgName string,
) CA

生成自签名证书

func (CA) OnError

func (this CA) OnError(fn CAErrorFunc) CA

引出错误信息

func (CA) SM2Verify

func (this CA) SM2Verify(rootPEM string, certPEM string, opts cryptobin_x509.VerifyOptions) (bool, error)

SM2 验证

func (CA) ToKeyBytes

func (this CA) ToKeyBytes() []byte

私钥/公钥/cert

func (CA) ToKeyString

func (this CA) ToKeyString() string

私钥/公钥/cert

func (CA) UpdateCert

func (this CA) UpdateCert(fn func(*x509.Certificate) *x509.Certificate) CA

更新 Cert 数据

func (CA) UpdateCertRequest

func (this CA) UpdateCertRequest(fn func(*x509.CertificateRequest) *x509.CertificateRequest) CA

更新证书请求数据

func (CA) UpdateSM2Cert

func (this CA) UpdateSM2Cert(fn func(*x509.Certificate) *x509.Certificate) CA

更新 Cert 数据

func (CA) UpdateSM2CertRequest

func (this CA) UpdateSM2CertRequest(fn func(*x509.CertificateRequest) *x509.CertificateRequest) CA

更新证书请求数据

func (CA) Verify

func (this CA) Verify(rootPEM string, certPEM string, opts x509.VerifyOptions) (bool, error)

验证

func (CA) WithCert

func (this CA) WithCert(data any) CA

设置 cert 可用 [*x509.Certificate | *sm2X509.Certificate]

func (CA) WithCertRequest

func (this CA) WithCertRequest(data any) CA

设置 certRequest 可用 [*x509.CertificateRequest | *sm2X509.CertificateRequest]

func (CA) WithErrors added in v1.0.1026

func (this CA) WithErrors(errs []error) CA

设置错误

func (CA) WithKeyData

func (this CA) WithKeyData(data []byte) CA

设置 keyData

func (CA) WithPrivateKey

func (this CA) WithPrivateKey(data any) CA

设置 PrivateKey

func (CA) WithPublicKey

func (this CA) WithPublicKey(data any) CA

设置 publicKey

type CACertificate

type CACertificate = x509.Certificate

证书

type CACertificateRequest

type CACertificateRequest = x509.CertificateRequest

证书请求

type CAErrorFunc

type CAErrorFunc = func([]error)

错误方法

type CAExtKeyUsage

type CAExtKeyUsage = x509.ExtKeyUsage

ExtKeyUsage

type CAKeyUsage

type CAKeyUsage = x509.KeyUsage

KeyUsage

type CAPkixAlgorithmIdentifier

type CAPkixAlgorithmIdentifier = pkix.AlgorithmIdentifier

AlgorithmIdentifier

type CAPkixAttributeTypeAndValue

type CAPkixAttributeTypeAndValue = pkix.AttributeTypeAndValue

AttributeTypeAndValue 数据

type CAPkixAttributeTypeAndValueSET

type CAPkixAttributeTypeAndValueSET = pkix.AttributeTypeAndValueSET

AttributeTypeAndValueSET

type CAPkixCertificateList

type CAPkixCertificateList = pkix.CertificateList

CertificateList

type CAPkixExtension

type CAPkixExtension = pkix.Extension

Extension

type CAPkixName

type CAPkixName = pkix.Name

Subject 数据

type CAPkixRDNSequence

type CAPkixRDNSequence = pkix.RDNSequence

RDNSequence

type CAPkixRevokedCertificate

type CAPkixRevokedCertificate = pkix.RevokedCertificate

RevokedCertificate

type CAPkixTBSCertificateList

type CAPkixTBSCertificateList = pkix.TBSCertificateList

TBSCertificateList

type CAPublicKeyAlgorithm

type CAPublicKeyAlgorithm = x509.PublicKeyAlgorithm

PublicKeyAlgorithm

type CASignatureAlgorithm

type CASignatureAlgorithm = x509.SignatureAlgorithm

SignatureAlgorithm

type CAVerifyOptions

type CAVerifyOptions = x509.VerifyOptions

配置别名

type SM2CACertificate added in v1.0.2015

type SM2CACertificate = cryptobin_x509.Certificate

SM2 证书

type SM2CACertificateRequest added in v1.0.2015

type SM2CACertificateRequest = cryptobin_x509.CertificateRequest

SM2 证书请求

type SM2CAExtKeyUsage added in v1.0.2015

type SM2CAExtKeyUsage = cryptobin_x509.ExtKeyUsage

ExtKeyUsage

type SM2CAKeyUsage added in v1.0.2015

type SM2CAKeyUsage = cryptobin_x509.KeyUsage

KeyUsage

type SM2CAPublicKeyAlgorithm added in v1.0.2015

type SM2CAPublicKeyAlgorithm = cryptobin_x509.PublicKeyAlgorithm

PublicKeyAlgorithm

type SM2CASignatureAlgorithm added in v1.0.2015

type SM2CASignatureAlgorithm = cryptobin_x509.SignatureAlgorithm

SignatureAlgorithm

type SM2CAVerifyOptions added in v1.0.2015

type SM2CAVerifyOptions = cryptobin_x509.VerifyOptions

配置别名

Jump to

Keyboard shortcuts

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