]> WPIA git - cassiopeia.git/blob - src/crypto/sslUtil.h
7a6850451f81566477930f14791a7223b7e34686
[cassiopeia.git] / src / crypto / sslUtil.h
1 #pragma once
2 #include <openssl/ssl.h>
3 #include <memory>
4 #include <string>
5 #include <cinttypes>
6
7 class CAConfig {
8 public:
9     std::string path;
10     std::string name;
11
12     std::shared_ptr<X509> ca;
13     std::shared_ptr<EVP_PKEY> caKey;
14     CAConfig( std::string name );
15
16 };
17
18
19 struct Profile {
20     uint16_t id;
21
22     std::string eku;
23     std::string ku;
24
25     std::shared_ptr<CAConfig> ca;
26 };
27
28 extern std::shared_ptr<int> ssl_lib_ref;
29
30 std::shared_ptr<X509> loadX509FromFile( std::string filename );
31 std::shared_ptr<EVP_PKEY> loadPkeyFromFile( std::string filename );
32
33 std::shared_ptr<SSL_CTX> generateSSLContext( bool server );
34 std::shared_ptr<BIO> openSerial( const std::string name );