Page 1 of 1

Protected Strings strange behavior

Posted: Tue Jan 01, 2013 4:16 pm
by ggpnet
Good Day and Happy new Year

I'd like to know why when I extract Protected Strings with Enigma_IDE.cs at the end of strings appears a strange character.

Protected Strings - Enigma Protector

Image


Extracted Protected Strings

Image


with Examples - Protected Strings

Code: Select all

private void Form1_Shown(object sender, EventArgs e)
        {
            Int32 len = Enigma_IDE.EP_ProtectedStringByKey("fyi6z02Y", null, 0);
            if (len > 0)
            {
                StringBuilder str = new StringBuilder(len);
                if (Enigma_IDE.EP_ProtectedStringByKey("fyi6z02Y", str, len) > 0)
                {
                    textBox1.Text = str.ToString();                    
                }
            }

            len = Enigma_IDE.EP_ProtectedStringByID(1, null, 0);
            if (len > 0)
            {
                StringBuilder str = new StringBuilder(len);
                if (Enigma_IDE.EP_ProtectedStringByID(1, str, len) > 0)
                {
                    textBox2.Text = str.ToString();
                }
            }

            len = Enigma_IDE.EP_ProtectedStringByKey("26Lu66Er", null, 0);
            if (len > 0)
            {
                StringBuilder str = new StringBuilder(len);
                if (Enigma_IDE.EP_ProtectedStringByKey("26Lu66Er", str, len) > 0)
                {
                    textBox3.Text = str.ToString();
                }
            }
        }

Regards,
Gianfranco

Re: Protected Strings strange behavior

Posted: Thu Jan 03, 2013 9:58 am
by Enigma
Hi ggpnet, Happy New Year for you too!

I guess there is something wrong with the C# example. StringBuilder that is used there to extract the protected string requires a null terminated character in the end of the string, that is not inserting by a protection. Protection returns just a buffer with the string, and it does not cares about null terminators and so.

Take a look at the attachment, there is a new example how to extract protected strings, and few helper functions in Enigma_ide.cs file that allows to extract protected strings very easy.
It will be working well.