forked from rebolsource/r3
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into crypt
- Loading branch information
Showing
6 changed files
with
293 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
REBOL [ | ||
name: plist | ||
type: module | ||
options: [delay] | ||
version: 1.0.0 | ||
title: "PLIST codec" | ||
file: https://raw.githubusercontent.com/Oldes/Rebol3/master/src/mezz/codec-plist.reb | ||
author: "Oldes" | ||
history: [ | ||
07-Apr-2022 "Oldes" {Initial version of the PLIST and Provisioning Profile decoder} | ||
] | ||
references: [ | ||
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/Introduction/Introduction.html | ||
https://medium.com/@karaiskc/understanding-apples-binary-property-list-format-281e6da00dbd | ||
] | ||
todo: { | ||
* Support binary PLIST version | ||
* PLIST encoder | ||
* Provision profile data validation? | ||
} | ||
] | ||
|
||
system/options/log/plist: 1 | ||
|
||
stack: copy [] | ||
key: value: none | ||
|
||
~spnl: system/catalog/bitsets/whitespace | ||
|
||
~dict: [ | ||
any ~spnl | ||
<dict> | ||
( | ||
append append stack :key make map! 8 | ||
) | ||
any [ | ||
~key | ||
~value | ||
( | ||
put last stack :key :value | ||
) | ||
| any ~spnl | ||
] | ||
any ~comment | ||
</dict> | ||
( | ||
value: take/last stack | ||
key: take/last stack | ||
) | ||
] | ||
~key: [<key> any ~spnl copy key: to </key> thru #">" (try [key: to word! key])] | ||
~string: [<string> any ~spnl copy value: to </string> thru #">" ] | ||
~data: [<data> any ~spnl copy value: to </data> thru #">" (value: debase value 64)] | ||
~date: [<date> any ~spnl copy value: to </date> thru #">" (value: to-date value)] | ||
~integer: [<integer> any ~spnl copy value: to </integer> thru #">" (value: to integer! value)] | ||
~real: [<real> any ~spnl copy value: to </real> thru #">" (value: to decimal! value)] | ||
~true: [<true/> (value: true )] | ||
~false: [<false/> (value: false)] | ||
~array: [ | ||
<array> | ||
(append/only stack copy []) | ||
any [~value (append/only last stack :value) any ~spnl] | ||
</array> | ||
(value: take/last stack) | ||
] | ||
~comment: [any ~spnl opt ["<!--" thru "-->"]] | ||
|
||
~value: [ | ||
any ~comment [ | ||
~string | ||
| ~true | ||
| ~false | ||
| ~array | ||
| ~dict | ||
| ~date | ||
| ~data | ||
| ~integer | ||
| ~real | ||
] | ||
] | ||
|
||
register-codec [ | ||
name: 'plist | ||
type: 'text | ||
title: "Property List File Format" | ||
suffixes: [%.plist] | ||
|
||
decode: function [ | ||
{Extract content of the PLIST file} | ||
data [binary! file! url!] | ||
;return: [map!] | ||
] [ | ||
verbose: system/options/log/plist | ||
unless binary? data [ data: read data ] | ||
if verbose > 0 [ | ||
sys/log/info 'PLIST ["^[[1;32mDecode PLIST data^[[m (^[[1m" length? data "^[[mbytes )"] | ||
] | ||
unless parse to string! data [ | ||
thru "<plist " thru #">" | ||
~dict | ||
any ~comment | ||
</plist> | ||
to end | ||
][ return none ] | ||
|
||
if verbose: system/options/log/plist > 0 [ | ||
foreach [k v] value [ | ||
switch to word! k [ | ||
DeveloperCertificates [ | ||
v: copy v | ||
forall v [ | ||
try [ | ||
crt: codecs/crt/decode v/1 | ||
change/only v compose [ | ||
commonName: (crt/subject/commonName) | ||
valid-to: (crt/valid-to) | ||
fingerprint: (select crt 'fingerprint) | ||
] | ||
] | ||
] | ||
] | ||
DER-Encoded-Profile [ | ||
sys/log/more 'PLIST ajoin [as-green k ": " mold v] | ||
continue | ||
] | ||
] | ||
sys/log 'PLIST ajoin [as-green k ": " mold v] | ||
] | ||
] | ||
|
||
value | ||
] | ||
|
||
;encode: function [data [binary!]][ ] | ||
|
||
identify: function [data [binary!]][ | ||
; just a simple test if there are key parts... | ||
parse data [ | ||
thru "<!DOCTYPE plist" | ||
thru "<plist " to end | ||
] | ||
] | ||
] | ||
|
||
register-codec [ | ||
name: 'provision | ||
type: 'cryptography | ||
title: "Apple's Provisioning Profile File Format" | ||
suffixes: [%.provisionprofile %.mobileprovision] | ||
|
||
decode: function [ | ||
{Extract PLIST data from a provision profile} | ||
data [binary! file! url!] | ||
;return: [map!] | ||
] [ | ||
unless binary? data [ data: read data ] | ||
|
||
der: codecs/der/decode data | ||
parse der [ | ||
'SEQUENCE into [ | ||
'OBJECT_IDENTIFIER #{2A864886F70D010702} 'CS0 into [ | ||
'SEQUENCE into [ | ||
'INTEGER set version: binary! | ||
'SET into [ | ||
'SEQUENCE into [ | ||
'OBJECT_IDENTIFIER set oid: binary! ( | ||
hash-alg: codecs/der/decode-oid oid | ||
) | ||
to end | ||
] | ||
] | ||
'SEQUENCE into [ | ||
'OBJECT_IDENTIFIER #{2A864886F70D010701} 'CS0 into [ | ||
'OCTET_STRING set plist: binary! | ||
] | ||
] | ||
; follows certificates used to sign the data.. | ||
; validation is not implemented! | ||
to end | ||
] | ||
to end | ||
] | ||
to end | ||
] | ||
] | ||
either binary? plist [ | ||
codecs/plist/decode plist | ||
][ none ] | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?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>AppIDName</key> | ||
<string>Test Application</string> | ||
<key>ApplicationIdentifierPrefix</key> | ||
<array> | ||
<string>XXXXXXXXXX</string> | ||
</array> | ||
<key>CreationDate</key> | ||
<date>2022-03-25T11:00:04Z</date> | ||
<key>Platform</key> | ||
<array> | ||
<string>OSX</string> | ||
</array> | ||
<key>IsXcodeManaged</key> | ||
<true/> | ||
<key>DeveloperCertificates</key> | ||
<array> | ||
<data>UGxhY2Vob2xkZXI=</data> | ||
<data>Q2VydGlmaWNhdGU=</data> | ||
</array> | ||
|
||
<key>DER-Encoded-Profile</key> | ||
<data>UGxhY2Vob2xkZXI=</data> | ||
|
||
<key>Entitlements</key> | ||
<dict> | ||
|
||
<key>com.apple.developer.arcade-operations</key> | ||
<true/> | ||
|
||
<key>com.apple.application-identifier</key> | ||
<string>XXXXXXXXXX.application.test</string> | ||
|
||
<key>keychain-access-groups</key> | ||
<array> | ||
<string>XXXXXXXXXX.*</string> | ||
</array> | ||
|
||
<key>com.apple.developer.team-identifier</key> | ||
<string>XXXXXXXXXX</string> | ||
|
||
<key>com.apple.developer.ubiquity-kvstore-identifier</key> | ||
<string>XXXXXXXXXX.*</string> | ||
|
||
<key>com.apple.developer.ubiquity-container-identifiers</key> | ||
<array> | ||
<string>XXXXXXXXXX.*</string> | ||
</array> | ||
|
||
</dict> | ||
<key>ExpirationDate</key> | ||
<date>2023-03-25T11:00:04Z</date> | ||
<key>Name</key> | ||
<string>Mac Team Provisioning Profile: application.test</string> | ||
<key>ProvisionedDevices</key> | ||
<array> | ||
<string>DA3279C7-4CA2-5F13-AD90-7FC271175118</string> | ||
<string>94FAF6E4-BE34-5B0B-9533-78B245EF4174</string> | ||
</array> | ||
<key>TeamIdentifier</key> | ||
<array> | ||
<string>XXXXXXXXXX</string> | ||
</array> | ||
<key>TeamName</key> | ||
<string>Some Company s.r.o.</string> | ||
<key>TimeToLive</key> | ||
<integer>365</integer> | ||
<key>UUID</key> | ||
<string>bba91992-3a72-46b3-bc5f-f7b59aa49236</string> | ||
<key>Version</key> | ||
<integer>1</integer> | ||
</dict> | ||
</plist> |