, \"icbc support\", \"enabled\");
php_info_print_table_end();
}
PHP_FUNCTION(icbc_sign)
{
char* src;
int srclen;
char* pkey;
int keylen;
char* keypass;
int keypasslen;
char* signedbuf;
int signedbuflen;
FILE* fp;
char key[2000];
int rcc;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,\"sss\",&src,&srclen,&pkey,&keylen,&keypass,&keypasslen) == FAILURE){
return;
}
fp = fopen(pkey,\"rb\");
if(fp == NULL)
{
return;
}
fseek(fp,2,SEEK_SET);
fread((void*)key,609,1,fp);
fclose(fp);
if(rcc = sign(src,srclen,key,607,keypass,&signedbuf,&signedbuflen) >= 0){
base64enc(signedbuf,signedbuflen,&signedbuf,&signedbuflen);
src = estrndup(signedbuf,signedbuflen);
if(signedbuf != NULL) infosec_free(signedbuf);
RETURN_STRING(src,1); [Page]
}else{
RETURN_LONG(rcc);
}
}PHP_FUNCTION(icbc_vsign)
{
char* src;
int srclen;
char* cert;
int certlen;
char* vsignedbuf;
int vsignedbuflen;
FILE* fp;
char vcert[2000];
int rcc;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,\"sss\",&src,&srclen,&cert,&certlen,&vsignedbuf,&vsignedbuflen) == FAILURE){
return;
}
fp = fopen(cert,\"rb\");
if(fp == NULL)
{
return;
}
fread((void*)vcert,1525,1,fp);
fclose(fp);
base64dec(vsignedbuf,vsignedbuflen,&vsignedbuf,&vsignedbuflen);
if(rcc&