Dynamics Online Payment Service

gvolkovgvolkov Member Posts: 196
edited 2014-10-08 in NAV Three Tier
Successfully implemeneted credit card processing using Dynamics Online Payment Servce in NAVR2 thru cybersource. But for some reason it only works on one workstation - one we used to set everything up.
On other computers we ge this:
The call to member Decrypt failed, mscorlib returned the following message: Bad Data.

Anyone using this service yet? Or ran into same issue? I thought perhaps it could be some security certificate mismatch since it fails to decrypt?
Microsoft Certified Technology Specialist
Microsoft Certified Business Management Solutions Professional
Microsoft Certified Business Management Solutions Specialist

http://www.navisiontech.com

Comments

  • companycompany Member Posts: 89
    Hi,

    Were you able to fix this error . i am also getting the same error message.

    please let me know.

    Thanks in advance ](*,) ](*,) ](*,) ](*,) ](*,) ](*,)
  • TListTList Member, Microsoft Employee Posts: 7
    The payment solution uses machine key based encryption. The way this works is by storing the encryption key on the machine and not in the database.
    As a result you will get data and key separation but it also means you, as an admin, need to make sure the key is distributed to the users.

    To be more specific you need to distribute the key to all NST's and to all the classic clients who encrypt (create/modify creditcard data) or decrypt (use creditcard payment) credit card data.

    The bad data message is a generic error message thrown by the underlying crypto provider and the cause is normally:
    * invalid data, the data is encrypted with a different key.
    or
    * file system permission errors on the key file (under %AllUsersProfile%\Microsoft\Crypto\RSA\MachineKeys containing the text NAV_RSAMAchineKeyProvider)

    The most common scenario for this type of error occurs if you're using the classic client and the key must be distributed to all clients.
    While the feature does not ship with an import/export functionality the automation object actually supports this.
    So adding your own code enables you to Export the key on one box and Import it on another box.

    A simple way of achieving this is by modifying codeunit 824 "Encryption Mgt." where you can add code similar to the existing encrypt and decrypt functions:
    CreateEncrypter(Encrypter);
    IF CONFIRM('Import?') THEN
      Encrypter.ImportKey('C:\Temp\mykey.key')
    ELSE
      Encrypter.ExportKey('C:\Temp\mykey.key');
    
    Then you just have to run the export on the first box and the import on all the other boxes.
  • jlandeenjlandeen Member Posts: 524
    This post helped me greatly in dealing with a support issue. As data was encrypted on one machine but was viewed and exported from another machine users were receiving the "invalid data, the data is encrypted with a different key" error message.

    To make this easier and more functional I found extending one of the pages/forms to have an "Import Key" and "Export Key" function that allows as user to quickly import and export a Key file. I then exported the key from the main server (where the data was originally encrypted) and imported it on the accounting users machine and then everything worked fine.

    Microsoft highlighted this in a MSDN article: http://msdn.microsoft.com/en-us/library/jj551764(v=nav.71).aspx
    //New Function: ExportEncrypter(ptFileName : Text[250])
    CreateEncrypter(Encrypter);
    Encrypter.ExportKey(ptFileName);
    
    //New Function: ImportEncrypter(ptFileName : Text[250])
    CreateEncrypter(Encrypter);
    Encrypter.ImportKey(ptFileName);
    
    Jeff Landeen - Sr. Consultant
    Epimatic Corp.

    http://www.epimatic.com
Sign In or Register to comment.