📄 passwordmanager.h
字号:
/* Copyright 2003-2005, Voltage Security, all rights reserved.
*/
#ifndef _PASSWORD_MANAGER_H_
#define _PASSWORD_MANAGER_H_
#include "vibe.h"
#include "PassDialog.h"
#ifdef __cplusplus
extern "C" {
#endif
#define NUM_MAX_PASSWORD_TRIES 3
#define ERROR_MAX_PASSWORD_TRIES_REACHED 2500
#define PASSWORD_MGR_PURPOSE_DESTROY 0x8006
/* Some error messages
*/
#define WRONG_PASSWORD_MSG \
"The password you entered is wrong." \
"\nPlease try again."
#define ERROR_FIND_CLIENT_REQUEST_MSG \
"\nAn error ocurred while determining the client request for this identity." \
"\nThe request generated by the client if any, will not be fulfilled."
#define ERROR_FULFILL_CLIENT_REQUEST_MSG \
"\nThere was an errror while fulfilling the request generated by client " \
"For this identity."
#define SUCCESS_FULFILL_CLIENT_REQUEST_MSG \
"\nAll the pending requests generated by client for this identity " \
"were fulfilled successfully."
#define MULTIPLE_REQUEST_WARNING_MSG \
"There are Multiple requests pending for this identity." \
"\nToolkit Token handler will try to fulfill all of them" \
"\n You may be asked for passwords multiple times." \
"\nIf you don't know the password, just hit cancel."
#define TOKEN_HANDLER_SUCCESSFUL_MSG \
"\nToken Handler fulfilled all the pending toolkit requets " \
"for this identity successfully." \
"\nYou can now close any open browser windows."
#define TOKEN_HANDLER_UNSUCCESSFUL_MSG \
"\nToken Handler couldn't fulfill all the requests successfully." \
"\nYou can now close any open browser windows."
/* This struct records the status of a password for a given storage location.
*/
struct password_status
{
unsigned char *location;
char password [MAX_PASSWORD_LEN];
unsigned int passwordLen;
char oldPassword [MAX_PASSWORD_LEN];
unsigned int oldPaswordLen;
struct password_status *next;
};
typedef struct password_status PasswordStatus;
/* This is the password manager used by token handler.
*/
int PasswordManager (
VtLibCtx libCtx ,
Pointer localInfo,
unsigned int purpose,
unsigned char **oldPassword,
unsigned int *oldPasswordLen,
unsigned char **password,
unsigned int *passwordLen
) ;
/* This function adds a location to a list of location for which
* the password has been previously retrieved successfully so that
* we don't prompt user for password again for the same location.
* It returns pointers to the current and old passwords for the location.
*/
int AddLocationPasswordToPasswordList (
PasswordStatus **storeList,
unsigned char *location,
char *password,
unsigned char **currentPassword,
unsigned int *currentPasswordLen,
unsigned char **oldPassword,
unsigned int *oldPasswordLen
);
/* This function resets the pasword for a given location in the
* list of locations, for which there is an existing password.
* It returns pointers to the current and old passwords for the location
*/
int ResetPasswordFordLocation (
PasswordStatus *storeList,
unsigned char *location,
char *newPassword,
unsigned char **password,
unsigned int *passwordLen,
unsigned char **oldPassword,
unsigned int *oldPasswordLen
);
/* If the password exists for a give location the return value is 1 otherwise 0.
* It returns pointers to the current and old passwords for the location.
*/
int GetPasswordForLocation (
PasswordStatus *storeList,
unsigned char *location,
unsigned char **password,
unsigned int *passwordLen,
unsigned char **oldPassword,
unsigned int *oldPasswordLen
);
#ifdef __cplusplus
}
#endif
#endif //_PASSWORD_MANAGER_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -