Key Files Directory file format?

The place to discuss Mac OS X version of MakeMKV
Post Reply
virtual1
Posts: 5
Joined: Sun Oct 25, 2009 1:47 am

Key Files Directory file format?

Post by virtual1 » Sun Oct 25, 2009 2:00 am

I have just finished a day's reading in a dozen of my blurays to hard drive and am ready to transcode them for my appletv. Every title I try to run MakeMKV on gives me an error it cannot find the title key.

After rummaging around on the internet I found several demos of similar software. One I downloaded was able to decrypt and give me a preview.

I was able to use the app to find a disc's volume ID as well as the title key but can't figure out how to tell MakeMKV to use this information. I see the option to change the "key files directory", but after an hour of looking around here and other places, I can find no documentation on the format it wants of the files in the directory.

My first guess was assuming the files should be the volume ID in its hex representation (16 bytes = 32 character filename), with no filename extension, and it should contain the volume key - 32 bytes as 64 hex characters, ending with a linfeed/cr. But this does not work and generates no errors in the log of MakeMKV so I don't know what I'm doing wrong. I'm going to try a little more experimentation and see what I can find. i found a post regarding command line use of the tool but the post looked a little confused, talking about the volume ID twice and never mentioning the key. (http://forum.doom9.org/archive/index.php/t-144611.html) All I really need is an example of one such file but I can't find one.

"Passing VID is arcane magic, at least until we release libdriveio sources under LGPL and that should happen quite soon. You can indeed pass the VID, but only if you are opening "files on hard drive", not ISO. If you only have ISO file then you can extract all files from it by cddump.exe tool that is part of MakeMKV package. Assuming you have blu-ray files in some folder, you need to create a binary file called "diskatt.dat" in that folder. The file size must be 24 bytes. The first 8 bytes must be 04 00 00 80 00 00 00 10 , the next 16 bytes must be binary VID. It all makes sense but is too long to explain why :) If you have original disc you can dump all disc attributes including VID using following command: "cddump.exe a DRIVEID d diskatt.dat" where DRIVEID is your single-digit drive number reported by "cddump.exe l" command."

This looks like its talking about the format of the file, but only the volume ID is mentioned, and I was expecting the file to contain the key so I don't know if I'm on the right track here or not. Maybe this just has to do with dumping basic disc information. I'm new to this.

virtual1
Posts: 5
Joined: Sun Oct 25, 2009 1:47 am

Re: Key Files Directory file format?

Post by virtual1 » Sun Oct 25, 2009 3:17 am

I've looked more at this and see that MakeMKV seems to be able to process some (but not all) of my blurays read off the drive. (Batman the Movie for example will not, this is a BD+ limitation?) Simpsons for example will and so will Narnia, but when I try to select them off the hard drive it says the volume ID cannot be found. So it's not a problem of the key not being found so much as the volume ID not being found?

Unexpectedly, I have to select one of the video files within the BDMV directory instead of selecting the entire volume folder. I made a diskatt.att file per previous instructions and put it in the BDVM folder but it doesn't seem to have had any effect, it still refuses to open:

Opening files on harddrive at /Volumes/Bluray3/Encrypted/simpsons/SIMPSONS_MOVIE/
The volume key is unknown for this disc - video can't be decrypted

And the middle button to begin the selection and conversion is not enabled. When selecting from hard drive it does not allow selection of a folder, are we supposed to just pick any .bdmv file we find inside anywhere? or just any file in the BDMV folder?

I think I got the volume id from the BD+ dump it just made, "dump_SIMPSONS_MOVIE_C1B6453418D28C3F", I assume that's the VID there (C1B6453418D28C3F)

I assume this is the correct file format:
localhost:~ user $ cat /Volumes/Bluray3/Encrypted/simpsons/SIMPSONS_MOVIE/BDMV/diskatt.dat | xxd
0000000: 0400 0080 0000 0010 4331 4236 3435 3334 ........C1B64534
0000010: 3138 4432 3843 3346 18D28C3F

I used another app to try to get the keys and it appears the correct key is "3E184CC47EC30BF0167B16D8A2B2212F" instead so I don't know if I'm off track here.

In case the latter was correct I also tried this which appears to be more correct. The instructions said the file length was supposed to be 24 (8+16) so the key needs to be 16 bytes. So that's 8 hex chars or 16 raw bytes. (tho the howto says "binary" which is clearly not right)

