|
Qt Cryptographic Architecture
|
#include <QtCrypto>

Public Member Functions | |
| SecureArray & | append (const SecureArray &a) |
| char & | at (int index) |
| const char & | at (int index) const |
| void | clear () |
| const char * | constData () const |
| char * | data () |
| const char * | data () const |
| void | fill (char fillChar, int fillToPosition=-1) |
| bool | isEmpty () const |
| bool | operator!= (const MemoryRegion &other) const |
| SecureArray & | operator+= (const SecureArray &a) |
| SecureArray & | operator= (const QByteArray &a) |
| SecureArray & | operator= (const SecureArray &from) |
| bool | operator== (const MemoryRegion &other) const |
| char & | operator[] (int index) |
| const char & | operator[] (int index) const |
| bool | resize (int size) |
| SecureArray () | |
| SecureArray (const char *str) | |
| SecureArray (const MemoryRegion &a) | |
| SecureArray (const QByteArray &a) | |
| SecureArray (const SecureArray &from) | |
| SecureArray (int size, char ch=0) | |
| int | size () const |
| QByteArray | toByteArray () const |
| Public Member Functions inherited from QCA::MemoryRegion | |
| 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 MemoryRegion &from) | |
| MemoryRegion (const QByteArray &from) | |
| MemoryRegion & | operator= (const MemoryRegion &from) |
| MemoryRegion & | operator= (const QByteArray &from) |
| int | size () const |
| QByteArray | toByteArray () const |
Protected Member Functions | |
| void | set (const QByteArray &from) |
| void | set (const SecureArray &from) |
| Protected Member Functions inherited from QCA::MemoryRegion | |
| char & | at (int index) |
| char * | data () |
| MemoryRegion (bool secure) | |
| MemoryRegion (const QByteArray &from, bool secure) | |
| MemoryRegion (int size, bool secure) | |
| bool | resize (int size) |
| void | set (const QByteArray &from, bool secure) |
| void | setSecure (bool secure) |
Secure array of bytes.
The SecureArray provides an array of memory from a pool that is, at least partly, secure. In this sense, secure means that the contents of the memory should not be made available to other applications. By comparison, a QByteArray or QString may be held in pages that might be swapped to disk or free'd without being cleared first.
Note that this class is implicitly shared (that is, copy on write).
| QCA::SecureArray::SecureArray | ( | ) |
Construct a secure byte array, zero length.
Referenced by append(), QCA::AuthTag::AuthTag(), QCA::InitializationVector::InitializationVector(), operator+=(), operator=(), operator=(), SecureArray(), set(), and QCA::SymmetricKey::SymmetricKey().
|
explicit |
Construct a secure byte array of the specified length.
| size | the number of bytes in the array |
| ch | the value every byte should be set to |
References size().
| QCA::SecureArray::SecureArray | ( | const char * | str | ) |
Construct a secure byte array from a string.
Note that this copies, rather than references the source array.
| str | the source of the data (as a null terminated string). |
| QCA::SecureArray::SecureArray | ( | const QByteArray & | a | ) |
Construct a secure byte array from a QByteArray.
Note that this copies, rather than references the source array.
| a | the source of the data. |
| QCA::SecureArray::SecureArray | ( | const MemoryRegion & | a | ) |
Construct a secure byte array from a MemoryRegion.
Note that this copies, rather than references the source array
| a | the source of the data. |
| QCA::SecureArray::SecureArray | ( | const SecureArray & | from | ) |
Construct a (shallow) copy of another secure byte array.
| from | the source of the data and length. |
References SecureArray().
| SecureArray & QCA::SecureArray::operator= | ( | const SecureArray & | from | ) |
Creates a reference, rather than a deep copy.
| from | the array to reference |
References SecureArray().
| SecureArray & QCA::SecureArray::operator= | ( | const QByteArray & | a | ) |
Creates a copy, rather than references.
| a | the array to copy from |
References SecureArray().
| void QCA::SecureArray::clear | ( | ) |
Clears the contents of the array and makes it empty.
| char & QCA::SecureArray::operator[] | ( | int | index | ) |
Returns a reference to the byte at the index position.
| index | the zero-based offset to obtain |
| const char & QCA::SecureArray::operator[] | ( | int | index | ) | const |
Returns a reference to the byte at the index position.
| index | the zero-based offset to obtain |
| char * QCA::SecureArray::data | ( | ) |
Pointer to the data in the secure array.
You can use this for memcpy and similar functions. If you are trying to obtain data at a particular offset, you might be better off using at() or operator[]
| const char * QCA::SecureArray::data | ( | ) | const |
Pointer to the data in the secure array.
You can use this for memcpy and similar functions. If you are trying to obtain data at a particular offset, you might be better off using at() or operator[]
| const char * QCA::SecureArray::constData | ( | ) | const |
Pointer to the data in the secure array.
You can use this for memcpy and similar functions. If you are trying to obtain data at a particular offset, you might be better off using at() or operator[]
| char & QCA::SecureArray::at | ( | int | index | ) |
Returns a reference to the byte at the index position.
| index | the zero-based offset to obtain |
| const char & QCA::SecureArray::at | ( | int | index | ) | const |
Returns a reference to the byte at the index position.
| index | the zero-based offset to obtain |
| int QCA::SecureArray::size | ( | ) | const |
Returns the number of bytes in the array.
Referenced by QCA::AuthTag::AuthTag(), QCA::InitializationVector::InitializationVector(), resize(), SecureArray(), and QCA::SymmetricKey::SymmetricKey().
| bool QCA::SecureArray::isEmpty | ( | ) | const |
Test if the array contains any bytes.
This is equivalent to testing (size() != 0). Note that if the array is allocated, isEmpty() is false (even if no data has been added)
| bool QCA::SecureArray::resize | ( | int | size | ) |
Change the length of this array If the new length is less than the old length, the extra information is (safely) discarded.
If the new length is equal to or greater than the old length, the existing data is copied into the array.
| size | the new length |
References size().
| void QCA::SecureArray::fill | ( | char | fillChar, |
| int | fillToPosition = -1 ) |
Fill the data array with a specified character.
| fillChar | the character to use as the fill |
| fillToPosition | the number of characters to fill to. If not specified (or -1), fills array to current length. |
| QByteArray QCA::SecureArray::toByteArray | ( | ) | const |
Copy the contents of the secure array out to a standard QByteArray.
Note that this performs a deep copy of the data.
| SecureArray & QCA::SecureArray::append | ( | const SecureArray & | a | ) |
Append a secure byte array to the end of this array.
| a | the array to append to this array |
References SecureArray().
| bool QCA::SecureArray::operator== | ( | const MemoryRegion & | other | ) | const |
Equality operator.
Returns true if both arrays have the same data (and the same length, of course).
| other | the MemoryRegion to compare to |
|
inline |
Inequality operator.
Returns true if both arrays have different length, or the same length but different data.
| other | the MemoryRegion to compare to |
| SecureArray & QCA::SecureArray::operator+= | ( | const SecureArray & | a | ) |
Append a secure byte array to the end of this array.
| a | the array to append to this array |
References SecureArray().
|
protected |
Assign the contents of a provided byte array to this object.
| from | the byte array to copy |
References SecureArray().
|
protected |
Assign the contents of a provided byte array to this object.
| from | the byte array to copy |