diff --git a/ModernKeePass/MainPage.xaml b/ModernKeePass/MainPage.xaml
index 9d10b60..7f6337b 100644
--- a/ModernKeePass/MainPage.xaml
+++ b/ModernKeePass/MainPage.xaml
@@ -54,7 +54,7 @@
-
+
diff --git a/ModernKeePass/ModernKeePass.csproj b/ModernKeePass/ModernKeePass.csproj
index f9acbb0..6daba0a 100644
--- a/ModernKeePass/ModernKeePass.csproj
+++ b/ModernKeePass/ModernKeePass.csproj
@@ -159,8 +159,8 @@
-
- ..\packages\ModernKeePassLib.2.19.0.24806\lib\netstandard1.2\ModernKeePassLib.dll
+
+ ..\packages\ModernKeePassLib.2.19.0.33692\lib\netstandard1.2\ModernKeePassLib.dll
True
diff --git a/ModernKeePass/packages.config b/ModernKeePass/packages.config
index a071fbd..591e6d7 100644
--- a/ModernKeePass/packages.config
+++ b/ModernKeePass/packages.config
@@ -2,7 +2,7 @@
-
+
diff --git a/ModernKeePassLib/Serialization/CryptoStream.cs b/ModernKeePassLib/Serialization/CryptoStream.cs
index 6c24cf5..599bbc4 100644
--- a/ModernKeePassLib/Serialization/CryptoStream.cs
+++ b/ModernKeePassLib/Serialization/CryptoStream.cs
@@ -18,17 +18,16 @@ namespace ModernKeePassLib.Serialization
private IEnumerator m_enumerator = null;
public CryptoStream(Stream s, String strAlgName, bool bEncrypt, byte[] pbKey, byte[] pbIV)
- : base()
{
IBuffer iv = CryptographicBuffer.CreateFromByteArray(pbIV);
SymmetricKeyAlgorithmProvider objAlg = SymmetricKeyAlgorithmProvider.OpenAlgorithm(strAlgName);
CryptographicKey key = objAlg.CreateSymmetricKey( CryptographicBuffer.CreateFromByteArray(pbKey) );
- if (bEncrypt)
+ /*if (bEncrypt)
{
Debug.Assert(false, "Not implemented yet");
}
else
- {
+ {*/
// For the time being, WinRT CryptographicEngine doesn't support stream decoding. Bummer.
// Copy the file to a memory buffer, then decode all at once.
@@ -50,7 +49,7 @@ namespace ModernKeePassLib.Serialization
}
CryptographicBuffer.CopyToByteArray(decoded, out m_decoded);
m_enumerator = m_decoded.AsEnumerable().GetEnumerator();
- }
+ //}
}
diff --git a/ModernKeePassLib/Serialization/IOConnection.cs b/ModernKeePassLib/Serialization/IOConnection.cs
index c36b4a6..4cd477e 100644
--- a/ModernKeePassLib/Serialization/IOConnection.cs
+++ b/ModernKeePassLib/Serialization/IOConnection.cs
@@ -281,13 +281,13 @@ namespace ModernKeePassLib.Serialization
return CreateWebClient(ioc).OpenWrite(uri);
}
#else
- public async static Task OpenWrite(IOConnectionInfo ioc)
+ public static async Task OpenWrite(IOConnectionInfo ioc)
{
return await OpenWriteLocal(ioc);
}
#endif
- private async static Task OpenWriteLocal(IOConnectionInfo ioc)
+ private static async Task OpenWriteLocal(IOConnectionInfo ioc)
{
try
{
@@ -303,18 +303,15 @@ namespace ModernKeePassLib.Serialization
public static bool FileExists(IOConnectionInfo ioc)
{
- return FileExists(ioc, false);
+ //return FileExists(ioc, false);
+ return true;
}
- public static bool FileExists(IOConnectionInfo ioc, bool bThrowErrors)
+ /*public static bool FileExists(IOConnectionInfo ioc, bool bThrowErrors)
{
- Debug.Assert(false, "Not implemented yet");
- return false;
-#if TODO
-
if(ioc == null) { Debug.Assert(false); return false; }
- if(ioc.IsLocalFile()) return File.Exists(ioc.Path);
+ if(ioc.IsLocalFile()) return ioc.StorageFile.IsAvailable;
try
{
@@ -334,15 +331,12 @@ namespace ModernKeePassLib.Serialization
}
return true;
-#endif
- }
+ }*/
- public static void DeleteFile(IOConnectionInfo ioc)
+ public static async void DeleteFile(IOConnectionInfo ioc)
{
- Debug.Assert(false, "Not implemented yet");
- return ;
-#if TODO
- if(ioc.IsLocalFile()) { File.Delete(ioc.Path); return; }
+ if(ioc.IsLocalFile()) { await ioc.StorageFile.DeleteAsync(StorageDeleteOption.Default);
+ }
#if !KeePassLibSD && TODO
WebRequest req = CreateWebRequest(ioc);
@@ -359,7 +353,6 @@ namespace ModernKeePassLib.Serialization
DisposeResponse(req.GetResponse(), true);
}
-#endif
#endif
}
@@ -372,11 +365,9 @@ namespace ModernKeePassLib.Serialization
///
/// Source file path.
/// Target file path.
- public static void RenameFile(IOConnectionInfo iocFrom, IOConnectionInfo iocTo)
+ public static async void RenameFile(IOConnectionInfo iocFrom, IOConnectionInfo iocTo)
{
- return;
-#if TODO
- if(iocFrom.IsLocalFile()) { File.Move(iocFrom.Path, iocTo.Path); return; }
+ if(iocFrom.IsLocalFile()) { await iocTo.StorageFile.RenameAsync(iocTo.Path, NameCollisionOption.GenerateUniqueName); }
#if !KeePassLibSD && TODO
WebRequest req = CreateWebRequest(iocFrom);
@@ -419,7 +410,6 @@ namespace ModernKeePassLib.Serialization
// sIn.Close();
// }
// DeleteFile(iocFrom);
-#endif
}
private static void DisposeResponse(WebResponse wr, bool bGetStream)
diff --git a/ModernKeePassLib/Serialization/Kdb4File.Write.cs b/ModernKeePassLib/Serialization/Kdb4File.Write.cs
index fb64f7b..b93e9ca 100644
--- a/ModernKeePassLib/Serialization/Kdb4File.Write.cs
+++ b/ModernKeePassLib/Serialization/Kdb4File.Write.cs
@@ -85,52 +85,60 @@ namespace ModernKeePassLib.Serialization
UTF8Encoding encNoBom = StrUtil.Utf8;
CryptoRandom cr = CryptoRandom.Instance;
- try
- {
- m_pbMasterSeed = cr.GetRandomBytes(32);
- m_pbTransformSeed = cr.GetRandomBytes(32);
- m_pbEncryptionIV = cr.GetRandomBytes(16);
+ try
+ {
+ m_pbMasterSeed = cr.GetRandomBytes(32);
+ m_pbTransformSeed = cr.GetRandomBytes(32);
+ m_pbEncryptionIV = cr.GetRandomBytes(16);
- m_pbProtectedStreamKey = cr.GetRandomBytes(32);
- m_craInnerRandomStream = CrsAlgorithm.Salsa20;
- m_randomStream = new CryptoRandomStream(m_craInnerRandomStream,
- m_pbProtectedStreamKey);
+ m_pbProtectedStreamKey = cr.GetRandomBytes(32);
+ m_craInnerRandomStream = CrsAlgorithm.Salsa20;
+ m_randomStream = new CryptoRandomStream(m_craInnerRandomStream,
+ m_pbProtectedStreamKey);
- m_pbStreamStartBytes = cr.GetRandomBytes(32);
+ m_pbStreamStartBytes = cr.GetRandomBytes(32);
- Stream writerStream;
- BinaryWriter bw = null;
- if(m_format == Kdb4Format.Default)
- {
- bw = new BinaryWriter(hashedStream, encNoBom);
- WriteHeader(bw); // Also flushes bw
+ Stream writerStream;
+ BinaryWriter bw = null;
+ if (m_format == Kdb4Format.Default)
+ {
+ bw = new BinaryWriter(hashedStream, encNoBom);
+ WriteHeader(bw); // Also flushes bw
- Stream sEncrypted = AttachStreamEncryptor(hashedStream);
- if((sEncrypted == null) || (sEncrypted == hashedStream))
- throw new SecurityException(KLRes.CryptoStreamFailed);
+ Stream sEncrypted = AttachStreamEncryptor(hashedStream);
+ if ((sEncrypted == null) || (sEncrypted == hashedStream))
+ throw new SecurityException(KLRes.CryptoStreamFailed);
- sEncrypted.Write(m_pbStreamStartBytes, 0, m_pbStreamStartBytes.Length);
+ sEncrypted.Write(m_pbStreamStartBytes, 0, m_pbStreamStartBytes.Length);
- Stream sHashed = new HashedBlockStream(sEncrypted, true);
+ Stream sHashed = new HashedBlockStream(sEncrypted, true);
- if(m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
- writerStream = new GZipStream(sHashed, CompressionMode.Compress);
- else
- writerStream = sHashed;
- }
- else if(m_format == Kdb4Format.PlainXml)
- writerStream = hashedStream;
- else { Debug.Assert(false); throw new FormatException("KdbFormat"); }
+ if (m_pwDatabase.Compression == PwCompressionAlgorithm.GZip)
+ writerStream = new GZipStream(sHashed, CompressionMode.Compress);
+ else
+ writerStream = sHashed;
+ }
+ else if (m_format == Kdb4Format.PlainXml)
+ writerStream = hashedStream;
+ else
+ {
+ Debug.Assert(false);
+ throw new FormatException("KdbFormat");
+ }
- using (m_xmlWriter = XmlWriter.Create(writerStream, new XmlWriterSettings { Encoding = encNoBom }))
- {
- WriteDocument(pgDataSource);
+ using (m_xmlWriter = XmlWriter.Create(writerStream, new XmlWriterSettings {Encoding = encNoBom}))
+ {
+ WriteDocument(pgDataSource);
- m_xmlWriter.Flush();
- writerStream.Dispose();
- }
- GC.KeepAlive(bw);
- }
+ m_xmlWriter.Flush();
+ writerStream.Dispose();
+ }
+ GC.KeepAlive(bw);
+ }
+ catch (Exception ex)
+ {
+
+ }
finally { CommonCleanUpWrite(sSaveTo, hashedStream); }
}