mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
versioning fix
This commit is contained in:
@@ -12,10 +12,6 @@ public class PuttyKeyFileGenerator
|
||||
private const string keyType = "ssh-rsa";
|
||||
private const string encryptionType = "none";
|
||||
|
||||
// source from
|
||||
// https://gist.github.com/canton7/5670788?permalink_comment_id=3240331
|
||||
// https://gist.github.com/bosima/ee6630d30b533c7d7b2743a849e9b9d0
|
||||
|
||||
public static string ToPuttyPrivateKey(RSACryptoServiceProvider cryptoServiceProvider, string Comment = "imported-openssh-key")
|
||||
{
|
||||
var publicParameters = cryptoServiceProvider.ExportParameters(false);
|
||||
@@ -24,7 +20,7 @@ public class PuttyKeyFileGenerator
|
||||
using (var bw = new BinaryWriter(new MemoryStream(publicBuffer)))
|
||||
{
|
||||
bw.Write(new byte[] { 0x00, 0x00, 0x00 });
|
||||
bw.Write(keyType);
|
||||
bw.Write(Encoding.ASCII.GetBytes(keyType));
|
||||
PutPrefixed(bw, publicParameters.Exponent, CheckIsNeddPadding(publicParameters.Exponent));
|
||||
PutPrefixed(bw, publicParameters.Modulus, CheckIsNeddPadding(publicParameters.Modulus));
|
||||
}
|
||||
@@ -37,20 +33,19 @@ public class PuttyKeyFileGenerator
|
||||
using (var bw = new BinaryWriter(new MemoryStream(privateBuffer)))
|
||||
{
|
||||
PutPrefixed(bw, privateParameters.D, true);
|
||||
PutPrefixed(bw, privateParameters.P, true);
|
||||
PutPrefixed(bw, privateParameters.P!, true);
|
||||
PutPrefixed(bw, privateParameters.Q, true);
|
||||
PutPrefixed(bw, privateParameters.InverseQ, true);
|
||||
}
|
||||
var privateBlob = System.Convert.ToBase64String(privateBuffer);
|
||||
|
||||
HMACSHA1 hmacSha1 = new(SHA1.Create().ComputeHash(Encoding.ASCII.GetBytes("putty-private-key-file-mac-key")));
|
||||
//byte[] bytesToHash = new byte[4 + 7 + 4 + 4 + 4 + Comment.Length + 4 + publicBuffer.Length + 4 + privateBuffer.Length];
|
||||
byte[] bytesToHash = new byte[prefixSize + keyType.Length + prefixSize + encryptionType.Length + prefixSize + Comment.Length + prefixSize + publicBuffer.Length + prefixSize + privateBuffer.Length];
|
||||
|
||||
using (var bw = new BinaryWriter(new MemoryStream(bytesToHash)))
|
||||
{
|
||||
PutPrefixed(bw, Encoding.ASCII.GetBytes("ssh-rsa"));
|
||||
PutPrefixed(bw, Encoding.ASCII.GetBytes("none"));
|
||||
PutPrefixed(bw, Encoding.ASCII.GetBytes(keyType));
|
||||
PutPrefixed(bw, Encoding.ASCII.GetBytes(encryptionType));
|
||||
PutPrefixed(bw, Encoding.ASCII.GetBytes(Comment));
|
||||
PutPrefixed(bw, publicBuffer);
|
||||
PutPrefixed(bw, privateBuffer);
|
||||
@@ -89,21 +84,26 @@ public class PuttyKeyFileGenerator
|
||||
bw.Write(new byte[] { 0x00 });
|
||||
bw.Write(bytes);
|
||||
}
|
||||
|
||||
|
||||
private static string[] SpliceText(string text, int lineLength)
|
||||
{
|
||||
return Regex.Matches(text, ".{1," + lineLength + "}").Cast<Match>().Select(m => m.Value).ToArray();
|
||||
}
|
||||
private static int GetPrefixSize(byte[] bytes)
|
||||
private static int GetPrefixSize(byte[]? bytes)
|
||||
{
|
||||
if (bytes is null)
|
||||
return 0;
|
||||
|
||||
return CheckIsNeddPadding(bytes) ? paddedPrefixSize : prefixSize;
|
||||
}
|
||||
private static bool CheckIsNeddPadding(byte[] bytes)
|
||||
{
|
||||
if (bytes is null || bytes.Length == 0)
|
||||
return false;
|
||||
|
||||
// 128 == 10000000
|
||||
// This means that the number of bits can be divided by 8.
|
||||
// According to the algorithm in putty, you need to add a padding.
|
||||
return bytes[0] >= 128;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,15 @@ using System.Resources;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("mRemoteNG")]
|
||||
[assembly: AssemblyProduct("mRemoteNG Connection Manager")]
|
||||
[assembly: AssemblyCopyright("(c) 2023 mRemoteNG")]
|
||||
[assembly: AssemblyCopyright("(c) 2024 mRemoteNG")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information
|
||||
[assembly: AssemblyVersion("1.77.3.1764")]
|
||||
[assembly: AssemblyFileVersion("1.77.3.1764")]
|
||||
[assembly: AssemblyVersion("1.77.3.1765")]
|
||||
[assembly: AssemblyFileVersion("1.77.3.1765")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en-US")]
|
||||
[assembly: AssemblyInformationalVersion("1.77.3 (Nightly Build 1764)")]
|
||||
[assembly: AssemblyInformationalVersion("1.77.3 (Nightly Build 1765)")]
|
||||
|
||||
// Logging
|
||||
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")]
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Resources;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("mRemoteNG")]
|
||||
[assembly: AssemblyProduct("mRemoteNG Connection Manager")]
|
||||
[assembly: AssemblyCopyright("(c) 2023 mRemoteNG")]
|
||||
[assembly: AssemblyCopyright("(c) 2024 mRemoteNG")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -29,7 +29,7 @@ using System.Resources;
|
||||
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config")]
|
||||
|
||||
<#+
|
||||
//build is a days from date of last release + curent hour + curent minute of build
|
||||
//build is a number of days from date of last release + curent hour + curent minute of build
|
||||
int major = 1;
|
||||
int minor = 77;
|
||||
int revision = 3;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace mRemoteNG.UI.Tabs
|
||||
[DllImport("User32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern uint SendMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam);
|
||||
|
||||
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
|
||||
//[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
int WM_NCLBUTTONDOWN = 0x00A1;
|
||||
@@ -53,9 +53,9 @@ namespace mRemoteNG.UI.Tabs
|
||||
if ((uint)m.WParam == 8) // Check if button down occured in minimize box
|
||||
{
|
||||
if (WindowState == FormWindowState.Minimized)
|
||||
FloatWindowNG.SendMessage(Handle, (int)WM_SYSCOMMAND, (uint)SC_RESTORE, 0);
|
||||
_ = FloatWindowNG.SendMessage(Handle, (int)WM_SYSCOMMAND, (uint)SC_RESTORE, 0);
|
||||
else
|
||||
FloatWindowNG.SendMessage(Handle, (int)WM_SYSCOMMAND, (uint)SC_MINIMIZE, 0);
|
||||
_ = FloatWindowNG.SendMessage(Handle, (int)WM_SYSCOMMAND, (uint)SC_MINIMIZE, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="echo $(ConfigurationName) > buildenv.tmp
powershell.exe -WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -Command "$InfoText='[Pre-Build-Event-Info]';'{0} PowerShell Version: {1}' -f $InfoText,$PSVersionTable.PSVersion.toString(); $VSToolsDir=(. '$(SolutionDir)Tools\find_vstool.ps1' -FileName 'devenv.exe'); $Env:DevEnvDir = Split-Path -Path $VSToolsDir -Parent; '{0} VS tools dir found: {1}' -f $InfoText,$Env:DevEnvDir;if ($Env:APPVEYOR) {'{0} AppVeyor (cloud based CI/CD) environment detected' -f $InfoText; &'$(DevEnvDir)TextTransform.exe' -a !!BuildConfiguration!'$(Configuration)' '$(ProjectDir)Properties\AssemblyInfo.tt'} else {'{0} None AppVeyor (cloud based CI/CD) environment detected, continue' -f $InfoText;}"" />
|
||||
<Exec Command="echo $(ConfigurationName) > buildenv.tmp
powershell.exe -WindowStyle Hidden -NonInteractive -ExecutionPolicy Bypass -Command "$InfoText='[Pre-Build-Event-Info]';'{0} PowerShell Version: {1}' -f $InfoText,$PSVersionTable.PSVersion.toString(); $VSToolsDir=(. '$(SolutionDir)Tools\find_vstool.ps1' -FileName 'devenv.exe'); $Env:DevEnvDir = Split-Path -Path $VSToolsDir -Parent; '{0} VS tools dir found: {1}' -f $InfoText,$Env:DevEnvDir;if ($Env:APPVEYOR) {'{0} AppVeyor (cloud based CI/CD) environment detected' -f $InfoText; &'$(DevEnvDir)TextTransform.exe' -a !!BuildConfiguration!'$(Configuration)' '$(ProjectDir)Properties\AssemblyInfo.tt'} else {'{0} None AppVeyor (cloud based CI/CD) environment detected, continue' -f $InfoText; &'$(DevEnvDir)TextTransform.exe' -a !!BuildConfiguration!'$(Configuration)' '$(ProjectDir)Properties\AssemblyInfo.tt'}"" />
|
||||
</Target>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command=":: When passing paths to powershell scripts, check if the path ends with a backslash "\"
:: If it does, then the backslash may be interpreted as an escape character. Add another backslash to cancel the first one.

powershell -noprofile -command "sleep 2"

set /p buildenv=<buildenv.tmp

:: Manual builds, set the cert password and uncomment below.
:: IF "%25APPVEYOR_BUILD_FOLDER"=="" ( set cert_pwd= )

:: Call the post build powershell script
powershell.exe -ExecutionPolicy Bypass -File "$(SolutionDir)Tools\postbuild.ps1" -SolutionDir "$(SolutionDir)\" -TargetDir "$(TargetDir)\" -TargetFileName "mRemoteNG.exe" -ConfigurationName "%25buildenv%25" -CertificatePath "$(CertPath)" -CertificatePassword "$(CertPassword)" -ExcludeFromSigning "putty.exe"" />
|
||||
|
||||
Reference in New Issue
Block a user