A simple Qt based browser with no bullshit that supports PKCS#11 tokens (such as the SuisseID).
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

48 lines
845 B

#include "SecOpGuard.h"
#include <actDebug.h>
#include <actIToken.h>
#include <actITokenAuth.h>
SecOpGuard::SecOpGuard(act::IToken* token)
: m_token(token)
, act::SCardLock(token->GetOS())
{
ACT_ASSERT(token != NULL);
m_token_auth = token->GetAuth();
}
SecOpGuard::~SecOpGuard()
{
if(!m_token_auth->IsAuthenticated())
return;
try
{
m_token_auth->Logout();
}
catch(act::Exception& ACT_DEBUG_PARAM(e))
{
ACT_TRACE(e, "SecOpGuard::~SecOpGuard");
}
}
bool SecOpGuard::Authenticate(act::ITokenPIN* token_pin, const act::Blob& auth_data)
{
// Auth constraints, chained authorization, anyone?
if(m_token_auth->IsAuthenticated())
return true;
try
{
return (m_token_auth->Login(token_pin, auth_data));
}
catch(act::Exception& ACT_DEBUG_PARAM(e))
{
ACT_TRACE(e, "SecOpGuard::Authenticate");
}
return false;
}