Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


while retrun bad result!

Posted on 2006-06-30
Medium Priority
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);


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>


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 100 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 100 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

With its various features, Office 365 can not only help you with your day-to-day business tasks, it can also do wonders for your marketing campaign.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

636 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