Documentation ¶
Overview ¶
Package macOS provides cgo-less wrappers for Core Foundation and Security.framework, similarly to how package syscall provides access to libSystem.dylib.
Index ¶
- Constants
- Variables
- func CFArrayAppendValue(array CFRef, val CFRef)
- func CFArrayGetCount(array CFRef) int
- func CFDataGetBytePtr(data CFRef) uintptr
- func CFDataGetLength(data CFRef) int
- func CFDataToSlice(data CFRef) []byte
- func CFEqual(a, b CFRef) bool
- func CFErrorGetCode(errRef CFRef) int
- func CFNumberGetValue(num CFRef) (int32, error)
- func CFRelease(ref CFRef)
- func CFStringToString(ref CFRef) string
- func ReleaseCFArray(array CFRef)
- func SecCertificateCopyData(cert CFRef) ([]byte, error)
- func SecTrustEvaluateWithError(trustObj CFRef) (int, error)
- func SecTrustGetCertificateCount(trustObj CFRef) int
- func SecTrustGetResult(trustObj CFRef, result CFRef) (CFRef, CFRef, error)
- func SecTrustSetVerifyDate(trustObj CFRef, dateRef CFRef) error
- type CFRef
- func BytesToCFData(b []byte) CFRef
- func CFArrayCreateMutable() CFRef
- func CFArrayGetValueAtIndex(array CFRef, index int) CFRef
- func CFDateCreate(seconds float64) CFRef
- func CFDictionaryGetValueIfPresent(dict CFRef, key CFString) (value CFRef, ok bool)
- func CFErrorCopyDescription(errRef CFRef) CFRef
- func CFStringCreateExternalRepresentation(strRef CFRef) (CFRef, error)
- func SecCertificateCreateWithData(b []byte) (CFRef, error)
- func SecPolicyCreateSSL(name string) (CFRef, error)
- func SecTrustCreateWithCertificates(certs CFRef, policies CFRef) (CFRef, error)
- func SecTrustEvaluate(trustObj CFRef) (CFRef, error)
- func SecTrustGetCertificateAtIndex(trustObj CFRef, i int) (CFRef, error)
- func SecTrustSettingsCopyCertificates(domain SecTrustSettingsDomain) (certArray CFRef, err error)
- func SecTrustSettingsCopyTrustSettings(cert CFRef, domain SecTrustSettingsDomain) (trustSettings CFRef, err error)
- func TimeToCFDateRef(t time.Time) CFRef
- type CFString
- type OSStatus
- type SecTrustResultType
- type SecTrustSettingsDomain
- type SecTrustSettingsResult
Constants ¶
const ( // various macOS error codes that can be returned from // SecTrustEvaluateWithError that we can map to Go cert // verification error types. ErrSecCertificateExpired = -67818 ErrSecHostNameMismatch = -67602 ErrSecNotTrusted = -67843 )
Variables ¶
var ErrNoTrustSettings = errors.New("no trust settings found")
var SecPolicyAppleSSL = StringToCFString("1.2.840.113635.100.1.3") // defined by POLICYMACRO
var SecPolicyOid = StringToCFString("SecPolicyOid")
var SecTrustSettingsPolicy = StringToCFString("kSecTrustSettingsPolicy")
var SecTrustSettingsPolicyString = StringToCFString("kSecTrustSettingsPolicyString")
var SecTrustSettingsResultKey = StringToCFString("kSecTrustSettingsResult")
Functions ¶
func CFArrayAppendValue ¶
func CFArrayGetCount ¶
func CFDataGetBytePtr ¶
func CFDataGetLength ¶
func CFDataToSlice ¶
CFDataToSlice returns a copy of the contents of data as a bytes slice.
func CFErrorGetCode ¶
func CFNumberGetValue ¶
func CFStringToString ¶
CFStringToString returns a Go string representation of the passed in CFString, or an empty string if it's invalid.
func ReleaseCFArray ¶
func ReleaseCFArray(array CFRef)
ReleaseCFArray iterates through an array, releasing its contents, and then releases the array itself. This is necessary because we cannot, easily, set the CFArrayCallBacks argument when creating CFArrays.
func SecCertificateCopyData ¶
func SecTrustSetVerifyDate ¶
Types ¶
type CFRef ¶
type CFRef uintptr
CFRef is an opaque reference to a Core Foundation object. It is a pointer, but to memory not owned by Go, so not an unsafe.Pointer.
func BytesToCFData ¶
func CFArrayCreateMutable ¶
func CFArrayCreateMutable() CFRef
func CFArrayGetValueAtIndex ¶
func CFDateCreate ¶
func CFErrorCopyDescription ¶
func SecPolicyCreateSSL ¶
func SecTrustEvaluate ¶
func SecTrustSettingsCopyCertificates ¶
func SecTrustSettingsCopyCertificates(domain SecTrustSettingsDomain) (certArray CFRef, err error)
func SecTrustSettingsCopyTrustSettings ¶
func SecTrustSettingsCopyTrustSettings(cert CFRef, domain SecTrustSettingsDomain) (trustSettings CFRef, err error)
func TimeToCFDateRef ¶
TimeToCFDateRef converts a time.Time into an apple CFDateRef.
type CFString ¶
type CFString CFRef
func StringToCFString ¶
StringToCFString returns a copy of the UTF-8 contents of s as a new CFString.
type SecTrustResultType ¶
type SecTrustResultType int32
const ( SecTrustResultInvalid SecTrustResultType = iota SecTrustResultProceed SecTrustResultConfirm // deprecated SecTrustResultDeny SecTrustResultUnspecified SecTrustResultRecoverableTrustFailure SecTrustResultFatalTrustFailure SecTrustResultOtherError )
type SecTrustSettingsDomain ¶
type SecTrustSettingsDomain int32
const ( SecTrustSettingsDomainUser SecTrustSettingsDomain = iota SecTrustSettingsDomainAdmin SecTrustSettingsDomainSystem )
type SecTrustSettingsResult ¶
type SecTrustSettingsResult int32
const ( SecTrustSettingsResultInvalid SecTrustSettingsResult = iota SecTrustSettingsResultTrustRoot SecTrustSettingsResultTrustAsRoot SecTrustSettingsResultDeny SecTrustSettingsResultUnspecified )