This repository will tell you how Navicat offline activation works.
-
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 Premium.app/Contents/Resources/rpk. You can see it by any kind of text editor. 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.
NOTICE:
Start from Navicat Premuim 12.0.24 for Mac, the public key is no longer stored in Navicat Premium.app/Contents/Resources/rpk. Instead, the public key is stored in Navicat executable file Navicat Premium.app/Contents/MacOS/Navicat Premium. You can see it by searching string
"-----BEGIN PUBLIC KEY----- "
. -
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, DeviceIdentifier (related with your machine), Platform (Appropriately speaking, it should be OS Type).Like:
{
"K": "xxxxxxxxxxxxxxxx",
"P": "Mac 10.13",
"DI": "xxxxxxxxxxxxxxxxxxxx"
} -
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 can be string or integer (Thanks for discoveries from @Wizr, issue #10).Differ from Navicat Windows version,
"T"
is mandatory and must be -1 ~ +4 days difference from current time. Here is an example of Offline Activation Response Information:{
"DI" : "xxxxxxxxxxxxxxxxxxxx",
"T" : "1515770827.925012",
"K" : "xxxxxxxxxxxxxxxx",
"N" : "DoubleLabyrinth",
"O" : "Shadow"
} -
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.
-
data[0] and data[1] must be
0x68
and0x2A
respectively.May change when Navicat product changes. Uncertain yet.
-
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.
-
data[5] and data[6] are related with your Navicat product language. It depends.
May change when Navicat product changes. Uncertain yet.
Must change when Navicat product changes. Confirmed yet.
Language data[5] data[6] Discoverer English 0xAC 0x88 简体中文 0xCE 0x32 繁體中文 0xAA 0x99 日本語 0xAD 0x82 @dragonflylee Polski 0xBB 0x55 @dragonflylee Español 0xAE 0x10 @dragonflylee Français 0xFA 0x20 @Deltafox79 Deutsch 0xB1 0x60 @dragonflylee 한국어 0xB5 0x60 @dragonflylee Русский 0xEE 0x16 @dragonflylee Português 0xCD 0x49 @dragonflylee According to Navicat 12 for Mac x64 version, what IDA 7.0 indicates is that this two bytes are product signature.
-
data[7] represents whether it is commercial license or non-commercial license.
For Navicat 12 x64:
0x65
is commercial license,0x66
is non-commercial license.
For Navicat 11 x64:0x15
is commercial license,0x16
is non-commercial license.May change when Navicat product changes. Uncertain yet.
Must change when version change.
According to Navicat 12 for Mac x64 version, what IDA 7.0 indicates is that commercial license is Enterprise License and non-commercial license is Educational License.
-
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
or0001
.For Navicat 12 x64: High 4 bits must be
1100
, which is the binary of number12
.
For Navicat 11 x64: High 4 bits must be1011
, which is the binary of number11
.Must change when version change. Confirmed by Navicat 12 for Mac x64 with IDA Pro 7.0
-
data[9] is unknown, but you can set it
0xFD
or0xFC
or0xFB
if you want to use not-for-resale license. This must not be0x00
. But other value is OK.May change when Navicat product changes. Uncertain yet.
According to Navicat 12 for Mac x64 version, what IDA 7.0 indicates is that:
0xFB
is Not-For-Resale-30-days license.0xFC
is Not-For-Resale-90-days license.0xFD
is Not-For-Resale-365-days license.0xFE
is Not-For-Resale license.0xFF
is Site license.
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:
unsigned char DESKey = { 0x64, 0xAD, 0xF3, 0x2F, 0xAE, 0xF2, 0x1A, 0x27 };
Then encode the 10-bytes-long data:
-
Regard data[10] as a 80-bits-long data.
If data[10] starts with
0x68
and0x2A
, so the 80-bits-long data is01011000 00101010......
-
Divide the 80-bits-long data as 16 5-bits-long blocks.
If data[10] starts with
0x68
and0x2A
, so the 80-bits-long data is01011
,00000
,10101
,0....
, ... -
So the value every block is less than 32. Map them by a encode-table:
// Thanks for discoveries from @Wizr, issue #10 char EncodeTable[] = "ABCDEFGH8JKLMN9PQRSTUVWXYZ234567";
Then you will get a 16-char-long string.
If data[10] starts with
0x68
and0x2A
, so after encoded, it should starts with"N"
,"A"
,"V"
. -
Divide the 16-char-long string to four 4-chars-long blocks, Then you get snKey.
-
-
Check whether sn_Key that user inputs is legal.
-
After user clicks
Activate
, Navicat will start online activation first. If fails, user can choose offline activation. -
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.
-
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.
-
According to the Request Code, Get
"DI"
value and"K"
value. -
Fill Offline Activation Response Information with
"K"
value, name, organization name and"DI"
value. -
Encrypt Offline Activation Response Information by Navicat Activation Private Key and you will get 256-byte-long data.
-
Encode 256-byte-long data by Base64. The result is Activation Code.
-
-
Input Activation Code, then offline activation is done.
-
Before you build keygen, you should make sure you have installed OpenSSL.
If you havebrew
, you can install it bybrew install openssl
.$ cd navicat-keygen $ make release
-
Build patcher if your Navicat version is or is after 12.0.24.
$ cd navicat-patcher $ make release
NOTICE:
For Navicat whose version is or is after 12.0.24, if you want to use your own RSA key, please replace the content in
/navicat-patcher/main.c
const char pubkey[9][72] = { "-----BEGIN PUBLIC KEY-----", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxqkTcfbKw8ysVygePlcB", "oUAhCF6oniyP13iDtu85ZsHwqw8PnMyTp6n6FnMN9YinleIAy6NFveBu/vshTN8S", "oXbYyy5AqdZ8CQpfvuriO9UNfgV1l7SFdPPpruFAmOw+uzA3GawMsg3QNK/htqJe", "b4xKHFS04xC2AueE2RTmk6tJcL8TEBfRG7DEYOHPjebKl1NQ3ZIu15U97cCPYKO2", "pWHzsb+Fr4Wj0DChLoxlXxaBcJ2ozogaq0tW2t4Aopvt9kRSuSK9HcgxICJM5ct4", "naU91WFGWlw0+0JpiMIl5OnMbpak/5xQre9DL8zM8LjRy14I88txvXvhPEsWaYCO", "1QIDAQAB", "-----END PUBLIC KEY-----" };
with your own RSA public key before you build patcher.
-
Build keygen.
-
Generate RSA-2048 private key and public key. (Navicat Premium version < 12.0.24 ONLY)
$ openssl genrsa -out 2048key.pem 2048 $ openssl rsa -in 2048key.pem -pubout -out rpk
You will get two file:
2048key.pem
andrpk
.Now you do not need to generate RSA key. I've already prepared these two file:
-
rpk
file is innavicat-patcher
folder. -
2048key.pem
is innavicat-keygen
folder.
-
-
For Navicat Premium version < 12.0.24:
- Replace
Navicat Premium.app/Contents/Resources/rpk
file byrpk
file.
For Navicat Premium version >= 12.0.24:
-
Backup your
Navicat Premium.app/Contents/MacOS/Navicat Premium
and all of your saved database connection configurations (with password). -
Delete all of passwords in
Keychain.app
that is saved by Navicat. -
Run patcher:
$ cd navicat-patcher $ ./navicat-patcher <your navicat executable file path>
Example:
$ cd navicat-patcher $ ./navicat-patcher /Applications/Navicat\ Premium.app/Contents/MacOS/Navicat\ Premium
-
Generate a self-signed code-sign certificate and always trust it. Then use
codesign
to re-signNavicat Premium.app
.$ codesign -f -s "Your self-signed code-sign certificate name" <path to Navicat Premium.app>
- Replace
-
Then goto
navicat-keygen
folder and in Terminal:$ ./navicat-keygen 2048key.pem
You will get a snKey and be asked to input your name and organization.
Just input and then you will be asked to input the request code. Now DO NOT CLOSE KEYGEN. -
Open Navicat Premium, find and click
Registration
. Then inputRegistration Key
by snKey that keygen gave. Then clickActivate
. -
Generally online activation will failed and Navicat will ask you do
Manual Activation
, just choose it. -
Copy your request code and paste it in keygen. Leave empty line to tell keygen that your input ends.
-
Then you will get activation code which looks like a Base64 string. Just copy it and paste it in Navicat
Manual Activation
window, then clickActivate
. If nothing is wrong, activation should be done successfully. -
Finally, restore your database connection configurations if you have.