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

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

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

CertPath.getType介绍

[英]Returns the type of Certificate in this instance.
[中]返回此实例中的证书类型。

代码示例

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

/**
 * Overrides {@code Object.hashCode()}. The function is defined as follows:
 * <pre>
 * {@code hashCode = 31 * path.getType().hashCode() +
 * path.getCertificates().hashCode();}
 * </pre>
 *
 * @return the hash code for this instance.
 */
public int hashCode() {
  int hash = getType().hashCode();
  hash = hash*31 + getCertificates().hashCode();
  return hash;
}

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

/**
 * Returns {@code true} if {@code Certificate}s in the list are the same
 * type and the lists are equal (and by implication the certificates
 * contained within are the same).
 *
 * @param other
 *            {@code CertPath} to be compared for equality.
 * @return {@code true} if the object are equal, {@code false} otherwise.
 */
public boolean equals(Object other) {
  if (this == other) {
    return true;
  }
  if (other instanceof CertPath) {
    CertPath o = (CertPath)other;
    if (getType().equals(o.getType())) {
      if (getCertificates().equals(o.getCertificates())) {
        return true;
      }
    }
  }
  return false;
}

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

/**
 * Returns an alternate object to be serialized.
 *
 * @return an alternate object to be serialized.
 * @throws ObjectStreamException
 *             if the creation of the alternate object fails.
 */
protected Object writeReplace() throws ObjectStreamException {
  try {
    return new CertPathRep(getType(), getEncoded());
  } catch (CertificateEncodingException e) {
    throw new NotSerializableException("Could not create serialization object: " + e);
  }
}

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

/**
 * Returns a {@code String} representation of this {@code CertPath}
 * instance. It is the result of calling {@code toString} on all {@code
 * Certificate}s in the {@code List}.
 *
 * @return a string representation of this instance.
 */
public String toString() {
  StringBuilder sb = new StringBuilder(getType());
  sb.append(" Cert Path, len=");
  sb.append(getCertificates().size());
  sb.append(": [\n");
  int n=1;
  for (Iterator<? extends Certificate> i=getCertificates().iterator(); i.hasNext(); n++) {
    sb.append("---------------certificate ");
    sb.append(n);
    sb.append("---------------\n");
    sb.append(((Certificate)i.next()).toString());
  }
  sb.append("\n]");
  return sb.toString();
}

代码示例来源:origin: dCache/dcache

public static boolean isX509CertPath(Object credential)
{
  return credential instanceof CertPath && ((CertPath) credential).getType().equals(CertificateFactories.X_509);
}

代码示例来源:origin: dCache/dcache

public static X509Certificate[] getX509Certificates(CertPath certPath)
{
  Preconditions.checkArgument(certPath.getType().equals(CertificateFactories.X_509));
  List<X509Certificate> certificates = (List<X509Certificate>) certPath.getCertificates();
  return certificates.toArray(new X509Certificate[certificates.size()]);
}

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

/**
 * Overrides {@code Object.hashCode()}. The function is defined as follows:
 * <pre>
 * {@code hashCode = 31 * path.getType().hashCode() +
 * path.getCertificates().hashCode();}
 * </pre>
 *
 * @return the hash code for this instance.
 */
