java.security
Class KeyStore

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.KeyStore

public class KeyStore
extends Object sample code for java.lang.Object definition code for java.lang.Object

This class represents a storage facility for cryptographic keys and certificates.

A KeyStore manages different types of entries. Each type of entry implements the KeyStore.Entry interface. Three basic KeyStore.Entry implementations are provided:

Each entry in a keystore is identified by an "alias" string. In the case of private keys and their associated certificate chains, these strings distinguish among the different ways in which the entity may authenticate itself. For example, the entity may authenticate itself using different certificate authorities, or using different public key algorithms.

Whether keystores are persistent, and the mechanisms used by the keystore if it is persistent, are not specified here. This allows use of a variety of techniques for protecting sensitive (e.g., private or secret) keys. Smart cards or other integrated cryptographic engines (SafeKeyper) are one option, and simpler mechanisms such as files may also be used (in a variety of formats).

Typical ways to request a KeyStore object include relying on the default type and providing a specific keystore type.

Before a keystore can be accessed, it must be loaded sample code for java.security.KeyStore.load(java.io.InputStream, char[]) definition code for java.security.KeyStore.load(java.io.InputStream, char[]) .

    KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());

    // get user password and file input stream
    char[] password = getPassword();
    java.io.FileInputStream fis =
        new java.io.FileInputStream("keyStoreName");
    ks.load(fis, password);
    fis.close();
 
To create an empty keystore using the above load method, pass null as the InputStream argument.

Once the keystore has been loaded, it is possible to read existing entries from the keystore, or to write new entries into the keystore:

    // get my private key
    KeyStore.PrivateKeyEntry pkEntry = (KeyStore.PrivateKeyEntry)
        ks.getEntry("privateKeyAlias", password);
    PrivateKey myPrivateKey = pkEntry.getPrivateKey();

    // save my secret key
    javax.crypto.SecretKey mySecretKey;
    KeyStore.SecretKeyEntry skEntry =
        new KeyStore.SecretKeyEntry(mySecretKey);
    ks.setEntry("secretKeyAlias", skEntry, password);

    // store away the keystore
    java.io.FileOutputStream fos =
        new java.io.FileOutputStream("newKeyStoreName");
    ks.store(fos, password);
    fos.close();
 
Note that although the same password may be used to load the keystore, to protect the private key entry, to protect the secret key entry, and to store the keystore (as is shown in the sample code above), different passwords or other protection parameters may also be used.

Since:
1.2
See Also:
PrivateKey sample code for java.security.PrivateKey definition code for java.security.PrivateKey , SecretKey, Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate

Nested Class Summary
static class KeyStore.Builder sample code for java.security.KeyStore.Builder definition code for java.security.KeyStore.Builder
          A description of a to-be-instantiated KeyStore object.
static class KeyStore.CallbackHandlerProtection sample code for java.security.KeyStore.CallbackHandlerProtection definition code for java.security.KeyStore.CallbackHandlerProtection
          A ProtectionParameter encapsulating a CallbackHandler.
static interface KeyStore.Entry sample code for java.security.KeyStore.Entry definition code for java.security.KeyStore.Entry
          A marker interface for KeyStore entry types.
static interface KeyStore.LoadStoreParameter sample code for java.security.KeyStore.LoadStoreParameter definition code for java.security.KeyStore.LoadStoreParameter
          A marker interface for KeyStore load sample code for java.security.KeyStore.load(java.security.KeyStore.LoadStoreParameter) definition code for java.security.KeyStore.load(java.security.KeyStore.LoadStoreParameter) and store sample code for java.security.KeyStore.store(java.security.KeyStore.LoadStoreParameter) definition code for java.security.KeyStore.store(java.security.KeyStore.LoadStoreParameter) parameters.
static class KeyStore.PasswordProtection sample code for java.security.KeyStore.PasswordProtection definition code for java.security.KeyStore.PasswordProtection
          A password-based implementation of ProtectionParameter.
static class KeyStore.PrivateKeyEntry sample code for java.security.KeyStore.PrivateKeyEntry definition code for java.security.KeyStore.PrivateKeyEntry
          A KeyStore entry that holds a PrivateKey and corresponding certificate chain.
static interface KeyStore.ProtectionParameter sample code for java.security.KeyStore.ProtectionParameter definition code for java.security.KeyStore.ProtectionParameter
          A marker interface for keystore protection parameters.
static class KeyStore.SecretKeyEntry sample code for java.security.KeyStore.SecretKeyEntry definition code for java.security.KeyStore.SecretKeyEntry
          A KeyStore entry that holds a SecretKey.
static class KeyStore.TrustedCertificateEntry sample code for java.security.KeyStore.TrustedCertificateEntry definition code for java.security.KeyStore.TrustedCertificateEntry
          A KeyStore entry that holds a trusted Certificate.
 
Constructor Summary
protected KeyStore sample code for java.security.KeyStore.KeyStore(java.security.KeyStoreSpi, java.security.Provider, java.lang.String) definition code for java.security.KeyStore.KeyStore(java.security.KeyStoreSpi, java.security.Provider, java.lang.String) (KeyStoreSpi sample code for java.security.KeyStoreSpi definition code for java.security.KeyStoreSpi  keyStoreSpi, Provider sample code for java.security.Provider definition code for java.security.Provider  provider, String sample code for java.lang.String definition code for java.lang.String  type)
          Creates a KeyStore object of the given type, and encapsulates the given provider implementation (SPI object) in it.
 
Method Summary
 Enumeration sample code for java.util.Enumeration definition code for java.util.Enumeration <String sample code for java.lang.String definition code for java.lang.String > aliases sample code for java.security.KeyStore.aliases() definition code for java.security.KeyStore.aliases() ()
          Lists all the alias names of this keystore.
 boolean containsAlias sample code for java.security.KeyStore.containsAlias(java.lang.String) definition code for java.security.KeyStore.containsAlias(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  alias)
          Checks if the given alias exists in this keystore.
 void deleteEntry sample code for java.security.KeyStore.deleteEntry(java.lang.String) definition code for java.security.KeyStore.deleteEntry(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  alias)
          Deletes the entry identified by the given alias from this keystore.
 boolean entryInstanceOf sample code for java.security.KeyStore.entryInstanceOf(java.lang.String, java.lang.Class) definition code for java.security.KeyStore.entryInstanceOf(java.lang.String, java.lang.Class) (String sample code for java.lang.String definition code for java.lang.String  alias, Class sample code for java.lang.Class definition code for java.lang.Class <? extends KeyStore.Entry sample code for java.security.KeyStore.Entry definition code for java.security.KeyStore.Entry > entryClass)
          Determines if the keystore Entry for the specified alias is an instance or subclass of the specified entryClass.
 Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate getCertificate sample code for java.security.KeyStore.getCertificate(java.lang.String) definition code for java.security.KeyStore.getCertificate(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  alias)
          Returns the certificate associated with the given alias.
 String sample code for java.lang.String definition code for java.lang.String getCertificateAlias sample code for java.security.KeyStore.getCertificateAlias(java.security.cert.Certificate) definition code for java.security.KeyStore.getCertificateAlias(java.security.cert.Certificate) (Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate  cert)
          Returns the (alias) name of the first keystore entry whose certificate matches the given certificate.
 Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] getCertificateChain sample code for java.security.KeyStore.getCertificateChain(java.lang.String) definition code for java.security.KeyStore.getCertificateChain(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  alias)
          Returns the certificate chain associated with the given alias.
 Date sample code for java.util.Date definition code for java.util.Date getCreationDate sample code for java.security.KeyStore.getCreationDate(java.lang.String) definition code for java.security.KeyStore.getCreationDate(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  alias)
          Returns the creation date of the entry identified by the given alias.
static String sample code for java.lang.String definition code for java.lang.String getDefaultType sample code for java.security.KeyStore.getDefaultType() definition code for java.security.KeyStore.getDefaultType() ()
          Returns the default keystore type as specified in the Java security properties file, or the string "jks" (acronym for "Java keystore") if no such property exists.
 KeyStore.Entry sample code for java.security.KeyStore.Entry definition code for java.security.KeyStore.Entry getEntry sample code for java.security.KeyStore.getEntry(java.lang.String, java.security.KeyStore.ProtectionParameter) definition code for java.security.KeyStore.getEntry(java.lang.String, java.security.KeyStore.ProtectionParameter) (String sample code for java.lang.String definition code for java.lang.String  alias, KeyStore.ProtectionParameter sample code for java.security.KeyStore.ProtectionParameter definition code for java.security.KeyStore.ProtectionParameter  protParam)
          Gets a keystore Entry for the specified alias with the specified protection parameter.
static KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore getInstance sample code for java.security.KeyStore.getInstance(java.lang.String) definition code for java.security.KeyStore.getInstance(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  type)
          Generates a keystore object of the given type.
static KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore getInstance sample code for java.security.KeyStore.getInstance(java.lang.String, java.security.Provider) definition code for java.security.KeyStore.getInstance(java.lang.String, java.security.Provider) (String sample code for java.lang.String definition code for java.lang.String  type, Provider sample code for java.security.Provider definition code for java.security.Provider  provider)
          Generates a keystore object for the specified keystore type from the specified provider.
static KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore getInstance sample code for java.security.KeyStore.getInstance(java.lang.String, java.lang.String) definition code for java.security.KeyStore.getInstance(java.lang.String, java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  type, String sample code for java.lang.String definition code for java.lang.String  provider)
          Generates a keystore object for the specified keystore type from the specified provider.
 Key sample code for java.security.Key definition code for java.security.Key getKey sample code for java.security.KeyStore.getKey(java.lang.String, char[]) definition code for java.security.KeyStore.getKey(java.lang.String, char[]) (String sample code for java.lang.String definition code for java.lang.String  alias, char[] password)
          Returns the key associated with the given alias, using the given password to recover it.
 Provider sample code for java.security.Provider definition code for java.security.Provider getProvider sample code for java.security.KeyStore.getProvider() definition code for java.security.KeyStore.getProvider() ()
          Returns the provider of this keystore.
 String sample code for java.lang.String definition code for java.lang.String getType sample code for java.security.KeyStore.getType() definition code for java.security.KeyStore.getType() ()
          Returns the type of this keystore.
 boolean isCertificateEntry sample code for java.security.KeyStore.isCertificateEntry(java.lang.String) definition code for java.security.KeyStore.isCertificateEntry(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  alias)
          Returns true if the entry identified by the given alias was created by a call to setCertificateEntry, or created by a call to setEntry with a TrustedCertificateEntry.
 boolean isKeyEntry sample code for java.security.KeyStore.isKeyEntry(java.lang.String) definition code for java.security.KeyStore.isKeyEntry(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  alias)
          Returns true if the entry identified by the given alias was created by a call to setKeyEntry, or created by a call to setEntry with a PrivateKeyEntry or a SecretKeyEntry.
 void load sample code for java.security.KeyStore.load(java.io.InputStream, char[]) definition code for java.security.KeyStore.load(java.io.InputStream, char[]) (InputStream sample code for java.io.InputStream definition code for java.io.InputStream  stream, char[] password)
          Loads this KeyStore from the given input stream.
 void load sample code for java.security.KeyStore.load(java.security.KeyStore.LoadStoreParameter) definition code for java.security.KeyStore.load(java.security.KeyStore.LoadStoreParameter) (KeyStore.LoadStoreParameter sample code for java.security.KeyStore.LoadStoreParameter definition code for java.security.KeyStore.LoadStoreParameter  param)
          Loads this keystore using the given LoadStoreParameter.
 void setCertificateEntry sample code for java.security.KeyStore.setCertificateEntry(java.lang.String, java.security.cert.Certificate) definition code for java.security.KeyStore.setCertificateEntry(java.lang.String, java.security.cert.Certificate) (String sample code for java.lang.String definition code for java.lang.String  alias, Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate  cert)
          Assigns the given trusted certificate to the given alias.
 void setEntry sample code for java.security.KeyStore.setEntry(java.lang.String, java.security.KeyStore.Entry, java.security.KeyStore.ProtectionParameter) definition code for java.security.KeyStore.setEntry(java.lang.String, java.security.KeyStore.Entry, java.security.KeyStore.ProtectionParameter) (String sample code for java.lang.String definition code for java.lang.String  alias, KeyStore.Entry sample code for java.security.KeyStore.Entry definition code for java.security.KeyStore.Entry  entry, KeyStore.ProtectionParameter sample code for java.security.KeyStore.ProtectionParameter definition code for java.security.KeyStore.ProtectionParameter  protParam)
          Saves a keystore Entry under the specified alias.
 void setKeyEntry sample code for java.security.KeyStore.setKeyEntry(java.lang.String, byte[], java.security.cert.Certificate[]) definition code for java.security.KeyStore.setKeyEntry(java.lang.String, byte[], java.security.cert.Certificate[]) (String sample code for java.lang.String definition code for java.lang.String  alias, byte[] key, Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] chain)
          Assigns the given key (that has already been protected) to the given alias.
 void setKeyEntry sample code for java.security.KeyStore.setKeyEntry(java.lang.String, java.security.Key, char[], java.security.cert.Certificate[]) definition code for java.security.KeyStore.setKeyEntry(java.lang.String, java.security.Key, char[], java.security.cert.Certificate[]) (String sample code for java.lang.String definition code for java.lang.String  alias, Key sample code for java.security.Key definition code for java.security.Key  key, char[] password, Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] chain)
          Assigns the given key to the given alias, protecting it with the given password.
 int size sample code for java.security.KeyStore.size() definition code for java.security.KeyStore.size() ()
          Retrieves the number of entries in this keystore.
 void store sample code for java.security.KeyStore.store(java.security.KeyStore.LoadStoreParameter) definition code for java.security.KeyStore.store(java.security.KeyStore.LoadStoreParameter) (KeyStore.LoadStoreParameter sample code for java.security.KeyStore.LoadStoreParameter definition code for java.security.KeyStore.LoadStoreParameter  param)
          Stores this keystore using the given LoadStoreParameter.
 void store sample code for java.security.KeyStore.store(java.io.OutputStream, char[]) definition code for java.security.KeyStore.store(java.io.OutputStream, char[]) (OutputStream sample code for java.io.OutputStream definition code for java.io.OutputStream  stream, char[] password)
          Stores this keystore to the given output stream, and protects its integrity with the given password.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

