2009-08-22 71 views
10

我需要从未安装的TrueCrypt磁盘加载文件到内存中。有没有办法以编程方式做到这一点? TrueCrypt是否提供API?有没有办法从TrueCrypt磁盘读取文件到内存中的文件?

我相信最适合尝试的方法是安装卷(当然提示用户输入密码),打开文件,然后卸载卷。有没有办法自动完成这一切?

我在Windows Vista上。我有C#,Python和Perl随时可用。

回答

12

你不能使用System.Diagnostics.Process中的true crypt command line吗?

using System; 
using System.Diagnostics; 

namespace Test { 

    class TrueCrypeStart 
    { 
     static void Main(string[] args) 
     { 

      string password = getPassword(...); 
      Process tc= new Process(); 

      tc.StartInfo.FileName = "TrueCrypt.exe"; 
      tc.StartInfo.Arguments = string.Format("/v \"{0}\" /p \"{1}\" /q", ...mount info ..., password); // for quiet! 

      tc.Start(); 
     } 
    } 
} 
+0

谢谢,这工作。 – MiffTheFox 2009-08-22 11:41:15

+4

请注意,将密码硬编码到.NET程序集中可以使得通过反编译提取pw变得容易。如果安全性问题,您应该考虑混淆您的代码。 – galaktor 2009-08-22 11:50:10

+3

@galaktor - 我通过省略/ p选项来解决该问题,允许用户直接将密码输入到TrueCrypt中。 – MiffTheFox 2009-11-09 00:16:37

0

TrueResize包括一个开放源代码C#TrueCrypt的库,将允许您读取加密的卷(而无需将其安装),附加的库包括NTFS的支持。

相关问题