Argon2KDF write mode works! (thanks to an option in XMLWriterSettings)

This commit is contained in:
BONNEVILLE Geoffroy
2017-11-08 17:52:00 +01:00
parent 29e7b22953
commit 65f2e529f4
9 changed files with 29 additions and 28 deletions

View File

@@ -26,11 +26,8 @@ using System.IO;
using System.Security;
using System.Text;
using System.Xml;
#if ModernKeePassLib
using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams;
#else
#if !ModernKeePassLib && !KeePassUAP
using System.Security.Cryptography;
#endif
@@ -40,15 +37,15 @@ using System.IO.Compression;
using KeePassLibSD;
#endif
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLib.Cryptography.KeyDerivation;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Keys;
using ModernKeePassLib.Resources;
using ModernKeePassLib.Utility;
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography.KeyDerivation;
using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
namespace ModernKeePassLib.Serialization
{

View File

@@ -25,9 +25,8 @@ using System.IO;
using System.Security;
using System.Text;
using System.Xml;
#if ModernKeePassLib
using Windows.Security.Cryptography;
#else
#if !ModernKeePassLib && !KeePassUAP
using System.Drawing;
using System.Security.Cryptography;
#endif
@@ -41,15 +40,13 @@ using System.IO.Compression;
using ModernKeePassLib.Collections;
using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLib.Cryptography.KeyDerivation;
using ModernKeePassLib.Delegates;
using ModernKeePassLib.Interfaces;
using ModernKeePassLib.Keys;
using ModernKeePassLib.Resources;
using ModernKeePassLib.Security;
using ModernKeePassLib.Utility;
using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams;
using ModernKeePassLib.Cryptography.KeyDerivation;
namespace ModernKeePassLib.Serialization
{
@@ -212,8 +209,13 @@ namespace ModernKeePassLib.Serialization
xws.Indent = true;
xws.IndentChars = "\t";
xws.NewLineOnAttributes = false;
#if ModernKeePassLib
// This is needed for Argon2Kdf write
xws.Async = true;
if (m_uFileVersion >= FileVersion32_4) xws.CloseOutput = true;
#endif
XmlWriter xw = XmlWriter.Create(sXml, xws);
XmlWriter xw = XmlWriter.Create(sXml, xws);
#else
XmlTextWriter xw = new XmlTextWriter(sXml, encNoBom);

View File

@@ -519,8 +519,8 @@ namespace ModernKeePassLib.Serialization
byte[] pbData = pb.ReadData();
/*var file = FileSystem.Current.GetFileFromPathAsync(strPath).Result;
using (var stream = file.OpenAsync(FileAccess.ReadAndWrite).Result) {*/
var file = StorageFile.GetFileFromPathAsync(strPath).GetResults();
using (var stream = file.OpenAsync(FileAccessMode.ReadWrite).GetResults().AsStream())
var file = StorageFile.GetFileFromPathAsync(strPath).GetAwaiter().GetResult();
using (var stream = file.OpenAsync(FileAccessMode.ReadWrite).GetAwaiter().GetResult().AsStream())
{
stream.Write (pbData, 0, pbData.Length);
}