localhost:~ user $ cat /Volumes/Bluray3/Encrypted/simpsons/SIMPSONS_MOVIE/BDMV/diskatt.dat | xxd
0000000: 0400 0080 0000 0010 3e18 4cc4 7ec3 0bf0 ........>.L.~...
0000010: 167b 16d8 a2b2 212f .{....!/

I also tried moving the diskatt.dat file into the folder with the application, and also into my home folder but it doesn't have any effect. Where does it need to be?

mike admin
Posts: 3584
Joined: Wed Nov 26, 2008 2:26 am
Contact:

Re: Key Files Directory file format?

Post by mike admin » Mon Oct 26, 2009 8:23 am

It looks like your volume key is incorrect. To feed volume key to MakemKV create a file in "AACS key directory" containing the volume key in HEX format - as you correctly indicated "32 bytes as 64 hex characters". MakeMKV will scan all files in this directory and try all hex strings in all files to see if it is a valid key for the disc - it can do it very fast so no special file names and file formats are needed. If you can obtain the volume key (not the VID) for the disc, by all means just use it. MakeMKV does not need to know VID if VUK is known. If you still only have VID then let me check and I will clarify about file format and location.

virtual1
Posts: 5
Joined: Sun Oct 25, 2009 1:47 am

Re: Key Files Directory file format?

Post by virtual1 » Sun Nov 01, 2009 3:30 pm

I've found a way to obtain keys one at a time in most cases, but is there a file somewhere for download that contains the bulk of VUKs? I was surprised such a thing wasn't easier to find...

virtual1
Posts: 5
Joined: Sun Oct 25, 2009 1:47 am

Re: Key Files Directory file format?

Post by virtual1 » Sun Nov 01, 2009 5:28 pm

OK sorry this is something of a steep learning curve, I believe I understand everything short of the differential key revocation process now, and for my purposes that's unimportant.

I've read the thread at https://forum.doom9.org/showthread.php?t=122363 and specifically am looking at the image at http://img367.imageshack.us/img367/6008 ... km3nf8.png and the annotation that goes with it:

MKB = Media Key Block
Process MKB = Subset-Difference Tree system
Km = Media Key
Kvu = Volume Unique Key
Encrypted Key = Encrypted Title Key
Kt = Title Key

Part of my confusion lately is there's a little difference in terminology going around. You called it a "volume key", and I think you're referring to what they call the "volume id". I can see now that every title has a unique MKB, Volume ID, and Encrypted Key. MakeMKV needs to read all three of these off the disc, and the Volume ID is not a regular file and must be obtained by querying the player itself to read it from some special storage place on the disc. This explains why I was unable to run MakeMKV on a copy I had dragged to the hard drive, MakeMKV was unable to determine the VUK.

Still interested in being able to transcode from hard drive due to the bluray reader being my main bottleneck. I'm passing the MKV files through visualhub to get playable video, and that must run on the mac pro for speed's sake also, so the fastest way to go is to rip them all at one time, and then to set visualhub loose with a bunch queued overnight. (not possible to swap discs periodically overnight!)

To do this I believe I need one of two things. (1) I need to be able to obtain the Volume ID ("VID"?) so MakeMKV can determine VUK, or (2) I need the Title Key. And both of these vary from disc to disc.

It looks like the easiest way to go with MakeMKV is if I have some way to quickly read the VID from a disc so I can stash it in the AACS key directory. Obviously MakeMKV does this read process internally when ripping directly from a disc, I don't suppose it has a utility or some way to use it to just dump the VID? (or when the rip process starts, does it stash the VID somewhere I can snag and then cancel the rip? would be nice if it stored it somewhere in a database) Or is there some app out there that can do it? (macintosh please!) I'm sure someone somewhere has a big list of VIDs and TKs too but I haven't had any luck finding it. I did find something that looked similar (http://forum.doom9.org/attachment.php?a ... 1255252890) but they discuss this list like it's obsolete. If I happen to find a table of TKs, does MakeMKV have a way to accept those directly, or does it only work with VIDs?

Again the reason for this is my time at home with the bluray drive is limited and I can get this done the fastest by ripping directly to hard drive on the MBP, and taking the drive to work and running makemkv/visualhub on the macpro. It's very slow going if I have to run makemkv at home and then visualhub it at work, especially if I find I got the wrong title etc and have to rerun makemkv.

virtual1
Posts: 5
Joined: Sun Oct 25, 2009 1:47 am

Re: Key Files Directory file format?

Post by virtual1 » Mon Nov 02, 2009 1:42 am

FYI for those looking, I have found that the keydb.cfg file here contains many common VIDs including most of my discs. The database also appears to be actively updated (they update the attachment in that thread regularly even though the thread itself is not active). MakeMKV does a fine job of finding the appropriate key in the file just as-is so it can be dropped into the AACS keys folder and works immediately, so I am now able to use MakeMKV with hard drive copies of the BDs.

it appears the MPAA is on a DMCA rampage for this file so it's hard to find but apparently that one's bulletproof. I found 1/2 dozen additional copies elsewhere that were broken links, some claiming DMCA takedown issues.

So for now I think I have most of what I need. I would still like a way to extract the VID myself because several of my BDs are not in the list, particularly less popular things like history channel video that I'd like to stream from my media server mac to my playstation. There's an app by Pav tube that connects to the internet to get the keys when it reads a disc. Looking at the traffic it appears to fetch the title key itself rather than just the volume id. I don't know if posting actual keys here will cause problems for you so I won't get into that, but it fetched eight 16 bit and one 32 bit keys from its servers, the 32 bit key starts with D25E and the 16's start with 6CD4,88EE,353B,FDAB,FBD7,962D,2068,5F95. If you have that particular BD handy (everyone loves ironman ;) maybe you can check to see if one of them is the title key. (too bad MakeMKV does not display this sort of information in its log!) If any of those numbers is useful for MakeMKV I can just grab them from there. Still wondering if there's a way to feed MakeMKV the title keys directly?

Feature request: please display the VID and TK in the advanced log when reading a disc from bluray drive. An even better addition would be for MakeMKV to create a file in the AACS folder and place new keys as it finds them, with their title names if possible. That way it's just a matter of running MakeMKV briefly on a disc to get the keys read in, and then can drag and drop files to hard drive for later transcoding without the slow access time on the BD.

Post Reply