]> WPIA git - cassiopeia.git/blobdiff - src/sslUtil.cpp
upd: Better configuration, respecting profiles
[cassiopeia.git] / src / sslUtil.cpp
index db50f2d46918600e1a645b09aeb2588ef47ac948..c7944f298bed9765993183a987589bc9beb1f105 100644 (file)
@@ -159,8 +159,8 @@ void setupSerial( FILE* f ) {
     }
 }
 
-std::shared_ptr<BIO> openSerial( const char* name ) {
-    FILE* f = fopen( name, "r+" );
+std::shared_ptr<BIO> openSerial( const std::string name ) {
+    FILE* f = fopen( name.c_str(), "r+" );
 
     if( !f ) {
         std::cout << "Opening serial device failed" << std::endl;
@@ -172,3 +172,9 @@ std::shared_ptr<BIO> openSerial( const char* name ) {
     std::shared_ptr<BIO> b( BIO_new_fd( fileno( f ), 0 ), BIO_free );
     return b;
 }
+
+CAConfig::CAConfig( std::string path ) {
+    this->path = path;
+    ca = loadX509FromFile( path + "/ca.crt" );
+    caKey = loadPkeyFromFile( path + "/ca.key" );
+}