This commit is contained in:
Philipp Crocoll
2019-08-05 06:36:56 +02:00
31 changed files with 712 additions and 619 deletions

View File

@@ -20,6 +20,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
namespace KeePassLib.Cryptography.KeyDerivation
@@ -127,8 +128,44 @@ namespace KeePassLib.Cryptography.KeyDerivation
byte[] pbSecretKey = p.GetByteArray(ParamSecretKey);
byte[] pbAssocData = p.GetByteArray(ParamAssocData);
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);
}
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;
@@ -143,5 +180,14 @@ namespace KeePassLib.Cryptography.KeyDerivation
MaxIterations, uMilliseconds, true);
return p;
}
[DllImport("argon2")]
static extern int argon2_hash(
UInt32 t_cost, UInt32 m_cost, UInt32 parallelism,
IntPtr pwd, IntPtr pwdlen,
IntPtr salt, IntPtr saltlen,
IntPtr hash, IntPtr hashlen,
IntPtr encoded, IntPtr encodedlen,
UInt32 type, UInt32 version);
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -67,7 +67,7 @@
<None Include="Jars\AboutJars.txt" />
<None Include="Additions\AboutAdditions.txt" />
<LibraryProjectZip Include="Jars\pcloud-sdk-android-1.0.1.aar" />
<LibraryProjectZip Include="Jars\pcloud-sdk-android-1.1.0.aar" />
</ItemGroup>
<ItemGroup>
<TransformFile Include="Transforms\Metadata.xml" />
@@ -84,7 +84,7 @@
</Target>
-->
<ItemGroup>
<EmbeddedReferenceJar Include="Jars\pcloud-sdk-java-core-1.0.1.jar" />
<EmbeddedReferenceJar Include="Jars\pcloud-sdk-java-core-1.1.0.jar" />
</ItemGroup>
</Project>

View File

@@ -26,5 +26,5 @@ using Android.App;
// 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")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

View File

@@ -1,6 +1,11 @@
#!/bin/bash
set -e
echo '*****************************************'
echo '******* Building native libraries *******'
echo '*****************************************'
./build-native.sh
echo '*****************************************'
echo '********** Building Java parts **********'
echo '*****************************************'

View File

@@ -1,6 +1,8 @@
#!/bin/bash
set -e
unset ANDROID_NDK_HOME ANDROID_NDK
pushd ../java/
pushd JavaFileStorageTest-AS

View File

