提示模块使用This encryption
密码出错了
const encrypted = crypto.publicEncrypt( { key: `MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAW3P7gObqvIjJA3L7ZMVDdJ5lLis4jpShq14xWtS3AvnStWV4xY2BQ74bE08PvomByQc585vM7/HQNj2JNwQXwbjhyL5noC5Da3YGt5RiPMARa61LVeBcN8pipJNZoaFSrpMeG1CE45NMNhAnphv0WXzdX+9sr2uateIOi3Ab5QIDAQAB`, padding: crypto.constants.RSA_PKCS1_PADDING, }, Buffer.from(cardData), );
误差
Error: error:1E08010C:DECODER routines::unsupported at Object.publicEncrypt (node:internal/crypto/cipher:79:12)
我也这样试过,但还是一样的错误
const publicKey = Buffer.from( 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAW3P7gObqvIjJA3L7ZMVDdJ5lLis4jpShq14xWtS3AvnStWV4xY2BQ74bE08PvomByQc585vM7/HQNj2JNwQXwbjhyL5noC5Da3YGt5RiPMARa61LVeBcN8pipJNZoaFSrpMeG1CE45NMNhAnphv0WXzdX+9sr2uateIOi3Ab5QIDAQAB',
'base64',
);
const encrypted = crypto.publicEncrypt(
{
key: publicKey,
padding: crypto.constants.RSA_PKCS1_PADDING,
},
Buffer.from(cardData, 'base64'),
);
1条答案
按热度按时间flseospp1#
很奇怪,但是当我把钥匙放进一个文件里的时候,它就起作用了,但是我不明白为什么
然后读出来