]> granicus.if.org Git - icinga2/blob - lib/remote/pkiutility.hpp
Merge pull request #6734 from leeclemens/remove-redundant-indexes
[icinga2] / lib / remote / pkiutility.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef PKIUTILITY_H
4 #define PKIUTILITY_H
5
6 #include "remote/i2-remote.hpp"
7 #include "base/exception.hpp"
8 #include "base/dictionary.hpp"
9 #include "base/string.hpp"
10 #include <openssl/x509v3.h>
11 #include <memory>
12
13 namespace icinga
14 {
15
16 /**
17  * @ingroup remote
18  */
19 class PkiUtility
20 {
21 public:
22         static int NewCa();
23         static int NewCert(const String& cn, const String& keyfile, const String& csrfile, const String& certfile);
24         static int SignCsr(const String& csrfile, const String& certfile);
25         static std::shared_ptr<X509> FetchCert(const String& host, const String& port);
26         static int WriteCert(const std::shared_ptr<X509>& cert, const String& trustedfile);
27         static int GenTicket(const String& cn, const String& salt, std::ostream& ticketfp);
28         static int RequestCertificate(const String& host, const String& port, const String& keyfile,
29                 const String& certfile, const String& cafile, const std::shared_ptr<X509>& trustedcert,
30                 const String& ticket = String());
31         static String GetCertificateInformation(const std::shared_ptr<X509>& certificate);
32         static Dictionary::Ptr GetCertificateRequests();
33
34 private:
35         PkiUtility();
36
37 };
38
39 }
40
41 #endif /* PKIUTILITY_H */