Click here to Skip to main content
15,888,053 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OT: Re: YARP parser Pin
CPallini23-Nov-08 8:18
mveCPallini23-Nov-08 8:18 
GeneralRe: OT: Re: YARP parser Pin
Randor 24-Nov-08 3:48
professional Randor 24-Nov-08 3:48 
AnswerRe: xml parsing in MFC Pin
adam george16-Feb-09 23:52
adam george16-Feb-09 23:52 
QuestionElevating the process to create the file at ACCESS_DENIED Position Pin
VCProgrammer19-Nov-08 19:52
VCProgrammer19-Nov-08 19:52 
AnswerRe: Elevating the process to create the file at ACCESS_DENIED Position Pin
SandipG 19-Nov-08 20:04
SandipG 19-Nov-08 20:04 
Questionhow to change panes in status bar of a dialog box application Pin
puppya19-Nov-08 19:44
puppya19-Nov-08 19:44 
AnswerRe: how to change panes in status bar of a dialog box application Pin
Iain Clarke, Warrior Programmer19-Nov-08 21:54
Iain Clarke, Warrior Programmer19-Nov-08 21:54 
Questiondecrypting a string question [modified] Pin
monsieur_jj19-Nov-08 19:42
monsieur_jj19-Nov-08 19:42 
Hi all,

Is there a c++ version of this or at least can a c++ version of this algorithm can be made? Please advise. Can anyone give me a sample on how to use windows crypto api decryption just by inputting an encrypted string?

Thanks,
Jayjay

btw this is made of c#

public static string Decrypt(string cipherString, bool useHashing)
    {
        byte[] keyArray;
        //get the byte code of the string

        byte[] toEncryptArray = Convert.FromBase64String(cipherString);

        System.Configuration.AppSettingsReader settingsReader = new AppSettingsReader();
        //Get your key from config file to open the lock!
        string key = (string)settingsReader.GetValue("SecurityKey", typeof(String));

        if (useHashing)
        {
            //if hashing was used get the hash code with regards to your key
            MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
            keyArray = hashmd5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
            //release any resource held by the MD5CryptoServiceProvider

            hashmd5.Clear();
        }
        else
        {
            //if hashing was not implemented get the byte code of the key
            keyArray = UTF8Encoding.UTF8.GetBytes(key);
         }

        TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
        //set the secret key for the tripleDES algorithm
        tdes.Key = keyArray;
        //mode of operation. there are other 4 modes.
        //We choose ECB(Electronic code Book)

        tdes.Mode = CipherMode.ECB;
        //padding mode(if any extra byte added)
        tdes.Padding = PaddingMode.PKCS7;

        ICryptoTransform cTransform = tdes.CreateDecryptor();
        byte[] resultArray = cTransform.TransformFinalBlock
                (toEncryptArray, 0, toEncryptArray.Length);
        //Release resources held by TripleDes Encryptor
        tdes.Clear();
        //return the Clear decrypted TEXT
        return UTF8Encoding.UTF8.GetString(resultArray);
    }


modified on Thursday, November 20, 2008 3:28 AM

AnswerRe: decrypting a string question Pin
Randor 19-Nov-08 21:52
professional Randor 19-Nov-08 21:52 
GeneralRe: decrypting a string question Pin
monsieur_jj19-Nov-08 22:09
monsieur_jj19-Nov-08 22:09 
GeneralRe: decrypting a string question Pin
CPallini19-Nov-08 22:16
mveCPallini19-Nov-08 22:16 
GeneralRe: decrypting a string question Pin
monsieur_jj20-Nov-08 15:34
monsieur_jj20-Nov-08 15:34 
GeneralRe: decrypting a string question Pin
Randor 20-Nov-08 21:58
professional Randor 20-Nov-08 21:58 
GeneralRe: decrypting a string question [modified] Pin
monsieur_jj20-Nov-08 22:09
monsieur_jj20-Nov-08 22:09 
AnswerRe: decrypting a string question Pin
CPallini19-Nov-08 21:59
mveCPallini19-Nov-08 21:59 
GeneralRe: decrypting a string question Pin
monsieur_jj20-Nov-08 22:05
monsieur_jj20-Nov-08 22:05 
QuestionModifying one cell in a CListCtrl Pin
sunny_vc19-Nov-08 18:58
sunny_vc19-Nov-08 18:58 
AnswerRe: Modifying one cell in a CListCtrl Pin
Hamid_RT19-Nov-08 20:28
Hamid_RT19-Nov-08 20:28 
AnswerRe: Modifying one cell in a CListCtrl Pin
Prasann Mayekar19-Nov-08 20:32
Prasann Mayekar19-Nov-08 20:32 
AnswerRe: Modifying one cell in a CListCtrl Pin
Nishad S19-Nov-08 20:41
Nishad S19-Nov-08 20:41 
GeneralRe: Modifying one cell in a CListCtrl Pin
sunny_vc19-Nov-08 21:37
sunny_vc19-Nov-08 21:37 
GeneralRe: Modifying one cell in a CListCtrl Pin
Nishad S19-Nov-08 22:00
Nishad S19-Nov-08 22:00 
GeneralRe: Modifying one cell in a CListCtrl Pin
sunny_vc19-Nov-08 22:40
sunny_vc19-Nov-08 22:40 
GeneralRe: Modifying one cell in a CListCtrl Pin
Nishad S19-Nov-08 23:06
Nishad S19-Nov-08 23:06 
GeneralRe: Modifying one cell in a CListCtrl Pin
sunny_vc20-Nov-08 22:02
sunny_vc20-Nov-08 22:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.