使用内存时,我在访问已EnvelopedData
签名CMS_ContentInfo*
对象内时遇到问题BIO
。
使用以下代码,一切正常:
BIO* output = BIO_new_file("/absolute/path/test.txt", "r+");
if (CMS_verify(cms, stack, store, dcont, output, CMS_NOINTERN)) {
BIO_flush(output);
BIO_reset(output);
CMS_ContentInfo* cms2 = SMIME_read_CMS(output, nullptr);
}
cms2 已正确实例化,我能够解密其内容。虽然,我不希望将文件写入磁盘,所以我试图像这样在内存中进行这项工作:
BIO* output = BIO_new(BIO_s_mem());
if (CMS_verify(cms, stack, store, dcont, output, CMS_NOINTERN)) {
BIO_flush(output);
BIO_seek(output, 0);
CMS_ContentInfo* cms2 = SMIME_read_CMS(output, nullptr);
}
由于某种原因,该SMIME_read_CMS
函数似乎永远无法从BIO
. 谁能帮我搞定这个工作?