Qt Cryptographic Architecture
|
#include <QtCrypto>
Public Member Functions | |
const char & | at (int index) const |
const char * | constData () const |
const char * | data () const |
bool | isEmpty () const |
bool | isNull () const |
bool | isSecure () const |
MemoryRegion (const char *str) | |
MemoryRegion (const QByteArray &from) | |
MemoryRegion (const MemoryRegion &from) | |
MemoryRegion & | operator= (const MemoryRegion &from) |
MemoryRegion & | operator= (const QByteArray &from) |
int | size () const |
QByteArray | toByteArray () const |
Protected Member Functions | |
char & | at (int index) |
char * | data () |
MemoryRegion (bool secure) | |
MemoryRegion (int size, bool secure) | |
MemoryRegion (const QByteArray &from, bool secure) | |
bool | resize (int size) |
void | set (const QByteArray &from, bool secure) |
void | setSecure (bool secure) |
Array of bytes that may be optionally secured.
This class is mostly unusable on its own. Either use it as a SecureArray subclass or call toByteArray() to convert to QByteArray.
Note that this class is implicitly shared (that is, copy on write).
QCA::MemoryRegion::MemoryRegion | ( | const char * | str | ) |
Constructs a new Memory Region from a null terminated character array.
str | pointer to the array of data to copy |
QCA::MemoryRegion::MemoryRegion | ( | const QByteArray & | from | ) |
Constructs a new MemoryRegion from the data in a byte array.
from | the QByteArray to copy from |
QCA::MemoryRegion::MemoryRegion | ( | const MemoryRegion & | from | ) |
Standard copy constructor.
from | the MemoryRegion to copy from |
|
protected |
|
protected |
Create a memory region, optionally using secure storage.
size | the number of bytes in the memory region. |
secure | if this is true, the memory region will use secure storage. |
|
protected |
Create a memory region, optionally using secure storage.
This constructor variant allows you to initialize the memory region from an existing array.
from | the byte array to copy from. |
secure | if this is true, the memory region will use secure storage. |
MemoryRegion& QCA::MemoryRegion::operator= | ( | const MemoryRegion & | from | ) |
Standard assignment operator.
from | the MemoryRegion to copy from |
MemoryRegion& QCA::MemoryRegion::operator= | ( | const QByteArray & | from | ) |
Standard assignment operator.
from | the QByteArray to copy from |
bool QCA::MemoryRegion::isNull | ( | ) | const |
Test if the MemoryRegion is null (i.e.
was created as a null array, and hasn't been resized).
This is probably not what you are trying to do. If you are trying to determine whether there are any bytes in the array, use isEmpty() instead.
bool QCA::MemoryRegion::isSecure | ( | ) | const |
Test if the MemoryRegion is using secure memory, or not.
In this context, memory is secure if it will not be paged out to disk.
QByteArray QCA::MemoryRegion::toByteArray | ( | ) | const |
Convert this memory region to a byte array.
bool QCA::MemoryRegion::isEmpty | ( | ) | const |
Returns true if the size of the memory region is zero.
int QCA::MemoryRegion::size | ( | ) | const |
Returns the number of bytes in the memory region.
const char* QCA::MemoryRegion::data | ( | ) | const |
Convert the contents of the memory region to a C-compatible character array.
This consists of size() bytes, followed by a null terminator.
const char* QCA::MemoryRegion::constData | ( | ) | const |
Convert the contents of the memory region to a C-compatible character array.
This consists of size() bytes, followed by a null terminator.
const char& QCA::MemoryRegion::at | ( | int | index | ) | const |
|
protected |
Convert the contents of the memory region to a C-compatible character array.
This consists of size() bytes, followed by a null terminator.
|
protected |
|
protected |
Resize the memory region to the specified size.
size | the new size of the region. |
|
protected |
Modify the memory region to match a specified byte array.
This resizes the memory region as required to match the byte array size.
from | the byte array to copy from. |
secure | if this is true, the memory region will use secure storage. |
|
protected |
Convert the memory region to use the specified memory type.
This may involve copying data from secure to insecure storage, or from insecure to secure storage.
secure | if true, use secure memory; otherwise use insecure memory. |