From ebf80fc7cf0dbcb3824da7921763f9bad7a81881 Mon Sep 17 00:00:00 2001 From: Steve Kim <86316075+sbSteveK@users.noreply.github.com> Date: Wed, 10 Jan 2024 08:10:09 -0800 Subject: [PATCH] Clean Android CI Dependencies and add PKCS11 documentation (#457) * remove unnecessary dependencies in test app * Add documentation for Android PKCS#11 library requirements --- documents/ANDROID.md | 9 +++++++++ sdk/tests/android/testapp/build.gradle | 11 +---------- .../amazon/awssdk/iottest/MainActivityTest.kt | 1 - 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/documents/ANDROID.md b/documents/ANDROID.md index 01ba18b5..0d16be1e 100644 --- a/documents/ANDROID.md +++ b/documents/ANDROID.md @@ -28,6 +28,7 @@ a dependency of the aws-iot-device-sdk-android library. * [Consuming from Maven](#consuming-from-maven) * [Consuming from locally installed](#consuming-from-locally-installed) * [Samples App](#samples-app) +* [PKCS#11](#pkcs11) ## Installation @@ -94,3 +95,11 @@ Look up the latest SDK version here: https://github.com/aws/aws-iot-device-sdk-j ## Samples App [Android IoT Samples App README](../samples/Android/README.md) +## PKCS#11 +Connecting using PKCS#11 requires a PKCS#11 library which the user must supply. There are requirements the library must meet: +* The PKCS#11 library **must** be compiled for Android and for use on the architecture of the target device. +* The PKCS#11 library **must** have access to the PKCS#11 compatible smart card or Hardware Security Module (HSM) for storage and access to the private key file. +* The path to the library needs to be provided to the [AwsIotMqtt5ClientBuilder](https://github.com/aws/aws-iot-device-sdk-java-v2/blob/92e9ff7dff1cdb191b16c8e52710cc731df04c08/sdk/src/main/java/software/amazon/awssdk/iot/AwsIotMqtt5ClientBuilder.java#L109C24-L109C24) for it to load and use the PKCS#11 library. ([The PKCS#11 Sample](../samples/Pkcs11Connect/README.md) can be used as a reference) +* The PKCS#11 library must not be compressed (When packaging assets into an Android APK, the assets are routinely compressed) and if it is compressed, must be uncompressed before providing the file location. + +A java sample using PKCS#11 can be found here: [Java PKCS#11 Sample](../samples/Pkcs11Connect/README.md) diff --git a/sdk/tests/android/testapp/build.gradle b/sdk/tests/android/testapp/build.gradle index c05bef1f..29f0e49f 100644 --- a/sdk/tests/android/testapp/build.gradle +++ b/sdk/tests/android/testapp/build.gradle @@ -13,6 +13,7 @@ buildscript { allprojects { repositories{ google() + mavenLocal() mavenCentral() } } @@ -57,12 +58,6 @@ android { sourceCompatibility = 1.8 targetCompatibility = 1.8 } - ndkVersion '23.1.7779620' -} - -repositories { - mavenLocal() - mavenCentral() } dependencies { @@ -75,13 +70,9 @@ dependencies { implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.13' - testImplementation 'junit:junit:4.12' androidTestImplementation "androidx.test:core:1.2.0" - androidTestImplementation "androidx.test:runner:1.5.2" androidTestImplementation "androidx.test:rules:1.5.0" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } diff --git a/sdk/tests/android/testapp/src/androidTest/java/software/amazon/awssdk/iottest/MainActivityTest.kt b/sdk/tests/android/testapp/src/androidTest/java/software/amazon/awssdk/iottest/MainActivityTest.kt index c14d2a3b..cdc5ebf5 100644 --- a/sdk/tests/android/testapp/src/androidTest/java/software/amazon/awssdk/iottest/MainActivityTest.kt +++ b/sdk/tests/android/testapp/src/androidTest/java/software/amazon/awssdk/iottest/MainActivityTest.kt @@ -11,7 +11,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Test import org.junit.runner.RunWith -import org.junit.Before import org.junit.Assert.* import java.lang.System