public int hashCode() {
  int hash = getType().hashCode();
  hash = hash*31 + getCertificates().hashCode();
  return hash;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Overrides {@code Object.hashCode()}. The function is defined as follows:
 * <pre>
 * {@code hashCode = 31 * path.getType().hashCode() +
 * path.getCertificates().hashCode();}
 * </pre>
 *
 * @return the hash code for this instance.
 */
public int hashCode() {
  int hash = getType().hashCode();
  hash = hash*31 + getCertificates().hashCode();
  return hash;
}

代码示例来源:origin: ibinti/bugvm

/**
 * Overrides {@code Object.hashCode()}. The function is defined as follows:
 * <pre>
 * {@code hashCode = 31 * path.getType().hashCode() +
 * path.getCertificates().hashCode();}
 * </pre>
 *
 * @return the hash code for this instance.
 */
public int hashCode() {
  int hash = getType().hashCode();
  hash = hash*31 + getCertificates().hashCode();
  return hash;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Overrides {@code Object.hashCode()}. The function is defined as follows:
 * <pre>
 * {@code hashCode = 31 * path.getType().hashCode() +
 * path.getCertificates().hashCode();}
 * </pre>
 *
 * @return the hash code for this instance.
 */
public int hashCode() {
  int hash = getType().hashCode();
  hash = hash*31 + getCertificates().hashCode();
  return hash;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Overrides {@code Object.hashCode()}. The function is defined as follows:
 * <pre>
 * {@code hashCode = 31 * path.getType().hashCode() +
 * path.getCertificates().hashCode();}
 * </pre>
 *
 * @return the hash code for this instance.
 */
public int hashCode() {
  int hash = getType().hashCode();
  hash = hash*31 + getCertificates().hashCode();
  return hash;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Overrides {@code Object.hashCode()}. The function is defined as follows:
 * <pre>
 * {@code hashCode = 31 * path.getType().hashCode() +
 * path.getCertificates().hashCode();}
 * </pre>
 *
 * @return the hash code for this instance.
 */
public int hashCode() {
  int hash = getType().hashCode();
  hash = hash*31 + getCertificates().hashCode();
  return hash;
}

代码示例来源:origin: au.net.zeus.jgdms/jgdms-rmi-tls

/**
 * Determines if the argument is an X.509 certificate CertPath.  Returns
 * true if the argument is a non-null CertPath, has at least one
 * certificate, and has type X.509.
 */
protected static boolean isX509CertificateChain(Object credential) {
if (!(credential instanceof CertPath)) {
  return false;
}
CertPath certPath = (CertPath) credential;
if (certPath.getCertificates().isEmpty()) {
  return false;
} else if (!certPath.getType().equals("X.509")) {
  return false;
}
return true;
}

代码示例来源:origin: eclipse/californium

/**
 * Creates a new instance for a certificate chain.
 * 
 * @param certPath The certificate chain asserting the peer's identity.
 * @throws IllegalArgumentException if the given certificate chain is empty or does not contain
 *                                  X.509 certificates only.
 */
public X509CertPath(final CertPath certPath) {
  if (!TYPE_X509.equals(certPath.getType())) {
    throw new IllegalArgumentException("Cert path must contain X.509 certificates only");
  } else if (certPath.getCertificates().isEmpty()) {
    throw new IllegalArgumentException("Cert path must not be empty");
  } else {
    this.path = certPath;
    this.target = (X509Certificate) certPath.getCertificates().get(0);
  }
}

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

/**
 * Returns an alternate object to be serialized.
 *
 * @return an alternate object to be serialized.
 * @throws ObjectStreamException
 *             if the creation of the alternate object fails.
 */
protected Object writeReplace() throws ObjectStreamException {
  try {
    return new CertPathRep(getType(), getEncoded());
  } catch (CertificateEncodingException e) {
    throw new NotSerializableException("Could not create serialization object: " + e);
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Returns an alternate object to be serialized.
 *
 * @return an alternate object to be serialized.
 * @throws ObjectStreamException
 *             if the creation of the alternate object fails.
 */
protected Object writeReplace() throws ObjectStreamException {
  try {
    return new CertPathRep(getType(), getEncoded());
  } catch (CertificateEncodingException e) {
    throw new NotSerializableException("Could not create serialization object: " + e);
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns an alternate object to be serialized.
 *
 * @return an alternate object to be serialized.
 * @throws ObjectStreamException
 *             if the creation of the alternate object fails.
 */
protected Object writeReplace() throws ObjectStreamException {
  try {
    return new CertPathRep(getType(), getEncoded());
  } catch (CertificateEncodingException e) {
    throw new NotSerializableException("Could not create serialization object: " + e);
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Returns an alternate object to be serialized.
 *
 * @return an alternate object to be serialized.
 * @throws ObjectStreamException
 *             if the creation of the alternate object fails.
 */
protected Object writeReplace() throws ObjectStreamException {
  try {
    return new CertPathRep(getType(), getEncoded());
  } catch (CertificateEncodingException e) {
    throw new NotSerializableException("Could not create serialization object: " + e);
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Returns an alternate object to be serialized.
 *
 * @return an alternate object to be serialized.
 * @throws ObjectStreamException
 *             if the creation of the alternate object fails.
 */
protected Object writeReplace() throws ObjectStreamException {
  try {
    return new CertPathRep(getType(), getEncoded());
  } catch (CertificateEncodingException e) {
    throw new NotSerializableException("Could not create serialization object: " + e);
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Returns an alternate object to be serialized.
 *
 * @return an alternate object to be serialized.
 * @throws ObjectStreamException
 *             if the creation of the alternate object fails.
 */
protected Object writeReplace() throws ObjectStreamException {
  try {
    return new CertPathRep(getType(), getEncoded());
  } catch (CertificateEncodingException e) {
    throw new NotSerializableException("Could not create serialization object: " + e);
  }
}

相关文章