1 <?xml version="1.0" encoding="UTF-8"?> 2 <!-- 3 Copyright 2013 The Android Open Source Project 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 --> 17 <sample> 18 <name>BasicAndroidKeyStore</name> 19 <group>Security</group> 20 <package>com.example.android.basicandroidkeystore</package> 21 22 <!-- change minSdk if needed--> 23 <minSdk>18</minSdk> 24 25 <strings> 26 <intro> 27 <![CDATA[ 28 Welcome to the <b>Basic Android Key Store</b> sample!\n\n 29 This sample demonstrates how to use the Android Key Store to safely create and store 30 encryption keys that only your application can access. You can also sign data 31 using those keys.\n\n 32 To create a new KeyPair, click \"Create\".\n\n 33 To sign some data using a KeyPair, click \"Sign\".\n\n 34 To verify the data using the signature provided, click \"Verify\".\n\n 35 ]]> 36 </intro> 37 </strings> 38 39 <template src="base"/> 40 <template src="SimpleView"/> 41 <common src="activities"/> 42 <common src="logger"/> 43 44 <metadata> 45 <status>PUBLISHED</status> 46 <categories>Security</categories> 47 <technologies>Android</technologies> 48 <languages>Java</languages> 49 <solutions>Mobile</solutions> 50 <level>ADVANCED</level> 51 <icon>screenshots/big-icon.png</icon> 52 <screenshots> 53 <img>screenshots/screenshot1.png</img> 54 <img>screenshots/screenshot2.png</img> 55 <img>screenshots/screenshot3.png</img> 56 <img>screenshots/screenshot4.png</img> 57 <img>screenshots/screenshot5.png</img> 58 </screenshots> 59 <api_refs> 60 <android>android.security.keystore.KeyGenParameterSpec</android> 61 <android>android.security.keystore.KeyProperties</android> 62 <android>android.security.KeyPairGeneratorSpec</android> 63 <android>java.security.KeyStore</android> 64 </api_refs> 65 <description> 66 <![CDATA[ 67 An advanced sample displaying the creation and usage of data integrity mechanisms 68 ]]> 69 </description> 70 <intro> 71 <![CDATA[ 72 This sample demonstrates how to use the Android [KeyStore][1] to safely create and store 73 encryption keys that only your application can access. 74 75 A [KeyPair][2] consisting of a [PrivateKey][3] and a [PublicKey][4] is being generated. 76 The private key then is being used to sign and verify a String. 77 78 Below Android M, this sample uses a [KeyPairGeneratorSpec][5] to generate a key pair. 79 On newer versions of Android, a [KeyGenParameterSpec][6] generates a key pair with 80 additional restrictions and properties. 81 82 83 Next to that appropriate exception handling for potential errors is being displayed. 84 85 [1]: https://developer.android.com/reference/java/security/KeyStore.html 86 [2]: https://developer.android.com/reference/java/security/KeyPair.html 87 [3]: https://developer.android.com/reference/java/security/PrivateKey.html 88 [4]: https://developer.android.com/reference/java/security/PublicKey.html 89 [5]: https://developer.android.com/reference/android/security/KeyPairGeneratorSpec.html 90 [6]: https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.html 91 ]]> 92 </intro> 93 </metadata> 94 </sample> 95