@@ -1,3 +1,6 @@ | |||||
4.4.1.0 2022-02-08 | |||||
- Add plain/none ciphers | |||||
4.4.0.0 2021-01-01 | 4.4.0.0 2021-01-01 | ||||
- Security: remove infrastructure of stream ciphers (#3048) | - Security: remove infrastructure of stream ciphers (#3048) | ||||
- Show warning message when importing from deprecated legacy ss:// links. | - Show warning message when importing from deprecated legacy ss:// links. | ||||
@@ -11,7 +11,7 @@ | |||||
# version format | # version format | ||||
# Build version format is taken from UI if it is not set | # Build version format is taken from UI if it is not set | ||||
version: 4.4.0.{build} | |||||
version: 4.4.1.{build} | |||||
# # branches to build | # # branches to build | ||||
# branches: | # branches: | ||||
@@ -33,7 +33,7 @@ namespace Shadowsocks.Controller | |||||
public event EventHandler CheckUpdateCompleted; | public event EventHandler CheckUpdateCompleted; | ||||
public const string Version = "4.4.0.0"; | |||||
public const string Version = "4.4.1.0"; | |||||
private readonly Version _version; | private readonly Version _version; | ||||
public UpdateChecker() | public UpdateChecker() | ||||
@@ -3,6 +3,7 @@ using System.Collections.Generic; | |||||
using System.Reflection; | using System.Reflection; | ||||
using System.Text; | using System.Text; | ||||
using Shadowsocks.Encryption.AEAD; | using Shadowsocks.Encryption.AEAD; | ||||
using Shadowsocks.Encryption.Stream; | |||||
namespace Shadowsocks.Encryption | namespace Shadowsocks.Encryption | ||||
{ | { | ||||
@@ -16,6 +17,8 @@ namespace Shadowsocks.Encryption | |||||
{ | { | ||||
var AEADMbedTLSEncryptorSupportedCiphers = AEADMbedTLSEncryptor.SupportedCiphers(); | var AEADMbedTLSEncryptorSupportedCiphers = AEADMbedTLSEncryptor.SupportedCiphers(); | ||||
var AEADSodiumEncryptorSupportedCiphers = AEADSodiumEncryptor.SupportedCiphers(); | var AEADSodiumEncryptorSupportedCiphers = AEADSodiumEncryptor.SupportedCiphers(); | ||||
var PlainEncryptorSupportedCiphers = PlainEncryptor.SupportedCiphers(); | |||||
if (Sodium.AES256GCMAvailable) | if (Sodium.AES256GCMAvailable) | ||||
{ | { | ||||
// prefer to aes-256-gcm in libsodium | // prefer to aes-256-gcm in libsodium | ||||
@@ -43,6 +46,12 @@ namespace Shadowsocks.Encryption | |||||
if (!_registeredEncryptors.ContainsKey(method)) | if (!_registeredEncryptors.ContainsKey(method)) | ||||
_registeredEncryptors.Add(method, typeof(AEADMbedTLSEncryptor)); | _registeredEncryptors.Add(method, typeof(AEADMbedTLSEncryptor)); | ||||
} | } | ||||
foreach (string method in PlainEncryptorSupportedCiphers) | |||||
{ | |||||
if (!_registeredEncryptors.ContainsKey(method)) | |||||
_registeredEncryptors.Add(method, typeof(PlainEncryptor)); | |||||
} | |||||
} | } | ||||
public static IEncryptor GetEncryptor(string method, string password) | public static IEncryptor GetEncryptor(string method, string password) | ||||
@@ -0,0 +1,98 @@ | |||||
using System; | |||||
using System.Collections.Generic; | |||||
namespace Shadowsocks.Encryption.Stream | |||||
{ | |||||
class PlainEncryptor | |||||
: EncryptorBase, IDisposable | |||||
{ | |||||
const int CIPHER_NONE = 1; | |||||
private static Dictionary<string, EncryptorInfo> _ciphers = new Dictionary<string, EncryptorInfo> { | |||||
{ "plain", new EncryptorInfo("PLAIN", 0, 0, CIPHER_NONE) }, | |||||
{ "none", new EncryptorInfo("PLAIN", 0, 0, CIPHER_NONE) } | |||||
}; | |||||
public PlainEncryptor(string method, string password) : base(method, password) | |||||
{ | |||||
} | |||||
public static List<string> SupportedCiphers() | |||||
{ | |||||
return new List<string>(_ciphers.Keys); | |||||
} | |||||
protected Dictionary<string, EncryptorInfo> getCiphers() | |||||
{ | |||||
return _ciphers; | |||||
} | |||||
#region TCP | |||||
public override void Encrypt(byte[] buf, int length, byte[] outbuf, out int outlength) | |||||
{ | |||||
Buffer.BlockCopy(buf, 0, outbuf, 0, length); | |||||
outlength = length; | |||||
} | |||||
public override void Decrypt(byte[] buf, int length, byte[] outbuf, out int outlength) | |||||
{ | |||||
Buffer.BlockCopy(buf, 0, outbuf, 0, length); | |||||
outlength = length; | |||||
} | |||||
#endregion | |||||
#region UDP | |||||
public override void EncryptUDP(byte[] buf, int length, byte[] outbuf, out int outlength) | |||||
{ | |||||
Buffer.BlockCopy(buf, 0, outbuf, 0, length); | |||||
outlength = length; | |||||
} | |||||
public override void DecryptUDP(byte[] buf, int length, byte[] outbuf, out int outlength) | |||||
{ | |||||
Buffer.BlockCopy(buf, 0, outbuf, 0, length); | |||||
outlength = length; | |||||
} | |||||
#endregion | |||||
#region IDisposable | |||||
private bool _disposed; | |||||
// instance based lock | |||||
private readonly object _lock = new object(); | |||||
public override void Dispose() | |||||
{ | |||||
Dispose(true); | |||||
GC.SuppressFinalize(this); | |||||
} | |||||
~PlainEncryptor() | |||||
{ | |||||
Dispose(false); | |||||
} | |||||
protected virtual void Dispose(bool disposing) | |||||
{ | |||||
lock (_lock) | |||||
{ | |||||
if (_disposed) return; | |||||
_disposed = true; | |||||
} | |||||
if (disposing) | |||||
{ | |||||
// free managed objects | |||||
} | |||||
} | |||||
#endregion | |||||
} | |||||
} |
@@ -27,6 +27,8 @@ namespace Shadowsocks.View | |||||
// Edit here to add/delete encryption method displayed in UI | // Edit here to add/delete encryption method displayed in UI | ||||
private static string[] inuseMethod = new string[] | private static string[] inuseMethod = new string[] | ||||
{ | { | ||||
"none", | |||||
"plain", | |||||
"aes-256-gcm", | "aes-256-gcm", | ||||
"aes-192-gcm", | "aes-192-gcm", | ||||
"aes-128-gcm", | "aes-128-gcm", | ||||
@@ -611,5 +613,10 @@ namespace Shadowsocks.View | |||||
{ | { | ||||
ShowHidePluginArgInput(NeedPluginArgCheckBox.Checked); | ShowHidePluginArgInput(NeedPluginArgCheckBox.Checked); | ||||
} | } | ||||
private void EncryptionSelect_SelectedIndexChanged(object sender, EventArgs e) | |||||
{ | |||||
} | |||||
} | } | ||||
} | } |
@@ -240,6 +240,7 @@ | |||||
<Compile Include="Encryption\OpenSSL.cs" /> | <Compile Include="Encryption\OpenSSL.cs" /> | ||||
<Compile Include="Encryption\RNG.cs" /> | <Compile Include="Encryption\RNG.cs" /> | ||||
<Compile Include="Encryption\Sodium.cs" /> | <Compile Include="Encryption\Sodium.cs" /> | ||||
<Compile Include="Encryption\Stream\PlainEncryptor.cs" /> | |||||
<Compile Include="Localization\LocalizationProvider.cs" /> | <Compile Include="Localization\LocalizationProvider.cs" /> | ||||
<Compile Include="Localization\Strings.Designer.cs"> | <Compile Include="Localization\Strings.Designer.cs"> | ||||
<AutoGen>True</AutoGen> | <AutoGen>True</AutoGen> | ||||