Documentation ¶
Index ¶
- Constants
- func AssertCertificate(t *testing.T, expectedSubject string, ...)
- func AssertConfiguration(t *testing.T, configuration externalschema.Configuration)
- func ChangeCommonName(subject, commonName string) string
- func CheckCertificateChainOrder(t *testing.T, chain string)
- func CheckIfCertIsSigned(t *testing.T, certificates []*x509.Certificate)
- func CheckIfChainContainsTwoCertificates(t *testing.T, certChain string)
- func CheckIfSubjectEquals(t *testing.T, expectedSubject string, certificate *x509.Certificate)
- func Cleanup(t *testing.T, configmapCleaner *k8s.ConfigmapCleaner, ...)
- func ClientCertPair(t *testing.T, certChainBytes, privateKeyBytes []byte) (*rsa.PrivateKey, [][]byte)
- func CreateCertDataHeader(subject, hash string) string
- func CreateCsr(t *testing.T, strSubject string, keys *rsa.PrivateKey) []byte
- func CreateKey(t require.TestingT) *rsa.PrivateKey
- func DecodeAndParseCerts(t *testing.T, crtResponse *model.CrtResponse) model.DecodedCrtResponse
- func DecodeBase64Cert(t *testing.T, certificate string) []byte
- func DecodeCert(t *testing.T, certificateStr string) *x509.Certificate
- func DecodeCertChain(t *testing.T, certificateChain string) []*x509.Certificate
- func EncodeBase64(src []byte) string
- func EncodedCertChainToPemBytes(t *testing.T, encodedChain string) []byte
- func GenerateKey() (*rsa.PrivateKey, error)
- func GetCertificateHash(t *testing.T, certificateStr string) string
- func ParseSubject(subject string) pkix.Name
- func SortSubject(subject string) string
- type CAConfig
- type CertificationResponse
- type ConfigurationResponse
- type RevokeResult
Constants ¶
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 CheckCertificateChainOrder ¶
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 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 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 DecodeCert ¶
func DecodeCert(t *testing.T, certificateStr string) *x509.Certificate
func DecodeCertChain ¶
func DecodeCertChain(t *testing.T, certificateChain string) []*x509.Certificate
func EncodeBase64 ¶
func EncodedCertChainToPemBytes ¶
EncodedCertChainToPemBytes decodes certificates chain and return pemBlock's bytes for client cert and ca cert
func GenerateKey ¶
func GenerateKey() (*rsa.PrivateKey, error)
func ParseSubject ¶
func SortSubject ¶
Types ¶
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"`
}