コード例 #1
0
 /// <summary>
 /// Delete the keys we created
 /// </summary>
 ///
 public static void tearDownClass()
 {
     // delete all keys when done
     FilePrivateKeyStorage instance = new FilePrivateKeyStorage();
     try {
         instance.deleteKey(new Name("/test/KEY/123"));
         instance.deleteKey(new Name("/test/KEY/temp1"));
     } catch (Exception e) {
         System.Console.Error.WriteLine("Failed to clean up generated keys");
     }
 }
コード例 #2
0
 /// <summary>
 /// Test of generateKeyPair method, of class FilePrivateKeyStorage.
 /// </summary>
 ///
 public void testGenerateAndDeleteKeys()
 {
     // create some more key files
     FilePrivateKeyStorage instance = new FilePrivateKeyStorage();
     instance.generateKeyPair(new Name("/test/KEY/temp1"), new RsaKeyParams(
             2048));
     // check if files created
     FileInfo[] files = ndnFolder_.listFiles();
     int createdFileCount = files.Length;
     AssertTrue(createdFileCount >= 2); // 2 pre-created + 2 created now + some created by NFD
     // delete these keys
     instance.deleteKey(new Name("/test/KEY/temp1"));
     files = ndnFolder_.listFiles();
     int deletedfileCount = files.Length;
     AssertTrue(createdFileCount - 2 == deletedfileCount);
 }