Loading...
Searching...
No Matches
Public Member Functions | List of all members
BPasswordKey Class Reference

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 uint8Data () 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.
 
BKeyoperator= (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.
 

Detailed Description

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.

Since
Haiku R1

Constructor & Destructor Documentation

◆ BPasswordKey() [1/3]

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.

Since
Haiku R1

◆ BPasswordKey() [2/3]

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.

Parameters
passwordA null-terminated string that contains the password
purposeThe purpose of this key
identifierA unique identifier for this key
secondaryIdentifierAn (optional) secondary identifier for this key
Since
Haiku R1

◆ BPasswordKey() [3/3]

BPasswordKey::BPasswordKey ( BPasswordKey other)

Copy constructor that makes a copy of an other BPasswordKey.

Since
Haiku R1

◆ ~BPasswordKey()

BPasswordKey::~BPasswordKey ( )
virtual

Free all resources associated with this key.

Since
Haiku R1

Member Function Documentation

◆ Password()

const char * BPasswordKey::Password ( ) const

Get the password for the key.

Since
Haiku R1

◆ PrintToStream()

void BPasswordKey::PrintToStream ( )
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.

Since
Haiku R1

Reimplemented from BKey.

◆ SetPassword()

status_t BPasswordKey::SetPassword ( const char *  password)

Set the password for this key.

Parameters
passwordA null-terminated string that contains the password.
Since
Haiku R1

◆ SetTo()

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.

Parameters
passwordA null-terminated string that contains the password
purposeThe purpose of this key
identifierA unique identifier for this key
secondaryIdentifierAn (optional) secondary identifier for this key
Returns
  • B_OK if the changes were successful.
  • B_NO_MEMORY in case it fails to allocate memory.
Since
Haiku R1

◆ Type()

BKeyType BPasswordKey::Type ( ) const
inlinevirtual

Returns BKeyType::B_KEY_TYPE_PASSWORD.

Since
Haiku R1

Reimplemented from BKey.

References B_KEY_TYPE_PASSWORD.