Windows version of offline decryption (HFODU)

#1
As mentioned on the beta offline decryption thread https://hummy.tv/forum/threads/offline-decryption-utility.8676/ I was looking into a windows version of a decryption only utility. I have had this working for a while now but haven't got around to writing up the full help.
The problem is I have written the program in Java which requires the end user to have a working recent version of Java runtime. I haven't pulled together the information to allow users to have a portable version of the runtime so that you don't have to install Java with all the associated update and extra bloat.
Given that this might take a while, for those who want to give the program a try, have Java installed, I'm uploading a zip file containing the jar file that needs to be run. Unzip to your preferred directory and then open a command window at the same directory. Type java -jar HFODU.jar at the command line and the program should run (you could use javaw rather than java). If this doesn't work the Java bin directory may not be on your PATH. I intend to add further information in later posts.
If you get the program running, you will need enter your MAC and serial number (see original thread for details) - use the Change button. Then use the Open button to select a Humax .ts file (prefereably copied to the same directory the jar file is in). The file should be an encrypted .ts file probably transferred from a FOX-T2 to a PC via ftp. The "output" box can be edited if you don't like the default decrypted filename. If the file is recognised, the Decrypt button will be enabled. Hopefully this will decrypt the file. If the .hmt file exists it will be copied and edited. .nts and .thm will also be copied if they exist. They won't be created if they don't.
This is not even a beta test. It is probably an alpha test! I have only tested it on one file, provided by af123. If it works for you, fine. If it doesn't, I shall look a pillock and we'll be back to square one with the Windows version.

(The original zip file has been deleted)
A revised version appears at post #8
Edit: 31 August 2018
The most recent version that processes files individually is in post #20.
A new version that allows multiple files to be selected is in post #55.
 
Last edited:
OP
OP
EEPhil

EEPhil

Number 28
#2
To run this Java program you need a working Java runtime environment on your computer. It also needs to version 1.8 or later. I've tested it with V1.8.0_151. If you need to install or update you could go to the Oracle website and download a new version. You may not want to do this as installing Java this way seems to want to install an update program which is a pain (to me at least - so I delete the update program).

www.raymond.cc said:
Although the Java Runtime Environment (JRE) package requires installation and there is no official portable version, it is still possible to run applets and applications without installing Java into Windows. An unofficial portable version from PortableApps.com allows you to copy Java to your USB flash drive or hard drive folder and run it from there. Here’s a guide on how to do that.
1. First insert a USB flash drive into your computer. For this example the letter of our USB flash drive is the F: drive. Obviously substitute F: for your own drive letter.

2. Download Java Portable from PortableApps.com. Once finished downloading, run the downloaded executable file and click OK -> Next -> I Agree and then you’re asked to choose an install location. By default the destination folder will show {path}\CommonFiles\Java, add F: at the front so that it becomes F:\CommonFiles\Java and click the Install button.
You don't need to put it on a flash drive. Any directory on your disk will do.
This normally works although in trying it out for this documentation I had problems with the connection to Oracle being refused!
 
Last edited:
OP
OP
EEPhil

EEPhil

Number 28
#3
A more complicated alternative for a portable version is this.
First download the 7z archiver https://www.7-zip.org/
Goto the Oracle website and download the full runtime for your version of windows (about 60MB GB for jre-8u171-windows-i586.exe).[Thanks to prpr for spotting the mistake!]
Use 7z to open the exe file. Find Data1.cab and double-click on that. This will give you a file installerexe. Double click on that and you get the Java runtime directories. Create a directory Java wherever you want to store the runtime and then drag the contents of the 7z runtime to the Java directory. Unfortunately you are not done yet.
From http://superuser.com/questions/745112/how-do-i-run-a-jar-file-without-installing-java you need to:
lpacheco said:
go into [the Java directory] and run [in a command window] for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar;
try running bin/java -version.
If it works, thats it, you have got yourself a portable JAVA_HOME.

