troubleshooting Question

VB6 - crypto api advapi.dll - doesn't work in japanese?

Avatar of SweatCoder
SweatCoderFlag for United States of America asked on
Visual Basic Classic
18 Comments1 Solution577 ViewsLast Modified:
I have a vb6 crypto module that works great on a standard American windows 2003 server. but when i run it on a Japanese Windows 2003, all the crypto strings get mangled.

How can I resolve this?

Here's a partial example of the top portion of my component:

Private Const lngALG_CLASS_DATA_ENCRYPT                 As Long = 24576&
Private Const lngALG_CLASS_HASH                         As Long = 32768
Private Const lngALG_SID_MD5                            As Long = 3&
Private Const lngALG_SID_RC4                            As Long = 1&
Private Const lngALG_TYPE_ANY                           As Long = 0&
Private Const lngALG_TYPE_STREAM                        As Long = 2048&
Private Const lngCALG_MD5                               As Long = ((lngALG_CLASS_HASH Or lngALG_TYPE_ANY) Or lngALG_SID_MD5)
Private Const lngCALG_RC4                               As Long = ((lngALG_CLASS_DATA_ENCRYPT Or lngALG_TYPE_STREAM) Or lngALG_SID_RC4)
Private Const lngCRYPT_NEWKEYSET                        As Long = 8&
Private Const lngENCRYPT_ALGORITHM                      As Long = lngCALG_RC4
Private Const lngPROV_RSA_FULL                          As Long = 1&
Private Const strKEY_CONTAINER                          As String = "TestString"
Private Const strSERVICE_PROVIDER                       As String = "Microsoft Base Cryptographic Provider v1.0"
Private Const strMODULE_NAME                            As String = "clsCryptography"
Private Const lngERR_NUMBER_SUCCESS                     As Long = 0
Private Const strEncryptionPassword                     As String = "[removed]"

Private Declare Function CryptAcquireContext Lib "advapi32.dll" _
   Alias "CryptAcquireContextA" ( _
   ByRef phProv As Long, _
   ByVal pszContainer As String, _
   ByVal pszProvider As String, _
   ByVal dwProvType As ProviderType, _
   ByVal dwFlags As AquireContextFlags) As Long

                         
Private Declare Function CryptCreateHash Lib "advapi32.dll" _
    (ByVal hProv As Long, _
     ByVal Algid As Long, _
     ByVal hKey As Long, _
     ByVal dwFlags As Long, _
     ByRef phHash As Long) As Long
                         
Private Declare Function CryptHashData Lib "advapi32.dll" _
    (ByVal hHash As Long, _
     ByVal pbData As String, _
     ByVal dwDataLen As Long, _
     ByVal dwFlags As Long) As Long

[. . .much more]
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros