Colorized Source Code
<%@ page language="java" %>
<%@ page contentType="text/html; charset=ISO-8859-1" %>
<%@ page import="com.mobipocket.drm.Crypto" %>
<%
/*----------------------------------------
Generation of Hash Code
for New Transaction
web
service ----------------------------------------
*/
String PlainData;
String HashCode;
String CommerceID;
String RetailerKey;
String BookID;
String RetailerTrans;
String RetailerUserID;
CommerceID = "MyCommerceID"; // replace this string by your CommerceID
RetailerKey= "Mykey"; // replace this string by your retailer private key
BookID = "6716";RetailerTrans = "125"; //replace this by the purchase transaction ID in your system
RetailerUserID = "75860";
// Step 1. make the Plain DATA string CommerceID+RetailerUserID+BookId+RetailerTrans
PlainData = CommerceID + RetailerUserID + BookID + RetailerTrans;
//Step 2. encode the Plain DATA string
Crypto c = new Crypto();
c.setKey(RetailerKey.getBytes());
HashCode = c.encode(PlainData);
%>
|