47 lines
825 B
C++
47 lines
825 B
C++
#ifndef __CARDKEY_H__
|
|
#define __CARDKEY_H__
|
|
|
|
|
|
#include <actBlob.h>
|
|
|
|
//#include <openssl/crypto.h>
|
|
//#include <openssl/objects.h>
|
|
#include <openssl/engine.h>
|
|
|
|
#include <memory>
|
|
|
|
namespace act
|
|
{
|
|
class ITokenKey;
|
|
}
|
|
|
|
/*
|
|
* Retains a single RSA key pair and (maybe) the provided PIN which is used to authenticate for usage of
|
|
* this key
|
|
*/
|
|
|
|
class SecOpGuard;
|
|
|
|
class CardKey
|
|
{
|
|
public:
|
|
CardKey(act::ITokenKey* token_key);
|
|
~CardKey();
|
|
|
|
inline act::ITokenKey* getKey() const { return m_token_key.get(); }
|
|
|
|
// NOTE: Contents of source string will be overwritten for security reasons
|
|
void setPin(char *pin);
|
|
void setPin(const act::Blob& pin);
|
|
void setPin(UI_METHOD *ui_method, void *callback_data);
|
|
|
|
bool Authenticate(SecOpGuard& where);
|
|
|
|
private:
|
|
std::auto_ptr<act::ITokenKey> m_token_key;
|
|
act::Blob m_pin;
|
|
};
|
|
|
|
#endif
|
|
|