• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 package org.chromium.chrome.browser;
6 
7 import android.content.Context;
8 
9 import org.chromium.net.AndroidPrivateKey;
10 
11 import java.security.cert.X509Certificate;
12 
13 /**
14  * Defines API for managing interaction with SmartCard-based certificate storage using PKCS11.
15  */
16 public interface PKCS11AuthenticationManager {
17 
18     /**
19      * @return true iff SmartCard-based authentication is available.
20      */
isPKCS11AuthEnabled()21     public boolean isPKCS11AuthEnabled();
22 
23     /**
24      * Retrieves the preferred client certificate alias for the given host, port pair, or null if
25      * none can be retrieved.
26      *
27      * @param hostName The host for which to retrieve client certificate.
28      * @param port The port to use in conjunction with host to retrieve client certificate.
29      */
getClientCertificateAlias(String hostName, int port)30     public String getClientCertificateAlias(String hostName, int port);
31 
32     /**
33      * Returns the X509Certificate chain for the requested alias, or null if no there is no result.
34      */
getCertificateChain(String alias)35     public X509Certificate[] getCertificateChain(String alias);
36 
37     /**
38      * Performs necessary initializing for using a PKCS11-based KeysStore.
39      */
initialize(Context context)40     public void initialize(Context context);
41 
42     /**
43      * Returns the AndroidPrivateKey for the requested alias, or null if there is no result.
44      */
getPrivateKey(String alias)45     public AndroidPrivateKey getPrivateKey(String alias);
46 }
47