Documentation
¶
Index ¶
- Variables
- type CA
- func FromCertificate(cert []byte) CA
- func FromCertificateRequest(cert []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 GenerateDSAKey(ln string) CA
- func GenerateECDSAKey(curve string) CA
- func GenerateEdDSAKey() CA
- func GenerateElGamalKey(bitsize, probability int) CA
- func GenerateGostKey(curve string) 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) CreateCAWithIssuer(issuer *cryptobin_x509.Certificate, issuerKey crypto.PrivateKey) CA
- func (this CA) CreateCSR() CA
- func (this CA) CreateCert(issuer *cryptobin_x509.Certificate, issuerKey crypto.PrivateKey) CA
- func (this CA) CreatePKCS12Cert(caCerts []*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(cert []byte) CA
- func (this CA) FromCertificateRequest(cert []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) GenerateDSAKey(ln string) CA
- func (this CA) GenerateECDSAKey(curve string) CA
- func (this CA) GenerateEdDSAKey() CA
- func (this CA) GenerateElGamalKey(bitsize, probability int) CA
- func (this CA) GenerateGostKey(curve string) 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) GetBitsize() int
- func (this CA) GetCert() *x509.Certificate
- func (this CA) GetCertRequest() *x509.CertificateRequest
- func (this CA) GetCurve() elliptic.Curve
- func (this CA) GetErrors() []error
- func (this CA) GetGostCurve() *gost.Curve
- 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) GetProbability() int
- 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(commonName string, organization []string, signAlgName string) CA
- func (this CA) MakeCert(subject pkix.Name, expire int, dns []string, ip []net.IP, signAlgName string) CA
- func (this CA) OnError(fn func([]error)) CA
- func (this CA) ParseCertificateFromPEM(cert []byte) (*cryptobin_x509.Certificate, error)
- func (this CA) ParseCertificateRequestFromPEM(cert []byte) (*cryptobin_x509.CertificateRequest, error)
- 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) SetCurve(curve string) CA
- func (this CA) SetGenerateType(typ string) CA
- func (this CA) SetGostCurve(curve 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)) CA
- func (this CA) UpdateCertRequest(fn func(*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) WithBitsize(bits int) CA
- func (this CA) WithCert(cert *x509.Certificate) CA
- func (this CA) WithCertRequest(cert *x509.CertificateRequest) CA
- func (this CA) WithCurve(curve elliptic.Curve) CA
- func (this CA) WithErrors(errs []error) CA
- func (this CA) WithGostCurve(curve *gost.Curve) 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) WithProbability(probability int) CA
- func (this CA) WithPublicKey(key crypto.PublicKey) CA
- func (this CA) WithPublicKeyType(keyType PublicKeyType) CA
- type Certificate
- type CertificateRequest
- type ExtKeyUsage
- type KeyUsage
- type Options
- type Opts
- type PBKDF2Opts
- type PkixAlgorithmIdentifier
- type PkixAttributeTypeAndValue
- type PkixAttributeTypeAndValueSET
- type PkixCertificateList
- type PkixExtension
- type PkixName
- type PkixRDNSequence
- type PkixRevokedCertificate
- type PkixTBSCertificateList
- type PublicKeyAlgorithm
- type PublicKeyType
- type ScryptOpts
- type SignatureAlgorithm
- type VerifyOptions
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 ¶
From Certificate Request PEM
func FromPrivateKeyWithPassword ¶
From PrivateKey PEM With Password
func GenerateKeyWithSeed ¶
Generate Key with Reader
func (CA) CreateCAWithIssuer ¶
func (this CA) CreateCAWithIssuer(issuer *cryptobin_x509.Certificate, issuerKey crypto.PrivateKey) CA
Create CA PEM With Issuer
func (CA) CreateCert ¶
func (this CA) CreateCert(issuer *cryptobin_x509.Certificate, issuerKey crypto.PrivateKey) CA
Create Cert PEM
func (CA) CreatePKCS12Cert ¶
func (this CA) CreatePKCS12Cert(caCerts []*x509.Certificate, password string) CA
Create PKCS12 Cert PEM caCerts 通常保留为空
func (CA) CreatePrivateKeyWithPassword ¶
Create PrivateKey PEM With Password
func (CA) FromCertificateRequest ¶
From Certificate Request PEM
func (CA) FromPrivateKeyWithPassword ¶
From PrivateKey PEM With Password
func (CA) GenerateDSAKey ¶
Generate DSA key params: [ L1024N160 | L2048N224 | L2048N256 | L3072N256 ]
func (CA) GenerateECDSAKey ¶
Generate ECDSA key params: [P521 | P384 | P256 | P224]
func (CA) GenerateElGamalKey ¶
Generate ElGamal key
func (CA) GenerateKeyWithSeed ¶
Generate Key with Reader
func (CA) GenerateRSAKey ¶
Generate RSA key params: [512 | 1024 | 2048 | 4096]
func (CA) GetParameterSizes ¶
func (this CA) GetParameterSizes() dsa.ParameterSizes
get DSA ParameterSizes
func (CA) MakeCert ¶
func (this CA) MakeCert( subject pkix.Name, expire int, dns []string, ip []net.IP, signAlgName string, ) CA
生成证书
func (CA) ParseCertificateFromPEM ¶
func (this CA) ParseCertificateFromPEM(cert []byte) (*cryptobin_x509.Certificate, error)
Parse Certificate From PEM
func (CA) ParseCertificateRequestFromPEM ¶
func (this CA) ParseCertificateRequestFromPEM(cert []byte) (*cryptobin_x509.CertificateRequest, error)
Parse Certificate Request From PEM
func (CA) ParsePKCS8PrivateKeyFromPEM ¶
func (this CA) ParsePKCS8PrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error)
Parse PKCS8 PrivateKey From PEM
func (CA) ParsePKCS8PrivateKeyFromPEMWithPassword ¶
func (this CA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password []byte) (crypto.PrivateKey, error)
Parse PKCS8 PrivateKey From PEM With Password
func (CA) ParsePKCS8PublicKeyFromPEM ¶
Parse PKCS8 PublicKey From PEM
func (CA) SetGenerateType ¶
set Generate public key type params: [ RSA | DSA | ECDSA | EdDSA | SM2 | Gost | ElGamal ]
func (CA) SetGostCurve ¶
设置曲线类型 set gost curve 可选参数 / params: IdGostR34102001TestParamSet IdGostR34102001CryptoProAParamSet IdGostR34102001CryptoProBParamSet IdGostR34102001CryptoProCParamSet IdGostR34102001CryptoProXchAParamSet IdGostR34102001CryptoProXchBParamSet Idtc26gost34102012256paramSetA Idtc26gost34102012256paramSetB Idtc26gost34102012256paramSetC Idtc26gost34102012256paramSetD Idtc26gost34102012512paramSetTest Idtc26gost34102012512paramSetA Idtc26gost34102012512paramSetB Idtc26gost34102012512paramSetC
func (CA) SetParameterSizes ¶
With DSA ParameterSizes params: [ L1024N160 | L2048N224 | L2048N256 | L3072N256 ]
func (CA) SetPublicKeyType ¶
set public key type params: [ RSA | DSA | ECDSA | EdDSA | SM2 | Gost | ElGamal ]
func (CA) UpdateCertRequest ¶
func (this CA) UpdateCertRequest(fn func(*x509.CertificateRequest)) CA
更新证书请求数据
func (CA) WithCertRequest ¶
func (this CA) WithCertRequest(cert *x509.CertificateRequest) CA
设置 certRequest
func (CA) WithParameterSizes ¶
func (this CA) WithParameterSizes(sizes dsa.ParameterSizes) CA
With DSA ParameterSizes
func (CA) WithProbability ¶
ElGamal private key probability size
func (CA) WithPublicKeyType ¶
func (this CA) WithPublicKeyType(keyType PublicKeyType) CA
public key type
type Options ¶
type Options struct {
// public key type
PublicKeyType PublicKeyType
// generates DSA ParameterSizes
ParameterSizes dsa.ParameterSizes
// generates ECC curve
Curve elliptic.Curve
// generates Gost curve
GostCurve *gost.Curve
// generates RSA private key bit size
Bits int
// generates ElGamal private key bit size and probability
Bitsize, Probability int
}
Options
type PkixAlgorithmIdentifier ¶
type PkixAlgorithmIdentifier = pkix.AlgorithmIdentifier
AlgorithmIdentifier
type PkixAttributeTypeAndValue ¶
type PkixAttributeTypeAndValue = pkix.AttributeTypeAndValue
AttributeTypeAndValue 数据
type PkixAttributeTypeAndValueSET ¶
type PkixAttributeTypeAndValueSET = pkix.AttributeTypeAndValueSET
AttributeTypeAndValueSET
type PkixRevokedCertificate ¶
type PkixRevokedCertificate = pkix.RevokedCertificate
RevokedCertificate
type PkixTBSCertificateList ¶
type PkixTBSCertificateList = pkix.TBSCertificateList
TBSCertificateList
type PublicKeyType ¶
type PublicKeyType uint
public key type
const ( KeyTypeUnknown PublicKeyType = iota KeyTypeRSA KeyTypeDSA KeyTypeECDSA KeyTypeEdDSA KeyTypeSM2 KeyTypeGost KeyTypeElGamal )
func (PublicKeyType) String ¶
func (typ PublicKeyType) String() string