From 403246c951ab381bace41f639f75a9073cbf897a Mon Sep 17 00:00:00 2001 From: Patrick Proy Date: Wed, 4 May 2016 16:04:13 +0200 Subject: [PATCH] Change update URL + added comments --- README.md | 6 +++++- src/app/sslcertificates.h | 26 +++++++++++++++++++++++++- src/app/sslmainwindow.cpp | 20 +++++++++++++++----- src/app/sslmainwindow.h | 2 ++ src/app/sslmainwindow.ui | 29 +++++++++++++++++++++-------- 5 files changed, 68 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index efa5888..9e73f1f 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,17 @@ Yet Another Openssl GUI : Qt base openssl GUI to create CSR, certificates, keys (RSA / DSA / EC) This project aims to allow creating certificates in a quick and easy way. -Features : +Features : +- Single executable with no dependencies (openssl lib are included) : on Windows for now - Create auto sign certificates, CSR with immediate PEM display to copy/paste - Conversion from certificate to csr - Allow RSA, DSA and elliptic curve keys - Encrypt/descrypt keys, check certificate key match - Set X509v3 extensions - Import/export to PKCS#12 +- Should work on any platform supported by Qt + +Binary includes openssl library : https://www.openssl.org Licence : GPL V3 diff --git a/src/app/sslcertificates.h b/src/app/sslcertificates.h index e1c6df5..a3f37f7 100644 --- a/src/app/sslcertificates.h +++ b/src/app/sslcertificates.h @@ -124,15 +124,39 @@ class SSLCertificates * check ssl errors */ int create_csr(); + /** + * @brief get_csr_PEM : put CSR in PEM format to a string + * @param Skey : string to receive CSR + * @param maxlength : max size to put in Skey + * @return + */ int get_csr_PEM(char* Skey,size_t maxlength); + /** + * @brief get_csr_PEM : put CSR in human readable format to a string + * @param Skey : string to receive CSR + * @param maxlength : max size to put in Skey + * @return + */ int get_csr_HUM(char* Skey,size_t maxlength); + /** + * @brief set_csr_PEM : load csr in Skey in openssl structure + * @param Skey : string containing CSR in PEM format + * @param password : password if encrypted cert, can be null + * @return 0: sucess, 1 : error reading csr, 2: wrong password + * check ssl errors + */ int set_csr_PEM(const char* Skey, char* password); void set_display_callback(void(*callback)(char*)); void clear_display_callback(); - static int abortnow; + static int abortnow; //!< static var to abort key generation when set to 1 + /** + * @brief print_ssl_errors : put all errors in buffer and clear them + * @param buffer + * @param size + */ void print_ssl_errors(char* buffer,size_t size); void empty_ssl_errors(); int SSLError; //!< set to 1 if at least one SSL error raised. reset with empty_ssl_errors (but not with print_ssl_errors) diff --git a/src/app/sslmainwindow.cpp b/src/app/sslmainwindow.cpp index e331ddc..d9e18ce 100644 --- a/src/app/sslmainwindow.cpp +++ b/src/app/sslmainwindow.cpp @@ -1418,6 +1418,11 @@ void SSLMainWindow::on_pushButtonSave2p12_clicked() // TODO : finish this fclose(file); } +void SSLMainWindow::on_pushButtonLoadPKCS12_clicked() +{ + QMessageBox::information(this,"Not yes","Not implemented yet","ok"); +} + /************************ Settings ************************************************/ @@ -1514,7 +1519,7 @@ void SSLMainWindow::check_updates() connect(network, SIGNAL(finished(QNetworkReply*)), this, SLOT(network_reply_finished(QNetworkReply*))); - QUrl updateurl=QUrl("http://www.proy.org/update.php"); + QUrl updateurl=QUrl("http://yaog.proy.org/update.php"); QUrlQuery postdata; postdata.addQueryItem("version",YAOGVERSION); @@ -1529,7 +1534,8 @@ void SSLMainWindow::check_updates() void SSLMainWindow::network_reply_finished(QNetworkReply* reply) //TODO { - QRegExp ok("^.*:OK"); + QRegExp ok("^OK:.*"); + QRegExp update("^UPDATE:.*"); QByteArray bts = reply->readAll(); QString str(bts); reply->deleteLater(); @@ -1538,7 +1544,11 @@ void SSLMainWindow::network_reply_finished(QNetworkReply* reply) //TODO //QMessageBox::information(this,"Reply",str,"Up to date"); return; } - //TODO - QMessageBox::information(this,"Update Available",str,"ok"); - + if (update.exactMatch(str)) + { // TODO : make update automatic + QMessageBox::information(this,"Update Available",str,"Up to date"); + return; + } + //TODO On all other errors, check last OK reply : if older than 1 month, alert user + //For now, silently die (alone) } diff --git a/src/app/sslmainwindow.h b/src/app/sslmainwindow.h index b342878..055a721 100644 --- a/src/app/sslmainwindow.h +++ b/src/app/sslmainwindow.h @@ -304,6 +304,8 @@ private slots: void network_reply_finished(QNetworkReply* reply); + void on_pushButtonLoadPKCS12_clicked(); + signals: //extension_button_del_on_clicked(int row); add_text_output(QString); diff --git a/src/app/sslmainwindow.ui b/src/app/sslmainwindow.ui index b038002..999687e 100644 --- a/src/app/sslmainwindow.ui +++ b/src/app/sslmainwindow.ui @@ -17,7 +17,7 @@ - SSLMainWindow + Yet Another OpenSSL GUI @@ -359,9 +359,9 @@ - 130 + 160 20 - 141 + 110 23 @@ -373,8 +373,8 @@ 280 - 50 - 47 + 80 + 70 20 @@ -386,7 +386,7 @@ 280 - 80 + 100 69 22 @@ -411,9 +411,9 @@ - 50 + 70 20 - 69 + 80 22 @@ -739,6 +739,19 @@ Save Settings + + + + 100 + 240 + 75 + 23 + + + + Load PKCS12 + +