MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / KeyDecryptor

Class KeyDecryptor

libcppcryptfs/util/KeybufManager.h:87–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85};
86
87class KeyDecryptor {
88 KeybufManager* m_mgr;
89 bool m_bEntered;
90public:
91 KeyDecryptor() = delete;
92 KeyDecryptor(KeybufManager* mgr, bool manual_enter = false)
93 {
94 m_bEntered = false;
95
96 m_mgr = mgr;
97
98 if (!m_mgr)
99 return;
100
101 if (!manual_enter)
102 Enter();
103 }
104 void Enter()
105 {
106 if (m_bEntered || !m_mgr)
107 return;
108
109 if (!m_mgr->Enter())
110 throw std::exception("KeyDecryptor enter failed");
111
112 m_bEntered = true;
113 }
114 virtual ~KeyDecryptor()
115 {
116 if (m_bEntered)
117 m_mgr->Leave();
118 }
119 // disallow copying
120 KeyDecryptor(KeyDecryptor const&) = delete;
121 void operator=(KeyDecryptor const&) = delete;
122};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected