views:

163

answers:

2

I'm building an installer using InstallScript MSI project. During installation I save some information to a local file. This file is created based on the user's preferences and it may contain sensitive information.

I would like to encrypt this information but couldn't find any InstallScript function to handle this. I know I can have feature files encrypted, but this file is create during installation and is not a part of a specific feature.

Does anyone know of a way to encrypt strings using InstallScript?

Thanks!

+1  A: 

Like KMoraz wrote - I don't know of a builtin function for this.

For what it's worth - the way I do it is by using an external COM DLL to do the encryption/decryption for me.
You will of course need to obtain/create such a DLL to use and deploy it with the installation.
(I use pure installscript installation - not MSI)

function STRING Encryption(bEncrypt,sInput)
    STRING  sEncryptionKey, sResult;
    OBJECT  oEncryption;
begin 
    try 
        // create encryption key
        sEncryptionKey = "key";

        // create COM object
        set oEncryption = CoCreateObject("Encryption");
        if (IsObject(oEncryption)) then
            // set encryption key
            oEncryption.Initialize(sEncryptionKey);
            if (bEncrypt = TRUE) then
                sResult = oEncryption.Encode(sInput);
            else    
                sResult = oEncryption.Decode(sInput);
            endif;
        endif;
        // free object
        set oEncryption = NOTHING;
    catch
        sResult = "";
    endcatch;

    return sResult;
end;

Hope this helps in any way.

Dror
Thanks for the response! Eventually InstallShield was so difficult to work with we simply moved to Wix... :)
Tamar
Yes, I know what you are talking about - it's not very pleasant.
Dror
A: 

Can u send me sample of the code inside installshield to run this DLL-Function?

Thank in advance... I need it as soon as possible...PLEASEEEE!! :)