2008-08-31 18:50:31 +00:00
|
|
|
/*
|
|
|
|
* libretroshare/src/pqi: cleanupxpgp.cc
|
|
|
|
*
|
|
|
|
* 3P/PQI network interface for RetroShare.
|
|
|
|
*
|
|
|
|
* Copyright 2008 by Sourashis Roy
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "cleanupxpgp.h"
|
|
|
|
#include <iostream>
|
2009-05-23 15:07:35 +00:00
|
|
|
#include <string.h> //strlen
|
2011-04-08 18:53:12 +00:00
|
|
|
#include <list>
|
2011-08-30 21:49:49 +00:00
|
|
|
#include <retroshare/rspeers.h>
|
2008-08-31 18:50:31 +00:00
|
|
|
/*
|
|
|
|
Method for cleaning up the certificate. This method removes any unnecessay white spaces and unnecessary
|
|
|
|
new line characters in the certificate. Also it makes sure that there are 64 characters per line in
|
|
|
|
the certificate. This function removes white spaces and new line characters in the entire segment
|
|
|
|
-----BEGIN XPGP CERTIFICATE-----
|
|
|
|
<CERTIFICATE>
|
|
|
|
-----END XPGP CERTIFICATE-----
|
|
|
|
We also take care of correcting cases like ----- BEGIN. Here extra empty spaces
|
|
|
|
have been introduced between ----- and BEGIN. Similarly for the
|
|
|
|
end tag we take care of cases like ----- END XPGP . Here extra empty spaces have been
|
|
|
|
introduced and the actual tag should have been -----END XPGP
|
|
|
|
*/
|
|
|
|
|
2011-08-30 21:49:49 +00:00
|
|
|
|
|
|
|
std::string cleanUpCertificate(const std::string& badCertificate,int& error_code)
|
2008-08-31 18:50:31 +00:00
|
|
|
{
|
2011-08-30 21:49:49 +00:00
|
|
|
error_code = RS_PEER_CERT_CLEANING_CODE_UNKOWN_ERROR ; // default
|
2008-08-31 18:50:31 +00:00
|
|
|
/*
|
|
|
|
Buffer for storing the cleaned certificate. In certain cases the
|
|
|
|
cleanCertificate can be larger than the badCertificate
|
|
|
|
*/
|
2010-08-14 11:51:15 +00:00
|
|
|
std::string cleanCertificate;
|
2008-08-31 18:50:31 +00:00
|
|
|
//The entire certificate begin tag
|
2011-04-08 18:53:12 +00:00
|
|
|
const char * beginCertTag="-----BEGIN";
|
2008-08-31 18:50:31 +00:00
|
|
|
//The entire certificate end tag
|
2011-04-08 18:53:12 +00:00
|
|
|
const char * endCertTag="-----END";
|
2008-08-31 18:50:31 +00:00
|
|
|
//Tag containing dots. The common part of both start and end tags
|
2011-04-08 18:53:12 +00:00
|
|
|
const char * commonTag="-----";
|
2008-08-31 18:50:31 +00:00
|
|
|
//Only BEGIN part of the begin tag
|
2011-04-08 18:53:12 +00:00
|
|
|
const char * beginTag="BEGIN";
|
2008-08-31 18:50:31 +00:00
|
|
|
//Only END part of the end tag
|
2011-04-08 18:53:12 +00:00
|
|
|
const char * endTag="END";
|
2008-08-31 18:50:31 +00:00
|
|
|
//The start index of the ----- part of the certificate begin tag
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t beginCertStartIdx1=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//The start index of the BEGIN part of the certificate begin tag
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t beginCertStartIdx2=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//The start index of the end part(-----) of the certificate begin tag. The begin tag ends with -----. Example -----BEGIN XPGP CERTIFICATE-----
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t beginCertEndIdx=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//The start index of the ----- part of the certificate end tag
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t endCertStartIdx1=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//The start index of the END part of the certificate end tag
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t endCertStartIdx2=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//The start index of the end part(-----) of the certificate end tag. The begin tag ends with -----. Example -----BEGIN XPGP CERTIFICATE-----
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t endCertEndIdx=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//The length of the bad certificate.
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t lengthOfCert=badCertificate.length();
|
2008-08-31 18:50:31 +00:00
|
|
|
//The current index value in the bad certificate
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t currBadCertIdx=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//Temporary index value
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t tmpIdx=0;
|
2008-08-31 18:50:31 +00:00
|
|
|
//Boolean flag showing if the begin tag or the end tag has been found
|
|
|
|
bool found=false;
|
|
|
|
/*
|
2011-08-30 21:49:49 +00:00
|
|
|
Calculating the value of the beginCertStartIdx1 and beginCertStartIdx2. Here
|
|
|
|
we first locate the occurance of ----- and then the location of BEGIN. Next
|
|
|
|
we check if there are any non space or non new-line characters between their
|
|
|
|
occureance. If there are any other characters between the two(----- and
|
|
|
|
BEGIN), other than space and new line then it means that it is the
|
|
|
|
certificate begin tag. Here we take care of the fact that we may have
|
|
|
|
introduced some spaces and newlines in the begin tag by mistake. This takes
|
|
|
|
care of the spaces and newlines between ----- and BEGIN.
|
2008-08-31 18:50:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
while(found==false && (beginCertStartIdx1=badCertificate.find(commonTag,tmpIdx))!=std::string::npos)
|
|
|
|
{
|
|
|
|
beginCertStartIdx2=badCertificate.find(beginTag,beginCertStartIdx1+strlen(commonTag));
|
|
|
|
tmpIdx=beginCertStartIdx1+strlen(commonTag);
|
|
|
|
if(beginCertStartIdx2!=std::string::npos)
|
|
|
|
{
|
|
|
|
found=true;
|
2011-04-08 18:53:12 +00:00
|
|
|
for(size_t i=beginCertStartIdx1+strlen(commonTag);i<beginCertStartIdx2;i++)
|
2008-08-31 18:50:31 +00:00
|
|
|
{
|
|
|
|
if(badCertificate[i]!=' ' && badCertificate[i]!='\n' )
|
|
|
|
{
|
|
|
|
found=false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
begin tag not found
|
|
|
|
*/
|
|
|
|
if(!found)
|
|
|
|
{
|
|
|
|
std::cerr<<"Certificate corrupted beyond repair: No <------BEGIN > tag"<<std::endl;
|
2011-08-30 21:49:49 +00:00
|
|
|
error_code = RS_PEER_CERT_CLEANING_CODE_NO_BEGIN_TAG ;
|
2008-08-31 18:50:31 +00:00
|
|
|
return badCertificate;
|
|
|
|
}
|
|
|
|
beginCertEndIdx=badCertificate.find(commonTag,beginCertStartIdx2);
|
|
|
|
if(beginCertEndIdx==std::string::npos)
|
|
|
|
{
|
|
|
|
std::cerr<<"Certificate corrupted beyond repair: No <------BEGIN > tag"<<std::endl;
|
2011-08-30 21:49:49 +00:00
|
|
|
error_code = RS_PEER_CERT_CLEANING_CODE_NO_BEGIN_TAG ;
|
2008-08-31 18:50:31 +00:00
|
|
|
return badCertificate;
|
|
|
|
}
|
|
|
|
tmpIdx=beginCertEndIdx+strlen(commonTag);
|
|
|
|
found=false;
|
|
|
|
/*
|
|
|
|
Calculating the value of the endCertStartIdx1 and endCertStartIdx2. Here we first locate the occurance of ----- and then
|
|
|
|
the location of END. Next we check if there are any non space or non new-line characters between their occureance. If there are any other
|
|
|
|
characters between the two(----- and END), other than space and new line then it means that it is the certificate end tag.
|
|
|
|
Here we take care of the fact that we may have introduced some spaces and newlines in the end tag by mistake. This
|
|
|
|
takes care of the spaces and newlines between ----- and END.
|
|
|
|
*/
|
|
|
|
while(found==false && (endCertStartIdx1=badCertificate.find(commonTag,tmpIdx))!=std::string::npos)
|
|
|
|
{
|
|
|
|
endCertStartIdx2=badCertificate.find(endTag,endCertStartIdx1+strlen(commonTag));
|
|
|
|
tmpIdx=endCertStartIdx1+strlen(commonTag);
|
|
|
|
if(endCertStartIdx2!=std::string::npos)
|
|
|
|
{
|
|
|
|
found=true;
|
2011-04-08 18:53:12 +00:00
|
|
|
for(size_t i=endCertStartIdx1+strlen(commonTag);i<endCertStartIdx2;i++)
|
2008-08-31 18:50:31 +00:00
|
|
|
{
|
|
|
|
if(badCertificate[i]!=' '&& badCertificate[i]!='\n')
|
|
|
|
{
|
|
|
|
found=false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
end tag not found
|
|
|
|
*/
|
|
|
|
if(!found)
|
|
|
|
{
|
|
|
|
std::cerr<<"Certificate corrupted beyond repair: No <------END > tag"<<std::endl;
|
2011-08-30 21:49:49 +00:00
|
|
|
error_code = RS_PEER_CERT_CLEANING_CODE_NO_END_TAG ;
|
2008-08-31 18:50:31 +00:00
|
|
|
return badCertificate;
|
|
|
|
}
|
|
|
|
endCertEndIdx=badCertificate.find(commonTag,endCertStartIdx2);
|
|
|
|
if(endCertEndIdx==std::string::npos || endCertEndIdx>=lengthOfCert)
|
|
|
|
{
|
|
|
|
std::cerr<<"Certificate corrupted beyond repair: No <------END > tag"<<std::endl;
|
2011-08-30 21:49:49 +00:00
|
|
|
error_code = RS_PEER_CERT_CLEANING_CODE_NO_END_TAG ;
|
2008-08-31 18:50:31 +00:00
|
|
|
return badCertificate;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
Copying the begin tag(-----BEGIN) to the clean certificate
|
|
|
|
*/
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate += beginCertTag;
|
2008-08-31 18:50:31 +00:00
|
|
|
currBadCertIdx=beginCertStartIdx2+strlen(beginTag);
|
|
|
|
/*
|
|
|
|
Copying the name of the tag e.g XPGP CERTIFICATE. At the same time remove any white spaces and new line
|
|
|
|
characters.
|
|
|
|
*/
|
|
|
|
while(currBadCertIdx<beginCertEndIdx)
|
|
|
|
{
|
|
|
|
if(badCertificate[currBadCertIdx]=='\n')
|
|
|
|
{
|
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
|
|
|
else if(badCertificate[currBadCertIdx]==' ' && (badCertificate[currBadCertIdx-1]==' '|| badCertificate[currBadCertIdx-1]=='\n') )
|
|
|
|
{
|
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate += badCertificate[currBadCertIdx];
|
2008-08-31 18:50:31 +00:00
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
If the last character is a space we need to remove it.
|
|
|
|
*/
|
2010-08-14 11:51:15 +00:00
|
|
|
if(cleanCertificate.substr(cleanCertificate.length()-1, 1) == " ")
|
2008-08-31 18:50:31 +00:00
|
|
|
{
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate.erase(cleanCertificate.length()-1);
|
2008-08-31 18:50:31 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
Copying the end part of the certificate start tag(-----).
|
|
|
|
*/
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate += commonTag;
|
|
|
|
cleanCertificate += "\n";
|
2008-08-31 18:50:31 +00:00
|
|
|
currBadCertIdx=currBadCertIdx+strlen(commonTag);
|
|
|
|
/*
|
|
|
|
Remove the white spaces between the end of the certificate begin tag and the actual
|
|
|
|
start of the certificate.
|
|
|
|
*/
|
|
|
|
while(badCertificate[currBadCertIdx]=='\n'|| badCertificate[currBadCertIdx]==' ')
|
|
|
|
{
|
|
|
|
currBadCertIdx++;
|
2011-04-08 18:53:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//keep the armor header
|
|
|
|
std::list<std::string> header;
|
|
|
|
header.push_back("Version");
|
|
|
|
header.push_back("Comment");
|
|
|
|
header.push_back("MessageID");
|
|
|
|
header.push_back("Hash");
|
|
|
|
header.push_back("Charset");
|
|
|
|
|
|
|
|
for (std::list<std::string>::iterator headerIt = header.begin (); headerIt != header.end(); headerIt++)
|
|
|
|
{
|
|
|
|
if (badCertificate.substr(currBadCertIdx, (*headerIt).length()) == *headerIt)
|
|
|
|
{
|
|
|
|
cleanCertificate += badCertificate.substr(currBadCertIdx, (*headerIt).length());
|
|
|
|
currBadCertIdx += (*headerIt).length();
|
2011-08-30 21:49:49 +00:00
|
|
|
while(currBadCertIdx<endCertStartIdx1 && badCertificate[currBadCertIdx]!='\n')
|
2011-04-08 18:53:12 +00:00
|
|
|
{
|
|
|
|
cleanCertificate += badCertificate[currBadCertIdx];
|
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
|
|
|
cleanCertificate += "\n";
|
|
|
|
}
|
|
|
|
}
|
2010-01-19 21:44:59 +00:00
|
|
|
|
2011-04-08 18:53:12 +00:00
|
|
|
//add empty line after armor header
|
|
|
|
cleanCertificate += "\n";
|
2010-01-19 21:44:59 +00:00
|
|
|
|
2008-08-31 18:50:31 +00:00
|
|
|
//Start of the actual certificate. Remove spaces in the certificate
|
|
|
|
//and make sure there are 64 characters per line in the
|
|
|
|
//new cleaned certificate
|
|
|
|
int cntPerLine=0;
|
|
|
|
while(currBadCertIdx<endCertStartIdx1)
|
|
|
|
{
|
|
|
|
if(cntPerLine==64)
|
|
|
|
{
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate += "\n";
|
2008-08-31 18:50:31 +00:00
|
|
|
cntPerLine=0;
|
|
|
|
}
|
2011-08-30 21:49:49 +00:00
|
|
|
|
|
|
|
if(badCertificate[currBadCertIdx]=='=') /* checksum */
|
2011-04-08 18:53:12 +00:00
|
|
|
{
|
2011-08-30 21:49:49 +00:00
|
|
|
cntPerLine=0 ;
|
2011-04-08 18:53:12 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-08-31 18:50:31 +00:00
|
|
|
else if(badCertificate[currBadCertIdx]==' ')
|
|
|
|
currBadCertIdx++;
|
|
|
|
else if(badCertificate[currBadCertIdx]=='\n')
|
2011-08-30 21:49:49 +00:00
|
|
|
currBadCertIdx++;
|
|
|
|
else
|
2008-08-31 18:50:31 +00:00
|
|
|
{
|
2011-08-30 21:49:49 +00:00
|
|
|
cleanCertificate += badCertificate[currBadCertIdx];
|
|
|
|
cntPerLine++;
|
2008-08-31 18:50:31 +00:00
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
2011-04-08 18:53:12 +00:00
|
|
|
}
|
2011-08-30 21:49:49 +00:00
|
|
|
if(currBadCertIdx>=endCertStartIdx1)
|
2011-04-08 18:53:12 +00:00
|
|
|
{
|
2011-08-30 21:49:49 +00:00
|
|
|
std::cerr<<"Certificate corrupted beyond repair: No checksum, or no newline after first tag"<<std::endl;
|
|
|
|
error_code = RS_PEER_CERT_CLEANING_CODE_NO_CHECKSUM ;
|
|
|
|
return badCertificate;
|
|
|
|
}
|
|
|
|
|
|
|
|
while(currBadCertIdx < endCertStartIdx1 && (badCertificate[currBadCertIdx] == '=' || badCertificate[currBadCertIdx] == ' ' || badCertificate[currBadCertIdx] == '\n' ))
|
|
|
|
currBadCertIdx++ ;
|
|
|
|
|
|
|
|
cleanCertificate += "==\n=";
|
|
|
|
|
|
|
|
// if (badCertificate[currBadCertIdx] == '=')
|
|
|
|
// {
|
2011-04-08 18:53:12 +00:00
|
|
|
/* checksum */
|
2008-08-31 18:50:31 +00:00
|
|
|
|
2011-04-08 18:53:12 +00:00
|
|
|
while(currBadCertIdx<endCertStartIdx1)
|
|
|
|
{
|
|
|
|
if (badCertificate[currBadCertIdx]==' ')
|
|
|
|
{
|
|
|
|
currBadCertIdx++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if(badCertificate[currBadCertIdx]=='\n')
|
|
|
|
{
|
|
|
|
currBadCertIdx++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
cleanCertificate += badCertificate[currBadCertIdx];
|
|
|
|
cntPerLine++;
|
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
2011-08-30 21:49:49 +00:00
|
|
|
// }
|
2011-04-08 18:53:12 +00:00
|
|
|
|
|
|
|
if(cleanCertificate.substr(cleanCertificate.length()-1,1)!="\n")
|
|
|
|
{
|
|
|
|
cleanCertificate += "\n";
|
|
|
|
// std::cerr<<"zeeeee"<<std::endl;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// std::cerr<<"zooooo"<<std::endl;
|
2008-08-31 18:50:31 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
Copying the begining part of the certificate end tag. Copying
|
|
|
|
-----END part of the tag.
|
|
|
|
*/
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate += endCertTag;
|
2008-08-31 18:50:31 +00:00
|
|
|
currBadCertIdx=endCertStartIdx2+strlen(endTag);
|
2011-04-08 18:53:12 +00:00
|
|
|
/*
|
2008-08-31 18:50:31 +00:00
|
|
|
Copying the name of the certificate e.g XPGP CERTIFICATE. The end tag also has the
|
|
|
|
the name of the tag.
|
|
|
|
*/
|
|
|
|
while(currBadCertIdx<endCertEndIdx)
|
|
|
|
{
|
|
|
|
if(badCertificate[currBadCertIdx]=='\n')
|
|
|
|
{
|
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
|
|
|
else if( badCertificate[currBadCertIdx]==' ' && (badCertificate[currBadCertIdx-1]==' '|| badCertificate[currBadCertIdx-1]=='\n'))
|
|
|
|
{
|
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate += badCertificate[currBadCertIdx];
|
2008-08-31 18:50:31 +00:00
|
|
|
currBadCertIdx++;
|
|
|
|
}
|
|
|
|
}
|
2011-04-08 18:53:12 +00:00
|
|
|
|
2008-08-31 18:50:31 +00:00
|
|
|
/*
|
|
|
|
If the last character is a space we need to remove it.
|
|
|
|
*/
|
2010-08-14 11:51:15 +00:00
|
|
|
if(cleanCertificate.substr(cleanCertificate.length()-1,1)==" ")
|
2008-08-31 18:50:31 +00:00
|
|
|
{
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate.erase(cleanCertificate.length()-1);
|
2008-08-31 18:50:31 +00:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
Copying the end part(-----) of the end tag in the certificate.
|
|
|
|
*/
|
2010-08-14 11:51:15 +00:00
|
|
|
cleanCertificate += commonTag;
|
|
|
|
cleanCertificate += "\n";
|
2008-08-31 18:50:31 +00:00
|
|
|
|
2011-08-30 21:49:49 +00:00
|
|
|
error_code = RS_PEER_CERT_CLEANING_CODE_NO_ERROR ;
|
2011-04-08 18:53:12 +00:00
|
|
|
return cleanCertificate;
|
2008-08-31 18:50:31 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 18:53:12 +00:00
|
|
|
#ifdef UNUSED_CODE
|
2008-08-31 18:50:31 +00:00
|
|
|
int findEndIdxOfCertStartTag(std::string badCertificate)
|
|
|
|
{
|
2011-04-08 18:53:12 +00:00
|
|
|
size_t idxTag1=0;
|
|
|
|
size_t tmpIdx=0;
|
|
|
|
size_t idxTag2=0;
|
|
|
|
const char * tag1="---";
|
|
|
|
const char * tag2="---";
|
2008-08-31 18:50:31 +00:00
|
|
|
bool found=false;
|
|
|
|
while(found==false && (idxTag1=badCertificate.find(tag1,tmpIdx))!=std::string::npos)
|
|
|
|
{
|
|
|
|
idxTag2=badCertificate.find(tag2,idxTag1+strlen(tag1));
|
2011-04-08 18:53:12 +00:00
|
|
|
|
2008-08-31 18:50:31 +00:00
|
|
|
if(idxTag2!=std::string::npos)
|
|
|
|
{
|
|
|
|
found=true;
|
2011-04-08 18:53:12 +00:00
|
|
|
for(size_t i=idxTag1+strlen(tag1);i<idxTag2;i++)
|
2008-08-31 18:50:31 +00:00
|
|
|
{
|
|
|
|
if(badCertificate[i]!=' ')
|
|
|
|
{
|
|
|
|
found=false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-04-08 18:53:12 +00:00
|
|
|
return 1;
|
2008-08-31 18:50:31 +00:00
|
|
|
}
|
2011-04-08 18:53:12 +00:00
|
|
|
#endif
|