Skip to content

Structs and helpers for working with Apple Configuration Profiles in go

License

Notifications You must be signed in to change notification settings

vec715/cfgprofiles

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Structs and helpers for working with Apple Configuration Profiles in go.

Package cfgprofiles provides structs and helpers for working with Apple Configuration Profiles in go.

Go Reference

Note: marshaling and unmarshaling are dependent on the https://github.com/groob/plist package.

Example unmarshaling (parsing):

b, _ := ioutil.ReadFile("profile.mobileconfig")
p := &cfgprofiles.Profile{}
_ := plist.Unmarshal(b, p)
fmt.Println(p.PayloadIdentifier)
// returns: "com.my.profile.id"

Example marshaling:

p := cfgprofiles.NewProfile("com.my.profile.id")
pld := cfgprofiles.NewCertificatePKCS1Payload("com.my.profile.id.payload")
cert, _ := x509.ParseCertificate(certBytes)
pld.PayloadContent = cert.Raw
p.AddPayload(pld)
b, _ := plist.Marshal(p)
fmt.Println(string(b))
// returns "<?xml version="1.0" encod [...] <key>PayloadContent</key><data>MIIEPjCCAy [...]"

About

Structs and helpers for working with Apple Configuration Profiles in go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%