qDebug("test failed!");
return -1;
}
- qDebug("writing key.h...");
- QFile fd("key.h");
+ qDebug("writing key.xml...");
+ QFile fd("key.xml");
if(!fd.open(QIODevice::WriteOnly|QIODevice::Truncate)){
- qDebug("Error: cannot open key.h");
+ qDebug("Error: cannot open key.xml");
return -1;
}
char buf[1024];//more than enough for a 1024 bit number in hex
- fd.write("//generated file, don't edit!\n#define RSA_N \"0x");
+ fd.write("<?xml version='1.0'?>\n<!-- generated file, don't edit! -->\n<RSA>\n <n>0x");
fd.write(mpz_get_str(buf,16,n));
- fd.write("\"\n#define RSA_E \"0x");
+ fd.write("</n>\n <e>0x");
fd.write(mpz_get_str(buf,16,e));
- fd.write("\"\n#define RSA_D \"0x");
+ fd.write("</e>\n <d>0x");
fd.write(mpz_get_str(buf,16,d));
- fd.write("\"\n");
+ fd.write("</d>\n</RSA>");
fd.close();
return 0;
}