Exemple #1
0
OTPassword::OTPassword(OTPassword::BlockSize theBlockSize)
    : size_(0)
    , isText_(true)
    , isBinary_(false)
    , isPageLocked_(false)
    , blockSize_(theBlockSize)
{
    data_[0] = '\0';
    setPassword_uint8(reinterpret_cast<const uint8_t*>(""), 0);
}
// ---------------------------------------------------------
OTPassword::OTPassword(const uint8_t * szInput, uint32_t nInputSize, OTPassword::BlockSize theBlockSize/*=DEFAULT_SIZE*/)
:	m_nPasswordSize(0),
    m_bIsText(true),
    m_bIsBinary(false),
    m_bIsPageLocked(false),
    m_theBlockSize(theBlockSize) // The buffer has this size+1 as its static size.
{
	m_szPassword[0] = '\0';
	
	setPassword_uint8(szInput, nInputSize);
}
OTPassword::OTPassword(OTPassword::BlockSize theBlockSize/*=DEFAULT_SIZE*/)
:	m_nPasswordSize(0),
    m_bIsText(true),
    m_bIsBinary(false),
    m_bIsPageLocked(false),
	m_theBlockSize(theBlockSize) // The buffer has this size+1 as its static size.
{
	m_szPassword[0] = '\0';
    
    setPassword_uint8(reinterpret_cast<const uint8_t*>(""), 0);
}
Exemple #4
0
OTPassword& OTPassword::operator=(const OTPassword& rhs)
{
    if (rhs.isPassword()) {
        setPassword_uint8(rhs.getPassword_uint8(), rhs.getPasswordSize());
    }
    else if (rhs.isMemory()) {
        setMemory(rhs.getMemory_uint8(), rhs.getMemorySize());
    }

    return *this;
}
Exemple #5
0
OTPassword::OTPassword(const uint8_t* szInput, uint32_t nInputSize,
                       OTPassword::BlockSize theBlockSize)
    : size_(0)
    , isText_(true)
    , isBinary_(false)
    , isPageLocked_(false)
    , blockSize_(theBlockSize) // The buffer has this size+1 as its static size.
{
    data_[0] = '\0';

    setPassword_uint8(szInput, nInputSize);
}
Exemple #6
0
OTPassword::OTPassword(const OTPassword& rhs)
    : size_(0)
    , isText_(rhs.isPassword())
    , isBinary_(rhs.isMemory())
    , isPageLocked_(false)
    , blockSize_(
          rhs.blockSize_) // The buffer has this size+1 as its static size.
{
    if (isText_) {
        data_[0] = '\0';
        setPassword_uint8(rhs.getPassword_uint8(), rhs.getPasswordSize());
    }
    else if (isBinary_) {
        setMemory(rhs.getMemory_uint8(), rhs.getMemorySize());
    }
}
OTPassword::OTPassword(const OTPassword & rhs)
:	m_nPasswordSize(0),
    m_bIsText(rhs.isPassword()),
    m_bIsBinary(rhs.isMemory()),
    m_bIsPageLocked(false),
    m_theBlockSize(rhs.m_theBlockSize) // The buffer has this size+1 as its static size.
{
    if (m_bIsText)
    {
        m_szPassword[0] = '\0';
        setPassword_uint8(rhs.getPassword_uint8(), rhs.getPasswordSize());
    }
    else if (m_bIsBinary)
    {
        setMemory(rhs.getMemory_uint8(), rhs.getMemorySize());
    }
}
Exemple #8
0
// Returns size of password (in case truncation is necessary.)
// Returns -1 in case of error.
//
int32_t OTPassword::setPassword(const char* szInput, int32_t nInputSize)
{
    return setPassword_uint8(reinterpret_cast<const uint8_t*>(szInput),
                             static_cast<uint32_t>(nInputSize));
}