In multiuser/network
environments, this is the method ICVERIFY
software and third-party applications use to communicate with the master
station (in simple terms, the station that is connected to the modem). This
interface can be used for ICVERIFY.
Request-and-answer files:
- Contain one transaction record per line, which
may be a normal Request file or XML based file
- Can be virtually unlimited in length
- Can access any of the ICVERIFY
commands and functions
- The request file may be
encrypted with AES encryption. If the request file is encrypted then the
answer file will also be encrypted
- In MasterStation/Substation
mode the request file generated will always be encrypted
- Third party application can encrypt the request files and decrypt
the answer files by integrating with the ICVTnsClient
library
Using the Request and Answer File Method:
To use request and answer files in
multi-user/network installations:
Under Windows:
Select “ICVERIFY Multi User” from the ICVERIFY program group (or run
ICVMLT32.EXE).
See the Online user manual for a detailed
description of this configuration.
The system on which the multi-user ICVERIFY application is running is defined
as the master station. The master station will periodically poll a specified
directory (known as the “request directory”) for request files. This
directory will be shared with application workstations for networked configurations.
When the application needs a request
processed, it creates a request file containing the desired transaction record
and writes it to the request directory. See Transaction Processing for a
description of transaction records. ICVERIFY
reads the file, processes the request and returns a transaction response in an
answer file (.ANS) in the same directory. The application can then process the
answer file.
Request files processed in this manner are
given the name “ICVERxxx.REQ”, where
“xxx” refers to a station number. Single-user versions of ICVERIFY support only ICVER001.REQ.
Multi-user/network installations support ICVER001.REQ, ICVER002.REQ, etc. No
station should have a number less than 001 nor greater
than the maximum number of authorized users (versions supporting up to 999
stations are available).
Note: Avoid using long file names in the
path to the request and answer file directory.
Encrypt
the Request file by Third Party Application
.Net
User
First create the request file. Now
create a .Net application. To add the
reference of the ICVTnsClient DLL, right click
References in the Visual Studio .NET Solution Explorer and click Add Reference
for the Add Reference dialog box. From the Add Reference dialog select the
ICVTnsClient.dll.
Now, to encrypt a request string use
a) public string Encrypt(string
requestContent)
Here requestContent
is the string that needs to be encrypted.
TO ENCRYPT THE STRING:
(Sample
code is written in C#.Net)
// Initialize Tcp Client to communicate with Tns Server
SslTcpClient sslTcpClient = new
SslTcpClient();
// File name format that ICVERIFY
understand for request processing
string csFileName =
“\\icver001.req”;
// Request directory path where the plain text request files
will be
// read for encryption
string txtReqDirPath =
“SourceDir”;
if (!Directory.Exists(txtReqDirPath))
{
Console.WriteLine(“Source
directory not found.”);
Console.WriteLine(“Press any
key to exit …”);
Console.ReadKey();
Environment.Exit(0);
}
string csReqReadPath = txtReqDirPath + csFileName;
// Shared directory path where file is
being created.
string txtSharedDirPath = “EncDir”;
if (!Directory.Exists(txtSharedDirPath))
Directory.CreateDirectory(txtSharedDirPath);
string csSharedDirPath = txtSharedDirPath + csFileName;
// Request directory
path where file will be used by ICVERIFY for
// transaction
processing.
string txtReqPath = “ReqDir”;
if (!Directory.Exists(txtReqPath))
Directory.CreateDirectory(txtReqPath);
string csReqPreparationPath = txtReqPath
+ csFileName;
// Check presence of Req files
if(!File.Exists(csReqReadPath))
{
Console.WriteLine(“Req
file [icver001.req] not found in source directory.”);
Console.WriteLine(“Press any
key to exit …”);
Console.ReadKey();
Environment.Exit(0);
}
// Object of StreamWriter
StreamWriter objWriter = null;
// Create an empty file in shared
directory path
FileStream objFileStream = new
FileStream(csSharedDirPath,
FileMode.Create,
FileAccess.Write);
objWriter = new
StreamWriter(objFileStream);
// Open plain text request files for
reading
StreamReader objReader = null;
FileStream objFileReadStream = new
FileStream(csReqReadPath,
FileMode.Open,
FileAccess.Read);
objReader = new
StreamReader(objFileReadStream);
string csStringToEncrypt = string.Empty;
int reqCount = 0; // Counter for the
number of req lines in source file
DateTime startTime = System.DateTime.Now;
// Start time
// Read each line in plain text file and
call TnsServer for encryption
do
{
csStringToEncrypt
= objReader.ReadLine();
if
(!string.IsNullOrEmpty(csStringToEncrypt))
{
//
Encryption Process – Call TnsServer on Master station
string csEncryptedString =
sslTcpClient.Encrypt(csStringToEncrypt.Trim());
// Write encrypted request in
destination file
if
(!string.IsNullOrEmpty(csEncryptedString))
objWriter.WriteLine(csEncryptedString);
reqCount++;
}
} while
(!string.IsNullOrEmpty(csStringToEncrypt));
if (objWriter != null)
objWriter.Close();
if (objReader != null)
objReader.Close();
DateTime endTime = System.DateTime.Now;
// End time
TimeSpan timeElapsed =
endTime.Subtract(startTime);
// Once all the encrypt strings have been
written in file, move that
// file into the request directory for processing.
if (File.Exists(csReqPreparationPath))
File.Delete(csReqPreparationPath);
// Delete file if present
File.Move(csSharedDirPath, csReqPreparationPath);
To decrypt the
generated answer file use
b) public string Decrypt(string requestContent)
Here, requestContent
is the string that needs to be decrypted.
TO DECRYPT THE STRING:
(Sample code is
written in C#.Net)
// Initialize Tcp Client to communicate with Tns Server
SslTcpClient sslTcpClient = new
SslTcpClient();
// File name format that ICVERIFY
understand for request processing
string csFileName =
“\\icver001.ans”;
// Request directory path where the plain
text request files will be
// read for encryption
string txtReqDirPath =
“SourceDir”;
if
(!Directory.Exists(txtReqDirPath))
{
Console.WriteLine(“Source
directory not found.”);
Console.WriteLine(“Press any
key to exit …”);
Console.ReadKey();
Environment.Exit(0);
}
string csReqReadPath = txtReqDirPath + csFileName;
// Shared directory path where file is
being created.
string txtSharedDirPath =
“EncDir”;
if (!Directory.Exists(txtSharedDirPath))
Directory.CreateDirectory(txtSharedDirPath);
string csSharedDirPath = txtSharedDirPath + csFileName;
// Request directory path where file will
be used by ICVERIFY for
// transaction processing.
string txtReqPath = “ReqDir”;
if (!Directory.Exists(txtReqPath))
Directory.CreateDirectory(txtReqPath);
string csReqPreparationPath = txtReqPath + csFileName;
// Check presence of Ans files
if (!File.Exists(csReqReadPath))
{
Console.WriteLine(“Answer
file [icver001.ans] not found in source directory.”);
Console.WriteLine(“Press any
key to exit …”);
Console.ReadKey();
Environment.Exit(0);
}
// Object of StreamWriter
StreamWriter objWriter = null;
// Create an empty file in shared directory path
FileStream objFileStream = new
FileStream(csSharedDirPath,
FileMode.Create,
FileAccess.Write);
objWriter = new
StreamWriter(objFileStream);
// Open plain text request files for reading
StreamReader objReader = null;
FileStream objFileReadStream = new
FileStream(csReqReadPath,
FileMode.Open,
FileAccess.Read);
objReader = new
StreamReader(objFileReadStream);
string csStringToEncrypt = string.Empty;
int
reqCount = 0; // Counter for the number of req lines in source file
DateTime startTime = System.DateTime.Now;
// Start time
// Read each line in plain text file and
call TnsServer for encryption
do
{
csStringToEncrypt
= objReader.ReadLine();
if
(!string.IsNullOrEmpty(csStringToEncrypt))
{
//
Encryption Process – Call TnsServer on Master station
string csEncryptedString =
sslTcpClient.Decrypt(csStringToEncrypt.Trim());
// Write encrypted request in
destination file
if
(!string.IsNullOrEmpty(csEncryptedString))
objWriter.WriteLine(csEncryptedString);
reqCount++;
}
} while (!string.IsNullOrEmpty(csStringToEncrypt));
if (objWriter != null)
objWriter.Close();
if (objReader != null)
objReader.Close();
DateTime endTime = System.DateTime.Now;
//End time
TimeSpan timeElapsed =
endTime.Subtract(startTime);
// Once all the encrypt strings have been
written in file, move that
// file into the request directory for processing.
if (File.Exists(csReqPreparationPath))
File.Delete(csReqPreparationPath);
// Delete file if present
File.Move(csSharedDirPath,
csReqPreparationPath);
C++
or VB User
First create the request file. Now create a C++/VB
application. Use the ICVTnsClient.dll in the following way:
Generation of .tlb file
Since the ICVTnsClient.dll is a .NET component .tlb of the same has to be generated and registered using
regasm.exe (.Net framework tool). This .tlb file has
to be included in the C++/VB code and a new instance has to be created.
Request File Processing Transition
The flow chart below describes how the ICVERxxx.REQ gets processed into ICVERxxx.ANS
file.