NavicatEncrypt 1.3.3
dotnet add package NavicatEncrypt --version 1.3.3
NuGet\Install-Package NavicatEncrypt -Version 1.3.3
<PackageReference Include="NavicatEncrypt" Version="1.3.3" />
<PackageVersion Include="NavicatEncrypt" Version="1.3.3" />
<PackageReference Include="NavicatEncrypt" />
paket add NavicatEncrypt --version 1.3.3
#r "nuget: NavicatEncrypt, 1.3.3"
#addin nuget:?package=NavicatEncrypt&version=1.3.3
#tool nuget:?package=NavicatEncrypt&version=1.3.3
This is a port to DotNet Framework, DotNet Core and PHP from the original Python3 code made by DoubleLabyrinth
Original repository
- NOTICE: The text below is copy/pasted from DoubleLabyrinth, all credits go to him
How Does Navicat Encrypt/Decrypt Passwords?
1. What is Navicat?
Navicat is a series of graphical database management and development software produced by PremiumSoft CyberTech Ltd. for MySQL, MariaDB, Oracle, SQLite, PostgreSQL and Microsoft SQL Server.
It has an Explorer-like graphical user interface and supports multiple database connections for local and remote databases. Its design is made to meet the needs of a variety of audiences, from database administrators and programmers to various businesses/companies that serve clients and share information with partners.
See Navicat's website for more information about Navicat
2. What does indicate that Navicat encrypts password?
If you use Navicat to manage one of your databases, the first thing you should do is to create a connection to the database. So that means you should fill textboxes on the window showed below with the database's information like
host name
,User name
,Password
and so on.If you check "Save Password", after you click "Ok" button, Navicat will encrypt the password and then save the connection configuration, containing encrypted password, in Windows Registry. The exact path is showed below:
Database Type Path MySQL HKEY_CURRENT_USER\Software\PremiumSoft\Navicat\Servers\ <your connection name>
MariaDB HKEY_CURRENT_USER\Software\PremiumSoft\NavicatMARIADB\Servers\ <your connection name>
Microsoft SQL HKEY_CURRENT_USER\Software\PremiumSoft\NavicatMSSQL\Servers\ <your connection name>
Oracle HKEY_CURRENT_USER\Software\PremiumSoft\NavicatOra\Servers\ <your connection name>
PostgreSQL HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPG\Servers\ <your connection name>
SQLite HKEY_CURRENT_USER\Software\PremiumSoft\NavicatSQLite\Servers\ <your connection name>
3. How does Navicat encrypt password?
Navicat use blowfish algorithm to encrypt password string. Here below is what Navicat did:
1. Generate Key.
- Navicat use SHA-1 algorithm to generate a 160-bits' key.
- The SHA-1 digest of an ASCII string---"3DC5CA39", 8 bytes long---is the key used in blowfish cipher.
- The exact value is: unsigned char Key[20] = { 0x42, 0xCE, 0xB2, 0x71, 0xA5, 0xE4, 0x58, 0xB7, 0x4A, 0xEA, 0x93, 0x94, 0x79, 0x22, 0x35, 0x43, 0x91, 0x87, 0x33, 0x40 };
2. Initialize Initial Vector(IV)
- We know that blowfish algorithm could only encrypt an 8-bytes-long block every time.
- At the beginning, Navicat fills an 8-bytes-long block with 0xFF, then uses blowfish algorithm encrypt the block by the key mentioned above. After that the 8-bytes-long block is Initial Vector(IV).
- The exact value of IV is:
unsigned char IV[8] = { 0xD9, 0xC7, 0xC3, 0xC8, 0x87, 0x0D, 0x64, 0xBD };
3. Encrypt Password String.
- NOTICE: Here, the password string is an ASCII string, and we DO NOT consider the "NULL" terminator.
- Navicat use a pipeline to encrypt password string. The pipeline is showed below:
- NOTICE: Every plaintext block is an 8-bytes-long block. Only when the last plaintext block is not 8-bytes-long, will the last step showed in the picture above be executed. Otherwise, the last step is just like the middle two steps.
4. Store The Encrypted Password.
- The encrypted password stored in Windows Registry is the join of hex strings of every cipher blocks.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
*1.3.3 - NetStandard 2.1 and 2.0
*1.3.2 - Added encrypt/decrypt with customcode option
*1.3.1 - Built with v4.8 instead of v4.8.1
* 1.3 - Removed dependencies
* 1.2 - Changed dependency version
* 1.1 - Added dispose support.