testhelper

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Overview

Package testhelper implements utility routines required for writing unit tests. The testhelper should only be used in unit tests.

Package testhelper implements utility routines required for writing unit tests. The testhelper should only be used in unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockClient

func MockClient(certChain []RSACertTuple, desiredOCSPStatuses []ocsp.ResponseStatus, revokedTime *time.Time, validPKIXNoCheck bool) *http.Client

Creates a mock HTTP Client (more accurately, a spy) that intercepts requests to /issuer and /ocsp endpoints The client's responses are dependent on the cert and desiredOCSPStatus

Types

type ECCertTuple

type ECCertTuple struct {
	Cert       *x509.Certificate
	PrivateKey *ecdsa.PrivateKey
}

func GetECCertTuple

func GetECCertTuple(curve elliptic.Curve) ECCertTuple

func GetECDSACertTupleWithPK

func GetECDSACertTupleWithPK(privKey *ecdsa.PrivateKey, cn string, issuer *ECCertTuple) ECCertTuple

func GetECLeafCertificate

func GetECLeafCertificate() ECCertTuple

GetECLeafCertificate returns leaf certificate signed using EC algorithm

func GetECRootCertificate

func GetECRootCertificate() ECCertTuple

GetECRootCertificate returns root certificate signed using EC algorithm

func GetUnsupportedECCert

func GetUnsupportedECCert() ECCertTuple

GetUnsupportedECCert returns certificate signed using EC algorithm with P-224 curve which is not supported by notary.

type RSACertTuple

type RSACertTuple struct {
	Cert       *x509.Certificate
	PrivateKey *rsa.PrivateKey
}

func GetRSACertTuple

func GetRSACertTuple(size int) RSACertTuple

func GetRSACertTupleWithPK

func GetRSACertTupleWithPK(privKey *rsa.PrivateKey, cn string, issuer *RSACertTuple) RSACertTuple

func GetRSALeafCertificate

func GetRSALeafCertificate() RSACertTuple

GetRSALeafCertificate returns leaf certificate signed using RSA algorithm

func GetRSALeafCertificateWithoutEKU

func GetRSALeafCertificateWithoutEKU() RSACertTuple

GetRSALeafCertificateWithoutEKU returns leaf certificate without EKU signed using RSA algorithm

func GetRSARootCertificate

func GetRSARootCertificate() RSACertTuple

GetRSARootCertificate returns root certificate signed using RSA algorithm

func GetRSASelfSignedCertTupleWithPK

func GetRSASelfSignedCertTupleWithPK(privKey *rsa.PrivateKey, cn string) RSACertTuple

func GetRSASelfSignedSigningCertTuple

func GetRSASelfSignedSigningCertTuple(cn string) RSACertTuple

func GetRSASelfSignedSigningCertificate

func GetRSASelfSignedSigningCertificate() RSACertTuple

GetRSASelfSignedSigningCertificate returns a self-signed certificate created which can be used for signing

func GetRevokableRSAChain

func GetRevokableRSAChain(size int) []RSACertTuple

GetRevokableRSAChain returns a chain of certificates that specify a local OCSP server signed using RSA algorithm

func GetRevokableRSALeafCertificate

func GetRevokableRSALeafCertificate() RSACertTuple

GetRevokableRSALeafCertificate returns leaf certificate that specifies a local OCSP server signed using RSA algorithm

func GetUnsupportedRSACert

func GetUnsupportedRSACert() RSACertTuple

GetUnsupportedRSACert returns certificate signed using RSA algorithm with key size of 1024 bits which is not supported by notary.

Jump to

Keyboard shortcuts

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