helpers

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

helpers/readfile.go

For utility/helper functions to support the jamf pro package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64EncodeCertificate

func Base64EncodeCertificate(certPath string) (string, error)

Base64EncodeCertificate reads a certificate file and returns its content as a base64-encoded string.

func ConvertFromXMLSafeString

func ConvertFromXMLSafeString(s string) string

ConvertFromXMLSafeString reverses the process of ConvertToXMLSafeString. It replaces XML entity references in a string back to their original characters. This is useful when reading XML data that contains entity references and converting them back to normal characters.

func ConvertToXMLSafeString

func ConvertToXMLSafeString(s string) string

ConvertToXMLSafeString replaces disallowed XML characters in a string with their corresponding XML entity references. This function is useful for preparing a string to be safely included in an XML document.

func EnsureXMLSafeString

func EnsureXMLSafeString(s string) string

EnsureXMLSafeString checks if a string contains disallowed XML characters. If it does, it converts the string to an XML-safe format using ConvertToXMLSafeString. This function is useful for ensuring that strings are safe for inclusion in XML documents.

func ReadJCDSPackageTypes

func ReadJCDSPackageTypes(filePath string) (io.Reader, int64, error)

ReadJCDSPackageTypes returns a reader and size for a package file securely after applying multiple checks.

func SafeReadCertificateFile

func SafeReadCertificateFile(filePath string, allowedExtensions []string) ([]byte, error)

SafeReadCertificateFile reads a certificate file securely after applying multiple checks.

func SafeReadJCDSPackageFile

func SafeReadJCDSPackageFile(filePath string, allowedExtensions []string) ([]byte, error)

SafeReadJCDSPackageFile reads a package file securely after applying multiple checks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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