コード例 #1
0
        public void setUp()
        {
            // Don't show INFO log messages.
            ILOG.J2CsMapping.Util.Logging.Logger.getLogger("").setLevel(ILOG.J2CsMapping.Util.Logging.Level.WARNING);

            policyConfigDirectory_ = net.named_data.jndn.tests.integration_tests.IntegrationTestsCommon
                                     .getPolicyConfigDirectory();

            testCertFile_ = new FileInfo(System.IO.Path.Combine(new FileInfo(System.IO.Path.Combine(policyConfigDirectory_.FullName, "certs")).FullName, "test.cert"));

            pibImpl_       = new PibMemory();
            tpmBackEnd_    = new TpmBackEndMemory();
            policyManager_ = new ConfigPolicyManager(policyConfigDirectory_
                                                     + "/simple_rules.conf", new CertificateCacheV2());

            identityName_ = new Name("/TestConfigPolicyManager/temp");
            // To match the anchor cert.
            keyName_ = new Name(identityName_).append("KEY").append(
                "ksk-1416010123");
            pibImpl_.addKey(identityName_, keyName_, TEST_RSA_PUBLIC_KEY_DER);
            // Set the password null since we have an unencrypted PKCS #8 private key.
            tpmBackEnd_.importKey(keyName_, TEST_RSA_PRIVATE_KEY_PKCS8, null);

            keyChain_ = new KeyChain(pibImpl_, tpmBackEnd_, policyManager_);

            PibKey pibKey = keyChain_.getPib().getIdentity(identityName_)
                            .getKey(keyName_);

            // selfSign adds to the PIB.
            keyChain_.selfSign(pibKey);
        }
コード例 #2
0
        public void setUp()
        {
            backEndMemory = new TpmBackEndMemory();

            FileInfo locationPath = new FileInfo(System.IO.Path.Combine(net.named_data.jndn.tests.integration_tests.IntegrationTestsCommon.getPolicyConfigDirectory().FullName, "ndnsec-key-file"));

            if (locationPath.Exists)
            {
                /* foreach */
                // Delete files from a previous test.
                foreach (FileInfo file  in  locationPath.listFiles())
                {
                    file.delete();
                }
            }
            backEndFile = new TpmBackEndFile(locationPath.FullName);

            backEndList[0] = backEndMemory;
            backEndList[1] = backEndFile;
        }