本文整理汇总了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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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));
}