For partners that build or integrate commercially available applications and service solutions with the Oracle Cloud Platform
For partners that provide implementation or managed services around Oracle Cloud Applications
Hi All,
In OIC, How to calculate signature using HMAC sha256
Is there any script available in OIC calculate HMAC sha256 ??
Regards,
Logu,
Hi John,
When i tried this code getting below error while activating the Integration.
Deployment Failed: Error occurred during deployment of component: TWO_FACTOR_AUTH to service engine: implementation.bpel, for composite: TWO_FACTOR_AUTH: ORABPEL-05215 Error while loading process. The process domain is encountering the following errors while loading the process "TWO_FACTOR_AUTH" (composite "oracleinternalics/TWO_FACTOR_AUTH!01.00.0000*3e9ee41e-1494-4ec8-80ef-dd9219521999"): Error while creating process. error while attempting to instantiate the class for the process "oracleinternalics/TWO_FACTOR_AUTH!01.00.0000*3e9ee41e-1494-4ec8-80ef-dd9219521999" (revision "TWO_FACTOR_AUTH"); the exception reported was: ReferenceError: "require" is not defined. (js/HMAC_SHA256_01.00.0000/Hmac-sha256.js#1) This error contained an exception thrown by the underlying process loader module. Verify the exception trace in the log (with logging level set to debug mode). . This error contained an exception thrown by the underlying process loader module. Check the exception trace in the log (with logging level set to debug mode). If there is a patch installed on the server, verify that the bpelcClasspath domain property includes the patch classes.
Thank you so much John.
reference library we should add right?
1. enc-base64.min.js
2.hmac-sha256.min.js
3.crypto-js.min.js
Right. You'll need to add the modules in the node_modules directory and zip it up for the library. I typically do my testing using nodejs and build out the needed modules, then zip and upload. That's why I have the code at the end that calls the method and displays the results.
Hi John,
When i tried this code getting below error while activating the Integration.
Deployment Failed: Error occurred during deployment of component: TWO_FACTOR_AUTH to service engine: implementation.bpel, for composite: TWO_FACTOR_AUTH: ORABPEL-05215 Error while loading process. The process domain is encountering the following errors while loading the process "TWO_FACTOR_AUTH" (composite "oracleinternalics/TWO_FACTOR_AUTH!01.00.0000*3e9ee41e-1494-4ec8-80ef-dd9219521999"): Error while creating process. error while attempting to instantiate the class for the process "oracleinternalics/TWO_FACTOR_AUTH!01.00.0000*3e9ee41e-1494-4ec8-80ef-dd9219521999" (revision "TWO_FACTOR_AUTH"); the exception reported was: ReferenceError: "require" is not defined. (js/HMAC_SHA256_01.00.0000/Hmac-sha256.js#1) This error contained an exception thrown by the underlying process loader module. Verify the exception trace in the log (with logging level set to debug mode). . This error contained an exception thrown by the underlying process loader module. Check the exception trace in the log (with logging level set to debug mode). If there is a patch installed on the server, verify that the bpelcClasspath domain property includes the patch classes.
Sorry I haven't been able to get back to this for awhile. You are right. The 'require' command is not allowed in the library. Let me try to build out something else. I might be able to use browserify to bring in the crypto command into a standalone js file. I'll let you know how I go.
Thank you so much for your response.
Kindly let me know any current possible ways.
Add above library and craete a function as below. These are cryptoJs library and needs to be used as below.
var message = "Message"; function Hmac(key){ var hash = CryptoJS.HmacSHA256(message,key); var hashInBase64 = CryptoJS.enc.Base64.stringify(hash); return hashInBase64; }
Let me know if this works. I tried this recently and gives me result.
I have done with my own another code refered with the above libraries.
Hi Logu,
How did you add the following in the reference library?
1. enc-base64.min.js
2.hmac-sha256.min.js
3.crypto-js.min.js
I'm getting the error "Failed to register library, Library file enc-base64.min.js should contain at least one JS file with valid functions." when I try to register the JS. Same error for the other two JS.
I downloaded the copies of the JS above from https://www.cdnpkg.com/crypto-js.
Hopefully you can help me with my issue.
Thanks,
Aram
Here I attached, what file I am using right now. kindly test with these files.
Let me know if any concern
Thank you for your reply Logu. I tried to register one of the JS file you have used, and it is giving me the same error I have before.
This should help start how to build js libraries and use them - Using Libraries & Adding Callouts
If you are using the zip file attached by logu, you can use the js files in it, jar them and upload that as a library, instead of individual files and that should solve your problem.
Hi Hemanth,
Thank you for your comment. As I'm new in JS and Java, may I ask what tool I can use to compress the js files and convert it into jar file?
I generally use java command line to generate the jar file like below:
jar -cvf Sample.jar *.js
Picks up all js files in current location and create a jar with name Sample in current location, assuming JAVAHOME and $JAVAHOME/bin are set in PATH variable.
Thank you. I have done what you have instructed and produced a jar file, however, I got the same error when I tried to register the jar file. I have attached the jar file that I have created.
I tried jar on my side what u have attached. successfully got registered with a warning message
Thank you for all the help! Finally, I was able to upload successfully in the Library. I have updated my function and created a new jar file. I have attached the working jar file I have created.
Add above library and craete a function as below. These are cryptoJs library and needs to be used as below.