mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 00:49:41 -05:00
improved pgp cleaning function
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5335 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
da8a8ec659
commit
a28786513e
@ -41,6 +41,10 @@ end tag we take care of cases like ----- END XPGP . Here extra empty spaces h
|
||||
introduced and the actual tag should have been -----END XPGP
|
||||
*/
|
||||
|
||||
static bool is_acceptable_radix64Char(char c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '+' || c == '/' ;
|
||||
}
|
||||
|
||||
std::string cleanUpCertificate(const std::string& badCertificate,int& error_code)
|
||||
{
|
||||
@ -262,20 +266,24 @@ std::string cleanUpCertificate(const std::string& badCertificate,int& error_code
|
||||
}
|
||||
|
||||
if(badCertificate[currBadCertIdx]=='=') /* checksum */
|
||||
{
|
||||
cntPerLine=0 ;
|
||||
break;
|
||||
}
|
||||
else if(badCertificate[currBadCertIdx]=='\t')
|
||||
currBadCertIdx++;
|
||||
else if(badCertificate[currBadCertIdx]==' ')
|
||||
currBadCertIdx++;
|
||||
else if(badCertificate[currBadCertIdx]=='\n')
|
||||
currBadCertIdx++;
|
||||
else
|
||||
else if(is_acceptable_radix64Char(badCertificate[currBadCertIdx]))
|
||||
{
|
||||
cleanCertificate += badCertificate[currBadCertIdx];
|
||||
cntPerLine++;
|
||||
currBadCertIdx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "Warning: Invalid character in radix certificate encoding: " << badCertificate[currBadCertIdx] << std::endl;
|
||||
currBadCertIdx++;
|
||||
}
|
||||
}
|
||||
if(currBadCertIdx>=endCertStartIdx1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user