utils

package
v0.0.0-...-5c10511 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PEMBlockTypeCertificate = "CERTIFICATE"
	PEMBlockTypeRSA         = "RSA PRIVATE KEY"
)

Variables

This section is empty.

Functions

func Check

func Check(err error)

func CompressZlibBase64

func CompressZlibBase64(data []byte) string

func CreateCertificate

func CreateCertificate(
	commonName string,
	emailAddress string,
	identifier string,
	parentCertificate []byte,
	parentPrivateKey *rsa.PrivateKey,
) ([]byte, *rsa.PrivateKey)

func DecompressZlibBase64

func DecompressZlibBase64(s string) []byte

func GetUserUrn

func GetUserUrn(pemEncodedCert []byte) (string, error)

func GetUserUrnFromEscapedCert

func GetUserUrnFromEscapedCert(escapedCert string) (string, error)

func Keys

func Keys(m map[string]string) []string

Keys returns the keys of a map.

func PEMDecodeMany

func PEMDecodeMany(pemEncoded []byte) [][]byte

PEMDecodeMany decodes multiple PEM encoded blocks from a single byte slice.

func PEMEncodeMany

func PEMEncodeMany(data [][]byte, pemType string) []byte

PEMEncodeMany PEM encodes multiple byte slices to a single byte slice.

func RemoveFile

func RemoveFile(name string)

RemoveFile removes a file, ignoring all errors.

func RemoveFiles

func RemoveFiles(names []string)

RemoveFiles removes multiple files, ignoring all errors.

func WriteTempFile

func WriteTempFile(data []byte) (string, error)

WriteTempFile writes data to a temporary file and returns its name. It is the caller's responsibility to remove the file when it is no longer needed.

func WriteTempFilePem

func WriteTempFilePem(data []byte, pemType string) (string, error)

WriteTempFilePem writes PEM encoded data to a temporary file and return its name. It is the caller's responsibility to remove the file when it is no longer needed.

func WriteTempFilePems

func WriteTempFilePems(data [][]byte, pemType string) (string, error)

WriteTempFilePems writes multiple PEM encoded data to a temporary file and return its name. It is the caller's responsibility to remove the file when it is no longer needed.

func WriteTempFiles

func WriteTempFiles(data [][]byte) ([]string, error)

WriteTempFiles writes data to temporary files and returns their names. It is the caller's responsibility to remove the files when they are no longer needed.

func WriteTempFilesPem

func WriteTempFilesPem(data [][]byte, pemType string) ([]string, error)

WriteTempFilesPem write PEM encoded data to temporary files and returns their names. It is the caller's responsibility to remove the files when they are no longer needed.

Types

type ArrayFlags

type ArrayFlags []string

https://stackoverflow.com/a/28323276

func (*ArrayFlags) Set

func (i *ArrayFlags) Set(value string) error

func (*ArrayFlags) String

func (i *ArrayFlags) String() string

Jump to

Keyboard shortcuts

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