Examples of PrivateKeyUsagePeriod


Examples of org.bouncycastle.asn1.x509.PrivateKeyUsagePeriod

   
    private void privateKeyUsageTestStartOffset(final long startOffset) throws Exception {
      X509Certificate cert = privateKeyUsageGetCertificate(true, startOffset, false, 0L);       
        assertNotNull("Has the extension", cert.getExtensionValue("2.5.29.16"));
        assertTrue("Extension is non-critical", cert.getNonCriticalExtensionOIDs().contains("2.5.29.16"));
        PrivateKeyUsagePeriod ext = PrivateKeyUsagePeriod.getInstance(X509ExtensionUtil.fromExtensionValue(cert.getExtensionValue("2.5.29.16")));
        assertNotNull("Has notBefore", ext.getNotBefore());
        assertNull("Has no notAfter", ext.getNotAfter());
        assertEquals("notBefore " + startOffset + " seconds after ca cert", cert.getNotBefore().getTime() + startOffset * 1000, ext.getNotBefore().getDate().getTime());
    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.PrivateKeyUsagePeriod

   
    private void privateKeyUsageTestValidityLength(final long length) throws Exception {
      X509Certificate cert = privateKeyUsageGetCertificate(false, 0L, true, length);       
        assertNotNull("Has the extension", cert.getExtensionValue("2.5.29.16"));
        assertTrue("Extension is non-critical", cert.getNonCriticalExtensionOIDs().contains("2.5.29.16"));
        PrivateKeyUsagePeriod ext = PrivateKeyUsagePeriod.getInstance(X509ExtensionUtil.fromExtensionValue(cert.getExtensionValue("2.5.29.16")));
        assertNotNull("Has notAfter", ext.getNotAfter());
        assertNull("Has no notBefore", ext.getNotBefore());
        assertEquals("notAfter " + length + " seconds after issue time", cert.getNotBefore().getTime() + length * 1000, ext.getNotAfter().getDate().getTime());
    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.PrivateKeyUsagePeriod

   
    private void privateKeyUsageTestBoth(final long startOffset, final long length) throws Exception {
      X509Certificate cert = privateKeyUsageGetCertificate(true, startOffset, true, length);       
        assertNotNull("Has the extension", cert.getExtensionValue("2.5.29.16"));
        assertTrue("Extension is non-critical", cert.getNonCriticalExtensionOIDs().contains("2.5.29.16"));
        PrivateKeyUsagePeriod ext = PrivateKeyUsagePeriod.getInstance(X509ExtensionUtil.fromExtensionValue(cert.getExtensionValue("2.5.29.16")));
        assertNotNull("Has notBefore", ext.getNotBefore());
        assertNotNull("Has notAfter", ext.getNotAfter());
        assertEquals("notBefore " + startOffset + " seconds after ca cert", cert.getNotBefore().getTime() + startOffset * 1000, ext.getNotBefore().getDate().getTime());
        assertEquals("notAfter " + length + " seconds after notBefore", ext.getNotBefore().getDate().getTime() + length * 1000, ext.getNotAfter().getDate().getTime());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.