Announcements
Hi community,
I am building an extension in Business Central and I need to apply a HTTP signature to my API calls.
At this moment I am using the function SignData in codeunit 1266 "Cryptography Management", because I need to sign my data with algorithm sha256 and by using my private key file.
When I use this function however, I receive the following error message.
Error:
A call to System.Security.Cryptography.RSACryptoServiceProvider.FromXmlString failed with this message: Invalid syntax on line 1.
Code:
Does anyone have an idea what could be the problem?
Thanks a lot!
Kind regards,
Gijs
Did you guys find a solution for the same?
It seems like the cryptography mgt accepted the key but the webservice that I'm contacting is still returning errors over my signature.
So many unknown variables on this, but I won't stop looking.
Thank you very much for your response!
Kind regards,
Joriek
Not really sure that this was exactly the project that I used, but your approach looks correct to me.
In any case you should be able to import the generated XML file in BC and use it in cryptography mgt.
Thank you for your respons, I guess the correct method is to add my pem file to the exe directory, use the cmd to execute the .exe file and use the generated XML in my BC. Or did you use another method?
Hi Joriek,
There is no function available in AL for this at the moment, so I had to look for a third party tool to transform PEM to XML.
After doing some research I came across a .net project that was able to do this.
If I remember correct, it was this one: github.com/.../pem2xml
Kind regards,
Hey Gijs, how did you convert this PEM file to an XML? Can you do this only using AL code or did you need any 3th party tools?
You can only use this function if the private key file is a XML file.
In this case the private key file was a PEM file, so I had to transform the PEM file to a XML file to be able to use this function.
Kind regards,
Did u find any solution??
Hi,
If there was an outcome, then maybe you can share it with the community?
Thanks.
Hi Marco,
Unfortunately I already came across this blog posting and this didn't help me.
I contacted Microsoft for this issue and I will keep this post up-to-date.
Kind regards,
André Arnaud de Cal...
294,069
Super User 2025 Season 1
Martin Dráb
232,858
Most Valuable Professional
nmaenpaa
101,158
Moderator