Compare commits
99 Commits
1.08d-r5
...
l10n_maste
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b90ad6e595 | ||
|
|
38ce10e6cc | ||
|
|
a6cd4c5358 | ||
|
|
e2668f85ca | ||
|
|
2f3aa0aca3 | ||
|
|
4cf4299b37 | ||
|
|
32bd3d0d6b | ||
|
|
ea2a38a6ee | ||
|
|
6ec537e385 | ||
|
|
556855ab6c | ||
|
|
c98e789128 | ||
|
|
cd2c65d763 | ||
|
|
c1116fb836 | ||
|
|
7b09a7c9bf | ||
|
|
c8029a835e | ||
|
|
0b18490ce7 | ||
|
|
395d85385f | ||
|
|
3da8e8a6cc | ||
|
|
220a64393f | ||
|
|
da64e724ed | ||
|
|
28d3db3211 | ||
|
|
eeabd3e7d9 | ||
|
|
f30f6efaa0 | ||
|
|
ff812441fc | ||
|
|
91492f2a73 | ||
|
|
64252b6a04 | ||
|
|
1b5c294d5a | ||
|
|
2d6e4c9f94 | ||
|
|
3ec6e73b33 | ||
|
|
e8db9a1e17 | ||
|
|
7c8470175a | ||
|
|
5505dd4266 | ||
|
|
3bdd05be5b | ||
|
|
cfeb3db3ab | ||
|
|
c4d892dff7 | ||
|
|
cc9c95aeec | ||
|
|
5289ee9dc5 | ||
|
|
82bcfa0a86 | ||
|
|
fe529e4f03 | ||
|
|
7a8b1b9666 | ||
|
|
6199b6f6a2 | ||
|
|
6392202ab6 | ||
|
|
9b2ef0e8f6 | ||
|
|
0c84610224 | ||
|
|
29a4c9a67e | ||
|
|
e8cf6d16ed | ||
|
|
554d827852 | ||
|
|
8548440a5f | ||
|
|
e8542e7e39 | ||
|
|
b1a5e34de4 | ||
|
|
56dee832f9 | ||
|
|
c1d2e89a49 | ||
|
|
57f57715ad | ||
|
|
182cce9e8f | ||
|
|
df23c7c566 | ||
|
|
4fa605bc4d | ||
|
|
706bc792f6 | ||
|
|
b0405d474d | ||
|
|
bf3b6d84fd | ||
|
|
9a277231d2 | ||
|
|
bec528d845 | ||
|
|
f1bf0c6220 | ||
|
|
bb9df5b93a | ||
|
|
34d0b703ba | ||
|
|
e0920c3f08 | ||
|
|
8c56cc37e4 | ||
|
|
4e5f6ab9de | ||
|
|
b6a666e1cc | ||
|
|
ea123c9b9c | ||
|
|
97ecf17e92 | ||
|
|
16dc8a9c7e | ||
|
|
fcae243cfa | ||
|
|
f6e05cac0f | ||
|
|
3f97e53f5a | ||
|
|
b500be06f2 | ||
|
|
1b9d8ecfe3 | ||
|
|
a7b6c97634 | ||
|
|
1c797e0d68 | ||
|
|
75f9b8338a | ||
|
|
ee1b38cdb3 | ||
|
|
2be344daf3 | ||
|
|
e44d20e02b | ||
|
|
e2cab68003 | ||
|
|
7eef326c15 | ||
|
|
d1a56b8406 | ||
|
|
efa65ea520 | ||
|
|
bbac3ba77b | ||
|
|
aa8222b870 | ||
|
|
ad1c100485 | ||
|
|
ed0085fabd | ||
|
|
19283d159e | ||
|
|
c61db37a0b | ||
|
|
ec1e56984f | ||
|
|
a048c762b0 | ||
|
|
2c8aa264f9 | ||
|
|
70eef6f9c9 | ||
|
|
fb828670ad | ||
|
|
15020a80e2 | ||
|
|
99b0d78502 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -169,5 +169,3 @@ src/java/Keepass2AndroidPluginSDK2/build/generated/mockable-Google-Inc.-Google-A
|
||||
/src/java/KP2AKdbLibrary/app/build
|
||||
/src/java/KP2ASoftkeyboard_AS/app/.cxx
|
||||
/src/java/KP2ASoftkeyboard_AS/app/src/main/libs
|
||||
/src/java/KP2AKdbLibrary/app/.cxx
|
||||
/src/ActionViewFilterTest
|
||||
|
||||
24
crowdin.yml
24
crowdin.yml
@@ -8,27 +8,3 @@ files:
|
||||
two_letters_code:
|
||||
zh-CN: zh
|
||||
zh-TW: zh-rTW
|
||||
pt-PT: pt
|
||||
pt-BR: pt-rBR
|
||||
- source: src/java/android-filechooser-AS/app/src/main/res/values/strings.xml
|
||||
translation: >-
|
||||
/src/java/android-filechooser-AS/app/src/main/res/values-%two_letters_code%/%original_file_name%
|
||||
translate_attributes: '0'
|
||||
content_segmentation: '0'
|
||||
languages_mapping:
|
||||
two_letters_code:
|
||||
zh-CN: zh
|
||||
zh-TW: zh-rTW
|
||||
pt-PT: pt
|
||||
pt-BR: pt-rBR
|
||||
- source: src/java/KP2ASoftkeyboard_AS/app/src/main/res/values/strings.xml
|
||||
translation: >-
|
||||
/src/java/KP2ASoftkeyboard_AS/app/src/main/res/values-%two_letters_code%/%original_file_name%
|
||||
translate_attributes: '0'
|
||||
content_segmentation: '0'
|
||||
languages_mapping:
|
||||
two_letters_code:
|
||||
zh-CN: zh
|
||||
zh-TW: zh-rTW
|
||||
pt-PT: pt
|
||||
pt-BR: pt-rBR
|
||||
|
||||
@@ -98,23 +98,6 @@ It's time for action! As soon as possible, select Settings - Database - Export a
|
||||
## Why is Keepass2Android's apk so big?
|
||||
Please see [Keepass2Android Apk](Keepass2Android-Apk.md) for more information.
|
||||
|
||||
## I get a message "File is trashed" when reading or writing a file on Google Drive
|
||||
This happens because ocaml-fuse (I guess you are on Linux and use that) moves files to trash and then creates a new one instead of correctly updating the file on Google Drive (each file has a unique ID which Keepass2Android uses). Fortunately, this was fixed: https://github.com/astrada/google-drive-ocamlfuse/issues/494After activating this option, please select "Change database" in KP2A, tap ,"Open file" and browse to the file on Google Drive again. After that, the message should no longer pop up.
|
||||
|
||||
## I get a message "The name must not be empty: null" when opening from Google Drive
|
||||
Please follow these steps:
|
||||
|
||||
* select "Change database" on the password screen, then "Open database" and browse to your file again
|
||||
* go to Android app settings and disable all permissions for the KP2A app. Then try again to open the database file.
|
||||
* reboot the device
|
||||
|
||||
(Before running the following steps, make sure you don't have local changes in your database which have not been synchronized with Google Drive (this can happen if you worked offline). If you have, please open the database from the local cache and go to settings - database settings - export database and make a backup copy of the data.)
|
||||
|
||||
* clear KP2A's app cache in the Android settings
|
||||
* uninstall & reinstall
|
||||
|
||||
One of these has helped all users so far, but unfortunately it's not totally clear to me why different steps are required (or nothing for most users).
|
||||
|
||||
# For developers
|
||||
If you are interested in adding new features, you have two options:
|
||||
Either your features can be implemented as a plug-in. Please see [How to create a plug-in?](How-to-create-a-plug-in_.md) for more information. Or you add the features directly in the source code of the projects and create a pull request.
|
||||
|
||||
@@ -8,7 +8,7 @@ The password database file can be synchronized across different devices. This wo
|
||||
# Where to get it?
|
||||
Regular stable releases of Keepass2Android are available on [Google Play](https://play.google.com/store/apps/details?id=keepass2android.keepass2android).
|
||||
|
||||
Beta-releases can be obtained by opting in to the [Beta testing channel](https://play.google.com/apps/testing/keepass2android.keepass2android) or [Beta testing channel for Keepass2Android Offline](https://play.google.com/apps/testing/keepass2android.keepass2android_nonet).
|
||||
Beta-releases can be obtained by opting in to the [Beta testing channel](https://play.google.com/apps/testing/keepass2android.keepass2android) or [Beta testing channel for Keepass2Android Offline](https://play.google.com/apps/testing/keepass2android.keepass2android_nonet). Please join the [Beta tester group](https://plus.google.com/communities/107293657110547776032) for news and discussions about the latest beta releases.
|
||||
|
||||
# How can I contribute?
|
||||
* Help to translate Keepass2Android into your language or improve translations at [our Crowdin page](http://crowdin.net/project/keepass2android)
|
||||
|
||||
48
src/BiometricBinding/Additions/AboutAdditions.txt
Normal file
48
src/BiometricBinding/Additions/AboutAdditions.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
Additions allow you to add arbitrary C# to the generated classes
|
||||
before they are compiled. This can be helpful for providing convenience
|
||||
methods or adding pure C# classes.
|
||||
|
||||
== Adding Methods to Generated Classes ==
|
||||
|
||||
Let's say the library being bound has a Rectangle class with a constructor
|
||||
that takes an x and y position, and a width and length size. It will look like
|
||||
this:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (int x, int y, int width, int height)
|
||||
{
|
||||
// JNI bindings
|
||||
}
|
||||
}
|
||||
|
||||
Imagine we want to add a constructor to this class that takes a Point and
|
||||
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
|
||||
with a partial class containing our new method:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (Point location, Size size) :
|
||||
this (location.X, location.Y, size.Width, size.Height)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
At compile time, the additions class will be added to the generated class
|
||||
and the final assembly will a Rectangle class with both constructors.
|
||||
|
||||
|
||||
== Adding C# Classes ==
|
||||
|
||||
Another thing that can be done is adding fully C# managed classes to the
|
||||
generated library. In the above example, let's assume that there isn't a
|
||||
Point class available in Java or our library. The one we create doesn't need
|
||||
to interact with Java, so we'll create it like a normal class in C#.
|
||||
|
||||
By adding a Point.cs file with this class, it will end up in the binding library:
|
||||
|
||||
public class Point
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
||||
70
src/BiometricBinding/BiometricBinding.csproj
Normal file
70
src/BiometricBinding/BiometricBinding.csproj
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}</ProjectGuid>
|
||||
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>BiometricBinding</RootNamespace>
|
||||
<AssemblyName>BiometricBinding</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
|
||||
<AndroidClassParser>class-parse</AndroidClassParser>
|
||||
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
<None Include="Additions\AboutAdditions.txt" />
|
||||
<LibraryProjectZip Include="Jars\biometric-1.0.0-rc02.aar" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<TransformFile Include="Transforms\Metadata.xml" />
|
||||
<TransformFile Include="Transforms\EnumFields.xml" />
|
||||
<TransformFile Include="Transforms\EnumMethods.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.AndroidX.Fragment">
|
||||
<Version>1.0.0-preview02</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
24
src/BiometricBinding/Jars/AboutJars.txt
Normal file
24
src/BiometricBinding/Jars/AboutJars.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
This directory is for Android .jars.
|
||||
|
||||
There are 2 types of jars that are supported:
|
||||
|
||||
== Input Jar ==
|
||||
|
||||
This is the jar that bindings should be generated for.
|
||||
|
||||
For example, if you were binding the Google Maps library, this would
|
||||
be Google's "maps.jar".
|
||||
|
||||
Set the build action for these jars in the properties page to "InputJar".
|
||||
|
||||
|
||||
== Reference Jars ==
|
||||
|
||||
These are jars that are referenced by the input jar. C# bindings will
|
||||
not be created for these jars. These jars will be used to resolve
|
||||
types used by the input jar.
|
||||
|
||||
NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
|
||||
based on the Target Framework selected.
|
||||
|
||||
Set the build action for these jars in the properties page to "ReferenceJar".
|
||||
BIN
src/BiometricBinding/Jars/biometric-1.0.0-rc02.aar
Normal file
BIN
src/BiometricBinding/Jars/biometric-1.0.0-rc02.aar
Normal file
Binary file not shown.
30
src/BiometricBinding/Properties/AssemblyInfo.cs
Normal file
30
src/BiometricBinding/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("BiometricBinding")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("BiometricBinding")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
14
src/BiometricBinding/Transforms/EnumFields.xml
Normal file
14
src/BiometricBinding/Transforms/EnumFields.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<enum-field-mappings>
|
||||
<!--
|
||||
This example converts the constants Fragment_id, Fragment_name,
|
||||
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
|
||||
to an enum called Android.Support.V4.App.FragmentTagType with values
|
||||
Id, Name, and Tag.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
|
||||
<field jni-name="Fragment_name" clr-name="Name" value="0" />
|
||||
<field jni-name="Fragment_id" clr-name="Id" value="1" />
|
||||
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
|
||||
</mapping>
|
||||
-->
|
||||
</enum-field-mappings>
|
||||
13
src/BiometricBinding/Transforms/EnumMethods.xml
Normal file
13
src/BiometricBinding/Transforms/EnumMethods.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<enum-method-mappings>
|
||||
<!--
|
||||
This example changes the Java method:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
|
||||
to be:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
|
||||
when bound in C#.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
|
||||
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
|
||||
</mapping>
|
||||
-->
|
||||
</enum-method-mappings>
|
||||
9
src/BiometricBinding/Transforms/Metadata.xml
Normal file
9
src/BiometricBinding/Transforms/Metadata.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<metadata>
|
||||
<!--
|
||||
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
|
||||
|
||||
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
|
||||
-->
|
||||
</metadata>
|
||||
Binary file not shown.
BIN
src/JavaFileStorageBindings/Jars/okhttp-4.2.2.jar
Normal file
BIN
src/JavaFileStorageBindings/Jars/okhttp-4.2.2.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/JavaFileStorageBindings/Jars/okio-2.2.2.jar
Normal file
BIN
src/JavaFileStorageBindings/Jars/okio-2.2.2.jar
Normal file
Binary file not shown.
Binary file not shown.
@@ -146,12 +146,12 @@
|
||||
<EmbeddedReferenceJar Include="Jars\gson-2.8.1.jar" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedReferenceJar Include="Jars\okhttp-digest-2.5.jar" />
|
||||
<EmbeddedReferenceJar Include="Jars\okhttp-4.2.2.jar" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedReferenceJar Include="Jars\okio-2.9.0.jar" />
|
||||
<EmbeddedReferenceJar Include="Jars\okio-2.2.2.jar" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedReferenceJar Include="Jars\okhttp-4.10.0-RC1.jar" />
|
||||
<EmbeddedReferenceJar Include="Jars\okhttp-digest-2.0.jar" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SamsungPass", "SamsungPass\
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PCloudBindings", "PCloudBindings\PCloudBindings.csproj", "{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BiometricBinding", "BiometricBinding\BiometricBinding.csproj", "{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -295,6 +297,30 @@ Global
|
||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|Win32.Build.0 = ReleaseNoNet|Any CPU
|
||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|x64.ActiveCfg = ReleaseNoNet|Any CPU
|
||||
{2DB80C77-D46F-4970-B967-E9FFA9B2AC2E}.ReleaseNoNet|x64.Build.0 = ReleaseNoNet|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|Win32.Build.0 = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|Win32.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|Win32.Build.0 = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.Release|x64.Build.0 = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|Any CPU.Build.0 = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|Win32.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|Win32.Build.0 = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|x64.ActiveCfg = Release|Any CPU
|
||||
{2B1DE455-BF8E-4F8A-87BE-AE7EA354F3E4}.ReleaseNoNet|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -367,27 +367,5 @@ namespace KeePassLib.Cryptography
|
||||
Debug.Assert(iPos == pbRes.Length);
|
||||
return pbRes;
|
||||
}
|
||||
|
||||
|
||||
private static int g_iWeakSeed = 0;
|
||||
public static Random NewWeakRandom()
|
||||
{
|
||||
long s64 = DateTime.UtcNow.ToBinary();
|
||||
int s32 = (int)((s64 >> 32) ^ s64);
|
||||
|
||||
lock (g_oSyncRoot)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
g_iWeakSeed += 0x78A8C4B7; // Prime number
|
||||
s32 ^= g_iWeakSeed;
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent overflow in the Random constructor of .NET 2.0
|
||||
if (s32 == int.MinValue) s32 = int.MaxValue;
|
||||
|
||||
return new Random(s32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -20,67 +20,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
#if !KeePassUAP
|
||||
using System.Security.Cryptography;
|
||||
#endif
|
||||
|
||||
using KeePassLib.Native;
|
||||
using KeePassLib.Utility;
|
||||
|
||||
namespace KeePassLib.Cryptography
|
||||
{
|
||||
public static class CryptoUtil
|
||||
{
|
||||
private static bool? g_obProtData = null;
|
||||
public static bool IsProtectedDataSupported
|
||||
{
|
||||
get
|
||||
{
|
||||
if (g_obProtData.HasValue) return g_obProtData.Value;
|
||||
|
||||
bool b = false;
|
||||
try
|
||||
{
|
||||
Random r = CryptoRandom.NewWeakRandom();
|
||||
|
||||
byte[] pbData = new byte[137];
|
||||
r.NextBytes(pbData);
|
||||
|
||||
byte[] pbEnt = new byte[41];
|
||||
r.NextBytes(pbEnt);
|
||||
|
||||
byte[] pbEnc = ProtectedData.Protect(pbData, pbEnt,
|
||||
DataProtectionScope.CurrentUser);
|
||||
if ((pbEnc != null) && !MemUtil.ArraysEqual(pbEnc, pbData))
|
||||
{
|
||||
byte[] pbDec = ProtectedData.Unprotect(pbEnc, pbEnt,
|
||||
DataProtectionScope.CurrentUser);
|
||||
if ((pbDec != null) && MemUtil.ArraysEqual(pbDec, pbData))
|
||||
b = true;
|
||||
}
|
||||
}
|
||||
catch (Exception) { Debug.Assert(false); }
|
||||
|
||||
Debug.Assert(b); // Should be supported on all systems
|
||||
g_obProtData = b;
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] HashSha256(byte[] pbData)
|
||||
{
|
||||
if (pbData == null) throw new ArgumentNullException("pbData");
|
||||
if(pbData == null) throw new ArgumentNullException("pbData");
|
||||
|
||||
return HashSha256(pbData, 0, pbData.Length);
|
||||
}
|
||||
|
||||
public static byte[] HashSha256(byte[] pbData, int iOffset, int cbCount)
|
||||
{
|
||||
if (pbData == null) throw new ArgumentNullException("pbData");
|
||||
if(pbData == null) throw new ArgumentNullException("pbData");
|
||||
|
||||
#if DEBUG
|
||||
byte[] pbCopy = new byte[pbData.Length];
|
||||
@@ -88,7 +49,7 @@ namespace KeePassLib.Cryptography
|
||||
#endif
|
||||
|
||||
byte[] pbHash;
|
||||
using (SHA256Managed h = new SHA256Managed())
|
||||
using(SHA256Managed h = new SHA256Managed())
|
||||
{
|
||||
pbHash = h.ComputeHash(pbData, iOffset, cbCount);
|
||||
}
|
||||
@@ -105,22 +66,6 @@ namespace KeePassLib.Cryptography
|
||||
return pbHash;
|
||||
}
|
||||
|
||||
internal static byte[] HashSha256(string strFilePath)
|
||||
{
|
||||
byte[] pbHash = null;
|
||||
|
||||
using (FileStream fs = new FileStream(strFilePath, FileMode.Open,
|
||||
FileAccess.Read, FileShare.Read))
|
||||
{
|
||||
using (SHA256Managed h = new SHA256Managed())
|
||||
{
|
||||
pbHash = h.ComputeHash(fs);
|
||||
}
|
||||
}
|
||||
|
||||
return pbHash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a cryptographic key of length <paramref name="cbOut" />
|
||||
/// (in bytes) from <paramref name="pbIn" />.
|
||||
@@ -128,34 +73,34 @@ namespace KeePassLib.Cryptography
|
||||
public static byte[] ResizeKey(byte[] pbIn, int iInOffset,
|
||||
int cbIn, int cbOut)
|
||||
{
|
||||
if (pbIn == null) throw new ArgumentNullException("pbIn");
|
||||
if (cbOut < 0) throw new ArgumentOutOfRangeException("cbOut");
|
||||
if(pbIn == null) throw new ArgumentNullException("pbIn");
|
||||
if(cbOut < 0) throw new ArgumentOutOfRangeException("cbOut");
|
||||
|
||||
if (cbOut == 0) return MemUtil.EmptyByteArray;
|
||||
if(cbOut == 0) return MemUtil.EmptyByteArray;
|
||||
|
||||
byte[] pbHash;
|
||||
if (cbOut <= 32) pbHash = HashSha256(pbIn, iInOffset, cbIn);
|
||||
if(cbOut <= 32) pbHash = HashSha256(pbIn, iInOffset, cbIn);
|
||||
else
|
||||
{
|
||||
using (SHA512Managed h = new SHA512Managed())
|
||||
using(SHA512Managed h = new SHA512Managed())
|
||||
{
|
||||
pbHash = h.ComputeHash(pbIn, iInOffset, cbIn);
|
||||
}
|
||||
}
|
||||
|
||||
if (cbOut == pbHash.Length) return pbHash;
|
||||
if(cbOut == pbHash.Length) return pbHash;
|
||||
|
||||
byte[] pbRet = new byte[cbOut];
|
||||
if (cbOut < pbHash.Length)
|
||||
if(cbOut < pbHash.Length)
|
||||
Array.Copy(pbHash, pbRet, cbOut);
|
||||
else
|
||||
{
|
||||
int iPos = 0;
|
||||
ulong r = 0;
|
||||
while (iPos < cbOut)
|
||||
while(iPos < cbOut)
|
||||
{
|
||||
Debug.Assert(pbHash.Length == 64);
|
||||
using (HMACSHA256 h = new HMACSHA256(pbHash))
|
||||
using(HMACSHA256 h = new HMACSHA256(pbHash))
|
||||
{
|
||||
byte[] pbR = MemUtil.UInt64ToBytes(r);
|
||||
byte[] pbPart = h.ComputeHash(pbR);
|
||||
@@ -180,75 +125,5 @@ namespace KeePassLib.Cryptography
|
||||
MemUtil.ZeroByteArray(pbHash);
|
||||
return pbRet;
|
||||
}
|
||||
|
||||
#if !KeePassUAP
|
||||
private static bool? g_obAesCsp = null;
|
||||
internal static SymmetricAlgorithm CreateAes()
|
||||
{
|
||||
if (g_obAesCsp.HasValue)
|
||||
return (g_obAesCsp.Value ? CreateAesCsp() : new RijndaelManaged());
|
||||
|
||||
SymmetricAlgorithm a = CreateAesCsp();
|
||||
g_obAesCsp = (a != null);
|
||||
return (a ?? new RijndaelManaged());
|
||||
}
|
||||
|
||||
private static SymmetricAlgorithm CreateAesCsp()
|
||||
{
|
||||
try
|
||||
{
|
||||
// On Windows, the CSP implementation is only minimally
|
||||
// faster (and for key derivations it's not used anyway,
|
||||
// as KeePass uses a native implementation based on
|
||||
// CNG/BCrypt, which is much faster)
|
||||
if (!NativeLib.IsUnix()) return null;
|
||||
|
||||
string strFqn = Assembly.CreateQualifiedName(
|
||||
"System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
|
||||
"System.Security.Cryptography.AesCryptoServiceProvider");
|
||||
|
||||
Type t = Type.GetType(strFqn);
|
||||
if (t == null) return null;
|
||||
|
||||
return (Activator.CreateInstance(t) as SymmetricAlgorithm);
|
||||
}
|
||||
catch (Exception) { Debug.Assert(false); }
|
||||
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static byte[] ProtectData(byte[] pb, byte[] pbOptEntropy,
|
||||
DataProtectionScope s)
|
||||
{
|
||||
return ProtectDataPriv(pb, true, pbOptEntropy, s);
|
||||
}
|
||||
|
||||
public static byte[] UnprotectData(byte[] pb, byte[] pbOptEntropy,
|
||||
DataProtectionScope s)
|
||||
{
|
||||
return ProtectDataPriv(pb, false, pbOptEntropy, s);
|
||||
}
|
||||
|
||||
private static byte[] ProtectDataPriv(byte[] pb, bool bProtect,
|
||||
byte[] pbOptEntropy, DataProtectionScope s)
|
||||
{
|
||||
if (pb == null) throw new ArgumentNullException("pb");
|
||||
|
||||
if ((pbOptEntropy != null) && (pbOptEntropy.Length == 0))
|
||||
pbOptEntropy = null;
|
||||
|
||||
if (CryptoUtil.IsProtectedDataSupported)
|
||||
{
|
||||
if (bProtect)
|
||||
return ProtectedData.Protect(pb, pbOptEntropy, s);
|
||||
return ProtectedData.Unprotect(pb, pbOptEntropy, s);
|
||||
}
|
||||
|
||||
Debug.Assert(false);
|
||||
byte[] pbCopy = new byte[pb.Length];
|
||||
Array.Copy(pb, pbCopy, pb.Length);
|
||||
return pbCopy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
private const ulong NbBlockSizeInQW = NbBlockSize / 8UL;
|
||||
private const ulong NbSyncPoints = 4;
|
||||
|
||||
private const ulong NbAddressesInBlock = 128;
|
||||
|
||||
private const int NbPreHashDigestLength = 64;
|
||||
private const int NbPreHashSeedLength = NbPreHashDigestLength + 8;
|
||||
|
||||
@@ -58,7 +56,6 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
|
||||
private sealed class Argon2Ctx
|
||||
{
|
||||
public Argon2Type Type = Argon2Type.D;
|
||||
public uint Version = 0;
|
||||
|
||||
public ulong Lanes = 0;
|
||||
@@ -92,9 +89,9 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] Argon2Transform(byte[] pbMsg, byte[] pbSalt, uint uParallel,
|
||||
ulong uMem, ulong uIt, int cbOut, uint uVersion, byte[] pbSecretKey,
|
||||
byte[] pbAssocData)
|
||||
private static byte[] Argon2d(byte[] pbMsg, byte[] pbSalt, uint uParallel,
|
||||
ulong uMem, ulong uIt, int cbOut, uint uVersion, byte[] pbSecretKey,
|
||||
byte[] pbAssocData)
|
||||
{
|
||||
pbSecretKey = (pbSecretKey ?? MemUtil.EmptyByteArray);
|
||||
pbAssocData = (pbAssocData ?? MemUtil.EmptyByteArray);
|
||||
@@ -104,7 +101,6 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
#endif
|
||||
|
||||
Argon2Ctx ctx = new Argon2Ctx();
|
||||
ctx.Type = m_t;
|
||||
ctx.Version = uVersion;
|
||||
|
||||
ctx.Lanes = uParallel;
|
||||
@@ -141,7 +137,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||
MemUtil.UInt32ToBytesEx(uVersion, pbBuf, 0);
|
||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||
MemUtil.UInt32ToBytesEx((uint)m_t, pbBuf, 0);
|
||||
MemUtil.UInt32ToBytesEx(0, pbBuf, 0); // Argon2d type = 0
|
||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||
MemUtil.UInt32ToBytesEx((uint)pbMsg.Length, pbBuf, 0);
|
||||
h.TransformBlock(pbBuf, 0, pbBuf.Length, pbBuf, 0);
|
||||
@@ -491,43 +487,18 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
private static void FillSegmentThr(object o)
|
||||
{
|
||||
Argon2ThreadInfo ti = (o as Argon2ThreadInfo);
|
||||
if (ti == null) { Debug.Assert(false); return; }
|
||||
if(ti == null) { Debug.Assert(false); return; }
|
||||
|
||||
try
|
||||
{
|
||||
Argon2Ctx ctx = ti.Context;
|
||||
if (ctx == null) { Debug.Assert(false); return; }
|
||||
if(ctx == null) { Debug.Assert(false); return; }
|
||||
|
||||
Debug.Assert(ctx.Version >= MinVersion);
|
||||
bool bCanXor = (ctx.Version >= 0x13U);
|
||||
|
||||
ulong[] pbR = new ulong[NbBlockSizeInQW];
|
||||
ulong[] pbTmp = new ulong[NbBlockSizeInQW];
|
||||
ulong[] pbAddrInputZero = null;
|
||||
|
||||
bool bDataIndependentAddr = ((ctx.Type == Argon2Type.ID) &&
|
||||
(ti.Pass == 0) && (ti.Slice < (NbSyncPoints / 2)));
|
||||
if (bDataIndependentAddr)
|
||||
{
|
||||
pbAddrInputZero = new ulong[NbBlockSizeInQW * 3];
|
||||
|
||||
const int iInput = (int)NbBlockSizeInQW;
|
||||
pbAddrInputZero[iInput] = ti.Pass;
|
||||
pbAddrInputZero[iInput + 1] = ti.Lane;
|
||||
pbAddrInputZero[iInput + 2] = ti.Slice;
|
||||
pbAddrInputZero[iInput + 3] = ctx.MemoryBlocks;
|
||||
pbAddrInputZero[iInput + 4] = ctx.TCost;
|
||||
pbAddrInputZero[iInput + 5] = (ulong)ctx.Type;
|
||||
}
|
||||
|
||||
ulong uStart = 0;
|
||||
if ((ti.Pass == 0) && (ti.Slice == 0))
|
||||
{
|
||||
uStart = 2;
|
||||
|
||||
if (bDataIndependentAddr)
|
||||
NextAddresses(pbAddrInputZero, pbR, pbTmp);
|
||||
}
|
||||
if((ti.Pass == 0) && (ti.Slice == 0)) uStart = 2;
|
||||
|
||||
ulong uCur = (ti.Lane * ctx.LaneLength) + (ti.Slice *
|
||||
ctx.SegmentLength) + uStart;
|
||||
@@ -535,23 +506,17 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
ulong uPrev = (((uCur % ctx.LaneLength) == 0) ?
|
||||
(uCur + ctx.LaneLength - 1UL) : (uCur - 1UL));
|
||||
|
||||
for (ulong i = uStart; i < ctx.SegmentLength; ++i)
|
||||
ulong[] pbR = new ulong[NbBlockSizeInQW];
|
||||
ulong[] pbTmp = new ulong[NbBlockSizeInQW];
|
||||
|
||||
for(ulong i = uStart; i < ctx.SegmentLength; ++i)
|
||||
{
|
||||
if ((uCur % ctx.LaneLength) == 1)
|
||||
if((uCur % ctx.LaneLength) == 1)
|
||||
uPrev = uCur - 1UL;
|
||||
|
||||
ulong uPseudoRand;
|
||||
if (bDataIndependentAddr)
|
||||
{
|
||||
ulong iMod = i % NbAddressesInBlock;
|
||||
if (iMod == 0)
|
||||
NextAddresses(pbAddrInputZero, pbR, pbTmp);
|
||||
uPseudoRand = pbAddrInputZero[iMod];
|
||||
}
|
||||
else uPseudoRand = ctx.Mem[uPrev * NbBlockSizeInQW];
|
||||
|
||||
ulong uPseudoRand = ctx.Mem[uPrev * NbBlockSizeInQW];
|
||||
ulong uRefLane = (uPseudoRand >> 32) % ctx.Lanes;
|
||||
if ((ti.Pass == 0) && (ti.Slice == 0))
|
||||
if((ti.Pass == 0) && (ti.Slice == 0))
|
||||
uRefLane = ti.Lane;
|
||||
|
||||
ti.Index = i;
|
||||
@@ -571,12 +536,11 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
|
||||
MemUtil.ZeroArray<ulong>(pbR);
|
||||
MemUtil.ZeroArray<ulong>(pbTmp);
|
||||
if (pbAddrInputZero != null) MemUtil.ZeroArray<ulong>(pbAddrInputZero);
|
||||
}
|
||||
catch (Exception) { Debug.Assert(false); }
|
||||
catch(Exception) { Debug.Assert(false); }
|
||||
|
||||
try { ti.Finished.Set(); }
|
||||
catch (Exception) { Debug.Assert(false); }
|
||||
catch(Exception) { Debug.Assert(false); }
|
||||
}
|
||||
|
||||
#if ARGON2_B2ROUND_ARRAYS
|
||||
@@ -646,19 +610,6 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
XorBlock(pMem, uNext, pbR, 0);
|
||||
}
|
||||
|
||||
private static void NextAddresses(ulong[] pbAddrInputZero, ulong[] pbR,
|
||||
ulong[] pbTmp)
|
||||
{
|
||||
// pbAddrInputZero contains an address block, an input block and a zero block
|
||||
const ulong uAddr = 0;
|
||||
const ulong uInput = NbBlockSizeInQW;
|
||||
const ulong uZero = NbBlockSizeInQW * 2;
|
||||
|
||||
++pbAddrInputZero[uInput + 6];
|
||||
FillBlock(pbAddrInputZero, uZero, uInput, uAddr, false, pbR, pbTmp);
|
||||
FillBlock(pbAddrInputZero, uZero, uAddr, uAddr, false, pbR, pbTmp);
|
||||
}
|
||||
|
||||
private static byte[] FinalHash(Argon2Ctx ctx, int cbOut, Blake2b h)
|
||||
{
|
||||
ulong[] pqBlockHash = new ulong[NbBlockSizeInQW];
|
||||
|
||||
@@ -25,22 +25,11 @@ using System.Text;
|
||||
|
||||
namespace KeePassLib.Cryptography.KeyDerivation
|
||||
{
|
||||
public enum Argon2Type
|
||||
{
|
||||
// The values must be the same as in the Argon2 specification
|
||||
D = 0,
|
||||
ID = 2
|
||||
}
|
||||
public sealed partial class Argon2Kdf : KdfEngine
|
||||
public sealed partial class Argon2Kdf : KdfEngine
|
||||
{
|
||||
|
||||
|
||||
private static readonly PwUuid g_uuidD = new PwUuid(new byte[] {
|
||||
0xEF, 0x63, 0x6D, 0xDF, 0x8C, 0x29, 0x44, 0x4B,
|
||||
0x91, 0xF7, 0xA9, 0xA4, 0x03, 0xE3, 0x0A, 0x0C });
|
||||
private static readonly PwUuid g_uuidID = new PwUuid(new byte[] {
|
||||
0x9E, 0x29, 0x8B, 0x19, 0x56, 0xDB, 0x47, 0x73,
|
||||
0xB2, 0x3D, 0xFC, 0x3E, 0xC6, 0xF0, 0xA1, 0xE6 });
|
||||
private static readonly PwUuid g_uuid = new PwUuid(new byte[] {
|
||||
0xEF, 0x63, 0x6D, 0xDF, 0x8C, 0x29, 0x44, 0x4B,
|
||||
0x91, 0xF7, 0xA9, 0xA4, 0x03, 0xE3, 0x0A, 0x0C });
|
||||
|
||||
public const string ParamSalt = "S"; // Byte[]
|
||||
public const string ParamParallelism = "P"; // UInt32
|
||||
@@ -66,37 +55,28 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
internal const uint MinParallelism = 1;
|
||||
internal const uint MaxParallelism = (1 << 24) - 1;
|
||||
|
||||
internal const ulong DefaultIterations = 2;
|
||||
internal const ulong DefaultMemory = 64 * 1024 * 1024; // 64 MB
|
||||
internal const uint DefaultParallelism = 2;
|
||||
internal const ulong DefaultIterations = 2;
|
||||
internal const ulong DefaultMemory = 1024 * 1024; // 1 MB
|
||||
internal const uint DefaultParallelism = 2;
|
||||
|
||||
private readonly Argon2Type m_t;
|
||||
public override PwUuid Uuid
|
||||
{
|
||||
get { return g_uuid; }
|
||||
}
|
||||
|
||||
public override PwUuid Uuid
|
||||
{
|
||||
get { return ((m_t == Argon2Type.D) ? g_uuidD : g_uuidID); }
|
||||
}
|
||||
public override string Name
|
||||
{
|
||||
get { return "Argon2"; }
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return ((m_t == Argon2Type.D) ? "Argon2d" : "Argon2id"); }
|
||||
}
|
||||
|
||||
public Argon2Kdf() : this(Argon2Type.D)
|
||||
{
|
||||
}
|
||||
|
||||
public Argon2Kdf(Argon2Type t)
|
||||
{
|
||||
if ((t != Argon2Type.D) && (t != Argon2Type.ID))
|
||||
throw new NotSupportedException();
|
||||
|
||||
m_t = t;
|
||||
}
|
||||
public override byte[] GetSeed(KdfParameters p)
|
||||
{ return p.GetByteArray(ParamSalt); }
|
||||
|
||||
public override KdfParameters GetDefaultParameters()
|
||||
public Argon2Kdf()
|
||||
{
|
||||
}
|
||||
|
||||
public override KdfParameters GetDefaultParameters()
|
||||
{
|
||||
KdfParameters p = base.GetDefaultParameters();
|
||||
|
||||
@@ -112,7 +92,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
public override void Randomize(KdfParameters p)
|
||||
{
|
||||
if(p == null) { Debug.Assert(false); return; }
|
||||
Debug.Assert(p.KdfUuid.Equals(this.Uuid));
|
||||
Debug.Assert(g_uuid.Equals(p.KdfUuid));
|
||||
|
||||
byte[] pb = CryptoRandom.Instance.GetRandomBytes(32);
|
||||
p.SetByteArray(ParamSalt, pb);
|
||||
@@ -148,59 +128,46 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
byte[] pbSecretKey = p.GetByteArray(ParamSecretKey);
|
||||
byte[] pbAssocData = p.GetByteArray(ParamAssocData);
|
||||
|
||||
byte[] pbRet;
|
||||
|
||||
if (m_t == Argon2Type.ID)
|
||||
{
|
||||
pbRet = Argon2Transform(pbMsg, pbSalt, uPar, uMem,
|
||||
uIt, 32, v, pbSecretKey, pbAssocData);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pbSecretKey != null)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbSecretKey");
|
||||
}
|
||||
|
||||
if (pbAssocData != null)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbAssocData");
|
||||
}
|
||||
|
||||
/*
|
||||
byte[] pbRet = Argon2d(pbMsg, pbSalt, uPar, uMem, uIt,
|
||||
32, v, pbSecretKey, pbAssocData);
|
||||
*/
|
||||
|
||||
IntPtr msgPtr = Marshal.AllocHGlobal(pbMsg.Length);
|
||||
IntPtr saltPtr = Marshal.AllocHGlobal(pbSalt.Length);
|
||||
IntPtr retPtr = Marshal.AllocHGlobal(32);
|
||||
Marshal.Copy(pbMsg, 0, msgPtr, pbMsg.Length);
|
||||
Marshal.Copy(pbSalt, 0, saltPtr, pbSalt.Length);
|
||||
|
||||
const UInt32 Argon2_d = 0;
|
||||
|
||||
int ret = argon2_hash(
|
||||
(UInt32)uIt, (UInt32)(uMem / 1024), uPar,
|
||||
msgPtr, (IntPtr)pbMsg.Length,
|
||||
saltPtr, (IntPtr)pbSalt.Length,
|
||||
retPtr, (IntPtr)32,
|
||||
(IntPtr)0, (IntPtr)0, Argon2_d, v);
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
throw new Exception("argon2_hash failed with " + ret);
|
||||
}
|
||||
|
||||
pbRet = new byte[32];
|
||||
Marshal.Copy(retPtr, pbRet, 0, 32);
|
||||
|
||||
Marshal.FreeHGlobal(msgPtr);
|
||||
Marshal.FreeHGlobal(saltPtr);
|
||||
Marshal.FreeHGlobal(retPtr);
|
||||
if (pbSecretKey != null) {
|
||||
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbSecretKey");
|
||||
}
|
||||
|
||||
if(uMem > (100UL * 1024UL * 1024UL)) GC.Collect();
|
||||
if (pbAssocData != null) {
|
||||
throw new ArgumentOutOfRangeException("Unsupported configuration: non-null pbAssocData");
|
||||
}
|
||||
|
||||
/*
|
||||
byte[] pbRet = Argon2d(pbMsg, pbSalt, uPar, uMem, uIt,
|
||||
32, v, pbSecretKey, pbAssocData);
|
||||
*/
|
||||
|
||||
IntPtr msgPtr = Marshal.AllocHGlobal(pbMsg.Length);
|
||||
IntPtr saltPtr = Marshal.AllocHGlobal(pbSalt.Length);
|
||||
IntPtr retPtr = Marshal.AllocHGlobal(32);
|
||||
Marshal.Copy(pbMsg, 0, msgPtr, pbMsg.Length);
|
||||
Marshal.Copy(pbSalt, 0, saltPtr, pbSalt.Length);
|
||||
|
||||
const UInt32 Argon2_d = 0;
|
||||
|
||||
int ret = argon2_hash(
|
||||
(UInt32)uIt, (UInt32)(uMem / 1024), uPar,
|
||||
msgPtr, (IntPtr)pbMsg.Length,
|
||||
saltPtr, (IntPtr)pbSalt.Length,
|
||||
retPtr, (IntPtr)32,
|
||||
(IntPtr)0, (IntPtr)0, Argon2_d, v);
|
||||
|
||||
if (ret != 0) {
|
||||
throw new Exception("argon2_hash failed with " + ret);
|
||||
}
|
||||
|
||||
byte[] pbRet = new byte[32];
|
||||
Marshal.Copy(retPtr, pbRet, 0, 32);
|
||||
|
||||
Marshal.FreeHGlobal(msgPtr);
|
||||
Marshal.FreeHGlobal(saltPtr);
|
||||
Marshal.FreeHGlobal(retPtr);
|
||||
|
||||
if(uMem > (100UL * 1024UL * 1024UL)) GC.Collect();
|
||||
return pbRet;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2020 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
Copyright (C) 2003-2017 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -41,11 +41,10 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
||||
|
||||
private static void EnsureInitialized()
|
||||
{
|
||||
if(g_l.Count != 0) return;
|
||||
if(g_l.Count > 0) return;
|
||||
|
||||
g_l.Add(new AesKdf());
|
||||
g_l.Add(new Argon2Kdf(Argon2Type.D));
|
||||
g_l.Add(new Argon2Kdf(Argon2Type.ID));
|
||||
g_l.Add(new Argon2Kdf());
|
||||
}
|
||||
|
||||
internal static KdfParameters GetDefaultParameters()
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
<HintPath>..\ProtoBuf\protobuf-net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
@@ -72,7 +71,6 @@
|
||||
<Compile Include="Cryptography\KeyDerivation\KdfParameters.cs" />
|
||||
<Compile Include="Cryptography\KeyDerivation\KdfPool.cs" />
|
||||
<Compile Include="IDatabaseFormat.cs" />
|
||||
<Compile Include="Keys\KcpKeyFile.Xml.cs" />
|
||||
<Compile Include="Kp2aLog.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Resources\KLRes.Generated.cs" />
|
||||
@@ -162,7 +160,6 @@
|
||||
<Compile Include="Utility\UrlUtil.cs" />
|
||||
<Compile Include="Utility\TimeUtil.cs" />
|
||||
<Compile Include="Delegates\Handlers.cs" />
|
||||
<Compile Include="Utility\XmlUtilEx.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
|
||||
@@ -1,281 +0,0 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
using KeePassLib.Cryptography;
|
||||
using KeePassLib.Resources;
|
||||
using KeePassLib.Serialization;
|
||||
using KeePassLib.Utility;
|
||||
|
||||
namespace KeePassLib.Keys
|
||||
{
|
||||
[XmlType("KeyFile")]
|
||||
public sealed class KfxFile
|
||||
{
|
||||
private const ulong KfxVersionCriticalMask = 0xFFFF000000000000UL;
|
||||
private const int KfxDataHashLength = 4;
|
||||
|
||||
private KfxMeta m_meta = new KfxMeta();
|
||||
public KfxMeta Meta
|
||||
{
|
||||
get { return m_meta; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
m_meta = value;
|
||||
}
|
||||
}
|
||||
|
||||
private KfxKey m_key = new KfxKey();
|
||||
public KfxKey Key
|
||||
{
|
||||
get { return m_key; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
m_key = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static KfxFile Create(ulong uVersion, byte[] pbKey, byte[] pbHash)
|
||||
{
|
||||
if(pbKey == null) throw new ArgumentNullException("pbKey");
|
||||
if(pbKey.Length == 0) throw new ArgumentOutOfRangeException("pbKey");
|
||||
|
||||
if(uVersion == 0) uVersion = 0x0002000000000000;
|
||||
|
||||
// Null hash: generate one, empty hash: store no hash
|
||||
if(pbHash == null) pbHash = HashData(pbKey);
|
||||
VerifyHash(pbKey, pbHash);
|
||||
|
||||
KfxFile kf = new KfxFile();
|
||||
|
||||
if(uVersion == 0x0001000000000000)
|
||||
kf.Meta.Version = "1.00"; // KeePass <= 2.46 used two zeros
|
||||
else kf.Meta.Version = StrUtil.VersionToString(uVersion, 2);
|
||||
|
||||
if(uVersion == 0x0001000000000000)
|
||||
kf.Key.Data.Value = Convert.ToBase64String(pbKey);
|
||||
else if(uVersion == 0x0002000000000000)
|
||||
{
|
||||
kf.Key.Data.Value = FormatKeyHex(pbKey, 3);
|
||||
|
||||
if(pbHash.Length != 0)
|
||||
kf.Key.Data.Hash = MemUtil.ByteArrayToHexString(pbHash);
|
||||
}
|
||||
else throw new NotSupportedException(KLRes.FileVersionUnsupported);
|
||||
|
||||
return kf;
|
||||
}
|
||||
|
||||
internal static KfxFile Create(ulong uVersion, string strKey, string strHash)
|
||||
{
|
||||
byte[] pbKey = ParseKey(uVersion, strKey);
|
||||
byte[] pbHash = ((strHash != null) ? ParseHash(strHash) : null);
|
||||
|
||||
return Create(uVersion, pbKey, pbHash);
|
||||
}
|
||||
|
||||
internal static bool CanLoad(string strFilePath)
|
||||
{
|
||||
if(string.IsNullOrEmpty(strFilePath)) { Debug.Assert(false); return false; }
|
||||
|
||||
try
|
||||
{
|
||||
IOConnectionInfo ioc = IOConnectionInfo.FromPath(strFilePath);
|
||||
using(Stream s = IOConnection.OpenRead(ioc))
|
||||
{
|
||||
return (Load(s) != null);
|
||||
}
|
||||
}
|
||||
catch(Exception) { }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static KfxFile Load(Stream s)
|
||||
{
|
||||
return XmlUtilEx.Deserialize<KfxFile>(s);
|
||||
}
|
||||
|
||||
public void Save(Stream s)
|
||||
{
|
||||
XmlUtilEx.Serialize<KfxFile>(s, this, true);
|
||||
}
|
||||
|
||||
private static string FormatKeyHex(byte[] pb, int cTabs)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
string str = MemUtil.ByteArrayToHexString(pb);
|
||||
|
||||
for(int i = 0; i < str.Length; ++i)
|
||||
{
|
||||
if((i & 0x1F) == 0)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.Append('\t', cTabs);
|
||||
}
|
||||
else if((i & 0x07) == 0) sb.Append(' ');
|
||||
|
||||
sb.Append(str[i]);
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
if(cTabs > 0) sb.Append('\t', cTabs - 1);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private ulong GetVersion()
|
||||
{
|
||||
string str = m_meta.Version;
|
||||
if(string.IsNullOrEmpty(str)) return 0;
|
||||
|
||||
return StrUtil.ParseVersion(str);
|
||||
}
|
||||
|
||||
public byte[] GetKey()
|
||||
{
|
||||
ulong uVersion = GetVersion();
|
||||
|
||||
byte[] pbKey = ParseKey(uVersion, m_key.Data.Value);
|
||||
if((pbKey == null) || (pbKey.Length == 0))
|
||||
throw new FormatException(KLRes.FileCorrupted);
|
||||
|
||||
byte[] pbHash = ParseHash(m_key.Data.Hash);
|
||||
VerifyHash(pbKey, pbHash);
|
||||
|
||||
return pbKey;
|
||||
}
|
||||
|
||||
private static byte[] HashData(byte[] pb)
|
||||
{
|
||||
return MemUtil.Mid(CryptoUtil.HashSha256(pb), 0, KfxDataHashLength);
|
||||
}
|
||||
|
||||
private static void VerifyHash(byte[] pbKey, byte[] pbHash)
|
||||
{
|
||||
// The hash is optional; empty hash means success
|
||||
if((pbHash == null) || (pbHash.Length == 0)) return;
|
||||
|
||||
byte[] pbHashCmp = HashData(pbKey);
|
||||
if(!MemUtil.ArraysEqual(pbHash, pbHashCmp))
|
||||
throw new Exception("Keyfile hash mismatch!");
|
||||
}
|
||||
|
||||
private static byte[] ParseKey(ulong uVersion, string strKey)
|
||||
{
|
||||
if(strKey == null) throw new ArgumentNullException("strKey");
|
||||
|
||||
strKey = StrUtil.RemoveWhiteSpace(strKey);
|
||||
if(string.IsNullOrEmpty(strKey)) return MemUtil.EmptyByteArray;
|
||||
|
||||
uVersion &= KfxVersionCriticalMask;
|
||||
|
||||
byte[] pbKey;
|
||||
if(uVersion == 0x0001000000000000)
|
||||
pbKey = Convert.FromBase64String(strKey);
|
||||
else if(uVersion == 0x0002000000000000)
|
||||
pbKey = ParseHex(strKey);
|
||||
else throw new NotSupportedException(KLRes.FileVersionUnsupported);
|
||||
|
||||
return pbKey;
|
||||
}
|
||||
|
||||
private static byte[] ParseHash(string strHash)
|
||||
{
|
||||
return ParseHex(strHash);
|
||||
}
|
||||
|
||||
private static byte[] ParseHex(string str)
|
||||
{
|
||||
if(str == null) throw new ArgumentNullException("str");
|
||||
if(str.Length == 0) return MemUtil.EmptyByteArray;
|
||||
|
||||
if(((str.Length & 1) != 0) || !StrUtil.IsHexString(str, true))
|
||||
throw new FormatException();
|
||||
|
||||
return MemUtil.HexStringToByteArray(str);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class KfxMeta
|
||||
{
|
||||
private string m_strVersion = string.Empty;
|
||||
[DefaultValue("")]
|
||||
public string Version
|
||||
{
|
||||
get { return m_strVersion; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
m_strVersion = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class KfxKey
|
||||
{
|
||||
private KfxData m_data = new KfxData();
|
||||
public KfxData Data
|
||||
{
|
||||
get { return m_data; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
m_data = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class KfxData
|
||||
{
|
||||
private string m_strHash = string.Empty;
|
||||
[DefaultValue("")]
|
||||
[XmlAttribute("Hash")]
|
||||
public string Hash
|
||||
{
|
||||
get { return m_strHash; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
m_strHash = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string m_strValue = string.Empty;
|
||||
[DefaultValue("")]
|
||||
[XmlText]
|
||||
public string Value
|
||||
{
|
||||
get { return m_strValue; }
|
||||
set
|
||||
{
|
||||
if(value == null) throw new ArgumentNullException("value");
|
||||
m_strValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,9 +127,10 @@ namespace KeePassLib.Keys
|
||||
#endif
|
||||
}
|
||||
|
||||
byte[] pbKey = LoadKeyFile(pbFileData);
|
||||
byte[] pbKey = LoadXmlKeyFile(pbFileData);
|
||||
if(pbKey == null) pbKey = LoadKeyFile(pbFileData);
|
||||
|
||||
if (pbKey == null) throw new InvalidOperationException();
|
||||
if(pbKey == null) throw new InvalidOperationException();
|
||||
|
||||
m_ioc = iocKeyFile;
|
||||
m_pbKeyData = new ProtectedBinary(true, pbKey);
|
||||
@@ -149,60 +150,54 @@ namespace KeePassLib.Keys
|
||||
// }
|
||||
|
||||
|
||||
private static byte[] LoadKeyFile(byte[] pbFileData)
|
||||
{
|
||||
if (pbFileData == null) throw new ArgumentNullException("pbFileData");
|
||||
private static byte[] LoadKeyFile(byte[] pbFileData)
|
||||
{
|
||||
if(pbFileData == null) { Debug.Assert(false); return null; }
|
||||
|
||||
byte[] pbKey = LoadKeyFileXml(pbFileData);
|
||||
if (pbKey != null) return pbKey;
|
||||
int iLength = pbFileData.Length;
|
||||
|
||||
int cb = pbFileData.Length;
|
||||
if (cb == 32) return pbFileData;
|
||||
byte[] pbKey = null;
|
||||
if(iLength == 32) pbKey = LoadBinaryKey32(pbFileData);
|
||||
else if(iLength == 64) pbKey = LoadHexKey32(pbFileData);
|
||||
|
||||
if (cb == 64)
|
||||
{
|
||||
pbKey = LoadKeyFileHex(pbFileData);
|
||||
if (pbKey != null) return pbKey;
|
||||
}
|
||||
if(pbKey == null)
|
||||
pbKey = CryptoUtil.HashSha256(pbFileData);
|
||||
|
||||
return CryptoUtil.HashSha256(pbFileData);
|
||||
}
|
||||
return pbKey;
|
||||
}
|
||||
|
||||
private static byte[] LoadKeyFileXml(byte[] pbFileData)
|
||||
{
|
||||
KfxFile kf;
|
||||
try
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream(pbFileData, false))
|
||||
{
|
||||
kf = KfxFile.Load(ms);
|
||||
}
|
||||
}
|
||||
catch (Exception) { return null; }
|
||||
private static byte[] LoadBinaryKey32(byte[] pbFileData)
|
||||
{
|
||||
if(pbFileData == null) { Debug.Assert(false); return null; }
|
||||
if(pbFileData.Length != 32) { Debug.Assert(false); return null; }
|
||||
|
||||
// We have a syntactically valid XML key file;
|
||||
// failing to verify the key should throw an exception
|
||||
return ((kf != null) ? kf.GetKey() : null);
|
||||
}
|
||||
return pbFileData;
|
||||
}
|
||||
|
||||
private static byte[] LoadKeyFileHex(byte[] pbFileData)
|
||||
{
|
||||
if (pbFileData == null) { Debug.Assert(false); return null; }
|
||||
private static byte[] LoadHexKey32(byte[] pbFileData)
|
||||
{
|
||||
if(pbFileData == null) { Debug.Assert(false); return null; }
|
||||
if(pbFileData.Length != 64) { Debug.Assert(false); return null; }
|
||||
|
||||
try
|
||||
{
|
||||
int cc = pbFileData.Length;
|
||||
if ((cc & 1) != 0) { Debug.Assert(false); return null; }
|
||||
try
|
||||
{
|
||||
if(!StrUtil.IsHexString(pbFileData, true)) return null;
|
||||
|
||||
if (!StrUtil.IsHexString(pbFileData, true)) return null;
|
||||
string strHex = StrUtil.Utf8.GetString(pbFileData);
|
||||
byte[] pbKey = MemUtil.HexStringToByteArray(strHex);
|
||||
if((pbKey == null) || (pbKey.Length != 32))
|
||||
{
|
||||
Debug.Assert(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
string strHex = StrUtil.Utf8.GetString(pbFileData);
|
||||
return MemUtil.HexStringToByteArray(strHex);
|
||||
}
|
||||
catch (Exception) { Debug.Assert(false); }
|
||||
return pbKey;
|
||||
}
|
||||
catch(Exception) { Debug.Assert(false); }
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// Create a new, random key-file.
|
||||
/// </summary>
|
||||
|
||||
@@ -118,10 +118,5 @@ namespace keepass2android
|
||||
sendIntent.SetType("text/plain");
|
||||
ctx.StartActivity(Intent.CreateChooser(sendIntent, "Send log to..."));
|
||||
}
|
||||
|
||||
public static void LogTask(object task, string activityName)
|
||||
{
|
||||
Log($"Task in activity {activityName} changed to {task?.GetType()?.Name ?? "null"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using keepass2android;
|
||||
|
||||
#if !KeePassUAP
|
||||
using System.Drawing;
|
||||
#endif
|
||||
@@ -872,17 +872,8 @@ namespace KeePassLib.Serialization
|
||||
pb = pb8;
|
||||
}
|
||||
long lSec = MemUtil.BytesToInt64(pb);
|
||||
try
|
||||
{
|
||||
return new DateTime(lSec * TimeSpan.TicksPerSecond, DateTimeKind.Utc);
|
||||
}
|
||||
catch (System.ArgumentOutOfRangeException e)
|
||||
{
|
||||
//files might contain bad data, e.g. see #868. Fall back to MinValue
|
||||
Kp2aLog.Log("Failed to read date from file.");
|
||||
return DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
return new DateTime(lSec * TimeSpan.TicksPerSecond, DateTimeKind.Utc);
|
||||
}
|
||||
else
|
||||
{
|
||||
string str = ReadString(xr);
|
||||
|
||||
@@ -28,9 +28,9 @@ namespace KeePassLib.Serialization
|
||||
/// </summary>
|
||||
public static KdbxFormat GetFormatToUse(string fileExt)
|
||||
{
|
||||
return fileExt.Equals(KdbpFile.FileNameExtension, StringComparison.OrdinalIgnoreCase) ? KdbxFormat.ProtocolBuffers :
|
||||
(fileExt.Equals("xml", StringComparison.OrdinalIgnoreCase) ? KdbxFormat.PlainXml : KdbxFormat.Default);
|
||||
}
|
||||
// If the filename ends in .kdbp, use ProtocolBuffers format.
|
||||
return fileExt.Equals(KdbpFile.FileNameExtension, StringComparison.OrdinalIgnoreCase) ? KdbxFormat.ProtocolBuffers : KdbxFormat.Default;
|
||||
}
|
||||
|
||||
public static void WriteDocument(PwDatabase database, Stream stream, byte[] protectedStreamKey, byte[] hashOfHeader)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace KeePassLib.Utility
|
||||
/// </summary>
|
||||
public static class MemUtil
|
||||
{
|
||||
public static readonly byte[] EmptyByteArray = new byte[0];
|
||||
internal static readonly byte[] EmptyByteArray = new byte[0];
|
||||
|
||||
private static readonly uint[] m_vSBox = new uint[256] {
|
||||
0xCD2FACB3, 0xE78A7F5C, 0x6F0803FC, 0xBCF6E230,
|
||||
|
||||
@@ -1734,24 +1734,5 @@ namespace KeePassLib.Utility
|
||||
// behavior of Notepad (on Windows 10)
|
||||
return str.Replace('\0', ' ');
|
||||
}
|
||||
|
||||
internal static string RemoveWhiteSpace(string str)
|
||||
{
|
||||
if (str == null) { Debug.Assert(false); return string.Empty; }
|
||||
|
||||
int cc = str.Length;
|
||||
if (cc == 0) return string.Empty;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < cc; ++i)
|
||||
{
|
||||
char ch = str[i];
|
||||
if (char.IsWhiteSpace(ch)) continue;
|
||||
sb.Append(ch);
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,290 +0,0 @@
|
||||
/*
|
||||
KeePass Password Safe - The Open-Source Password Manager
|
||||
Copyright (C) 2003-2021 Dominik Reichl <dominik.reichl@t-online.de>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml.XPath;
|
||||
|
||||
using KeePassLib.Delegates;
|
||||
using KeePassLib.Interfaces;
|
||||
using KeePassLib.Serialization;
|
||||
|
||||
namespace KeePassLib.Utility
|
||||
{
|
||||
public static class XmlUtilEx
|
||||
{
|
||||
public static XmlDocument CreateXmlDocument()
|
||||
{
|
||||
XmlDocument d = new XmlDocument();
|
||||
|
||||
// .NET 4.5.2 and newer do not resolve external XML resources
|
||||
// by default; for older .NET versions, we explicitly
|
||||
// prevent resolving
|
||||
d.XmlResolver = null; // Default in old .NET: XmlUrlResolver object
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
public static XmlReaderSettings CreateXmlReaderSettings()
|
||||
{
|
||||
XmlReaderSettings xrs = new XmlReaderSettings();
|
||||
|
||||
xrs.CloseInput = false;
|
||||
xrs.IgnoreComments = true;
|
||||
xrs.IgnoreProcessingInstructions = true;
|
||||
xrs.IgnoreWhitespace = true;
|
||||
|
||||
#if KeePassUAP
|
||||
xrs.DtdProcessing = DtdProcessing.Prohibit;
|
||||
#else
|
||||
// Also see PrepMonoDev.sh script
|
||||
xrs.ProhibitDtd = true; // Obsolete in .NET 4, but still there
|
||||
// xrs.DtdProcessing = DtdProcessing.Prohibit; // .NET 4 only
|
||||
#endif
|
||||
|
||||
xrs.ValidationType = ValidationType.None;
|
||||
xrs.XmlResolver = null;
|
||||
|
||||
return xrs;
|
||||
}
|
||||
|
||||
public static XmlReader CreateXmlReader(Stream s)
|
||||
{
|
||||
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||
|
||||
return XmlReader.Create(s, CreateXmlReaderSettings());
|
||||
}
|
||||
|
||||
public static XmlWriterSettings CreateXmlWriterSettings()
|
||||
{
|
||||
XmlWriterSettings xws = new XmlWriterSettings();
|
||||
|
||||
xws.CloseOutput = false;
|
||||
xws.Encoding = StrUtil.Utf8;
|
||||
xws.Indent = true;
|
||||
xws.IndentChars = "\t";
|
||||
xws.NewLineOnAttributes = false;
|
||||
|
||||
return xws;
|
||||
}
|
||||
|
||||
public static XmlWriter CreateXmlWriter(Stream s)
|
||||
{
|
||||
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||
|
||||
return XmlWriter.Create(s, CreateXmlWriterSettings());
|
||||
}
|
||||
|
||||
public static T Deserialize<T>(Stream s)
|
||||
{
|
||||
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||
|
||||
XmlSerializer xs = new XmlSerializer(typeof(T));
|
||||
|
||||
T t = default(T);
|
||||
using(XmlReader xr = CreateXmlReader(s))
|
||||
{
|
||||
t = (T)xs.Deserialize(xr);
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
public static void Serialize<T>(Stream s, T t)
|
||||
{
|
||||
if(s == null) { Debug.Assert(false); throw new ArgumentNullException("s"); }
|
||||
|
||||
XmlSerializer xs = new XmlSerializer(typeof(T));
|
||||
using(XmlWriter xw = CreateXmlWriter(s))
|
||||
{
|
||||
xs.Serialize(xw, t);
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Serialize<T>(Stream s, T t, bool bRemoveXsdXsi)
|
||||
{
|
||||
// One way to remove the "xsd" and "xsi" namespace declarations
|
||||
// is to use an XmlSerializerNamespaces object containing only
|
||||
// a ""/"" pair; this seems to work, but Microsoft's
|
||||
// documentation explicitly states that it isn't supported:
|
||||
// https://docs.microsoft.com/en-us/dotnet/api/system.xml.serialization.xmlserializernamespaces
|
||||
// There are other, more complex ways, but these either rely on
|
||||
// undocumented details or require the type T to be modified.
|
||||
|
||||
string str;
|
||||
using(MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
Serialize<T>(ms, t);
|
||||
|
||||
str = StrUtil.Utf8.GetString(ms.ToArray());
|
||||
}
|
||||
|
||||
Func<string, string, bool> fFindPfx = delegate(string strText, string strSub)
|
||||
{
|
||||
int i = strText.IndexOf(strSub, StringComparison.Ordinal);
|
||||
if(i < 0) return false;
|
||||
if(i == 0) return true;
|
||||
return char.IsWhiteSpace(strText[i - 1]);
|
||||
};
|
||||
|
||||
if(bRemoveXsdXsi)
|
||||
{
|
||||
if(!fFindPfx(str, "xsd:") && !fFindPfx(str, "xsi:"))
|
||||
{
|
||||
Debug.Assert(str.IndexOf("xmlns:xsd") > 0);
|
||||
str = str.Replace(" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"", string.Empty);
|
||||
Debug.Assert(str.IndexOf("xmlns:xsd") < 0);
|
||||
|
||||
Debug.Assert(str.IndexOf("xmlns:xsi") > 0);
|
||||
str = str.Replace(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"", string.Empty);
|
||||
Debug.Assert(str.IndexOf("xmlns:xsi") < 0);
|
||||
}
|
||||
else { Debug.Assert(false); } // "xsd"/"xsi" decl. may be required
|
||||
}
|
||||
|
||||
MemUtil.Write(s, StrUtil.Utf8.GetBytes(str));
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
internal static void ValidateXml(string strXml, bool bReplaceStdEntities)
|
||||
{
|
||||
if(strXml == null) throw new ArgumentNullException("strXml");
|
||||
if(strXml.Length == 0) { Debug.Assert(false); return; }
|
||||
|
||||
string str = strXml;
|
||||
|
||||
if(bReplaceStdEntities)
|
||||
str = str.Replace(" ", " ");
|
||||
|
||||
XmlDocument d = new XmlDocument();
|
||||
d.LoadXml(str);
|
||||
}
|
||||
#endif
|
||||
|
||||
internal static XPathNodeIterator FindNodes(PwDatabase pd, string strXPath,
|
||||
IStatusLogger sl, out XmlDocument xd)
|
||||
{
|
||||
if(pd == null) throw new ArgumentNullException("pd");
|
||||
if(strXPath == null) { Debug.Assert(false); strXPath = string.Empty; }
|
||||
|
||||
KdbxFile kdbx = new KdbxFile(pd);
|
||||
|
||||
byte[] pbXml;
|
||||
using(MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
kdbx.Save(ms, null, KdbxFormat.PlainXml, sl);
|
||||
pbXml = ms.ToArray();
|
||||
}
|
||||
string strXml = StrUtil.Utf8.GetString(pbXml);
|
||||
|
||||
xd = CreateXmlDocument();
|
||||
xd.LoadXml(strXml);
|
||||
|
||||
XPathNavigator xpNav = xd.CreateNavigator();
|
||||
return xpNav.Select(strXPath);
|
||||
// XPathExpression xpExpr = xpNav.Compile(strXPath);
|
||||
// xpExpr.SetContext(new XuXsltContext());
|
||||
// return xpNav.Select(xpExpr);
|
||||
}
|
||||
|
||||
/* private sealed class XuFnMatches : IXsltContextFunction
|
||||
{
|
||||
private readonly XPathResultType[] m_vArgTypes = new XPathResultType[] {
|
||||
XPathResultType.String, XPathResultType.String, XPathResultType.String
|
||||
};
|
||||
public XPathResultType[] ArgTypes { get { return m_vArgTypes; } }
|
||||
|
||||
public int Maxargs { get { return 3; } }
|
||||
public int Minargs { get { return 2; } }
|
||||
|
||||
public XPathResultType ReturnType { get { return XPathResultType.Boolean; } }
|
||||
|
||||
private static string GetArgString(object[] args, int i, string strDefault)
|
||||
{
|
||||
if(args == null) { Debug.Assert(false); return strDefault; }
|
||||
if(i >= args.Length) return strDefault;
|
||||
|
||||
object o = args[i];
|
||||
if(o == null) return strDefault;
|
||||
|
||||
XPathNodeIterator it = (o as XPathNodeIterator);
|
||||
if(it != null) o = it.Current.Value;
|
||||
|
||||
return (o.ToString() ?? strDefault);
|
||||
}
|
||||
|
||||
public object Invoke(XsltContext xsltContext, object[] args,
|
||||
XPathNavigator docContext)
|
||||
{
|
||||
string strInput = GetArgString(args, 0, string.Empty);
|
||||
string strPattern = GetArgString(args, 1, string.Empty);
|
||||
string strFlags = GetArgString(args, 2, null);
|
||||
|
||||
RegexOptions ro = RegexOptions.None;
|
||||
if(!string.IsNullOrEmpty(strFlags))
|
||||
{
|
||||
if(strFlags.IndexOf('s') >= 0) ro |= RegexOptions.Singleline;
|
||||
if(strFlags.IndexOf('m') >= 0) ro |= RegexOptions.Multiline;
|
||||
if(strFlags.IndexOf('i') >= 0) ro |= RegexOptions.IgnoreCase;
|
||||
if(strFlags.IndexOf('x') >= 0) ro |= RegexOptions.IgnorePatternWhitespace;
|
||||
}
|
||||
|
||||
return Regex.IsMatch(strInput, strPattern, ro);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class XuXsltContext : XsltContext
|
||||
{
|
||||
public override bool Whitespace { get { return false; } }
|
||||
|
||||
public override int CompareDocument(string baseUri, string nextbaseUri)
|
||||
{
|
||||
return string.CompareOrdinal(baseUri, nextbaseUri);
|
||||
}
|
||||
|
||||
public override bool PreserveWhitespace(XPathNavigator node)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override IXsltContextFunction ResolveFunction(string prefix,
|
||||
string name, XPathResultType[] ArgTypes)
|
||||
{
|
||||
if(prefix != "kp") { Debug.Assert(false); return null; }
|
||||
|
||||
if(name == "matches") return new XuFnMatches();
|
||||
|
||||
Debug.Assert(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IXsltContextVariable ResolveVariable(string prefix,
|
||||
string name)
|
||||
{
|
||||
Debug.Assert(false);
|
||||
return null;
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ using KeePassLib.Keys;
|
||||
using KeePassLib.Serialization;
|
||||
using keepass2android.Io;
|
||||
using KeePassLib.Interfaces;
|
||||
#if !NoNet && !EXCLUDE_JAVAFILESTORAGE
|
||||
#if !NoNet
|
||||
using Keepass2android.Javafilestorage;
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace keepass2android
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Interface through which Activities and the logic layer can access some app specific functionalities and Application static data
|
||||
/// </summary>
|
||||
/// This also contains methods which are UI specific and should be replacable for testing.
|
||||
@@ -38,7 +38,7 @@ namespace keepass2android
|
||||
/// <summary>
|
||||
/// Locks all currently open databases, quicklocking if available (unless false is passed for allowQuickUnlock)
|
||||
/// </summary>
|
||||
void Lock(bool allowQuickUnlock, bool lockWasTriggeredByTimeout);
|
||||
void Lock(bool allowQuickUnlock);
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -123,7 +123,7 @@ namespace keepass2android
|
||||
|
||||
|
||||
bool CheckForDuplicateUuids { get; }
|
||||
#if !NoNet && !EXCLUDE_JAVAFILESTORAGE
|
||||
#if !NoNet
|
||||
ICertificateErrorHandler CertificateErrorHandler { get; }
|
||||
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace keepass2android.Io
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
else throw new Exception("couldn't move to first result element: " + (cursor == null) + uri.ToString());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -120,14 +120,10 @@ namespace keepass2android.Io
|
||||
|
||||
public bool IsCached(IOConnectionInfo ioc)
|
||||
{
|
||||
bool result = File.Exists(CachedFilePath(ioc))
|
||||
return File.Exists(CachedFilePath(ioc))
|
||||
&& File.Exists(VersionFilePath(ioc))
|
||||
&& File.Exists(BaseVersionFilePath(ioc));
|
||||
|
||||
Kp2aLog.Log(ioc.GetDisplayName() + " isCached = " + result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(IOConnectionInfo ioc)
|
||||
{
|
||||
@@ -597,15 +593,11 @@ namespace keepass2android.Io
|
||||
|
||||
public string GetBaseVersionHash(IOConnectionInfo ioc)
|
||||
{
|
||||
string hash = File.ReadAllText(BaseVersionFilePath(ioc));
|
||||
Kp2aLog.Log(ioc.GetDisplayName() + " baseVersionHash = " + hash);
|
||||
return hash;
|
||||
}
|
||||
return File.ReadAllText(BaseVersionFilePath(ioc));
|
||||
}
|
||||
public string GetLocalVersionHash(IOConnectionInfo ioc)
|
||||
{
|
||||
string hash = File.ReadAllText(VersionFilePath(ioc));
|
||||
Kp2aLog.Log(ioc.GetDisplayName() + " localVersionHash = " + hash);
|
||||
return hash;
|
||||
return File.ReadAllText(VersionFilePath(ioc));
|
||||
}
|
||||
public bool HasLocalChanges(IOConnectionInfo ioc)
|
||||
{
|
||||
|
||||
@@ -216,12 +216,9 @@ namespace keepass2android.Io
|
||||
try
|
||||
{
|
||||
using (var cl = GetClient(ioc))
|
||||
{
|
||||
var memStream = new MemoryStream();
|
||||
cl.OpenRead(IocToLocalPath(ioc), FtpDataType.Binary, 0).CopyTo(memStream);
|
||||
memStream.Seek(0, SeekOrigin.Begin);
|
||||
return memStream;
|
||||
}
|
||||
{
|
||||
return cl.OpenRead(IocToLocalPath(ioc), FtpDataType.Binary, 0);
|
||||
}
|
||||
}
|
||||
catch (FtpCommandException ex)
|
||||
{
|
||||
|
||||
@@ -9,14 +9,14 @@ using Android.OS;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
#if !NoNet && !EXCLUDE_JAVAFILESTORAGE
|
||||
#if !NoNet
|
||||
using Keepass2android.Javafilestorage;
|
||||
#endif
|
||||
using KeePassLib.Serialization;
|
||||
|
||||
namespace keepass2android.Io
|
||||
{
|
||||
#if !NoNet && !EXCLUDE_JAVAFILESTORAGE
|
||||
#if !NoNet
|
||||
public class WebDavFileStorage: JavaFileStorage
|
||||
{
|
||||
public WebDavFileStorage(IKp2aApp app) : base(new Keepass2android.Javafilestorage.WebDavStorage(app.CertificateErrorHandler), app)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;_EXCLUDE_TWOFISH;_EXCLUDE_KEYBOARD;_EXCLUDE_FILECHOOSER;_EXCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
|
||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;_EXCLUDE_KEYBOARD;_EXCLUDE_FILECHOOSER;_EXCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
@@ -34,7 +34,6 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<JavaMaximumHeapSize>4G</JavaMaximumHeapSize>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseNoNet|AnyCPU'">
|
||||
@@ -130,10 +129,6 @@
|
||||
<Compile Include="Utils\Spr\SprEngine.PickChars.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AndroidFileChooserBinding\AndroidFileChooserBinding.csproj">
|
||||
<Project>{3c0f7fe5-639f-4422-a087-8b26cf862d1b}</Project>
|
||||
<Name>AndroidFileChooserBinding</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\JavaFileStorageBindings\JavaFileStorageBindings.csproj">
|
||||
<Project>{48574278-4779-4b3a-a9e4-9cf1bc285d0b}</Project>
|
||||
<Name>JavaFileStorageBindings</Name>
|
||||
@@ -146,10 +141,6 @@
|
||||
<Project>{70D3844A-D9FA-4A64-B205-A84C6A822196}</Project>
|
||||
<Name>KP2AKdbLibraryBinding</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\PCloudBindings\PCloudBindings.csproj">
|
||||
<Project>{2db80c77-d46f-4970-b967-e9ffa9b2ac2e}</Project>
|
||||
<Name>PCloudBindings</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\TwofishCipher\TwofishCipher.csproj">
|
||||
<Project>{5CF675A5-9BEE-4720-BED9-D5BF14A2EBF9}</Project>
|
||||
<Name>TwofishCipher</Name>
|
||||
@@ -163,118 +154,118 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FluentFTP">
|
||||
<Version>31.3.1</Version>
|
||||
<Version>27.1.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Graph">
|
||||
<Version>1.21.0</Version>
|
||||
<Version>1.17.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Graph.Auth">
|
||||
<Version>1.0.0-preview.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Identity.Client">
|
||||
<Version>4.8.2</Version>
|
||||
<Version>4.4.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Arch.Core.Common">
|
||||
<Version>1.1.1.3</Version>
|
||||
<Version>1.1.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Arch.Core.Runtime">
|
||||
<Version>1.1.1.3</Version>
|
||||
<Version>1.1.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.Common">
|
||||
<Version>1.1.1.3</Version>
|
||||
<Version>1.1.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.LiveData">
|
||||
<Version>1.1.1.3</Version>
|
||||
<Version>1.1.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.LiveData.Core">
|
||||
<Version>1.1.1.3</Version>
|
||||
<Version>1.1.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.Runtime">
|
||||
<Version>1.1.1.3</Version>
|
||||
<Version>1.1.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Arch.Lifecycle.ViewModel">
|
||||
<Version>1.1.1.3</Version>
|
||||
<Version>1.1.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Animated.Vector.Drawable">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Annotations">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.AsyncLayoutInflater">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Collections">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Compat">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.CoordinaterLayout">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Core.UI">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Core.Utils">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.CursorAdapter">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.CustomTabs">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.CustomView">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.DocumentFile">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.DrawerLayout">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Fragment">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Interpolator">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Loader">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.LocalBroadcastManager">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Media.Compat">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Print">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.SlidingPaneLayout">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.SwipeRefreshLayout">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.v13">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.v4">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.Vector.Drawable">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.VersionedParcelable">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Android.Support.ViewPager">
|
||||
<Version>28.0.0.3</Version>
|
||||
<Version>28.0.0.1</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
|
||||
@@ -49,11 +49,6 @@ namespace keepass2android
|
||||
get { return _activeActivity; }
|
||||
private set
|
||||
{
|
||||
if (_activeActivity != null && _activeActivity != _previouslyActiveActivity)
|
||||
{
|
||||
_previouslyActiveActivity = _activeActivity;
|
||||
|
||||
}
|
||||
_activeActivity = value;
|
||||
if (_task != null)
|
||||
_task.ActiveActivity = _activeActivity;
|
||||
@@ -65,18 +60,12 @@ namespace keepass2android
|
||||
}
|
||||
}
|
||||
|
||||
public Activity PreviouslyActiveActivity
|
||||
{
|
||||
get { return _previouslyActiveActivity; }
|
||||
|
||||
}
|
||||
|
||||
private readonly Handler _handler;
|
||||
private readonly Handler _handler;
|
||||
private readonly RunnableOnFinish _task;
|
||||
private IProgressDialog _progressDialog;
|
||||
private readonly IKp2aApp _app;
|
||||
private Thread _thread;
|
||||
private Activity _activeActivity, _previouslyActiveActivity;
|
||||
private Activity _activeActivity;
|
||||
private ProgressDialogStatusLogger _progressDialogStatusLogger;
|
||||
|
||||
public ProgressTask(IKp2aApp app, Activity activity, RunnableOnFinish task)
|
||||
|
||||
4386
src/Kp2aBusinessLogic/Resources/Resource.Designer.cs
generated
4386
src/Kp2aBusinessLogic/Resources/Resource.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@@ -88,7 +88,6 @@ namespace keepass2android
|
||||
ReadOnlyReason_ReadOnlyKitKat,
|
||||
ReadOnlyReason_LocalBackup,
|
||||
Ok,
|
||||
cancel,
|
||||
FileNotFound
|
||||
cancel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace keepass2android
|
||||
}
|
||||
|
||||
public byte[] HashOfLastStream { get; private set; }
|
||||
public bool CanWrite { get { return _format != KdbxFormat.PlainXml; } }
|
||||
public bool CanWrite { get { return true; } }
|
||||
public string SuccessMessage { get { return null; } }
|
||||
public void Save(PwDatabase kpDatabase, Stream stream)
|
||||
{
|
||||
|
||||
@@ -43,21 +43,17 @@ namespace keepass2android
|
||||
try
|
||||
{
|
||||
remoteData = cachingFileStorage.GetRemoteDataAndHash(ioc, out hash);
|
||||
Kp2aLog.Log("Checking for file change. Current hash = " + hash);
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
StatusLogger.UpdateSubMessage(_app.GetResourceString(UiStringKey.RestoringRemoteFile));
|
||||
cachingFileStorage.UpdateRemoteFile(ioc, _app.GetBooleanPreference(PreferenceKey.UseFileTransactions));
|
||||
Finish(true, _app.GetResourceString(UiStringKey.SynchronizedDatabaseSuccessfully));
|
||||
Kp2aLog.Log("Checking for file change: file not found");
|
||||
return;
|
||||
}
|
||||
|
||||
//check if remote file was modified:
|
||||
var baseVersionHash = cachingFileStorage.GetBaseVersionHash(ioc);
|
||||
Kp2aLog.Log("Checking for file change. baseVersionHash = " + baseVersionHash);
|
||||
if (baseVersionHash != hash)
|
||||
if (cachingFileStorage.GetBaseVersionHash(ioc) != hash)
|
||||
{
|
||||
//remote file is modified
|
||||
if (cachingFileStorage.HasLocalChanges(ioc))
|
||||
|
||||
@@ -36,11 +36,8 @@ namespace keepass2android
|
||||
{
|
||||
_actionToPerform = actionToPerform;
|
||||
}
|
||||
|
||||
//if set to true, the previously active active will be passed to ActionToPerformOnFinish instead null if no activity is on foreground
|
||||
public bool AllowInactiveActivity { get; set; }
|
||||
|
||||
public override void Run()
|
||||
|
||||
public override void Run()
|
||||
{
|
||||
if (Message == null)
|
||||
Message = "";
|
||||
@@ -49,7 +46,7 @@ namespace keepass2android
|
||||
Handler.Post(() => {_actionToPerform(Success, Message, ActiveActivity);});
|
||||
}
|
||||
else
|
||||
_actionToPerform(Success, Message, AllowInactiveActivity ? (ActiveActivity ?? PreviouslyActiveActivity) : ActiveActivity);
|
||||
_actionToPerform(Success, Message, ActiveActivity);
|
||||
base.Run();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace keepass2android
|
||||
else
|
||||
{
|
||||
// Let's not bother recovering from a failure to save. It is too much work.
|
||||
App.Lock(false, false);
|
||||
App.Lock(false);
|
||||
}
|
||||
}, OnFinishToRun);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace keepass2android
|
||||
_editGroup.App.DirtyGroups.Add(_editGroup.Group.ParentGroup);
|
||||
} else
|
||||
{
|
||||
_editGroup._app.Lock(false, false);
|
||||
_editGroup._app.Lock(false);
|
||||
}
|
||||
|
||||
base.Run();
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace keepass2android
|
||||
{
|
||||
if (!(e is InvalidCompositeKeyException))
|
||||
Kp2aLog.LogUnexpectedError(e);
|
||||
Finish(false, _app.GetResourceString(UiStringKey.ErrorOcurred) + " " + (e.Message ?? (e is FileNotFoundException ? _app.GetResourceString(UiStringKey.FileNotFound) : "")), false, Exception);
|
||||
Finish(false, _app.GetResourceString(UiStringKey.ErrorOcurred) + " " + e.Message, false, Exception);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace keepass2android
|
||||
protected OnFinish BaseOnFinish;
|
||||
protected Handler Handler;
|
||||
private ProgressDialogStatusLogger _statusLogger = new ProgressDialogStatusLogger(); //default: no logging but not null -> can be used whenever desired
|
||||
private Activity _activeActivity, _previouslyActiveActivity;
|
||||
private Activity _activeActivity;
|
||||
|
||||
|
||||
public ProgressDialogStatusLogger StatusLogger
|
||||
@@ -53,12 +53,7 @@ namespace keepass2android
|
||||
get { return _activeActivity; }
|
||||
set
|
||||
{
|
||||
if (_activeActivity != null && _activeActivity != _previouslyActiveActivity)
|
||||
{
|
||||
_previouslyActiveActivity = _activeActivity;
|
||||
|
||||
}
|
||||
_activeActivity = value;
|
||||
_activeActivity = value;
|
||||
if (BaseOnFinish != null)
|
||||
{
|
||||
BaseOnFinish.ActiveActivity = value;
|
||||
@@ -66,15 +61,8 @@ namespace keepass2android
|
||||
}
|
||||
}
|
||||
|
||||
public Activity PreviouslyActiveActivity
|
||||
{
|
||||
get { return _previouslyActiveActivity; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected OnFinish(Activity activeActivity, Handler handler)
|
||||
protected OnFinish(Activity activeActivity, Handler handler)
|
||||
{
|
||||
ActiveActivity = activeActivity;
|
||||
BaseOnFinish = null;
|
||||
|
||||
@@ -116,18 +116,14 @@ namespace keepass2android
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool hasStreamForOrigFile = (_streamForOrigFile != null);
|
||||
bool hasChangeFast = hasStreamForOrigFile ||
|
||||
fileStorage.CheckForFileChangeFast(ioc, _db.LastFileVersion); //first try to use the fast change detection;
|
||||
bool hasHashChanged = hasChangeFast ||
|
||||
(FileHashChanged(ioc, _db.KpDatabase.HashOfFileOnDisk) ==
|
||||
FileHashChange.Changed); //if that fails, hash the file and compare:
|
||||
|
||||
if (hasHashChanged)
|
||||
if (
|
||||
(_streamForOrigFile != null)
|
||||
|| fileStorage.CheckForFileChangeFast(ioc, _db.LastFileVersion) //first try to use the fast change detection
|
||||
|| (FileHashChanged(ioc, _db.KpDatabase.HashOfFileOnDisk) == FileHashChange.Changed) //if that fails, hash the file and compare:
|
||||
)
|
||||
{
|
||||
Kp2aLog.Log("Conflict. " + hasStreamForOrigFile + " " + hasChangeFast + " " + hasHashChanged);
|
||||
|
||||
//ask user...
|
||||
_app.AskYesNoCancel(UiStringKey.TitleSyncQuestion, UiStringKey.MessageSyncQuestion,
|
||||
|
||||
BIN
src/PCloudBindings/Jars/pcloud-sdk-android-1.1.0.aar
Normal file
BIN
src/PCloudBindings/Jars/pcloud-sdk-android-1.1.0.aar
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/PCloudBindings/Jars/pcloud-sdk-java-core-1.1.0.jar
Normal file
BIN
src/PCloudBindings/Jars/pcloud-sdk-java-core-1.1.0.jar
Normal file
Binary file not shown.
Binary file not shown.
@@ -55,7 +55,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
<None Include="Additions\AboutAdditions.txt" />
|
||||
<LibraryProjectZip Include="Jars\pcloud-sdk-android-1.2.0.aar" />
|
||||
<LibraryProjectZip Include="Jars\pcloud-sdk-android-1.1.0.aar" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<TransformFile Include="Transforms\Metadata.xml" />
|
||||
@@ -71,6 +71,6 @@
|
||||
</Target>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<EmbeddedReferenceJar Include="Jars\pcloud-sdk-java-core-1.2.0.jar" />
|
||||
<EmbeddedReferenceJar Include="Jars\pcloud-sdk-java-core-1.1.0.jar" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -54,7 +54,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<LibraryProjectZip Include="..\java\Keepass2AndroidPluginSDK2\app\build\outputs\aar\app-release.aar">
|
||||
<LibraryProjectZip Include="..\java\Keepass2AndroidPluginSDK2\app\build\outputs\aar\Keepass2AndroidPluginSDK2-release.aar">
|
||||
<Link>Jars\Keepass2AndroidPluginSDK2-release.aar</Link>
|
||||
</LibraryProjectZip>
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
cd ..\java\JavaFileStorageTest-AS
|
||||
./gradlew clean assemble
|
||||
|
||||
call gradlew assemble
|
||||
|
||||
cd ..\KP2ASoftkeyboard_AS
|
||||
./gradlew clean assemble
|
||||
call gradlew assemble
|
||||
|
||||
cd ..\Keepass2AndroidPluginSDK2
|
||||
./gradlew clean assemble
|
||||
call gradlew assemble
|
||||
|
||||
|
||||
cd ..\KP2AKdbLibrary
|
||||
./gradlew clean assemble
|
||||
call gradlew assemble
|
||||
|
||||
cd ..\PluginQR
|
||||
./gradlew clean assemble
|
||||
call gradlew assemble
|
||||
|
||||
cd ..\..\build-scripts
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
cd ..\java\JavaFileStorageTest-AS
|
||||
./gradlew -q :app:dependencies > ../../build-scripts/dependencies-JavaFileStorageTest-AS.txt
|
||||
|
||||
cd ..\KP2ASoftkeyboard_AS
|
||||
./gradlew -q :app:dependencies > ../../build-scripts/dependencies-KP2ASoftkeyboard_AS.txt
|
||||
|
||||
cd ..\Keepass2AndroidPluginSDK2
|
||||
./gradlew -q :app:dependencies > ../../build-scripts/dependencies-Keepass2AndroidPluginSDK2.txt
|
||||
|
||||
|
||||
cd ..\KP2AKdbLibrary
|
||||
./gradlew -q :app:dependencies > ../../build-scripts/dependencies-KP2AKdbLibrary.txt
|
||||
|
||||
cd ..\PluginQR
|
||||
./gradlew -q :app:dependencies > ../../build-scripts/dependencies-PluginQR.txt
|
||||
|
||||
cd ..\..\build-scripts
|
||||
@@ -1,11 +1,11 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
compileSdkVersion 26
|
||||
buildToolsVersion '28.0.3'
|
||||
defaultConfig {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
targetSdkVersion 23
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -26,9 +26,8 @@ NOTE: If you change dependencies here, don't forget to update the jar files in J
|
||||
*/
|
||||
|
||||
dependencies {
|
||||
compile 'com.android.support:appcompat-v7:28.0.0'
|
||||
compile 'com.squareup.okhttp3:okhttp:4.10.0-RC1'
|
||||
compile 'com.burgstaller:okhttp-digest:2.5'
|
||||
compile 'com.squareup.okhttp3:okhttp:4.2.2'
|
||||
compile 'com.burgstaller:okhttp-digest:2.0'
|
||||
compile 'com.google.android.gms:play-services:4.0.30'
|
||||
compile 'com.google.http-client:google-http-client-gson:1.20.0'
|
||||
compile('com.google.api-client:google-api-client-android:1.16.0-rc') {
|
||||
@@ -40,8 +39,8 @@ dependencies {
|
||||
compile('com.onedrive.sdk:onedrive-sdk-android:1.2.0') {
|
||||
transitive = false
|
||||
}
|
||||
compile 'com.pcloud.sdk:java-core:1.2.0'
|
||||
compile 'com.pcloud.sdk:android:1.2.0'
|
||||
compile 'com.pcloud.sdk:java-core:1.1.0'
|
||||
compile 'com.pcloud.sdk:android:1.1.0'
|
||||
compile 'com.google.code.gson:gson:2.3.1'
|
||||
compile 'com.microsoft.services.msa:msa-auth:0.8.6'
|
||||
compile 'com.microsoft.aad:adal:1.14.0'
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="14" />
|
||||
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2006-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2006-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2005-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2005-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2013-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2013-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2015-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2015-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2015-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2015-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2015-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2015-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2015-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2015-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2015-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2015-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2004-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2004-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2004-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2004-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
@@ -93,13 +93,7 @@ class IdentityFile implements Identity{
|
||||
* @return "ssh-rsa" or "ssh-dss"
|
||||
*/
|
||||
public String getAlgName(){
|
||||
byte[] name = kpair.getKeyTypeName();
|
||||
try {
|
||||
return new String(name, "UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException e){
|
||||
return new String(name);
|
||||
}
|
||||
return new String(kpair.getKeyTypeName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2012-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2012-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
@@ -66,9 +66,9 @@ public class JSch{
|
||||
config.put("diffie-hellman-group-exchange-sha256",
|
||||
"com.jcraft.jsch.DHGEX256"); // available since JDK1.4.2.
|
||||
// On JDK8, 2048bits will be used.
|
||||
config.put("ecdsa-sha2-nistp256", "com.jcraft.jsch.jce.SignatureECDSA256");
|
||||
config.put("ecdsa-sha2-nistp384", "com.jcraft.jsch.jce.SignatureECDSA384");
|
||||
config.put("ecdsa-sha2-nistp521", "com.jcraft.jsch.jce.SignatureECDSA521");
|
||||
config.put("ecdsa-sha2-nistp256", "com.jcraft.jsch.jce.SignatureECDSA");
|
||||
config.put("ecdsa-sha2-nistp384", "com.jcraft.jsch.jce.SignatureECDSA");
|
||||
config.put("ecdsa-sha2-nistp521", "com.jcraft.jsch.jce.SignatureECDSA");
|
||||
|
||||
config.put("ecdh-sha2-nistp256", "com.jcraft.jsch.DHEC256");
|
||||
config.put("ecdh-sha2-nistp384", "com.jcraft.jsch.DHEC384");
|
||||
@@ -94,6 +94,7 @@ public class JSch{
|
||||
config.put("md5", "com.jcraft.jsch.jce.MD5");
|
||||
config.put("signature.dss", "com.jcraft.jsch.jce.SignatureDSA");
|
||||
config.put("signature.rsa", "com.jcraft.jsch.jce.SignatureRSA");
|
||||
config.put("signature.ecdsa", "com.jcraft.jsch.jce.SignatureECDSA");
|
||||
config.put("keypairgen.dsa", "com.jcraft.jsch.jce.KeyPairGenDSA");
|
||||
config.put("keypairgen.rsa", "com.jcraft.jsch.jce.KeyPairGenRSA");
|
||||
config.put("keypairgen.ecdsa", "com.jcraft.jsch.jce.KeyPairGenECDSA");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
Copyright (c) 2002-2018 ymnk, JCraft,Inc. All rights reserved.
|
||||
Copyright (c) 2002-2016 ymnk, JCraft,Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
@@ -301,7 +301,7 @@ public abstract class KeyExchange{
|
||||
|
||||
SignatureECDSA sig=null;
|
||||
try{
|
||||
Class c=Class.forName(session.getConfig(alg));
|
||||
Class c=Class.forName(session.getConfig("signature.ecdsa"));
|
||||
sig=(SignatureECDSA)(c.newInstance());
|
||||
sig.init();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user