certs

package
v0.0.0-...-6d13c91 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RSAKey = "rsa2048"
)

Variables

This section is empty.

Functions

func AssertCertificate

func AssertCertificate(t *testing.T, expectedSubject string, certificationResult externalschema.CertificationResult)

func AssertConfiguration

func AssertConfiguration(t *testing.T, configuration externalschema.Configuration)

func ChangeCommonName

func ChangeCommonName(subject, commonName string) string

func CheckCertificateChainOrder

func CheckCertificateChainOrder(t *testing.T, chain string)

Certificate chain starts from leaf certificate and ends with a root certificate (https://tools.ietf.org/html/rfc5246#section-7.4.2). The correct certificate chain holds the following property: ith certificate in the chain is issued by (i+1)th certificate

func CheckIfCertIsSigned

func CheckIfCertIsSigned(t *testing.T, certificates []*x509.Certificate)

CheckIfCertIsSigned verifies that client certificate is signed by server certificate

func CheckIfChainContainsTwoCertificates

func CheckIfChainContainsTwoCertificates(t *testing.T, certChain string)

func CheckIfSubjectEquals

func CheckIfSubjectEquals(t *testing.T, expectedSubject string, certificate *x509.Certificate)

CheckIfSubjectEquals verifies that specified subject is equal to this in certificate

func Cleanup

func Cleanup(t *testing.T, configmapCleaner *k8s.ConfigmapCleaner, certificationResult externalschema.CertificationResult)

func ClientCertPair

func ClientCertPair(t *testing.T, certChainBytes, privateKeyBytes []byte) (*rsa.PrivateKey, [][]byte)

ClientCertPair returns a decoded client certificate and key pair.

func CreateCertDataHeader

func CreateCertDataHeader(subject, hash string) string

func CreateCsr

func CreateCsr(t *testing.T, strSubject string, keys *rsa.PrivateKey) []byte

CreateCsr creates CSR request

func CreateKey

func CreateKey(t require.TestingT) *rsa.PrivateKey

Create Key generates rsa.PrivateKey

func DecodeAndParseCerts

func DecodeAndParseCerts(t *testing.T, crtResponse *model.CrtResponse) model.DecodedCrtResponse

DecodeAndParseCerts decodes base64 encoded certificates chain and parses it

func DecodeBase64Cert

func DecodeBase64Cert(t *testing.T, certificate string) []byte

func DecodeCert

func DecodeCert(t *testing.T, certificateStr string) *x509.Certificate

func DecodeCertChain

func DecodeCertChain(t *testing.T, certificateChain string) []*x509.Certificate

func EncodeBase64

func EncodeBase64(src []byte) string

func EncodedCertChainToPemBytes

func EncodedCertChainToPemBytes(t *testing.T, encodedChain string) []byte

EncodedCertChainToPemBytes decodes certificates chain and return pemBlock's bytes for client cert and ca cert

func GenerateKey

func GenerateKey() (*rsa.PrivateKey, error)

func GetCertificateHash

func GetCertificateHash(t *testing.T, certificateStr string) string

func ParseSubject

func ParseSubject(subject string) pkix.Name

func SortSubject

func SortSubject(subject string) string

Types

type CAConfig

type CAConfig struct {
	Certificate          []byte `envconfig:"-"`
	Key                  []byte `envconfig:"-"`
	SecretName           string
	SecretNamespace      string
	SecretCertificateKey string
	SecretKeyKey         string
}

type CertificationResponse

type CertificationResponse struct {
	Result externalschema.CertificationResult `json:"result"`
}

type ConfigurationResponse

type ConfigurationResponse struct {
	Result externalschema.Configuration `json:"result"`
}

type RevokeResult

type RevokeResult struct {
	Result bool `json:"result"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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