testtools

package
v0.0.0-...-4c73ccb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCertificateTemplate = x509.Certificate{
	SerialNumber: big.NewInt(1),
	Version:      3,
	NotBefore:    time.Now().Add(-10 * time.Second),
	NotAfter:     time.Now().AddDate(10, 0, 0),
	KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature |
		x509.KeyUsageCertSign | x509.KeyUsageCRLSign,
	ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth, x509.ExtKeyUsageServerAuth},
	Subject: pkix.Name{
		Country:            []string{"UA"},
		Organization:       []string{"EPAM"},
		OrganizationalUnit: []string{"Aos"},
		Locality:           []string{"Kyiv"},
	},
	DNSNames: []string{
		"localhost",
		"wwwaosum",
		"*.kyiv.epam.com",
		"*.aos-dev.test",
	},
	BasicConstraintsValid: true,
	IPAddresses:           []net.IP{net.IPv4(127, 0, 0, 1).To4(), net.IPv6loopback},
}

DefaultCertificateTemplate default certificate template.

Functions

func CompareFiles

func CompareFiles(dst, src string) (err error)

CompareFiles compares files.

func CreateCSR

func CreateCSR(key crypto.PrivateKey) (csr []byte, err error)

CreateCSR creates CSR.

func CreateFilePartition

func CreateFilePartition(
	path string, fsType string, size uint64, contentCreator func(mountPoint string) (err error), archivate bool,
) (err error)

CreateFilePartition creates partition in file.

func GenerateCACertAndKey

func GenerateCACertAndKey(
	parent *x509.Certificate, privateKey crypto.PrivateKey, subject pkix.Name,
) (*x509.Certificate, crypto.PrivateKey, error)

GenerateCACertAndKey generates CA certificate and key.

func GenerateCert

func GenerateCert(
	template, parent *x509.Certificate, privateKey crypto.PrivateKey, publicKey crypto.PublicKey,
) (*x509.Certificate, error)

GenerateCert generates certificate.

func GenerateCertAndKey

func GenerateCertAndKey(
	template, parent *x509.Certificate, parentPrivateKey crypto.PrivateKey,
) (cert *x509.Certificate, privateKey crypto.PrivateKey, err error)

GenerateCertAndKey generates key and certificate.

func GenerateCertAndKeyWithSubject

func GenerateCertAndKeyWithSubject(
	subject pkix.Name, parent *x509.Certificate, privateKey crypto.PrivateKey,
) (*x509.Certificate, crypto.PrivateKey, error)

GenerateCertAndKeyWithSubject generates certificate and key.

func GenerateDefaultCARootCertAndKey

func GenerateDefaultCARootCertAndKey() (cert *x509.Certificate, key crypto.PrivateKey, err error)

GenerateDefaultCARootCertAndKey generates default CA root certificate and key.

func VerifyCertChain

func VerifyCertChain(leafCert *x509.Certificate, roots, intermediates []*x509.Certificate) error

VerifyCertChain verifies chain of certificates.

Types

type PartDesc

type PartDesc struct {
	Type  string
	Label string
	Size  uint64
}

PartDesc partition description structure.

type PartInfo

type PartInfo struct {
	PartDesc
	Device   string
	PartUUID string
}

PartInfo partition info structure.

type TestDisk

type TestDisk struct {
	Device     string
	Partitions []PartInfo
	// contains filtered or unexported fields
}

TestDisk test disk structure.

func NewTestDisk

func NewTestDisk(path string, desc []PartDesc) (disk *TestDisk, err error)

NewTestDisk creates new disk in file.

func (*TestDisk) Close

func (disk *TestDisk) Close() (err error)

Close closes test disk.

Jump to

Keyboard shortcuts

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