- string current;
- while (!f.eof()) {
- char buffer[128];
- if (f.gets(buffer, 128) == 0) {
- break;
- }
- current += buffer;
- if (strncmp (buffer, "-----END CERTIFICATE-----", 25) == 0) {
- new_chain->add (dcp::Certificate (current));
- current = "";
- } else if (strncmp (buffer, "-----END RSA PRIVATE KEY-----", 29) == 0) {
- new_chain->set_key (current);
- current = "";
- }
- }
+ dcp::File f(wx_to_std(d->GetPath()), "r");
+ if (!f) {
+ throw OpenFileError(f.path(), errno, OpenFileError::WRITE);
+ }