当前位置: 首页>>代码示例>>Java>>正文


Java Time.getInstance方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: rebuildASN1Time

import org.bouncycastle.asn1.x509.Time; //导入方法依赖的package包/类
private Time rebuildASN1Time(int tagNo, byte[] array) throws IOException {
	// Tag UTC or GeneralizedTime
	return Time.getInstance(rebuildASN1Primitive(tagNo, array));
}
 
开发者ID:esig,项目名称:dss,代码行数:5,代码来源:CRLParser.java


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