Documentation ¶
Overview ¶
Package untar untars a tarball to disk.
Index ¶
- Constants
- Variables
- func CancelWhenSignaled(parent context.Context) context.Context
- func CertsFromFile(file string) ([]*x509.Certificate, error)
- func CheckInstall()
- func DoCmd(cmd string, args ...string)
- func EncodeCertPEM(cert *x509.Certificate) []byte
- func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
- func GetCopyright(file string) string
- func GetDomain() string
- func GetRepo() string
- func LoadRepoFromGoMod() error
- func LoadRepoFromGoPath() error
- func LoadRepoFromGoPathOrGoMod() error
- func NewCertAndKey(caCert *x509.Certificate, caKey *rsa.PrivateKey, config Config) (*x509.Certificate, *rsa.PrivateKey, error)
- func NewPrivateKey() (*rsa.PrivateKey, error)
- func NewSignedCert(cfg Config, key *rsa.PrivateKey, caCert *x509.Certificate, ...) (*x509.Certificate, error)
- func Overwrite(path, templateName, templateValue string, data interface{}) bool
- func ParseCertsPEM(pemCerts []byte) ([]*x509.Certificate, error)
- func ParsePrivateKeyPEM(keyData []byte) (interface{}, error)
- func PrivateKeyFromFile(file string) (interface{}, error)
- func SetRepo(r string)
- func TryLoadCertAndKeyFromDisk(pkiPath, name string) (*x509.Certificate, *rsa.PrivateKey, error)
- func TryLoadCertFromDisk(pkiPath, name string) (*x509.Certificate, error)
- func TryLoadKeyFromDisk(pkiPath, name string) (*rsa.PrivateKey, error)
- func Untar(r io.Reader, dir string, ...) error
- func WriteIfNotFound(path, templateName, templateValue string, data interface{}) bool
- type AltNames
- type Config
Constants ¶
const ( // ECPrivateKeyBlockType is a possible value for pem.Block.Type. ECPrivateKeyBlockType = "EC PRIVATE KEY" // RSAPrivateKeyBlockType is a possible value for pem.Block.Type. RSAPrivateKeyBlockType = "RSA PRIVATE KEY" // PrivateKeyBlockType is a possible value for pem.Block.Type. PrivateKeyBlockType = "PRIVATE KEY" // CertificateBlockType is a possible value for pem.Block.Type. CertificateBlockType = "CERTIFICATE" )
Variables ¶
var Domain string
Functions ¶
func CertsFromFile ¶
func CertsFromFile(file string) ([]*x509.Certificate, error)
CertsFromFile returns the x509.Certificates contained in the given PEM-encoded file. Returns an error if the file could not be read, a certificate could not be parsed, or if the file does not contain any certificates
func CheckInstall ¶
func CheckInstall()
func EncodeCertPEM ¶
func EncodeCertPEM(cert *x509.Certificate) []byte
EncodeCertPEM returns PEM-endcoded certificate data
func EncodePrivateKeyPEM ¶
func EncodePrivateKeyPEM(key *rsa.PrivateKey) []byte
EncodePrivateKeyPEM returns PEM-encoded private key data
func GetCopyright ¶
func LoadRepoFromGoMod ¶
func LoadRepoFromGoMod() error
func LoadRepoFromGoPath ¶
func LoadRepoFromGoPath() error
func LoadRepoFromGoPathOrGoMod ¶
func LoadRepoFromGoPathOrGoMod() error
func NewCertAndKey ¶
func NewCertAndKey(caCert *x509.Certificate, caKey *rsa.PrivateKey, config Config) (*x509.Certificate, *rsa.PrivateKey, error)
NewCertAndKey creates new certificate and key by passing the certificate authority certificate and key
func NewPrivateKey ¶
func NewPrivateKey() (*rsa.PrivateKey, error)
NewPrivateKey creates an RSA private key
func NewSignedCert ¶
func NewSignedCert(cfg Config, key *rsa.PrivateKey, caCert *x509.Certificate, caKey *rsa.PrivateKey) (*x509.Certificate, error)
NewSignedCert creates a signed certificate using the given CA certificate and key
func ParseCertsPEM ¶
func ParseCertsPEM(pemCerts []byte) ([]*x509.Certificate, error)
ParseCertsPEM returns the x509.Certificates contained in the given PEM-encoded byte array Returns an error if a certificate could not be parsed, or if the data does not contain any certificates
func ParsePrivateKeyPEM ¶
ParsePrivateKeyPEM returns a private key parsed from a PEM block in the supplied data. Recognizes PEM blocks for "EC PRIVATE KEY", "RSA PRIVATE KEY", or "PRIVATE KEY"
func PrivateKeyFromFile ¶
PrivateKeyFromFile returns the private key in rsa.PrivateKey or ecdsa.PrivateKey format from a given PEM-encoded file. Returns an error if the file could not be read or if the private key could not be parsed.
func TryLoadCertAndKeyFromDisk ¶
func TryLoadCertAndKeyFromDisk(pkiPath, name string) (*x509.Certificate, *rsa.PrivateKey, error)
TryLoadCertAndKeyFromDisk tries to load a cert and a key from the disk and validates that they are valid
func TryLoadCertFromDisk ¶
func TryLoadCertFromDisk(pkiPath, name string) (*x509.Certificate, error)
TryLoadCertFromDisk tries to load the cert from the disk and validates that it is valid
func TryLoadKeyFromDisk ¶
func TryLoadKeyFromDisk(pkiPath, name string) (*rsa.PrivateKey, error)
TryLoadKeyFromDisk tries to load the key from the disk and validates that it is valid
func WriteIfNotFound ¶
writeIfNotFound returns true if the file was created and false if it already exists