Solved

while retrun bad result!

Posted on 2006-06-30
4
205 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
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.
0
 
LVL 3

Assisted Solution

by:tang_tzuchi
tang_tzuchi earned 25 total points
ID: 17035615
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

919 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

14 Experts available now in Live!

Get 1:1 Help Now