Update dependencies (#10)

Fix code style
This commit is contained in:
2021-09-16 13:56:05 +02:00
committed by GitHub
parent d20e5bd308
commit 57925151fa
28 changed files with 378 additions and 256 deletions
@@ -77,16 +77,16 @@ namespace SystemExtensions.NetStandard.Security.Encryption
public async Task<Stream> Encrypt(string key, string iv, Stream value)
{
if (value is null) throw new ArgumentNullException(nameof(value));
return await EncryptInternal(StringToBytes(key), StringToBytes(iv), value).ConfigureAwait(false);
return value is null
? throw new ArgumentNullException(nameof(value))
: await EncryptInternal(StringToBytes(key), StringToBytes(iv), value).ConfigureAwait(false);
}
public async Task<Stream> Encrypt(byte[] key, byte[] iv, Stream value)
{
if (value is null) throw new ArgumentNullException(nameof(value));
return await EncryptInternal(key, iv, value).ConfigureAwait(false);
return value is null
? throw new ArgumentNullException(nameof(value))
: await EncryptInternal(key, iv, value).ConfigureAwait(false);
}
public Stream GetEncryptionStream(string key, string iv, Stream outStream)
@@ -112,9 +112,9 @@ namespace SystemExtensions.NetStandard.Security.Encryption
private static byte[] StreamToBytes(Stream value)
{
value.Position = 0;
byte[] buffer = new byte[1024];
var buffer = new byte[1024];
using var ms = new MemoryStream();
int read = -1;
var read = -1;
do
{
read = value.Read(buffer, 0, buffer.Length);
@@ -47,20 +47,33 @@ namespace System.Encryption
public static implicit operator SecureString(string s) => new(s);
public static SecureString operator +(SecureString ss1, SecureString ss2)
{
if (ss1 is null) throw new ArgumentNullException(nameof(ss1));
if (ss2 is null) throw new ArgumentNullException(nameof(ss2));
if (ss1 is null)
{
throw new ArgumentNullException(nameof(ss1));
}
if (ss2 is null)
{
throw new ArgumentNullException(nameof(ss2));
}
return new SecureString(ss1.Value + ss2.Value);
}
public static SecureString operator +(SecureString ss1, string s2)
{
if (ss1 is null) throw new ArgumentNullException(nameof(ss1));
if (ss1 is null)
{
throw new ArgumentNullException(nameof(ss1));
}
return new SecureString(ss1.Value + s2);
}
public static SecureString operator +(SecureString ss1, char c)
{
if (ss1 is null) throw new ArgumentNullException(nameof(ss1));
if (ss1 is null)
{
throw new ArgumentNullException(nameof(ss1));
}
return new SecureString(ss1.Value + c);
}