Custom Payment gateway in 15.1.2 throwing errors. Not a valid hex string Value is 9**********7t5

at Asi.iBO.CCrypto.ConvertStringFromHex(String hexString)
at Asi.iBO.CCrypto.DecryptHexStringViaKey(Int32 masterKeyHandle, String encryptedHex)
at Asi.iBO.CCrypto.EncryptDecrypt(String textIn, Boolean encrypt)
at Asi.iBO.CCrypto.Decrypt(String encrypted)
at Asi.iBO.SystemConfig.CPaymentAuthorizationAccount.Retrieve(CPaymentAuthorizationAccount account, SqlDataReader reader)
at Asi.iBO.SystemConfig.CPaymentAuthorizationAccount.GetAuthorizationAccounts(String connectionString)
at Asi.iBO.SystemConfig.CReferenceData.get_PaymentAuthorizationAccountList()
at Asi.iBO.Financials.CPayment.get_PaymentAuthorizationAccount()
at Asi.iBO.Commerce.PaymentGatewayService.ProcessPayment(TransactionType transactionType, CPayment payment, CAddressBasic billingAddress)
at Asi.iBO.Financials.CPayment.ProcessPayment(TransactionType transactionType, CAddressBasic billingAddress)
at Asi.Bae.Web.Checkout.Review.ProcessPaymentViaGateway(OrderCheckout& oc, Secure sc, String webmasterEmail, CPayment& payment, TransactionType transType)
<br><br>
Not a valid hex string Value is 9**********7t5
<br><br>
Asi.iBO.UnableToPerformEncryptDecryptException
<br><br>
2010-01-05 18:43:11.073
imis_train_public/Core/Cart/review.aspx
imis_train_public/Core/Cart/review.aspx
secure.org HTTP_CACHE_CONTROL:no-cache
HTTP_CONNECTION:Keep-Alive HTTP_CONTENT_LENGTH:6466
HTTP_CONTENT_TYPE:application/x-www-form-urlencoded
HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-ms-application, application/vnd.ms-xpsdocument,
application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, a
pplication/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
HTTP_ACCEPT_ENCODING:gzip, deflate
HTTP_ACCEPT_LANGUAGE:en-us
HTTP_COOKIE:__utma=98914563.145153105.1261534105.1261534105.1; __utmz=98914563.12105.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
ASP.NET_SessionId=yyjg2a55f55ucbdmwv445; Asi.Web.Browser.CookiesEnabled=true; MeetingType=SE;
Login=9B337654612383AB68AC37F34A362FE208AC18C2A727595522EDDDA1E5F83AD7C06F84E0C4

4124818BCECFB299AE9E16832C9C3F092E6E5E8C853C265C624EABED385792;

UserID=45C49BB03165D33B; FirstName=B; LastName=W; FullName=Br; Company_ID=;
Email=bw@bs.com; Organization=; SecurityGroup=AB2F4715FA1607879C75360D34684F05
HTTP_HOST:secure.org HTTP_REFERER:https://secure/imis_train_public/Core/Cart/review.aspx
HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB6.3; SLCC1; .NET CLR 2.0.50727;
Media Center PC 5.0; .NET CLR 3.0.04506; Windows-Media-Player/10.00.00.3990) HTTP_UA_CPU:x86
881285 __utma=98914563.1451535309.1261534105.1261534105.1261534105.1; __utmz=98914563.1261534105.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
ASP.NET_SessionId=yyjg2a55f55lvoucbdmwv445; Asi.Web.Browser.CookiesEnabled=true; MeetingType=SE;
Login=9B33765461AB8468A7F34A362FE208AC18C2A7275968849DDDA1E5F873084E0C4

4124818BCECFB299AE9E16832C9C3F092E658C853C265C624EABED385792;
UserID=45C49316D33B; FirstName=B; LastName=W; FullName=B W; Company_ID=;
Email=bw@bs.com;
Organization=;
SecurityGroup=AB2F4715FA16079C0D34684F05

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Are there VB6 methods to decrypt the CCAuthAcct.CCAuthPassword?

 

