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

  • Home
  • SEARCH
  • 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 1045565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:00:18+00:00 2026-05-16T16:00:18+00:00

We have a .NET application that needs to pass some data over to a

  • 0

We have a .NET application that needs to pass some data over to a Java app. We are wanting to give it some simple encryption, M.C. Hawking wont be hacking in but it needs to not be plain text.

I found some great Java code that lets me encrypt/decrypt using AES. What I am hoping to find is the matching peice of this for C# that will let me Encrypt a string that will be decryptable with my Java routine.

Here is my java class:

class SimpleProtector
{    
   private final String ALGORITHM = "AES";    
   private final byte[] keyValue = new byte[] { 'T', 'h', 'i', 's', 'I', 's', 'A', 'S', 'e', 'c', 'r', 'e', 't', 'K', 'e', 'y' };     
   public String encrypt(String valueToEnc) throws Exception
   {        
      Key key = generateKey();        
      Cipher c = Cipher.getInstance(ALGORITHM);        
      c.init(Cipher.ENCRYPT_MODE, key);        
      byte[] encValue = c.doFinal(valueToEnc.getBytes());        
      String encryptedValue = new BASE64Encoder().encode(encValue);        
      return encryptedValue;
   }    

   public String decrypt(String encryptedValue) throws Exception
   {        
      Key key = generateKey();        
      Cipher c = Cipher.getInstance(ALGORITHM);        
      c.init(Cipher.DECRYPT_MODE, key);        
      byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedValue);       
      byte[] decValue = c.doFinal(decordedValue);        
      String decryptedValue = new String(decValue);        
      return decryptedValue;    
   }    

   private Key generateKey() throws Exception
   {        
      Key key = new SecretKeySpec(keyValue, ALGORITHM);        
      return key;    
   }
}

Thanks for any tips!

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

    See answers to this question: Using AES encryption in C#

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

Sidebar

Related Questions

I have a .NET console application that needs to generate some HTML files. I
I have a WinForms application written in C# for .NET 3.5 that needs to
I have a .NET application that contains a checkbox (System.Windows.Forms.Checkbox). This component (WindowsForms10.BUTTON.app.0.378734a1) is
I have a .NET application that uses some API calls, for example GetPrivateProfileString .
I am working on a simple cart application that needs the ability to pass
I have .NET application that is hosted on IIS 6.1 It is impossible to
I have a .NET application that I want to use as a client to
We have a .net application that we didn't develop, but use. I can tell
I have a .Net application that dynamically creates a small HTML page and pops
I have a .net application that is not working on a colleagues computer (he

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.