const NodeRSA = require('node-rsa');
exports.RsaSign = function (Str, RsaKey, KeyLengTh = 1024, signingScheme_ = "sha256", userPrivateKey = 'pkcs8-private') {
    const key = new NodeRSA();
    key.setOptions({ b: KeyLengTh, signingScheme: signingScheme_ });//配置密钥长度，并设置签名方法
    key.importKey(RsaKey, userPrivateKey);//导入密钥并设定格式
    let signedData = key.sign(Buffer.from(Str), "base64", "base64").toString("base64");
    return signedData;
}
