mirror of
https://github.com/DoubleLabyrinth/navicat-keygen.git
synced 2019-12-02 05:10:56 +00:00
Compare commits
37
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a6d87c40f | ||
|
|
60328cf9ef | ||
|
|
4fd30137d6 | ||
|
|
a43664904f | ||
|
|
52a563bfbe | ||
|
|
1c82c345ae | ||
|
|
4f9cf55a51 | ||
|
|
d59dea7657 | ||
|
|
27e97b34f0 | ||
|
|
b358e76f56 | ||
|
|
3a7e720bec | ||
|
|
921b59e8b2 | ||
|
|
0dc6a95868 | ||
|
|
99e496d3e5 | ||
|
|
2fcc848af6 | ||
|
|
cdbf7601bf | ||
|
|
8a853937a3 | ||
|
|
5029aad429 | ||
|
|
9ea49d8e3e | ||
|
|
bacd4e14c1 | ||
|
|
918d4a8efe | ||
|
|
6f885c4a1a | ||
|
|
88c2714363 | ||
|
|
bc8f3b62c9 | ||
|
|
3f84ef8711 | ||
|
|
43c81e1971 | ||
|
|
1a3d0b0128 | ||
|
|
c7dc56180e | ||
|
|
1f81dce182 | ||
|
|
6b29f20c46 | ||
|
|
0586ceefb6 | ||
|
|
bf2fb47a3a | ||
|
|
e81e0f0813 | ||
|
|
793d1e583c | ||
|
|
acd61f1822 | ||
|
|
d14695a524 | ||
|
|
7f84cf3294 |
@@ -1,43 +1,10 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: "[FAILURE][write OS type here] write your own description here"
|
||||
labels: failure report
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
BEFORE `navicat-patcher.exe` (Windows, Wine in Linux) or `navicat-patcher` (macOS) is run, you should make sure that your Navicat is official version, which means it has not been modified by anyone, and you should also make sure there's no `*.backup` files in Navicat installation folder.
|
||||
|
||||
If you still meet a failure, you can submit a failure report and please fill in the following:
|
||||
|
||||
1. What is your Navicat product? Check one of the following:
|
||||
- [ ] Navicat Premium
|
||||
- [ ] Navicat MySQL
|
||||
- [ ] Navicat Data Modeler
|
||||
- [ ] Navicat Report Viewer
|
||||
- [ ] Other, please write here: ______
|
||||
|
||||
2. What is your Navicat language version? Check one of the following:
|
||||
- [ ] English
|
||||
- [ ] Simplified Chinese
|
||||
- [ ] Traditional Chinese
|
||||
- [ ] Other, please write here: ______
|
||||
|
||||
3. What is your OS? Check one of the following:
|
||||
- [ ] Windows
|
||||
- [ ] macOS
|
||||
- [ ] Linux
|
||||
|
||||
4. Can you post console output here? If don't have, leave it empty.
|
||||
```
|
||||
Please post here
|
||||
```
|
||||
|
||||
5. If __Request Code__ or __Activation Code__ is shown, please post the content of `RegPrivateKey.pem` here:
|
||||
```
|
||||
Please post here
|
||||
```
|
||||
|
||||
6. If you have other information to provide, please write here.
|
||||
(If you don't have, leave it empty.)
|
||||
|
||||
@@ -18,26 +18,29 @@ If you still meet a failure, you can submit a failure report and please fill in
|
||||
- [ ] Navicat Report Viewer
|
||||
- [ ] Other, please write here: ______
|
||||
|
||||
2. What is your Navicat language version? Check one of the following:
|
||||
2. What's your Navicat version number?
|
||||
Please write here: ______
|
||||
|
||||
3. What is your Navicat language version? Check one of the following:
|
||||
- [ ] English
|
||||
- [ ] Simplified Chinese
|
||||
- [ ] Traditional Chinese
|
||||
- [ ] Other, please write here: ______
|
||||
|
||||
3. What is your OS? Check one of the following:
|
||||
4. What is your OS? Check one of the following:
|
||||
- [ ] Windows
|
||||
- [ ] macOS
|
||||
- [ ] Linux
|
||||
|
||||
4. Can you post console output here? If don't have, leave it empty.
|
||||
5. Can you post console output here? If don't have, leave it empty.
|
||||
```
|
||||
Please post here
|
||||
```
|
||||
|
||||
5. If __Request Code__ or __Activation Code__ is shown, please post the content of `RegPrivateKey.pem` here:
|
||||
6. If __Request Code__ or __Activation Code__ is shown, please post the content of `RegPrivateKey.pem` here:
|
||||
```
|
||||
Please post here
|
||||
```
|
||||
|
||||
6. If you have other information to provide, please write here.
|
||||
7. If you have other information to provide, please write here.
|
||||
(If you don't have, leave it empty.)
|
||||
|
||||
@@ -18,26 +18,29 @@ assignees: ''
|
||||
- [ ] Navicat Report Viewer
|
||||
- [ ] 其他,请写在这里:______
|
||||
|
||||
2. 你的Navicat产品语言版本是什么?选择下面一个:
|
||||
2. 你的Navicat版本号是多少?
|
||||
请写在这里:______
|
||||
|
||||
3. 你的Navicat产品语言版本是什么?选择下面一个:
|
||||
- [ ] English
|
||||
- [ ] Simplified Chinese
|
||||
- [ ] Traditional Chinese
|
||||
- [ ] 其他,请写在这里:______
|
||||
|
||||
3. 你的操作系统是什么?选择下面一个:
|
||||
4. 你的操作系统是什么?选择下面一个:
|
||||
- [ ] Windows
|
||||
- [ ] macOS
|
||||
- [ ] Linux
|
||||
|
||||
4. 你可以把命令行输出贴出来吗?如果你没有,请留空:
|
||||
5. 你可以把命令行输出贴出来吗?如果你没有,请留空:
|
||||
```
|
||||
贴在这里
|
||||
```
|
||||
|
||||
5. 如果 __请求码__ 或者 __激活码__ 出现了,请把 `RegPrivateKey.pem` 的内容贴在这里:
|
||||
6. 如果 __请求码__ 或者 __激活码__ 出现了,请把 `RegPrivateKey.pem` 的内容贴在这里:
|
||||
```
|
||||
贴在这里
|
||||
```
|
||||
|
||||
6. 如果你有其他信息要提供的,请写在这里:
|
||||
7. 如果你有其他信息要提供的,请写在这里:
|
||||
(如果你没有,请留空。)
|
||||
|
||||
@@ -8,202 +8,15 @@ This repository will tell you how Navicat offline activation works.
|
||||
|
||||
## How to use?
|
||||
|
||||
1. Download the latest release [from here](https://github.com/DoubleLabyrinth/navicat-keygen/releases).
|
||||
For Windows users, see [here](README_FOR_WINDOWS.md).
|
||||
|
||||
2. Use `navicat-patcher.exe` to replace __Navicat Activation Public Key__ that is stored in `navicat.exe` or `libcc.dll`.
|
||||
|
||||
```
|
||||
navicat-patcher.exe <Navicat installation path> [RSA-2048 PEM file]
|
||||
```
|
||||
For Linux users, see [here](README_FOR_LINUX.md).
|
||||
|
||||
* `<Navicat installation path>`: The full path to Navicat installation folder.
|
||||
|
||||
__This parameter must be specified.__
|
||||
## Contributor
|
||||
|
||||
* `[RSA-2048 PEM file]`: The full path or relative path to a RSA-2048 private key file.
|
||||
|
||||
__This parameter is optional.__ If not specified, `navicat-patcher.exe` will generate a new RSA-2048 private key file `RegPrivateKey.pem` at current directory.
|
||||
* Deltafox79
|
||||
|
||||
__Example: (in cmd.exe)__
|
||||
* dragonflylee
|
||||
|
||||
```
|
||||
navicat-patcher.exe "C:\Program Files\PremiumSoft\Navicat Premium 12"
|
||||
```
|
||||
|
||||
It has been tested on __Navicat Premium 12.1.12 Simplified Chinese version__. The following is an example of output.
|
||||
|
||||
```
|
||||
***************************************************
|
||||
* Navicat Patcher by @DoubleLabyrinth *
|
||||
* Release date: Jan 19 2019 *
|
||||
***************************************************
|
||||
|
||||
Press Enter to continue or Ctrl + C to abort.
|
||||
|
||||
MESSAGE: [PatchSolution3] Keywords[0] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a08
|
||||
Relative Machine Code RVA = +0x0000000001645608
|
||||
Patch Offset = +0x00000000023d56e4
|
||||
Patch Size = 3 byte(s)
|
||||
MESSAGE: [PatchSolution3] Keywords[1] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a5f
|
||||
Relative Machine Code RVA = +0x000000000164565f
|
||||
Patch Offset = +0x0000000001644a63
|
||||
Patch Size = 2 byte(s)
|
||||
...
|
||||
...
|
||||
...
|
||||
MESSAGE: [PatchSolution3] Keywords[109] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001651558
|
||||
Relative Machine Code RVA = +0x0000000001652158
|
||||
Patch Offset = +0x000000000165155c
|
||||
Patch Size = 2 byte(s)
|
||||
MESSAGE: [PatchSolution3] Keywords[110] has been found:
|
||||
Relative Machine Code Offset = +0x000000000165155e
|
||||
Relative Machine Code RVA = +0x000000000165215e
|
||||
Patch Offset = +0x0000000001651561
|
||||
Patch Size = 1 byte(s)
|
||||
MESSAGE: Generating new RSA private key, it may take a long time.
|
||||
MESSAGE: New RSA private key has been saved to RegPrivateKey.pem.
|
||||
|
||||
Your RSA public key:
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxnosIMaINNalTS93BgGF
|
||||
dcbodlk3X2PVuPl+HZuYLLfrGPfzgtfXKzM7RzEuJOX9ozs4lyiB298ImnS/fa4g
|
||||
xHKJBvdk11PgD3mSTU6+PwIR45ud5RcbsuwnjVUEpXkth+9tjaxiNNtaDH5af4+z
|
||||
/ExWeRLH/8lnNMhC5wndvPhw2gbrypAD1VvBPj0LG7Ktmt1Sqx25aBdikp/uEPvn
|
||||
eXQgOgH7H+L8id8RtKItI+ZSwojaDWu9ROpvVejlA7W4ceZlNVeGCSqIieL7MUpm
|
||||
DpRmLgBBoXrZgQTyG1Z9RjXD3+Q361z2RvfZZcsnMxfMA04NRscoqlG7eC2JW5JN
|
||||
swIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
|
||||
@ +023d56e4: 4D 49 49 ---> 4D 49 49
|
||||
@ +01644a63: 42 49 ---> 42 49
|
||||
@ +01644a68: 6A ---> 6A
|
||||
@ +01644ace: 41 ---> 41
|
||||
@ +01644b28: 4E 42 67 6B ---> 4E 42 67 6B
|
||||
@ +01644b32: 71 ---> 71
|
||||
@ +023d56e8: 68 6B 69 47 39 77 ---> 68 6B 69 47 39 77
|
||||
...
|
||||
...
|
||||
...
|
||||
@ +023d58d0: 37 73 57 ---> 71 6C 47
|
||||
@ +023d58d4: 36 63 6A ---> 37 65 43
|
||||
@ +023d58d8: 78 6C 6A 75 75 51 61 ---> 32 4A 57 35 4A 4E 73
|
||||
@ +023d58e8: 77 49 44 41 ---> 77 49 44 41
|
||||
@ +0165155c: 51 41 ---> 51 41
|
||||
@ +01651561: 42 ---> 42
|
||||
|
||||
MESSAGE: Patch has been done successfully.
|
||||
```
|
||||
|
||||
3. Then use `navicat-keygen.exe` to generate __snKey__ and __Activation Code__
|
||||
|
||||
```
|
||||
navicat-keygen.exe <-bin|-text> [-adv] <RSA-2048 PrivateKey(PEM file)>
|
||||
```
|
||||
|
||||
* `<-bin|-text>`: Must be `-bin` or `-text`.
|
||||
|
||||
If `-bin` is specified, `navicat-keygen.exe` will finally generate `license_file`. It is used for Navicat old activation method only.
|
||||
|
||||
If `-text` is specified, `navicat-keygen.exe` will finally generate a Base64-style string which is __Activation Code__. It is used for Navicat new activation method.
|
||||
|
||||
__This parameter must be specified.__
|
||||
|
||||
* `[-adv]`: Enable advanced mode.
|
||||
|
||||
__This parameter is optional.__ If specified, `navicat-keygen.exe` will ask you input Navicat product ID number, language signature numbers. It is for future use generally.
|
||||
|
||||
* `<RSA-2048 PrivateKey(PEM file)>`: The full path or relative path to a RSA-2048 private key file.
|
||||
|
||||
__This parameter must be specified.__
|
||||
|
||||
__Example: (in cmd.exe)__
|
||||
|
||||
```bash
|
||||
navicat-keygen.exe -text .\RegPrivateKey.pem
|
||||
```
|
||||
|
||||
You will be asked to select Navicat product, language and input major version number. After that an randomly generated __snKey__ will be given.
|
||||
|
||||
```
|
||||
Select Navicat product:
|
||||
1. DataModeler
|
||||
2. Premium
|
||||
3. MySQL
|
||||
4. PostgreSQL
|
||||
5. Oracle
|
||||
6. SQLServer
|
||||
7. SQLite
|
||||
8. MariaDB
|
||||
9. MongoDB
|
||||
10. ReportViewer
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
Select product language:
|
||||
1. English
|
||||
2. Simplified Chinese
|
||||
3. Traditional Chinese
|
||||
4. Japanese
|
||||
5. Polish
|
||||
6. Spanish
|
||||
7. French
|
||||
8. German
|
||||
9. Korean
|
||||
10. Russian
|
||||
11. Portuguese
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
(Input major version number, range: 0 ~ 15, default: 12)> 12
|
||||
|
||||
Serial number:
|
||||
NAVO-2ORP-IN5A-GQEE
|
||||
|
||||
Your name:
|
||||
```
|
||||
|
||||
You can use this __snKey__ to activate your Navicat preliminarily.
|
||||
|
||||
Then you will be asked to input `Your name` and `Your organization`. Just set them whatever you want, but not too long.
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
Input request code (in Base64), input empty line to end:
|
||||
```
|
||||
|
||||
After that, you will be asked to input the request code. Now __DO NOT CLOSE KEYGEN__.
|
||||
|
||||
4. __Disconnect your network__ and open Navicat. Find and click `Registration`. Fill `Registration Key` by __snKey__ that the keygen gave and click `Activate`.
|
||||
|
||||
5. Generally online activation will failed and Navicat will ask you do `Manual Activation`, just choose it.
|
||||
|
||||
6. Copy your request code and paste it in the keygen. Input empty line to tell the keygen that your input ends.
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
|
||||
Input request code (in Base64), input empty line to end:
|
||||
t2U+0yfE2FfnbjyhCXa0lglZOHu9Ntc3qyGiPbR6xb1QoU63/9BVfdaCq0blwVycXPyT/Vqw5joIKdM5oCRR/afCPM7iRcyhQMAnvqwc+AOKCqayVV+SqKLvtR/AbREI12w++PQ6Ewfs4A8PgB8OJ9G0jKt6Q/iJRblqi2WWw9mwy+YHcYYh3UAfygTnyj/xl+MzRymbY0lkus+6LPtpDecVsFFhM7F32Ee1QPwISko7bAkHOtkt+joPfYDdn9PDGZ4HEmeLvH6UqZCXkzgaAfynB7cQZFEkId8FsW2NGkbpM7wB2Hi3fNFgOIjutTprixTdbpFKn4w6gGc28ve23A==
|
||||
|
||||
Request Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE", "DI":"R91j6WyMhxHznAKSxxxx", "P":"WIN"}
|
||||
|
||||
Response Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE","DI":"R91j6WyMhxHznAKSxxxx","N":"DoubleLabyrinth","O":"DoubleLabyrinth","T":1547826060}
|
||||
|
||||
License:
|
||||
lRF18o+ZhBphyN0U5kFLHtAAGGXuvhqOcxNuvAk4dJcGeR0ISuw74mQvAfdNjv0T
|
||||
I5NZFzqIJvrzM0XeR88q+3kmZkECuxwwWHP3zzDPhPiylcTV4DoGZ1tfoViUSYQc
|
||||
LgXG0Fl7koZeP61YOKQ8GfX+Xk2ZTM64bYaF7NlhonM+GQUJCCF2JThmrP921t2p
|
||||
b/E5pV6fLOYMM13881ZQcQcltMNVDZn4lzgzKRFFxCQFaTl6fJMHZdYVmICQTHtI
|
||||
sNaym0zduc8/cv34mgJ+7NseXmsEPCdjrZ59wgfPsLhZLXqtfxi5hGWw4NMa3Sb2
|
||||
UI8dzqFzRp/hSDEM0mEqiA==
|
||||
```
|
||||
|
||||
7. Finally, you will get __Activation Code__ which looks like a Base64 string. Just copy it and paste it in Navicat `Manual Activation` window, then click `Activate`. If nothing wrong, activation should be done successfully.
|
||||
* zenuo
|
||||
|
||||
|
||||
+6
-193
@@ -6,202 +6,15 @@
|
||||
|
||||
## 如何使用这个注册机
|
||||
|
||||
1. [从这里](https://github.com/DoubleLabyrinth/navicat-keygen/releases)下载最新的release。
|
||||
针对 Windows 用户,请见[这里](README_FOR_WINDOWS.zh-CN.md)。
|
||||
|
||||
2. 使用`navicat-patcher.exe`替换掉`navicat.exe`和`libcc.dll`里的Navicat激活公钥。
|
||||
针对 Linux 用户,请见[这里](README_FOR_LINUX.zh-CN.md)。
|
||||
|
||||
```
|
||||
navicat-patcher.exe <Navicat installation path> [RSA-2048 PEM file]
|
||||
```
|
||||
## 贡献者
|
||||
|
||||
* `<Navicat installation path>`: Navicat的完整安装路径。
|
||||
|
||||
__这个参数必须指定。__
|
||||
* Deltafox79
|
||||
|
||||
* `[RSA-2048 PEM file]`: RSA-2048私钥文件的完整路径或相对路径。
|
||||
|
||||
__这个参数是可选的。__ 如果未指定,`navicat-patcher.exe`将会在当前目录生成一个新的RSA-2048私钥文件。
|
||||
* dragonflylee
|
||||
|
||||
__例如:(在cmd.exe中)__
|
||||
|
||||
```
|
||||
navicat-patcher.exe "C:\Program Files\PremiumSoft\Navicat Premium 12"
|
||||
```
|
||||
|
||||
__Navicat Premium 12.1.12 简体中文版已通过测试__。下面将是一份样例输出。
|
||||
|
||||
```
|
||||
***************************************************
|
||||
* Navicat Patcher by @DoubleLabyrinth *
|
||||
* Release date: Jan 19 2019 *
|
||||
***************************************************
|
||||
|
||||
Press Enter to continue or Ctrl + C to abort.
|
||||
|
||||
MESSAGE: [PatchSolution3] Keywords[0] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a08
|
||||
Relative Machine Code RVA = +0x0000000001645608
|
||||
Patch Offset = +0x00000000023d56e4
|
||||
Patch Size = 3 byte(s)
|
||||
MESSAGE: [PatchSolution3] Keywords[1] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a5f
|
||||
Relative Machine Code RVA = +0x000000000164565f
|
||||
Patch Offset = +0x0000000001644a63
|
||||
Patch Size = 2 byte(s)
|
||||
...
|
||||
...
|
||||
...
|
||||
MESSAGE: [PatchSolution3] Keywords[109] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001651558
|
||||
Relative Machine Code RVA = +0x0000000001652158
|
||||
Patch Offset = +0x000000000165155c
|
||||
Patch Size = 2 byte(s)
|
||||
MESSAGE: [PatchSolution3] Keywords[110] has been found:
|
||||
Relative Machine Code Offset = +0x000000000165155e
|
||||
Relative Machine Code RVA = +0x000000000165215e
|
||||
Patch Offset = +0x0000000001651561
|
||||
Patch Size = 1 byte(s)
|
||||
MESSAGE: Generating new RSA private key, it may take a long time.
|
||||
MESSAGE: New RSA private key has been saved to RegPrivateKey.pem.
|
||||
|
||||
Your RSA public key:
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxnosIMaINNalTS93BgGF
|
||||
dcbodlk3X2PVuPl+HZuYLLfrGPfzgtfXKzM7RzEuJOX9ozs4lyiB298ImnS/fa4g
|
||||
xHKJBvdk11PgD3mSTU6+PwIR45ud5RcbsuwnjVUEpXkth+9tjaxiNNtaDH5af4+z
|
||||
/ExWeRLH/8lnNMhC5wndvPhw2gbrypAD1VvBPj0LG7Ktmt1Sqx25aBdikp/uEPvn
|
||||
eXQgOgH7H+L8id8RtKItI+ZSwojaDWu9ROpvVejlA7W4ceZlNVeGCSqIieL7MUpm
|
||||
DpRmLgBBoXrZgQTyG1Z9RjXD3+Q361z2RvfZZcsnMxfMA04NRscoqlG7eC2JW5JN
|
||||
swIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
|
||||
@ +023d56e4: 4D 49 49 ---> 4D 49 49
|
||||
@ +01644a63: 42 49 ---> 42 49
|
||||
@ +01644a68: 6A ---> 6A
|
||||
@ +01644ace: 41 ---> 41
|
||||
@ +01644b28: 4E 42 67 6B ---> 4E 42 67 6B
|
||||
@ +01644b32: 71 ---> 71
|
||||
@ +023d56e8: 68 6B 69 47 39 77 ---> 68 6B 69 47 39 77
|
||||
...
|
||||
...
|
||||
...
|
||||
@ +023d58d0: 37 73 57 ---> 71 6C 47
|
||||
@ +023d58d4: 36 63 6A ---> 37 65 43
|
||||
@ +023d58d8: 78 6C 6A 75 75 51 61 ---> 32 4A 57 35 4A 4E 73
|
||||
@ +023d58e8: 77 49 44 41 ---> 77 49 44 41
|
||||
@ +0165155c: 51 41 ---> 51 41
|
||||
@ +01651561: 42 ---> 42
|
||||
|
||||
MESSAGE: Patch has been done successfully.
|
||||
```
|
||||
|
||||
3. 接下来使用`navicat-keygen.exe`来生成序列号和激活码
|
||||
|
||||
```
|
||||
navicat-keygen.exe <-bin|-text> [-adv] <RSA-2048 PrivateKey(PEM file)>
|
||||
```
|
||||
|
||||
* `<-bin|-text>`: 必须是`-bin`或`-text`。
|
||||
|
||||
如果指定了`-bin`,`navicat-keygen.exe`最终将生成`license_file`文件。这个选项是给Navicat旧激活方式使用的。
|
||||
|
||||
如果指定了`-text`,`navicat-keygen.exe`最终将生成Base64样式的激活码。这个选项是给Navicat新激活方式使用的。
|
||||
|
||||
__这个参数必须指定。__
|
||||
|
||||
* `[-adv]`: 开启高级模式。
|
||||
|
||||
__这个参数是可选的。__ 如果指定了这个参数,`navicat-keygen.exe`将会要求你手工填写产品ID号、语言标识号。这个选项一般是给以后用的。
|
||||
|
||||
* `<RSA-2048 PrivateKey(PEM file)>`: RSA-2048私钥文件的完整路径或相对路径。
|
||||
|
||||
__这个参数必须指定。__
|
||||
|
||||
__例如:(在cmd.exe中)__
|
||||
|
||||
```bash
|
||||
navicat-keygen.exe -text .\RegPrivateKey.pem
|
||||
```
|
||||
|
||||
你会被要求选择Navicat产品类别、语言以及输入主版本号。之后会随机生成一个序列号。
|
||||
|
||||
```
|
||||
Select Navicat product:
|
||||
1. DataModeler
|
||||
2. Premium
|
||||
3. MySQL
|
||||
4. PostgreSQL
|
||||
5. Oracle
|
||||
6. SQLServer
|
||||
7. SQLite
|
||||
8. MariaDB
|
||||
9. MongoDB
|
||||
10. ReportViewer
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
Select product language:
|
||||
1. English
|
||||
2. Simplified Chinese
|
||||
3. Traditional Chinese
|
||||
4. Japanese
|
||||
5. Polish
|
||||
6. Spanish
|
||||
7. French
|
||||
8. German
|
||||
9. Korean
|
||||
10. Russian
|
||||
11. Portuguese
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
(Input major version number, range: 0 ~ 15, default: 12)> 12
|
||||
|
||||
Serial number:
|
||||
NAVO-2ORP-IN5A-GQEE
|
||||
|
||||
Your name:
|
||||
```
|
||||
|
||||
你可以使用这个序列号暂时激活Navicat。
|
||||
|
||||
接下来你会被要求输入`用户名`和`组织名`;请随便填写,但不要太长。
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
Input request code (in Base64), input empty line to end:
|
||||
```
|
||||
|
||||
之后你会被要求填入请求码。注意 __不要关闭命令行__.
|
||||
|
||||
4. __断开网络__ 并打开Navicat。找到`注册`窗口,并填入keygen给你的序列号。然后点击`激活`按钮。
|
||||
|
||||
5. 一般来说在线激活肯定会失败,这时候Navicat会询问你是否`手动激活`,直接选吧。
|
||||
|
||||
6. 在`手动激活`窗口你会得到一个请求码,复制它并把它粘贴到keygen里。最后别忘了连按至少两下回车结束输入。
|
||||
|
||||
```bash
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
|
||||
Input request code (in Base64), input empty line to end:
|
||||
t2U+0yfE2FfnbjyhCXa0lglZOHu9Ntc3qyGiPbR6xb1QoU63/9BVfdaCq0blwVycXPyT/Vqw5joIKdM5oCRR/afCPM7iRcyhQMAnvqwc+AOKCqayVV+SqKLvtR/AbREI12w++PQ6Ewfs4A8PgB8OJ9G0jKt6Q/iJRblqi2WWw9mwy+YHcYYh3UAfygTnyj/xl+MzRymbY0lkus+6LPtpDecVsFFhM7F32Ee1QPwISko7bAkHOtkt+joPfYDdn9PDGZ4HEmeLvH6UqZCXkzgaAfynB7cQZFEkId8FsW2NGkbpM7wB2Hi3fNFgOIjutTprixTdbpFKn4w6gGc28ve23A==
|
||||
|
||||
Request Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE", "DI":"R91j6WyMhxHznAKSxxxx", "P":"WIN"}
|
||||
|
||||
Response Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE","DI":"R91j6WyMhxHznAKSxxxx","N":"DoubleLabyrinth","O":"DoubleLabyrinth","T":1547826060}
|
||||
|
||||
License:
|
||||
lRF18o+ZhBphyN0U5kFLHtAAGGXuvhqOcxNuvAk4dJcGeR0ISuw74mQvAfdNjv0T
|
||||
I5NZFzqIJvrzM0XeR88q+3kmZkECuxwwWHP3zzDPhPiylcTV4DoGZ1tfoViUSYQc
|
||||
LgXG0Fl7koZeP61YOKQ8GfX+Xk2ZTM64bYaF7NlhonM+GQUJCCF2JThmrP921t2p
|
||||
b/E5pV6fLOYMM13881ZQcQcltMNVDZn4lzgzKRFFxCQFaTl6fJMHZdYVmICQTHtI
|
||||
sNaym0zduc8/cv34mgJ+7NseXmsEPCdjrZ59wgfPsLhZLXqtfxi5hGWw4NMa3Sb2
|
||||
UI8dzqFzRp/hSDEM0mEqiA==
|
||||
```
|
||||
|
||||
4. 如果不出意外,你会得到一个看似用Base64编码的激活码。直接复制它,并把它粘贴到Navicat的`手动激活`窗口,最后点`激活`按钮。如果没什么意外的话应该能成功激活。
|
||||
* zenuo
|
||||
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
# Navicat Keygen - for Linux
|
||||
|
||||
[中文版README](README_FOR_LINUX.zh-CN.md)
|
||||
|
||||
## How to use?
|
||||
|
||||
> You can download [Screen recoding](image/Screen_recording.mp4) for references.
|
||||
|
||||
1. Switch to the path you extracted the installation package ,Run Navicat, for initialization:
|
||||
|
||||
```bash
|
||||
cd ~/navicat121_premium_en_x64 && \
|
||||
./start_navicat
|
||||
```
|
||||
|
||||
When running for the first time, you will be prompted with the following two windows, click "Cancel" to:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
Until the `Registration` window appears, select `Trial`, close Navicat after loading is complete, and execute `Step 2`:
|
||||
|
||||

|
||||
|
||||
2. Download the latest release [from here](https://github.com/DoubleLabyrinth/navicat-keygen/releases), and extract :
|
||||
|
||||
> The 64-bit executable file is downloaded here. If you use 32-bit, please download the corresponding version.
|
||||
|
||||
```bash
|
||||
curl -O -L https://github.com/DoubleLabyrinth/navicat-keygen/releases/download/v3.1/navicat-keygen-for-x64.zip && \
|
||||
unzip navicat-keygen-for-x64.zip
|
||||
```
|
||||
|
||||
3. Download `navicat-pacther.sh` and `navicat-keygen.sh`:
|
||||
|
||||
```bash
|
||||
curl -O -L https://raw.githubusercontent.com/DoubleLabyrinth/navicat-keygen/windows/bash/navicat-patcher.sh && \
|
||||
chmod +x navicat-patcher.sh && \
|
||||
curl -O -L https://raw.githubusercontent.com/DoubleLabyrinth/navicat-keygen/windows/bash/navicat-keygen.sh && \
|
||||
chmod +x navicat-keygen.sh
|
||||
```
|
||||
|
||||
4. Use `navicat-patcher.exe` to replace __Navicat Activation Public Key__ that is stored in `navicat.exe` or `libcc.dll`.
|
||||
|
||||
> Please turn off `Navicat` when performing this step.
|
||||
|
||||
```bash
|
||||
./navicat-patcher.sh
|
||||
```
|
||||
|
||||
It has been tested on __Navicat Premium 12.1.12 Simplified Chinese version__. The following is an example of output.
|
||||
|
||||
```
|
||||
***************************************************
|
||||
* Navicat Patcher by @DoubleLabyrinth *
|
||||
* Release date: Jan 19 2019 *
|
||||
***************************************************
|
||||
|
||||
Press Enter to continue or Ctrl + C to abort.
|
||||
|
||||
MESSAGE: PatchSolution0 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution3: Keywords[0] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a08
|
||||
Relative Machine Code RVA = +0x0000000001645608
|
||||
Patch Offset = +0x00000000023d56e4
|
||||
Patch Size = 3 byte(s)
|
||||
...
|
||||
...
|
||||
...
|
||||
MESSAGE: PatchSolution3: Keywords[110] has been found:
|
||||
Relative Machine Code Offset = +0x000000000165155e
|
||||
Relative Machine Code RVA = +0x000000000165215e
|
||||
Patch Offset = +0x0000000001651561
|
||||
Patch Size = 1 byte(s)
|
||||
|
||||
MESSAGE: PatchSolution2 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution1: Keywords[0] has been found: offset = +0x021f7390.
|
||||
MESSAGE: PatchSolution1: Keywords[1] has been found: offset = +0x0074bd39.
|
||||
MESSAGE: PatchSolution1: Keywords[2] has been found: offset = +0x021f70a0.
|
||||
MESSAGE: PatchSolution1: Keywords[3] has been found: offset = +0x0074bd1f.
|
||||
MESSAGE: PatchSolution1: Keywords[4] has been found: offset = +0x021f708c.
|
||||
|
||||
MESSAGE: Generating new RSA private key, it may take a long time.
|
||||
MESSAGE: New RSA private key has been saved to RegPrivateKey.pem.
|
||||
|
||||
Your RSA public key:
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWnV5hQxlXvDA3Ad4k5N
|
||||
ZLz4cO+iGEPegSovIDcwTo097I+0pXYKPTVl+0iKC5JtJRObb4Xx9yK9gGwqkcxo
|
||||
o6WzKq0xY1jz7X6obxwlQCNse3Os1wr0rIY0UzP1dCpkW/5MwGbFxiB6PEVqkzmJ
|
||||
CmHBzZDRu/jAuL1nyoiGnUStqwENNYhyl4k7r8AiJkBZGMOCrj6v0JfgNna25Ce6
|
||||
QCFojlY4dkYQ5/7njQ3qpLwMeLEXEysMW3aUScSB68/vsHnB4C0fIkwfEPYZ/AC5
|
||||
AqbWHVbNmveB3rjV+tZZxXcLE8ArgKh1Gs+2VtnL09gwHm6WcpyPZ42G6tMDjWyw
|
||||
1wIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
|
||||
******************************************
|
||||
* PatchSulution3 *
|
||||
******************************************
|
||||
@ +023d56e4: 4D 49 49 ---> 4D 49 49
|
||||
@ +01644a63: 42 49 ---> 42 49
|
||||
@ +01644a68: 6A ---> 6A
|
||||
@ +01644ace: 41 ---> 41
|
||||
...
|
||||
...
|
||||
...
|
||||
@ +023d58d4: 36 63 6A ---> 47 36 74
|
||||
@ +023d58d8: 78 6C 6A 75 75 51 61 ---> 4D 44 6A 57 79 77 31
|
||||
@ +023d58e8: 77 49 44 41 ---> 77 49 44 41
|
||||
@ +0165155c: 51 41 ---> 51 41
|
||||
@ +01651561: 42 ---> 42
|
||||
|
||||
******************************************
|
||||
* PatchSulution1 *
|
||||
******************************************
|
||||
@ +0x021f7390
|
||||
Previous:
|
||||
+0x00000000021F7390 44 37 35 31 32 35 42 37 30 37 36 37 42 39 34 31 D75125B70767B941
|
||||
+0x00000000021F73A0 34 35 42 34 37 43 31 43 42 33 43 30 37 35 35 45 45B47C1CB3C0755E
|
||||
+0x00000000021F73B0 37 43 43 42 38 38 32 35 43 35 44 43 45 30 43 35 7CCB8825C5DCE0C5
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
@ +0x021f708c
|
||||
Previous:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 39 32 39 33 1225OE).....9293
|
||||
+0x00000000021F7090 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3...............
|
||||
After:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 32 37 45 38 1225OE).....27E8
|
||||
+0x00000000021F7090 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E...............
|
||||
|
||||
MESSAGE: Patch has been done successfully.
|
||||
```
|
||||
|
||||
5. Then use `navicat-keygen.exe` to generate __snKey__ and __Activation Code__
|
||||
|
||||
```
|
||||
./navicat-keygen.sh
|
||||
```
|
||||
|
||||
You will be asked to select Navicat product, language and input major version number. After that an randomly generated __snKey__ will be given.
|
||||
|
||||
```
|
||||
Select Navicat product:
|
||||
0. DataModeler
|
||||
1. Premium
|
||||
2. MySQL
|
||||
3. PostgreSQL
|
||||
4. Oracle
|
||||
5. SQLServer
|
||||
6. SQLite
|
||||
7. MariaDB
|
||||
8. MongoDB
|
||||
9. ReportViewer
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
Select product language:
|
||||
0. English
|
||||
1. Simplified Chinese
|
||||
2. Traditional Chinese
|
||||
3. Japanese
|
||||
4. Polish
|
||||
5. Spanish
|
||||
6. French
|
||||
7. German
|
||||
8. Korean
|
||||
9. Russian
|
||||
10. Portuguese
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
(Input major version number, range: 0 ~ 15, default: 12)> 12
|
||||
|
||||
Serial number:
|
||||
NAVO-2ORP-IN5A-GQEE
|
||||
|
||||
Your name:
|
||||
```
|
||||
|
||||
You can use this __snKey__ to activate your Navicat preliminarily.
|
||||
|
||||
Then you will be asked to input `Your name` and `Your organization`. Just set them whatever you want, but not too long.
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
Input request code (in Base64), input empty line to end:
|
||||
```
|
||||
|
||||
After that, you will be asked to input the request code. Now __DO NOT CLOSE KEYGEN__.
|
||||
|
||||
6. __Set up__ a invalid proxy. Find and click `Registration`. Fill `Registration Key` by __snKey__ that the keygen gave and click `Activate`.
|
||||
|
||||
7. Online activation will failed and Navicat will ask you do `Manual Activation`, just choose it.
|
||||
|
||||
8. Copy your request code and paste it in the keygen. Input empty line to tell the keygen that your input ends.
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
|
||||
Input request code (in Base64), input empty line to end:
|
||||
t2U+0yfE2FfnbjyhCXa0lglZOHu9Ntc3qyGiPbR6xb1QoU63/9BVfdaCq0blwVycXPyT/Vqw5joIKdM5oCRR/afCPM7iRcyhQMAnvqwc+AOKCqayVV+SqKLvtR/AbREI12w++PQ6Ewfs4A8PgB8OJ9G0jKt6Q/iJRblqi2WWw9mwy+YHcYYh3UAfygTnyj/xl+MzRymbY0lkus+6LPtpDecVsFFhM7F32Ee1QPwISko7bAkHOtkt+joPfYDdn9PDGZ4HEmeLvH6UqZCXkzgaAfynB7cQZFEkId8FsW2NGkbpM7wB2Hi3fNFgOIjutTprixTdbpFKn4w6gGc28ve23A==
|
||||
|
||||
Request Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE", "DI":"R91j6WyMhxHznAKSxxxx", "P":"WIN"}
|
||||
|
||||
Response Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE","DI":"R91j6WyMhxHznAKSxxxx","N":"DoubleLabyrinth","O":"DoubleLabyrinth","T":1547826060}
|
||||
|
||||
License:
|
||||
lRF18o+ZhBphyN0U5kFLHtAAGGXuvhqOcxNuvAk4dJcGeR0ISuw74mQvAfdNjv0T
|
||||
I5NZFzqIJvrzM0XeR88q+3kmZkECuxwwWHP3zzDPhPiylcTV4DoGZ1tfoViUSYQc
|
||||
LgXG0Fl7koZeP61YOKQ8GfX+Xk2ZTM64bYaF7NlhonM+GQUJCCF2JThmrP921t2p
|
||||
b/E5pV6fLOYMM13881ZQcQcltMNVDZn4lzgzKRFFxCQFaTl6fJMHZdYVmICQTHtI
|
||||
sNaym0zduc8/cv34mgJ+7NseXmsEPCdjrZ59wgfPsLhZLXqtfxi5hGWw4NMa3Sb2
|
||||
UI8dzqFzRp/hSDEM0mEqiA==
|
||||
```
|
||||
|
||||
7. Finally, you will get __Activation Code__ which looks like a Base64 string. Just copy it and paste it in Navicat `Manual Activation` window, then click `Activate`. If nothing wrong, activation should be done successfully. Don't forget to close the proxy that we just set up.
|
||||
|
||||
@@ -0,0 +1,224 @@
|
||||
# Navicat Keygen - for Linux
|
||||
|
||||
## 如何使用这个注册机
|
||||
|
||||
> 可下载[录屏文件](image/Screen_recording.mp4)参考
|
||||
|
||||
1. 切换到解压安装包的路径,本示例解压到了`家目录`,运行Navicat,使其初始化环境:
|
||||
|
||||
```bash
|
||||
cd ~/navicat121_premium_en_x64 && \
|
||||
./start_navicat
|
||||
```
|
||||
|
||||
首次启动时,会提示如下两个窗口,点击“Cancel”即可:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
直至出现`Registration`窗口,选择`Trial`,待加载完成后关闭Navicat,执行`步骤2`:
|
||||
|
||||

|
||||
|
||||
2. [从这里](https://github.com/DoubleLabyrinth/navicat-keygen/releases)下载最新的release,并且解压:
|
||||
|
||||
> 此处下载的是64位的可执行文件,若您使用32位,请下载对应版本
|
||||
|
||||
```bash
|
||||
curl -O -L https://github.com/DoubleLabyrinth/navicat-keygen/releases/download/v3.1/navicat-keygen-for-x64.zip && \
|
||||
unzip navicat-keygen-for-x64.zip
|
||||
```
|
||||
|
||||
3. 下载`navicat-pacther.sh`和`navicat-keygen.sh`:
|
||||
|
||||
```bash
|
||||
curl -O -L https://raw.githubusercontent.com/DoubleLabyrinth/navicat-keygen/windows/bash/navicat-patcher.sh && \
|
||||
chmod +x navicat-patcher.sh && \
|
||||
curl -O -L https://raw.githubusercontent.com/DoubleLabyrinth/navicat-keygen/windows/bash/navicat-keygen.sh && \
|
||||
chmod +x navicat-keygen.sh
|
||||
```
|
||||
|
||||
4. 使用`navicat-patcher.exe`替换掉`navicat.exe`和`libcc.dll`里的Navicat激活公钥。
|
||||
|
||||
> 执行此步骤时,请将`Navicat`关闭
|
||||
|
||||
```bash
|
||||
./navicat-patcher.sh
|
||||
```
|
||||
|
||||
__Navicat Premium 12.1.12 简体中文版已通过测试__。下面将是一份样例输出。
|
||||
|
||||
```
|
||||
***************************************************
|
||||
* Navicat Patcher by @DoubleLabyrinth *
|
||||
* Release date: Jan 19 2019 *
|
||||
***************************************************
|
||||
|
||||
Press Enter to continue or Ctrl + C to abort.
|
||||
|
||||
MESSAGE: PatchSolution0 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution3: Keywords[0] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a08
|
||||
Relative Machine Code RVA = +0x0000000001645608
|
||||
Patch Offset = +0x00000000023d56e4
|
||||
Patch Size = 3 byte(s)
|
||||
...
|
||||
...
|
||||
...
|
||||
MESSAGE: PatchSolution3: Keywords[110] has been found:
|
||||
Relative Machine Code Offset = +0x000000000165155e
|
||||
Relative Machine Code RVA = +0x000000000165215e
|
||||
Patch Offset = +0x0000000001651561
|
||||
Patch Size = 1 byte(s)
|
||||
|
||||
MESSAGE: PatchSolution2 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution1: Keywords[0] has been found: offset = +0x021f7390.
|
||||
MESSAGE: PatchSolution1: Keywords[1] has been found: offset = +0x0074bd39.
|
||||
MESSAGE: PatchSolution1: Keywords[2] has been found: offset = +0x021f70a0.
|
||||
MESSAGE: PatchSolution1: Keywords[3] has been found: offset = +0x0074bd1f.
|
||||
MESSAGE: PatchSolution1: Keywords[4] has been found: offset = +0x021f708c.
|
||||
|
||||
MESSAGE: Generating new RSA private key, it may take a long time.
|
||||
MESSAGE: New RSA private key has been saved to RegPrivateKey.pem.
|
||||
|
||||
Your RSA public key:
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWnV5hQxlXvDA3Ad4k5N
|
||||
ZLz4cO+iGEPegSovIDcwTo097I+0pXYKPTVl+0iKC5JtJRObb4Xx9yK9gGwqkcxo
|
||||
o6WzKq0xY1jz7X6obxwlQCNse3Os1wr0rIY0UzP1dCpkW/5MwGbFxiB6PEVqkzmJ
|
||||
CmHBzZDRu/jAuL1nyoiGnUStqwENNYhyl4k7r8AiJkBZGMOCrj6v0JfgNna25Ce6
|
||||
QCFojlY4dkYQ5/7njQ3qpLwMeLEXEysMW3aUScSB68/vsHnB4C0fIkwfEPYZ/AC5
|
||||
AqbWHVbNmveB3rjV+tZZxXcLE8ArgKh1Gs+2VtnL09gwHm6WcpyPZ42G6tMDjWyw
|
||||
1wIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
|
||||
******************************************
|
||||
* PatchSulution3 *
|
||||
******************************************
|
||||
@ +023d56e4: 4D 49 49 ---> 4D 49 49
|
||||
@ +01644a63: 42 49 ---> 42 49
|
||||
@ +01644a68: 6A ---> 6A
|
||||
@ +01644ace: 41 ---> 41
|
||||
...
|
||||
...
|
||||
...
|
||||
@ +023d58d4: 36 63 6A ---> 47 36 74
|
||||
@ +023d58d8: 78 6C 6A 75 75 51 61 ---> 4D 44 6A 57 79 77 31
|
||||
@ +023d58e8: 77 49 44 41 ---> 77 49 44 41
|
||||
@ +0165155c: 51 41 ---> 51 41
|
||||
@ +01651561: 42 ---> 42
|
||||
|
||||
******************************************
|
||||
* PatchSulution1 *
|
||||
******************************************
|
||||
@ +0x021f7390
|
||||
Previous:
|
||||
+0x00000000021F7390 44 37 35 31 32 35 42 37 30 37 36 37 42 39 34 31 D75125B70767B941
|
||||
+0x00000000021F73A0 34 35 42 34 37 43 31 43 42 33 43 30 37 35 35 45 45B47C1CB3C0755E
|
||||
+0x00000000021F73B0 37 43 43 42 38 38 32 35 43 35 44 43 45 30 43 35 7CCB8825C5DCE0C5
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
@ +0x021f708c
|
||||
Previous:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 39 32 39 33 1225OE).....9293
|
||||
+0x00000000021F7090 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3...............
|
||||
After:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 32 37 45 38 1225OE).....27E8
|
||||
+0x00000000021F7090 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E...............
|
||||
|
||||
MESSAGE: Patch has been done successfully.
|
||||
```
|
||||
|
||||
5. 接下来使用`navicat-keygen.exe`来生成序列号和激活码
|
||||
|
||||
```
|
||||
./navicat-keygen.sh
|
||||
```
|
||||
|
||||
你会被要求选择Navicat产品类别、语言以及输入主版本号。之后会随机生成一个序列号。
|
||||
|
||||
```
|
||||
Select Navicat product:
|
||||
0. DataModeler
|
||||
1. Premium
|
||||
2. MySQL
|
||||
3. PostgreSQL
|
||||
4. Oracle
|
||||
5. SQLServer
|
||||
6. SQLite
|
||||
7. MariaDB
|
||||
8. MongoDB
|
||||
9. ReportViewer
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
Select product language:
|
||||
0. English
|
||||
1. Simplified Chinese
|
||||
2. Traditional Chinese
|
||||
3. Japanese
|
||||
4. Polish
|
||||
5. Spanish
|
||||
6. French
|
||||
7. German
|
||||
8. Korean
|
||||
9. Russian
|
||||
10. Portuguese
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
(Input major version number, range: 0 ~ 15, default: 12)> 12
|
||||
|
||||
Serial number:
|
||||
NAVO-2ORP-IN5A-GQEE
|
||||
|
||||
Your name:
|
||||
```
|
||||
|
||||
你可以使用这个序列号暂时激活Navicat。
|
||||
|
||||
接下来你会被要求输入`用户名`和`组织名`;请随便填写,但不要太长。
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
Input request code (in Base64), input empty line to end:
|
||||
```
|
||||
|
||||
之后你会被要求填入请求码。注意 __不要关闭命令行__.
|
||||
|
||||
6. 配置一个不存在的`代理`。找到`注册`窗口,并填入keygen给你的序列号。然后点击`激活`按钮。
|
||||
|
||||
7. 在线激活失败,这时候Navicat会询问你是否`手动激活`,直接选吧。
|
||||
|
||||
8. 在`手动激活`窗口你会得到一个请求码,复制它并把它粘贴到keygen里。最后别忘了连按至少两下回车结束输入。
|
||||
|
||||
```bash
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
|
||||
Input request code (in Base64), input empty line to end:
|
||||
t2U+0yfE2FfnbjyhCXa0lglZOHu9Ntc3qyGiPbR6xb1QoU63/9BVfdaCq0blwVycXPyT/Vqw5joIKdM5oCRR/afCPM7iRcyhQMAnvqwc+AOKCqayVV+SqKLvtR/AbREI12w++PQ6Ewfs4A8PgB8OJ9G0jKt6Q/iJRblqi2WWw9mwy+YHcYYh3UAfygTnyj/xl+MzRymbY0lkus+6LPtpDecVsFFhM7F32Ee1QPwISko7bAkHOtkt+joPfYDdn9PDGZ4HEmeLvH6UqZCXkzgaAfynB7cQZFEkId8FsW2NGkbpM7wB2Hi3fNFgOIjutTprixTdbpFKn4w6gGc28ve23A==
|
||||
|
||||
Request Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE", "DI":"R91j6WyMhxHznAKSxxxx", "P":"WIN"}
|
||||
|
||||
Response Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE","DI":"R91j6WyMhxHznAKSxxxx","N":"DoubleLabyrinth","O":"DoubleLabyrinth","T":1547826060}
|
||||
|
||||
License:
|
||||
lRF18o+ZhBphyN0U5kFLHtAAGGXuvhqOcxNuvAk4dJcGeR0ISuw74mQvAfdNjv0T
|
||||
I5NZFzqIJvrzM0XeR88q+3kmZkECuxwwWHP3zzDPhPiylcTV4DoGZ1tfoViUSYQc
|
||||
LgXG0Fl7koZeP61YOKQ8GfX+Xk2ZTM64bYaF7NlhonM+GQUJCCF2JThmrP921t2p
|
||||
b/E5pV6fLOYMM13881ZQcQcltMNVDZn4lzgzKRFFxCQFaTl6fJMHZdYVmICQTHtI
|
||||
sNaym0zduc8/cv34mgJ+7NseXmsEPCdjrZ59wgfPsLhZLXqtfxi5hGWw4NMa3Sb2
|
||||
UI8dzqFzRp/hSDEM0mEqiA==
|
||||
```
|
||||
|
||||
9. 如果不出意外,你会得到一个看似用Base64编码的激活码。直接复制它,并把它粘贴到Navicat的`手动激活`窗口,最后点`激活`按钮。如果没什么意外的话应该能成功激活。别忘了关闭我们刚刚设置的不存在的代理哦。
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
# Navicat Keygen - for Windows
|
||||
|
||||
[中文版README](README_FOR_WINDOWS.zh-CN.md)
|
||||
|
||||
## How to use?
|
||||
|
||||
1. Download the latest release [from here](https://github.com/DoubleLabyrinth/navicat-keygen/releases).
|
||||
|
||||
2. Use `navicat-patcher.exe` to replace __Navicat Activation Public Key__ that is stored in `navicat.exe` or `libcc.dll`.
|
||||
|
||||
```
|
||||
navicat-patcher.exe <Navicat installation path> [RSA-2048 PEM file]
|
||||
```
|
||||
|
||||
* `<Navicat installation path>`: The full path to Navicat installation folder.
|
||||
|
||||
__This parameter must be specified.__
|
||||
|
||||
* `[RSA-2048 PEM file]`: The full path or relative path to a RSA-2048 private key file.
|
||||
|
||||
__This parameter is optional.__ If not specified, `navicat-patcher.exe` will generate a new RSA-2048 private key file `RegPrivateKey.pem` at current directory.
|
||||
|
||||
__Example: (in cmd.exe)__
|
||||
|
||||
```
|
||||
navicat-patcher.exe "C:\Program Files\PremiumSoft\Navicat Premium 12"
|
||||
```
|
||||
|
||||
It has been tested on __Navicat Premium 12.1.12 Simplified Chinese version__. The following is an example of output.
|
||||
|
||||
```
|
||||
***************************************************
|
||||
* Navicat Patcher by @DoubleLabyrinth *
|
||||
* Release date: Jan 19 2019 *
|
||||
***************************************************
|
||||
|
||||
Press Enter to continue or Ctrl + C to abort.
|
||||
|
||||
MESSAGE: PatchSolution0 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution3: Keywords[0] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a08
|
||||
Relative Machine Code RVA = +0x0000000001645608
|
||||
Patch Offset = +0x00000000023d56e4
|
||||
Patch Size = 3 byte(s)
|
||||
...
|
||||
...
|
||||
...
|
||||
MESSAGE: PatchSolution3: Keywords[110] has been found:
|
||||
Relative Machine Code Offset = +0x000000000165155e
|
||||
Relative Machine Code RVA = +0x000000000165215e
|
||||
Patch Offset = +0x0000000001651561
|
||||
Patch Size = 1 byte(s)
|
||||
|
||||
MESSAGE: PatchSolution2 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution1: Keywords[0] has been found: offset = +0x021f7390.
|
||||
MESSAGE: PatchSolution1: Keywords[1] has been found: offset = +0x0074bd39.
|
||||
MESSAGE: PatchSolution1: Keywords[2] has been found: offset = +0x021f70a0.
|
||||
MESSAGE: PatchSolution1: Keywords[3] has been found: offset = +0x0074bd1f.
|
||||
MESSAGE: PatchSolution1: Keywords[4] has been found: offset = +0x021f708c.
|
||||
|
||||
MESSAGE: Generating new RSA private key, it may take a long time.
|
||||
MESSAGE: New RSA private key has been saved to RegPrivateKey.pem.
|
||||
|
||||
Your RSA public key:
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWnV5hQxlXvDA3Ad4k5N
|
||||
ZLz4cO+iGEPegSovIDcwTo097I+0pXYKPTVl+0iKC5JtJRObb4Xx9yK9gGwqkcxo
|
||||
o6WzKq0xY1jz7X6obxwlQCNse3Os1wr0rIY0UzP1dCpkW/5MwGbFxiB6PEVqkzmJ
|
||||
CmHBzZDRu/jAuL1nyoiGnUStqwENNYhyl4k7r8AiJkBZGMOCrj6v0JfgNna25Ce6
|
||||
QCFojlY4dkYQ5/7njQ3qpLwMeLEXEysMW3aUScSB68/vsHnB4C0fIkwfEPYZ/AC5
|
||||
AqbWHVbNmveB3rjV+tZZxXcLE8ArgKh1Gs+2VtnL09gwHm6WcpyPZ42G6tMDjWyw
|
||||
1wIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
|
||||
******************************************
|
||||
* PatchSulution3 *
|
||||
******************************************
|
||||
@ +023d56e4: 4D 49 49 ---> 4D 49 49
|
||||
@ +01644a63: 42 49 ---> 42 49
|
||||
@ +01644a68: 6A ---> 6A
|
||||
@ +01644ace: 41 ---> 41
|
||||
...
|
||||
...
|
||||
...
|
||||
@ +023d58d4: 36 63 6A ---> 47 36 74
|
||||
@ +023d58d8: 78 6C 6A 75 75 51 61 ---> 4D 44 6A 57 79 77 31
|
||||
@ +023d58e8: 77 49 44 41 ---> 77 49 44 41
|
||||
@ +0165155c: 51 41 ---> 51 41
|
||||
@ +01651561: 42 ---> 42
|
||||
|
||||
******************************************
|
||||
* PatchSulution1 *
|
||||
******************************************
|
||||
@ +0x021f7390
|
||||
Previous:
|
||||
+0x00000000021F7390 44 37 35 31 32 35 42 37 30 37 36 37 42 39 34 31 D75125B70767B941
|
||||
+0x00000000021F73A0 34 35 42 34 37 43 31 43 42 33 43 30 37 35 35 45 45B47C1CB3C0755E
|
||||
+0x00000000021F73B0 37 43 43 42 38 38 32 35 43 35 44 43 45 30 43 35 7CCB8825C5DCE0C5
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
@ +0x021f708c
|
||||
Previous:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 39 32 39 33 1225OE).....9293
|
||||
+0x00000000021F7090 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3...............
|
||||
After:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 32 37 45 38 1225OE).....27E8
|
||||
+0x00000000021F7090 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E...............
|
||||
|
||||
MESSAGE: Patch has been done successfully.
|
||||
```
|
||||
|
||||
3. Then use `navicat-keygen.exe` to generate __snKey__ and __Activation Code__
|
||||
|
||||
```
|
||||
navicat-keygen.exe <-bin|-text> [-adv] <RSA-2048 PrivateKey(PEM file)>
|
||||
```
|
||||
|
||||
* `<-bin|-text>`: Must be `-bin` or `-text`.
|
||||
|
||||
If `-bin` is specified, `navicat-keygen.exe` will finally generate `license_file`. It is used for Navicat old activation method only.
|
||||
|
||||
If `-text` is specified, `navicat-keygen.exe` will finally generate a Base64-style string which is __Activation Code__. It is used for Navicat new activation method.
|
||||
|
||||
__This parameter must be specified.__
|
||||
|
||||
* `[-adv]`: Enable advanced mode.
|
||||
|
||||
__This parameter is optional.__ If specified, `navicat-keygen.exe` will ask you input Navicat product ID number, language signature numbers. It is for future use generally.
|
||||
|
||||
* `<RSA-2048 PrivateKey(PEM file)>`: The full path or relative path to a RSA-2048 private key file.
|
||||
|
||||
__This parameter must be specified.__
|
||||
|
||||
__Example: (in cmd.exe)__
|
||||
|
||||
```bash
|
||||
navicat-keygen.exe -text .\RegPrivateKey.pem
|
||||
```
|
||||
|
||||
You will be asked to select Navicat product, language and input major version number. After that an randomly generated __snKey__ will be given.
|
||||
|
||||
```
|
||||
Select Navicat product:
|
||||
0. DataModeler
|
||||
1. Premium
|
||||
2. MySQL
|
||||
3. PostgreSQL
|
||||
4. Oracle
|
||||
5. SQLServer
|
||||
6. SQLite
|
||||
7. MariaDB
|
||||
8. MongoDB
|
||||
9. ReportViewer
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
Select product language:
|
||||
0. English
|
||||
1. Simplified Chinese
|
||||
2. Traditional Chinese
|
||||
3. Japanese
|
||||
4. Polish
|
||||
5. Spanish
|
||||
6. French
|
||||
7. German
|
||||
8. Korean
|
||||
9. Russian
|
||||
10. Portuguese
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
(Input major version number, range: 0 ~ 15, default: 12)> 12
|
||||
|
||||
Serial number:
|
||||
NAVO-2ORP-IN5A-GQEE
|
||||
|
||||
Your name:
|
||||
```
|
||||
|
||||
You can use this __snKey__ to activate your Navicat preliminarily.
|
||||
|
||||
Then you will be asked to input `Your name` and `Your organization`. Just set them whatever you want, but not too long.
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
Input request code (in Base64), input empty line to end:
|
||||
```
|
||||
|
||||
After that, you will be asked to input the request code. Now __DO NOT CLOSE KEYGEN__.
|
||||
|
||||
4. __Disconnect your network__ and open Navicat. Find and click `Registration`. Fill `Registration Key` by __snKey__ that the keygen gave and click `Activate`.
|
||||
|
||||
5. Generally online activation will failed and Navicat will ask you do `Manual Activation`, just choose it.
|
||||
|
||||
6. Copy your request code and paste it in the keygen. Input empty line to tell the keygen that your input ends.
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
|
||||
Input request code (in Base64), input empty line to end:
|
||||
t2U+0yfE2FfnbjyhCXa0lglZOHu9Ntc3qyGiPbR6xb1QoU63/9BVfdaCq0blwVycXPyT/Vqw5joIKdM5oCRR/afCPM7iRcyhQMAnvqwc+AOKCqayVV+SqKLvtR/AbREI12w++PQ6Ewfs4A8PgB8OJ9G0jKt6Q/iJRblqi2WWw9mwy+YHcYYh3UAfygTnyj/xl+MzRymbY0lkus+6LPtpDecVsFFhM7F32Ee1QPwISko7bAkHOtkt+joPfYDdn9PDGZ4HEmeLvH6UqZCXkzgaAfynB7cQZFEkId8FsW2NGkbpM7wB2Hi3fNFgOIjutTprixTdbpFKn4w6gGc28ve23A==
|
||||
|
||||
Request Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE", "DI":"R91j6WyMhxHznAKSxxxx", "P":"WIN"}
|
||||
|
||||
Response Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE","DI":"R91j6WyMhxHznAKSxxxx","N":"DoubleLabyrinth","O":"DoubleLabyrinth","T":1547826060}
|
||||
|
||||
License:
|
||||
lRF18o+ZhBphyN0U5kFLHtAAGGXuvhqOcxNuvAk4dJcGeR0ISuw74mQvAfdNjv0T
|
||||
I5NZFzqIJvrzM0XeR88q+3kmZkECuxwwWHP3zzDPhPiylcTV4DoGZ1tfoViUSYQc
|
||||
LgXG0Fl7koZeP61YOKQ8GfX+Xk2ZTM64bYaF7NlhonM+GQUJCCF2JThmrP921t2p
|
||||
b/E5pV6fLOYMM13881ZQcQcltMNVDZn4lzgzKRFFxCQFaTl6fJMHZdYVmICQTHtI
|
||||
sNaym0zduc8/cv34mgJ+7NseXmsEPCdjrZ59wgfPsLhZLXqtfxi5hGWw4NMa3Sb2
|
||||
UI8dzqFzRp/hSDEM0mEqiA==
|
||||
```
|
||||
|
||||
7. Finally, you will get __Activation Code__ which looks like a Base64 string. Just copy it and paste it in Navicat `Manual Activation` window, then click `Activate`. If nothing wrong, activation should be done successfully.
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
# Navicat Keygen - for Windows
|
||||
|
||||
## 如何使用这个注册机
|
||||
|
||||
1. [从这里](https://github.com/DoubleLabyrinth/navicat-keygen/releases)下载最新的release。
|
||||
|
||||
2. 使用`navicat-patcher.exe`替换掉`navicat.exe`和`libcc.dll`里的Navicat激活公钥。
|
||||
|
||||
```
|
||||
navicat-patcher.exe <Navicat installation path> [RSA-2048 PEM file]
|
||||
```
|
||||
|
||||
* `<Navicat installation path>`: Navicat的完整安装路径。
|
||||
|
||||
__这个参数必须指定。__
|
||||
|
||||
* `[RSA-2048 PEM file]`: RSA-2048私钥文件的完整路径或相对路径。
|
||||
|
||||
__这个参数是可选的。__ 如果未指定,`navicat-patcher.exe`将会在当前目录生成一个新的RSA-2048私钥文件。
|
||||
|
||||
__例如:(在cmd.exe中)__
|
||||
|
||||
```
|
||||
navicat-patcher.exe "C:\Program Files\PremiumSoft\Navicat Premium 12"
|
||||
```
|
||||
|
||||
__Navicat Premium 12.1.12 简体中文版已通过测试__。下面将是一份样例输出。
|
||||
|
||||
```
|
||||
***************************************************
|
||||
* Navicat Patcher by @DoubleLabyrinth *
|
||||
* Release date: Jan 19 2019 *
|
||||
***************************************************
|
||||
|
||||
Press Enter to continue or Ctrl + C to abort.
|
||||
|
||||
MESSAGE: PatchSolution0 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution3: Keywords[0] has been found:
|
||||
Relative Machine Code Offset = +0x0000000001644a08
|
||||
Relative Machine Code RVA = +0x0000000001645608
|
||||
Patch Offset = +0x00000000023d56e4
|
||||
Patch Size = 3 byte(s)
|
||||
...
|
||||
...
|
||||
...
|
||||
MESSAGE: PatchSolution3: Keywords[110] has been found:
|
||||
Relative Machine Code Offset = +0x000000000165155e
|
||||
Relative Machine Code RVA = +0x000000000165215e
|
||||
Patch Offset = +0x0000000001651561
|
||||
Patch Size = 1 byte(s)
|
||||
|
||||
MESSAGE: PatchSolution2 will be omitted.
|
||||
|
||||
MESSAGE: PatchSolution1: Keywords[0] has been found: offset = +0x021f7390.
|
||||
MESSAGE: PatchSolution1: Keywords[1] has been found: offset = +0x0074bd39.
|
||||
MESSAGE: PatchSolution1: Keywords[2] has been found: offset = +0x021f70a0.
|
||||
MESSAGE: PatchSolution1: Keywords[3] has been found: offset = +0x0074bd1f.
|
||||
MESSAGE: PatchSolution1: Keywords[4] has been found: offset = +0x021f708c.
|
||||
|
||||
MESSAGE: Generating new RSA private key, it may take a long time.
|
||||
MESSAGE: New RSA private key has been saved to RegPrivateKey.pem.
|
||||
|
||||
Your RSA public key:
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsWnV5hQxlXvDA3Ad4k5N
|
||||
ZLz4cO+iGEPegSovIDcwTo097I+0pXYKPTVl+0iKC5JtJRObb4Xx9yK9gGwqkcxo
|
||||
o6WzKq0xY1jz7X6obxwlQCNse3Os1wr0rIY0UzP1dCpkW/5MwGbFxiB6PEVqkzmJ
|
||||
CmHBzZDRu/jAuL1nyoiGnUStqwENNYhyl4k7r8AiJkBZGMOCrj6v0JfgNna25Ce6
|
||||
QCFojlY4dkYQ5/7njQ3qpLwMeLEXEysMW3aUScSB68/vsHnB4C0fIkwfEPYZ/AC5
|
||||
AqbWHVbNmveB3rjV+tZZxXcLE8ArgKh1Gs+2VtnL09gwHm6WcpyPZ42G6tMDjWyw
|
||||
1wIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
|
||||
******************************************
|
||||
* PatchSulution3 *
|
||||
******************************************
|
||||
@ +023d56e4: 4D 49 49 ---> 4D 49 49
|
||||
@ +01644a63: 42 49 ---> 42 49
|
||||
@ +01644a68: 6A ---> 6A
|
||||
@ +01644ace: 41 ---> 41
|
||||
...
|
||||
...
|
||||
...
|
||||
@ +023d58d4: 36 63 6A ---> 47 36 74
|
||||
@ +023d58d8: 78 6C 6A 75 75 51 61 ---> 4D 44 6A 57 79 77 31
|
||||
@ +023d58e8: 77 49 44 41 ---> 77 49 44 41
|
||||
@ +0165155c: 51 41 ---> 51 41
|
||||
@ +01651561: 42 ---> 42
|
||||
|
||||
******************************************
|
||||
* PatchSulution1 *
|
||||
******************************************
|
||||
@ +0x021f7390
|
||||
Previous:
|
||||
+0x00000000021F7390 44 37 35 31 32 35 42 37 30 37 36 37 42 39 34 31 D75125B70767B941
|
||||
+0x00000000021F73A0 34 35 42 34 37 43 31 43 42 33 43 30 37 35 35 45 45B47C1CB3C0755E
|
||||
+0x00000000021F73B0 37 43 43 42 38 38 32 35 43 35 44 43 45 30 43 35 7CCB8825C5DCE0C5
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
@ +0x021f708c
|
||||
Previous:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 39 32 39 33 1225OE).....9293
|
||||
+0x00000000021F7090 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3...............
|
||||
After:
|
||||
+0x00000000021F7080 31 32 32 35 4f 45 29 2e 00 00 00 00 32 37 45 38 1225OE).....27E8
|
||||
+0x00000000021F7090 45 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 E...............
|
||||
|
||||
MESSAGE: Patch has been done successfully.
|
||||
```
|
||||
|
||||
3. 接下来使用`navicat-keygen.exe`来生成序列号和激活码
|
||||
|
||||
```
|
||||
navicat-keygen.exe <-bin|-text> [-adv] <RSA-2048 PrivateKey(PEM file)>
|
||||
```
|
||||
|
||||
* `<-bin|-text>`: 必须是`-bin`或`-text`。
|
||||
|
||||
如果指定了`-bin`,`navicat-keygen.exe`最终将生成`license_file`文件。这个选项是给Navicat旧激活方式使用的。
|
||||
|
||||
如果指定了`-text`,`navicat-keygen.exe`最终将生成Base64样式的激活码。这个选项是给Navicat新激活方式使用的。
|
||||
|
||||
__这个参数必须指定。__
|
||||
|
||||
* `[-adv]`: 开启高级模式。
|
||||
|
||||
__这个参数是可选的。__ 如果指定了这个参数,`navicat-keygen.exe`将会要求你手工填写产品ID号、语言标识号。这个选项一般是给以后用的。
|
||||
|
||||
* `<RSA-2048 PrivateKey(PEM file)>`: RSA-2048私钥文件的完整路径或相对路径。
|
||||
|
||||
__这个参数必须指定。__
|
||||
|
||||
__例如:(在cmd.exe中)__
|
||||
|
||||
```bash
|
||||
navicat-keygen.exe -text .\RegPrivateKey.pem
|
||||
```
|
||||
|
||||
你会被要求选择Navicat产品类别、语言以及输入主版本号。之后会随机生成一个序列号。
|
||||
|
||||
```
|
||||
Select Navicat product:
|
||||
0. DataModeler
|
||||
1. Premium
|
||||
2. MySQL
|
||||
3. PostgreSQL
|
||||
4. Oracle
|
||||
5. SQLServer
|
||||
6. SQLite
|
||||
7. MariaDB
|
||||
8. MongoDB
|
||||
9. ReportViewer
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
Select product language:
|
||||
0. English
|
||||
1. Simplified Chinese
|
||||
2. Traditional Chinese
|
||||
3. Japanese
|
||||
4. Polish
|
||||
5. Spanish
|
||||
6. French
|
||||
7. German
|
||||
8. Korean
|
||||
9. Russian
|
||||
10. Portuguese
|
||||
|
||||
(Input index)> 1
|
||||
|
||||
(Input major version number, range: 0 ~ 15, default: 12)> 12
|
||||
|
||||
Serial number:
|
||||
NAVO-2ORP-IN5A-GQEE
|
||||
|
||||
Your name:
|
||||
```
|
||||
|
||||
你可以使用这个序列号暂时激活Navicat。
|
||||
|
||||
接下来你会被要求输入`用户名`和`组织名`;请随便填写,但不要太长。
|
||||
|
||||
```
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
Input request code (in Base64), input empty line to end:
|
||||
```
|
||||
|
||||
之后你会被要求填入请求码。注意 __不要关闭命令行__.
|
||||
|
||||
4. __断开网络__ 并打开Navicat。找到`注册`窗口,并填入keygen给你的序列号。然后点击`激活`按钮。
|
||||
|
||||
5. 一般来说在线激活肯定会失败,这时候Navicat会询问你是否`手动激活`,直接选吧。
|
||||
|
||||
6. 在`手动激活`窗口你会得到一个请求码,复制它并把它粘贴到keygen里。最后别忘了连按至少两下回车结束输入。
|
||||
|
||||
```bash
|
||||
Your name: DoubleLabyrinth
|
||||
Your organization: DoubleLabyrinth
|
||||
|
||||
Input request code (in Base64), input empty line to end:
|
||||
t2U+0yfE2FfnbjyhCXa0lglZOHu9Ntc3qyGiPbR6xb1QoU63/9BVfdaCq0blwVycXPyT/Vqw5joIKdM5oCRR/afCPM7iRcyhQMAnvqwc+AOKCqayVV+SqKLvtR/AbREI12w++PQ6Ewfs4A8PgB8OJ9G0jKt6Q/iJRblqi2WWw9mwy+YHcYYh3UAfygTnyj/xl+MzRymbY0lkus+6LPtpDecVsFFhM7F32Ee1QPwISko7bAkHOtkt+joPfYDdn9PDGZ4HEmeLvH6UqZCXkzgaAfynB7cQZFEkId8FsW2NGkbpM7wB2Hi3fNFgOIjutTprixTdbpFKn4w6gGc28ve23A==
|
||||
|
||||
Request Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE", "DI":"R91j6WyMhxHznAKSxxxx", "P":"WIN"}
|
||||
|
||||
Response Info:
|
||||
{"K":"NAVO2ORPIN5AGQEE","DI":"R91j6WyMhxHznAKSxxxx","N":"DoubleLabyrinth","O":"DoubleLabyrinth","T":1547826060}
|
||||
|
||||
License:
|
||||
lRF18o+ZhBphyN0U5kFLHtAAGGXuvhqOcxNuvAk4dJcGeR0ISuw74mQvAfdNjv0T
|
||||
I5NZFzqIJvrzM0XeR88q+3kmZkECuxwwWHP3zzDPhPiylcTV4DoGZ1tfoViUSYQc
|
||||
LgXG0Fl7koZeP61YOKQ8GfX+Xk2ZTM64bYaF7NlhonM+GQUJCCF2JThmrP921t2p
|
||||
b/E5pV6fLOYMM13881ZQcQcltMNVDZn4lzgzKRFFxCQFaTl6fJMHZdYVmICQTHtI
|
||||
sNaym0zduc8/cv34mgJ+7NseXmsEPCdjrZ59wgfPsLhZLXqtfxi5hGWw4NMa3Sb2
|
||||
UI8dzqFzRp/hSDEM0mEqiA==
|
||||
```
|
||||
|
||||
4. 如果不出意外,你会得到一个看似用Base64编码的激活码。直接复制它,并把它粘贴到Navicat的`手动激活`窗口,最后点`激活`按钮。如果没什么意外的话应该能成功激活。
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIEowIBAAKCAQEAtOZGsX7UoDPuxCfEuw4iyWDASpwaN19GaPNrTlWz6K7MKXGr
|
||||
AQpYD5gNZ8nGdfRgp52TErTHSNoRjgfpxGqKApPUISsIanGMcyf/H2b8pGuz1oF1
|
||||
9kVKSyZTPaVLbE+1Cw7FULbI04bc64XnWSHoaQAXrYKGpC7oDomRGMtx28figu3A
|
||||
HAk1UQrcCvE3+0ITTA7X8xaRwz6+gb+uLgCdiXyRYDodG8i+kk1YIt3f2mt7jH+u
|
||||
EHqBYjIfvvo6g5MZz4KNz7Ewc6+sDyO8bmlXeFnHo6YAgCcaHVvVtGNCxCd1O5wW
|
||||
HvUN985HHQYnFr7qzJaL9cPb735pP2hb0IXeywIDAQABAoIBAA5W7qWlQx+L3lJo
|
||||
QJz/Styhsbx4UU+wWrl5CjmEa6V3LbHfU8naUw6xY+alRPkWrQ68W+swr1dkCd4z
|
||||
XGF4fIYlx7v1WE5vv81lD0Ei/cXez7uiOYKTDYeVeyW405i7XMOKoTN7ucGiwCJf
|
||||
U+5p1K12F2pmnVuoaDa2yuynO9hLBqf3SeQ8qd2dQvKLqL8JVLE+a1txl3YuV5Ap
|
||||
PzUyLtGOmo5pIyKeeQ2dgR+AhnsUPDj5t0F1see6ysQVsNDk7i8Zcyfn2uWy4DPy
|
||||
NcWu/zLilelKDiYqI2UH+Fm0RzkG7ce2UmNbrG4ESEPNfwMyzy8IUGv3sBxL8p9a
|
||||
Xvtg7YkCgYEA7x9+cJNjs1DVxhTCatQrqWUwtwDiXZniz/WRUK7mQgX3mdFRhBhH
|
||||
GjZCvWOz1muYYvkwPSDMzwjwuV3ItPSUp7sI9FWhkrYqG+lMLpKXrYLSj1Grc9pn
|
||||
CZLQwmL9UegBUihBonm6bp+xJxbQeF/HStUWXP3xnWyRHBwUyAQC5v8CgYEAwarK
|
||||
08U7NbRcrYBgzegn0n2z3iG16JR/3kLQt/MJAsbQAxavW98b8rUb3V7XvkECiTcD
|
||||
74XuFdIAeeZeqlcsnYq2Gbr1tKCbTLHewztuFBwsQzeEmu1i81w0LeUaZqtB8HwQ
|
||||
evRRQGaEZfIdsXCn+PiPb/O5zGJNTJTD3aE/9DUCgYAdYutw/kwEX2zGGQsDgeuT
|
||||
t8HS26L2CdFb6TvghH37oywYlSbFaw5h5EUzbStOsI5bq3AIMx24W8rpnOLrihsy
|
||||
ucOR82wV0Zk/MN6R4qYNRsSFpG3DoRWEkaxiFzQ2eqKe7B+UzgzhR3LH8P/Rq0Oc
|
||||
qK9E4lhtFkiHAdRz+Do7FQKBgH8thkZtJcXNrHKvdGKjSstaiuybXJbgNdwiKmgx
|
||||
7D/riRwOIJgHOpY2wparuqeQj3bGLwpy+/dOUcu7MX1RA9ZtCcp50PKN6Y4C3FN+
|
||||
ynngSlzVr3oB29IOQaHF6oFzgzjGcBgeKuFMsTM1PLSSU2wW5jLRbbi+8R4SL1Fy
|
||||
m8nlAoGBAJsq8E6qkAErFkjHt7u1Pmp7iGdgoP8hDQ0NXH6BxU432j3cIT+g2W3y
|
||||
K28wXuHGamDqA9PLq3lb55wEkHqR62mTBqt9nJAW6CmAsl1Appvtf7ynep5SSNZg
|
||||
jLUllIz/D76Kb4AXehqfkLmU+X3a1dNofpDSqCr4AdEizZHbX8Zp
|
||||
-----END RSA PRIVATE KEY-----
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd `dirname "$0"`
|
||||
navicat_root=`pwd`
|
||||
|
||||
# Wine environment variables
|
||||
WINEDIR="wine"
|
||||
export LANG="en_US.UTF-8"
|
||||
export PATH="$navicat_root/$WINEDIR/bin":"$navicat_root":"$navicat_root/$WINEDIR/drive_c/windows":"$PATH"
|
||||
export LD_LIBRARY_PATH="$navicat_root/$WINEDIR/lib":"$navicat_root/lib":"$LD_LIBRARY_PATH"
|
||||
export WINEDLLPATH="$navicat_root/$WINEDIR/lib/wine"
|
||||
export WINELOADER="$navicat_root/$WINEDIR/bin/wine64"
|
||||
export WINESERVER="$navicat_root/$WINEDIR/bin/wineserver"
|
||||
export WINEPREFIX="$HOME/.navicat64"
|
||||
|
||||
exec "${WINELOADER:-wine}" "navicat-keygen.exe" "-text" "RegPrivateKey.pem"
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd `dirname "$0"`
|
||||
navicat_root=`pwd`
|
||||
|
||||
# Wine environment variables
|
||||
WINEDIR="wine"
|
||||
export LANG="en_US.UTF-8"
|
||||
export PATH="$navicat_root/$WINEDIR/bin":"$navicat_root":"$navicat_root/$WINEDIR/drive_c/windows":"$PATH"
|
||||
export LD_LIBRARY_PATH="$navicat_root/$WINEDIR/lib":"$navicat_root/lib":"$LD_LIBRARY_PATH"
|
||||
export WINEDLLPATH="$navicat_root/$WINEDIR/lib/wine"
|
||||
export WINELOADER="$navicat_root/$WINEDIR/bin/wine64"
|
||||
export WINESERVER="$navicat_root/$WINEDIR/bin/wineserver"
|
||||
export WINEPREFIX="$HOME/.navicat64"
|
||||
|
||||
# 将斜线替换为反斜线
|
||||
navicat_root_back_slash=${navicat_root//\//\\}
|
||||
# 前缀
|
||||
prefix='Z:\'
|
||||
# 后缀
|
||||
suffix='\Navicat'
|
||||
# wine环境中的navicat路径
|
||||
navicat_path="$prefix$navicat_root_back_slash$suffix"
|
||||
|
||||
# wine执行navicat-patcher.exe
|
||||
exec "${WINELOADER:-wine}" "navicat-patcher.exe" "$navicat_path"
|
||||
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include "TString.hpp"
|
||||
#include <vector>
|
||||
|
||||
class Exception {
|
||||
private:
|
||||
static inline TString EmptyErrorStr;
|
||||
TString _File;
|
||||
size_t _Line;
|
||||
TString _Message;
|
||||
std::vector<TString> _Hints;
|
||||
public:
|
||||
|
||||
template<typename... __Ts>
|
||||
Exception(const TString& FileName,
|
||||
size_t LineNumber,
|
||||
const TString& CustomMsg,
|
||||
__Ts&&... SomeHints) noexcept :
|
||||
_File(FileName),
|
||||
_Line(LineNumber),
|
||||
_Message(CustomMsg),
|
||||
_Hints{ std::forward<__Ts>(SomeHints)... } {}
|
||||
|
||||
const TString& File() const noexcept {
|
||||
return _File;
|
||||
}
|
||||
|
||||
size_t Line() const noexcept {
|
||||
return _Line;
|
||||
}
|
||||
|
||||
const TString& Message() const noexcept {
|
||||
return _Message;
|
||||
}
|
||||
|
||||
std::vector<TString>& Hints() noexcept {
|
||||
return _Hints;
|
||||
}
|
||||
|
||||
const std::vector<TString>& Hints() const noexcept {
|
||||
return _Hints;
|
||||
}
|
||||
|
||||
virtual bool HasErrorCode() const noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual uintptr_t ErrorCode() const noexcept {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual const TString& ErrorString() const noexcept {
|
||||
return EmptyErrorStr;
|
||||
}
|
||||
|
||||
virtual ~Exception() = default;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
#include "Exception.hpp"
|
||||
|
||||
class SystemException : public Exception {
|
||||
private:
|
||||
DWORD _ErrorCode;
|
||||
TString _ErrorString;
|
||||
public:
|
||||
|
||||
template<typename... __Ts>
|
||||
SystemException(const TString& FileName,
|
||||
size_t LineNumber,
|
||||
DWORD Win32ErrorCode,
|
||||
const TString& CustomMsg,
|
||||
__Ts&&... SomeHints) noexcept :
|
||||
Exception(FileName, LineNumber, CustomMsg, std::forward<__Ts>(SomeHints)...),
|
||||
_ErrorCode(Win32ErrorCode)
|
||||
{
|
||||
PTSTR Text = NULL;
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_MAX_WIDTH_MASK,
|
||||
NULL,
|
||||
Win32ErrorCode,
|
||||
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
|
||||
reinterpret_cast<PTSTR>(&Text),
|
||||
0,
|
||||
NULL);
|
||||
_ErrorString.assign(Text);
|
||||
LocalFree(Text);
|
||||
}
|
||||
|
||||
virtual bool HasErrorCode() const noexcept override {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual uintptr_t ErrorCode() const noexcept override {
|
||||
return _ErrorCode;
|
||||
}
|
||||
|
||||
virtual const TString& ErrorString() const noexcept override {
|
||||
return _ErrorString;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
#pragma once
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <memory.h>
|
||||
#include "Exception.hpp"
|
||||
#include "ResourceObject.hpp"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "libcryptoMTd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "libcryptoMT.lib")
|
||||
#endif
|
||||
#pragma comment(lib, "WS2_32.lib") // some symbol are used in OpenSSL static lib
|
||||
#pragma comment(lib, "Crypt32.lib") // some symbol are used in OpenSSL static lib
|
||||
|
||||
#undef __BASE_FILE__
|
||||
#define __BASE_FILE__ TEXT("RSACipher.hpp")
|
||||
|
||||
class OpensslException : public Exception {
|
||||
private:
|
||||
unsigned long _ErrorCode;
|
||||
TString _ErrorString;
|
||||
public:
|
||||
|
||||
OpensslException(const TString& FileName,
|
||||
size_t LineNumber,
|
||||
unsigned long OpensslErrorCode,
|
||||
const TString& CustomMsg) noexcept :
|
||||
Exception(FileName, LineNumber, CustomMsg),
|
||||
_ErrorCode(OpensslErrorCode),
|
||||
_ErrorString(TStringBuilder(ERR_error_string(OpensslErrorCode, nullptr), CP_UTF8)) {}
|
||||
|
||||
virtual bool HasErrorCode() const noexcept override {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual uintptr_t ErrorCode() const noexcept override {
|
||||
return _ErrorCode;
|
||||
}
|
||||
|
||||
virtual const TString& ErrorString() const noexcept override {
|
||||
return _ErrorString;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct OpensslBIOTraits {
|
||||
using HandleType = BIO*;
|
||||
static inline const HandleType InvalidValue = nullptr;
|
||||
static constexpr auto& Releasor = BIO_free;
|
||||
};
|
||||
|
||||
struct OpensslBIOChainTraits {
|
||||
using HandleType = BIO*;
|
||||
static inline const HandleType InvalidValue = nullptr;
|
||||
static constexpr auto& Releasor = BIO_free_all;
|
||||
};
|
||||
|
||||
struct OpensslBNTraits {
|
||||
using HandleType = BIGNUM*;
|
||||
static inline const HandleType InvalidValue = nullptr;
|
||||
static constexpr auto& Releasor = BN_free;
|
||||
};
|
||||
|
||||
struct OpensslRSATraits {
|
||||
using HandleType = RSA*;
|
||||
static inline const HandleType InvalidValue = nullptr;
|
||||
static constexpr auto& Releasor = RSA_free;
|
||||
};
|
||||
|
||||
enum class RSAKeyType {
|
||||
PrivateKey,
|
||||
PublicKey
|
||||
};
|
||||
|
||||
enum class RSAKeyFormat {
|
||||
NotSpecified,
|
||||
PEM,
|
||||
PKCS1
|
||||
};
|
||||
|
||||
class RSACipher {
|
||||
private:
|
||||
ResourceObject<OpensslRSATraits> _RSAObj;
|
||||
|
||||
RSACipher(RSA* pRsa) noexcept : _RSAObj(pRsa) {}
|
||||
|
||||
//
|
||||
// Copy constructor is not allowed
|
||||
//
|
||||
RSACipher(const RSACipher&) = delete;
|
||||
|
||||
//
|
||||
// Copy assignment is not allowed
|
||||
//
|
||||
RSACipher& operator=(const RSACipher&) = delete;
|
||||
|
||||
template<RSAKeyType __Type, RSAKeyFormat __Format = RSAKeyFormat::NotSpecified>
|
||||
static void _WriteRSAToBIO(RSA* PtrToRSA, BIO* PtrToBIO) {
|
||||
if constexpr (__Type == RSAKeyType::PrivateKey) {
|
||||
if (!PEM_write_bio_RSAPrivateKey(PtrToBIO, PtrToRSA, nullptr, nullptr, 0, nullptr, nullptr))
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("PEM_write_bio_RSAPrivateKey failed."));
|
||||
} else {
|
||||
if constexpr (__Format == RSAKeyFormat::PEM) {
|
||||
if (!PEM_write_bio_RSA_PUBKEY(PtrToBIO, PtrToRSA))
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("PEM_write_bio_RSA_PUBKEY failed."));
|
||||
} else if constexpr (__Format == RSAKeyFormat::PKCS1) {
|
||||
if (!PEM_write_bio_RSAPublicKey(PtrToBIO, PtrToRSA))
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("PEM_write_bio_RSAPublicKey failed."));
|
||||
} else {
|
||||
static_assert(__Format == RSAKeyFormat::PEM || __Format == RSAKeyFormat::PKCS1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<RSAKeyType __Type, RSAKeyFormat __Format = RSAKeyFormat::NotSpecified>
|
||||
static RSA* _ReadRSAFromBIO(BIO* PtrToBIO) {
|
||||
RSA* PtrToRSA;
|
||||
|
||||
if constexpr (__Type == RSAKeyType::PrivateKey) {
|
||||
PtrToRSA = PEM_read_bio_RSAPrivateKey(PtrToBIO, nullptr, nullptr, nullptr);
|
||||
if (PtrToRSA == nullptr)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("PEM_read_bio_RSAPrivateKey failed."));
|
||||
} else {
|
||||
if constexpr (__Format == RSAKeyFormat::PEM) {
|
||||
PtrToRSA = PEM_read_bio_RSA_PUBKEY(PtrToBIO, nullptr, nullptr, nullptr);
|
||||
if (PtrToRSA == nullptr)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("PEM_read_bio_RSA_PUBKEY failed."));
|
||||
} else if constexpr (__Format == RSAKeyFormat::PKCS1) {
|
||||
PtrToRSA = PEM_read_bio_RSAPublicKey(PtrToBIO, nullptr, nullptr, nullptr);
|
||||
if (PtrToRSA == nullptr)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("PEM_read_bio_RSAPublicKey failed."));
|
||||
} else {
|
||||
static_assert(__Format == RSAKeyFormat::PEM || __Format == RSAKeyFormat::PKCS1);
|
||||
}
|
||||
}
|
||||
|
||||
return PtrToRSA;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
RSACipher() : _RSAObj(RSA_new()) {
|
||||
if (_RSAObj.IsValid() == false)
|
||||
throw OpensslException(__BASE_FILE__, __LINE__, ERR_get_error(),
|
||||
TEXT("RSA_new failed."));
|
||||
}
|
||||
|
||||
void GenerateKey(int bits, unsigned int e = RSA_F4) {
|
||||
ResourceObject<OpensslBNTraits> bn_e;
|
||||
|
||||
bn_e.TakeOver(BN_new());
|
||||
if (bn_e.IsValid() == false)
|
||||
throw OpensslException(__BASE_FILE__, __LINE__, ERR_get_error(),
|
||||
TEXT("BN_new failed."));
|
||||
|
||||
if (!BN_set_word(bn_e, e))
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("BN_set_word failed."));
|
||||
|
||||
if (!RSA_generate_key_ex(_RSAObj, bits, bn_e, nullptr))
|
||||
throw OpensslException(__BASE_FILE__, __LINE__, ERR_get_error(),
|
||||
TEXT("RSA_generate_key_ex failed."));
|
||||
}
|
||||
|
||||
template<RSAKeyType __Type, RSAKeyFormat __Format = RSAKeyFormat::NotSpecified>
|
||||
void ExportKeyToFile(const std::string& FileName) {
|
||||
ResourceObject<OpensslBIOTraits> BIOKeyFile;
|
||||
|
||||
BIOKeyFile.TakeOver(BIO_new_file(FileName.c_str(), "w"));
|
||||
if (BIOKeyFile.IsValid() == false)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("BIO_new_file failed."));
|
||||
|
||||
_WriteRSAToBIO<__Type, __Format>(_RSAObj, BIOKeyFile);
|
||||
}
|
||||
|
||||
template<RSAKeyType __Type, RSAKeyFormat __Format = RSAKeyFormat::NotSpecified>
|
||||
std::string ExportKeyString() {
|
||||
std::string KeyString;
|
||||
ResourceObject<OpensslBIOTraits> BIOKeyMemory;
|
||||
long s;
|
||||
const char* p = nullptr;
|
||||
|
||||
BIOKeyMemory.TakeOver(BIO_new(BIO_s_mem()));
|
||||
if (BIOKeyMemory.IsValid() == false)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("BIO_new failed."));
|
||||
|
||||
_WriteRSAToBIO<__Type, __Format>(_RSAObj, BIOKeyMemory);
|
||||
|
||||
s = BIO_get_mem_data(BIOKeyMemory, &p);
|
||||
KeyString.resize(s);
|
||||
memcpy(KeyString.data(), p, s);
|
||||
|
||||
return KeyString;
|
||||
}
|
||||
|
||||
template<RSAKeyType __Type, RSAKeyFormat __Format = RSAKeyFormat::NotSpecified>
|
||||
void ImportKeyFromFile(const std::string& FileName) {
|
||||
ResourceObject<OpensslBIOTraits> BIOKeyFile;
|
||||
RSA* NewRSAObj;
|
||||
|
||||
BIOKeyFile.TakeOver(BIO_new_file(FileName.c_str(), "r"));
|
||||
if (BIOKeyFile.IsValid() == false)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("BIO_new_file failed."));
|
||||
|
||||
NewRSAObj = _ReadRSAFromBIO<__Type, __Format>(BIOKeyFile);
|
||||
_RSAObj.Release();
|
||||
_RSAObj.TakeOver(NewRSAObj);
|
||||
}
|
||||
|
||||
template<RSAKeyType __Type, RSAKeyFormat __Format = RSAKeyFormat::NotSpecified>
|
||||
void ImportKeyString(const std::string& KeyString) {
|
||||
ResourceObject<OpensslBIOTraits> BIOKeyMemory;
|
||||
RSA* NewRSAObj;
|
||||
|
||||
BIOKeyMemory = BIO_new(BIO_s_mem());
|
||||
if (BIOKeyMemory == nullptr)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("BIO_new failed."));
|
||||
|
||||
if (BIO_puts(BIOKeyMemory, KeyString.c_str()) <= 0)
|
||||
throw Exception(__BASE_FILE__, __LINE__,
|
||||
TEXT("BIO_puts failed."));
|
||||
|
||||
NewRSAObj = _ReadRSAFromBIO<__Type, __Format>(BIOKeyMemory);
|
||||
_RSAObj.Release();
|
||||
_RSAObj.TakeOver(NewRSAObj);
|
||||
}
|
||||
|
||||
template<RSAKeyType __Type = RSAKeyType::PublicKey>
|
||||
int Encrypt(const void* from, int len, void* to, int padding) {
|
||||
int WriteBytes;
|
||||
|
||||
if constexpr (__Type == RSAKeyType::PrivateKey) {
|
||||
WriteBytes = RSA_private_encrypt(len,
|
||||
reinterpret_cast<const unsigned char*>(from),
|
||||
reinterpret_cast<unsigned char*>(to),
|
||||
_RSAObj,
|
||||
padding);
|
||||
if (WriteBytes == -1)
|
||||
throw OpensslException(__BASE_FILE__, __LINE__, ERR_get_error(),
|
||||
TEXT("RSA_private_encrypt failed."));
|
||||
} else {
|
||||
WriteBytes = RSA_public_encrypt(len,
|
||||
reinterpret_cast<const unsigned char*>(from),
|
||||
reinterpret_cast<unsigned char*>(to),
|
||||
_RSAObj,
|
||||
padding);
|
||||
if (WriteBytes == -1)
|
||||
throw OpensslException(__BASE_FILE__, __LINE__, ERR_get_error(),
|
||||
TEXT("RSA_public_encrypt failed."));
|
||||
}
|
||||
|
||||
return WriteBytes;
|
||||
}
|
||||
|
||||
template<RSAKeyType __Type = RSAKeyType::PrivateKey>
|
||||
int Decrypt(const void* from, int len, void* to, int padding) {
|
||||
int WriteBytes;
|
||||
|
||||
if constexpr (__Type == RSAKeyType::PrivateKey) {
|
||||
WriteBytes = RSA_private_decrypt(len,
|
||||
reinterpret_cast<const unsigned char*>(from),
|
||||
reinterpret_cast<unsigned char*>(to),
|
||||
_RSAObj,
|
||||
padding);
|
||||
if (WriteBytes == -1)
|
||||
throw OpensslException(__BASE_FILE__, __LINE__, ERR_get_error(),
|
||||
TEXT("RSA_private_decrypt failed."));
|
||||
} else {
|
||||
WriteBytes = RSA_public_decrypt(len,
|
||||
reinterpret_cast<const unsigned char*>(from),
|
||||
reinterpret_cast<unsigned char*>(to),
|
||||
_RSAObj,
|
||||
padding);
|
||||
if (WriteBytes == -1)
|
||||
throw OpensslException(__BASE_FILE__, __LINE__, ERR_get_error(),
|
||||
TEXT("RSA_public_decrypt failed."));
|
||||
}
|
||||
|
||||
return WriteBytes;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
#pragma once
|
||||
#include <type_traits>
|
||||
|
||||
template<typename __ResourceTraits>
|
||||
class ResourceObject {
|
||||
public:
|
||||
using HandleType = typename __ResourceTraits::HandleType;
|
||||
private:
|
||||
HandleType _Handle;
|
||||
public:
|
||||
|
||||
ResourceObject() noexcept :
|
||||
_Handle(__ResourceTraits::InvalidValue) {}
|
||||
|
||||
explicit ResourceObject(const HandleType& Handle) noexcept :
|
||||
_Handle(Handle) {}
|
||||
|
||||
//
|
||||
// Copy constructor is not allowed
|
||||
//
|
||||
ResourceObject(const ResourceObject<__ResourceTraits>& Other) = delete;
|
||||
|
||||
ResourceObject(ResourceObject<__ResourceTraits>&& Other) noexcept :
|
||||
_Handle(Other._Handle)
|
||||
{
|
||||
Other._Handle = __ResourceTraits::InvalidValue;
|
||||
}
|
||||
|
||||
//
|
||||
// Copy assignment is not allowed
|
||||
//
|
||||
ResourceObject<__ResourceTraits>&
|
||||
operator=(const ResourceObject<__ResourceTraits>& Other) = delete;
|
||||
|
||||
ResourceObject<__ResourceTraits>&
|
||||
operator=(ResourceObject<__ResourceTraits>&& Other) noexcept {
|
||||
_Handle = Other._Handle;
|
||||
Other._Handle = __ResourceTraits::InvalidValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename __DummyType = int,
|
||||
typename = typename std::enable_if<std::is_pointer<HandleType>::value, __DummyType>::type>
|
||||
HandleType operator->() const noexcept {
|
||||
return _Handle;
|
||||
}
|
||||
|
||||
operator HandleType() const noexcept {
|
||||
return _Handle;
|
||||
}
|
||||
|
||||
// Check if handle is a valid handle
|
||||
bool IsValid() const noexcept {
|
||||
return _Handle != __ResourceTraits::InvalidValue;
|
||||
}
|
||||
|
||||
HandleType Get() const noexcept {
|
||||
return _Handle;
|
||||
}
|
||||
|
||||
void TakeOver(const HandleType& Handle) noexcept {
|
||||
if (_Handle != __ResourceTraits::InvalidValue) {
|
||||
__ResourceTraits::Releasor(_Handle);
|
||||
_Handle = __ResourceTraits::InvalidValue;
|
||||
} else {
|
||||
_Handle = Handle;
|
||||
}
|
||||
}
|
||||
|
||||
void Abandon() noexcept {
|
||||
_Handle = __ResourceTraits::InvalidValue;
|
||||
}
|
||||
|
||||
// Force release
|
||||
void Release() {
|
||||
if (_Handle != __ResourceTraits::InvalidValue) {
|
||||
__ResourceTraits::Releasor(_Handle);
|
||||
_Handle = __ResourceTraits::InvalidValue;
|
||||
}
|
||||
}
|
||||
|
||||
~ResourceObject() {
|
||||
if (_Handle != __ResourceTraits::InvalidValue) {
|
||||
__ResourceTraits::Releasor(_Handle);
|
||||
_Handle = __ResourceTraits::InvalidValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename __ClassType>
|
||||
struct CppObjectTraits {
|
||||
using HandleType = __ClassType*;
|
||||
static inline const HandleType InvalidValue = nullptr;
|
||||
static inline void Releasor(HandleType pObject) {
|
||||
delete pObject;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename __ClassType>
|
||||
struct CppDynamicArrayTraits {
|
||||
using HandleType = __ClassType*;
|
||||
static inline const HandleType InvalidValue = nullptr;
|
||||
static inline void Releasor(HandleType pArray) {
|
||||
delete[] pArray;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
#include "TString.hpp"
|
||||
#include "ExceptionSystem.hpp"
|
||||
|
||||
#undef __BASE_FILE__
|
||||
#define __BASE_FILE__ TEXT("TString.cpp")
|
||||
|
||||
TString TStringBuilder(PCSTR LpMultiByteStr, UINT CodePage) {
|
||||
#ifdef _UNICODE
|
||||
TString TStr;
|
||||
int RequiredSize = MultiByteToWideChar(CodePage,
|
||||
NULL,
|
||||
LpMultiByteStr,
|
||||
-1,
|
||||
NULL,
|
||||
0);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
TStr.resize(RequiredSize);
|
||||
|
||||
if (!MultiByteToWideChar(CP_ACP,
|
||||
NULL,
|
||||
LpMultiByteStr,
|
||||
-1,
|
||||
TStr.data(),
|
||||
RequiredSize))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
while (TStr.back() == L'\x00')
|
||||
TStr.pop_back();
|
||||
|
||||
return TStr;
|
||||
#else
|
||||
if (CodePage == CP_ACP) {
|
||||
return TString(LpMultiByteStr);
|
||||
} else {
|
||||
std::wstring WideCharStr;
|
||||
TString TStr;
|
||||
int RequiredSize = MultiByteToWideChar(CodePage,
|
||||
NULL,
|
||||
LpMultiByteStr,
|
||||
-1,
|
||||
NULL,
|
||||
0);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
WideCharStr.resize(RequiredSize);
|
||||
|
||||
if (!MultiByteToWideChar(CP_ACP,
|
||||
NULL,
|
||||
LpMultiByteStr,
|
||||
-1,
|
||||
WideCharStr.data(),
|
||||
RequiredSize))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
while (WideCharStr.back() == L'\x00')
|
||||
WideCharStr.pop_back();
|
||||
|
||||
RequiredSize = WideCharToMultiByte(CP_ACP,
|
||||
NULL,
|
||||
WideCharStr.c_str(),
|
||||
-1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
TStr.resize(RequiredSize);
|
||||
|
||||
if (!WideCharToMultiByte(CP_ACP,
|
||||
NULL,
|
||||
WideCharStr.c_str(),
|
||||
-1,
|
||||
TStr.data(),
|
||||
RequiredSize,
|
||||
NULL,
|
||||
NULL))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
while (TStr.back() == '\x00')
|
||||
TStr.pop_back();
|
||||
|
||||
return TStr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
TString TStringBuilder(PCWSTR LpWideCharStr) {
|
||||
#ifdef _UNICODE
|
||||
return TString(LpWideCharStr);
|
||||
#else
|
||||
TString TStr;
|
||||
int RequiredSize = WideCharToMultiByte(CP_ACP,
|
||||
NULL,
|
||||
LpWideCharStr,
|
||||
-1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
TStr.resize(RequiredSize);
|
||||
|
||||
if (!WideCharToMultiByte(CP_ACP,
|
||||
NULL,
|
||||
LpWideCharStr,
|
||||
-1,
|
||||
TStr.data(),
|
||||
RequiredSize,
|
||||
NULL,
|
||||
NULL))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
while (TStr.back() == '\x00')
|
||||
TStr.pop_back();
|
||||
|
||||
return TStr;
|
||||
#endif
|
||||
}
|
||||
|
||||
TString TStringBuilder(const std::string& RefMultiByteStr, UINT CodePage) {
|
||||
return TStringBuilder(RefMultiByteStr.c_str(), CodePage);
|
||||
}
|
||||
|
||||
TString TStringBuilder(const std::wstring& RefWideCharStr) {
|
||||
return TStringBuilder(RefWideCharStr.c_str());
|
||||
}
|
||||
|
||||
std::string TStringEncode(PTSTR LpTString, UINT CodePage) {
|
||||
std::string MultiByteStr;
|
||||
int RequiredSize;
|
||||
#ifdef _UNICODE
|
||||
RequiredSize = WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
LpTString,
|
||||
-1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
MultiByteStr.resize(RequiredSize);
|
||||
|
||||
if (!WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
LpTString,
|
||||
-1,
|
||||
MultiByteStr.data(),
|
||||
RequiredSize,
|
||||
NULL,
|
||||
NULL))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
while (MultiByteStr.back() == '\x00')
|
||||
MultiByteStr.pop_back();
|
||||
#else
|
||||
if (CodePage == CP_ACP)
|
||||
return RefTStr;
|
||||
|
||||
std::wstring WideCharStr;
|
||||
RequiredSize = MultiByteToWideChar(CP_ACP,
|
||||
NULL,
|
||||
LpTString,
|
||||
-1,
|
||||
NULL,
|
||||
0);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
WideCharStr.resize(RequiredSize);
|
||||
|
||||
if (!MultiByteToWideChar(CP_ACP,
|
||||
NULL,
|
||||
LpTString,
|
||||
-1,
|
||||
WideCharStr.data(),
|
||||
RequiredSize))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
while (WideCharStr.back() == L'\x00')
|
||||
WideCharStr.pop_back();
|
||||
|
||||
RequiredSize = WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
WideCharStr.c_str(),
|
||||
-1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
MultiByteStr.resize(RequiredSize);
|
||||
|
||||
if (!WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
WideCharStr.c_str(),
|
||||
-1,
|
||||
MultiByteStr.data(),
|
||||
RequiredSize,
|
||||
NULL,
|
||||
NULL))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
while (MultiByteStr.back() == '\x00')
|
||||
MultiByteStr.pop_back();
|
||||
#endif
|
||||
return MultiByteStr;
|
||||
}
|
||||
|
||||
std::string TStringEncode(const TString& RefTStr, UINT CodePage) {
|
||||
std::string MultiByteStr;
|
||||
int RequiredSize;
|
||||
#ifdef _UNICODE
|
||||
RequiredSize = WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
RefTStr.c_str(),
|
||||
-1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
MultiByteStr.resize(RequiredSize);
|
||||
|
||||
if (!WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
RefTStr.c_str(),
|
||||
-1,
|
||||
MultiByteStr.data(),
|
||||
RequiredSize,
|
||||
NULL,
|
||||
NULL))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
while (MultiByteStr.back() == '\x00')
|
||||
MultiByteStr.pop_back();
|
||||
#else
|
||||
if (CodePage == CP_ACP)
|
||||
return RefTStr;
|
||||
|
||||
std::wstring WideCharStr;
|
||||
RequiredSize = MultiByteToWideChar(CP_ACP,
|
||||
NULL,
|
||||
RefTStr.c_str(),
|
||||
-1,
|
||||
NULL,
|
||||
0);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
WideCharStr.resize(RequiredSize);
|
||||
|
||||
if (!MultiByteToWideChar(CP_ACP,
|
||||
NULL,
|
||||
RefTStr.c_str(),
|
||||
-1,
|
||||
WideCharStr.data(),
|
||||
RequiredSize))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("MultiByteToWideChar failed."));
|
||||
|
||||
while (WideCharStr.back() == L'\x00')
|
||||
WideCharStr.pop_back();
|
||||
|
||||
RequiredSize = WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
WideCharStr.c_str(),
|
||||
-1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL);
|
||||
if (RequiredSize == 0)
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
MultiByteStr.resize(RequiredSize);
|
||||
|
||||
if (!WideCharToMultiByte(CodePage,
|
||||
NULL,
|
||||
WideCharStr.c_str(),
|
||||
-1,
|
||||
MultiByteStr.data(),
|
||||
RequiredSize,
|
||||
NULL,
|
||||
NULL))
|
||||
throw SystemException(__BASE_FILE__, __LINE__, GetLastError(),
|
||||
TEXT("WideCharToMultiByte failed."));
|
||||
|
||||
while (MultiByteStr.back() == '\x00')
|
||||
MultiByteStr.pop_back();
|
||||
#endif
|
||||
return MultiByteStr;
|
||||
}
|
||||
|
||||
TString TStringDecode(PCSTR LpMultiByteStr, UINT CodePage) {
|
||||
return TStringBuilder(LpMultiByteStr, CodePage);
|
||||
}
|
||||
|
||||
TString TStringDecode(const std::string& RefMultiByteStr, UINT CodePage) {
|
||||
return TStringBuilder(RefMultiByteStr.c_str(), CodePage);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
|
||||
//
|
||||
// A TString can be either multiple-bytes string or wide-char string.
|
||||
// When multiple-bytes string, the code page is CP_ACP.
|
||||
// When wide-char string, it is UTF-16-LE encoded string.
|
||||
//
|
||||
#ifdef _UNICODE
|
||||
using TString = std::wstring;
|
||||
#else
|
||||
using TString = std::string;
|
||||
#endif
|
||||
|
||||
//
|
||||
// For a multiple-bytes string, the default code-page is CP_ACP.
|
||||
// Of course, you can specify code-page to override it.
|
||||
//
|
||||
TString TStringBuilder(PCSTR LpMultiByteStr, UINT CodePage = CP_ACP);
|
||||
|
||||
//
|
||||
// For a wide-char string, it must be UTF-16-LE encoded.
|
||||
// So `CodePage` is not needed.
|
||||
//
|
||||
TString TStringBuilder(PCWSTR LpWideCharStr);
|
||||
|
||||
//
|
||||
// For a multiple-bytes string, the default code-page is CP_ACP.
|
||||
// Of course, you can specify code-page to override it.
|
||||
//
|
||||
TString TStringBuilder(const std::string& RefMultiByteStr, UINT CodePage = CP_ACP);
|
||||
|
||||
//
|
||||
// For a wide-char string, it must be UTF-16-LE encoded.
|
||||
// So `CodePage` is not needed.
|
||||
//
|
||||
TString TStringBuilder(const std::wstring& RefWideCharStr);
|
||||
|
||||
//
|
||||
// Convert a TString to a multiple-bytes string with specified code-page.
|
||||
//
|
||||
std::string TStringEncode(PTSTR LpTString, UINT CodePage);
|
||||
std::string TStringEncode(const TString& RefTStr, UINT CodePage);
|
||||
|
||||
//
|
||||
// Convert a multiple-bytes string to a TString with specified code-page.
|
||||
//
|
||||
TString TStringDecode(PCSTR LpMultiByteStr, UINT CodePage = CP_ACP);
|
||||
TString TStringDecode(const std::string& RefMultiByteStr, UINT CodePage = CP_ACP);
|
||||
|
||||
//
|
||||
// Format function for TString
|
||||
//
|
||||
template<typename... __Ts>
|
||||
TString TStringFormat(const TString& Format, __Ts&&... Args) {
|
||||
TString s;
|
||||
s.resize(_sctprintf(Format.c_str(), std::forward<__Ts>(Args)...) + 1);
|
||||
s.resize(_sntprintf_s(s.data(), s.capacity(), _TRUNCATE, Format.c_str(), std::forward<__Ts>(Args)...));
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<ItemsProjectGuid>{6aa392e2-b540-4ab5-9bfd-40ad964b209a}</ItemsProjectGuid>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectCapability Include="SourceItemsFromImports" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)TString.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)Exception.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)ExceptionSystem.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)ResourceObject.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)RSACipher.hpp" />
|
||||
<ClInclude Include="$(MSBuildThisFileDirectory)TString.hpp" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user