]> WPIA git - cassiopeia.git/blob - src/crypto/remoteSigner.h
chg: Modify the code to use the new logger
[cassiopeia.git] / src / crypto / remoteSigner.h
1 #pragma once
2
3 #include <memory>
4 #include <openssl/ssl.h>
5
6 #include "db/database.h"
7 #include "crypto/signer.h"
8 #include "io/bios.h"
9 #include "io/opensslBIO.h"
10 #include "io/record.h"
11
12
13 class RemoteSigner : public Signer {
14 private:
15     std::shared_ptr<BIO> target;
16     std::shared_ptr<SSL_CTX> ctx;
17     std::shared_ptr<std::ostream> log;
18     int count = 0;
19     void send( std::shared_ptr<OpensslBIOWrapper> bio, RecordHeader& head, RecordHeader::SignerCommand cmd, std::string data );
20 public:
21     RemoteSigner( std::shared_ptr<BIO> target, std::shared_ptr<SSL_CTX> ctx );
22     ~RemoteSigner();
23     std::shared_ptr<SignedCertificate> sign( std::shared_ptr<TBSCertificate> cert );
24     std::pair<std::shared_ptr<CRL>, std::string> revoke( std::shared_ptr<CAConfig> ca, std::vector<std::string> serial );
25
26     void setLog( std::shared_ptr<std::ostream> target );
27 };