cfssl: github.com/cloudflare/cfssl/helpers/testsuite Index | Files

package testsuite

import "github.com/cloudflare/cfssl/helpers/testsuite"

Index

Package Files

testing_helpers.go

Variables

var CSRTests = []CSRTest{
    {
        File:          "../../signer/local/testdata/rsa2048.csr",
        KeyAlgo:       "rsa",
        KeyLen:        2048,
        ErrorCallback: nil,
    },
    {
        File:          "../../signer/local/testdata/rsa3072.csr",
        KeyAlgo:       "rsa",
        KeyLen:        3072,
        ErrorCallback: nil,
    },
    {
        File:          "../../signer/local/testdata/rsa4096.csr",
        KeyAlgo:       "rsa",
        KeyLen:        4096,
        ErrorCallback: nil,
    },
    {
        File:          "../../signer/local/testdata/ecdsa256.csr",
        KeyAlgo:       "ecdsa",
        KeyLen:        256,
        ErrorCallback: nil,
    },
    {
        File:          "../../signer/local/testdata/ecdsa384.csr",
        KeyAlgo:       "ecdsa",
        KeyLen:        384,
        ErrorCallback: nil,
    },
    {
        File:          "../../signer/local/testdata/ecdsa521.csr",
        KeyAlgo:       "ecdsa",
        KeyLen:        521,
        ErrorCallback: nil,
    },
}

CSRTests define a set of CSR files for testing.

func CreateCertificateChain Uses

func CreateCertificateChain(requests []csr.CertificateRequest) (certChain []byte, key []byte, err error)

CreateCertificateChain creates a chain of certificates from a slice of requests. The first request is the root certificate and the last is the leaf. The chain is returned as a slice of PEM-encoded bytes.

func CreateSelfSignedCert Uses

func CreateSelfSignedCert(request csr.CertificateRequest) (encodedCert, encodedKey []byte, err error)

CreateSelfSignedCert creates a self-signed certificate from a certificate request. This function just calls the CLI "gencert" command.

func NewConfig Uses

func NewConfig(t *testing.T, configBytes []byte) *config.Config

NewConfig returns a config object from the data passed.

func SignCertificate Uses

func SignCertificate(request csr.CertificateRequest, signerCert, signerKey []byte) (encodedCert, encodedKey []byte, err error)

SignCertificate uses a certificate (input as signerCert) to create a signed certificate for the input request.

type CFSSLServer Uses

type CFSSLServer struct {
    // contains filtered or unexported fields
}

CFSSLServer is the type returned by StartCFSSLServer. It serves as a handle to a running CFSSL server.

func StartCFSSLServer Uses

func StartCFSSLServer(address string, portNumber int, serverData CFSSLServerData) (*CFSSLServer, error)

StartCFSSLServer creates a local server listening on the given address and port number. Both the address and port number are assumed to be valid.

func (*CFSSLServer) Kill Uses

func (server *CFSSLServer) Kill() error

Kill a running CFSSL server.

type CFSSLServerData Uses

type CFSSLServerData struct {
    CA        []byte
    CABundle  []byte
    CAKey     []byte
    IntBundle []byte
}

CFSSLServerData is the data with which a server is initialized. These fields can be left empty if desired. Any empty fields passed in to StartServer will lead to the server being initialized with the default values defined by the 'cfssl serve' command.

type CSRTest Uses

type CSRTest struct {
    File    string
    KeyAlgo string
    KeyLen  int
    // Error checking function
    ErrorCallback func(*testing.T, error)
}

CSRTest holds information about CSR test files.

Package testsuite imports 13 packages (graph). Updated 2019-07-15. Refresh now. Tools for package owners.