web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Custom connector C# co...
Power Automate
Unanswered

Custom connector C# code doesn't suport RSA function?

(0) ShareShare
ReportReport
Posted on by 367

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.

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard