pki

package module
v0.0.0-...-1f7ee3e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2018 License: MIT Imports: 9 Imported by: 0

README

Work in progress - simplified X.509 handling in Go.

Docs: https://godoc.org/github.com/dmjones500/pki

Documentation

Overview

Package pki provides helper methods for manipulating X.509 objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertificateToPem

func CertificateToPem(cert *x509.Certificate) []byte

CertificateToPem converts a certificate into PEM format

func CreateSimpleCertRequest

func CreateSimpleCertRequest(subject Subject, key crypto.Signer) (*x509.CertificateRequest, error)

CreateSimpleCertRequest makes a certificate request for the supplied subject.

func IsRootCACert

func IsRootCACert(cert *x509.Certificate) bool

IsRootCACert tests whether a certificate is a root CA certificate by checking the certificate is self-signed and validating the Basic Constraints, if present.

WARNING: Do not use this function to determine whether to trust the certificate.

func ParsePemCertificate

func ParsePemCertificate(pemCert []byte) (*x509.Certificate, error)

ParsePemCertificate reads a certificate from PEM format. Only the first PEM object in the input data is read.

func PrivateKeyToPem

func PrivateKeyToPem(key crypto.Signer, password []byte) ([]byte, error)

PrivateKeyToPem converts an RSA or ECDSA private key to a PEM file, encrypting it with the password if supplied (and non-empty).

Types

type Subject

type Subject struct {
	Country            string
	Province           string
	Locality           string
	Organization       string
	OrganizationalUnit string
	CommonName         string
	EmailAddress       string
}

Subject contains the basic subject info for a certificate request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL