Solved

while retrun bad result!

Posted on 2006-06-30
4
201 Views
Last Modified: 2010-04-01
The following code work file when the vector retrun 1 account, however, when vector retrun more then 1 record, some how the encryption did not work correctly.
I am getting the data from database then store in vector, then in my JSP retrieve the result.  while retrive the result, I  add the result to XML string then encrypted and display it in form so use can click on "Go" button to summit to the remote server.  
someone everything working when just one account retrun, but mess up when more then one account.  I put select statement in the loop to see I am getting the correct data and yes I am getting the correct record, but the encryption did not work correctly.

Thanks in advanace

Vector v = new  HBECust().getNumber(test);
Iterator i = v.iterator();
while (i.hasNext()) {
 Vector row = (Vector)i.next();
  BigDecimal AcctNum1 = (BigDecimal)row.get(0);
 String TypeC = (String)row.get(1);

PublicKey ="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
PrivateKey ="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";


cryptodata = "<Request><AccountNumber>"+ AcctNum1 +"</AccountNumber><Type>"+TypeC+"</Type><ExpireDateTime>"+dateString+"</ExpireDateTime><EmailAddress>email@email.com</EmailAddress></Request>";

 TDESEncryptor  encryptz1 = new TDESEncryptor ();


String cryptodata1 = encryptz1.Encrypt(PrivateKey,cryptodata);
String test1 ="<Wrapper><ClientId>999999</ClientId><Request>" + cryptodata1 +"</Request></Wrapper>";
cryptoPublic = encryptz1.Encrypt(PublicKey,test1);


%>

<tr bgcolor= ><td>Card Number:</td><td align=left><%= AcctNum1%></td><td>Type: <%= TypeC %></td><td>
<input type="hidden" name="test2" value="<%=cryptoPublic%>">
<input type="submit"   id=Submit3>

<%
}      

%>
0
Comment
Question by:salasadi
4 Comments
 
LVL 3

Accepted Solution

by:
runa_paathak earned 25 total points
Comment Utility
Have a statement like System.out.println("abc") inside the while loop, check if it is coming into the while loop as many times as the number of Accounts.
0
 
LVL 3

Assisted Solution

by:tang_tzuchi
tang_tzuchi earned 25 total points
Comment Utility
Hi,

You can try this:


<tr bgcolor= ><td>Card Number:</td><td align=left><%= AcctNum1%></td><td>Type: <%= TypeC %></td><td>
<input type="hidden" name="test2" value="<%=cryptoPublic%>">
<input type="submit"   id=Submit3>

<%

*****you can try to reset all variable to null or empty value at here.

}    

%>

Hope this can help you. :)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now