Link to home
Start Free TrialLog in
Avatar of salasadi
salasadi

asked on

while retrun bad result!

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>

<%
}      

%>
ASKER CERTIFIED SOLUTION
Avatar of runa_paathak
runa_paathak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial