Exemplo n.º 1
0
    public string DeCryptUsingKey(string sKey, string sStringToDecrypt)
    {
        //this function calls the blowfish decrypt, using the given key.

        if (!string.IsNullOrEmpty(sKey) && !string.IsNullOrEmpty(sStringToDecrypt))
        {
            return(Blowfish.DecryptFromBase64(sKey, sStringToDecrypt));
        }
        else
        {
            return("");
        }
    }
Exemplo n.º 2
0
    public string EnCrypt(string sStringToEncrypt)
    {
        //the "EncryptionKey" in the web.config is an encrypted version of the actual user-defined key
        //EncryptionKey is encrypted using our hardcoded, proprietary key.

        string sKey = Blowfish.DecryptFromBase64(BLOWFISH_KEY, DatabaseSettings.EnvironmentKey);

        if (!string.IsNullOrEmpty(sKey) && !string.IsNullOrEmpty(sStringToEncrypt))
        {
            return(EnCryptUsingKey(sKey, sStringToEncrypt));
        }
        else
        {
            return("");
        }
    }