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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:40:51+00:00 2026-05-29T16:40:51+00:00

I have a native Win32 client application, and a .NET web application. I’d like

  • 0

I have a native Win32 client application, and a .NET web application. I’d like to be able to encrypt a string on the client (given a user supplied password), and to be able to decrypt this string on the server given the same password. My client application is 32-bit, and my .NET web application is 64-bit. On the client, I’m not able to deploy the .NET framework.

I need a simple and robust solution. By simple, I mean I’d prefer a single function call. By robust, I mean I’d like an industry standard encryption algorithm like AES, and I don’t want memory leaks.

Any suggestions on how I can accomplish this in a simple and robust way?

(Perhaps a DLL that comes in both a 32-bit and a 64-bit version? My .NET web application could P/Invoke to it, and my native application could just use it.)

  • 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-29T16:40:54+00:00Added an answer on May 29, 2026 at 4:40 pm

    I’m afraid that there is no “magic” function that will do this for both your server and the client. It is not hard to write a simple encryption / decryption scheme that will work across both though, since the algorithms are standard. Building your own will also help you to understand how the encryption and decryption works in your software.

    For .NET, you can use the System.Security.Cryptography namespace and for Win32 you should use the CryptoAPI.

    As for the encryption scheme, going by your use case, you can use a simple symmetric encryption scheme.

    Encryption:

    1. Hash the user password together with a constant salt to create a 32-bit buffer. You can use SHA256 for this. The CryptoAPI SHA256 is only supported XP SP3 and up though. Otherwise you can find many open source implementations online.
    2. Take the first 16-bytes as the key and last 16 as the IV.
    3. Use the AES CryptoProvider in the CryptoAPI to do the encryption using the key and the IV.

    Decryption:

    1. and 2. will be same as for encryption. .NET has built in classes for SHA256 that you can use for this. Doing these steps should give you the same key as you have during encryption.
    2. Use the AesCryptoServiceProvider class to decrypt the data, using the key and the IV. See example here: https://gist.github.com/1833986 (this one doesn’t use any salt).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET application that makes calls to a native Win32 DLL using
i have a native win32 c++ application which has a checkbox in it. I
I have a need to do some drawing using win32/GDI (Native, not .NET), and
I have a .NET/native C++ application. Currently, the C++ code allocates memory on the
The setup: I have a unmanaged/native Win32 application that I inject my code into.
Windows resources have a FileVersion and a ProductVersion. In native development environment(eg. Win32 app,
I have a .net application calling to a COM component (C++) which in turn
We have native Win32 C++ code and a set of C# assemblies which we
I have a number of native C++ libraries (Win32, without MFC) compiling under Visual
I have some applications (some native, some .NET) which use manifest files so that

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.