fixed issue loading kdb files with key file

improved error message by adding messages to loading exceptions in Java
This commit is contained in:
Philipp Crocoll
2014-11-11 17:19:22 +01:00
parent 3239131a84
commit 49c4fa5b05
13 changed files with 79 additions and 15 deletions

View File

@@ -36,25 +36,21 @@ namespace keepass2android
}
KcpKeyFile passwordKeyfile = (KcpKeyFile)key.GetUserKey(typeof(KcpKeyFile));
string keyfile = "";
MemoryStream keyfileStream = null;
if (passwordKeyfile != null)
{
keyfile = passwordKeyfile.Path;
keyfileStream = new MemoryStream(passwordKeyfile.RawFileData.ReadData());
}
try
{
var dbv3 = importer.OpenDatabase(hashingStream, password, keyfile);
var dbv3 = importer.OpenDatabase(hashingStream, password, keyfileStream);
db.Name = dbv3.Name;
db.RootGroup = ConvertGroup(dbv3.RootGroup);
}
catch (InvalidPasswordException e) {
return;
}
catch (Java.IO.FileNotFoundException e)
{
throw new FileNotFoundException(