utiltest

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package utiltest provides testing helpers, for generating valid mock data like X509 certificates etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateECPrivateKey added in v0.2.0

func GenerateECPrivateKey(t *testing.T) string

GenerateECPrivateKey generates EC private key, PEM encoded.

func GeneratePKCS1PrivateKey added in v0.2.0

func GeneratePKCS1PrivateKey(t *testing.T) string

GeneratePKCS1PrivateKey generates RSA private key in PKCS1 format, PEM encoded.

func GenerateRSAPrivateKey

func GenerateRSAPrivateKey(t *testing.T) string

GenerateRSAPrivateKey generates RSA private key and returns it as string in PEM format.

func GenerateX509Certificate

func GenerateX509Certificate(t *testing.T) string

GenerateX509Certificate generates random X.509 certificate and returns it as string in PEM format.

Types

type PKI

type PKI struct {
	Certificate string
	PrivateKey  string
}

PKI struct holds X509 certificate and belonging RSA private key in PEM format.

func GeneratePKI

func GeneratePKI(t *testing.T) *PKI

GeneratePKI generates PKI struct.

func GeneratePKIErr added in v0.2.2

func GeneratePKIErr() (*PKI, error)

GeneratePKIErr generates fake PKI X.509 key pair sutiable for tests.

Jump to

Keyboard shortcuts

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