
Announcements
Hi expert,
I creating custom connector that require custom code
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Security.Cryptography;
using System.Text;
using Newtonsoft.Json;
public class Script : ScriptBase
{
// Some code here
private static string SignData(string data, string privateKey)
{
using (RSA rsa = RSA.Create())
{
rsa.ImportFromPem(privateKey.ToCharArray());
var signatureBytes = rsa.SignData(Encoding.UTF8.GetBytes(data), HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
return Base64UrlEncode(Convert.ToBase64String(signatureBytes));
}
}
}
It don't let me save the code with error "Failed to provision compute for custom code. Request failed with error 'Code: BadRequest. Message: script.csx(95,13): error CS1061: 'RSA' does not contain a definition for 'ImportFromPem' and no accessible extension method 'ImportFromPem' accepting a first argument of type 'RSA' could be found (are you missing a using directive or an assembly reference?).'
I have tried this code in Visual Studio and its work fine without an problem, I checked all limitation and all those namespace should supported by custom code, No idea why it causing error.
Any advice would be appreciated.
Thank you.