Show ssl_client.cpp syntax highlighted
#include "SSLClient.h"
bool SSLClient::initialized = false;
using std::cout;
using std::cerr;
using std::string;
using std::endl;
int main()
{
std::string line;
try {
SSLClient client("imap.uoregon.edu", "imaps", "/etc/ssl/certs");
if(client.hasValidCert()) {
cout << "imaps.uoregon.edu has a valid certificate." << endl;
} else {
cout << "imap.uoregon.edu does not have a trusted cert." << endl;
cout << "Details: " << client.getCertificateDetails() << endl;
}
std::cout << client.getLine();
client << "1 capability\r\n";
std::cout << client.getLine();
client << "2 login tkay " PASSWORD "\r\n";
std::cout << client.getLine();
client << "3 select inbox\r\n";
do {
line = client.getLine();
std::cout << line;
} while(line[0] != '3' && line[0] != ' ');
} catch(std::exception &e) {
std::cerr << e.what() << std::endl;
return 1;
}
return 0;
}
See more files for this project here