代码之家  ›  专栏  ›  技术社区  ›  Tamar

如何使用InstallScript加密字符串

  •  0
  • Tamar  · 技术社区  · 15 年前

    我正在使用InstallScript MSI项目构建安装程序。在安装过程中,我将一些信息保存到本地文件中。此文件是根据用户的首选项创建的,它可能包含敏感信息。

    我想加密此信息,但找不到任何installscript函数来处理此信息。我知道我可以加密功能文件,但是这个文件是在安装过程中创建的,不是特定功能的一部分。

    有人知道使用installscript加密字符串的方法吗?

    谢谢!

    1 回复  |  直到 14 年前
        1
  •  1
  •   Dror Big McLargeHuge    14 年前

    喜欢 克莫拉兹 我不知道这里面有什么函数。

    为了它的价值-我这样做的方式是使用一个外部的COM DLL为我进行加密/解密。
    当然,您需要获取/创建这样一个DLL,以便在安装时使用和部署它。
    (我使用纯installscript安装-不是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;
    

    希望这有任何帮助。