Home | History | Annotate | Download | only in KeyChainDemo
      1 <p>This is a demo application highlighting how to use the KeyChain APIs introduced in API Level 14.</p>
      2 
      3 <p>The source code for this demo app shows how to install a PKCS12 key chain stored in the assets folder,
      4  grant permission to the app to use the installed key chain and finally display the certificate and
      5  private key info.  The app also has a simple implementation of a web server listening to requests
      6  at an SSL socket using the same certificate in the key chain.
      7 </p>
      8 
      9 <p>The application includes the following key classes:</p>
     10 <ul>
     11   <li><a href="src/com/example/android/keychain/KeyChainDemoActivity.html"><code>KeyChainDemoActivity</code></a>
     12     &mdash; the main <code>Activity</code> that is used to install the key chain and start/stop
     13     the web server.  </li>
     14   <li><a href="src/com/example/android/keychain/SecureWebServer.html"><code>SecureWebServer</code></a>
     15     &mdash; a single thread web server listening at port 8080 for <code>https://localhost:8080</code> request</li>
     16   <li><a href="src/com/example/android/keychain/SecureWebServerService.html"><code>SecureWebServerService</code></a>
     17     &mdash; a <code>Service</code> that runs the web server in the foreground.</li>
     18 </ul>
     19 
     20 <p>If you are developing an application that uses the KeyChain APIs,
     21  remember that the feature is supported only on Android 4.0 (API level 14) and
     22  higher versions of the platform. To ensure that your application can only be
     23  installed on devices that are running Android 4.0, remember to add the
     24  following to the application's manifest:</p>
     25 <ul>
     26   <li><code>&lt;uses-sdk android:minSdkVersion="14" /&gt;</code>, which
     27     indicates to the Android platform that your application requires
     28     Android 4.0 or higher. For more information, see <a
     29     href="../../../guide/appendix/api-levels.html">API Levels</a> and the
     30     documentation for the <a
     31     href="../../../guide/topics/manifest/uses-sdk-element.html"><code>&lt;uses-sdk&gt;</code></a>
     32     element.</li>
     33 </ul>
     34 
     35 <p>Note: Due to browser cache, you need to restart the browser completely before it can recognize
     36  any keystore updates.  The easiest way to do this is to dismiss the app in the Recent Apps list.
     37 </p>
     38 
     39 <p>
     40   For more information about using the KeyChain API, see the
     41   <a href="../../../reference/android/security/KeyChain.html">
     42   <code>android.security.KeyChain</code></a>
     43   documentation.
     44 </p>
     45 
     46 <img alt="" src="../images/KeyChainDemo1.png" />
     47 <img alt="" src="../images/KeyChainDemo2.png" />
     48 <img alt="" src="../images/KeyChainDemo3.png" />
     49 <img alt="" src="../images/KeyChainDemo4.png" />
     50 
     51