View Full Version : LIT conversion (C#) developer


Jaapjan
08-30-2005, 08:15 AM
Is there anyone out there who ever tried to port the CLit code to c# instead?

Just trying to meet up or talk a bit with other such developers who tried or thought about it (with reasonable expectations of having succes).

:indian_ch

dpierron
08-30-2005, 08:37 AM
Shouldn't be too difficult if the original source is available (which I think it is).
But what for ?

Jaapjan
08-30-2005, 09:38 AM
I see you haven't actually looked into it yet (at all?)

It would be fairly complex in fact. It is not a simple format.

doctorow
08-30-2005, 09:58 AM
Jaapjan, what's complex about it? The sources (http://www.convertlit.com/download.php) can be easily compiled with Microsoft Visual C and any other GNU C compiler. Shouldn't it be straightforward to transform C code into C# ?

Jaapjan
08-30-2005, 10:21 AM
The trouble is that the code is not object oriented, scattered about through many files and using a great deal of macro's.

Accurately deducing what a the more complex parts do precisely is ... not easy.

doctorow
08-30-2005, 10:22 AM
I C. Thanks for the clarification ;)

Jaapjan
08-30-2005, 10:23 AM
It's not a problem to explain. Feel free to verify my statements. I love to hear you find it very easy, because I could ask all the tough questions to you then...

doctorow
08-30-2005, 10:24 AM
Well I have never programmed in C#. But I did C++ and usually it was not an issue incorporating C code into C++.

Jaapjan
08-30-2005, 10:32 AM
Yes, C and C++ aren't very different and you can intermingle said variants of the C language without any sort of worry. This is not the case with C# though, which is entirely object oriented.

In fact, c# doesn't even have support for pointers, nor macro's. It's not as much a thing of porting but of rewriting based on the original C code.

doctorow
08-30-2005, 11:53 AM
May I ask you what you are working on? A project involving ConvertLit always sounds intriguing.

Jaapjan
08-30-2005, 11:58 AM
Off course. A reader for the lit format for windows mobile 5. Particularly, the code should be in the .net compact 2 framework and entirely managed code, meaning it ought work wherever mono or microsoft .net is. Possibly that .gnu variant too, whatever it is called though I won't bother with that.

It's just a hobby thing but I made quite some progress.

Laurens
08-30-2005, 12:34 PM
Is it absolutely required to use only managed code? If not, why not compile the original CLit source as a DLL and call its functions using P/Invoke?

Jaapjan
08-30-2005, 01:04 PM
I require it to be completely managed, yes. Besides that, I do not want to use any of the original code. I merely use it as a reference.

doctorow
08-30-2005, 01:08 PM
I require it to be completely managed, yes. Besides that, I do not want to use any of the original code. I merely use it as a reference.
I take it then you don't want to release your reader as GPL?

Jaapjan
08-30-2005, 01:18 PM
To be honest, I have no idea. Right now it is a hobby thing. 'See if I can do it' thing. To be honest, I don't think I would make any sort of commercial thing out of it. If that is your worry.

doctorow
08-30-2005, 01:20 PM
Nahh, I wouldn't worry about that. In fact, I am happy to see a new player among e-book readers! And if it's good, you surely deserve to make money out of it!

I was just curious why you didn't want to use the original code since you are allowed to do so as long as you respect GPL.

Jaapjan
08-30-2005, 01:24 PM
Ah yes. I want to avoid pitfalls like that for now. I'm just curious if there are others trying the same thing as I do. But... doesn't seem that way.

Sorry I took so long to reply. Had to beat the chopper highscore.

doctorow
08-30-2005, 01:49 PM
ROEFL.

Please keep us updated with the progress of your reader! Of course, if you could share a screenshot or two, even better ;)

Jaapjan
08-31-2005, 02:41 AM
Naturally. But the topic was actually about finding others who were attempting such a thing...

I'm not at the stage where I am up to screenshots, I'm trying to read the books first...which means some complicated rebuilding. Like the SHA-1 variant MS uses, the DES key and iv required and the decompression code.

Colin Dunstan
08-31-2005, 05:33 AM
Good luck with your program, Jaapjan. Definitely sounds good to me, so don't give it up!

Jaapjan
08-31-2005, 01:08 PM
Out of curiousity, Mr Dunstan. Why are you interested in it?

Colin Dunstan
08-31-2005, 01:25 PM
Heh that's easy to answer. I use my PDA primarily for reading e-books. Any new e-book reader in town raises my interest, because I think although the current ones are already very good, there is still room for a lot of improvement.

Btw, you can call me Colin.

Jaapjan
08-31-2005, 01:29 PM
As you wish, Mr. Dunstan. What can be improved in your opinion? Pure speculative naturally?

Jaapjan
09-05-2005, 11:01 AM
Well. That's it for manifest and the DES validation. Now I have to go do some studying on how exactly Huffman trees relate to compression, in particular LZW compression.

Ahh...hobby programming. I love it.

cbarnett
09-05-2005, 09:39 PM
Look on it as a wonderful learning process :D

