Everyone,
I am trying to make a web call to an API end for a online file transfer site that we use (FileGenius). They require all API calls to be signed using your API key and secret. The Secret needs to be hashed using SHA1, which then gets fed into the SHA256 HMAC signature along with a couple other parameters.
I am totally at a loss on where to start on this one. I have tried using the generateSignature function of a ByteArray, but cant seem to get what I want out of it. I suspect that is due to the fact that Switch is encoding the SHA1 hash with ASN.1, and then encrypting the that data.
I just need to get some message hashes.
Any thoughts?
Thanks,
David
SHA1 / SHA256 Message Authentication
Re: SHA1 / SHA256 Message Authentication
I had to create my HMAC hash in an external program and call that from Switch. Couldn't find a way in Switch to do it. It might be possible using ByteArray.generateSignature(), but it sounds like that was deprecated in 20017 Update 2.
The lack of true JSON support and HMAC generation is making it difficult to integrate with modern APIs.
The lack of true JSON support and HMAC generation is making it difficult to integrate with modern APIs.
Re: SHA1 / SHA256 Message Authentication
I think I used openssl as command line tool in the past to do hmac's, but I remember it wasn't simple, I had to work with an intermediate batch file.
cstevens, have you tried Switch 2017, update 2 yet? It now has JSON.stringify() and JSON.Parse()
cstevens, have you tried Switch 2017, update 2 yet? It now has JSON.stringify() and JSON.Parse()