• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Time类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bouncycastle.asn1.x509.Time的典型用法代码示例。如果您正苦于以下问题:Java Time类的具体用法?Java Time怎么用?Java Time使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Time类属于org.bouncycastle.asn1.x509包,在下文中一共展示了Time类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: X509v1CertificateBuilder

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
/**
 * Create a builder for a version 1 certificate.
 *
 * @param issuer the certificate issuer
 * @param serial the certificate serial number
 * @param notBefore the date before which the certificate is not valid
 * @param notAfter the date after which the certificate is not valid
 * @param subject the certificate subject
 * @param publicKeyInfo the info structure for the public key to be associated with this certificate.
 */
public X509v1CertificateBuilder(X500Name issuer, BigInteger serial, Date notBefore, Date notAfter, X500Name subject, SubjectPublicKeyInfo publicKeyInfo)
{
    if (issuer == null)
    {
        throw new IllegalArgumentException("issuer must not be null");
    }

    if (publicKeyInfo == null)
    {
        throw new IllegalArgumentException("publicKeyInfo must not be null");
    }

    tbsGen = new V1TBSCertificateGenerator();
    tbsGen.setSerialNumber(new ASN1Integer(serial));
    tbsGen.setIssuer(issuer);
    tbsGen.setStartDate(new Time(notBefore));
    tbsGen.setEndDate(new Time(notAfter));
    tbsGen.setSubject(subject);
    tbsGen.setSubjectPublicKeyInfo(publicKeyInfo);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:X509v1CertificateBuilder.java


示例2: OptionalValidity

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
private OptionalValidity(ASN1Sequence seq)
{
    Enumeration en = seq.getObjects();
    while (en.hasMoreElements())
    {
        ASN1TaggedObject tObj = (ASN1TaggedObject)en.nextElement();

        if (tObj.getTagNo() == 0)
        {
            notBefore = Time.getInstance(tObj, true);
        }
        else
        {
            notAfter = Time.getInstance(tObj, true);
        }
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:OptionalValidity.java


示例3: X509v1CertificateBuilder

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
/**
 * Create a builder for a version 1 certificate.
 *
 * @param issuer the certificate issuer
 * @param serial the certificate serial number
 * @param notBefore the Time before which the certificate is not valid
 * @param notAfter the Time after which the certificate is not valid
 * @param subject the certificate subject
 * @param publicKeyInfo the info structure for the public key to be associated with this certificate.
 */
public X509v1CertificateBuilder(X500Name issuer, BigInteger serial, Time notBefore, Time notAfter, X500Name subject, SubjectPublicKeyInfo publicKeyInfo)
{
    if (issuer == null)
    {
        throw new IllegalArgumentException("issuer must not be null");
    }

    if (publicKeyInfo == null)
    {
        throw new IllegalArgumentException("publicKeyInfo must not be null");
    }

    tbsGen = new V1TBSCertificateGenerator();
    tbsGen.setSerialNumber(new ASN1Integer(serial));
    tbsGen.setIssuer(issuer);
    tbsGen.setStartDate(notBefore);
    tbsGen.setEndDate(notAfter);
    tbsGen.setSubject(subject);
    tbsGen.setSubjectPublicKeyInfo(publicKeyInfo);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:31,代码来源:X509v1CertificateBuilder.java


示例4: createTBS

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
private static TBSCertificate createTBS(ByteArrayOutputStream bOut, SubjectPublicKeyInfo ski, AlgorithmIdentifier algo) throws IOException {
    TBSCertificate tbs = null;

    V1TBSCertificateGenerator tbsGen = new V1TBSCertificateGenerator();
    tbsGen.setSerialNumber(new ASN1Integer(0x1));
    tbsGen.setStartDate(new Time(new Date(100, 01, 01, 00, 00, 00)));
    tbsGen.setEndDate(new Time(new Date(130, 12, 31, 23, 59, 59)));
    tbsGen.setIssuer(new X500Name("CN=Cryptonit"));
    tbsGen.setSubject(new X500Name("CN=Cryptonit"));
    tbsGen.setSignature(algo);
    tbsGen.setSubjectPublicKeyInfo(ski);
    tbs = tbsGen.generateTBSCertificate();

    ASN1OutputStream aOut = new ASN1OutputStream(bOut);
    aOut.writeObject(tbs);
    System.out.println("Build TBS");
    System.out.println(toHex(bOut.toByteArray()));
    Base64.encode(bOut.toByteArray(), System.out);
    System.out.println();

    return tbs;
}
 
开发者ID:mbrossard,项目名称:cryptonit-applet,代码行数:23,代码来源:PivTest.java


示例5: addSigningTimeAttribute

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
private void addSigningTimeAttribute(final CAdESSignatureParameters parameters, final ASN1EncodableVector signedAttributes) {

		if (!padesUsage) {
			/*
			 * In PAdES, we don't include the signing time : ETSI TS 102 778-3 V1.2.1 (2010-07): 4.5.3 signing-time
			 * Attribute
			 */
			final Date signingDate = parameters.bLevel().getSigningDate();
			if (signingDate != null) {

				final DERSet attrValues = new DERSet(new Time(signingDate));
				final Attribute attribute = new Attribute(pkcs_9_at_signingTime, attrValues);
				signedAttributes.add(attribute);
			}
		}
	}
 
开发者ID:esig,项目名称:dss,代码行数:17,代码来源:CAdESLevelBaselineB.java


示例6: makeRootCert

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
private X509Certificate makeRootCert(KeyPair kp) throws InvalidKeyException, IllegalStateException, NoSuchProviderException,
        SignatureException, IOException, NoSuchAlgorithmException, ParseException, OperatorCreationException, CertificateException {

    // Load real root certificate
    X509CertificateHolder real = getRealCert("sk-root.pem");

    // Use values from real certificate
    JcaX509v3CertificateBuilder builder = new JcaX509v3CertificateBuilder(real.getIssuer(), real.getSerialNumber(), Time.getInstance(new ASN1GeneralizedTime(real.getNotBefore())), Time.getInstance(new ASN1GeneralizedTime(real.getNotAfter())), real.getSubject(), kp.getPublic());

    @SuppressWarnings("unchecked")
    List<ASN1ObjectIdentifier> list = real.getExtensionOIDs();

    // Copy all extensions verbatim
    for (ASN1ObjectIdentifier extoid : list) {
        Extension ext = real.getExtension(extoid);
        builder.copyAndAddExtension(ext.getExtnId(), ext.isCritical(), real);
    }

    // Generate cert
    ContentSigner sigGen = new JcaContentSignerBuilder("SHA1withRSA").setProvider(BouncyCastleProvider.PROVIDER_NAME).build(kp.getPrivate());

    X509CertificateHolder cert = builder.build(sigGen);
    return new JcaX509CertificateConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME).getCertificate(cert);
}
 
开发者ID:martinpaljak,项目名称:esteidhacker,代码行数:25,代码来源:FakeEstEIDCA.java


示例7: makeEsteidCert

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
private X509Certificate makeEsteidCert(KeyPair esteid, KeyPair root) throws InvalidKeyException, IllegalStateException,
        NoSuchProviderException, SignatureException, IOException, NoSuchAlgorithmException, ParseException, OperatorCreationException,
        CertificateException {

    // Load current root certificate
    X509CertificateHolder real = getRealCert("sk-esteid.pem");

    JcaX509v3CertificateBuilder builder = new JcaX509v3CertificateBuilder(real.getIssuer(), real.getSerialNumber(),
            Time.getInstance(new ASN1UTCTime(real.getNotBefore())), Time.getInstance(new ASN1GeneralizedTime(real.getNotAfter())), real.getSubject(), esteid.getPublic());

    // Basic constraints
    @SuppressWarnings("unchecked")
    List<ASN1ObjectIdentifier> list = real.getExtensionOIDs();

    // Copy all extensions
    for (ASN1ObjectIdentifier extoid : list) {
        Extension ext = real.getExtension(extoid);
        builder.copyAndAddExtension(ext.getExtnId(), ext.isCritical(), real);
    }

    // Generate cert
    ContentSigner sigGen = new JcaContentSignerBuilder("SHA384withRSA").setProvider(BouncyCastleProvider.PROVIDER_NAME).build(root.getPrivate());

    X509CertificateHolder cert = builder.build(sigGen);
    return new JcaX509CertificateConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME).getCertificate(cert);
}
 
开发者ID:martinpaljak,项目名称:esteidhacker,代码行数:27,代码来源:FakeEstEIDCA.java


示例8: X509v2CRLBuilder

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
/**
 * Basic constructor.
 *
 * @param issuer the issuer this CRL is associated with.
 * @param thisUpdate  the date of this update.
 */
public X509v2CRLBuilder(
    X500Name issuer,
    Date     thisUpdate)
{
    tbsGen = new V2TBSCertListGenerator();
    extGenerator = new ExtensionsGenerator();

    tbsGen.setIssuer(issuer);
    tbsGen.setThisUpdate(new Time(thisUpdate));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:X509v2CRLBuilder.java


示例9: setNextUpdate

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
/**
 * Set the date by which the next CRL will become available.
 *
 * @param date  date of next CRL update.
 * @return the current builder.
 */
public X509v2CRLBuilder setNextUpdate(
    Date    date)
{
    tbsGen.setNextUpdate(new Time(date));

    return this;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:14,代码来源:X509v2CRLBuilder.java


示例10: X509v3CertificateBuilder

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
/**
 * Create a builder for a version 3 certificate.
 *
 * @param issuer the certificate issuer
 * @param serial the certificate serial number
 * @param notBefore the date before which the certificate is not valid
 * @param notAfter the date after which the certificate is not valid
 * @param subject the certificate subject
 * @param publicKeyInfo the info structure for the public key to be associated with this certificate.
 */
public X509v3CertificateBuilder(X500Name issuer, BigInteger serial, Date notBefore, Date notAfter, X500Name subject, SubjectPublicKeyInfo publicKeyInfo)
{
    tbsGen = new V3TBSCertificateGenerator();
    tbsGen.setSerialNumber(new ASN1Integer(serial));
    tbsGen.setIssuer(issuer);
    tbsGen.setStartDate(new Time(notBefore));
    tbsGen.setEndDate(new Time(notAfter));
    tbsGen.setSubject(subject);
    tbsGen.setSubjectPublicKeyInfo(publicKeyInfo);

    extGenerator = new ExtensionsGenerator();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:X509v3CertificateBuilder.java


示例11: createTime

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
private Time createTime(Date date)
{
    if (date != null)
    {
        return new Time(date);
    }

    return null;
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:10,代码来源:CertificateRequestMessageBuilder.java


示例12: setNextUpdate

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
/**
 * Set the date by which the next CRL will become available.
 *
 * @param date  date of next CRL update.
 * @return the current builder.
 */
public X509v2CRLBuilder setNextUpdate(
    Time    date)
{
    tbsGen.setNextUpdate(date);

    return this;
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:14,代码来源:X509v2CRLBuilder.java


示例13: X509v3CertificateBuilder

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
/**
 * Create a builder for a version 3 certificate.
 *
 * @param issuer the certificate issuer
 * @param serial the certificate serial number
 * @param notBefore the Time before which the certificate is not valid
 * @param notAfter the Time after which the certificate is not valid
 * @param subject the certificate subject
 * @param publicKeyInfo the info structure for the public key to be associated with this certificate.
 */
public X509v3CertificateBuilder(X500Name issuer, BigInteger serial, Time notBefore, Time notAfter, X500Name subject, SubjectPublicKeyInfo publicKeyInfo)
{
    tbsGen = new V3TBSCertificateGenerator();
    tbsGen.setSerialNumber(new ASN1Integer(serial));
    tbsGen.setIssuer(issuer);
    tbsGen.setStartDate(notBefore);
    tbsGen.setEndDate(notAfter);
    tbsGen.setSubject(subject);
    tbsGen.setSubjectPublicKeyInfo(publicKeyInfo);

    extGenerator = new ExtensionsGenerator();
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:23,代码来源:X509v3CertificateBuilder.java


示例14: extractExpiredCertsOnCRL

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
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);
		}
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:16,代码来源:AbstractCRLUtils.java


示例15: getDate

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
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;
	}
}
 
开发者ID:esig,项目名称:dss,代码行数:9,代码来源:DSSASN1Utils.java


示例16: checkTime

import org.bouncycastle.asn1.x509.Time; //导入依赖的package包/类
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");
        }
    }
}
 
开发者ID:xipki,项目名称:xipki,代码行数:13,代码来源:X509CertprofileQa.java



注:本文中的org.bouncycastle.asn1.x509.Time类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AMRMClientAsyncImpl类代码示例发布时间:2022-05-22
下一篇:
Java BatchWriteItemRequest类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap