passwrd.h
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:1k
- // Passwrd.h: interface for the CPasswrd class.
- #ifndef _PASSWRD_HLPER_
- #define _PASSWRD_HLPER_
- extern "C"
- {
- #include "author.h"
- }
- /*
- * Class Name: CPasswrd
- * Purpose Description: System Password info Encrypting or Unencrypting Helper.
- * Author Name/Address: devia lee / lixiaofei@geasp.com
- * Creation Time : 2004/07/01
- */
- class CPasswrd
- {
- public:
-
- // Password decryptor!
- class ToText
- {
- public:
- inline ToText(const char encrypted[MAXPWLEN])
- {
- plaintext = vncDecryptPasswd((char *)encrypted);
- }
- inline ~ToText()
- {
- if (plaintext != NULL)
- {
- ZeroMemory(plaintext, strlen(plaintext));
- free(plaintext);
- }
- }
- inline operator const char*() const {return plaintext;};
- private:
- char *plaintext;
- };
-
- class FromText
- {
- public:
- inline FromText(char *unencrypted)
- {
- vncEncryptPasswd(unencrypted, encrypted);
- ZeroMemory(unencrypted, strlen(unencrypted));
- }
- inline ~FromText()
- {
- }
- inline operator const char*() const {return encrypted;};
- private:
- char encrypted[MAXPWLEN];
- };
-
- class FromClear
- {
- public:
- inline FromClear()
- {
- vncEncryptPasswd("", encrypted); // 初始化密码
- }
- inline ~FromClear()
- {
- }
- inline operator const char*() const {return encrypted;};
- private:
- char encrypted[MAXPWLEN];
- };
- };
- #endif //_PASSWRD_HLPER_