Ok The at Asi.iBO.CCrypto.ConvertStringFromHex checks to see if every entry in the CCAuthAcct.CCAuthPassword field is encrypted.

If any value is not encrypted then we get the error.

This is especially cumbersome because the Custom OCX does not have the ability to call the Asi.iBO.CCrypto.ConvertStringFromHex method.

Are there VB6 methods to decrypt the CCAuthAcct.CCAuthPassword?
 

Bruce M Walker

BSCI

Chicago IL

How to decrypt strCCAuthPassword = rs!CCAuthPassword

This is from the custom payment gateway  OCX.

VB6 code

 

Private Sub GetTransactionKey(strCCAuthAcctCode As String, strCCAuthURL As String, _
strCCAuthUser As String, strCCAuthPassword As String)
   

On Error GoTo CCerror:
    Dim DSN As String
    Dim Db As String
    Dim UserID As String
    Dim Password As String
    Dim rs As Recordset
    Dim strBT_ID As String
    

    RaiseEvent GetValue("lvSession.SQLHostName", DSN)
    RaiseEvent GetValue("lvSession.SQLDatabase", Db)
    RaiseEvent GetValue("lvSession.SQLUserId", UserID)
    RaiseEvent GetValue("lvSession.SQLUserPassword", Password)
    RaiseEvent GetValue("fBtId", strBT_ID)
   
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.LockType = adLockReadOnly
    rs.ActiveConnection = "PROVIDER=MSDASQL;dsn=" + DSN + ";uid=" _
        & UserID + ";pwd=" + Password + ";database=" + Db + ";"
    rs.Open "select  CCAuthAcctCode, CCAuthURL, CCAuthUser, CCAuthPassword, " & _
     " from dbo.CCAuthAcct " & _
    " where CCAuthAcctCode = 'AuthorizeDotNet' "
    strCCAuthAcctCode = rs!CCAuthAcctCode
    strCCAuthURL = rs!CCAuthURL
    strCCAuthUser = rs!CCAuthUser
    strCCAuthPassword = rs!CCAuthPassword
    strCCTest = rs!CCTest
    
        
        
    rs.Close

    Exit Sub
CCerror:
'
End Sub

Hi Walker, This is error is

Hi Walker,

This is error is not at all related to any of your VB6 OCX. It is purely related ASI.IBO.DLL, Please report to ASI.

I never tried custom payment gateway provider using 15.1.2 ver. It could be a bug

Thanks

Balaji

I am using a custom OCX and DLL with success in 15.1.2 the probl

A profile trace revealed 2 calls to the SQL

Select * from CCauthAccount

 This is then crunched by Asi.iBO.CCrypto.ConvertStringFromHex method for the 2 Custom accounts.

This is key because it is what causes the error.

An exception is thrown when either of the 2 custom gateways have an un-encrypted password in the field CCAuthAcct.CCAuthPassword. 

When the Asi.iBO.CCrypto.ConvertStringFromHex checks to see if every entry in the CCAuthAcct.CCAuthPassword field is encrypted.

If any value is not encrypted then we get the error.

This is especially cumbersome because the Custom OCX does not have the ability decrypt the field CCAuthPassword.

Are there VB6 methods to decrypt the field CCAuthAcct.CCAuthPassword ?
 

 

 

Not certain how to do this in VB6?

 

' Instantiate a Crypto object
Dim cryObject As CCrypto
Set cryObject = New CCrypto

' Initialize the Crypto object
cryObject.Init(m_strdsname, m_strSQLUserID, m_strSQLPassword)

' Decrypt the password
cryObject.Decrypt(strEncrypted, m_strDecrypted)

'

 Will also try

Desktop: CC Encryption and Password Hashing

The asiUtil component is used for string encryption

 

declare @object int
declare @hr int
declare @initreturn varchar(255)
declare @return varchar(255)
declare @src varchar(255)
declare @desc varchar(255)
declare @pwd varchar(255)

set @pwd = 'imis'

exec @hr = sp_OACreate 'ASIUtil.CCrypto',@object OUT
if @hr <> 0 goto HandleError

