diff --git a/build/sdk.atree b/build/sdk.atree index b0d66420e..72808c59a 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -170,6 +170,7 @@ development/samples/CubeLiveWallpaper samples/${PLATFORM_NAME}/CubeLive development/samples/Home samples/${PLATFORM_NAME}/Home development/samples/HoneycombGallery samples/${PLATFORM_NAME}/HoneycombGallery development/samples/JetBoy samples/${PLATFORM_NAME}/JetBoy +development/samples/KeyChainDemo samples/${PLATFORM_NAME}/KeyChainDemo development/samples/LunarLander samples/${PLATFORM_NAME}/LunarLander development/samples/MultiResolution samples/${PLATFORM_NAME}/MultiResolution development/samples/NotePad samples/${PLATFORM_NAME}/NotePad diff --git a/samples/KeyChainDemo/Android.mk b/samples/KeyChainDemo/Android.mk new file mode 100644 index 000000000..a607e95d0 --- /dev/null +++ b/samples/KeyChainDemo/Android.mk @@ -0,0 +1,16 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := samples + +# Only compile source java files in this apk. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := KeyChainDemo + +LOCAL_SDK_VERSION := current + +include $(BUILD_PACKAGE) + +# Use the following include to make our test apk. +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/samples/KeyChainDemo/AndroidManifest.xml b/samples/KeyChainDemo/AndroidManifest.xml new file mode 100644 index 000000000..e52930932 --- /dev/null +++ b/samples/KeyChainDemo/AndroidManifest.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/KeyChainDemo/_index.html b/samples/KeyChainDemo/_index.html new file mode 100644 index 000000000..57e91b30f --- /dev/null +++ b/samples/KeyChainDemo/_index.html @@ -0,0 +1,50 @@ +

This is a demo application highlighting how to use the KeyChain APIs introduced in API Level 14.

+ +

The source code for this demo app shows how to install a PKCS12 key chain stored in the assets folder, + grant permission to the app to use the installed key chain and finally display the certificate and + private key info. The app also has a simple implementation of a web server listening to requests + at an SSL socket using the same certificate in the key chain. +

+ +

The application includes the following key classes:

+ + +

If you are developing an application that uses the KeyChain APIs, + remember that the feature is supported only on Android 4.0 (API level 14) and + higher versions of the platform. To ensure that your application can only be + installed on devices that are running Android 4.0, remember to add the + following to the application's manifest:

+ + +

Note: Due to browser cache, you need to restart the browser completely before it can recognize + any keystore updates. The easiest way to do this is to dismiss the app in the Recent Apps list. +

+ +

+ For more information about using the KeyChain API, see the + + android.security.KeyChain + documentation. +

+ + + + + + diff --git a/samples/KeyChainDemo/assets/keychain.p12 b/samples/KeyChainDemo/assets/keychain.p12 new file mode 100644 index 000000000..66bd91663 Binary files /dev/null and b/samples/KeyChainDemo/assets/keychain.p12 differ diff --git a/samples/KeyChainDemo/assets/training-prof.png b/samples/KeyChainDemo/assets/training-prof.png new file mode 100644 index 000000000..ad91db27c Binary files /dev/null and b/samples/KeyChainDemo/assets/training-prof.png differ diff --git a/samples/KeyChainDemo/res/drawable-hdpi/ic_launcher.png b/samples/KeyChainDemo/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..8074c4c57 Binary files /dev/null and b/samples/KeyChainDemo/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/KeyChainDemo/res/drawable-ldpi/ic_launcher.png b/samples/KeyChainDemo/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 000000000..1095584ec Binary files /dev/null and b/samples/KeyChainDemo/res/drawable-ldpi/ic_launcher.png differ diff --git a/samples/KeyChainDemo/res/drawable-mdpi/ic_launcher.png b/samples/KeyChainDemo/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..a07c69fa5 Binary files /dev/null and b/samples/KeyChainDemo/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/KeyChainDemo/res/layout/main.xml b/samples/KeyChainDemo/res/layout/main.xml new file mode 100644 index 000000000..c968c0898 --- /dev/null +++ b/samples/KeyChainDemo/res/layout/main.xml @@ -0,0 +1,93 @@ + + + + + + +