README.md
1
2Android BasicAndroidKeyStore Sample
3===================================
4
5An advanced sample displaying the creation and usage of data integrity mechanisms
6
7Introduction
8------------
9
10This sample demonstrates how to use the Android [KeyStore][1] to safely create and store
11encryption keys that only your application can access.
12
13A [KeyPair][2] consisting of a [PrivateKey][3] and a [PublicKey][4] is being generated.
14The private key then is being used to sign and verify a String.
15
16Below Android M, this sample uses a [KeyPairGeneratorSpec][5] to generate a key pair.
17On newer versions of Android, a [KeyGenParameterSpec][6] generates a key pair with
18additional restrictions and properties.
19
20
21Next to that appropriate exception handling for potential errors is being displayed.
22
23[1]: https://developer.android.com/reference/java/security/KeyStore.html
24[2]: https://developer.android.com/reference/java/security/KeyPair.html
25[3]: https://developer.android.com/reference/java/security/PrivateKey.html
26[4]: https://developer.android.com/reference/java/security/PublicKey.html
27[5]: https://developer.android.com/reference/android/security/KeyPairGeneratorSpec.html
28[6]: https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.html
29
30Pre-requisites
31--------------
32
33- Android SDK 27
34- Android Build Tools v27.0.2
35- Android Support Repository
36
37Screenshots
38-------------
39
40<img src="screenshots/screenshot1.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot2.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot3.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot4.png" height="400" alt="Screenshot"/> <img src="screenshots/screenshot5.png" height="400" alt="Screenshot"/>
41
42Getting Started
43---------------
44
45This sample uses the Gradle build system. To build this project, use the
46"gradlew build" command or use "Import Project" in Android Studio.
47
48Support
49-------
50
51- Google+ Community: https://plus.google.com/communities/105153134372062985968
52- Stack Overflow: http://stackoverflow.com/questions/tagged/android
53
54If you've found an error in this sample, please file an issue:
55https://github.com/googlesamples/android-BasicAndroidKeyStore
56
57Patches are encouraged, and may be submitted by forking this project and
58submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
59
60License
61-------
62
63Copyright 2017 The Android Open Source Project, Inc.
64
65Licensed to the Apache Software Foundation (ASF) under one or more contributor
66license agreements. See the NOTICE file distributed with this work for
67additional information regarding copyright ownership. The ASF licenses this
68file to you under the Apache License, Version 2.0 (the "License"); you may not
69use this file except in compliance with the License. You may obtain a copy of
70the License at
71
72http://www.apache.org/licenses/LICENSE-2.0
73
74Unless required by applicable law or agreed to in writing, software
75distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
76WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
77License for the specific language governing permissions and limitations under
78the License.
79