org.bouncycastle.asn1.x509.Time类的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(209)

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

Time介绍

暂无

代码示例

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public Date getThisUpdate()
{
  return c.getThisUpdate().getDate();
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public void setEndDate(
  ASN1UTCTime endDate)
{
  this.endDate = new Time(endDate);
}

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

if (signingTime != null)
  Time timeInstance = Time.getInstance(signingTime.getAttrValues().getObjectAt(0));
  try
    certFromSignedData.checkValidity(timeInstance.getDate());
    System.out.println("Certificate valid at signing time: " + timeInstance.getDate());

代码示例来源:origin: org.xipki.pki/ca-qa

private static void checkTime(Time time, ValidationIssue issue) {
  ASN1Primitive asn1Time = time.toASN1Primitive();
  if (time.getDate().getTime() / 1000 < EPOCHTIME_2050010100) {
    if (!(asn1Time instanceof ASN1UTCTime)) {
      issue.setFailureMessage("not encoded as UTCTime");
    }
  } else {
    if (!(asn1Time instanceof ASN1GeneralizedTime)) {
      issue.setFailureMessage("not encoded as GeneralizedTime");
    }
  }
}

代码示例来源:origin: esig/dss

protected void extractExpiredCertsOnCRL(CRLValidity validity, byte[] expiredCertsOnCRLBinaries) {
  if (expiredCertsOnCRLBinaries != null) {
    try {
      ASN1OctetString octetString = (ASN1OctetString) ASN1Primitive.fromByteArray(expiredCertsOnCRLBinaries);
      Time time = Time.getInstance(ASN1Primitive.fromByteArray(octetString.getOctets()));
      if (time != null && time.toASN1Primitive() instanceof ASN1GeneralizedTime) {
        validity.setExpiredCertsOnCRL(time.getDate());
      } else {
        LOG.warn("Attribute 'expiredCertsOnCRL' found but ignored (should be encoded as ASN.1 GeneralizedTime)");
      }
    } catch (Exception e) {
      LOG.error("Unable to parse expiredCertsOnCRL on CRL : " + e.getMessage(), e);
    }
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public static Time getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(obj.getObject()); // must be explicitly tagged
}

代码示例来源:origin: org.xipki/ca-server

public X509CRL getCrl(BigInteger crlNumber) throws OperationException {
 LOG.info("     START getCrl: ca={}, crlNumber={}", caIdent.getName(), crlNumber);
 boolean successful = false;
 try {
  byte[] encodedCrl = certstore.getEncodedCrl(caIdent, crlNumber);
  if (encodedCrl == null) {
   return null;
  }
  try {
   X509CRL crl = X509Util.parseCrl(encodedCrl);
   successful = true;
   if (LOG.isInfoEnabled()) {
    String timeStr = new Time(crl.getThisUpdate()).getTime();
    LOG.info("SUCCESSFUL getCrl: ca={}, thisUpdate={}", caIdent.getName(), timeStr);
   }
   return crl;
  } catch (CRLException | CertificateException ex) {
   throw new OperationException(SYSTEM_FAILURE, ex);
  } catch (RuntimeException ex) {
   throw new OperationException(SYSTEM_FAILURE, ex);
  }
 } finally {
  if (!successful) {
   LOG.info("    FAILED getCrl: ca={}", caIdent.getName());
  }
 }
} // method getCrl

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public String toString()
  {
    return getTime();
  }
}

代码示例来源:origin: redfish64/TinyTravelTracker

public static Time getInstance(
  ASN1TaggedObject obj,
  boolean          explicit)
{
  return getInstance(obj.getObject()); // must be explicitly tagged
}

代码示例来源:origin: redfish64/TinyTravelTracker

public String toString()
  {
    return getTime();
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public Date getNotBefore()
{
  return c.getStartDate().getDate();
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public void setEndDate(
  ASN1UTCTime endDate)
{
  this.endDate = new Time(endDate);
}

代码示例来源:origin: esig/dss

public static Date getDate(ASN1Encodable encodable) {
  try {
    return Time.getInstance(encodable).getDate();
  } catch (Exception e) {
    LOG.warn("Unable to retrieve the date : " + encodable, e);
    return null;
  }
}

代码示例来源:origin: esig/dss

private Time rebuildASN1Time(int tagNo, byte[] array) throws IOException {
  // Tag UTC or GeneralizedTime
  return Time.getInstance(rebuildASN1Primitive(tagNo, array));
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public void checkValidity(
  Date    date)
  throws CertificateExpiredException, CertificateNotYetValidException
{
  if (date.getTime() > this.getNotAfter().getTime())  // for other VM compatibility
  {
    throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime());
  }
  if (date.getTime() < this.getNotBefore().getTime())
  {
    throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime());
  }
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public Date getThisUpdate()
{
  return c.getThisUpdate().getDate();
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public void setStartDate(
  ASN1UTCTime startDate)
{
  this.startDate = new Time(startDate);
}

代码示例来源:origin: org.apache.pdfbox/pdfbox-examples

if (signingTime != null)
  Time timeInstance = Time.getInstance(signingTime.getAttrValues().getObjectAt(0));
  try
    certFromSignedData.checkValidity(timeInstance.getDate());
    System.out.println("Certificate valid at signing time: " + timeInstance.getDate());

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public Time getRevocationDate()
{
  return Time.getInstance(seq.getObjectAt(1));
}

代码示例来源:origin: org.bouncycastle/bcprov-debug-jdk15on

public void checkValidity(
  Date    date)
  throws CertificateExpiredException, CertificateNotYetValidException
{
  if (date.getTime() > this.getNotAfter().getTime())  // for other VM compatibility
  {
    throw new CertificateExpiredException("certificate expired on " + c.getEndDate().getTime());
  }
  if (date.getTime() < this.getNotBefore().getTime())
  {
    throw new CertificateNotYetValidException("certificate not valid till " + c.getStartDate().getTime());
  }
}

相关文章