while retrun bad result!

Posted on 2006-06-30
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);
  BigDecimal AcctNum1 = (BigDecimal)row.get(0);
 String TypeC = (String)row.get(1);


cryptodata = "<Request><AccountNumber>"+ AcctNum1 +"</AccountNumber><Type>"+TypeC+"</Type><ExpireDateTime>"+dateString+"</ExpireDateTime><EmailAddress></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>


Question by:salasadi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

runa_paathak earned 25 total points
ID: 17029115
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.

Assisted Solution

tang_tzuchi earned 25 total points
ID: 17035615

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. :)

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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