Esempio n. 1
0
        public void testValidateData()
        {
            PibIdentity identity = fixture_.addIdentity(new Name(
                                                            "/TestValidator/Null"));
            Data data = new Data(new Name("/Some/Other/Data/Name"));

            fixture_.keyChain_.sign(data, new SigningInfo(identity));

            ValidatorNull validator = new ValidatorNull();

            validator.validate(data, new TestValidatorNull.Anonymous_C3(), new TestValidatorNull.Anonymous_C2());
        }
        public void setUp()
        {
            anchorContainer = new TrustAnchorContainer();
            fixture         = new IdentityManagementFixture();

            // Create a directory and prepares two certificates.
            certificateDirectoryPath = new FileInfo(System.IO.Path.Combine(net.named_data.jndn.tests.integration_tests.IntegrationTestsCommon.getPolicyConfigDirectory().FullName, "test-cert-dir"));
            System.IO.Directory.CreateDirectory(certificateDirectoryPath.FullName);

            certificatePath1 = new FileInfo(System.IO.Path.Combine(certificateDirectoryPath.FullName, "trust-anchor-1.cert"));
            certificatePath2 = new FileInfo(System.IO.Path.Combine(certificateDirectoryPath.FullName, "trust-anchor-2.cert"));

            identity1    = fixture.addIdentity(new Name("/TestAnchorContainer/First"));
            certificate1 = identity1.getDefaultKey().getDefaultCertificate();
            fixture.saveCertificateToFile(certificate1,
                                          certificatePath1.FullName);

            identity2 = fixture
                        .addIdentity(new Name("/TestAnchorContainer/Second"));
            certificate2 = identity2.getDefaultKey().getDefaultCertificate();
            fixture.saveCertificateToFile(certificate2,
                                          certificatePath2.FullName);
        }
Esempio n. 3
0
        public void testSelfSignedCertValidity()
        {
            CertificateV2 certificate = fixture_
                                        .addIdentity(
                new Name(
                    "/Security/V2/TestKeyChain/SelfSignedCertValidity"))
                                        .getDefaultKey().getDefaultCertificate();

            Assert.AssertTrue(certificate.isValid());
            // Check 10 years from now.
            Assert.AssertTrue(certificate.isValid(net.named_data.jndn.util.Common.getNowMilliseconds() + 10 * 365
                                                  * 24 * 3600 * 1000.0d));
            // Check that notAfter is later than 10 years from now.
            Assert.AssertTrue(certificate.getValidityPeriod().getNotAfter() > net.named_data.jndn.util.Common
                              .getNowMilliseconds() + 10 * 365 * 24 * 3600 * 1000.0d);
        }