Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++、Botan、Qt,不需要创建文件就使用STD_C++_Qt_Stdout_Std_Botan - Fatal编程技术网

C++、Botan、Qt,不需要创建文件就使用STD

C++、Botan、Qt,不需要创建文件就使用STD,c++,qt,stdout,std,botan,C++,Qt,Stdout,Std,Botan,我正在用Botan解密一些文件,如下所示: std::ifstream in (InFilename.c_str(), std::ios::binary); in.ignore(32); std::ofstream out (outFilename.c_str(), std::ios::binary); Pipe pipe(get_cipher("AES-256/CBC",key,iv, DECRYPTION),new DataSink_Stream(out)); try{ pipe.start

我正在用Botan解密一些文件,如下所示:

std::ifstream in (InFilename.c_str(), std::ios::binary);
in.ignore(32);
std::ofstream out (outFilename.c_str(), std::ios::binary);
Pipe pipe(get_cipher("AES-256/CBC",key,iv, DECRYPTION),new DataSink_Stream(out));
try{
pipe.start_msg();
in >> pipe;
pipe.end_msg();
out.flush();
out.close();
in.close();
在我收到信号后,该文件被解密,我将像pdf一样打开该文件:

pdf->openFile(outFilename);
每件事都完美而快速。但解密的文件位于同一文件夹中,我想解密内存中的文件,例如内存映射文件,并将其直接发送到openFile,而不保存在文件系统中。 我该怎么做?也许QT和Core C++有很多不同的可能性。
谢谢大家!

您不保存到文件系统的动机是什么?是安全性、性能还是其他要求。另一种解决方案也可以接受吗?出于安全考虑,我正在尝试这样做。用户不应该有权访问加密文件。我现在正努力寻找在植物学做这件事的可能性。我的意思是直接将文件从管道发送到openFile。但我现在还不太清楚:什么是pdf格式?一切都取决于您使用什么来查看pdf!你可以。我不知道Botan,但是参考资料显示DataSink_流需要一个std::ostream,而不一定是std::ofstream。使用同样继承std::ostream的东西应该可以工作。编辑:不是100%确定std::ostream足以满足您的其他需求,但是,它没有经过测试。看,它应该可以做到这一点。