Craig.

Jaapjan
09-06-2005, 02:01 AM
Off course, off course. If there wasn't any fun in it, you wouldn't do it either, would you?

TadW
09-06-2005, 10:36 AM
Off course, off course. If there wasn't any fun in it, you wouldn't do it either, would you?
Unless the result is you get really $$$$$$$ ;)

Jaapjan
09-07-2005, 02:46 AM
Well, even from my hobby programming work I get a certain amount of cash. Not because I've sold anything to date, or tried to, but because I'm a professional programmer. Any programming that increases my general knowledge is always welcome since much of the techniques and discipline can be used elsewhere too. And it is existing out of components too.

dpierron
09-14-2005, 07:07 AM
Jaapjan, I'm really happy to see another ebook reader developped, especially if it can read secured LIT files.
Don't you think that it would be interesting to keep focused on reading the encrypted LIT format, and leave the display/ebook stuff for an existing program ?
I mean, wouldn't it be easier to program a plugin for, let's say, the excellent µBook, that would permit it to read encrypted LIT files, and not have to program all the ebook reader part ?

Just an idea ...
David.

cbarnett
09-14-2005, 07:13 AM
I believe David at Gowerpoint has deliberately steered away from letting µbook read encrypted formats, but a plugin has potential.... and the code for decrypting the format is already open source in the form of convertlit.

Craig.

Jaapjan
09-14-2005, 08:18 AM
Actually, dpierron, cbarnett, regardless of my wishes, the code to decrypt LIT files is unavailable. Even in the open source domain. Basically, there are three different types out there. The first is very similar in protection to the second and both can be decrypted with the open source program convert lit, which I am unassociated with.
The third format, those you buy from the online bookstores and which require an activated reader, can be decrypted with the same program. But. I pretty much imagine you senseless people never tried doing so on anything -but- windows, did you?
Decrypting these kind of files needs to be done on the same computer as your activated reader...because it refers to some DLL's from microsoft. CovertLit uses those itself to decrypt them. These DLL's are also unsurprisingly enough not available on other platforms...

(Speculation, just thought up:)
Though maybe the pocketpc has them too...it has a reader after all...Hrm...

cbarnett
09-14-2005, 08:34 AM
:D, yes, it is an M$ platform, after all, and can decrypt DRM'd M$reader books, so it might be possible after. I haven't ever looked at the code for convertlit, so I wasn't sure about what it actually did to decrypt, either. If you could use it though, I doubt there'd be any issues if you're not making any money out of it...

Jaapjan
09-14-2005, 11:22 AM
I am not using any sort of code from ConvertLIT. I only see what it does and how and rebuild that. I have rebuild quite a bit of it in fact. I only need decompression. For that, I am first reading a book describing various techniques. After all, it is a fun project for me.

Compression is a very interesting topic. Many methods.

Unregistered
09-21-2005, 11:29 AM
I believe the last release of convertlit actually contained decryption code. However, you need the private part of the public/private key for the user, which is extracted by a closed-source app.
The encryption is standard RSA. If Microsoft had been more open (yeah... riiight), any publisher could have produced encrypted LIT titles without compromising security.
Instead, LIT files are sent using an ActiveX component which provides the public key encrypted with some other system that only Microsoft software (Digital Asset Server) can decrypt -- but you can use the activex control to harvest the activated email address, which is "protected" by a ROT13 equivalent substitution, assuming you - get people to visit your web site, with IE, and Reader installed and allowing safe-for-scripting ActiveX controls.

At one point, I was thinking that it'd be neat to offer an alternative to microsoft's server-side component for the ebook sites that didn't want to give overdrive a large cut.

StuBear
09-21-2005, 11:51 AM
Actually, dpierron, cbarnett, regardless of my wishes, the code to decrypt LIT files is unavailable. Even in the open source domain. Basically, there are three different types out there. The first is very similar in protection to the second and both can be decrypted with the open source program convert lit, which I am unassociated with.
The third format, those you buy from the online bookstores and which require an activated reader, can be decrypted with the same program. But. I pretty much imagine you senseless people never tried doing so on anything -but- windows, did you?

Yes, I convert all my lit files on linux - both X86 and arm (sharp zaurus) using converlit 1.8

Decrypting these kind of files needs to be done on the same computer as your activated reader...because it refers to some DLL's from microsoft. CovertLit uses those itself to decrypt them. These DLL's are also unsurprisingly enough not available on other platforms...

(Speculation, just thought up:)
Though maybe the pocketpc has them too...it has a reader after all...Hrm...

Sorry, but you are wrong.

Aint got any dlls on my zaurus and it happily converts DRM5 to DRM1 format or unpacking DRM5 to OEBPS format. All I need is the keys.txt file made from the windows version on the machine that MS reader is activated on.

Stu

Jaapjan
09-26-2005, 10:43 AM
Excellent. I am pleased to hear it. At any rate, I haven't in particular worked on DRM5 at the moment. I just returned from a vacation but I'll have a look when I am back into the regular flow of things. Just drove several hundered miles so....not now.