Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help with C# to VFP translation
Message
 
 
À
20/06/2010 23:20:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrats & ententes
Divers
Thread ID:
01469828
Message ID:
01469838
Vues:
143
Thanks Michael; Here it is:
________________________________________________________________________________________________
TO ENCRYPT THE STRING:

(Sample code is written in C#.Net)

// File name format that ICVERIFY understand for request processing
string csFileName = "\\icver001.req";
// Shared directory path where file is being created.
string txtSharedDirPath = "C:\\Shared Directory";
string csSharedDirPath = txtSharedDirPath + csFileName;
/*
// Request directory path where file will be used by
// ICVERIFY for transaction processing.
*/
string txtReqPath = "C:\\Request Directory";
string csReqPreparationPath = txtReqPath + csFileName;
// Object of StreamWriter
StreamWriter objWriter = null;
// This code is creating an empty file in shared directory path
FileStream objFileStream = new FileStream(csSharedDirPath, FileMode.Create, FileAccess.Write);
objWriter = new StreamWriter(objFileStream);
/*
// To call EncryptionManager.dll to encrypt string
// EncryptionManager.dll will use the creation date of the
// file that was being created in shared directory path.
*/
string csStringToEncrypt = "Some string";
EncryptionManager objEncryptionManager = new EncryptionManager();
string csEncryptedString = objEncryptionManager.EncryptThirdPartyMessage(csSharedDirPath, csStringToEncrypt);
// To write the encrypted string in the file
objWriter.WriteLine(csEncryptedString);
if (objWriter != null)
objWriter.Close();
/*
// Once all the encrypt strings have been written in file,
// move that file into the request directory for processing.
*/
File.Move(csSharedDirPath, csReqPreparationPath);
________________________________________________________________________________________________

TO DECRYPT THE STRING:

(Sample code is written in C#.Net)
// File name that need to be decrypted
string csFileName = "\\icver001.ans";
// Shared directory path where decrypted file will be created.
string txtSharedDirPath = "C:\\Shared Directory";
string csSharedDirPath = txtSharedDirPath + csFileName;
/*
// Request directory path where file that needs to be
// decrypted is present.
*/
string txtReqPath = "C:\\Request Directory";
string csReqPreparationPath = txtReqPath+ csFileName;
// object of StreamWriter
StreamWriter objWriter = null;
// This code is creating an empty file in shared directory path
FileStream objFileWriteStream = new FileStream(csSharedDirPath, FileMode.Create, FileAccess.Write);
objWriter = new StreamWriter(objFileWriteStream);
StreamReader objReader = null;
FileStream objFileReadStream = new FileStream(csReqPreparationPath, FileMode.Open, FileAccess.Read);
objReader = new StreamReader(objFileReadStream);
/*
// To call EncryptionManager.dll to decrypt string
// EncryptionManager.dll will use the creation date of the
// file that was being created in Request directory path.
*/
EncryptionManager objEncryptionManager = new EncryptionManager();
string strDecString = "";
string strEncString = "";
while (((strEncString = objReader.ReadLine()) != null))
{
strDecString = objEncryptionManager.DecryptThirdPartyMessage(csReqPreparationPath, strEncString);
objWriter.WriteLine(strDecString);
}
if (objReader != null)
objReader.Close();
if (objWriter != null)
objWriter.Close();
________________________________________________________________________________________________

And they had me run the following to register the DLLs in Windows Command Prompt:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\IcvGacUtil /i C:\ICVERIFY\ICWin403\SecurityService.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\ICVERIFY\ICWin403\SecurityService.dll /tlb
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\IcvGacUtil /i C:\ICVERIFY\ICWin403\EncryptionManager.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm C:\ICVERIFY\ICWin403\EncryptionManager.dll /tlb
________________________________________________________________________________________________

Pease let me know the cost, so you can just put it on my card.
Thanks
Cyrus


>>I am trying to use an External DLL (supplied by a Payment Transaction company ICVerify) to
>>
>>a) convert a String Variable into an encrypted file, and then
>>b) Decrypt the File into a String variable.
>>
>>They don't have a VFP sample code, but they have supplied Sample Code in C#.
>>It is about 5 to 10 commands. I need to have the C# code translated into VFP code and then some help in getting it to run.
>>
>>Please let me know asap.
>
>Could you simply paste the code in here?
Cyrus Nima
-------------------
cyrusnima@gmail.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform