我想将带参数的查询的执行放入delphi-2009中的线程安全类中.
我在谷歌导航但我没有找到我想要的东西.
谢谢
我正在尝试为制作肥皂请求创建WS。邮件的正文中有一个包含加密文本的字段。我有公用密钥来加密文本,但是我获得的唯一结果是无法识别文本。我使用节点的加密模块发出请求,并且文本被加密,但是我不知道为什么不正确加密。
附言:我用openssl_public_encrypt函数在php上进行了同样的操作。但是我必须在node.js中做到这一点。
有什么想法或建议吗?与crypto.publicEncrypt函数的openssl_public_encrypt有什么不同?
这是node.js中的加密部分:
var crypto = require("crypto");
var fs = require('fs');
fs.readFile("./certificate.pem", 'utf8', function (err, data) {
var bufferToEncrypt = new Buffer("textToEncrypt");
var encrypted = crypto.publicEncrypt({"key":data, padding:crypto.RSA_NO_PADDING}, bufferToEncrypt).toString("base64");
console.log(encrypted); // length 128
}
Run Code Online (Sandbox Code Playgroud)
在PHP中的同样的事情:
<?php
$publicKey = "./certificate.pem";
$plaintext = "textToEncrypt";
openssl_public_encrypt($plaintext, $encrypted, $publicKey);
echo base64_encode($encrypted); //encrypted string length 128
?>
Run Code Online (Sandbox Code Playgroud)
我没有用于解密文本的私钥,只有公钥。
还要注意,在php和node.js中,加密文本的长度(在base64中)是相同的。