java.security.KeyStore.throwNotInitialized()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中java.security.KeyStore.throwNotInitialized()方法的一些代码示例,展示了KeyStore.throwNotInitialized()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyStore.throwNotInitialized()方法的具体详情如下:
包路径:java.security.KeyStore
类名称:KeyStore
方法名:throwNotInitialized

KeyStore.throwNotInitialized介绍

[英]Throws the standard "keystore not initialized" exception.
[中]引发标准的“密钥库未初始化”异常。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * 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();
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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();
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

/**
 * 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);
}

代码示例来源:origin: robovm/robovm

throws KeyStoreException {
if (!isInit) {
  throwNotInitialized();

代码示例来源:origin: robovm/robovm

ProtectionParameter param) throws KeyStoreException {
if (!isInit) {
  throwNotInitialized();

代码示例来源:origin: robovm/robovm

Certificate[] chain) throws KeyStoreException {
if (!isInit) {
  throwNotInitialized();

代码示例来源:origin: MobiVM/robovm

/**
 * 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();
}

相关文章