且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Java中的node.js解密字符串?

更新时间:2023-11-14 09:51:34

您似乎与其他人有相同的问题OpenSSL加密未能解密C#

You seems to have the same issue as others OpenSSL encryption failing to decrypt C#

据我所知,文档加密库使用openssl。 openssl使用其EVP_BytesToKey函数和随机盐(不仅仅是哈希)从密码创建IV和密钥。正如戴夫指出的那样,加密库不使用盐。

As far I understood the docs, the crypto libeary uses openssl. The openssl creates IV and key from the password using its EVP_BytesToKey function and random salt (not just hash). As dave pointed out, the crypto library uses no salt.

openssl的输出为Salted_ {8字节salt} {ciphertext},因此请检查密码(我现在无法做到)

我写了一个小文章如何在Java中正确加密

I wrote a small article how to encrypt properly in Java