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

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

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

CertPath.getCertificates介绍

[英]Returns an immutable List of the Certificates contained in the CertPath.
[中]返回CertPath中包含的证书的不可变列表。

代码示例

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

/**
   * Returns a string containing a concise, human-readable description of this
   * {@code Timestamp}.
   *
   * @return a printable representation for this {@code Timestamp}.
   */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    // Dump only the first certificate
    buf.append("Timestamp [").append(timestamp).append(" certPath=");
    buf.append(signerCertPath.getCertificates().get(0)).append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of the
   * this {@code CodeSigner} including its first certificate and its time
   * stamp, if present.
   *
   * @return a printable representation for this {@code CodeSigner}.
   */
  @Override
  public String toString() {
    // There is no any special reason for '256' here, it's taken abruptly
    StringBuilder buf = new StringBuilder(256);
    // The javadoc says nothing, and the others implementations behavior seems as
    // dumping only the first certificate. Well, let's do the same.
    buf.append("CodeSigner [").append(signerCertPath.getCertificates().get(0));
    if( timestamp != null ) {
      buf.append("; ").append(timestamp);
    }
    buf.append("]");
    return buf.toString();
  }
}

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

pathValidator.validate( cp, params );
return (X509Certificate) cp.getCertificates().get( 0 );

代码示例来源:origin: net.jxta/jxta-jxse

/**
 * Returns the certificate associated with this credential.
 *
 * @return the certificate associated with this credential.
 */
public X509Certificate getCertificate() {
  return (X509Certificate) certs.getCertificates().get(0);
}

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

/**
 * Returns the first X509Certificate from a CertPath known to contain them.
 */
static X509Certificate firstX509Cert(CertPath certPath) {
return (X509Certificate) certPath.getCertificates().get(0);
}

代码示例来源:origin: net.jxta/jxta-jxse

/**
 * {@inheritDoc}
 */
public Object getSubject() {
  return ((X509Certificate) certs.getCertificates().get(0)).getSubjectDN();
}

代码示例来源:origin: net.jxta/jxta-jxse

/**
 * {@inheritDoc}
 * <p/>
 * A PSE Credential is valid as long as the associated certificate is
 * valid.
 */
public boolean isExpired() {
  try {
    ((X509Certificate) certs.getCertificates().get(0)).checkValidity();
    return false;
  } catch (CertificateExpiredException expired) {
    return true;
  } catch (CertificateNotYetValidException notyet) {
    return true;
  }
}

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

/**
 * Returns the latest time for which all of the X.509 certificates in the
 * certificate chain are valid.
 */
static long certificatesValidUntil(CertPath chain) {
long result = Long.MAX_VALUE;
List<? extends Certificate> certs = chain.getCertificates();
for (int i = certs.size(); --i >= 0;) {
  X509Certificate cert = (X509Certificate) certs.get(i);
  long until = cert.getNotAfter().getTime();
  if (until < result) {
  result = until;
  }
}
return result;
}

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

/**
   * Returns a string containing a concise, human-readable description of this
   * {@code Timestamp}.
   *
   * @return a printable representation for this {@code Timestamp}.
   */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    // Dump only the first certificate
    buf.append("Timestamp [").append(timestamp).append(" certPath=");
    buf.append(signerCertPath.getCertificates().get(0)).append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of this
   * {@code Timestamp}.
   *
   * @return a printable representation for this {@code Timestamp}.
   */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    // Dump only the first certificate
    buf.append("Timestamp [").append(timestamp).append(" certPath=");
    buf.append(signerCertPath.getCertificates().get(0)).append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of this
   * {@code Timestamp}.
   *
   * @return a printable representation for this {@code Timestamp}.
   */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    // Dump only the first certificate
    buf.append("Timestamp [").append(timestamp).append(" certPath=");
    buf.append(signerCertPath.getCertificates().get(0)).append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of this
   * {@code Timestamp}.
   *
   * @return a printable representation for this {@code Timestamp}.
   */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    // Dump only the first certificate
    buf.append("Timestamp [").append(timestamp).append(" certPath=");
    buf.append(signerCertPath.getCertificates().get(0)).append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of this
   * {@code Timestamp}.
   *
   * @return a printable representation for this {@code Timestamp}.
   */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    // Dump only the first certificate
    buf.append("Timestamp [").append(timestamp).append(" certPath=");
    buf.append(signerCertPath.getCertificates().get(0)).append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of this
   * {@code Timestamp}.
   *
   * @return a printable representation for this {@code Timestamp}.
   */
  @Override
  public String toString() {
    StringBuilder buf = new StringBuilder(256);
    // Dump only the first certificate
    buf.append("Timestamp [").append(timestamp).append(" certPath=");
    buf.append(signerCertPath.getCertificates().get(0)).append("]");
    return buf.toString();
  }
}

代码示例来源: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: net.jxta/jxta-jxse

/**
 * /**
 * Get a Signature verifier object based upon the certificate associated
 * with this credential.
 *
 * @param algorithm the signing algorithm to use.
 * @return Signature.
 */
public Signature getSignatureVerifier(String algorithm) throws NoSuchAlgorithmException {
  Signature verify = Signature.getInstance(algorithm);
  try {
    verify.initVerify((X509Certificate) certs.getCertificates().get(0));
  } catch (java.security.InvalidKeyException failed) {
    IllegalStateException failure = new IllegalStateException("Invalid certificate");
    failure.initCause(failed);
    throw failure;
  }
  return verify;
}

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

/**
   * Returns a string containing a concise, human-readable description of the
   * this {@code CodeSigner} including its first certificate and its time
   * stamp, if present.
   *
   * @return a printable representation for this {@code CodeSigner}.
   */
  @Override
  public String toString() {
    // There is no any special reason for '256' here, it's taken abruptly
    StringBuilder buf = new StringBuilder(256);
    // The javadoc says nothing, and the others implementations behavior seems as
    // dumping only the first certificate. Well, let's do the same.
    buf.append("CodeSigner [").append(signerCertPath.getCertificates().get(0));
    if( timestamp != null ) {
      buf.append("; ").append(timestamp);
    }
    buf.append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of the
   * this {@code CodeSigner} including its first certificate and its time
   * stamp, if present.
   *
   * @return a printable representation for this {@code CodeSigner}.
   */
  @Override
  public String toString() {
    // There is no any special reason for '256' here, it's taken abruptly
    StringBuilder buf = new StringBuilder(256);
    // The javadoc says nothing, and the others implementations behavior seems as
    // dumping only the first certificate. Well, let's do the same.
    buf.append("CodeSigner [").append(signerCertPath.getCertificates().get(0));
    if( timestamp != null ) {
      buf.append("; ").append(timestamp);
    }
    buf.append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of the
   * this {@code CodeSigner} including its first certificate and its time
   * stamp, if present.
   *
   * @return a printable representation for this {@code CodeSigner}.
   */
  @Override
  public String toString() {
    // There is no any special reason for '256' here, it's taken abruptly
    StringBuilder buf = new StringBuilder(256);
    // The javadoc says nothing, and the others implementations behavior seems as
    // dumping only the first certificate. Well, let's do the same.
    buf.append("CodeSigner [").append(signerCertPath.getCertificates().get(0));
    if( timestamp != null ) {
      buf.append("; ").append(timestamp);
    }
    buf.append("]");
    return buf.toString();
  }
}

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

/**
   * Returns a string containing a concise, human-readable description of the
   * this {@code CodeSigner} including its first certificate and its time
   * stamp, if present.
   *
   * @return a printable representation for this {@code CodeSigner}.
   */
  @Override
  public String toString() {
    // There is no any special reason for '256' here, it's taken abruptly
    StringBuilder buf = new StringBuilder(256);
    // The javadoc says nothing, and the others implementations behavior seems as
    // dumping only the first certificate. Well, let's do the same.
    buf.append("CodeSigner [").append(signerCertPath.getCertificates().get(0));
    if( timestamp != null ) {
      buf.append("; ").append(timestamp);
    }
    buf.append("]");
    return buf.toString();
  }
}

相关文章