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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:11:43+00:00 2026-05-29T11:11:43+00:00

I am trying to decrypt data using tripleDes. Everything looks fine but it has

  • 0

I am trying to decrypt data using tripleDes. Everything looks fine but it has some invalid characters at the beginning? What am I doing wrong? For same data if call this function again and again these first few characters are always different but the rest of the data is same.

I am passing useHashing to false.

public static byte[] GetTripleDesDecryption(string dataToDecrypt, byte[] key, bool useHashing)
    {
        byte[] keyArray;
        byte[] plainbytes = null;
        byte[] cipherbytes;

        try
        {
            if (useHashing)
            {
                MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
                keyArray = hashmd5.ComputeHash(key);
                hashmd5.Clear();
            }
            else
                keyArray = key;

            using (TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider())
            {
                tdes.Key = keyArray;
                tdes.Mode = CipherMode.CBC;
                tdes.Padding = PaddingMode.None;

                using (ICryptoTransform cTransform = tdes.CreateDecryptor())
                {
                    cipherbytes = Convert.FromBase64String(dataToDecrypt);
                    plainbytes = cTransform.TransformFinalBlock(cipherbytes, 0, cipherbytes.Length);
                }
            }
        }
        catch (Exception e)
        {
            LogMessage(e.Message + " Attribute Parsing error. DataToDecrypt = " + dataToDecrypt);
            throw e;
        }
        return plainbytes;
    }

This is what I get:

"�{c��]�sertion xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"><saml:AttributeStatement><saml:Attribute Name=\"userID\"><saml:AttributeValue>456</saml:AttributeValue></saml:Attribute><saml:Attribute Name=\"financialInstitutionNumber\"><saml:AttributeValue>303986258</saml:AttributeValue></saml:Attribute><saml:Attribute Name=\"password\"><saml:AttributeValue>galaxy</saml:AttributeValue></saml:Attribute></saml:AttributeStatement></saml:Assertion>   "
  • 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-29T11:11:44+00:00Added an answer on May 29, 2026 at 11:11 am

    I think that the C# classes use a random IV if it is not set. Try to set the IV to a byte array of 8 bytes valued 00h bytes and try to decrypt with that. If that does not work, you will have to retrieve the IV somehow.

    PS the right way is of course to request the blocksize from the tdes instance instead of putting in the literal 8

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

Sidebar

Related Questions

I'm trying to encrypt and decrypt data using RSA in C#. I have the
I am trying to pass some encrypted data to a flash , but I
I am trying to write a stored procedure to decrypt some data encrypted by
I'm trying to encrypt some data from python (Google App Engine) and then decrypt
I have a directory and in it has several files. I'm trying to decrypt
Trying to do this sort of thing... WHERE username LIKE '%$str%' ...but using bound
I am trying to make a program that Encrypts data using AES, then encrypts
I am trying the most basic thing - encrypt data using the public key
I am trying to decrypt using gpg.exe --passphrase-file my.passphrase --decrypt --output MTR241_20111124.htm MTR241_20111124.htm.gpg (without
I am trying to write encrypt/decrypt methods for AES 256 CBC encryption using PKCS5Padding

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.