com.android.ide.common.signing
Class KeystoreHelper

java.lang.Object
  extended by com.android.ide.common.signing.KeystoreHelper

public final class KeystoreHelper
extends java.lang.Object

A Helper to create and read keystore/keys.


Constructor Summary
KeystoreHelper()
           
 
Method Summary
static boolean createDebugStore(java.lang.String storeType, java.io.File storeFile, java.lang.String storePassword, java.lang.String keyPassword, java.lang.String keyAlias, com.android.utils.ILogger logger)
          Creates a new debug store with the location, keyalias, and passwords specified in the config.
static java.lang.String defaultDebugKeystoreLocation()
          Returns the location of the default debug keystore.
static CertificateInfo getCertificateInfo(java.lang.String storeType, java.io.File storeFile, java.lang.String storePassword, java.lang.String keyPassword, java.lang.String keyAlias)
          Returns the CertificateInfo for the given signing configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeystoreHelper

public KeystoreHelper()
Method Detail

defaultDebugKeystoreLocation

@NonNull
public static java.lang.String defaultDebugKeystoreLocation()
                                                     throws com.android.prefs.AndroidLocation.AndroidLocationException
Returns the location of the default debug keystore.

Returns:
The location of the default debug keystore.
Throws:
com.android.prefs.AndroidLocation.AndroidLocationException - if the location cannot be computed

createDebugStore

public static boolean createDebugStore(@Nullable
                                       java.lang.String storeType,
                                       @NonNull
                                       java.io.File storeFile,
                                       @NonNull
                                       java.lang.String storePassword,
                                       @NonNull
                                       java.lang.String keyPassword,
                                       @NonNull
                                       java.lang.String keyAlias,
                                       @NonNull
                                       com.android.utils.ILogger logger)
                                throws KeytoolException
Creates a new debug store with the location, keyalias, and passwords specified in the config.

Parameters:
signingConfig - The signing config
logger - a logger object to receive the log of the creation.
Throws:
KeytoolException

getCertificateInfo

public static CertificateInfo getCertificateInfo(@Nullable
                                                 java.lang.String storeType,
                                                 @NonNull
                                                 java.io.File storeFile,
                                                 @NonNull
                                                 java.lang.String storePassword,
                                                 @NonNull
                                                 java.lang.String keyPassword,
                                                 @NonNull
                                                 java.lang.String keyAlias)
                                          throws KeytoolException,
                                                 java.io.FileNotFoundException
Returns the CertificateInfo for the given signing configuration. Returns null if the key could not be found. If the passwords are wrong, it throws an exception

Parameters:
signingConfig - the signing configuration
Returns:
the certificate info if it could be loaded.
Throws:
KeytoolException
java.io.FileNotFoundException