API Connect

 View Only

crypto.createSign('rsa-sha256') error

  • 1.  crypto.createSign('rsa-sha256') error

    Posted Mon May 23, 2022 05:00 PM
    Hi All,
    i am trying to implement signature authentication scheme i am using below script from crypto module.

    const apim = require('apim');
    var crypto = require('crypto');

    const key = new Buffer(context.get('private_key')); // i have stored PEM format private key in set variable.
    var sign = crypto.createSign('rsa-sha256');
    sign.update(signingString).sign(key, function(error, signature) {
    if (error) {
    console.error("sign error "+error);
    } else {
    console.log("signature with rsa-sha256 is "+signature.toString('base64'));
    session.output.write(signature);
    }
    });

    Getting below error

     Mon May 23 2022 20:57:10 [dsv][0x8580005c][crypto][error] apigw(dsv): tid(53743267)[request][10.251.117.103] gtid(982d310b628bf52603340ea3): *Fail to deserialize the key object* Mon May 23 2022 20:57:10 [dsv][0x8580005c][gatewayscript-user][error] apigw(dsv): tid(53743267)[request][10.251.117.103] gtid(982d310b628bf52603340ea3): sign error Error: *Fail to deserialize the key object*

    Not sure i am doing something wrong. could you please suggest solutions?

    ------------------------------
    Arjun Pilli
    API Specialist
    DSV
    Johannesburg
    +27 0840611655
    ------------------------------