diff --git a/src/cryptoki.hxx b/src/cryptoki.hxx index 5be367c..eebe401 100644 --- a/src/cryptoki.hxx +++ b/src/cryptoki.hxx @@ -1867,11 +1867,15 @@ namespace cryptoki { CK_USER_TYPE userType=CKU_USER): _session(session) { CRYPTOLOG("log"); //! calls @c C_Login - _session.check(_session._slot.library()->C_Login - (_session._session, userType, - const_cast((const CK_CHAR*)pin.c_str()), - (int)pin.size()), - CRYPTOKI_FN_LOG("C_Login")); + try { + _session.check(_session._slot.library()->C_Login + (_session._session, userType, + const_cast((const CK_CHAR*)pin.c_str()), + (int)pin.size()), + CRYPTOKI_FN_LOG("C_Login")); + } catch (std::exception& x) { + throw wrong_pin(x.what()); + } } ~Login() {