Chinese is not supported RSA sign
Hopefully can work it out
PKCS1
Can you provide a minimal code example?
Can you provide a minimal code example?
The SIGN I returned with JavaWeb does not contain Chinese and can be passed
angular:
Returns false after using Chinese
Can you provide a minimal code example?
This is what happens when use Chinese
中文

Also in?
@a1031101978,
Please take a look at these issues: https://github.com/digitalbazaar/forge/issues?q=chinese
You need to convert your character strings into binary-encoded strings (so each character uses a character code of 0-255, i.e. a "string of bytes") when using forge. This is because forge was written before Uint8Array existed. Therefore, use the UTF-8 encoding APIs to convert a string of characters into a string of bytes before passing the string to the various crypto APIs.
@a1031101978 As @dlongley said,you should encode those Chinese characters to utf-8 style first. for encryption
const publickeyStr = "<public key...>";
const plaintextStr = "我爱你";
const publickey = forge.pki.publicKeyFromPem(publickeyStr);
const buffer = forge.util.createBuffer();
buffer.data = forge.util.encodeUtf8(plaintextStr)
const encryptedStr = forge.util.encode64(publickey.encrypt(buffer.bytes()))
console.log(encryptedStr);
for decryption
const privatekeyStr = "<private key...>"
const encryptedStr = "<encrypted string ...>";
const privateKey = forge.pki.privateKeyFromPem(privatekeyStr);
const decrypted = privateKey.decrypt(forge.util.decode64(encryptedStr))
const plaintextStr = forge.util.decodeUtf8(decrypted)
console.log(plaintextStr);
You can find more detail on this project: https://github.com/akino512/forge-web
I think this issue should be closed.
Thanks! I agree -- closing.