Documentation ¶
Index ¶
- Variables
- type CA
- func FromCertificate(der []byte) CA
- func FromCertificateRequest(asn1Data []byte) CA
- func FromPKCS12Cert(pfxData []byte, password string) CA
- func FromPrivateKey(key []byte) CA
- func FromPrivateKeyWithPassword(key []byte, password []byte) CA
- func FromPublicKey(key []byte) CA
- func FromSM2PKCS12Cert(pfxData []byte, password string) CA
- func GenerateDSAKey(ln string) CA
- func GenerateECDSAKey(curve string) CA
- func GenerateEdDSAKey() CA
- func GenerateKey(options ...Options) CA
- func GenerateKeyWithSeed(reader io.Reader, options ...Options) CA
- func GenerateRSAKey(bits int) CA
- func GenerateSM2Key() CA
- func New() CA
- func NewCA() CA
- func (this CA) AppendError(err ...error) CA
- func (this CA) CreateCA() CA
- func (this CA) CreateCSR() CA
- func (this CA) CreateCert(ca any) CA
- func (this CA) CreatePKCS12Cert(caCerts []*x509.Certificate, pwd string) CA
- func (this CA) CreatePKCS12CertTrustStore(certs []*x509.Certificate, password string) CA
- func (this CA) CreatePrivateKey() CA
- func (this CA) CreatePrivateKeyWithPassword(password []byte, opts ...any) CA
- func (this CA) CreatePublicKey() CA
- func (this CA) Error() error
- func (this CA) FromCertificate(der []byte) CA
- func (this CA) FromCertificateRequest(asn1Data []byte) CA
- func (this CA) FromPKCS12Cert(pfxData []byte, password string) CA
- func (this CA) FromPrivateKey(key []byte) CA
- func (this CA) FromPrivateKeyWithPassword(key []byte, password []byte) CA
- func (this CA) FromPublicKey(key []byte) CA
- func (this CA) FromSM2PKCS12Cert(pfxData []byte, password string) CA
- func (this CA) GenerateDSAKey(ln string) CA
- func (this CA) GenerateECDSAKey(curve string) CA
- func (this CA) GenerateEdDSAKey() CA
- func (this CA) GenerateKey() CA
- func (this CA) GenerateKeyWithSeed(reader io.Reader) CA
- func (this CA) GenerateRSAKey(bits int) CA
- func (this CA) GenerateSM2Key() CA
- func (this CA) GetBits() int
- func (this CA) GetCert() any
- func (this CA) GetCertRequest() any
- func (this CA) GetCurve() elliptic.Curve
- func (this CA) GetErrors() []error
- func (this CA) GetKeyData() []byte
- func (this CA) GetOptions() Options
- func (this CA) GetParameterSizes() dsa.ParameterSizes
- func (this CA) GetPrivateKey() crypto.PrivateKey
- func (this CA) GetPrivateKeyType() PublicKeyType
- func (this CA) GetPublicKey() crypto.PublicKey
- func (this CA) GetPublicKeyType() PublicKeyType
- func (this CA) MakeCA(subject pkix.Name, expire int, signAlgName string) CA
- func (this CA) MakeCSR(country []string, organization []string, organizationalUnit []string, ...) CA
- func (this CA) MakeCert(subject pkix.Name, expire int, dns []string, ip []net.IP, signAlgName string) CA
- func (this CA) MakeSM2CA(subject *pkix.Name, expire int, signAlgName string) CA
- func (this CA) MakeSM2CSR(country []string, organization []string, organizationalUnit []string, ...) CA
- func (this CA) MakeSM2Cert(subject *pkix.Name, expire int, dns []string, ip []net.IP, signAlgName string) CA
- func (this CA) OnError(fn func([]error)) CA
- func (this CA) ParsePKCS8PrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
- func (this CA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password []byte) (crypto.PrivateKey, error)
- func (this CA) ParsePKCS8PublicKeyFromPEM(key []byte) (crypto.PublicKey, error)
- func (this CA) SM2Verify(rootPEM string, certPEM string, opts cryptobin_x509.VerifyOptions) (bool, error)
- func (this CA) SetCurve(curve string) CA
- func (this CA) SetGenerateType(typ string) CA
- func (this CA) SetParameterSizes(ln string) CA
- func (this CA) SetPublicKeyType(keyType string) CA
- func (this CA) ToKeyBytes() []byte
- func (this CA) ToKeyString() string
- func (this CA) UpdateCert(fn func(*x509.Certificate) *x509.Certificate) CA
- func (this CA) UpdateCertRequest(fn func(*x509.CertificateRequest) *x509.CertificateRequest) CA
- func (this CA) UpdateSM2Cert(fn func(*x509.Certificate) *x509.Certificate) CA
- func (this CA) UpdateSM2CertRequest(fn func(*x509.CertificateRequest) *x509.CertificateRequest) CA
- func (this CA) Verify(rootPEM string, certPEM string, opts x509.VerifyOptions) (bool, error)
- func (this CA) WithBits(bits int) CA
- func (this CA) WithCert(cert any) CA
- func (this CA) WithCertRequest(cert any) CA
- func (this CA) WithCurve(curve elliptic.Curve) CA
- func (this CA) WithErrors(errs []error) CA
- func (this CA) WithKeyData(data []byte) CA
- func (this CA) WithOptions(options Options) CA
- func (this CA) WithParameterSizes(sizes dsa.ParameterSizes) CA
- func (this CA) WithPrivateKey(key crypto.PrivateKey) CA
- func (this CA) WithPublicKey(key crypto.PublicKey) CA
- func (this CA) WithPublicKeyType(keyType PublicKeyType) CA
- type CACertificate
- type CACertificateRequest
- type CAExtKeyUsage
- type CAKeyUsage
- type CAPkixAlgorithmIdentifier
- type CAPkixAttributeTypeAndValue
- type CAPkixAttributeTypeAndValueSET
- type CAPkixCertificateList
- type CAPkixExtension
- type CAPkixName
- type CAPkixRDNSequence
- type CAPkixRevokedCertificate
- type CAPkixTBSCertificateList
- type CAPublicKeyAlgorithm
- type CASignatureAlgorithm
- type CAVerifyOptions
- type Options
- type Opts
- type PBKDF2Opts
- type PublicKeyType
- type SM2CACertificate
- type SM2CACertificateRequest
- type SM2CAExtKeyUsage
- type SM2CAKeyUsage
- type SM2CAPublicKeyAlgorithm
- type SM2CASignatureAlgorithm
- type SM2CAVerifyOptions
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
var ( // get Cipher type GetCipherFromName = pkcs8.GetCipherFromName // get hash type GetHashFromName = pkcs8.GetHashFromName )
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 FromCertificateRequest ¶ added in v1.0.5019
From Certificate Request
func FromPKCS12Cert ¶ added in v1.0.5019
From PKCS12 Cert
func FromPrivateKeyWithPassword ¶ added in v1.0.5019
From PrivateKey With Password
func FromSM2PKCS12Cert ¶ added in v1.0.5019
From SM2 PKCS12 Cert
func GenerateECDSAKey ¶ added in v1.0.5020
Generate ECDSA Key
func GenerateKeyWithSeed ¶ added in v1.0.5019
Generate Key with Reader
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) CreatePrivateKeyWithPassword ¶ added in v1.0.5020
Create PrivateKey PEM With Password
func (CA) CreatePublicKey ¶ added in v1.0.5019
Create PublicKey PEM
func (CA) FromCertificate ¶ added in v1.0.5019
From Certificate
func (CA) FromCertificateRequest ¶ added in v1.0.5019
From Certificate Request
func (CA) FromPrivateKeyWithPassword ¶ added in v1.0.5019
From PrivateKey With Password
func (CA) FromSM2PKCS12Cert ¶
From SM2 PKCS12 Cert
func (CA) GenerateDSAKey ¶ added in v1.0.5020
Generate DSA key params: [ L1024N160 | L2048N224 | L2048N256 | L3072N256 ]
func (CA) GenerateECDSAKey ¶ added in v1.0.2015
Generate ECDSA key params: [P521 | P384 | P256 | P224]
func (CA) GenerateKeyWithSeed ¶ added in v1.0.5019
Generate Key with Reader
func (CA) GenerateRSAKey ¶ added in v1.0.2015
Generate RSA key params: [512 | 1024 | 2048 | 4096]
func (CA) GetParameterSizes ¶ added in v1.0.5019
func (this CA) GetParameterSizes() dsa.ParameterSizes
get DSA ParameterSizes
func (CA) GetPrivateKeyType ¶ added in v1.0.5019
func (this CA) GetPrivateKeyType() PublicKeyType
get PrivateKey Type
func (CA) GetPublicKeyType ¶ added in v1.0.5019
func (this CA) GetPublicKeyType() PublicKeyType
get PublicKey Type
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) 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) ParsePKCS8PrivateKeyFromPEM ¶ added in v1.0.5019
func (this CA) ParsePKCS8PrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
Parse PKCS8 PrivateKey From PEM
func (CA) ParsePKCS8PrivateKeyFromPEMWithPassword ¶ added in v1.0.5019
func (this CA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password []byte) (crypto.PrivateKey, error)
Parse PKCS8 PrivateKey From PEM With Password
func (CA) ParsePKCS8PublicKeyFromPEM ¶ added in v1.0.5019
Parse PKCS8 PublicKey From PEM
func (CA) SM2Verify ¶
func (this CA) SM2Verify(rootPEM string, certPEM string, opts cryptobin_x509.VerifyOptions) (bool, error)
SM2 验证
func (CA) SetGenerateType ¶ added in v1.0.5019
set Generate public key type params: [ RSA | DSA | ECDSA | EdDSA | SM2 ]
func (CA) SetParameterSizes ¶ added in v1.0.5019
With DSA ParameterSizes params: [ L1024N160 | L2048N224 | L2048N256 | L3072N256 ]
func (CA) SetPublicKeyType ¶ added in v1.0.5019
public key type params: [ RSA | DSA | ECDSA | EdDSA | SM2 ]
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) WithCertRequest ¶
设置 certRequest 可用 [*x509.CertificateRequest | *sm2X509.CertificateRequest]
func (CA) WithOptions ¶ added in v1.0.5019
With options
func (CA) WithParameterSizes ¶ added in v1.0.5019
func (this CA) WithParameterSizes(sizes dsa.ParameterSizes) CA
With DSA ParameterSizes
func (CA) WithPublicKeyType ¶ added in v1.0.5019
func (this CA) WithPublicKeyType(keyType PublicKeyType) CA
public key type
type CAPkixAlgorithmIdentifier ¶
type CAPkixAlgorithmIdentifier = pkix.AlgorithmIdentifier
AlgorithmIdentifier
type CAPkixAttributeTypeAndValue ¶
type CAPkixAttributeTypeAndValue = pkix.AttributeTypeAndValue
AttributeTypeAndValue 数据
type CAPkixAttributeTypeAndValueSET ¶
type CAPkixAttributeTypeAndValueSET = pkix.AttributeTypeAndValueSET
AttributeTypeAndValueSET
type CAPkixRevokedCertificate ¶
type CAPkixRevokedCertificate = pkix.RevokedCertificate
RevokedCertificate
type CAPkixTBSCertificateList ¶
type CAPkixTBSCertificateList = pkix.TBSCertificateList
TBSCertificateList
type Options ¶ added in v1.0.5019
type Options struct { // public key type PublicKeyType PublicKeyType // DSA ParameterSizes ParameterSizes dsa.ParameterSizes // ecc curve Curve elliptic.Curve // generates RSA private key bit size Bits int }
Options
type PublicKeyType ¶ added in v1.0.5019
type PublicKeyType uint
public key type
const ( KeyTypeUnknown PublicKeyType = iota KeyTypeRSA KeyTypeDSA KeyTypeECDSA KeyTypeEdDSA KeyTypeSM2 )
func (PublicKeyType) String ¶ added in v1.0.5019
func (typ PublicKeyType) String() string
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 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
配置别名