Documentation ¶
Index ¶
- func DecodePrivateKeyBytes(keyBytes []byte) (crypto.Signer, error)
- func GenerateCertificate(issuerCert *x509.Certificate, signerKey interface{}, commonName string, ...) ([]byte, []byte, error)
- func GeneratePrivateKey() (*rsa.PrivateKey, error)
- func IsVerifyError(err error) bool
- func LoadX509Certificate(cert []byte) (*x509.Certificate, error)
- func Verify(certificate, root *x509.Certificate) error
- type VerifyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePrivateKeyBytes ¶
DecodePrivateKeyBytes will decode a PEM encoded private key into a crypto.Signer. It supports RSA private keys only. All other types will return err.
func GenerateCertificate ¶
func GenerateCertificate(issuerCert *x509.Certificate, signerKey interface{}, commonName string, validFor time.Duration, isServer, isCA bool, host ...string) ([]byte, []byte, error)
GenerateCertificate issues a new certificate with the passed options and signed by the parent certificate if one is given. A self-signed is issued otherwise.
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*rsa.PrivateKey, error)
GeneratePrivateKey generates a new RSA private key
func IsVerifyError ¶
IsVerifyError returns true if the error has type VerifyError
func LoadX509Certificate ¶
func LoadX509Certificate(cert []byte) (*x509.Certificate, error)
LoadX509Certificate loads a x509.Certificate object from the given bytes
func Verify ¶
func Verify(certificate, root *x509.Certificate) error
Verify validates that the given certificate is valid and signed by the given root
Types ¶
type VerifyError ¶
type VerifyError struct {
// contains filtered or unexported fields
}
VerifyError is an error type returned when the certificate does not pass validation
func NewVerifyError ¶
func NewVerifyError(msg string) VerifyError
NewVerifyError returns a VerifyError
func (VerifyError) Error ¶
func (vf VerifyError) Error() string