Eddieb337
Member
Im upgrading an app from VB6 to VB .NET. The problem is i have smartcards with encrypted ansi strings on them. I pass these strings from the smartcard to the app to be decrypted.
In VB6:
strCfr = StrConv(strCfr, vbFromUnicode)
status = TDciph321.DecryptString(strCfr, LenB(strCfr))
This was a piece of cake using StrConv. In VB .NET I load the ANSI strings from the card but cannot pass them into the DecryptString method as an ANSI string. I can only pass them as Unicode strings which turns out to be a garbled mess when they are decrypted. I can only convert strCfr to an ANSI byte array but DecryptString will only take a string. I dont think i can Declare or use DllImport to make DecryptString an ansi function because it is not static but an instance method of TDciph321 which comes from TDCIPH32Lib. The question is how can i force DecryptString to behave as it should or force it to accept an ANSI string. Whats worse is that DecryptString works right on the parameter string you pass in, its an In/Out param. Thanks in advance to anyone who may be able to help.
Ed
In VB6:
strCfr = StrConv(strCfr, vbFromUnicode)
status = TDciph321.DecryptString(strCfr, LenB(strCfr))
This was a piece of cake using StrConv. In VB .NET I load the ANSI strings from the card but cannot pass them into the DecryptString method as an ANSI string. I can only pass them as Unicode strings which turns out to be a garbled mess when they are decrypted. I can only convert strCfr to an ANSI byte array but DecryptString will only take a string. I dont think i can Declare or use DllImport to make DecryptString an ansi function because it is not static but an instance method of TDciph321 which comes from TDCIPH32Lib. The question is how can i force DecryptString to behave as it should or force it to accept an ANSI string. Whats worse is that DecryptString works right on the parameter string you pass in, its an In/Out param. Thanks in advance to anyone who may be able to help.
Ed