HBCIUtils.log("trying to encrypt message",HBCIUtils.LOG_DEBUG);
HBCIUtilsInternal.getCallback().status(mainPassport,HBCICallback.STATUS_MSG_CRYPT,null);
// nachricht verschl�sseln
MSG old=msg;
Crypt crypt=CryptFactory.getInstance().createCrypt(getParentHandlerData(),old);
try {
msg=crypt.cryptIt("Crypted");
} finally {
CryptFactory.getInstance().unuseObject(crypt);
if (msg!=old) {
MSGFactory.getInstance().unuseObject(old);
}
}
if (!msg.getName().equals("Crypted")) {
String errmsg=HBCIUtilsInternal.getLocMsg("EXCMSG_CANTCRYPT");
if (!HBCIUtilsInternal.ignoreError(null,"client.errors.ignoreCryptErrors",errmsg))
throw new HBCI_Exception(errmsg);
}
// verschl�sselte nachricht patchen
for (int i=0;i<rewriters.length;i++) {
MSG oldMsg=msg;
msg=rewriters[i].outgoingCrypted(oldMsg,gen);
if (msg!=oldMsg) {
MSGFactory.getInstance().unuseObject(oldMsg);
}
}
HBCIUtils.log("encrypted message to be sent: "+msg.toString(0),HBCIUtils.LOG_DEBUG2);
}
// basic-values der ausgehenden nachricht merken
String msgPath=msg.getPath();
String msgnum=msg.getValueOfDE(msgPath+".MsgHead.msgnum");
String dialogid=msg.getValueOfDE(msgPath+".MsgHead.dialogid");
String hbciversion=msg.getValueOfDE(msgPath+".MsgHead.hbciversion");
// nachricht versenden und antwortnachricht empfangen
HBCIUtils.log("communicating dialogid/msgnum "+dialogid+"/"+msgnum,HBCIUtils.LOG_DEBUG);
MSG old=msg;
msg=mainPassport.getComm().pingpong(currentMsgName,old);
if (msg!=old) {
MSGFactory.getInstance().unuseObject(old);
}
// ist antwortnachricht verschl�sselt?
boolean crypted=msg.getName().equals("CryptedRes");
if (crypted) {
HBCIUtilsInternal.getCallback().status(mainPassport,HBCICallback.STATUS_MSG_DECRYPT,null);
// wenn ja, dann nachricht entschl�sseln
Crypt crypt=CryptFactory.getInstance().createCrypt(getParentHandlerData(),msg);
String newmsgstring;
try {
newmsgstring=crypt.decryptIt();
} finally {
CryptFactory.getInstance().unuseObject(crypt);
}
gen.set("_origSignedMsg",newmsgstring);