Skip to content

Commit f6e9a01

Browse files
committed
Added WIP JPAK 2.0 Extended Mode Documentation
1 parent abc5282 commit f6e9a01

5 files changed

Lines changed: 118 additions & 39 deletions

File tree

cpp/.cproject

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
2+
<?fileVersion 4.0.0?>
3+
4+
<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
35
<storageModule moduleId="org.eclipse.cdt.core.settings">
46
<cconfiguration id="cdt.managedbuild.config.gnu.cross.so.debug.320805835">
57
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.so.debug.320805835" moduleId="org.eclipse.cdt.core.settings" name="Debug">
68
<externalSettings>
79
<externalSetting>
810
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/libjpak"/>
911
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/libjpak/Debug"/>
10-
<entry flags="RESOLVED" kind="libraryFile" name="libjpak" srcPrefixMapping="" srcRootPath=""/>
12+
<entry flags="RESOLVED" kind="libraryFile" name="libjpak"/>
1113
</externalSetting>
1214
</externalSettings>
1315
<extensions>
@@ -17,44 +19,16 @@
1719
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
1820
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
1921
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
22+
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
23+
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
2024
</extensions>
2125
</storageModule>
2226
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
23-
<configuration artifactExtension="so" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.so.debug.320805835" name="Debug" parent="cdt.managedbuild.config.gnu.cross.so.debug">
27+
<configuration artifactExtension="so" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.so.debug.320805835" name="Debug" parent="cdt.managedbuild.config.gnu.cross.so.debug.320805835">
2428
<folderInfo id="cdt.managedbuild.config.gnu.cross.so.debug.320805835." name="/" resourcePath="">
25-
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.so.debug.513679468" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.so.debug">
26-
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2101776554" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
27-
<builder buildPath="${workspace_loc:/libjpak}/Debug" id="cdt.managedbuild.builder.gnu.cross.1203055334" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
28-
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1835160734" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
29-
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1044706102" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
30-
<option id="gnu.c.compiler.option.debugging.level.1073835195" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
31-
<option id="gnu.c.compiler.option.misc.pic.431893111" name="Position Independent Code (-fPIC)" superClass="gnu.c.compiler.option.misc.pic" value="true" valueType="boolean"/>
32-
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.263984192" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
33-
</tool>
34-
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.83800803" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
35-
<option id="gnu.cpp.compiler.option.optimization.level.1248909425" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
36-
<option id="gnu.cpp.compiler.option.debugging.level.657901764" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
37-
<option id="gnu.cpp.compiler.option.other.pic.765880724" name="Position Independent Code (-fPIC)" superClass="gnu.cpp.compiler.option.other.pic" value="true" valueType="boolean"/>
38-
<option id="gnu.cpp.compiler.option.other.other.2018074473" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0 -std=c++11" valueType="string"/>
39-
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1757886321" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
40-
</tool>
41-
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.248135629" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
42-
<option defaultValue="true" id="gnu.c.link.option.shared.1111004342" name="Shared (-shared)" superClass="gnu.c.link.option.shared" valueType="boolean"/>
43-
</tool>
44-
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.660083193" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
45-
<option defaultValue="true" id="gnu.cpp.link.option.shared.2089636387" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" valueType="boolean"/>
46-
<option id="gnu.cpp.link.option.libs.801443669" superClass="gnu.cpp.link.option.libs" valueType="libs">
47-
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="jsoncpp"/>
48-
</option>
49-
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1093083765" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
50-
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
51-
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
52-
</inputType>
53-
</tool>
54-
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.491489298" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
55-
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.1961334102" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
56-
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.242247632" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
57-
</tool>
29+
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.so.debug.513679468" name="Cross GCC">
30+
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.2101776554" isAbstract="false" osList="all"/>
31+
<builder buildPath="${workspace_loc:/libjpak}/Debug" id="cdt.managedbuild.builder.gnu.cross.1203055334" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder"/>
5832
</toolChain>
5933
</folderInfo>
6034
</configuration>
@@ -67,7 +41,7 @@
6741
<externalSetting>
6842
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/libjpak"/>
6943
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/libjpak/Release"/>
70-
<entry flags="RESOLVED" kind="libraryFile" name="libjpak" srcPrefixMapping="" srcRootPath=""/>
44+
<entry flags="RESOLVED" kind="libraryFile" name="libjpak"/>
7145
</externalSetting>
7246
</externalSettings>
7347
<extensions>
@@ -77,6 +51,8 @@
7751
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
7852
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
7953
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
54+
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
55+
<extension id="org.eclipse.cdt.core.MakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
8056
</extensions>
8157
</storageModule>
8258
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
@@ -117,7 +93,7 @@
11793
</cconfiguration>
11894
</storageModule>
11995
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
120-
<project id="libjpak.cdt.managedbuild.target.gnu.cross.so.1160724346" name="Shared Library" projectType="cdt.managedbuild.target.gnu.cross.so"/>
96+
<project id="libjpak.cdt.managedbuild.target.gnu.cross.so.1160724346" name="Shared Library"/>
12197
</storageModule>
12298
<storageModule moduleId="scannerConfiguration">
12399
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>

