Home >Backend Development >PHP Tutorial >keys generated by openssl_private_encrypt using DSA algorithm cannot be encrypted

keys generated by openssl_private_encrypt using DSA algorithm cannot be encrypted

WBOY
WBOYOriginal
2016-12-01 00:25:301691browse

<code>openssl_private_encrypt($originalData, $encryptData, $privateKey, OPENSSL_ALGO_DSS1)</code>

Warning message:

<code>Warning: openssl_private_encrypt(): key type not supported in this PHP build!
</code>

Key: *.pem

<code>-----BEGIN DSA PRIVATE KEY-----
密钥内容
-----END DSA PRIVATE KEY-----</code>

It seems that this format of key is not supported for encryption. The content of this key is provided by the partner, and their development language is JAVA.

I use RSA formatted key contents and then encrypt using openssl_private_encrypt with no problem.
There is very little content related to PHP DSA encryption on the Internet, which is a headache.

Reply content:

<code>openssl_private_encrypt($originalData, $encryptData, $privateKey, OPENSSL_ALGO_DSS1)</code>

Warning message:

<code>Warning: openssl_private_encrypt(): key type not supported in this PHP build!
</code>

Key: *.pem

<code>-----BEGIN DSA PRIVATE KEY-----
密钥内容
-----END DSA PRIVATE KEY-----</code>

It seems that this format of key is not supported for encryption. The content of this key is provided by the partner, and their development language is JAVA.

I use RSA formatted key contents and then encrypt using openssl_private_encrypt with no problem.
There is very little content related to PHP DSA encryption on the Internet, which is a headache.

Is privateKey pronounced correctly?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn