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

x33g5p2x  于2022-02-02 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(175)

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

X509Certificate.getBasicConstraints介绍

[英]Returns the path length of the certificate constraints from the BasicContraints extension. If the certificate has no basic constraints or is not a certificate authority, -1 is returned. If the certificate is a certificate authority without a path length, Integer.MAX_VALUE is returned. Otherwise, the certificate authority's path length is returned.
[中]返回BasicContaints扩展中证书约束的路径长度。如果证书没有基本约束或不是证书颁发机构,则返回-1。如果证书是没有路径长度的证书颁发机构,则为整数。返回最大值。否则,将返回证书颁发机构的路径长度。

代码示例

代码示例来源:origin: Meituan-Dianping/walle

@Override
public int getBasicConstraints() {
  return mDelegate.getBasicConstraints();
}

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

@Override
public int getBasicConstraints() {
  return unwrap().getBasicConstraints();
}

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

@Override
public int getBasicConstraints() {
  return unwrap().getBasicConstraints();
}

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

int p_len = cert.getBasicConstraints();
if ((pathLen < 0) && (p_len >= 0)) {

代码示例来源:origin: io.netty/netty-handler

@Override
public int getBasicConstraints() {
  return unwrap().getBasicConstraints();
}

代码示例来源:origin: org.demoiselle.signer/signature-core

/**
 * Returns the PathLength value of Certificate BasicConstraint.<br>
 * * <b>0</b> - if CA.<br>
 * * <b>1</b> - for End User Certificate.<br>
 *
 * @return int
 */
public int getPathLength() {
  return certificate.getBasicConstraints();
}

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

/**
 * Two ways to tell if a certificate is a CA:
 * 1) getBasicConstraints() > -1   means it's a CA and the value is the max certificate path length
 * 2) getKeyUsage() != null && getKeyUsage()[5] == true  means it has the "CA" key usage flag set
 * Currently we only check the basic constraints
 * @param certificate
 * @return 
 */
public static boolean isCA(X509Certificate certificate) {
  return certificate.getBasicConstraints() > -1;  // -1 indicates not a CA cert, 0 and above indicates CA cert        
}

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

/**
 * Two ways to tell if a certificate is a CA:
 * 1) getBasicConstraints() > -1   means it's a CA and the value is the max certificate path length
 * 2) getKeyUsage() != null && getKeyUsage()[5] == true  means it has the "CA" key usage flag set
 * Currently we only check the basic constraints
 * @param certificate
 * @return 
 */
public static boolean isCA(X509Certificate certificate) {
  return certificate.getBasicConstraints() > -1;  // -1 indicates not a CA cert, 0 and above indicates CA cert        
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-aas2-common

/**
 * Checks whether given {@link X509Certificate} is CA certificate.
 * @param cert
 * @return true if {@link X509Certificate} is CA certificate
 */
protected boolean isCACertificate(X509Certificate cert) {
  if (cert!=null) {
    return (cert.getBasicConstraints()>=0);
  } else {
    return false;
  }
}

代码示例来源:origin: org.demoiselle.signer/core

/**
 * Returns the PathLength value of Certificate BasicConstraint.<br>
 * * <b>0</b> - if CA.<br>
 * * <b>1</b> - for End User Certificate.<br>
 *
 * @return int path length
 */
public int getPathLength() {
  return certificate.getBasicConstraints();
}

代码示例来源:origin: org.demoiselle.signer/core

/**
 * Check if is a Certificate Authority Certificate (ICP-BRASIL = AC).<br>
 * * <b>true</b> - If CA.<br>
 * * <b>false</b> -for End User Certificate.<br>
 *
 * @return boolean true if CA certificate
 */
public boolean isCACertificate() {
  return certificate.getBasicConstraints() >= 0;
}

代码示例来源:origin: demoiselle/certificate

/**
 * Returns the PathLength value of Certificate BasicConstraint.<br>
 * * <b>0</b> - if CA.<br>
 * * <b>1</b> - for End User Certificate.<br>
 *
 * @return int
 */
public int getPathLength() {
  return certificate.getBasicConstraints();
}

代码示例来源:origin: org.nhind/agent

@Override
/**
 * {@inheritDoc}
 */
public int getBasicConstraints()
{
  return internalCert.getBasicConstraints();
}

代码示例来源:origin: org.demoiselle.signer/signature-core

/**
 * Check if is a Certificate Authority Certificate (ICP-BRASIL = AC).<br>
 * * <b>true</b> - If CA.<br>
 * * <b>false</b> -for End User Certificate.<br>
 *
 * @return boolean
 */
public boolean isCertificadoAc() {
  return certificate.getBasicConstraints() >= 0;
}

代码示例来源:origin: demoiselle/certificate

/**
 * Check if is a Certificate Authority Certificate (ICP-BRASIL = AC).<br>
 * * <b>true</b> - If CA.<br>
 * * <b>false</b> -for End User Certificate.<br>
 *
 * @return boolean
 */
public boolean isCertificadoAc() {
  return certificate.getBasicConstraints() >= 0;
}

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

/**
 * Check if certificate have basic constraints exception.
 * 
 * @param certificate given by server
 * @throws CertificateException
 */
private void checkBasicConstraints(X509Certificate cert) throws CertificateException {
  if (cert.getBasicConstraints() != -1) {
    throw new CertificateException("Certificate have no basic constraints");
  }
}

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

public String getPathLimit() {
  int pathLimit = certificate.getBasicConstraints();
  if (pathLimit != -1) {
    return pathLimit == Integer.MAX_VALUE ? "No Limit" : String.valueOf(pathLimit);
  } else {
    return "";
  }
}

代码示例来源:origin: apache/activemq-artemis

@Override
public int getBasicConstraints() {
  return unwrap().getBasicConstraints();
}

代码示例来源:origin: org.apache.activemq/artemis-jms-client-all

@Override
public int getBasicConstraints() {
  return unwrap().getBasicConstraints();
}

代码示例来源:origin: org.wildfly.openssl/wildfly-openssl-java

@Override
public int getBasicConstraints() {
  return unwrap().getBasicConstraints();
}

相关文章