Documentation ¶
Index ¶
- func CertAsBytes(certs ...*x509.Certificate) (b []byte, err error)
- func CertChainAsBytes(certs []*x509.Certificate) (b []byte, err error)
- func CertMatchesParams(key *rsa.PrivateKey, cert *x509.Certificate, params *CertParams) bool
- func NewCA(cn string) (*rsa.PrivateKey, *x509.Certificate, error)
- func NewCert(p *CertParams) (*rsa.PrivateKey, *x509.Certificate, error)
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func ParseCert(b []byte) (*x509.Certificate, error)
- func ParseCertChain(b []byte) ([]*x509.Certificate, error)
- func ParsePrivateKey(b []byte) (*rsa.PrivateKey, error)
- func PrivateKeyAsBytes(key *rsa.PrivateKey) (b []byte, err error)
- func PublicKeyAsBytes(key *rsa.PublicKey) (b []byte, err error)
- func SSHPublicKeyAsString(key *rsa.PublicKey) (s string, err error)
- func UniqueCert(certs []*x509.Certificate) []*x509.Certificate
- type CertParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CertAsBytes ¶
func CertAsBytes(certs ...*x509.Certificate) (b []byte, err error)
func CertChainAsBytes ¶
func CertChainAsBytes(certs []*x509.Certificate) (b []byte, err error)
func CertMatchesParams ¶
func CertMatchesParams(key *rsa.PrivateKey, cert *x509.Certificate, params *CertParams) bool
CertMatchesParams returns true if the given key and cert match the CertParams struct.
func NewCA ¶
func NewCA(cn string) (*rsa.PrivateKey, *x509.Certificate, error)
NewCA returns a new rsa.PrivateKey and x509.Certificate for a CA corresponding to the given CommonName.
func NewCert ¶
func NewCert(p *CertParams) (*rsa.PrivateKey, *x509.Certificate, error)
NewCert returns a new rsa.PrivateKey and x509.Certificate for a certificate corresponding to the given CertParams struct.
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey returns a new 2048-bit rsa.PrivateKey
func ParseCert ¶
func ParseCert(b []byte) (*x509.Certificate, error)
ParseCert takes certificate as bytes and returns x509.Certificate
func ParseCertChain ¶
func ParseCertChain(b []byte) ([]*x509.Certificate, error)
ParseCertChain takes certificate as bytes and returns slice of all x509.Certificate
func ParsePrivateKey ¶
func ParsePrivateKey(b []byte) (*rsa.PrivateKey, error)
func PrivateKeyAsBytes ¶
func PrivateKeyAsBytes(key *rsa.PrivateKey) (b []byte, err error)
func UniqueCert ¶
func UniqueCert(certs []*x509.Certificate) []*x509.Certificate
UniqueCert takes slice of the certificate and returns certificate slice with unique values
Types ¶
type CertParams ¶
type CertParams struct { Subject pkix.Name DNSNames []string IPAddresses []net.IP ExtKeyUsage []x509.ExtKeyUsage SigningKey *rsa.PrivateKey // leave nil for self-signed SigningCert *x509.Certificate // leave nil for self-signed }
CertParams defines the parameters which can be passed into NewCert.