certtool

package
v0.0.0-...-e3e1183 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package certtool used for generate certificate for test/examples By default, use CreateTemplate, GeneratePrivateKey, and SignCertificate, the certificates created in same process have same root ca

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTemplate

func CreateTemplate(cn string, isca bool, dns []string) (*x509.Certificate, error)

CreateTemplate creates a basic template for certificate

func GeneratePrivateKey

func GeneratePrivateKey(curve string) (priv interface{}, err error)

GeneratePrivateKey generate a private key for certificate Parameter curve support "P224","P256","P384", "P521", "RSA". If curve is "RSA", it will generate a 2048 bits RSA key

func Initialize

func Initialize() error

Initialize creates the RootCA only if RootCA is nil

func PemEncode

func PemEncode(describe string, data []byte) (string, error)

PemEncode encode the data to pem string

func PemEncodeKey

func PemEncodeKey(priv interface{}) (string, error)

PemEncodeKey encode private key to pem string

func PublicKey

func PublicKey(priv interface{}) interface{}

PublicKey returns the private key's public key

Types

type CertificateInfo

type CertificateInfo struct {
	CertPem string
	KeyPem  string
}

CertificateInfo contains x509 certificate information.

func CreateCertificateInfo

func CreateCertificateInfo(template, parent *x509.Certificate, templatePriv, parentPriv interface{}) (*CertificateInfo, error)

CreateCertificateInfo makes a CertificateInfo

func GetRootCA

func GetRootCA() *CertificateInfo

GetRootCA returns the RootCA's certificate info

func SignCertificate

func SignCertificate(template *x509.Certificate, priv interface{}) (*CertificateInfo, error)

SignCertificate create a Certificate based on template, signed by RootCA

Jump to

Keyboard shortcuts

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