mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-31 10:19:24 -04:00
added cleaning of certs in test code
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5404 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bc07b16737
commit
8694919ca7
1 changed files with 21 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "argstream.h"
|
#include "argstream.h"
|
||||||
|
#include <pqi/cleanupxpgp.h>
|
||||||
#include <pgp/rscertificate.h>
|
#include <pgp/rscertificate.h>
|
||||||
|
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
|
@ -9,8 +10,10 @@ int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
argstream as(argc,argv) ;
|
argstream as(argc,argv) ;
|
||||||
std::string keyfile ;
|
std::string keyfile ;
|
||||||
|
bool clean_cert = false ;
|
||||||
|
|
||||||
as >> parameter('i',"input",keyfile,"input certificate file (old or new formats)",true)
|
as >> parameter('i',"input",keyfile,"input certificate file (old or new formats)",true)
|
||||||
|
>> option('c',"clean",clean_cert,"clean cert before parsing")
|
||||||
>> help() ;
|
>> help() ;
|
||||||
|
|
||||||
as.defaultErrorHandling() ;
|
as.defaultErrorHandling() ;
|
||||||
|
@ -32,6 +35,24 @@ int main(int argc,char *argv[])
|
||||||
std::cerr << "==========================================" << std::endl;
|
std::cerr << "==========================================" << std::endl;
|
||||||
std::cerr << res << std::endl;
|
std::cerr << res << std::endl;
|
||||||
std::cerr << "==========================================" << std::endl;
|
std::cerr << "==========================================" << std::endl;
|
||||||
|
|
||||||
|
if(clean_cert)
|
||||||
|
{
|
||||||
|
std::string res2 ;
|
||||||
|
int err ;
|
||||||
|
|
||||||
|
res2 = cleanUpCertificate(res,err) ;
|
||||||
|
|
||||||
|
if(res2 == "")
|
||||||
|
std::cerr << "Error while cleaning: " << err << std::endl;
|
||||||
|
else
|
||||||
|
res = res2 ;
|
||||||
|
|
||||||
|
std::cerr << "Certificate after cleaning:" << std::endl;
|
||||||
|
std::cerr << "==========================================" << std::endl;
|
||||||
|
std::cerr << res << std::endl;
|
||||||
|
std::cerr << "==========================================" << std::endl;
|
||||||
|
}
|
||||||
std::cerr << "Parsing..." << std::endl;
|
std::cerr << "Parsing..." << std::endl;
|
||||||
|
|
||||||
RsCertificate cert(res) ;
|
RsCertificate cert(res) ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue