General information
Category:
Windows API functions
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only