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 3848942
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:46:41+00:00 2026-05-19T16:46:41+00:00

Here is the problem I am trying to solve. Let’s say I was releasing

  • 0

Here is the problem I am trying to solve. Let’s say I was releasing some web software built on ASP.NET MVC and I only wanted the end user to be able to add X users to the system. The software would be hosted on their servers.

I want to include an encrypted file that when the user tries to add a new user, it goes out and reads from the file an encrypted string. When the website decodes it, the clear text will be the number of allowed users.

What is the best/simplest way on my end to encrypt to generate this string on my end then decode it back to clear text in my application? Obviously I want to ensure that the end user cannot be spinning up their own encrypted string and just replace mine. I don’t want to worry about having to try and obfuscate my source so that they would not be able to see how I decode the string.

Is it possible to encrypt with a private rsa key, then decrypt it with the public one? I haven’t had luck with that in the code below:

        var rsa = new RSACryptoServiceProvider();

        var pubicKey = rsa.ToXmlString(false);
        var privateKey = rsa.ToXmlString(true);

        var test = "this string needs to be encrypted then decrypted";

        var rsa2 = new RSACryptoServiceProvider();
        rsa2.FromXmlString(privateKey);

        var encryptedBytes = rsa2.Encrypt(Encoding.UTF8.GetBytes(test), false);
        var encryptedString = Convert.ToBase64String(encryptedBytes);

        var rsa3 = new RSACryptoServiceProvider();
        rsa3.FromXmlString(pubicKey);

        encryptedBytes = Convert.FromBase64String(encryptedString);

        var decryptedString = Encoding.UTF8.GetString(rsa3.Decrypt(encryptedBytes,                        false));      
  • 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-19T16:46:42+00:00Added an answer on May 19, 2026 at 4:46 pm

    You can use a signature strategy, where the private key is used to generate a signature that verifies that your message is authentic.

    // Create message and signature on your end
    string message = "Here is the license message";
    
    var converter = new ASCIIEncoding();
    byte[] plainText = converter.GetBytes(secret);
    
    var rsaWrite = new RSACryptoServiceProvider();
    var privateParams = rsaWrite.ExportParameters(true);
    
    // Generate the public key / these can be sent to the user.
    var publicParams = rsaWrite.ExportParameters(false);
    
    byte[] signature =
        rsaWrite.SignData(plainText, new SHA1CryptoServiceProvider());
    
    // Verify from the user's side. Note that only the public parameters
    // are needed.
    var rsaRead = new RSACryptoServiceProvider();
    rsaRead.ImportParameters(publicParams);
    if (rsaRead.VerifyData(plainText,
                           new SHA1CryptoServiceProvider(),
                           signature))
    {
        Console.WriteLine("Verified!");
    }
    else
    {
        Console.WriteLine("NOT verified!");
    }
    

    This example was largely copied from Microsoft’s site:

    • RSACryptoServiceProvider.SignData Method (Byte[], Object)

    And here is web page that explains the concept:

    • Using RSA for Signing Messages
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to solve the problem here but I don't know why my code
Here is a problem I am trying to solve: I have an irregular shape.
(see here for the problem I'm trying to solve) How do you get hibernate
I have an interesting problem here I've been trying to solve for the last
Here's a problem I've been trying to solve at work. I'm not a database
edit: I was trying to solve a spoj problem. Here is the link to
Here's my problem. I'm currently trying to develop a .Net Compact Framework 2.0 application
Here is the problem I'm trying to solve for my game. I have this
Alright, here is my problem i'm trying to solve. I have an index page
While trying to solve a two-way data binding problem in here , I found

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.