java.security.cert.Certificate.hashCode()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(124)

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

Certificate.hashCode介绍

[英]Returns an integer hash code for the certificate. Any two objects which return true when passed to equals must return the same value for this method.
[中]返回证书的整数哈希代码。当传递给equals时返回true的任何两个对象都必须为此方法返回相同的值。

代码示例

代码示例来源:origin: hyperledger/fabric-sdk-java

private void addCACertificateToTrustStore(Certificate certificate) throws InvalidArgumentException, CryptoException {
  String alias;
  if (certificate instanceof X509Certificate) {
    alias = ((X509Certificate) certificate).getSerialNumber().toString();
  } else { // not likely ...
    alias = Integer.toString(certificate.hashCode());
  }
  addCACertificateToTrustStore(certificate, alias);
}

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

/**
 * {@inheritDoc}
 */
@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((_certificate == null) ? 0 : _certificate.hashCode());
  return result;
}

代码示例来源:origin: jboss-switchyard/core

/**
 * {@inheritDoc}
 */
@Override
public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + ((_certificate == null) ? 0 : _certificate.hashCode());
  return result;
}

代码示例来源:origin: org.eclipse.tycho/org.eclipse.osgi

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.osgi

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: com.github.veithen.cosmos/cosmos-equinox

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: org.eclipse/org.eclipse.osgi

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.osgi

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.osgi

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: org.eclipse/osgi

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.osgi

public int hashCode() {
  int result = mdAlgorithm.hashCode();
  for (int i = 0; i < chain.length; i++)
    result += chain[i].hashCode();
  // Note that we do not hash based on trustAnchor;
  // this changes dynamically but we need a constant hashCode for purposes of 
  // hashing in a Set.
  return result;
}

代码示例来源:origin: org.hyperledger.fabric-sdk-java/fabric-sdk-java

private void addCACertificateToTrustStore(Certificate certificate) throws InvalidArgumentException, CryptoException {
  String alias;
  if (certificate instanceof X509Certificate) {
    alias = ((X509Certificate) certificate).getSerialNumber().toString();
  } else { // not likely ...
    alias = Integer.toString(certificate.hashCode());
  }
  addCACertificateToTrustStore(certificate, alias);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

private void addCACertificateToTrustStore(Certificate certificate) throws InvalidArgumentException, CryptoException {
  String alias;
  if (certificate instanceof X509Certificate) {
    alias = ((X509Certificate) certificate).getSerialNumber().toString();
  } else { // not likely ...
    alias = Integer.toString(certificate.hashCode());
  }
  addCACertificateToTrustStore(certificate, alias);
}

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

public static boolean isCertInKnownServersStore(Certificate cert, Context context) 
    throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
  
  KeyStore knownServers = getKnownServersStore(context);
  Log_OC.d(TAG, "Certificate - HashCode: " + cert.hashCode() + " "
      + Boolean.toString(knownServers.isCertificateEntry(Integer.toString(cert.hashCode()))));
  return knownServers.isCertificateEntry(Integer.toString(cert.hashCode()));
}

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

public static void addCertToKnownServersStore(Certificate cert, Context context) 
    throws  KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
  
  KeyStore knownServers = getKnownServersStore(context);
  knownServers.setCertificateEntry(Integer.toString(cert.hashCode()), cert);
  FileOutputStream fos = null;
  try {
    fos = context.openFileOutput(LOCAL_TRUSTSTORE_FILENAME, Context.MODE_PRIVATE);
    knownServers.store(fos, LOCAL_TRUSTSTORE_PASSWORD.toCharArray());
  } finally {
    fos.close();
  }
}

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

public static boolean isCertInKnownServersStore(Certificate cert, Context context) 
    throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
  
  KeyStore knownServers = getKnownServersStore(context);
  Log_OC.d(TAG, "Certificate - HashCode: " + cert.hashCode() + " "
      + Boolean.toString(knownServers.isCertificateEntry(Integer.toString(cert.hashCode()))));
  return knownServers.isCertificateEntry(Integer.toString(cert.hashCode()));
}

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

public static void addCertToKnownServersStore(Certificate cert, Context context) 
    throws  KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
  
  KeyStore knownServers = getKnownServersStore(context);
  knownServers.setCertificateEntry(Integer.toString(cert.hashCode()), cert);
  FileOutputStream fos = null;
  try {
    fos = context.openFileOutput(LOCAL_TRUSTSTORE_FILENAME, Context.MODE_PRIVATE);
    knownServers.store(fos, LOCAL_TRUSTSTORE_PASSWORD.toCharArray());
  } finally {
    fos.close();
  }
}

代码示例来源:origin: net.exogeni.orca.core/shirako

for(Certificate cert : certs){
  System.out.println("Cert Type : " + cert.getType());
  System.out.println("Cert Hash Code : " + cert.hashCode());
  System.out.println("Cert Public Key Algorithm : " 
                + cert.getPublicKey().getAlgorithm());

代码示例来源:origin: org.symphonyoss.symphony/jcurl

System.err.println("*      Hash Code     : " + cert.hashCode());
System.err.println("*      PubKey Algo   : " + cert.getPublicKey().getAlgorithm());
System.err.println("*      PubKey Format : " + cert.getPublicKey().getFormat());

代码示例来源:origin: stackoverflow.com

for(Certificate cert : certs){
  System.out.println("Cert Type : " + cert.getType());
  System.out.println("Cert Hash Code : " + cert.hashCode());
  System.out.println("Cert Public Key Algorithm : " + cert.getPublicKey().getAlgorithm());
  System.out.println("Cert Public Key Format : " + cert.getPublicKey().getFormat());

相关文章