Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > API Authentication >

XeroApi v2.0 on Rackspace Cloud Sites

Started by Radomir Perzina -   in API Authentication

I wonder if anybody has any experience going XeroApi v2.0 on Rackspace Cloud Sites? Specifically when reading .pfx file using:
new X509Certificate2("public_privatekey.pfx", "XXX")
I get exception:
“CryptographicException: An internal error occurred.”
This happens only if running on Rackspace environment, if running locally everything works fine without any exception.
When searching interenet I found mostly using extra parameter to the constructor “X509KeyStorageFlags.MachineKeySet”, however using this parameter is causing Security Exception on Rackspace, because Cloud Sites are running under Medium Trust Environment.
Surprisingly I have one public_privatekey.pfx which works fine even on rackspace, but that one is going to expire shortly and nobody can remember how it was generated.
I was trying to generate pfx file many times, using openssl, makecert on windows, Mac, Linux trying different key length, but it still fails on Rackspace – locally all work fine.
If anybody can help it would much appreciated.
Finally I got it working. There was missing “<identity impersonate="true".../>” line in the web.config. After adding this line I was able to use X509KeyStorageFlags.MachineKeySet and the pfx file was loaded.

Radomir Perzina