Documentation ¶
Index ¶
Constants ¶
const DeviceInfoHeader = "x-apple-aspen-deviceinfo"
Variables ¶
var ( ErrEmptyHeader = errors.New("empty header") ErrNotSigned = errors.New("not signed") ErrCertRootNotFound = errors.New("certificate root not found") )
var AppleRootCert = newAppleRootCert()
AppleRootCert is Apple's Root CA parsed to an *x509.Certificate
var DefaultParser = NewParser(WithVerify(true))
Functions ¶
This section is empty.
Types ¶
type InvalidHeaderError ¶
type InvalidHeaderError struct {
Err error
}
func (*InvalidHeaderError) Error ¶
func (e *InvalidHeaderError) Error() string
func (*InvalidHeaderError) Unwrap ¶
func (e *InvalidHeaderError) Unwrap() error
type MachineInfo ¶
type MachineInfo struct { IMEI string `plist:"IMEI,omitempty"` Language string `plist:"LANGUAGE,omitempty"` MEID string `plist:"MEID,omitempty"` Product string `plist:"PRODUCT"` Serial string `plist:"SERIAL"` UDID string `plist:"UDID"` Version string `plist:"VERSION"` // VerifyContext is optionally populated by VerifyFuncs set on the Parser. // Parser.Parse guarantees VerifyContext to be non-nil VerifyContext Context `plist:"-"` }
MachineInfo is a device's information sent as part of an MDM enrollment profile request
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parses the x-apple-aspen-deviceinfo header from requests sent to the configuration_web_url as part of the Authenticating Through Web Views enrollment process
func NewParser ¶
func NewParser(opts ...ParserOption) *Parser
type ParserOption ¶
type ParserOption func(p *Parser)
func WithVerify ¶
func WithVerify(verify bool) ParserOption
WithVerify configures the parser to verify the signature against the Apple Root CA if verify is true
func WithVerifyFunc ¶
func WithVerifyFunc(f VerifyFunc) ParserOption
WithVerifyFunc configures the parser with a custom verify function that is run after other verifications take place. Multiple VerifyFuncs can be used, and they're executed in the order they're configured. If f returns an error, verification fails when Parse is called, and the error is returned. See VerifyFunc for more information
type VerifyFunc ¶
VerifyFunc is used to add additional verification of the initial device request. The original request, r, verified PKCS7 header, p7, and additional context, ctx are passed to the function. ctx is passed through the chain of VerifyFuncs, with the final result being added to the *MachineInfo returned by the parser. ctx should not be modified outside of the scope of the function.