14#include "keyple/card/calypso/SecureTransactionManagerAdapter.hpp"
19#include "keyple/card/calypso/CalypsoCardAdapter.hpp"
20#include "keyple/card/calypso/CommandCloseSecureSession.hpp"
21#include "keyple/core/util/cpp/exception/IllegalStateException.hpp"
22#include "keyple/core/util/cpp/exception/RuntimeException.hpp"
23#include "keypop/calypso/card/WriteAccessLevel.hpp"
29using keyple::core::util::cpp::exception::IllegalStateException;
30using keyple::core::util::cpp::exception::RuntimeException;
31using keypop::calypso::card::WriteAccessLevel;
35 SecureTransactionManagerAdapter<T>::MSG_SECURE_SESSION_NOT_OPEN
36 =
"Secure session is not open";
38const std::string SecureTransactionManagerAdapter<T>::MSG_SECURE_SESSION_OPEN
39 =
"Secure session is open";
42SecureTransactionManagerAdapter<T>::SecureTransactionManagerAdapter(
43 std::shared_ptr<ProxyReaderApi> ,
44 std::shared_ptr<CalypsoCardAdapter> )
45: mIsSecureSessionOpen(false)
51SecureTransactionManagerAdapter<T>::checkSecureSession()
const
53 if (!mIsSecureSessionOpen) {
54 throw IllegalStateException(MSG_SECURE_SESSION_NOT_OPEN);
60SecureTransactionManagerAdapter<T>::checkNoSecureSession()
const
62 if (mIsSecureSessionOpen) {
63 throw IllegalStateException(MSG_SECURE_SESSION_OPEN);
69SecureTransactionManagerAdapter<T>::disablePreOpenMode()
71 TransactionManagerAdapter<T>::mCard->setPreOpenWriteAccessLevel(
72 WriteAccessLevel::UNKOWN);
73 TransactionManagerAdapter<T>::mCard->setPreOpenDataOut({});
78SecureTransactionManagerAdapter<T>::prepareCancelSecureSession()
81 TransactionManagerAdapter<T>::mCommands.push_back(
82 std::unique_ptr<CommandCloseSecureSession>(
83 new CommandCloseSecureSession(
84 this->getTransactionContext(),
85 this->getCommandContext(),
89 this->resetTransaction();
92 resetCommandContext();
99 resetCommandContext();
100 disablePreOpenMode();
102 return dynamic_cast<T&
>(*this);
110#include "keypop/calypso/card/cpp/SecureExtendedModeTransactionManagerBase.hpp"
111#include "keypop/calypso/card/cpp/SecureRegularModeTransactionManagerBase.hpp"
112#include "keypop/calypso/card/transaction/SecurePkiModeTransactionManager.hpp"
114template class keyple::card::calypso::SecureTransactionManagerAdapter<
115 keypop::calypso::card::cpp::SecureExtendedModeTransactionManagerBase>;
117template class keyple::card::calypso::SecureTransactionManagerAdapter<
118 keypop::calypso::card::cpp::SecureRegularModeTransactionManagerBase>;
120template class keyple::card::calypso::SecureTransactionManagerAdapter<
121 keypop::calypso::card::transaction::SecurePkiModeTransactionManager>;