Exemplo n.º 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);
}
Exemplo n.º 2
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);
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 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;
}
Exemplo n.º 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);
}
Exemplo n.º 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());
    }
}
Exemplo n.º 7
0
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());
    }
}
Exemplo n.º 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));
}