Documentation
¶
Index ¶
- Constants
- func CertOrKeyExist(pkiPath, name string) bool
- func EncodeCertPEM(cert *x509.Certificate) []byte
- func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
- func EncodePublicKeyPEM(key crypto.PublicKey) []byte
- func GetAltNames(SANs []string, certName string) *certutil.AltNames
- func HasServerAuth(cert *x509.Certificate) bool
- func NewCertAndKey(caCert *x509.Certificate, caKey *rsa.PrivateKey, config *Config) (*x509.Certificate, *rsa.PrivateKey)
- func NewCertificate(key *rsa.PrivateKey, config *Config) *x509.Certificate
- func NewCertificateAuthority(config *Config) (cert *x509.Certificate, key *rsa.PrivateKey)
- func NewPrivateKey() *rsa.PrivateKey
- func NewSignedCert(cfg *Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) *x509.Certificate
- func PathsForCertAndKey(pkiPath, name string) (string, string)
- func TryLoadCertAndKeyFromDisk(pkiPath, name string) (*x509.Certificate, *rsa.PrivateKey)
- func TryLoadCertFromDisk(pkiPath, name string) *x509.Certificate
- func TryLoadPrivateKeyFromDisk(pkiPath, name string) *rsa.PrivateKey
- func TryLoadPrivatePublicKeyFromDisk(pkiPath, name string) (*rsa.PrivateKey, *rsa.PublicKey)
- func TryLoadPublicKeyFromDisk(pkiPath, name string) *rsa.PublicKey
- func WriteCert(pkiPath, name string, cert *x509.Certificate)
- func WriteCertAndKey(pkiPath string, name string, cert *x509.Certificate, key *rsa.PrivateKey)
- func WriteKey(pkiPath, name string, key *rsa.PrivateKey)
- func WritePublicKey(pkiPath, name string, key crypto.PublicKey)
- type Config
Constants ¶
View Source
const ( // PrivateKeyBlockType is a possible value for pem.Block.Type. PrivateKeyBlockType = "PRIVATE KEY" // PublicKeyBlockType is a possible value for pem.Block.Type. PublicKeyBlockType = "PUBLIC KEY" // CertificateBlockType is a possible value for pem.Block.Type. CertificateBlockType = "CERTIFICATE" // RSAPrivateKeyBlockType is a possible value for pem.Block.Type. RSAPrivateKeyBlockType = "RSA PRIVATE KEY" )
Variables ¶
This section is empty.
Functions ¶
func CertOrKeyExist ¶
func EncodeCertPEM ¶
func EncodeCertPEM(cert *x509.Certificate) []byte
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
func EncodePublicKeyPEM ¶
func HasServerAuth ¶
func HasServerAuth(cert *x509.Certificate) bool
HasServerAuth returns true if the given certificate is a ServerAuth
func NewCertAndKey ¶
func NewCertAndKey(caCert *x509.Certificate, caKey *rsa.PrivateKey, config *Config) (*x509.Certificate, *rsa.PrivateKey)
creates new certificate and key by passing the certificate authority certificate and key
func NewCertificate ¶
func NewCertificate(key *rsa.PrivateKey, config *Config) *x509.Certificate
func NewCertificateAuthority ¶
func NewCertificateAuthority(config *Config) (cert *x509.Certificate, key *rsa.PrivateKey)
creates new certificate and private key for the certificate authority
func NewPrivateKey ¶
func NewPrivateKey() *rsa.PrivateKey
func NewSignedCert ¶
func NewSignedCert(cfg *Config, key crypto.Signer, caCert *x509.Certificate, caKey crypto.Signer) *x509.Certificate
NewSignedCert creates a signed certificate using the given CA certificate and key
func PathsForCertAndKey ¶
func TryLoadCertAndKeyFromDisk ¶
func TryLoadCertAndKeyFromDisk(pkiPath, name string) (*x509.Certificate, *rsa.PrivateKey)
func TryLoadCertFromDisk ¶
func TryLoadCertFromDisk(pkiPath, name string) *x509.Certificate
TryLoadCertFromDisk tries to load the cert from the disk and validates that it is valid
func TryLoadPrivateKeyFromDisk ¶
func TryLoadPrivateKeyFromDisk(pkiPath, name string) *rsa.PrivateKey
tries to load the key from the disk and validates that it is valid
func TryLoadPrivatePublicKeyFromDisk ¶
func TryLoadPrivatePublicKeyFromDisk(pkiPath, name string) (*rsa.PrivateKey, *rsa.PublicKey)
func WriteCert ¶
func WriteCert(pkiPath, name string, cert *x509.Certificate)
WriteCert stores the given certificate at the given location
func WriteCertAndKey ¶
func WriteCertAndKey(pkiPath string, name string, cert *x509.Certificate, key *rsa.PrivateKey)
func WriteKey ¶
func WriteKey(pkiPath, name string, key *rsa.PrivateKey)
func WritePublicKey ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.