KeyStore sample code for java.security.KeyStore(java.security.KeyStoreSpi, java.security.Provider, java.lang.String) definition code for java.security.KeyStore(java.security.KeyStoreSpi, java.security.Provider, java.lang.String)

protected KeyStore(KeyStoreSpi sample code for java.security.KeyStoreSpi definition code for java.security.KeyStoreSpi  keyStoreSpi,
                   Provider sample code for java.security.Provider definition code for java.security.Provider  provider,
                   String sample code for java.lang.String definition code for java.lang.String  type)
Creates a KeyStore object of the given type, and encapsulates the given provider implementation (SPI object) in it.

Parameters:
keyStoreSpi - the provider implementation.
provider - the provider.
type - the keystore type.
Method Detail

getInstance sample code for java.security.KeyStore.getInstance(java.lang.String) definition code for java.security.KeyStore.getInstance(java.lang.String)

public static KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore  getInstance(String sample code for java.lang.String definition code for java.lang.String  type)
                            throws KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException 
Generates a keystore object of the given type.

If the default provider package provides a keystore implementation of the given type, an instance of KeyStore containing that implementation is returned. If the requested keystore type is not available in the default package, other packages are searched.

Parameters:
type - the type of keystore. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard keystore types.
Returns:
a keystore object of the specified type.
Throws:
KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException - if the requested keystore type is not available in the default provider package or any of the other provider packages that were searched.

getInstance sample code for java.security.KeyStore.getInstance(java.lang.String, java.lang.String) definition code for java.security.KeyStore.getInstance(java.lang.String, java.lang.String)

public static KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore  getInstance(String sample code for java.lang.String definition code for java.lang.String  type,
                                   String sample code for java.lang.String definition code for java.lang.String  provider)
                            throws KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException ,
                                   NoSuchProviderException sample code for java.security.NoSuchProviderException definition code for java.security.NoSuchProviderException 
Generates a keystore object for the specified keystore type from the specified provider.

Parameters:
type - the type of keystore. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard keystore types.
provider - the name of the provider.
Returns:
a keystore object of the specified type, as supplied by the specified provider.
Throws:
KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException - if the requested keystore type is not available from the provider.
NoSuchProviderException sample code for java.security.NoSuchProviderException definition code for java.security.NoSuchProviderException - if the provider has not been configured.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the provider name is null or empty.
See Also:
Provider sample code for java.security.Provider definition code for java.security.Provider

