# Navicat Keygen This repository will tell you how Navicat offline activation works. ## 1. Keyword Explanation. * __Navicat Activation Public Key__ It is a __RSA-2048__ public key that Navicat used to encrypt or decrypt offline activation information. It is stored in __navicat.exe__ as a kind of resource called __RCData__. You can see it by a kind of software [___Resource Hacker___](http://www.angusj.com/resourcehacker/). The concrete content is: > -----BEGIN PUBLIC KEY----- > MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw1dqF3SkCaAAmMzs889I > qdW9M2dIdh3jG9yPcmLnmJiGpBF4E9VHSMGe8oPAy2kJDmdNt4BcEygvssEfginv > a5t5jm352UAoDosUJkTXGQhpAWMF4fBmBpO3EedG62rOsqMBgmSdAyxCSPBRJIOF > R0QgZFbRnU0frj34fiVmgYiLuZSAmIbs8ZxiHPdp1oD4tUpvsFci4QJtYNjNnGU2 > WPH6rvChGl1IRKrxMtqLielsvajUjyrgOC6NmymYMvZNER3htFEtL1eQbCyTfDmt > YyQ1Wt4Ot12lxf0wVIR5mcGN7XCXJRHOFHSf1gzXWabRSvmt1nrl7sW6cjxljuuQ > awIDAQAB > -----END PUBLIC KEY----- If you have the corresponding private key, please tell me. I would be very appreciated for your generous. * __Request Code__ It is a Base64 string that represents 256-bytes-long data, while the 256-bytes-long data is the cipher text of the __offline activation information__ encrypted by __Navicat Activation Public Key__. * __Offline Activation Request Information__ It is just a JSON-style ASCII string which contains 3 items. Respectively they are `"K"`, `"DI"` and `"P"`, which represent __snKey__, __checksum__ (related with your machine and OS), __Platform__ (Appropriately speaking, it should be OS Type). Like: > {"K": "xxxxxxxxxxxxxxxx", "DI": "yyyyyyyyyyyyy", "P": "WIN8"} * __Activation Code__ It is a Base64 string that represents 256-bytes-long data, while the 256-bytes-long data is the cipher text of the __offline activation response information__ encrypted by __Navicat Activation Private Key__ (so far, we don't know official activation private key). * __Offline Activation Response Information__ Just like __Offline Activation Request Information__, it is also a JSON-style ASCII string. But it contains 5 items. Respectively they are `"K"`, `"N"`, `"O"`, `"T"`, '`DI`'. `"K"` and `"DI"` has the same meaning mentioned in __Offline Activation Request Information__ and must be same with the corresponding items in __Offline Activation Request Information__. `"N"`, `"O"`, `"T"` represent __Name__, __Organization__, __Time__ respectively. __Name__ and __Organization__ are string and the type of __Time__ is unknown. `"T"` can be omitted. * __snKey__ It is a 4-block-long string, while every block is 4-chars-long. __snKey__ is generated by 10-bytes-long data. In order to explain it easily, I use __data[10]__ to represent the 10-bytes-long data. 1. __data[0]__ and __data[1]__ must be `0x68` and `0x2A` respectively. _`May change when Navicat product changes. Uncertain yet.`_ 2. __data[2]__, __data[3]__ and __data[4]__ can be any byte. Just set them whatever you want. _`May change when Navicat product changes. Uncertain yet. But it's very possible right.`_ 3. __data[5]__ and __data[6]__ must be `0xCE` and `0x32` respectively. _`May change when Navicat product changes. Uncertain yet.`_ 4. __data[7]__ represents whether it is __commercial license__ or __non-commercial license__. In Navicat 12: `0x65` is __commercial license__, `0x66` is __non-commercial license__. In Navicat 11: `0x15` is __commercial license__, `0x16` is __non-commercial license__. _`May change when Navicat product changes. Uncertain yet.`_ _`Must change when version change.`_ 5. High 4 bits of __data[8]__ represents __version number__. Low 4 bits is unknown, but we can use it to delay activation deadline. Possible value is `0000` or `0001`. In Navicat 12: High 4 bits must be `1100`, which is the binary of number `12`. In Navicat 11: High 4 bits must be `1011`, which is the binary of number `11`. _`Must change when version change.`_ 6. __data[9]__ is unknown, but you can set it `0xFD` or `0xFC` or `0xFB` if you want to use __not-for-resale license__. _`May change when Navicat product changes. Uncertain yet.`_ After that. Navicat use __DES__ with __ECB mode__ to encrypt the last 8 bytes which are from __data[2]__ to __data[9]__. The DES key is: ```cpp unsigned char DESKey = { 0x64, 0xAD, 0xF3, 0x2F, 0xAE, 0xF2, 0x1A, 0x27 }; ``` Then encode the 10-bytes-long data: 1. Regard __data[10]__ as a 80-bits-long data. If __data[10]__ starts with `0x68` and `0x2A`, so the 80-bits-long data is `01011000 00101010......` 2. Divide the 80-bits-long data as 16 5-bits-long blocks. If __data[10]__ starts with `0x68` and `0x2A`, so the 80-bits-long data is `01011`, `00000`, `10101`, `0....`, ... 3. So the value every block is less than 32. Map them by a encode-table: ```cpp char EncodeTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; ``` Then you will get a 16-char-long string. If __data[10]__ starts with `0x68` and `0x2A`, so after encoded, it should starts with `"N"`, `"A"`, `"V"`. 4. Divide the 16-char-long string to four 4-chars-long blocks, Then you get __snKey__. ## 3. Activation Process 1. Check whether __sn_Key__ that user inputs is legal. 2. After user clicks `Activate`, Navicat will start online activation first. If fails, user can choose offline activation. 3. Navicat will use the __snKey__ that user inputs and some information collected from user's machine to generate __Offline Activation Request Information__, then encrypt it by __Navicat Activation Public Key__ and return Base64-encoded string as __Request Code__. 4. In legal way, the __Request Code__ should be sent to Navicat official activation server by a Internet-accessible computer. And Navicat official activation server will return a legal __Activation Code__. But now, we use keygen to play the official activation server's role. 1. According to the __Request Code__, Get `"DI"` value and `"K"` value. 2. Fill __Offline Activation Response Information__ with `"K"` value, name, organization name and `"DI"` value. 3. Encrypt __Offline Activation Response Information__ by __Navicat Activation Private Key__ and you will get 256-byte-long data. 4. Encode 256-byte-long data by Base64. The result is __Activation Code__. 5. Input __Activation Code__, then offline activation is done.