jsencrypt icon indicating copy to clipboard operation
jsencrypt copied to clipboard

why the public key only can encrypt not decrypt

Open SuimgPhilip opened this issue 5 years ago • 4 comments

in my project use RSA encrypt ,and try use JSEncrypt to decrypt in java all encrypt and decrypt is ok such like private key encrypt => public key decrypt, private key sign => public key verify, public key encrypt => private decrypt. but in JSEncrypt only public key encrypt and in java private decrypt is okey other function always not passed. signature method in java is SHA256withRSA ,and in js is CryptoJS.SHA256 verify not passed, and try not use verify to decrypt also not passed hope someone can help me .

SuimgPhilip avatar Aug 22 '19 15:08 SuimgPhilip

by the way, the RSA certificate is 2048 bit

SuimgPhilip avatar Aug 22 '19 15:08 SuimgPhilip

签名算法格式有很多标准的,你后端可能是jwt,前端可能格式不一样,要么后端用node.js也跑这个库。 中国式英语也不贴代码谁帮得了你

CoderYellow avatar Sep 28 '19 12:09 CoderYellow

He might want to know the signature format.Is it jwt?

CoderYellow avatar Sep 28 '19 12:09 CoderYellow

公钥不是用于解密的 用私钥加密[公钥解密]是不可能的。 RSA最初的设计就是为了公钥用于公开的

CreatorEdition avatar Apr 02 '23 10:04 CreatorEdition