Documentation ¶
Index ¶
- func DecodeCert(certPEM []byte) (*x509.Certificate, error)
- func DecodeKey(keyPEM []byte) (*ecdsa.PrivateKey, error)
- func EncodeCert(cert *x509.Certificate) ([]byte, error)
- func EncodeKey(privateKey *ecdsa.PrivateKey) ([]byte, error)
- func GenerateCSR(key *ecdsa.PrivateKey, commonName string, ips []net.IP) (*x509.CertificateRequest, error)
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func RandomString(length int) string
- type CA
- func (ca *CA) CertPool() *x509.CertPool
- func (ca *CA) CertificatePEM() ([]byte, error)
- func (ca *CA) Fingerprint256() string
- func (ca *CA) KeyPEM() ([]byte, error)
- func (ca *CA) SignCSR(csr *x509.CertificateRequest) (*x509.Certificate, error)
- func (ca *CA) Verify(cert *x509.Certificate) (bool, error)
- func (ca *CA) VerifyHTTPRequest(req *http.Request) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeCert ¶
func DecodeCert(certPEM []byte) (*x509.Certificate, error)
DecodeCert will decode a PEM encoded certificate.
func DecodeKey ¶
func DecodeKey(keyPEM []byte) (*ecdsa.PrivateKey, error)
DecodeKey will decode a PEM encoded private key.
func EncodeCert ¶
func EncodeCert(cert *x509.Certificate) ([]byte, error)
EncodeCert is a small helper function that will PEM encode a certificate.
func EncodeKey ¶
func EncodeKey(privateKey *ecdsa.PrivateKey) ([]byte, error)
EncodeKey is a helper that will PEM encode a private key.
func GenerateCSR ¶
func GenerateCSR(key *ecdsa.PrivateKey, commonName string, ips []net.IP) (*x509.CertificateRequest, error)
GenerateCSR will generate a new certificate signing request.
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
GenerateKey will generate a new ECDSA private key.
func RandomString ¶
RandomString will generate a pseudo-random string consisting of length alphanumeric runes.
Types ¶
type CA ¶
type CA struct { Certificate *x509.Certificate // contains filtered or unexported fields }
CA represents a certificate authority.
func (*CA) CertificatePEM ¶
CertificatePEM will return the root certificate in PEM format.
func (*CA) Fingerprint256 ¶
Fingerprint256 returns the certificate sha256 fingerprint as a string.
func (*CA) SignCSR ¶
func (ca *CA) SignCSR(csr *x509.CertificateRequest) (*x509.Certificate, error)
SignCSR will sign a CSR and generate a new certificate.