util

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CredentialsRootPath = `venafi/`

	StoreByCNString                              = "cn"
	StoreByHASHstring                            = "hash"
	StoreBySerialString                          = "serial"
	ErrorTextValueMustBeLess                     = `"ttl" value must be less than "max_ttl" value`
	ErrorTextStoreByAndStoreByCNOrSerialConflict = `Can't specify both story_by and store_by_cn or store_by_serial options '`
	ErrorTextNoStoreAndStoreByCNOrSerialConflict = `Can't specify both no_store and store_by_cn or store_by_serial options '`
	ErrorTextNoStoreAndStoreByConflict           = `Can't specify both no_store and store_by options '`
	ErrTextStoreByWrongOption                    = "Option store_by can be %s, %s or %s, not %s"
	ErrorTextVenafiSecretEmpty                   = `"venafi_secret" argument is required`
	ErrorTextURLEmpty                            = `"url" argument is required`
	ErrorTextZoneEmpty                           = `"zone" argument is required`
	ErrorTextInvalidMode                         = "invalid mode: fakemode or apikey or tpp credentials or tpp access token required"
	ErrorTextNeed2RefreshTokens                  = "secrets engine requires 2 refresh tokens for no impact token refresh"
)
View Source
const (
	Role_ttl_test_property = int(120)
	Ttl_test_property      = int(48)
)

Variables

View Source
var (
	ErrorTextMixedTPPAndToken   = fmt.Sprintf(errorMultiModeMessage, tppMode, tokenMode)
	ErrorTextMixedTPPAndCloud   = fmt.Sprintf(errorMultiModeMessage, tppMode, cloudMode)
	ErrorTextMixedTokenAndCloud = fmt.Sprintf(errorMultiModeMessage, tokenMode, cloudMode)
)

Functions

func AddSeparatorToHexFormattedString

func AddSeparatorToHexFormattedString(s string, sep string) (string, error)

AddSeparatorToHexFormattedString gets a hexadecimal string and adds colon (:) every two characters it returns a string with a colon every two chracters and any error during the convertion process input: 6800b707811f0befb37f922b9e12f68eab8093 output: 68:00:b7:07:81:1f:0b:ef:b3:7f:92:2b:9e:12:f6:8e:ab:80:93

func AreDNSNamesCorrect

func AreDNSNamesCorrect(actualAltNames []string, expectedCNNames []string, expectedAltNames []string) bool

func CopyMap

func CopyMap(m map[string]interface{}) map[string]interface{}

func DecryptPkcs8PrivateKey

func DecryptPkcs8PrivateKey(privateKey string, password string) (string, error)

func EncryptPkcs1PrivateKey

func EncryptPkcs1PrivateKey(privateKey string, password string) (string, error)

func EncryptPrivateKey

func EncryptPrivateKey(privateKey string, password string) (string, error)

func GetHexFormatted

func GetHexFormatted(buf []byte, sep string) (string, error)

func GetPrivateKey

func GetPrivateKey(keyBytes []byte, passphrase string) ([]byte, error)

func GetStatusCode

func GetStatusCode(msg string) int64

func NormalizeSerial

func NormalizeSerial(serial string) string

func RandRunes

func RandRunes(n int) string

func RemoveDuplicateStr

func RemoveDuplicateStr(strSlice *[]string)

we may want to enhance this function when we update to Go 1.18, since generics are only supported starting from that version

func SameIpSlice

func SameIpSlice(x, y []net.IP) bool

func SameStringSlice

func SameStringSlice(x, y []string) bool

func Sha1sum

func Sha1sum(s string) string

func ShortDurationString

func ShortDurationString(d time.Duration) string

ShortDurationString will trim

func SliceContains

func SliceContains(slice []string, item string) bool

func StringSlicesEqual

func StringSlicesEqual(a []string, b []string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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