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

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

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

KeyStore.getCertificateAlias介绍

[英]Returns the alias associated with the first entry whose certificate matches the specified certificate.
[中]返回与证书与指定证书匹配的第一个条目关联的别名。

代码示例

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

public String engineGetCertificateAlias(final Certificate cert) {
  try {
    return delegate.getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    return null;
  }
}

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

@Override
public String engineGetCertificateAlias(Certificate cert) {
  try {
    return getKeyStore().getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: igniterealtime/Openfire

if ( store.getCertificateAlias( first ) != null )

代码示例来源:origin: org.eclipse.jetty/jetty-util

certAlias = keyStore.getCertificateAlias((X509Certificate)cert);
if (certAlias == null)

代码示例来源:origin: fabric8io/kubernetes-client

private void verifyFabric8InStore(KeyStore trustStore)
 throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException {
 Certificate certificate = trustStore.getCertificate("fabric8-in-store");
 assertNotNull(certificate);
 InputStream certificateFile = CertUtils.getInputStreamFromDataOrFile(null, "src/test/resources/ssl/fabric8.crt");
 KeyStore storeWithCert = CertUtils.createTrustStore(certificateFile, null, "".toCharArray());
 String certificateAlias = storeWithCert.getCertificateAlias(certificate);
 assertNotNull(certificateAlias);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

public String engineGetCertificateAlias(final Certificate cert) {
  try {
    return delegate.getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    return null;
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-credential

public String engineGetCertificateAlias(final Certificate cert) {
  try {
    return delegate.getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    return null;
  }
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public String engineGetCertificateAlias(final Certificate cert) {
  try {
    return delegate.getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    return null;
  }
}

代码示例来源:origin: nu.zoom/portunis

public String getCertificateAlias(Certificate cert)
    throws KeyStoreException
{
  return store.getCertificateAlias(cert);
}

代码示例来源:origin: at.researchstudio.sat/won-core

@Override
public String getCertificateAlias(Certificate cert) {
  String retrieved = null;
  try {
    retrieved = store.getCertificateAlias(cert);
  } catch (Exception e) {
    logger.warn("No alias found for certificate", e);
  }
  return retrieved;
}

代码示例来源:origin: apache/karaf

public String getCertificateAlias(Certificate cert) {
  if (!loadKeystoreData()) {
    return null;
  }
  try {
    return keystore.getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    logger.error("Unable to read retrieve alias for given certificate from keystore", e);
  }
  return null;
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

@Override
public String engineGetCertificateAlias(Certificate cert) {
  try {
    return getKeyStore().getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: org.apache.directory.studio/connection.core

private void removeFromKeyStore( X509Certificate certificate, KeyStore keyStore ) throws Exception
  {
    String alias = keyStore.getCertificateAlias( certificate );
    if ( alias != null )
    {
      keyStore.deleteEntry( alias );
    }
  }
}

代码示例来源:origin: at.researchstudio.sat/won-core

@Override
public String getCertificateAlias(Certificate cert) {
  String retrieved = null;
  try {
    retrieved = getUnderlyingKeyStore().getCertificateAlias(cert);
  } catch (Exception e) {
    logger.warn("No alias found for certificate", e);
  }
  return retrieved;
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

@Override
public String engineGetCertificateAlias(Certificate cert) {
  try {
    return getKeyStore().getCertificateAlias(cert);
  } catch (KeyStoreException e) {
    throw new IllegalStateException(e);
  }
}

代码示例来源:origin: nextcloud/android-library

public boolean isKnownServer(X509Certificate cert) {
  try {
    return (mKnownServersKeyStore.getCertificateAlias(cert) != null);
  } catch (KeyStoreException e) {
    Log_OC.d(TAG, "Fail while checking certificate in the known-servers store");
    return false;
  }
}

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.relyingparty

private static boolean isInKeyStore(X509Certificate signedCert, KeyStore keyStore) throws RelyingPartyException {
  if (signedCert == null || keyStore == null) {
    throw new RelyingPartyException("invalidInputParams");
  }
  // validity period
  try {
    signedCert.checkValidity();
    return keyStore.getCertificateAlias(signedCert) != null;
  } catch (CertificateExpiredException | CertificateNotYetValidException | KeyStoreException e) {
    throw new RelyingPartyException("Error while loading trusted key store", e);
  }
}

代码示例来源:origin: apache/cxf

public static PrivateKey loadPrivateKey(Message m, Properties props,
                    X509Certificate inCert,
                    KeyOperation keyOper) {
  KeyStore ks = loadPersistKeyStore(m, props);
  try {
    String alias = ks.getCertificateAlias(inCert);
    return loadPrivateKey(ks, m, props, keyOper, alias);
  } catch (Exception ex) {
    LOG.warning("Private key can not be loaded");
    throw new JoseException(ex);
  }
}

代码示例来源:origin: org.apache.geronimo.modules/geronimo-security

public String getCertificateAlias(Certificate cert, char[] storePassword) throws KeystoreException {
  ensureLoaded(storePassword);
  try {
    String alias = keystore.getCertificateAlias(cert);
    if (alias == null) {
      throw new KeyNotFoundException("Keystore '"+keystoreName+"' does not contain an alias corresponding to the given certificate.");
    }
    return alias;
  } catch (KeyStoreException e) {
    throw new KeystoreException("Unable to read certificate alias from keystore", e);
  }
}

代码示例来源:origin: org.n52.security/52n-security-core

@Override
public KeyPair resolveByCertificate(final Certificate cert, final char[] password)
    throws KeyPairResolvingException {
  try {
    // todo : check semantic
    String alias = getKeyStore().getCertificateAlias(cert);
    return resolveByAlias(alias, password);
  } catch (KeyStoreException e) {
    throw new KeyPairResolvingException("Certificate not found in keystore", e);
  }
}

相关文章