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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:31:50+00:00 2026-05-29T10:31:50+00:00

I have developed a desktop application (.NET 2.0) and it needs to get some

  • 0

I have developed a desktop application (.NET 2.0) and it needs to get some information from a server running php/mysql. The provider at server end has decided to use encryption using openssl_private_encrypt method and has provided me a publickey.pem file. I am not good at php/mysql but i do know that it would not be any different if i were using asp .net.

My question is how do i decrypt private-enrypted data in a .NET 2.0 application. All my attempts to use the RSACrypoServiceProvider with the publickey have proven unsuccessful.

I stumbled upon ManagedOpenSSL library but that was no good either.

I am certain many at StackOverflow would have done similar stuff and it would be nice o know how they did it.

Appreciate all your help in advance.

  • 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-29T10:31:51+00:00Added an answer on May 29, 2026 at 10:31 am

    Here is what i used to make it work!

                HttpWebResponse response = (HttpWebResponse) request.GetResponse();
                string responseFromServerEnc = string.Empty;
    
                byte[] data = null;
    
                if (HttpStatusCode.OK == response.StatusCode)
                {
                    MemoryStream memoryStream = new MemoryStream(0x10000);
    
                    using (Stream responseStream =            request.GetResponse().GetResponseStream())
                    {
                        byte[] buffer = new byte[0x1000];
                        int bytes;
                        while ((bytes = responseStream.Read(buffer, 0, buffer.Length)) > 0)
                        {
                            memoryStream.Write(buffer, 0, bytes);
                        }
    
                        data = memoryStream.ToArray();
                    }
    
                    response.Close();
                }
    
    
                const string pubKey = "-----BEGIN PUBLIC KEY-----\n key from .pem file \n-----END PUBLIC KEY-----";
                PemReader pem = new PemReader(new StringReader(pubKey));
                RsaKeyParameters bcp = (RsaKeyParameters)pem.ReadObject();
    
                string responseFromServer = Encoding.UTF8.GetString(Decrypt(data,bcp));
    

    And responseFromServerEnc was the encrypted message and responseFromServer was correctly decrypted.

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

Sidebar

Related Questions

I have a web application developed with ASP.net and C# that is running on
I have a basic VB.Net application that gets data from some websites and then
I have developed an asp.net application and windows desktop application system. My clients can
In the company I work for we have a desktop application developed in .NET
We have a desktop client application developed in Swing. This application interacts with backend
I come from the iPhone development world but have never developed desktop applications. Now
I have developed a Web and windows application, both in C#.NET. Now, what I
We are using ASP.Net Web services. The architecture is Desktop Based Application developed in
i have developed one windows (desktop) based application which sends pdf as an attachments.
In my C# desktop application, I am calling web services developed in php. I

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.