Documentation ¶
Index ¶
- Constants
- 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 CertPem
- type PKI
- type PrivateKey
Constants ¶
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 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 PKI interface { // CreateSelfSignedRootCert info: request information for issuing a certificate; // durationDay: certificate validity period, in days; // generate a self-signed root certificate CreateSelfSignedRootCert(info *x509.CertificateRequest, durationDay int) (*CertPem, error) // CreateRootCert info: request information for issuing a certificate; // durationDay: certificate validity period, in days; // parent: root ca certificate, used to issue sub-certificates CreateRootCert(info *x509.CertificateRequest, durationDay int, parent *CertPem) (*CertPem, error) // CreateSubCert csr: standard CSR request data; // durationDay: certificate validity period, in days; // parent: root ca certificate, used to issue sub-certificates CreateSubCert(csr []byte, durationDay int, parent *CertPem) ([]byte, error) // CreateSubCertWithKey info: request information for issuing a certificate; // durationDay: certificate validity period, in days; // parent: root ca certificate, used to issue sub-certificates CreateSubCertWithKey(info *x509.CertificateRequest, durationDay int, parent *CertPem) (*CertPem, error) }
func NewPKIClient ¶
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.