Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFPEncryption.fll implementation
Message
 
 
À
14/10/2014 11:44:53
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2008
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01609313
Message ID:
01609331
Vues:
36
>>>>In a VFP application I use VFPEncryption.fll to encrypt a password string.
>>>>Now I need to be able to use the password from a .NET application (C#), so I need to decrypt the string that is saved in the table using C#. I wonder if there is an equivalent code for the decryption when the string was encrypted with VFPEncryption?
>>>>
>>>>The only workaround would be to create a com object from VFP, but if there is an easier solution I would be glad.
>>>
>>>
>>>Depending on what you're using you may be able to use RijndaelManaged http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged(v=vs.110).aspx
>>
>>Thanks, that seems to be the right way. However I do not understand how to deal with the "Salt" variable, since in the VFPEncryption we don't use that. We only have the string and the password, however the class in .NET requires the salt to be 8 bytes.
>>
>>var algorithm = new RijndaelManaged { KeySize = 256, BlockSize = 128 };
>>var key = new Rfc2898DeriveBytes(password, Encoding.ASCII.GetBytes(""));
>>
>>In the second line it says "Salt is not at least eight bytes". When I put in 8 spaces or 8 zeros it does not throw an error, but the resulting string is completely incorrect. Do you have any idea what could be the "Default" salt?
>
>
>I'll have a look at it in the morning
>
>But first, before I can say anything useful - I have to see the vfp code used to both encrypt and decrypt
>
>UPDATE
>
>And an example - with hex output

The code is just using the defaults (the security requirements are very low):
AES256
ECB
LOCAL lcString, lcKey, lcEncryptedString
lcString = "Hello World"
lcKey = "abcdefghijasdflkgdfkisluguslijon"
lcEncryptedString = Encrypt (lcString, lcKey) && Result: ÕÖì/ŸŒ@‘PŒ{'VûGuï…‰È*RÞÖ¸‚þ.÷}
lcString = Decrypt(lcEncryptedString, lcKey) && Result: Hello World
Christian Isberner
Software Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform