/** * Returns the number of entries stored in this {@code KeyStore}. * * @return the number of entries stored in this {@code KeyStore}. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final int size() throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineSize(); }
/** * Indicates whether the given alias is present in this {@code KeyStore}. * * @param alias * the alias of an entry. * @return {@code true} if the alias exists, {@code false} otherwise. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final boolean containsAlias(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineContainsAlias(alias); }
/** * Returns an {@code Enumeration} over all alias names stored in this * {@code KeyStore}. * * @return an {@code Enumeration} over all alias names stored in this * {@code KeyStore}. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final Enumeration<String> aliases() throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineAliases(); }
/** * Deletes the entry identified with the given alias from this {@code * KeyStore}. * * @param alias * the alias for the entry. * @throws KeyStoreException * if this {@code KeyStore} is not initialized, or if the entry * can not be deleted. */ public final void deleteEntry(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } implSpi.engineDeleteEntry(alias); }
/** * Returns the trusted certificate for the entry with the given alias. * * @param alias * the alias for the entry. * @return the trusted certificate for the entry with the given alias, or * {@code null} if the specified alias is not bound to an entry. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final Certificate getCertificate(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineGetCertificate(alias); }
/** * Indicates whether the specified alias is associated with either a * {@link PrivateKeyEntry} or a {@link SecretKeyEntry}. * * @param alias * the alias of an entry. * @return {@code true} if the given alias is associated with a key entry. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final boolean isKeyEntry(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineIsKeyEntry(alias); }
/** * Returns the creation date of the entry with the given alias. * * @param alias * the alias for the entry. * @return the creation date, or {@code null} if the specified alias is not * bound to an entry. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final Date getCreationDate(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineGetCreationDate(alias); }
/** * Returns the certificate chain for the entry with the given alias. * * @param alias * the alias for the entry. * @return the certificate chain for the entry with the given alias, or * {@code null} if the specified alias is not bound to an entry. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final Certificate[] getCertificateChain(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineGetCertificateChain(alias); }
/** * Indicates whether the specified alias is associated with a * {@link TrustedCertificateEntry}. * * @param alias * the alias of an entry. * @return {@code true} if the given alias is associated with a certificate * entry. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final boolean isCertificateEntry(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineIsCertificateEntry(alias); }
/** * Returns the alias associated with the first entry whose certificate * matches the specified certificate. * * @param cert * the certificate to find the associated entry's alias for. * @return the alias or {@code null} if no entry with the specified * certificate can be found. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final String getCertificateAlias(Certificate cert) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineGetCertificateAlias(cert); }
/** * Associates the given alias with a certificate. * <p> * If the specified alias already exists, it will be reassigned. * * @param alias * the alias for the certificate. * @param cert * the certificate. * @throws KeyStoreException * if this {@code KeyStore} is not initialized, or an existing * alias is not associated to an entry containing a trusted * certificate, or this method fails for any other reason. * @throws NullPointerException * if {@code alias} is {@code null}. */ public final void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } implSpi.engineSetCertificateEntry(alias, cert); }
/** * Returns the key with the given alias, using the password to recover the * key from the store. * * @param alias * the alias for the entry. * @param password * the password used to recover the key. * @return the key with the specified alias, or {@code null} if the * specified alias is not bound to an entry. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. * @throws NoSuchAlgorithmException * if the algorithm for recovering the key is not available. * @throws UnrecoverableKeyException * if the key can not be recovered. */ public final Key getKey(String alias, char[] password) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { if (!isInit) { throwNotInitialized(); } return implSpi.engineGetKey(alias, password); }
/** * Stores this {@code KeyStore} using the specified {@code * LoadStoreParameter}. * * @param param * the {@code LoadStoreParameter} that specifies how to store * this {@code KeyStore}, maybe {@code null}. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. * @throws IOException * if a problem occurred while writing to the stream. * @throws NoSuchAlgorithmException * if the required algorithm is not available. * @throws CertificateException * if an exception occurred while storing the certificates of * this {@code KeyStore}. * @throws IllegalArgumentException * if the given {@link LoadStoreParameter} is not recognized. */ public final void store(LoadStoreParameter param) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException { if (!isInit) { throwNotInitialized(); } implSpi.engineStore(param); }
/** * Writes this {@code KeyStore} to the specified {@code OutputStream}. The * data written to the {@code OutputStream} is protected by the specified * password. * * @param stream * the {@code OutputStream} to write the store's data to. * @param password * the password to protect the data. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. * @throws IOException * if a problem occurred while writing to the stream. * @throws NoSuchAlgorithmException * if the required algorithm is not available. * @throws CertificateException * if an exception occurred while storing the certificates of * this {@code KeyStore}. */ public final void store(OutputStream stream, char[] password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException { if (!isInit) { throwNotInitialized(); } //Just delegate stream and password to implSpi implSpi.engineStore(stream, password); }
/** * Indicates whether the entry for the given alias is assignable to the * provided {@code Class}. * * @param alias * the alias for the entry. * @param entryClass * the type of the entry. * @return {@code true} if the {@code Entry} for the alias is assignable to * the specified {@code entryClass}. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final boolean entryInstanceOf(String alias, Class<? extends KeyStore.Entry> entryClass) throws KeyStoreException { if (alias == null) { throw new NullPointerException("alias == null"); } if (entryClass == null) { throw new NullPointerException("entryClass == null"); } if (!isInit) { throwNotInitialized(); } return implSpi.engineEntryInstanceOf(alias, entryClass); }
/** * Returns the {@code Entry} with the given alias, using the specified * {@code ProtectionParameter}. * * @param alias * the alias of the requested entry. * @param param * the {@code ProtectionParameter} used to protect the requested * entry, maybe {@code null}. * @return he {@code Entry} with the given alias, using the specified * {@code ProtectionParameter}. * @throws NoSuchAlgorithmException * if the required algorithm is not available. * @throws UnrecoverableEntryException * if the entry can not be recovered. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. * @throws NullPointerException * if {@code alias} is {@code null}. */ public final Entry getEntry(String alias, ProtectionParameter param) throws NoSuchAlgorithmException, UnrecoverableEntryException, KeyStoreException { if (alias == null) { throw new NullPointerException("alias == null"); } if (!isInit) { throwNotInitialized(); } return implSpi.engineGetEntry(alias, param); }
throws KeyStoreException { if (!isInit) { throwNotInitialized();
ProtectionParameter param) throws KeyStoreException { if (!isInit) { throwNotInitialized();
Certificate[] chain) throws KeyStoreException { if (!isInit) { throwNotInitialized();
/** * Returns the number of entries stored in this {@code KeyStore}. * * @return the number of entries stored in this {@code KeyStore}. * @throws KeyStoreException * if this {@code KeyStore} is not initialized. */ public final int size() throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineSize(); }