Downgrade to net standard 1.2

This commit is contained in:
Geoffroy BONNEVILLE
2020-03-23 18:35:00 +01:00
parent b8240d482f
commit 5067f81189
60 changed files with 1250 additions and 285 deletions

View File

@@ -0,0 +1,26 @@
using System.IO;
using Org.BouncyCastle.Crypto.Engines;
using Org.BouncyCastle.Crypto.IO;
using Org.BouncyCastle.Crypto.Modes;
using Org.BouncyCastle.Crypto.Paddings;
using Org.BouncyCastle.Crypto.Parameters;
namespace ModernKeePassLib.Cryptography.Cipher
{
public class StandardAesEngineExt
{
internal static Stream CreateStream(Stream s, bool bEncrypt, byte[] pbKey, byte[] pbIV)
{
var cbc = new CbcBlockCipher(new AesEngine());
//var cbc = new CbcBlockCipher(new RijndaelEngine());
var bc = new PaddedBufferedBlockCipher(cbc, new Pkcs7Padding());
var kp = new KeyParameter(pbKey);
var prmIV = new ParametersWithIV(kp, pbIV);
bc.Init(bEncrypt, prmIV);
var cpRead = bEncrypt ? null : bc;
var cpWrite = bEncrypt ? bc : null;
return new CipherStream(s, cpRead, cpWrite);
}
}
}