summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-11-18 19:49:49 -0500
committerJakob Kaivo <jkk@ung.org>2020-11-18 19:49:49 -0500
commitfba801355bd8c4d7d57dadfa29362809a5a87b7f (patch)
tree6f58df6def82b5bb0d1dfab180aacf7a513a55cf /README.md
parent78d6a052fc6431ad45ff3a24461fd7744a3c1c28 (diff)
implement decryptiondeonebook
adjust command-line to require no file names or exactly two, input and output remove -G and -R options specify device with -d option specify key (in hex) if necessary with -k option better warnings and errors throughout
Diffstat (limited to 'README.md')
-rw-r--r--README.md65
1 files changed, 35 insertions, 30 deletions
diff --git a/README.md b/README.md
index f2ca53d..7d5509c 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,11 @@
DeOneBook
---------
-This program extracts encryption keys from eOneBook SD cards. Eventually I will
-add decryption as well, but for now it is enough to extract a key that can be
-used passed to `openssl` to do the actual decryption.
+This program is designed to decrypt the contents of eOneBook SD cards. It is
+able to extract the encryption keys from SD cards to make this automatic with
+the proper hardware. Without hardware support, decryption is a two-step
+process, extracting a key using the eOneBook itself, and decryption using that
+key.
Building
--------
@@ -25,22 +27,29 @@ Then build with the cross compiler:
make CC=arm-linux-gnueabihf-gcc
-Use
----
+Automatic Decryption
+--------------------
-If you are using the native version, simply place an eOneBook SD card in your
-SD card reader, and run:
+If your system has a directly connected SD card reader, you can decrypt files
+with:
- ./deonebook -G [devicename]
+ deonebook [-d devicename] <input-file> <output-file>
-Here, `devicename` is optional, and will default to `mmcblk0`. If your SD card
-has a different device name, specify it there. The encryption key will be
-presented in hexadecimal.
+The default device is `mmcblk0`. If your SD card reader is something else
+(n.b. it *must* be an `mmcblk` device), specify that via the `-d` option.
+Replace <input-file> with the path to an encrypted file (e.g.
+`/media/sd/001/100E`) and <output-file> with the path to place the newly
+decrypted file. DeOneBook will determine the encryption key by reading
+information directly from the SD card.
-For the eOneBook version, it's a little more complex. You'll need to prep the
-SD card to execute the program and save its output. First, make sure the SD
-card is not write-protected by moving the write-protect slider to the end of
-its slot nearest the pins of the card. Mount the SD card somewhere you can
+On-device Key Extraction
+------------------------
+
+If your system does not have a directly connected SD card reader, you can
+use your eOneBook device to extract the encryption key. You'll need to prep
+the SD card to execute the program and save its output. First, make sure the
+SD card is not write-protected by moving the write-protect slider to the end
+of its slot nearest the pins of the card. Mount the SD card somewhere you can
write to it, `cd` to that mount point, and run the following commands,
replacing `$DEONEBOOKDIR` with the path to the compiled DeOneBook.
@@ -52,25 +61,21 @@ before attempting this.***
mv .A001 eonebook # rename the official firmware
cp $DEONEBOOKDIR/deonebook . # copy over the key extractor
cp $DEONEBOOKDIR/extract.sh .A001 # copy over the extraction script
+ chmod +x deonebook .A001 # ensure deonebook files are executable
Put the SD card in your eOneBook and open it up. When the official interface
comes up, the key extraction is complete. Close the eOneBook and there will be
-a file called `eonebook.hex` containing the encryption key for that card.
-
-Decrypting
-----------
+a file called `eonebook.key` containing the encryption key for that card.
-Eventually this will be integrated into DeOneBook itself. For now, you can use
-the extracted key along with `openssl` to decrypt files. Replace `$KEY` with
-the hex key, either as printed with the native version or the contents of
-`eonebook.hex` from the cross-compiled version. Replace `$INFILE` with the name
-of an encrypted image (e.g. `002E`), and `$OUTFILE` with a path where you want
-the decrypted image to go:
+Manual Decryption
+-----------------
- openssl aes-128-cbc -d -iv 03030303030303030303030303030303 -K $KEY -in $INFILE -out $OUTFILE
+Once you have extraced the key using your eOneBook, you can use that key to
+manually decrypt that SD card's files. Run:
-You can do a whole directory with something like:
+ deonebook -k $KEY <input-file> <output-file>
- for i in *E; do
- openssl aes-128-cbc -d -iv 03030303030303030303030303030303 -K $KEY -in $i -out $i.gray
- done
+Replace `$KEY` with the contents of `eonebook.key` from the previous step (you
+could also simply replace it with `$(cat eonebook.key)`). Replace <input-file>
+with the path to an encrypted file, and <output-file> with the path for the
+newly decrypted file.