List of usage examples for org.bouncycastle.asn1.x509 X509Extensions PrivateKeyUsagePeriod
ASN1ObjectIdentifier PrivateKeyUsagePeriod
To view the source code for org.bouncycastle.asn1.x509 X509Extensions PrivateKeyUsagePeriod.
Click Source Link
From source file:com.otterca.common.crypto.X509CertificateBuilderImpl.java
License:Apache License
/** * Set Private Key Usage Period (RFC3280 4.2.1.4) *///from w w w .ja v a 2 s.c om protected void setPrivateKeyUsagePeriod() { if (privateKeyUsagePeriod != null) { generator.addExtension(X509Extensions.PrivateKeyUsagePeriod, false, privateKeyUsagePeriod); } }
From source file:org.ejbca.core.model.ca.certextensions.standard.PrivateKeyUsagePeriod.java
License:Open Source License
@Override public void init(CertificateProfile certProf) { super.setOID(X509Extensions.PrivateKeyUsagePeriod.getId()); super.setCriticalFlag(false); }
From source file:org.qipki.crypto.x509.X509ExtensionsReaderImpl.java
License:Open Source License
@Override public Interval getPrivateKeyUsagePeriod(X509Certificate cert) { try {/* w ww. ja v a2 s. c om*/ byte[] value = cert.getExtensionValue(X509Extensions.PrivateKeyUsagePeriod.getId()); if (value == null) { return null; } PrivateKeyUsagePeriod privKeyUsagePeriod = PrivateKeyUsagePeriod .getInstance(ASN1Object.fromByteArray(value)); SimpleDateFormat derDateFormat = new SimpleDateFormat("yyyyMMddHHmmssz"); Date notBefore = derDateFormat.parse(privKeyUsagePeriod.getNotBefore().getTime()); Date notAfter = derDateFormat.parse(privKeyUsagePeriod.getNotAfter().getTime()); return new Interval(new DateTime(notBefore), new DateTime(notAfter)); } catch (ParseException ex) { throw new CryptoFailure("Unable to extract PrivateKeyUsagePeriod from X509Certificate extensions", ex); } catch (IOException ex) { throw new CryptoFailure("Unable to extract PrivateKeyUsagePeriod from X509Certificate extensions", ex); } }