Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5965527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:38:36+00:00 2026-05-22T19:38:36+00:00

In my work we are doing encryption to protect data and that data is

  • 0

In my work we are doing encryption to protect data and that data is encrypted by the .NET Compact Framework and must be read by the regular .NET framework on a server. We are running into an issue where the compact framework is unable to encrypt (throwing exception) using RSA with a known public key. The server passes the public key to the compact framework device. Below is a test app written for the compact framework to show the problem.

string mod = 
    "rgTcL0/ZK3j5Rt6CigEsfyLDiERh2PuVzmZVdHbb/2jQOG5JEcAqqBoscDZ4PwJR8aO19xNVTce7"
  + "vzbEued32z2PLAvCcHFKGtOgNEeZ+ZcD6uHobsKws76BdjBrI7Pigk2HSkak21n2WoVcBVHoRmcn"
  + "eX7DPaB4atamhkbLoRBF1VlautDfhX9lnOFA2zyZUCB5CproavKF6wl19pZne2Q4U1vMtBAA2Q9N"
  + "aZFsrj/KjE3UtYKvjd4Oy55Hmtpb5P3CZAVpiyCTKq3gTxDJn69giyctu428DgkKacmZ4yTvkLWB"
  + "Ym/zWtAf9o8pI+3MwgF7wzuK5ypGack3l4/Skw==";

string exp = "AQAB";

RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(2048);

RSAParameters p = new RSAParameters();
p.Modulus = Convert.FromBase64String(mod);
p.Exponent = Convert.FromBase64String(exp);

rsa.ImportParameters(p);

var bytes = rsa.Encrypt(System.Text.Encoding.ASCII.GetBytes("MIKE"), true);

This code produces the following exception when the “Encrypt” method is called:

Framework: 3.5.7283.0
Exception: fOAEP 
InnerException: Could not evaluate expression

Stack Trace:
   at System.Security.Cryptography.RSACryptoServiceProvider.Encrypt
    (Byte[] rgb, Boolean fOAEP)

Does anyone know anything else I should try/do? I have written this code in regular .NET and it works just fine. I can encrypt and decrypt using different instances. Any help would be appreciated.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:38:37+00:00Added an answer on May 22, 2026 at 7:38 pm

    Use of a true value for the fOAEP parameter is not supported in the Compact Framework (at least in version 3.5). For details of the parameter, see http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.encrypt.aspx.

    In CF 3.5, support for fOAEP = true does not appear to be device-dependent. Instead, rejection of a true value is hard-coded as a parameter validation in the Encrypt method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing work for a client that has a server on his domain.
I am doing some work on a web site that has a secure area
I am doing some work on an asp website that uses Access as its
I'm doing maintenance work on a Rails site that's deployed using Phusion Passenger .
I am doing work for school, I'm supposed to write a function that accepts
I'm looking for a component for C#.NET 2008 Professional that is capable of doing
I have a long running activity (where the activity is continually doing work for
We are a mostly MS shop at work doing .NET LOB development. We also
I am doing work on a server with a postgresql database from home, where
After doing some work with Ruby, Rails, and RSpec last summer and I learned

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.