title: Decrypting string from Java in C#
body: <p>Here is the code from Java:</p>
  
  <pre><code>public static String encrypt(String strToEncrypt)
  {
      try
      {
          String secretKey = "1234567890123456";
          DESKeySpec keySpec = new DESKeySpec(secretKey.getBytes("UTF8"));
          SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
          SecretKey key = keyFactory.generateSecret(keySpec);
          BASE64Encoder base64encoder = new BASE64Encoder();
          byte[] cleartext = strToEncrypt.getBytes("UTF8");
          Cipher cipher = Cipher.getInstance("DES");
          cipher.init(Cipher.ENCRYPT_MODE, key);
          String encrypted = base64encoder.encode(cipher.doFinal(cleartext));
          return encrypted;
  
      }
      catch (Exception e)
      {
          return e.getMessage();
      }
  }
  </code></pre>
  
  <p>How can I decrypt it in C#? Tried the solution:</p>
  
  <p><a href="https://stackoverflow.com/questions/19698272/encrypt-in-java-and-decrypt-in-c-sharp-for-aes-256-bit">Encrypt in java and Decrypt in C# For AES 256 bit</a></p>
  
  <p>but it didn't work. </p>