Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top