Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting equivalent of VB.NET decryption function in VFP
Message
De
17/03/2006 17:22:14
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01105441
Message ID:
01105453
Vues:
25
>Craig Boyd have a VFPEncryption FLL posted in his BLOG. I am not sure what method .NET encryption used, but in Craig's Encryption library there are many methods included.
>http://www.sweetpotatosoftware.com/SPSBlog/PermaLink,guid,b1281831-9655-47f6-9366-be849b9f4598.aspx

That FLL is depending of some C++ modules installed. I am looking for some code in VFP that can be ready to go without installing anything else.

I also have another encryption class in .NET that uses a little bit less code with a different approach. Maybe that approach can be easier for someone to translate it to VFP.
    Public Shared Function Decrypt(ByVal tcString As String, ByVal sDecrKey As String) As Boolean
        Dim llSuccess As Boolean
        Dim des As New TripleDESCryptoServiceProvider
        Dim hashmd5 As New MD5CryptoServiceProvider
        llSuccess = False
        cDecrypt = ""
        Try
            des.Key = hashmd5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(sDecrKey))
            des.Mode = CipherMode.ECB
            Dim desdencrypt As ICryptoTransform = des.CreateDecryptor()
            Dim buff() As Byte = Convert.FromBase64String(tcString)
            cDecrypt = ASCIIEncoding.ASCII.GetString(desdencrypt.TransformFinalBlock(buff, 0, buff.Length))
            llSuccess = True
        Catch loError As Exception
            App.ErrorSetup(loError)
            If App.cError.StartsWith("Bad Data") Then
                App.cError = "You didn't encrypt the XML string with a valid key."
            End If
            If App.cError.StartsWith("Invalid character in a Base-64 string") Then
                App.cError = "Unable to decrypt that data."
            End If
        End Try
        Return llSuccess
    End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform