int cixFileStat = 4;
Vector noEncryData = new Vector();
byte[] wrappedKey = null;
Vector encryData = new Vector();
SealedObject sealedEncryData = null;
Cell nsCell = ObjectUtil.findNewCell(mainRow, "T", "NS");
String ns = (String)nsCell.getColumnValue();
Cell pCell = ObjectUtil.findNewCell(mainRow, "T", "P");
String p = (String)pCell.getColumnValue();
Cell paCell = ObjectUtil.findNewCell(mainRow, "T", "PA");
String pa = (String)paCell.getColumnValue();
String urns = null;
String urp = null;
DAO dao = DAO.getInstance();
dao.query(Resources.SELECT_URNS_URP_FORM_P_SQL);
dao.setObject(1, ns);
dao.setObject(2, p);
ResultSet rs = dao.executeQuery();
try {
if (rs.next()) {
urns = rs.getString("URNS");
urp = rs.getString("URP");
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
String urpa = null;
dao.query(Resources.SELECT_URPA_FROM_PA_SQL);
dao.setObject(1, ns);
dao.setObject(2, p);
dao.setObject(3, pa);
rs = dao.executeQuery();
try {
if (rs.next()) {
urpa = rs.getString("URPA");
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
noEncryData.add(urns);
noEncryData.add(urp);
noEncryData.add(urpa);
encryData.add(mainRow);
PrivateKey priKey = getPriKey(ns, p, pa);
try {
KeyGenerator keyGen = KeyGenerator.getInstance("DES");
SecureRandom random = new SecureRandom();
keyGen.init(random);
SecretKey key = keyGen.generateKey();
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE,key);
sealedEncryData = new SealedObject(encryData, cipher);
cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.WRAP_MODE, priKey);
wrappedKey = cipher.wrap(key);
} catch (Exception e) {
e.printStackTrace();