cpp/.project

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,50 @@
99
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
1010
<triggers>clean,full,incremental,</triggers>
1111
<arguments>
12+
<dictionary>
13+
<key>?name?</key>
14+
<value></value>
15+
</dictionary>
16+
<dictionary>
17+
<key>org.eclipse.cdt.make.core.append_environment</key>
18+
<value>true</value>
19+
</dictionary>
20+
<dictionary>
21+
<key>org.eclipse.cdt.make.core.buildArguments</key>
22+
<value></value>
23+
</dictionary>
24+
<dictionary>
25+
<key>org.eclipse.cdt.make.core.buildCommand</key>
26+
<value>make</value>
27+
</dictionary>
28+
<dictionary>
29+
<key>org.eclipse.cdt.make.core.buildLocation</key>
30+
<value>${workspace_loc:/libjpak}/Debug</value>
31+
</dictionary>
32+
<dictionary>
33+
<key>org.eclipse.cdt.make.core.contents</key>
34+
<value>org.eclipse.cdt.make.core.activeConfigSettings</value>
35+
</dictionary>
36+
<dictionary>
37+
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
38+
<value>false</value>
39+
</dictionary>
40+
<dictionary>
41+
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
42+
<value>true</value>
43+
</dictionary>
44+
<dictionary>
45+
<key>org.eclipse.cdt.make.core.enableFullBuild</key>
46+
<value>true</value>
47+
</dictionary>
48+
<dictionary>
49+
<key>org.eclipse.cdt.make.core.stopOnError</key>
50+
<value>true</value>
51+
</dictionary>
52+
<dictionary>
53+
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
54+
<value>false</value>
55+
</dictionary>
1256
</arguments>
1357
</buildCommand>
1458
<buildCommand>

doc/JPAK2/Extended Mode/README.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,59 @@
1-
TODO
1+
_ ____ _ _ __ ____ ___
2+
| | _ \ / \ | |/ / __ _|___ \ / _ \
3+
_ | | |_) / _ \ | ' / \ \ / / __) || | | |
4+
| |_| | __/ ___ \| . \ \ V / / __/ | |_| |
5+
\___/|_| /_/ \_\_|\_\ \_/ |_____(_)___/
6+
7+
_____ _ _ _
8+
| ____|_ _| |_ ___ _ __ __| | ___ __| |
9+
| _| \ \/ / __/ _ \ '_ \ / _` |/ _ \/ _` |
10+
| |___ > <| || __/ | | | (_| | __/ (_| |
11+
|_____/_/\_\\__\___|_| |_|\__,_|\___|\__,_|
12+
13+
Multiuse Javascript Package
14+
By: Lucas Teske
15+
https://github.com/racerxdl/jpak
16+
17+
#JPAK v2.0 Extended Mode
18+
19+
##### 1.0 Filesystem Specification
20+
The Extended Mode of JPAK is consisted of two new JPAK Format files: a **JDS** (JPAK Data Storage) and **JMS** (JPAK Meta Storage). The JPAK Data Storage is consisted about raw (or encrypted/compressed) data described by a JMS file. The struct is as follow:
21+
22+
| START | END | Description |
23+
| --------- | --------- | --------------------------------- |
24+
| 0x0 | 0x4 | JDS1 Magic Number |
25+
| 0x4 | 0xC | Padding (0x00) |
26+
| 0xC | 0xY | Start of Files Data |
27+
28+
The JPAK Meta Storage is similar to JPAK Filetable Structure, but aditionally has a volume list (JDK) for acessing the data storage. It has the follwing struct:
29+
30+
| START | END | Description |
31+
| --------- | --------- | ------------------------------------------------- |
32+
| 0x0 | 0x4 | JMS1 Magic Number |
33+
| 0x4 | 0xC | Padding (0x00) |
34+
| 0x**V** | 0x**U** | JSON Volume Table |
35+
| 0x**U** | 0x**W** | JSON File Table |
36+
| 0x**W** | 0x**X** | `uint32_t` Producer ID (Look JPAK2.0 spec at 2.1) |
37+
| 0x**X** | 0x**Y** | `uint32_t` JPAK Flags (Look JPAK2.0 spec at 2.1) |
38+
| 0x**Y** | 0x**Z** | `uint32_t` User Flags (Look JPAK2.0 spec at 2.1) |
39+
| 0x**Z** | `END` | `uint32_t` JSON FileTable Offset |
40+
41+
The JSON Filetable is the same, the offset is relative to the first volume. The JSON Volume Table is as follow:
42+
43+
{
44+
"0" : {
45+
"filename" : "vol0.jds", // Volume Filename
46+
"start" : "0", // Start of volume in Bytes
47+
"end" : "1024", // End of volume in Bytes
48+
},
49+
"1" : {
50+
"filename" : "vol1.jds", // Volume Filename
51+
"start" : "1024", // Start of volume in Bytes
52+
"end" : "4096", // End of volume in Bytes
53+
}
54+
}
55+
56+
##### 2.0 File Sharing
57+
58+
The JPAK 2.0 Extended Mode supports file sharing across users keeping the same JPAK Data Storage file. This allows to save space and allows to share it across Cloud Storage accounts. For using the File Sharing mode the full key support must be enabled (Directory Key and File Key set for every file). This allows the owner to selective share only few files/directories with someone. To do so, the `owner` must decrypt is own file, wipe the keys of directories or files he doesn't want to share (set them to **TRUE**), and send to the client. The `client` itself should reencrypt the `Meta Storage` with his own `Master Key` and store it on its personal cloud/storage. Then the `owner` shares the Data Storage with that customer. So when a JPAK Reader reads the extended mode jpak, when it encounters a directory/file with the key set to boolean **TRUE** it will know its encrypted but it doesnt have the key, so it will give access denied.
59+

tools/jpaktool.pyc

-2.88 KB
Binary file not shown.

tools/unpacker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
mkdir(os.path.splitext(os.path.basename(packfile))[0] + "/")
2222
volume = open(packfile, "rb")
2323
filetable = GetFileTable(volume)
24+
print filetable
2425
ProcessFolder(filetable, volume, "")
2526
volume.close()
2627
else:

0 commit comments

Comments
 (0)