exec @hr = sp_OAMethod @object, 'Init', @initreturn OUT,
'[DATASOURCE_NAME]','sa',''
if @hr <> 0 goto HandleError
if @initreturn <> 0 goto HandleInitError

exec @hr = sp_OAMethod @object, 'OmnisHash', @return OUT, @pwd
if @hr <> 0 goto HandleError

select @pwd Password, @return EncryptedPassword

exec @hr = sp_OADestroy @object
if @hr <> 0 goto HandleError

HandleError:
if @hr <> 0
begin
exec sp_OAGetErrorInfo @object, @src OUT, @desc OUT
select hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
exec @hr = sp_OADestroy @object
return
end

HandleInitError:
if @initreturn <> 0
begin
select 'Error in Init(): '+@initreturn
exec sp_OADestroy @object
return
end
 

 

 

Bruce M Walker BSCI Chicago IL

VB6 snippets that might help...

Add a reference to ASIUtil.dll

Private m_ASIUtil As ASIUtil.CCrypto

...

  ' Initialize ASIUtil
    Set m_ASIUtil = New CCrypto
    lRet = m_ASIUtil.Init(DSN, UserID, Password)
    If Not lRet = 0 Then
        MsgBox ("Error initializing ASIUtil")
        Exit Sub
    End If

...
 strTemp = p_rstCashAccts!CCAuthPassword
  lRet = m_ASIUtil.Decrypt(strTemp, strResult)
 

 

Thank You That works as you expected.

Private Sub GetTransactionKey(strCCAuthAcctCode As String, strCCAuthURL As String, _
strCCAuthUser As String, strCCAuthPassword As String, strCCDebug As String)
   

On Error GoTo CCerror:

    Dim strResult As String
    Dim lRet As String
    Dim strTemp As String
    Dim DSN As String
    Dim Db As String
    Dim UserID As String
    Dim Password As String
    Dim rs As Recordset
    Dim strBT_ID As String
      'Note this is only for the Discouver card - all others will ignore it
    RaiseEvent GetValue("lvSession.SQLHostName", DSN)
    RaiseEvent GetValue("lvSession.SQLDatabase", Db)
    RaiseEvent GetValue("lvSession.SQLUserId", UserID)
    RaiseEvent GetValue("lvSession.SQLUserPassword", Password)
    RaiseEvent GetValue("fBtId", strBT_ID)
   
    Set rs = New ADODB.Recordset
    rs.CursorLocation = adUseClient
    rs.LockType = adLockReadOnly
    rs.ActiveConnection = "PROVIDER=MSDASQL;dsn=" + DSN + ";uid=" _
        & UserID + ";pwd=" + Password + ";database=" + Db + ";"
    rs.Open "select  CCAuthAcctCode, CCAuthURL, CCAuthUser, CCAuthPassword, " & _
    " case when CCAuthURL like '%test%' then 'DeBug' else  'Live'  end as CCDebug, " & _
    " case when CCAuthVerisignProxyPassword = 'True' then 'DeBug' else  'Live'  end as CCTest " & _
    " from dbo.CCAuthAcct " & _
    " where CCAuthAcctCode = 'AuthorizeDotNet' "
    strCCAuthAcctCode = rs!CCAuthAcctCode
    strCCAuthURL = rs!CCAuthURL
    strCCAuthUser = rs!CCAuthUser
    'strCCAuthPassword = rs!CCAuthPassword
    strCCDebug = rs!CCDebug
    strCCTest = rs!CCTest
   
   
    'Add a reference to ASIUtil.dll
    'Initialize ASIUtil
   
    Set m_ASIUtil = New CCrypto
    lRet = m_ASIUtil.Init(DSN, UserID, Password)
    If Not lRet = 0 Then
        MsgBox ("Error initializing ASIUtil")
        Exit Sub
    End If

    strTemp = rs!CCAuthPassword
    lRet = m_ASIUtil.Decrypt(strTemp, strResult)
    strCCAuthPassword = strResult
    'account.ProxyPassword.ToString
   
       
    rs.Close

    Exit Sub
CCerror:
'
End Sub

 

 

 

Bruce M Walker BSCI Chicago IL