3

I am looking into php openSSL library and need to sign a string using pub and priv key. The function openssl_pkcs7_sign() from documentation it seem to take the file path as a file parameter but I have string in a variable that I need to encrypt. I see all of its examples points to writing files.

Is there any way I can pass the string into the function? Or perhaps some other functions available? Writing file to disk doesn't seem very practical for my use cases.

4

1 回答 1

2

据我所知,这是不可能的

根据OpenSSL PHP 扩展的源代码,他们使用 openssl 库函数PKCS7_sign

此函数将BIO流作为输入,可以是缓冲区。

然而,在 OpenSSL PHP 扩展中,BIO 流被创建为一个文件,以文件名作为参数。

您可以通过RFC请求实现此新功能,但您可能想先在内部邮件列表中讨论此事。

于 2017-05-24T13:17:21.010 回答