@@ -0,0 +1,6 @@
#!/bin/bash
set -e
pushd ../java/argon2
ndk-build
popd

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
@@ -35,8 +35,8 @@ dependencies {
compile('com.onedrive.sdk:onedrive-sdk-android:1.2.0') {
transitive = false
}
compile 'com.pcloud.sdk:java-core:1.0.1'
compile 'com.pcloud.sdk:android:1.0.1'
compile 'com.pcloud.sdk:java-core:1.1.0'
compile 'com.pcloud.sdk:android:1.1.0'
compile('com.microsoft.graph:msgraph-sdk-android:1.2.+')
compile ('com.microsoft.identity.client:msal:0.1.+') {
exclude group: 'com.android.support', module: 'appcompat-v7'

View File

@@ -28,6 +28,7 @@ import com.pcloud.sdk.PCloudSdk;
import com.pcloud.sdk.RemoteEntry;
import com.pcloud.sdk.RemoteFile;
import com.pcloud.sdk.RemoteFolder;
import com.pcloud.sdk.UploadOptions;
/**
* FileStorage implementation for PCloud provider.
@@ -136,10 +137,10 @@ public class PCloudFileStorage extends JavaFileStorageBase
String filePath = path.substring(0, path.lastIndexOf("/") + 1);
RemoteFolder remoteFolder = this.getRemoteFolderByPath(filePath);
String tempName = "." + UUID.randomUUID().toString();
try {
RemoteFile remoteFile = this.apiClient.createFile(remoteFolder, tempName, dataSource).execute();
this.apiClient.rename(remoteFile, filename).execute();
RemoteFile remoteFile = this.apiClient.createFile(
remoteFolder, filename, dataSource, null, null, UploadOptions.OVERRIDE_FILE
).execute();
} catch (ApiError e) {
throw convertApiError(e);
}

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.crocoapps.javafilestoragetest"

View File

@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 18

View File

@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '26.0.2'
compileSdkVersion 23
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 8
@@ -17,4 +17,4 @@ android {
}
dependencies {
}
}

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "keepass2android.plugin.qr"

View File

@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
buildToolsVersion '28.0.3'
defaultConfig {
minSdkVersion 15

1
src/java/argon2/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/libs/

View File

@@ -0,0 +1,18 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := argon2
LOCAL_SRC_FILES := \
../phc-winner-argon2/src/argon2.c \
../phc-winner-argon2/src/core.c \
../phc-winner-argon2/src/blake2/blake2b.c \
../phc-winner-argon2/src/thread.c \
../phc-winner-argon2/src/encoding.c \
../phc-winner-argon2/src/ref.c
LOCAL_CFLAGS += -I $(LOCAL_PATH)/../phc-winner-argon2/include
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,3 @@
APP_OPTIM := release
APP_ABI := armeabi-v7a arm64-v8a x86 x86_64
APP_PLATFORM := android-16

View File

@@ -108,7 +108,7 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<uses-library required="false" name="com.sec.android.app.multiwindow" />
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
@@ -127,4 +127,4 @@
<!-- Samsung Pass permission -->
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
</manifest>
</manifest>

View File

@@ -132,7 +132,7 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<uses-library required="false" name="com.sec.android.app.multiwindow" />
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
@@ -153,4 +153,4 @@
<!-- Samsung Pass permission -->
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
</manifest>
</manifest>

View File

@@ -123,7 +123,7 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<uses-library required="false" name="com.sec.android.app.multiwindow" />
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_W" android:value="632.0dip" />
<meta-data android:name="com.sec.android.multiwindow.DEFAULT_SIZE_H" android:value="598.0dip" />
@@ -138,4 +138,4 @@
<uses-permission android:name="keepass2android.keepass2android.permission.KP2aInternalSearch" />
<!-- Samsung Pass permission -->
<uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
</manifest>
</manifest>

View File

@@ -625,7 +625,7 @@
<string name="EntryChannel_name">Indtastningsnotifikationer</string>
<string name="EntryChannel_desc">Notificering til forenkelse af adgang til den aktuelt valgte indtastning.</string>
<string name="ShowKeyboardDuringFingerprintAuth">Vis soft-tastatur til adgangskodeinput, når fingeraftrykaflæsning er aktiv.</string>
<string name="ChangeLog_1_07"> Version 1.07-pre2\n
<string name="ChangeLog_1_07"> Version 1.07\n
* Løser nedbrud på Samsungs Android 9\n
* Tillader åbning af flere end én database, kompatibel med KeeAutoExec\n
* SFTP: Tillader offentlig nøglegodkendelse, tjekker om værtsnøgle er ændret\n

File diff suppressed because it is too large Load Diff

View File

@@ -548,6 +548,7 @@
<string name="filestoragehelp_dropboxKP2A">If you do not want to give KP2A access to your full Dropbox, you may select this option. It will request only access to the folder Apps/Keepass2Android. This is especially suited when creating a new database. If you already have a database, select this option to create the folder, then place your file inside the folder (from your PC) and then select this option again for opening the file.</string>
<string name="filestoragename_gdrive">Google Drive</string>
<string name="filestoragename_pcloud">PCloud</string>
<string name="filestoragehelp_pcloud">This storage type will only request access to the "Applications/Keepass2Android" folder. If you want to use an existing database from your PCloud account, please make sure the file is placed in this folder.</string>
<string name="filestoragename_onedrive">OneDrive</string>
<string name="filestoragename_sftp">SFTP (SSH File Transfer)</string>
<string name="filestoragename_content">System file picker</string>

View File

@@ -40,7 +40,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<Debugger>Xamarin</Debugger>
<DevInstrumentationEnabled>True</DevInstrumentationEnabled>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis>
<AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<BundleAssemblies>false</BundleAssemblies>
@@ -58,7 +58,7 @@
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<ConsolePause>False</ConsolePause>
<AndroidSupportedAbis>armeabi,armeabi-v7a,x86,x86_64</AndroidSupportedAbis>
<AndroidSupportedAbis>armeabi-v7a,x86,x86_64</AndroidSupportedAbis>
<CustomCommands>
<CustomCommands>
<Command type="BeforeBuild" command="UseManifestNet.bat" />
@@ -93,7 +93,7 @@
<Command type="BeforeBuild" command="UseManifestNoNet.bat" workingdir="" />
</CustomCommands>
</CustomCommands>
<AndroidSupportedAbis>armeabi,armeabi-v7a</AndroidSupportedAbis>
<AndroidSupportedAbis>armeabi-v7a</AndroidSupportedAbis>
<DeployExternal>True</DeployExternal>
<JavaOptions>
</JavaOptions>
@@ -1920,6 +1920,12 @@
<ItemGroup>
<AndroidAsset Include="Assets\publicsuffix.txt" />
</ItemGroup>
<ItemGroup>
<AndroidNativeLibrary Include="..\java\argon2\libs\armeabi-v7a\libargon2.so" />
<AndroidNativeLibrary Include="..\java\argon2\libs\arm64-v8a\libargon2.so" />
<AndroidNativeLibrary Include="..\java\argon2\libs\x86\libargon2.so" />
<AndroidNativeLibrary Include="..\java\argon2\libs\x86_64\libargon2.so" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
@@ -1968,4 +1974,4 @@
<Import Project="..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Animated.Vector.Drawable.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Animated.Vector.Drawable.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.targets" Condition="Exists('..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.targets')" />
<Import Project="..\packages\Xamarin.Android.Support.Design.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Design.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Design.26.1.0.1\build\MonoAndroid80\Xamarin.Android.Support.Design.targets')" />
</Project>
</Project>

View File

@@ -30,12 +30,12 @@ namespace keepass2android.services.AutofillBase
static readonly HashSet<string> _trustedBrowsers = new HashSet<string>
{
"org.mozilla.klar","org.mozilla.focus","org.mozilla.firefox","org.mozilla.firefox_beta","com.microsoft.emmx",
"com.android.chrome","com.chrome.beta","com.android.browser","com.brave.browser","com.opera.browser",
"com.opera.browser.beta","com.opera.mini.native","com.chrome.dev","com.chrome.canary",
"com.google.android.apps.chrome","com.google.android.apps.chrome_dev","com.yandex.browser",
"com.sec.android.app.sbrowser","com.sec.android.app.sbrowser.beta","org.codeaurora.swe.browser",
"com.amazon.cloud9"
"org.mozilla.firefox","org.mozilla.firefox_beta","org.mozilla.fenix","org.mozilla.klar","org.mozilla.focus",
"com.android.browser","com.android.chrome","com.chrome.beta","com.chrome.dev","com.chrome.canary",
"com.google.android.apps.chrome","com.google.android.apps.chrome_dev",
"com.opera.browser","com.opera.browser.beta","com.opera.mini.native",
"com.brave.browser","com.yandex.browser","com.microsoft.emmx","com.amazon.cloud9",
"com.sec.android.app.sbrowser","com.sec.android.app.sbrowser.beta","org.codeaurora.swe.browser"
};
private bool IsTrustedBrowser(string packageName)
@@ -43,4 +43,4 @@ namespace keepass2android.services.AutofillBase
return _trustedBrowsers.Contains(packageName);
}
}
}
}