Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Add SecurityInfo struct and make it part of Responses.
Browse files Browse the repository at this point in the history
Add Tests and test fixtures for SecurityInfo responses.
  • Loading branch information
mosen committed Jun 25, 2016
1 parent 3848d52 commit e185c23
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
13 changes: 13 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Response struct {
CommandUUID string
RequestType string `json:"request_type,omitempty" plist:",omitempty"`
QueryResponses QueryResponses `json:"query_responses,omitempty" plist:",omitempty"`
SecurityInfo SecurityInfo `json:"security_info,omitempty" plist:",omitempty"`
}

// CommonQueryResponses has a list of query responses common to all device types
Expand Down Expand Up @@ -108,3 +109,15 @@ type QueryResponses struct {
IosQueryResponses
AtvQueryResponses
}

// SecurityInfo is the SecurityInfo MDM Command Response
type SecurityInfo struct {
FDEEnabled bool `json:"fde_enabled,omitempty"` // OSX
FDEHasPersonalRecoveryKey bool `json:"fde_has_personal_recovery_key,omitempty"`
FDEHasInstitutionalRecoveryKey bool `json:"fde_has_institutional_recovery_key,omitempty"`

HardwareEncryptionCaps int `json:"hardware_encryption_caps,omitempty"` // iOS
PasscodeCompliant bool `json:"passcode_compliant,omitempty"`
PasscodeCompliantWithProfiles bool `json:"passcode_compliant_with_profiles,omitempty"`
PasscodePresent bool `json:"passcode_present,omitempty"`
}
65 changes: 65 additions & 0 deletions response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,51 @@ var (
<key>UDID</key>
<string>1111111111111111111111111111111111111112</string>
</dict>
</plist>`

macOSElCapSecurityInfoNoFDE = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CommandUUID</key>
<string>1111111111111111111111111111111111111111</string>
<key>RequestType</key>
<string>SecurityInfo</string>
<key>SecurityInfo</key>
<dict>
<key>FDE_Enabled</key>
<false/>
</dict>
<key>Status</key>
<string>Acknowledged</string>
<key>UDID</key>
<string>1111111111111111111111111111111111111111</string>
</dict>
</plist>
`

ios8IpadSecurityInfo = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CommandUUID</key>
<string>1111111111111111111111111111111111111112</string>
<key>SecurityInfo</key>
<dict>
<key>HardwareEncryptionCaps</key>
<integer>3</integer>
<key>PasscodeCompliant</key>
<true/>
<key>PasscodeCompliantWithProfiles</key>
<true/>
<key>PasscodePresent</key>
<false/>
</dict>
<key>Status</key>
<string>Acknowledged</string>
<key>UDID</key>
<string>1111111111111111111111111111111111111112</string>
</dict>
</plist>`
)

Expand Down Expand Up @@ -1006,3 +1051,23 @@ func TestQueryResponseIphoneIOS8(t *testing.T) {
t.Fatal(err)
}
}

func TestSecurityInfoMac(t *testing.T) {
response := &Response{}
plistBuf := []byte(macOSElCapSecurityInfoNoFDE)
err := plist.Unmarshal(plistBuf, response)

if err != nil {
t.Fatal(err)
}
}

func TestSecurityInfoIpadIOS8(t *testing.T) {
response := &Response{}
plistBuf := []byte(ios8IpadSecurityInfo)
err := plist.Unmarshal(plistBuf, response)

if err != nil {
t.Fatal(err)
}
}

0 comments on commit e185c23

Please sign in to comment.