#define FEATURE_EPRT 0x00000004\r
#define FEATURE_EPSV 0x00000008\r
\r
+// 暗号化通信対応\r
+// REG_SECT_MAXの値を加味する必要がある\r
+#define MAX_CERT_CACHE_HASH 256\r
+\r
\r
/*=================================================\r
* ストラクチャ\r
#include "common.h"\r
#include "resource.h"\r
#include "aes.h"\r
+// 暗号化通信対応\r
+#include "sha.h"\r
\r
#include <htmlhelp.h>\r
#include "helpid.h"\r
int FolderAttrNum = 777;\r
// 同時接続対応\r
int MaxThreadCount = 1;\r
+// 暗号化通信対応\r
+BYTE CertificateCacheHash[MAX_CERT_CACHE_HASH][20];\r
\r
\r
\r
BOOL __stdcall SSLConfirmCallback(BOOL bVerified, LPCSTR Certificate, LPCSTR CommonName)\r
{\r
BOOL bResult;\r
+ int i;\r
+ uint32 Hash[5];\r
char* pm0;\r
bResult = FALSE;\r
- pm0 = NULL;\r
- if(pm0 = AllocateStringM(strlen(Certificate) + 1024))\r
+ sha_memory((char*)Certificate, (uint32)(strlen(Certificate) * sizeof(char)), (uint32*)&Hash);\r
+ for(i = 0; i < MAX_CERT_CACHE_HASH; i++)\r
{\r
- sprintf(pm0, MSGJPN326, IsHostNameMatched(AskHostAdrs(), CommonName) ? MSGJPN327 : MSGJPN328, bVerified ? MSGJPN327 : MSGJPN328, Certificate);\r
- if(MessageBox(GetMainHwnd(), pm0, "FFFTP", MB_YESNO) == IDYES)\r
+ if(memcmp(&CertificateCacheHash[i], &Hash, 20) == 0)\r
bResult = TRUE;\r
}\r
- FreeDuplicatedString(pm0);\r
+ if(!bResult)\r
+ {\r
+ if(pm0 = AllocateStringM(strlen(Certificate) + 1024))\r
+ {\r
+ sprintf(pm0, MSGJPN326, IsHostNameMatched(AskHostAdrs(), CommonName) ? MSGJPN327 : MSGJPN328, bVerified ? MSGJPN327 : MSGJPN328, Certificate);\r
+ if(MessageBox(GetMainHwnd(), pm0, "FFFTP", MB_YESNO) == IDYES)\r
+ {\r
+ for(i = MAX_CERT_CACHE_HASH - 1; i >= 1; i--)\r
+ memcpy(&CertificateCacheHash[i], &CertificateCacheHash[i - 1], 20);\r
+ memcpy(&CertificateCacheHash[0], &Hash, 20);\r
+ bResult = TRUE;\r
+ }\r
+ FreeDuplicatedString(pm0);\r
+ }\r
+ }\r
return bResult;\r
}\r
\r
extern int FolderAttr;\r
extern int FolderAttrNum;\r
\r
+// 暗号化通信対応\r
+extern BYTE CertificateCacheHash[MAX_CERT_CACHE_HASH][20];\r
+\r
/*----- マスタパスワードの設定 ----------------------------------------------\r
*\r
* Parameter\r
if((i = AskCurrentHost()) == HOSTNUM_NOENTRY)\r
i = 0;\r
WriteIntValueToReg(hKey4, "CurSet", i);\r
+\r
+ // 暗号化通信対応\r
+ WriteBinaryToReg(hKey4, "CertCacheHash", &CertificateCacheHash, sizeof(CertificateCacheHash));\r
}\r
CloseSubKey(hKey4);\r
}\r
ReadIntValueFromReg(hKey4, "CurSet", &Sets);\r
SetCurrentHost(Sets);\r
\r
+ // 暗号化通信対応\r
+ ReadBinaryFromReg(hKey4, "CertCacheHash", &CertificateCacheHash, sizeof(CertificateCacheHash));\r
+\r
CloseSubKey(hKey4);\r
}\r
CloseReg(hKey3);\r