credential_pwd_create()

Create and save a new password credentials record.

Synopsis:

#include <sys/credential/credential_pwd.h>
 
int credential_pwd_create(const char *account_label,
                                        const char *account_name,
                                        const char *password,
                                        credential_owner_type_t owner_type,
                                        credential_store_t *store,
                                        credential_t **cred)

Arguments:

account_label

An account label. This is a UTF-8 encoded string used to identify the credentials to user in UI.

account_name

Account name. This is a A UTF-8 encoded string used to identify the account principle (for example, username, email).

password

A UTF-8 encoded string that contains the password.

owner_type

The owner type to be used when creating credential.

store

The store where the new credential record should be saved.

cred

(Optional) On return, a pointer to the credential structure. You must call credential_release() to release this structure when you're done using it. If set to NULL, then it will not be initialized on return.

Library:

libcredential (For the qcc command, use the -l bps option to link against this library)

Description:

This function allocates a new credential_t structure, initializes it with the input password credential details, and saves it in Credential Manager.

In most cases, it's sufficient to set store to CREDENTIAL_STORE_DEFAULT. If you need to store the credentials outside of the default store, you can use credential_perimeter_store_open() or credential_perimeter_adarp_store_open() to save the credentials in the perimeter or ADARP stores, respectively.

Specifying CREDENTIAL_OWNER_TYPE_ENTERPRISE as the value for owner_type is not allowed as this value is reserved for enterprise-managed credentials.

Returns:

0 if operation was successful, error code otherwise.