getInstance sample code for java.security.KeyStore.getInstance(java.lang.String, java.security.Provider) definition code for java.security.KeyStore.getInstance(java.lang.String, java.security.Provider)

public static KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore  getInstance(String sample code for java.lang.String definition code for java.lang.String  type,
                                   Provider sample code for java.security.Provider definition code for java.security.Provider  provider)
                            throws KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException 
Generates a keystore object for the specified keystore type from the specified provider. Note: the provider doesn't have to be registered.

Parameters:
type - the type of keystore. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard keystore types.
provider - the provider.
Returns:
a keystore object of the specified type, as supplied by the specified provider.
Throws:
KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException - if the requested keystore type is not available from the provider.
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the provider is null.
Since:
1.4
See Also:
Provider sample code for java.security.Provider definition code for java.security.Provider

getDefaultType sample code for java.security.KeyStore.getDefaultType() definition code for java.security.KeyStore.getDefaultType()

public static final String sample code for java.lang.String definition code for java.lang.String  getDefaultType()
Returns the default keystore type as specified in the Java security properties file, or the string "jks" (acronym for "Java keystore") if no such property exists. The Java security properties file is located in the file named <JAVA_HOME>/lib/security/java.security, where <JAVA_HOME> refers to the directory where the JDK was installed.

The default keystore type can be used by applications that do not want to use a hard-coded keystore type when calling one of the getInstance methods, and want to provide a default keystore type in case a user does not specify its own.

The default keystore type can be changed by setting the value of the "keystore.type" security property (in the Java security properties file) to the desired keystore type.

Returns:
the default keystore type as specified in the Java security properties file, or the string "jks" if no such property exists.

getProvider sample code for java.security.KeyStore.getProvider() definition code for java.security.KeyStore.getProvider()

public final Provider sample code for java.security.Provider definition code for java.security.Provider  getProvider()
Returns the provider of this keystore.

Returns:
the provider of this keystore.

getType sample code for java.security.KeyStore.getType() definition code for java.security.KeyStore.getType()

public final String sample code for java.lang.String definition code for java.lang.String  getType()
Returns the type of this keystore.

Returns:
the type of this keystore.

getKey sample code for java.security.KeyStore.getKey(java.lang.String, char[]) definition code for java.security.KeyStore.getKey(java.lang.String, char[])

public final Key sample code for java.security.Key definition code for java.security.Key  getKey(String sample code for java.lang.String definition code for java.lang.String  alias,
                        char[] password)
                 throws KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException ,
                        NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException ,
                        UnrecoverableKeyException sample code for java.security.UnrecoverableKeyException definition code for java.security.UnrecoverableKeyException 
Returns the key associated with the given alias, using the given password to recover it. The key must have been associated with the alias by a call to setKeyEntry, or by a call to setEntry with a PrivateKeyEntry or SecretKeyEntry.

Parameters:
alias - the alias name
password - the password for recovering the key
Returns:
the requested key, or null if the given alias does not exist or does not identify a key-related entry.
Throws:
KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException - if the keystore has not been initialized (loaded).
NoSuchAlgorithmException sample code for java.security.NoSuchAlgorithmException definition code for java.security.NoSuchAlgorithmException - if the algorithm for recovering the key cannot be found
UnrecoverableKeyException sample code for java.security.UnrecoverableKeyException definition code for java.security.UnrecoverableKeyException - if the key cannot be recovered (e.g., the given password is wrong).

getCertificateChain sample code for java.security.KeyStore.getCertificateChain(java.lang.String) definition code for java.security.KeyStore.getCertificateChain(java.lang.String)

public final Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] getCertificateChain(String sample code for java.lang.String definition code for java.lang.String  alias)
                                        throws KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException 
Returns the certificate chain associated with the given alias. The certificate chain must have been associated with the alias by a call to setKeyEntry, or by a call to setEntry with a PrivateKeyEntry.

Parameters:
alias - the alias name
Returns:
the certificate chain (ordered with the user's certificate first and the root certificate authority last), or null if the given alias does not exist or does not contain a certificate chain
Throws:
KeyStoreException sample code for java.security.KeyStoreException definition code for java.security.KeyStoreException - if the keystore has not been initialized (loaded).

getCertificate sample code for java.security.KeyStore.getCertificate(java.lang.String) definition code for java.security.KeyStore.getCertificate(java.lang.String)