Class that represents a password for or from the Haiku key store. More...
Inherits BKey.
Public Member Functions | |
BPasswordKey () | |
Constructor for an empty password key. | |
BPasswordKey (BPasswordKey &other) | |
Copy constructor that makes a copy of an other BPasswordKey. | |
BPasswordKey (const char *password, BKeyPurpose purpose, const char *identifier, const char *secondaryIdentifier=NULL) | |
Constructor for a password key with the provided data. | |
virtual | ~BPasswordKey () |
Free all resources associated with this key. | |
const char * | Password () const |
Get the password for the key. | |
virtual void | PrintToStream () |
Dump the contents of the key to standard output. | |
status_t | SetPassword (const char *password) |
Set the password for this key. | |
status_t | SetTo (const char *password, BKeyPurpose purpose, const char *identifier, const char *secondaryIdentifier=NULL) |
Set the key to specific values. | |
virtual BKeyType | Type () const |
Returns BKeyType::B_KEY_TYPE_PASSWORD. | |
Public Member Functions inherited from BKey | |
BKey () | |
Constructor for an empty generic key. | |
BKey (BKey &other) | |
Copy constructor that makes a copy of an other BKey. | |
BKey (BKeyPurpose purpose, const char *identifier, const char *secondaryIdentifier=NULL, const uint8 *data=NULL, size_t length=0) | |
Constructor for a generic key with the provided data. | |
virtual | ~BKey () |
Free all resources associated with this key. | |
bigtime_t | CreationTime () const |
Get the creation time of the key. | |
const uint8 * | Data () const |
Get a pointer to the data of the key. | |
size_t | DataLength () const |
Get the size of the key in bytes. | |
virtual status_t | Flatten (BMessage &message) const |
Flatten the key into a message. | |
status_t | GetData (uint8 *buffer, size_t bufferSize) const |
Copy the key into the buffer. | |
const char * | Identifier () const |
Get the identifier of the key. | |
bool | operator!= (const BKey &other) const |
Compare this key to an other key. | |
BKey & | operator= (const BKey &other) |
Copy the data from the other key into this key. | |
bool | operator== (const BKey &other) const |
Compare this key to an other key. | |
const char * | Owner () const |
Get the owner of the key. | |
virtual void | PrintToStream () |
Dump the contents of the key to standard output. | |
BKeyPurpose | Purpose () const |
Get the purpose of the key. | |
const char * | SecondaryIdentifier () const |
Get the secondary identifier of the key. | |
status_t | SetData (const uint8 *data, size_t length) |
Set the data for the key. | |
void | SetIdentifier (const char *identifier) |
Set the identifier of the key. | |
void | SetPurpose (BKeyPurpose purpose) |
Set the purpose of the key. | |
void | SetSecondaryIdentifier (const char *identifier) |
Set the secondary identifier of the key. | |
status_t | SetTo (BKeyPurpose purpose, const char *identifier, const char *secondaryIdentifier=NULL, const uint8 *data=NULL, size_t length=0) |
Set the key to the specified values. | |
virtual BKeyType | Type () const |
Returns the type of key. | |
virtual status_t | Unflatten (const BMessage &message) |
Unflatten the key from a message. | |
void | Unset () |
Reset the values of the key. | |
Class that represents a password for or from the Haiku key store.
This is a specialized version of the BKey class, which represents a key of the BKeyType::B_KEY_TYPE_PASSWORD.
BPasswordKey::BPasswordKey | ( | ) |
Constructor for an empty password key.
An empty key has no data associated with it, other than that it has a generic purpose and a password key type.
BPasswordKey::BPasswordKey | ( | const char * | password, |
BKeyPurpose | purpose, | ||
const char * | identifier, | ||
const char * | secondaryIdentifier = NULL |
||
) |
Constructor for a password key with the provided data.
See the BKey introduction for more information about the properties of a key. As you can see, the only required parameters are the purpose and the identifier. Any data you provide will be copied into the BKey object.
password | A null-terminated string that contains the password |
purpose | The purpose of this key |
identifier | A unique identifier for this key |
secondaryIdentifier | An (optional) secondary identifier for this key |
BPasswordKey::BPasswordKey | ( | BPasswordKey & | other | ) |
Copy constructor that makes a copy of an other BPasswordKey.
|
virtual |
Free all resources associated with this key.
const char * BPasswordKey::Password | ( | ) | const |
Get the password for the key.
|
virtual |
Dump the contents of the key to standard output.
This is a debug function that helps you read the contents of the key. All properties, including the actual password, will be printed to stdout
.
Reimplemented from BKey.
status_t BPasswordKey::SetPassword | ( | const char * | password | ) |
Set the password for this key.
password | A null-terminated string that contains the password. |
status_t BPasswordKey::SetTo | ( | const char * | password, |
BKeyPurpose | purpose, | ||
const char * | identifier, | ||
const char * | secondaryIdentifier = NULL |
||
) |
Set the key to specific values.
All properties of the key will be set to the parameters. If the key had a creation time set, it will be cleared. If there was an owner set, this piece of information will not be cleared.
password | A null-terminated string that contains the password |
purpose | The purpose of this key |
identifier | A unique identifier for this key |
secondaryIdentifier | An (optional) secondary identifier for this key |
B_OK
if the changes were successful.B_NO_MEMORY
in case it fails to allocate memory.
|
inlinevirtual |
Returns BKeyType::B_KEY_TYPE_PASSWORD.
Reimplemented from BKey.
References B_KEY_TYPE_PASSWORD.