Tuesday, 7 March 2017

Signing/Decoding with Base-4 PKCS-8 in Node.js

Currently working to try to get connected with the Walmart Partners API, and having some issues with their cryptography, and I have not found any documented assistance for this in Javascript/Node.The documentation states:"Sign the byte array representation of this data by:Decoding the Base-64, PKCS-8 representation of your Private Key. Note that the key is encoded using PKCS-8. Libraries in various languages offer the ability to specify that the key is in this format and not in other conflicting formats such as PKCS-1.Use this byte representation of your key to sign the data using SHA-256 with RSA.Encode the resulting signature using Base-64."I have the private key, and found the "chilkat" package that is nicely documented. Only issue is our development system is Windows, and there's an issue with it on Windows 10 64bit. If I use the 64bit, it does not identify as a 64bit system, so I am not able to even get the package installed.Also, it seems the chilkat package requires at least Node version 4, we attempted upgrading to Node 4 to use this, and the project is currently not able to use that version without some bugs as a result of some other packages we use. So at least until those bugs get resolved, Node 4 is not an option, which seems that Chilkat is out of the picture...So I found anotehr NPM package to assist with this: http://ift.tt/2mThzWx that package, I'm having issues getting the decoding/signing to work... I'm finding the documentation quite confusing, and the only assistance I have found with similar questions was in C#...Any advice on how I can achieve what Walmart is asking for with the node-rsa package? I can't even achieve the first step so far, it seems to work fine if I have a string that needs to be encoded, but I can not find information for how to take a text string that is already encoded and decode it.... And of course after that begins the signing part, which I would love some assistance with as well.Thanks

Submitted March 07, 2017 at 04:42PM by SpyridonZ

No comments:

Post a Comment