Documentation ¶
Index ¶
- Constants
- func EncodeByteToPem(data []byte, tp string) string
- func EncodeCertPrivateKey(priv *PrivateKey) ([]byte, error)
- func EncodeCertificates(certs ...*x509.Certificate) ([]byte, error)
- func EncodeCertificatesRequest(csrs ...*x509.CertificateRequest) ([]byte, error)
- func ParseCertificates(pemCerts []byte) ([]*x509.Certificate, error)
- func SigAlgorithmType(priv *PrivateKey) x509.SignatureAlgorithm
- type PKI
- type PrivateKey
- type Storage
Constants ¶
View Source
const ( TypeIssuingCA = "IssuingCA" // TypeIssuingSubCert is an issuing sub cert which is signed by issuing ca TypeIssuingSubCert = "IssuingSubCertificate" // 证书有效期,以天为单位 [1, 50*365] DefaultCADuration = 50 * 365 DefaultSubCertDuration = 20 * 365 )
View Source
const ( RsaPrivateKeyBlockType = "RSA PRIVATE KEY" EcPrivateKeyBlockType = "EC PRIVATE KEY" CertificateBlockType = "CERTIFICATE" CertificateRequestBlockType = "CERTIFICATE REQUEST" DefaultDSA = "P256" DefaultRSABits = 2048 )
Variables ¶
This section is empty.
Functions ¶
func EncodeByteToPem ¶
func EncodeCertPrivateKey ¶
func EncodeCertPrivateKey(priv *PrivateKey) ([]byte, error)
EncodeCertPrivateKey returns PEM-encoded private key data
func EncodeCertificates ¶
func EncodeCertificates(certs ...*x509.Certificate) ([]byte, error)
EncodeCertificates returns the PEM-encoded byte array that represents by the specified certs
func EncodeCertificatesRequest ¶
func EncodeCertificatesRequest(csrs ...*x509.CertificateRequest) ([]byte, error)
EncodeCertificatesRequest returns the PEM-encoded byte array that represents by the specified certs
func ParseCertificates ¶
func ParseCertificates(pemCerts []byte) ([]*x509.Certificate, error)
ParseCertificates takes a PEM encoded x509 certificates byte array and returns A x509 certificate and the block byte array
func SigAlgorithmType ¶
func SigAlgorithmType(priv *PrivateKey) x509.SignatureAlgorithm
Types ¶
type PKI ¶
type PrivateKey ¶
type PrivateKey struct { Type string Key interface{} }
PrivateKey wraps a ECC or RSA private key
func GenCertPrivateKey ¶
func GenCertPrivateKey(dsa string, bits int) (*PrivateKey, error)
func ParseCertPrivateKey ¶
func ParseCertPrivateKey(key []byte) (*PrivateKey, error)
ParseCertPrivateKey takes a key PEM byte array and returns a PrivateKey that represents Either an RSA or EC private key.
Click to show internal directories.
Click to hide internal directories.