本文整理汇总了C++中DBG_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG_INFO函数的具体用法?C++ DBG_INFO怎么用?C++ DBG_INFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBG_INFO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EBC_Provider_MkEuCryptZipDoc_A004
int EBC_Provider_MkEuCryptZipDoc_A004(AB_PROVIDER *pro,
AB_USER *u,
const char *requestType,
const uint8_t *pMsg,
uint32_t lMsg,
GWEN_CRYPT_KEY *skey,
GWEN_BUFFER *sbuf) {
GWEN_BUFFER *tbuf;
GWEN_BUFFER *ebuf;
int rv;
uint32_t l;
DBG_INFO(AQEBICS_LOGDOMAIN, "Generating EU A005");
tbuf=GWEN_Buffer_new(0, 512, 0, 1);
rv=EBC_Provider_MkEuZipDoc_A004(pro, u, requestType, pMsg, lMsg, tbuf);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(tbuf);
return rv;
}
/* padd EU */
rv=GWEN_Padd_PaddWithAnsiX9_23(tbuf);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(tbuf);
return rv;
}
/* encrypt EU with the DES session key */
ebuf=GWEN_Buffer_new(0, GWEN_Buffer_GetUsedBytes(tbuf)+16, 0, 1);
l=GWEN_Buffer_GetMaxUnsegmentedWrite(ebuf);
/* reset IV !! */
GWEN_Crypt_KeyDes3K_SetIV(skey, NULL, 0);
rv=GWEN_Crypt_Key_Encipher(skey,
(uint8_t*)GWEN_Buffer_GetStart(tbuf),
GWEN_Buffer_GetUsedBytes(tbuf),
(uint8_t*)GWEN_Buffer_GetPosPointer(ebuf),
&l);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(ebuf);
GWEN_Buffer_free(tbuf);
return rv;
}
GWEN_Buffer_free(tbuf);
GWEN_Buffer_IncrementPos(ebuf, l);
GWEN_Buffer_AdjustUsedBytes(ebuf);
/* base64 encode encrypted EU into given buffer */
rv=GWEN_Base64_Encode((const uint8_t*)GWEN_Buffer_GetStart(ebuf),
GWEN_Buffer_GetUsedBytes(ebuf),
sbuf, 0);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(ebuf);
return rv;
}
GWEN_Buffer_free(ebuf);
return 0;
}
示例2: GWEN_Process_Start
GWEN_PROCESS_STATE GWEN_Process_Start(GWEN_PROCESS *pr,
const char *prg,
const char *args) {
pid_t pid;
char *argv[32];
int argc;
const char *p, *p2;
GWEN_BUFFER *wbuf;
assert(pr);
if (GWEN_Process_Redirect(pr)) {
DBG_ERROR(GWEN_LOGDOMAIN, "Could not setup redirections");
pr->state=GWEN_ProcessStateNotStarted;
pr->pid=-1;
return GWEN_ProcessStateNotStarted;
}
pid=fork();
if (pid==-1) {
/* error in fork */
pr->state=GWEN_ProcessStateNotStarted;
pr->pid=-1;
/* close all pipes */
if (pr->filesStdin[0]!=-1) {
close(pr->filesStdin[0]);
close(pr->filesStdin[1]);
}
if (pr->filesStdout[0]!=-1) {
close(pr->filesStdout[0]);
close(pr->filesStdout[1]);
}
if (pr->filesStderr[0]!=-1) {
close(pr->filesStderr[0]);
close(pr->filesStderr[1]);
}
return GWEN_ProcessStateNotStarted;
}
else if (pid!=0) {
/* parent */
DBG_INFO(GWEN_LOGDOMAIN, "Process started with id %d", (int)pid);
pr->state=GWEN_ProcessStateRunning;
pr->pid=pid;
/* setup redirections */
if (pr->filesStdin[0]!=-1) {
close(pr->filesStdin[1]);
pr->stdIn=GWEN_SyncIo_File_fromFd(pr->filesStdin[0]);
}
if (pr->filesStdout[0]!=-1) {
close(pr->filesStdout[1]);
pr->stdOut=GWEN_SyncIo_File_fromFd(pr->filesStdout[0]);
}
if (pr->filesStderr[0]!=-1) {
close(pr->filesStderr[1]);
pr->stdErr=GWEN_SyncIo_File_fromFd(pr->filesStdout[0]);
}
return GWEN_ProcessStateRunning;
}
/* child, build arguments */
argc=0;
DBG_DEBUG(GWEN_LOGDOMAIN, "I'm the child process");
/* setup redirections */
if (pr->filesStdin[0]!=-1) {
close(pr->filesStdin[0]);
close(0);
if (dup(pr->filesStdin[1])==-1) {
DBG_ERROR(GWEN_LOGDOMAIN, "Could not setup redirection");
}
}
if (pr->filesStdout[0]!=-1) {
close(pr->filesStdout[0]);
close(1);
if (dup(pr->filesStdout[1])==-1) {
DBG_ERROR(GWEN_LOGDOMAIN, "Could not setup redirection");
}
}
if (pr->filesStderr[0]!=-1) {
close(pr->filesStderr[0]);
close(2);
if (dup(pr->filesStderr[1])==-1) {
DBG_ERROR(GWEN_LOGDOMAIN, "Could not setup redirection");
}
}
argv[0]=strdup(prg);
argc++;
p=args;
wbuf=GWEN_Buffer_new(0, 256, 0, 1);
while(argc<32 && *p) {
while(*p && isspace((int)*p))
p++;
if (!(*p))
break;
if (GWEN_Text_GetWordToBuffer(p, " ",
//.........这里部分代码省略.........
示例3: Gtk2Gui_Dialog_SetupTree
int Gtk2Gui_Dialog_SetupTree(GWEN_WIDGET *w) {
int rv;
switch(GWEN_Widget_GetType(w)) {
case GWEN_Widget_TypeDialog:
rv=Gtk2Gui_WDialog_Setup(w);
break;
case GWEN_Widget_TypeLabel:
rv=Gtk2Gui_WLabel_Setup(w);
break;
case GWEN_Widget_TypeGridLayout:
rv=Gtk2Gui_WGridLayout_Setup(w);
break;
case GWEN_Widget_TypeVLayout:
rv=Gtk2Gui_WVLayout_Setup(w);
break;
case GWEN_Widget_TypeHLayout:
rv=Gtk2Gui_WHLayout_Setup(w);
break;
case GWEN_Widget_TypePushButton:
rv=Gtk2Gui_WPushButton_Setup(w);
break;
case GWEN_Widget_TypeLineEdit:
rv=Gtk2Gui_WLineEdit_Setup(w);
break;
case GWEN_Widget_TypeHLine:
rv=Gtk2Gui_WHLine_Setup(w);
break;
case GWEN_Widget_TypeVLine:
rv=Gtk2Gui_WVLine_Setup(w);
break;
case GWEN_Widget_TypeVSpacer:
rv=Gtk2Gui_WVSpacer_Setup(w);
break;
case GWEN_Widget_TypeHSpacer:
rv=Gtk2Gui_WHSpacer_Setup(w);
break;
case GWEN_Widget_TypeComboBox:
rv=Gtk2Gui_WComboBox_Setup(w);
break;
case GWEN_Widget_TypeTextEdit:
rv=Gtk2Gui_WTextEdit_Setup(w);
break;
case GWEN_Widget_TypeWidgetStack:
rv=Gtk2Gui_WStack_Setup(w);
break;
case GWEN_Widget_TypeTabBook:
rv=Gtk2Gui_WTabBook_Setup(w);
break;
case GWEN_Widget_TypeTabPage:
/* just re-use vbox */
GWEN_Widget_AddFlags(w, GWEN_WIDGET_FLAGS_FILLX | GWEN_WIDGET_FLAGS_FILLY);
rv=Gtk2Gui_WVLayout_Setup(w);
break;
case GWEN_Widget_TypeGroupBox:
rv=Gtk2Gui_WGroupBox_Setup(w);
break;
case GWEN_Widget_TypeTextBrowser:
rv=Gtk2Gui_WTextBrowser_Setup(w);
break;
case GWEN_Widget_TypeProgressBar:
rv=Gtk2Gui_WProgressBar_Setup(w);
break;
case GWEN_Widget_TypeSpinBox:
rv=Gtk2Gui_WSpinBox_Setup(w);
break;
case GWEN_Widget_TypeListBox:
rv=Gtk2Gui_WListBox_Setup(w);
break;
case GWEN_Widget_TypeCheckBox:
rv=Gtk2Gui_WCheckBox_Setup(w);
break;
case GWEN_Widget_TypeScrollArea:
rv=Gtk2Gui_WScrollArea_Setup(w);
break;
case GWEN_Widget_TypeRadioButton:
rv=Gtk2Gui_WRadioButton_Setup(w);
break;
default:
DBG_ERROR(GWEN_LOGDOMAIN, "Unhandled widget type %d", GWEN_Widget_GetType(w));
rv=GWEN_ERROR_INVALID;
break;
}
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
return rv;
}
else {
GWEN_WIDGET *wChild;
/* handle children */
wChild=GWEN_Widget_Tree_GetFirstChild(w);
while(wChild) {
/* recursion */
rv=Gtk2Gui_Dialog_SetupTree(wChild);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
return rv;
}
//.........这里部分代码省略.........
示例4: EBC_Provider_AddJob
int EBC_Provider_AddJob(AB_PROVIDER *pro, AB_JOB *j) {
EBC_PROVIDER *dp;
AB_ACCOUNT *a;
AB_USER *u;
EBC_USERQUEUE *uq;
int doAdd=1;
GWEN_DB_NODE *dbJob;
assert(pro);
dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
assert(dp);
a=AB_Job_GetAccount(j);
assert(a);
u=AB_Account_GetFirstUser(a);
if (u==NULL) {
DBG_ERROR(AQEBICS_LOGDOMAIN, "No user assigned to account.");
GWEN_Gui_ProgressLog(0,
GWEN_LoggerLevel_Error,
I18N("No user assigned to account."));
GWEN_Gui_ShowError(I18N("Setup Error"),
I18N("No user assigned to this account. Please assign one in the online banking setup dialog "
"for this account.\n"));
return GWEN_ERROR_INTERNAL;
}
dbJob=AB_Job_GetProviderData(j, pro);
assert(dbJob);
switch(AB_Job_GetType(j)) {
case AB_Job_TypeGetTransactions:
case AB_Job_TypeTransfer:
case AB_Job_TypeDebitNote:
break;
case AB_Job_TypeGetBalance:
default:
DBG_INFO(AQEBICS_LOGDOMAIN,
"Job not yet supported (%d)",
AB_Job_GetType(j));
return GWEN_ERROR_NOT_SUPPORTED;
} /* switch */
uq=EBC_Queue_GetUserQueue(dp->queue, u);
assert(uq);
if (AB_Job_GetType(j)==AB_Job_TypeGetTransactions) {
AB_JOB *firstJob;
firstJob=EBC_Queue_FindFirstJobLikeThis(dp->queue, u, j);
if (firstJob) {
GWEN_DB_NODE *dbCurrJob;
/* this job is just a copy of the firstJob, reference it */
dbCurrJob=AB_Job_GetProviderData(j, pro);
assert(dbCurrJob);
GWEN_DB_SetIntValue(dbCurrJob,
GWEN_DB_FLAGS_OVERWRITE_VARS,
"refJob",
AB_Job_GetJobId(firstJob));
/* don't add to queues */
doAdd=0;
}
}
if (doAdd) {
/* only add to queue if needed */
EBC_UserQueue_AddJob(uq, j);
}
/* always add to linear list */
AB_Job_List2_PushBack(dp->bankingJobs, j);
return 0;
}
示例5: EBC_Provider_ExecUserQueue
int EBC_Provider_ExecUserQueue(AB_PROVIDER *pro,
AB_IMEXPORTER_CONTEXT *ctx,
EBC_USERQUEUE *uq){
EBC_PROVIDER *dp;
int errors=0;
int oks=0;
GWEN_HTTP_SESSION *sess;
int rv;
EBC_ACCOUNTQUEUE_LIST *al;
AB_BANKING *ab;
assert(pro);
dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
assert(dp);
ab=AB_Provider_GetBanking(pro);
assert(ab);
/* create and open session */
sess=EBC_Dialog_new(pro,
EBC_UserQueue_GetUser(uq));
rv=GWEN_HttpSession_Init(sess);
if (rv<0) {
DBG_ERROR(AQEBICS_LOGDOMAIN, "Could not open session");
GWEN_HttpSession_free(sess);
return rv;
}
al=EBC_UserQueue_GetAccountQueues(uq);
if (al) {
EBC_ACCOUNTQUEUE *aq;
aq=EBC_AccountQueue_List_First(al);
while(aq) {
AB_ACCOUNT *a;
a=EBC_AccountQueue_GetAccount(aq);
assert(a);
/* lock account */
GWEN_Gui_ProgressLog(0,
GWEN_LoggerLevel_Info,
I18N("Locking account"));
rv=AB_Banking_BeginExclUseAccount(ab, a);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Gui_ProgressLog(0,
GWEN_LoggerLevel_Error,
I18N("Could not lock account"));
}
else {
GWEN_Gui_ProgressLog(0,
GWEN_LoggerLevel_Info,
I18N("Executing account queue"));
rv=EBC_Provider_ExecAccountQueue(pro, ctx,
EBC_UserQueue_GetUser(uq),
sess, aq);
if (!rv)
oks++;
else {
errors++;
if (rv==GWEN_ERROR_USER_ABORTED) {
DBG_INFO(AQEBICS_LOGDOMAIN, "User aborted");
AB_Banking_EndExclUseAccount(ab, a, 1); /* abandon */
GWEN_HttpSession_Fini(sess);
GWEN_HttpSession_free(sess);
return rv;
}
else {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
}
}
/* unlock account */
GWEN_Gui_ProgressLog(0,
GWEN_LoggerLevel_Info,
I18N("Unlocking account"));
rv=AB_Banking_EndExclUseAccount(ab, a, 0);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Gui_ProgressLog(0,
GWEN_LoggerLevel_Error,
I18N("Could not unlock account"));
}
}
aq=EBC_AccountQueue_List_Next(aq);
}
}
/* close and destroy session */
GWEN_HttpSession_Fini(sess);
GWEN_HttpSession_free(sess);
return 0;
}
示例6: EBC_Provider_Init
int EBC_Provider_Init(AB_PROVIDER *pro, GWEN_DB_NODE *dbData) {
EBC_PROVIDER *dp;
const char *logLevelName;
assert(pro);
dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
assert(dp);
if (!GWEN_Logger_IsOpen(AQEBICS_LOGDOMAIN)) {
GWEN_Logger_Open(AQEBICS_LOGDOMAIN,
"aqebics", 0,
GWEN_LoggerType_Console,
GWEN_LoggerFacility_User);
}
logLevelName=getenv("AQEBICS_LOGLEVEL");
if (logLevelName) {
GWEN_LOGGER_LEVEL ll;
ll=GWEN_Logger_Name2Level(logLevelName);
if (ll!=GWEN_LoggerLevel_Unknown) {
GWEN_Logger_SetLevel(AQEBICS_LOGDOMAIN, ll);
DBG_WARN(AQEBICS_LOGDOMAIN,
"Overriding loglevel for AqEBICS with \"%s\"",
logLevelName);
}
else {
DBG_ERROR(AQEBICS_LOGDOMAIN, "Unknown loglevel \"%s\"",
logLevelName);
}
}
DBG_INFO(AQEBICS_LOGDOMAIN, "Please remember to purchase a license if you want to use the EBICS backend.");
if (1) {
GWEN_STRINGLIST *sl=GWEN_PathManager_GetPaths(AB_PM_LIBNAME,
AB_PM_LOCALEDIR);
const char *localedir=GWEN_StringList_FirstString(sl);
int rv;
rv=GWEN_I18N_BindTextDomain_Dir(PACKAGE, localedir);
if (rv) {
DBG_ERROR(AQEBICS_LOGDOMAIN, "Could not bind textdomain (%d)", rv);
}
else {
rv=GWEN_I18N_BindTextDomain_Codeset(PACKAGE, "UTF-8");
if (rv) {
DBG_ERROR(AQEBICS_LOGDOMAIN, "Could not set codeset (%d)", rv);
}
}
GWEN_StringList_free(sl);
}
DBG_NOTICE(AQEBICS_LOGDOMAIN, "Initializing AqEBICS backend");
dp->connectTimeout=GWEN_DB_GetIntValue(dbData, "connectTimeout", 0,
EBC_DEFAULT_CONNECT_TIMEOUT);
dp->transferTimeout=GWEN_DB_GetIntValue(dbData, "transferTimeout", 0,
EBC_DEFAULT_TRANSFER_TIMEOUT);
return 0;
}
示例7: EBC_Provider_FillDataEncryptionInfoNode
int EBC_Provider_FillDataEncryptionInfoNode(AB_PROVIDER *pro, AB_USER *u,
const GWEN_CRYPT_KEY *skey,
xmlNodePtr node) {
EBC_PROVIDER *dp;
int rv;
GWEN_CRYPT_TOKEN *ct;
const GWEN_CRYPT_TOKEN_CONTEXT *ctx;
const GWEN_CRYPT_TOKEN_KEYINFO *ki;
uint32_t keyId;
GWEN_BUFFER *hbuf;
xmlNodePtr nodeX = NULL;
const char *s;
assert(pro);
dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
assert(dp);
/* get crypt token and context */
rv=EBC_Provider_MountToken(pro, u, &ct, &ctx);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
return rv;
}
/* get key id for server crypt key */
keyId=GWEN_Crypt_Token_Context_GetEncipherKeyId(ctx);
ki=GWEN_Crypt_Token_GetKeyInfo(ct,
keyId,
0xffffffff,
0);
if (ki==NULL) {
DBG_INFO(AQEBICS_LOGDOMAIN,
"Keyinfo %04x not found on crypt token [%s:%s]",
keyId,
GWEN_Crypt_Token_GetTypeName(ct),
GWEN_Crypt_Token_GetTokenName(ct));
GWEN_Crypt_Token_Close(ct, 0, 0);
return GWEN_ERROR_NOT_FOUND;
}
hbuf=GWEN_Buffer_new(0, 256, 0, 1);
s=EBC_User_GetCryptVersion(u);
if (!(s && *s))
s="E001";
if (strcasecmp(s, "E001")==0) {
rv=EB_Key_Info_BuildHashSha1(ki, hbuf, 1);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(hbuf);
GWEN_Crypt_Token_Close(ct, 0, 0);
return rv;
}
nodeX=xmlNewTextChild(node, NULL,
BAD_CAST "EncryptionPubKeyDigest",
BAD_CAST GWEN_Buffer_GetStart(hbuf));
GWEN_Buffer_free(hbuf);
assert(nodeX);
xmlNewProp(nodeX,
BAD_CAST "Version",
BAD_CAST "E001");
xmlNewProp(nodeX,
BAD_CAST "Algorithm",
BAD_CAST "http://www.w3.org/2000/09/xmldsig#sha1");
}
else if (strcasecmp(s, "E002")==0) {
rv=EB_Key_Info_BuildHashSha256(ki, hbuf, 1);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(hbuf);
GWEN_Crypt_Token_Close(ct, 0, 0);
return rv;
}
nodeX=xmlNewTextChild(node, NULL,
BAD_CAST "EncryptionPubKeyDigest",
BAD_CAST GWEN_Buffer_GetStart(hbuf));
GWEN_Buffer_free(hbuf);
assert(nodeX);
xmlNewProp(nodeX,
BAD_CAST "Version",
BAD_CAST "E002");
xmlNewProp(nodeX,
BAD_CAST "Algorithm",
BAD_CAST "http://www.w3.org/2001/04/xmlenc#sha256");
}
/* add encrypted transactio key */
hbuf=GWEN_Buffer_new(0, 256, 0, 1);
rv=EBC_Provider_EncryptKey(pro, u, skey, hbuf);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(hbuf);
GWEN_Crypt_Token_Close(ct, 0, 0);
return rv;
}
nodeX=xmlNewTextChild(node, NULL,
//.........这里部分代码省略.........
示例8: AHB_DTAUS__Export
int AHB_DTAUS__Export(GWEN_DBIO *dbio,
GWEN_SYNCIO *sio,
GWEN_DB_NODE *data,
GWEN_DB_NODE *cfg,
uint32_t flags){
AB_VALUE *sumEUR;
AB_VALUE *sumDEM;
AB_VALUE *sumBankCodes;
AB_VALUE *sumAccountIds;
unsigned int cSets;
GWEN_BUFFER *dst;
GWEN_DB_NODE *gr;
int isDebitNote;
//int isEuro;
const uint8_t *p;
uint32_t size;
int rv;
isDebitNote=(strcasecmp(GWEN_DB_GetCharValue(cfg, "type", 0, "transfer"),
"debitnote")==0);
//isEuro=(strcasecmp(GWEN_DB_GetCharValue(cfg, "currency", 0, "EUR"),
// "EUR")==0);
cSets=0;
sumEUR=AB_Value_new();
sumDEM=AB_Value_new();
sumBankCodes=AB_Value_new();
sumAccountIds=AB_Value_new();
dst=GWEN_Buffer_new(0, 1024, 0, 1);
GWEN_Buffer_SetHardLimit(dst, AHB_DTAUS_HARDLIMIT);
/* create A set */
if (AHB_DTAUS__CreateSetA(dst, cfg)) {
DBG_INFO(AQBANKING_LOGDOMAIN, "Error creating A set");
GWEN_Buffer_free(dst);
AB_Value_free(sumAccountIds);
AB_Value_free(sumBankCodes);
AB_Value_free(sumDEM);
AB_Value_free(sumEUR);
return -1;
}
/* create C sets */
gr=GWEN_DB_GetFirstGroup(data);
while(gr) {
const char *gn;
gn=GWEN_DB_GroupName(gr);
if ((isDebitNote && strcasecmp(gn, "debitnote")==0) ||
(!isDebitNote &&
(strcasecmp(gn, "transfer")==0 ||
strcasecmp(gn, "transaction")==0))){
if (AHB_DTAUS__CreateSetC(dst, cfg, gr,
sumEUR, sumDEM,
sumBankCodes, sumAccountIds)) {
DBG_ERROR(AQBANKING_LOGDOMAIN, "Error creating C set from this data:");
GWEN_DB_Dump(gr, 2);
GWEN_Buffer_free(dst);
AB_Value_free(sumAccountIds);
AB_Value_free(sumBankCodes);
AB_Value_free(sumDEM);
AB_Value_free(sumEUR);
return -1;
}
cSets++;
} /* if group matches */
else {
DBG_ERROR(AQBANKING_LOGDOMAIN, "Ignoring group [%s]",
GWEN_DB_GroupName(gr));
}
gr=GWEN_DB_GetNextGroup(gr);
} /* while */
/* create E set */
if (AHB_DTAUS__CreateSetE(dst, cfg, cSets,
sumEUR, sumDEM,
sumBankCodes, sumAccountIds)) {
DBG_INFO(AQBANKING_LOGDOMAIN, "Error creating E set");
GWEN_Buffer_free(dst);
AB_Value_free(sumAccountIds);
AB_Value_free(sumBankCodes);
AB_Value_free(sumDEM);
AB_Value_free(sumEUR);
return -1;
}
AB_Value_free(sumAccountIds);
AB_Value_free(sumBankCodes);
AB_Value_free(sumDEM);
AB_Value_free(sumEUR);
/* DTAUS finished, write it */
p=(const uint8_t*)GWEN_Buffer_GetStart(dst);
size=GWEN_Buffer_GetUsedBytes(dst);
rv=GWEN_SyncIo_WriteForced(sio, p, size);
if (rv<0) {
DBG_ERROR(AQBANKING_LOGDOMAIN, "Broken pipe");
GWEN_Buffer_free(dst);
return GWEN_ERROR_IO;
}
//.........这里部分代码省略.........
示例9: EBC_Provider_SignMessage_X001
static int EBC_Provider_SignMessage_X001(AB_PROVIDER *pro,
EB_MSG *msg,
AB_USER *u,
xmlNodePtr node) {
EBC_PROVIDER *dp;
int rv;
GWEN_CRYPT_TOKEN *ct;
const GWEN_CRYPT_TOKEN_CONTEXT *ctx;
const GWEN_CRYPT_TOKEN_KEYINFO *ki;
uint32_t keyId;
GWEN_BUFFER *hbuf;
GWEN_BUFFER *bbuf;
xmlNodePtr nodeX = NULL;
xmlNodePtr nodeXX = NULL;
xmlNodePtr nodeXXX = NULL;
xmlNodePtr nodeXXXX = NULL;
xmlNsPtr ns;
assert(pro);
dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
assert(dp);
/* get crypt token and context */
rv=EBC_Provider_MountToken(pro, u, &ct, &ctx);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
return rv;
}
/* get key id */
keyId=GWEN_Crypt_Token_Context_GetAuthSignKeyId(ctx);
ki=GWEN_Crypt_Token_GetKeyInfo(ct,
keyId,
0xffffffff,
0);
if (ki==NULL) {
DBG_INFO(AQEBICS_LOGDOMAIN,
"Keyinfo %04x not found on crypt token [%s:%s]",
keyId,
GWEN_Crypt_Token_GetTypeName(ct),
GWEN_Crypt_Token_GetTokenName(ct));
GWEN_Crypt_Token_Close(ct, 0, 0);
return GWEN_ERROR_NOT_FOUND;
}
/* prepare signature nodes */
ns=xmlSearchNs(EB_Msg_GetDoc(msg), node, BAD_CAST "ds");
assert(ns);
/* build hash */
bbuf=GWEN_Buffer_new(0, 256, 0, 1);
rv=EB_Msg_BuildHashSha1(msg, bbuf);
if (rv) {
DBG_ERROR(AQEBICS_LOGDOMAIN, "Could not build hash");
GWEN_Buffer_free(bbuf);
return rv;
}
/* base64 encode */
hbuf=GWEN_Buffer_new(0, 256, 0, 1);
rv=GWEN_Base64_Encode((const uint8_t*)GWEN_Buffer_GetStart(bbuf),
GWEN_Buffer_GetUsedBytes(bbuf),
hbuf, 0);
if (rv<0) {
DBG_INFO(AQEBICS_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(hbuf);
GWEN_Buffer_free(bbuf);
return rv;
}
GWEN_Buffer_free(bbuf);
/* create signature node */
nodeX=xmlNewChild(node, ns, BAD_CAST "SignedInfo", NULL);
nodeXX=xmlNewChild(nodeX, ns, BAD_CAST "CanonicalizationMethod", NULL);
xmlNewProp(nodeXX,
BAD_CAST "Algorithm",
BAD_CAST "http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
nodeXX=xmlNewChild(nodeX, ns, BAD_CAST "SignatureMethod", NULL);
xmlNewProp(nodeXX,
BAD_CAST "Algorithm",
BAD_CAST "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
nodeXX=xmlNewChild(nodeX, ns, BAD_CAST "Reference", NULL);
xmlNewProp(nodeXX,
BAD_CAST "URI",
BAD_CAST "#xpointer(//*[@authenticate='true'])");
nodeXXX=xmlNewChild(nodeXX, ns, BAD_CAST "Transforms", NULL);
nodeXXXX=xmlNewChild(nodeXXX, ns, BAD_CAST "Transform", NULL);
xmlNewProp(nodeXXXX,
BAD_CAST "Algorithm",
BAD_CAST "http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
nodeXXX=xmlNewChild(nodeXX, ns, BAD_CAST "DigestMethod", NULL);
xmlNewProp(nodeXXX,
BAD_CAST "Algorithm",
BAD_CAST "http://www.w3.org/2000/09/xmldsig#sha1");
/* store hash value */
xmlNewTextChild(nodeXX, ns,
BAD_CAST "DigestValue",
BAD_CAST GWEN_Buffer_GetStart(hbuf));
//.........这里部分代码省略.........
示例10: extractArchive
int extractArchive(GWEN_DB_NODE *dbArgs, int argc, char **argv) {
GWEN_DB_NODE *db;
const char *aname;
GWEN_SAR *sr;
int rv;
int verbosity;
const GWEN_ARGS args[]={
{
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
GWEN_ArgsType_Char, /* type */
"archive", /* name */
1, /* minnum */
1, /* maxnum */
"a", /* short option */
"archive", /* long option */
"Specify the archive file name", /* short description */
"Specify the archive file name" /* long description */
},
{
0, /* flags */
GWEN_ArgsType_Int, /* type */
"verbosity", /* name */
0, /* minnum */
10, /* maxnum */
"v", /* short option */
NULL, /* long option */
"set verbosity", /* short description */
"set verbosity" /* long description */
},
{
GWEN_ARGS_FLAGS_HELP | GWEN_ARGS_FLAGS_LAST, /* flags */
GWEN_ArgsType_Int, /* type */
"help", /* name */
0, /* minnum */
0, /* maxnum */
"h", /* short option */
"help", /* long option */
"Show this help screen", /* short description */
"Show this help screen" /* long description */
}
};
db=GWEN_DB_GetGroup(dbArgs, GWEN_DB_FLAGS_DEFAULT, "local");
rv=GWEN_Args_Check(argc, argv, 1,
GWEN_ARGS_MODE_ALLOW_FREEPARAM,
args,
db);
if (rv==GWEN_ARGS_RESULT_ERROR) {
fprintf(stderr, "ERROR: Could not parse arguments\n");
return 1;
}
else if (rv==GWEN_ARGS_RESULT_HELP) {
GWEN_BUFFER *ubuf;
ubuf=GWEN_Buffer_new(0, 1024, 0, 1);
if (GWEN_Args_Usage(args, ubuf, GWEN_ArgsOutType_Txt)) {
fprintf(stderr, "ERROR: Could not create help string\n");
return 1;
}
fprintf(stderr, "%s\n", GWEN_Buffer_GetStart(ubuf));
GWEN_Buffer_free(ubuf);
return 0;
}
aname=GWEN_DB_GetCharValue(db, "archive", 0, NULL);
assert(aname);
verbosity=GWEN_DB_GetIntValue(db, "verbosity", 0, 0);
sr=GWEN_Sar_new();
rv=GWEN_Sar_OpenArchive(sr, aname,
GWEN_SyncIo_File_CreationMode_OpenExisting,
GWEN_SYNCIO_FILE_FLAGS_READ);
if (rv<0) {
fprintf(stderr, "ERROR: Error opening archive (%d)\n", rv);
return 2;
}
else {
const GWEN_SAR_FILEHEADER_LIST *fhl;
fhl=GWEN_Sar_GetHeaders(sr);
if (fhl) {
const GWEN_SAR_FILEHEADER *fh;
fh=GWEN_SarFileHeader_List_First(fhl);
while(fh) {
const char *s;
s=GWEN_SarFileHeader_GetPath(fh);
if (s && *s) {
rv=GWEN_Sar_ExtractFile(sr, fh);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
GWEN_Sar_CloseArchive(sr, 1);
GWEN_Sar_free(sr);
return rv;
}
if (verbosity>0) {
fprintf(stdout, "extracted \"%s\"\n", s);
}
//.........这里部分代码省略.........
示例11: assert
GWEN_DIALOG *AH_Provider_GetNewCardUserDialog(AB_PROVIDER *pro)
{
int rv;
GWEN_BUFFER *mtypeName;
GWEN_BUFFER *mediumName;
GWEN_CRYPT_TOKEN *ct;
AB_BANKING *ab;
assert(pro);
ab=AB_Provider_GetBanking(pro);
assert(ab);
mtypeName=GWEN_Buffer_new(0, 64, 0, 1);
mediumName=GWEN_Buffer_new(0, 64, 0, 1);
rv=AB_Banking_CheckCryptToken(ab,
GWEN_Crypt_Token_Device_Card,
mtypeName,
mediumName);
if (rv<0) {
DBG_ERROR(AQHBCI_LOGDOMAIN, "here (%d)", rv);
GWEN_Gui_ShowError(I18N("Chipcard Error"),
I18N("Error checking chip card (%d).\n"
"Maybe libchipcard or its plugins are not installed?"));
GWEN_Buffer_free(mediumName);
GWEN_Buffer_free(mtypeName);
return NULL;
}
rv=AB_Banking_GetCryptToken(AB_Provider_GetBanking(pro),
GWEN_Buffer_GetStart(mtypeName),
GWEN_Buffer_GetStart(mediumName),
&ct);
if (rv<0) {
DBG_ERROR(AQHBCI_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(mediumName);
GWEN_Buffer_free(mtypeName);
return NULL;
}
if (strcasecmp(GWEN_Buffer_GetStart(mtypeName), "ddvcard")==0) {
GWEN_DIALOG *dlg2;
DBG_WARN(0, "DDV card");
dlg2=AH_DdvCardDialog_new(pro, ct);
if (dlg2==NULL) {
DBG_INFO(AQHBCI_LOGDOMAIN, "here (no dialog)");
GWEN_Buffer_free(mediumName);
GWEN_Buffer_free(mtypeName);
return NULL;
}
GWEN_Dialog_SetWidgetText(dlg2, "", I18N("Create HBCI/FinTS DDV User"));
GWEN_Buffer_free(mediumName);
GWEN_Buffer_free(mtypeName);
return dlg2;
}
else if (strcasecmp(GWEN_Buffer_GetStart(mtypeName), "starcoscard")==0) {
DBG_ERROR(AQHBCI_LOGDOMAIN, "STARCOS RSA card currently not supported by this dialog");
// TODO
}
else if (strcasecmp(GWEN_Buffer_GetStart(mtypeName), "zkacard")==0) {
GWEN_DIALOG *dlg2;
DBG_WARN(0, "ZKA RSA card");
dlg2=AH_ZkaCardDialog_new(pro, ct);
if (dlg2==NULL) {
DBG_INFO(AQHBCI_LOGDOMAIN, "here (no dialog)");
GWEN_Buffer_free(mediumName);
GWEN_Buffer_free(mtypeName);
return NULL;
}
GWEN_Dialog_SetWidgetText(dlg2, "", I18N("Create HBCI/FinTS ZKA RSA User"));
GWEN_Buffer_free(mediumName);
GWEN_Buffer_free(mtypeName);
return dlg2;
}
else {
DBG_ERROR(AQHBCI_LOGDOMAIN, "Card type \"%s\" not yet supported",
GWEN_Buffer_GetStart(mtypeName));
}
GWEN_Buffer_free(mediumName);
GWEN_Buffer_free(mtypeName);
AB_Banking_ClearCryptTokenList(AB_Provider_GetBanking(pro));
return NULL;
}
示例12: APY_NewUserDialog_DoIt
int APY_NewUserDialog_DoIt(GWEN_DIALOG *dlg) {
APY_NEWUSER_DIALOG *xdlg;
AB_USER *u;
int rv;
uint32_t pid;
AB_PROVIDER *pro;
DBG_INFO(0, "Doit");
assert(dlg);
xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, APY_NEWUSER_DIALOG, dlg);
assert(xdlg);
pro=AB_Banking_GetProvider(xdlg->banking, "aqpaypal");
if (pro==NULL) {
DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not find backend, maybe some plugins are not installed?");
// TODO: show error message
return GWEN_DialogEvent_ResultHandled;
}
DBG_INFO(0, "Creating user");
u=AB_Banking_CreateUser(xdlg->banking, "aqpaypal");
if (u==NULL) {
DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not create user, maybe backend missing?");
// TODO: show error message
return GWEN_DialogEvent_ResultHandled;
}
/* generic setup */
AB_User_SetUserName(u, xdlg->userName);
AB_User_SetUserId(u, xdlg->userId);
AB_User_SetCustomerId(u, xdlg->userId);
AB_User_SetCountry(u, "de");
AB_User_SetBankCode(u, "PAYPAL");
APY_User_SetServerUrl(u, xdlg->url);
APY_User_SetHttpVMajor(u, xdlg->httpVMajor);
APY_User_SetHttpVMinor(u, xdlg->httpVMinor);
DBG_INFO(0, "Adding user");
rv=AB_Banking_AddUser(xdlg->banking, u);
if (rv<0) {
DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not add user (%d)", rv);
AB_User_free(u);
return GWEN_DialogEvent_ResultHandled;
}
pid=GWEN_Gui_ProgressStart(GWEN_GUI_PROGRESS_DELAY |
GWEN_GUI_PROGRESS_ALLOW_EMBED |
GWEN_GUI_PROGRESS_SHOW_PROGRESS |
GWEN_GUI_PROGRESS_SHOW_ABORT,
I18N("Setting Up Paypal User"),
I18N("The user will be created."),
3,
0);
/* lock new user */
DBG_INFO(0, "Locking user");
rv=AB_Banking_BeginExclUseUser(xdlg->banking, u);
if (rv<0) {
DBG_ERROR(AQPAYPAL_LOGDOMAIN, "Could not lock user (%d)", rv);
GWEN_Gui_ProgressLog(pid,
GWEN_LoggerLevel_Error,
I18N("Unable to lock users"));
AB_Banking_DeleteUser(xdlg->banking, u);
GWEN_Gui_ProgressEnd(pid);
return GWEN_DialogEvent_ResultHandled;
}
#if 0
DBG_INFO(0, "Getting certs (%08x)", AH_User_GetFlags(u));
GWEN_Gui_ProgressLog(pid,
GWEN_LoggerLevel_Notice,
I18N("Retrieving SSL certificate"));
rv=APY_Provider_GetCert(pro, u, 0, 1, 0);
if (rv<0) {
// TODO: retry with SSLv3 if necessary
AB_Banking_EndExclUseUser(xdlg->banking, u, 1);
DBG_ERROR(AQPAYPAL_LOGDOMAIN, "here (%d)", rv);
AB_Banking_DeleteUser(xdlg->banking, u);
GWEN_Gui_ProgressEnd(pid);
return GWEN_DialogEvent_ResultHandled;
}
rv=GWEN_Gui_ProgressAdvance(pid, GWEN_GUI_PROGRESS_ONE);
if (rv==GWEN_ERROR_USER_ABORTED) {
AB_Banking_EndExclUseUser(xdlg->banking, u, 1);
DBG_INFO(AQPAYPAL_LOGDOMAIN, "here (%d)", rv);
AB_Banking_DeleteUser(xdlg->banking, u);
GWEN_Gui_ProgressLog(pid,
GWEN_LoggerLevel_Error,
I18N("Aborted by user."));
GWEN_Gui_ProgressEnd(pid);
return GWEN_DialogEvent_ResultHandled;
}
#endif
GWEN_Gui_ProgressLog(pid,
GWEN_LoggerLevel_Notice,
I18N("Creating API credentials file"));
rv=APY_User_SetApiSecrets(u, xdlg->apiPassword, xdlg->apiSignature, xdlg->apiUserId);
if (rv<0) {
//.........这里部分代码省略.........
示例13: assert
GWEN_DATE *GWEN_Date_fromStringWithTemplate(const char *s, const char *tmpl) {
int year, month, day;
const char *p;
const char *t;
GWEN_DATE *gwt;
assert(s);
assert(tmpl);
year=month=day=0;
p=s;
t=tmpl;
while(*t && *p) {
int i;
if (*t=='*') {
t++;
if (!*t) {
DBG_ERROR(GWEN_LOGDOMAIN, "Bad pattern: Must not end with \"*\"");
return 0;
}
i=0;
while(*p) {
if (!isdigit((int)*p))
break;
if (*p==*t)
break;
i*=10;
i+=(*p)-'0';
p++;
} /* while */
}
else {
if (isdigit((int)*p))
i=(*p)-'0';
else
i=-1;
p++;
}
if (i==-1 && strchr("YMD", *t)!=NULL) {
DBG_INFO(GWEN_LOGDOMAIN,
"No more digits at [%s], continuing", t);
p--;
}
else {
switch(*t) {
case 'Y':
if (i==-1) {
DBG_INFO(GWEN_LOGDOMAIN, "here");
return 0;
}
year*=10;
year+=i;
break;
case 'M':
if (i==-1) {
DBG_INFO(GWEN_LOGDOMAIN, "here");
return 0;
}
month*=10;
month+=i;
break;
case 'D':
if (i==-1) {
DBG_INFO(GWEN_LOGDOMAIN, "here");
return 0;
}
day*=10;
day+=i;
break;
default:
DBG_VERBOUS(GWEN_LOGDOMAIN,
"Unknown character in template, will skip in both strings");
break;
}
}
t++;
} /* while */
if (year<100)
year+=2000;
DBG_DEBUG(GWEN_LOGDOMAIN,
"Got this date/time: %04d/%02d/%02d",
year, month, day);
/* get time in local time */
gwt=GWEN_Date_fromGregorian(year, month, day);
if (!gwt) {
DBG_INFO(GWEN_LOGDOMAIN, "here");
return 0;
}
return gwt;
}
示例14: GWEN_Gui_CProgress_Advance
int GWEN_Gui_CProgress_Advance(GWEN_GUI_CPROGRESS *cp, uint64_t progress)
{
#ifndef OS_WIN32
int fl;
#endif
assert(cp);
if (!cp->shown) {
time_t t1;
t1=time(0);
if (difftime(t1, cp->startTime)>GWEN_GUI_DELAY_SECS) {
if (!(GWEN_Gui_GetFlags(cp->gui) & GWEN_GUI_FLAGS_NONINTERACTIVE))
GWEN_Gui_StdPrintf(cp->gui, stderr, "%s: Started.\n", cp->title);
cp->shown=1;
}
}
if (progress==GWEN_GUI_PROGRESS_ONE)
progress=cp->current+1;
if (progress!=GWEN_GUI_PROGRESS_NONE) {
if (progress!=cp->current) {
if (cp->shown) {
if (!(GWEN_Gui_GetFlags(cp->gui) & GWEN_GUI_FLAGS_NONINTERACTIVE)) {
if (cp->total==GWEN_GUI_PROGRESS_NONE)
GWEN_Gui_StdPrintf(cp->gui, stderr, "%s: %llu\n", cp->title,
(long long unsigned)progress);
else
GWEN_Gui_StdPrintf(cp->gui, stderr, "%s: %llu of %llu\n",
cp->title,
(long long unsigned)progress,
(long long unsigned)cp->total);
}
}
cp->current=progress;
}
}
if (cp->aborted)
return GWEN_ERROR_USER_ABORTED;
#ifndef OS_WIN32
if (!(GWEN_Gui_GetFlags(cp->gui) & GWEN_GUI_FLAGS_NONINTERACTIVE)) {
/* check for abort */
fl=fcntl(fileno(stdin), F_GETFL);
if (fl!=-1) {
int chr;
/* set stdin to nonblocking */
if (fcntl(fileno(stdin), F_SETFL, fl | O_NONBLOCK)) {
DBG_INFO(GWEN_LOGDOMAIN, "fcntl(stdin): %s", strerror(errno));
return 0;
}
/* check whether there is a character */
chr=getchar();
/* set blocking mode to what we found before modification */
fcntl(fileno(stdin), F_SETFL, fl);
if (chr==GWEN_GUI_CPROGRESS_CHAR_ABORT) {
GWEN_Gui_StdPrintf(cp->gui, stderr, "------> ABORTED BY USER\n");
cp->aborted=1;
return GWEN_ERROR_USER_ABORTED;
}
}
}
#endif
return 0;
}
示例15: GWEN_CryptMgr_Decrypt
int GWEN_CryptMgr_Decrypt(GWEN_CRYPTMGR *cm, const uint8_t *pData, uint32_t lData, GWEN_BUFFER *dbuf) {
GWEN_TAG16 *tag;
const uint8_t *p;
uint32_t l;
GWEN_CRYPTHEAD *ch=NULL;
const uint8_t *pEncryptedData=NULL;
uint32_t lEncryptedData=0;
int rv;
GWEN_BUFFER *tbuf;
GWEN_CRYPT_KEY *mkey;
assert(cm);
if (lData<3) {
DBG_ERROR(GWEN_LOGDOMAIN, "Too few bytes");
return GWEN_ERROR_BAD_DATA;
}
tag=GWEN_Tag16_fromBuffer2(pData, lData, 0);
if (tag==NULL) {
DBG_ERROR(GWEN_LOGDOMAIN, "Data doesn't contain a valid TLV");
return GWEN_ERROR_BAD_DATA;
}
if (GWEN_Tag16_GetTagType(tag)!=GWEN_CRYPTMGR_TLV_ENCRYPTEDOBJECT) {
DBG_ERROR(GWEN_LOGDOMAIN, "Data does not contain an encrypted object");
GWEN_Tag16_free(tag);
return GWEN_ERROR_BAD_DATA;
}
p=GWEN_Tag16_GetTagData(tag);
l=GWEN_Tag16_GetTagLength(tag);
/* read crypthead */
if (l) {
GWEN_TAG16 *subtag;
subtag=GWEN_Tag16_fromBuffer2(p, l, 0);
if (subtag) {
if (GWEN_Tag16_GetTagType(subtag)==GWEN_CRYPTMGR_TLV_CRYPTHEAD) {
ch=GWEN_CryptHead_fromBuffer(GWEN_Tag16_GetTagData(subtag),
GWEN_Tag16_GetTagLength(subtag));
}
p+=GWEN_Tag16_GetTagSize(subtag);
l-=GWEN_Tag16_GetTagSize(subtag);
GWEN_Tag16_free(subtag);
}
}
/* read encrypted data */
if (l) {
GWEN_TAG16 *subtag;
subtag=GWEN_Tag16_fromBuffer2(p, l, 0);
if (subtag) {
if (GWEN_Tag16_GetTagType(subtag)==GWEN_CRYPTMGR_TLV_CRYPTDATA) {
pEncryptedData=GWEN_Tag16_GetTagData(subtag);
lEncryptedData=GWEN_Tag16_GetTagLength(subtag);
}
p+=GWEN_Tag16_GetTagSize(subtag);
l-=GWEN_Tag16_GetTagSize(subtag);
GWEN_Tag16_free(subtag);
}
}
/* check for all needed components */
if (!(ch && pEncryptedData && lEncryptedData)) {
DBG_ERROR(GWEN_LOGDOMAIN, "Encrypted object is not complete");
GWEN_CryptHead_free(ch);
GWEN_Tag16_free(tag);
return GWEN_ERROR_BAD_DATA;
}
/* store or check peer key info */
if (cm->localKeyName) {
const char *s;
/* compare peer info with expected info */
s=GWEN_CryptHead_GetKeyName(ch);
if (!(cm->localKeyName && s && (strcasecmp(cm->localKeyName, s)==0) &&
(cm->localKeyNumber==GWEN_CryptHead_GetKeyNumber(ch)) &&
(cm->localKeyVersion==GWEN_CryptHead_GetKeyVersion(ch)))) {
DBG_ERROR(GWEN_LOGDOMAIN, "Unexpected local key information in signature");
GWEN_CryptHead_free(ch);
GWEN_Tag16_free(tag);
return GWEN_ERROR_BAD_DATA;
}
}
/* decrypt message key */
tbuf=GWEN_Buffer_new(0, GWEN_CryptHead_GetKeyLen(ch), 0, 1);
rv=GWEN_CryptMgr_DecryptKey(cm,
GWEN_CryptHead_GetKeyPtr(ch),
GWEN_CryptHead_GetKeyLen(ch),
tbuf);
GWEN_CryptHead_free(ch);
if (rv<0) {
DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv);
GWEN_Buffer_free(tbuf);
GWEN_Tag16_free(tag);
//.........这里部分代码省略.........