Create and save a new password credentials record.
#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)
An account label. This is a UTF-8 encoded string used to identify the credentials to user in UI.
Account name. This is a A UTF-8 encoded string used to identify the account principle (for example, username, email).
A UTF-8 encoded string that contains the password.
The owner type to be used when creating credential.
The store where the new credential record should be saved.
(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.
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.
0 if operation was successful, error code otherwise.