refactor LoadCheckX509 into safer AuthSSL::parseX509DetailsFromFile

This commit is contained in:
Gioacchino Mazzurco 2019-05-14 22:05:42 +02:00
parent 0c097c2080
commit 16d606b513
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
5 changed files with 65 additions and 49 deletions

View file

@ -169,6 +169,16 @@ public:
virtual void getCurrentConnectionAttemptInfo(
RsPgpId& gpg_id, RsPeerId& ssl_id, std::string& ssl_cn ) = 0;
/**
* This function parse X509 certificate from the file and return some
* verified informations, like ID and signer
* @return false on error, true otherwise
*/
virtual bool parseX509DetailsFromFile(
const std::string& certFilePath, RsPeerId& certId, RsPgpId& issuer,
std::string& location ) = 0;
virtual ~AuthSSL();
protected:
@ -223,11 +233,16 @@ public:
virtual X509* SignX509ReqWithGPG(X509_REQ *req, long days) override;
/// @see AuthSSL
bool AuthX509WithGPG(X509 *x509,uint32_t& auth_diagnostic) override;
bool AuthX509WithGPG(X509 *x509, uint32_t& auth_diagnostic) override;
/// @see AuthSSL
int VerifyX509Callback(int preverify_ok, X509_STORE_CTX *ctx) override;
/// @see AuthSSL
bool parseX509DetailsFromFile(
const std::string& certFilePath, RsPeerId& certId,
RsPgpId& issuer, std::string& location ) override;
/*****************************************************************/
/*********************** p3config ******************************/