| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Copyright 2013 The Android Open Source Project |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| <sample> |
| <name>BasicAndroidKeyStore</name> |
| <group>Security</group> |
| <package>com.example.android.basicandroidkeystore</package> |
| |
| <!-- change minSdk if needed--> |
| <minSdk>18</minSdk> |
| |
| <strings> |
| <intro> |
| <![CDATA[ |
| Welcome to the <b>Basic Android Key Store</b> sample!\n\n |
| This sample demonstrates how to use the Android Key Store to safely create and store |
| encryption keys that only your application can access. You can also sign data |
| using those keys.\n\n |
| To create a new KeyPair, click \"Create\".\n\n |
| To sign some data using a KeyPair, click \"Sign\".\n\n |
| To verify the data using the signature provided, click \"Verify\".\n\n |
| ]]> |
| </intro> |
| </strings> |
| |
| <template src="base"/> |
| <template src="SimpleView"/> |
| <common src="activities"/> |
| <common src="logger"/> |
| |
| <metadata> |
| <status>PUBLISHED</status> |
| <categories>Security</categories> |
| <technologies>Android</technologies> |
| <languages>Java</languages> |
| <solutions>Mobile</solutions> |
| <level>ADVANCED</level> |
| <icon>screenshots/big-icon.png</icon> |
| <screenshots> |
| <img>screenshots/screenshot1.png</img> |
| <img>screenshots/screenshot2.png</img> |
| <img>screenshots/screenshot3.png</img> |
| <img>screenshots/screenshot4.png</img> |
| <img>screenshots/screenshot5.png</img> |
| </screenshots> |
| <api_refs> |
| <android>android.security.keystore.KeyGenParameterSpec</android> |
| <android>android.security.keystore.KeyProperties</android> |
| <android>android.security.KeyPairGeneratorSpec</android> |
| <android>java.security.KeyStore</android> |
| </api_refs> |
| <description> |
| <![CDATA[ |
| An advanced sample displaying the creation and usage of data integrity mechanisms |
| ]]> |
| </description> |
| <intro> |
| <![CDATA[ |
| This sample demonstrates how to use the Android [KeyStore][1] to safely create and store |
| encryption keys that only your application can access. |
| |
| A [KeyPair][2] consisting of a [PrivateKey][3] and a [PublicKey][4] is being generated. |
| The private key then is being used to sign and verify a String. |
| |
| Below Android M, this sample uses a [KeyPairGeneratorSpec][5] to generate a key pair. |
| On newer versions of Android, a [KeyGenParameterSpec][6] generates a key pair with |
| additional restrictions and properties. |
| |
| |
| Next to that appropriate exception handling for potential errors is being displayed. |
| |
| [1]: https://developer.android.com/reference/java/security/KeyStore.html |
| [2]: https://developer.android.com/reference/java/security/KeyPair.html |
| [3]: https://developer.android.com/reference/java/security/PrivateKey.html |
| [4]: https://developer.android.com/reference/java/security/PublicKey.html |
| [5]: https://developer.android.com/reference/android/security/KeyPairGeneratorSpec.html |
| [6]: https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.html |
| ]]> |
| </intro> |
| </metadata> |
| </sample> |