2017-06-15 81 views
0

我在NetSuite SuiteScript 2.0中使用加密模塊。我在下面的加密中使用了createHmac方法NetSuite Crypto createHmac顯示無效算法值

var hmacSignature = crypto.createHmac({ 
algorithm: crypto.HashAlg.SHA1 , 
        key: sKey 
    }); 

我得到'算法'值的無效類型參數。這是在NetSuite SuiteScript PDF中設置類型的指定方式。我究竟做錯了什麼??

+0

哪裏是你的生成'sKey'代碼生成它傳遞一個crypto.SecretKey對象解決這個問題? – Krypton

+0

我硬編碼的sKey值,因爲這是一個測試 – Bharath

+0

這可能是問題。該方法需要一個[crypto.SecretKey對象](https://netsuite.custhelp.com/app/answers/detail/a_id/43742)。如果您的硬編碼sKey不完全是這種格式,它可能會產生這個錯誤。 – Krypton

回答

0

由於氪,我可以通過使用crypto.CreateSecretKey方法