Whatever method you use you need to locate javaw.exe which is in the \bin directory of the Java installation. If it is properly installed in you system you should be able to open a command window and type javaw and get a sensible response. (I can't!). If you can then opening a command window, setting the directory to the one where you have saved HFODU.jar and typing javaw -jar HFODU.jar should run the program.

In windows XP it is possible to click on the jar file and run it as an executable file. This is what I do. It makes a jar file behave as though it was a normal Windows executable and saves a lot of messing about!
To do this, in Explorer, goto Tools | Folder Options | File Types
See if jar is a registered file type, if not use "new" to add it.
Examine the entry for jar. Click Advanced button, and check for Actions. If open doesn't exist use new to add it.
The 'Application to perform action' needs to be of the form:
"C:\Program Files\Java\jre1.8.0_151\bin\javaw.exe" -jar "%1" %*
where this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs to be your path to javaw and must be in quotes.

I hope there is a similar way to make jar files executable in other forms of windows.
If not, to make life easier, you will need a command file of some sort with contents:
"C:\Program Files\Java\jre1.8.0_151\bin\javaw.exe" -jar HFODU.jar
where the file name in quotes is your path to the javaw.exe file (not mine).
 
Last edited:

everthewatcher

Forum Supporter
#4
Currently recording something to test this on - anything recorded before 11pm yesterday is already done.

Edit: Done and being decrypted as I type. Just to see how robust it is I left the target .ts file on the machine and set it to write the decrypted file back there. Seems to be quite happy although slow - something like 3 times the file run time.

Edit 2: Exited with "ERROR DBG: decryptPacket Read error". Trying again with the target file in the .jar directory etc.

Edit 3: A lot faster - say 1/10th file run time and 50% CPU, but exited with the same error message.

Edit 4: It writes the output file but then deletes it when the error message comes up. I'll wait for you to come back.

Edit 5: If I grab a partial copy of the output file mid-decryption it plays OK in MPC so the decryption etc. works fine.
 
Last edited:
OP
OP
EEPhil

EEPhil

Number 28
#6
Hmm. Sorry, I'm a bit slow. I only come back here occasionally and I'm not alerted when messages arrive - my choice.
The error could to be a problem with the end of file. I think I'll remove the "delete the file when error occurs option" and leave the user to tidy up instead! (at least as a first repair). I have the problem that I cannot fully test this myself as I don't have a FOX T2 and the 2000T doesn't like the way of forming the decryption keys.
Can't do anything about the run speed unfortunately.
If you are running the program once, then open a new input file and try again it is likely to be faster. Allegedly, Java optimises itself when running!

I need to disconnect from internet, have a think and possibly update the program later (today?). The weather, rather than the football, may interfere with my productivity!
 

everthewatcher

Forum Supporter
#7
Hmm. Sorry, I'm a bit slow. I only come back here occasionally and I'm not alerted when messages arrive - my choice.
No problem. I did wonder if you'd just seen my original post and not the subsequent edits so were waiting for me to post again.

The error could to be a problem with the end of file. I think I'll remove the "delete the file when error occurs option" and leave the user to tidy up instead! (at least as a first repair).
That should be good enough for the number of times this is going to be needed. Well done BTW.

I have the problem that I cannot fully test this myself as I don't have a FOX T2 and the 2000T doesn't like the way of forming the decryption keys.
Understood.

Can't do anything about the run speed unfortunately...
My fault for doing the first run over the network with the target and output files on the Humax. The speed with them local is 30x better and more than fast enough - my use of '1/10th' may have confused. At around 50% CPU utilisation on this machine it's probably as fast as it's going to be.

The weather, rather than the football, may interfere with my productivity!
Same here...
 
OP
OP
EEPhil

EEPhil

Number 28
#8
This is a revised version taking into account the problems identified above.
This version has a better test for the end of input file, so shouldn't throw a wobbly in the first place. But, if it does, it doesn't tidy up after itself and may leave output file(s) which may or may not be usable. Not ideal.
I've had second thoughts about the speed - it might be possible to do something about it - but maybe not yet.
The speed with them local is 30x better and more than fast enough
I have similar problems downloading files to an external USB drive or the local disk. Network usage of 10% external (slooooow) or 60% local.
 

Attachments

#10
This version has a better test for the end of input file, so shouldn't throw a wobbly in the first place.
Works perfectly on the test file, ending with a reassuring 'The file was decrypted successfully'. I'll try it on a few more files once I've got some the box hasn't already decrypted.

A microquibble could be that it doesn't prompt before overwriting an output file, but TBH I don't see this justifies any effort being expended on it..

Once again well done.
 
OP
OP
EEPhil

EEPhil

Number 28
#14
I assume that means HiDef decrypts properly. I was unable to test this. But going on how af123 did this on the other thread I hoped it would.
 
#16
Looking good, thanks!
However I have one question / possible update request (sorry!) I have changed the encryption key on my box to all zeroes, because it apparently makes decryption a little quicker and I could also easily do the same on my HD-Fox so it can read the unencrypted files. I had thought that setting the MAC and serial number to zero would give the correct behaviour but it fails to decrypt. Could you make the program allow direct entry of the encryption key - or, probably more easily, remind me of the exact algorithm to get from one to the other, so I can figure out what MAC and serial number to put in?
 

Black Hole

May contain traces of nut
#17
remind me of the exact algorithm to get from one to the other, so I can figure out what MAC and serial number to put in?
I don't recall this having been explained previously, it was just assumed the reader would spot how they correspond. I would like to know too.
 

af123

Administrator
Staff member
#18
I don't recall this having been explained previously, it was just assumed the reader would spot how they correspond. I would like to know too.
As I said in https://hummy.tv/forum/threads/offline-decryption-utility.8676/post-122090, it it's the box MAC address + the first 10 digits of the serial number.

So if the MAC address is 00:03:78:01:02:f3 and the serial number is 0123456789..., then the resulting encryption key is, in hexadecimal:

00 03 78 01 02 f3 30 31 32 33 34 35 36 37 38 39

I suspect that an all zeros key is hard to enter into the Windows version; one simple solution would be to set the key to all 3s then just enter the MAC address as 33:33:33:33:33:33 and the serial number as 3333333333. This happens to work because the ASCII code for the digit '3' is 33 in hex.
 
OP
OP
EEPhil

EEPhil

Number 28
#19
I don't know why there should be a problem entering all zeros into the program under discussion.
Oh, hang on. By all zero's you DON'T mean that the serial number is zero (*10) do you? You mean that the key is 24 bytes of 00.
I might be able to make this happen if you really want it. :)
 
OP
OP
EEPhil

EEPhil

Number 28
#20
Yes. The "problem" is that I expected anyone who was changing the key in their Humax would not need a Windows version of decryption. As in - you have CF why would you be decrypting off the box in Windows?
I designed the program to only allow hex digits for the MAC and 0-9 (ASCII 30-39) for the serial number - not expecting the all zeros!
I am uploading (yet) another version which now allows you to have an all zero key. Press the Change button and tick the use zero key box. This is a special case - I don't think I'll be adding in a facility for entering any other non-standard key!
I've also taken the opportunity to add in an option to overwrite existing files or produce a new generation of the file (ie. a.ts, a(1).ts, a(2).ts etc.). Use the Edit menu to tick/untick the Overwrite Files option. I also changed the behaviour of the program back to the original "delete files on error". But, you will see another tick/untick option on the Edit menu "Tidy on error" which allows you to turn off this feature.
 

Attachments

Top