Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encryption problems with xp
Message
From
02/02/2004 10:24:58
Jonathan Cochran
Alion Science and Technology
Maryland, United States
 
 
To
30/01/2004 15:57:14
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00872528
Message ID:
00872952
Views:
21
We had this problem with some VB code and fixed it a year or two ago. The fix was to name a specific provider, not a generic one, which you appear to be doing with "this.oCrypto.cProviderName". Look in the code for your _crypt.vcx and look for a call to CryptAcquireContext and ensure that the provider is being passed to it (it should be the 3rd parameter).

>I have an application that uses a very simple encryption to hide login passwords. The encryption routine is based on the built in windows security as outlined in an Advisor article some time ago. The class code is:
>
>PUBLIC oEncoder
>#DEFINE T_CHARACTER "C"
>#DEFINE T_NUMERIC "N"
>#DEFINE T_DOUBLE "B"
>
>oEncoder = CREATEOBJECT("encoder")
>
>define class encoder as session
> oCrypto = .f.
> cKey = .F.
>
> procedure init
> this.oCrypto = newobject("_cryptapi", ".\classes\_crypt.vcx")
> this.oCrypto.cProviderName = "Microsoft Base Cryptographic Provider v1.0"
> this.cKey = "VFPRocks!"
> endproc
>
> function EncryptValue( cOriginalValue )
> local lcCipher, luResult
> lcCipher = ""
> lcText = trim(cOriginalValue)
> luResult = this.oCrypto.encryptSessionBlockString(lcText, this.cKey, @lcCipher)
> RETURN lcCipher
> endfunc
>
> function DecryptValue( cEncryptedValue )
> local lcCipher, luResult
> lcText = ""
> lcCipher = trim(cEncryptedValue)
> luResult = this.oCrypto.decryptSessionBlockString(lcCipher, this.cKey, @lcText)
> RETURN lcText
> endfunc
>
>enddefine
>
>and this works fine with win98 and win2000. It also works with winXP except that the returned values are different than with the older versions of windows. Consequently if the original authorization was with 98 or 2000, XP will not allow the login.
>
>Does anyone know a work around for this situation?
>
>Thanks in advance.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform