Documentation ¶
Index ¶
- Constants
- func CreateCSR(certInfo *CertInfo, key crypto.PrivateKey) ([]byte, error)
- func CreateCert(certInfo *CertInfo, key crypto.PrivateKey, CAkey crypto.PrivateKey, ...) (*x509.Certificate, []byte, error)
- func CreateKeyFile() []byte
- func CreatePrivateKey(rsabits int, encrypt bool) (crypto.PrivateKey, []byte, string, error)
- func CreateSSHKeyPair(rsabits int, encrypt bool) (pub ssh.PublicKey, pubBytes []byte, priv crypto.PrivateKey, privPEM []byte, ...)
- func GetCSR(pemCSR []byte) (*x509.CertificateRequest, error)
- func GetCertificate(pemCert []byte) (*x509.Certificate, error)
- func GetPrivateKey(pemKey []byte) (crypto.PrivateKey, error)
- type CertInfo
Constants ¶
const ( RootCACert IntermediateCACert OCSPSigningCert ServerCert ClientCert )
Certificate types handled by this package
Variables ¶
This section is empty.
Functions ¶
func CreateCSR ¶ added in v0.2.8
func CreateCSR(certInfo *CertInfo, key crypto.PrivateKey) ([]byte, error)
CreateCSR creates a private key and certificate signing request, currently only for a client certificate. the CertInfo needs only the CertType to be Client, and the O/OU/CN filled in for the Subject Name.
func CreateCert ¶
func CreateCert(certInfo *CertInfo, key crypto.PrivateKey, CAkey crypto.PrivateKey, CACert *x509.Certificate) (*x509.Certificate, []byte, error)
CreateCert creates a certificate from a private key and a CA, or a self-signed certificate a flag controls what kind of certificate is generated returns the certificate, and a byte slice PEM-formatted version
func CreateKeyFile ¶
func CreateKeyFile() []byte
CreateKeyFile creates a random 32 bytes and returns it as a byte64 encoded string.
func CreatePrivateKey ¶
CreatePrivateKey returns a PKCS#8 formatted private key it is an RSA private key of the specified length. it is returned as a pointer to an rsa.PrivateKey, and also in PEM format as a byte slice. If encrypted, the random password is returned also.
func CreateSSHKeyPair ¶ added in v0.2.8
func GetCSR ¶ added in v0.2.8
func GetCSR(pemCSR []byte) (*x509.CertificateRequest, error)
GetCSR gets the certificate from a PEM-format byte slice
func GetCertificate ¶
func GetCertificate(pemCert []byte) (*x509.Certificate, error)
GetCertificate gets the certificate from a PEM-format byte slice
func GetPrivateKey ¶
func GetPrivateKey(pemKey []byte) (crypto.PrivateKey, error)
GetPrivateKey gets the private kay from a PEM-format byte slice