OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import java.security.PrivateKey; | 9 import org.chromium.net.AndroidPrivateKey; |
| 10 |
10 import java.security.cert.X509Certificate; | 11 import java.security.cert.X509Certificate; |
11 | 12 |
12 /** | 13 /** |
13 * Defines API for managing interaction with SmartCard-based certificate storage
using PKCS11. | 14 * Defines API for managing interaction with SmartCard-based certificate storage
using PKCS11. |
14 */ | 15 */ |
15 public interface PKCS11AuthenticationManager { | 16 public interface PKCS11AuthenticationManager { |
16 | 17 |
17 /** | 18 /** |
18 * @return true iff SmartCard-based authentication is available. | 19 * @return true iff SmartCard-based authentication is available. |
19 */ | 20 */ |
20 public boolean isPKCS11AuthEnabled(); | 21 public boolean isPKCS11AuthEnabled(); |
21 | 22 |
22 /** | 23 /** |
23 * Retrieves the preferred client certificate alias for the given host, port
pair, or null if | 24 * Retrieves the preferred client certificate alias for the given host, port
pair, or null if |
24 * none can be retrieved. | 25 * none can be retrieved. |
25 * | 26 * |
26 * @param hostName The host for which to retrieve client certificate. | 27 * @param hostName The host for which to retrieve client certificate. |
27 * @param port The port to use in conjunction with host to retrieve client c
ertificate. | 28 * @param port The port to use in conjunction with host to retrieve client c
ertificate. |
28 */ | 29 */ |
29 public String getClientCertificateAlias(String hostName, int port); | 30 public String getClientCertificateAlias(String hostName, int port); |
30 | 31 |
31 /** | 32 /** |
32 * Returns the X509Certificate chain for the requested alias, or null if no
there is no result. | 33 * Returns the X509Certificate chain for the requested alias, or null if no
there is no result. |
33 */ | 34 */ |
34 public X509Certificate[] getCertificateChain(String alias); | 35 public X509Certificate[] getCertificateChain(String alias); |
35 | 36 |
36 /** | 37 /** |
37 * Returns the PrivateKey for the requested alias, or null if no there is no
result. | |
38 */ | |
39 public PrivateKey getPrivateKey(String alias); | |
40 | |
41 /** | |
42 * Performs necessary initializing for using a PKCS11-based KeysStore. Note
that this can | 38 * Performs necessary initializing for using a PKCS11-based KeysStore. Note
that this can |
43 * perform expensive operations and cannot be done on the UI thread. | 39 * perform expensive operations and cannot be done on the UI thread. |
44 */ | 40 */ |
45 public void initialize(Context context); | 41 public void initialize(Context context); |
| 42 |
| 43 /** |
| 44 * Returns the AndroidPrivateKey for the requested alias, or null if there i
s no result. |
| 45 */ |
| 46 public AndroidPrivateKey getPrivateKey(String alias); |
46 } | 47 } |
OLD | NEW |