/* void changePassword (in wstring oldPassword, in wstring newPassword); */ NS_IMETHODIMP nsPK11Token::ChangePassword(const PRUnichar *oldPassword, const PRUnichar *newPassword) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) return NS_ERROR_NOT_AVAILABLE; SECStatus rv; NS_ConvertUCS2toUTF8 aUtf8OldPassword(oldPassword); NS_ConvertUCS2toUTF8 aUtf8NewPassword(newPassword); rv = PK11_ChangePW(mSlot, NS_CONST_CAST(char *, aUtf8OldPassword.get()), NS_CONST_CAST(char *, aUtf8NewPassword.get())); return (rv == SECSuccess) ? NS_OK : NS_ERROR_FAILURE; }
NS_IMETHODIMP nsPK11Token::ChangePassword(const char16_t *oldPassword, const char16_t *newPassword) { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) return NS_ERROR_NOT_AVAILABLE; SECStatus rv; NS_ConvertUTF16toUTF8 aUtf8OldPassword(oldPassword); NS_ConvertUTF16toUTF8 aUtf8NewPassword(newPassword); rv = PK11_ChangePW(mSlot, (oldPassword ? const_cast<char *>(aUtf8OldPassword.get()) : nullptr), (newPassword ? const_cast<char *>(aUtf8NewPassword.get()) : nullptr)); return (rv == SECSuccess) ? NS_OK : NS_ERROR_FAILURE; }