7 void writeFile( const std::string& name, const std::string& content ) {
15 std::string readFile( const std::string& name ) {
16 std::ifstream t( name );
17 std::string res = std::string( std::istreambuf_iterator<char>( t ), std::istreambuf_iterator<char>() );
23 std::string writeBackFile( const std::string& serial, const std::string& cert, const std::string& keydir ) {
24 std::string filename = keydir;
25 mkdir( filename.c_str(), 0755 );
27 mkdir( filename.c_str(), 0755 );
30 if( serial.length() < 3 ) {
33 first = serial.substr( 0, serial.length() - 3 );
36 filename += "/" + first;
37 mkdir( filename.c_str(), 0755 );
38 filename += "/" + serial + ".crt";
39 writeFile( filename, cert );