diff options
Diffstat (limited to 'plugins/CryptoPP/GPGw')
29 files changed, 2632 insertions, 0 deletions
diff --git a/plugins/CryptoPP/GPGw/GnuPGw.dep b/plugins/CryptoPP/GPGw/GnuPGw.dep new file mode 100644 index 0000000000..4c922be73c --- /dev/null +++ b/plugins/CryptoPP/GPGw/GnuPGw.dep @@ -0,0 +1,141 @@ +# Microsoft Developer Studio Generated Dependency File, included by GnuPGw.mak
+
+.\commonheaders.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\gpg.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\keys.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\language.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\main.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\passdialog.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\passphrases.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\pipeexec.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\tools.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
+
+.\userdialog.c : \
+ "..\version.h"\
+ ".\commonheaders.h"\
+ ".\gpg.h"\
+ ".\keys.h"\
+ ".\language.h"\
+ ".\passdialog.h"\
+ ".\passphrases.h"\
+ ".\pipeexec.h"\
+ ".\size.h"\
+ ".\tools.h"\
+ ".\userdialog.h"\
+
diff --git a/plugins/CryptoPP/GPGw/GnuPGw.dsp b/plugins/CryptoPP/GPGw/GnuPGw.dsp new file mode 100644 index 0000000000..1ce65c2572 --- /dev/null +++ b/plugins/CryptoPP/GPGw/GnuPGw.dsp @@ -0,0 +1,158 @@ +# Microsoft Developer Studio Project File - Name="GnuPGw" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=GnuPGw - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "GnuPGw.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "GnuPGw.mak" CFG="GnuPGw - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "GnuPGw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "GnuPGw___Win32_Release"
+# PROP BASE Intermediate_Dir "GnuPGw___Win32_Release"
+# PROP BASE Ignore_Export_Lib 1
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 1
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /Gi /GX /O2 /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /Yu"commonheaders.h" /FD /c
+# SUBTRACT CPP /Fr
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x417 /d "NDEBUG"
+# ADD RSC /l 0x419 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib shell32.lib gdi32.lib msimg32.lib comdlg32.lib advapi32.lib msvcrt.lib /nologo /base:"0x46100000" /dll /map /machine:I386 /filealign:0x200
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 kernel32.lib user32.lib shell32.lib gdi32.lib msimg32.lib comdlg32.lib advapi32.lib msvcrt.lib /nologo /base:"0x46100000" /dll /map /machine:I386 /filealign:0x200
+# SUBTRACT LINK32 /pdb:none /debug
+# Begin Target
+
+# Name "GnuPGw - Win32 Release"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\commonheaders.c
+# ADD CPP /Yc"commonheaders.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\gpg.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\keys.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\language.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\passdialog.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\passphrases.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pipeexec.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\tools.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\userdialog.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\commonheaders.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\gpg.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\keys.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\language.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\passdialog.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\passphrases.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pipeexec.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\size.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\userdialog.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\resource.rc
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/plugins/CryptoPP/GPGw/GnuPGw.mak b/plugins/CryptoPP/GPGw/GnuPGw.mak new file mode 100644 index 0000000000..225c4fc5d3 --- /dev/null +++ b/plugins/CryptoPP/GPGw/GnuPGw.mak @@ -0,0 +1,191 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on GnuPGw.dsp
+!IF "$(CFG)" == ""
+CFG=GnuPGw - Win32 Release
+!MESSAGE No configuration specified. Defaulting to GnuPGw - Win32 Release.
+!ENDIF
+
+!IF "$(CFG)" != "GnuPGw - Win32 Release"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "GnuPGw.mak" CFG="GnuPGw - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "GnuPGw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : "$(OUTDIR)\GnuPGw.dll"
+
+
+CLEAN :
+ -@erase "$(INTDIR)\commonheaders.obj"
+ -@erase "$(INTDIR)\GnuPGw.pch"
+ -@erase "$(INTDIR)\gpg.obj"
+ -@erase "$(INTDIR)\keys.obj"
+ -@erase "$(INTDIR)\language.obj"
+ -@erase "$(INTDIR)\main.obj"
+ -@erase "$(INTDIR)\passdialog.obj"
+ -@erase "$(INTDIR)\passphrases.obj"
+ -@erase "$(INTDIR)\pipeexec.obj"
+ -@erase "$(INTDIR)\resource.res"
+ -@erase "$(INTDIR)\tools.obj"
+ -@erase "$(INTDIR)\userdialog.obj"
+ -@erase "$(INTDIR)\vc60.idb"
+ -@erase "$(OUTDIR)\GnuPGw.dll"
+ -@erase "$(OUTDIR)\GnuPGw.exp"
+ -@erase "$(OUTDIR)\GnuPGw.map"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MD /W3 /GX /O1 /Ob2 /Fp"$(INTDIR)\GnuPGw.pch" /Yu"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+RSC_PROJ=/l 0x419 /fo"$(INTDIR)\resource.res" /d "NDEBUG"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\GnuPGw.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib shell32.lib gdi32.lib msimg32.lib comdlg32.lib advapi32.lib msvcrt.lib /nologo /base:"0x46100000" /dll /incremental:no /pdb:"$(OUTDIR)\GnuPGw.pdb" /map:"$(INTDIR)\GnuPGw.map" /machine:I386 /out:"$(OUTDIR)\GnuPGw.dll" /implib:"$(OUTDIR)\GnuPGw.lib" /filealign:0x200
+LINK32_OBJS= \
+ "$(INTDIR)\commonheaders.obj" \
+ "$(INTDIR)\gpg.obj" \
+ "$(INTDIR)\keys.obj" \
+ "$(INTDIR)\language.obj" \
+ "$(INTDIR)\main.obj" \
+ "$(INTDIR)\passdialog.obj" \
+ "$(INTDIR)\passphrases.obj" \
+ "$(INTDIR)\pipeexec.obj" \
+ "$(INTDIR)\tools.obj" \
+ "$(INTDIR)\userdialog.obj" \
+ "$(INTDIR)\resource.res"
+
+"$(OUTDIR)\GnuPGw.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("GnuPGw.dep")
+!INCLUDE "GnuPGw.dep"
+!ELSE
+!MESSAGE Warning: cannot find "GnuPGw.dep"
+!ENDIF
+!ENDIF
+
+
+!IF "$(CFG)" == "GnuPGw - Win32 Release"
+SOURCE=.\commonheaders.c
+CPP_SWITCHES=/nologo /MD /W3 /GX /O1 /Ob2 /Fp"$(INTDIR)\GnuPGw.pch" /Yc"commonheaders.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
+
+"$(INTDIR)\commonheaders.obj" "$(INTDIR)\GnuPGw.pch" : $(SOURCE) "$(INTDIR)"
+ $(CPP) @<<
+ $(CPP_SWITCHES) $(SOURCE)
+<<
+
+
+SOURCE=.\gpg.c
+
+"$(INTDIR)\gpg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\keys.c
+
+"$(INTDIR)\keys.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\language.c
+
+"$(INTDIR)\language.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\main.c
+
+"$(INTDIR)\main.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\passdialog.c
+
+"$(INTDIR)\passdialog.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\passphrases.c
+
+"$(INTDIR)\passphrases.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\pipeexec.c
+
+"$(INTDIR)\pipeexec.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\tools.c
+
+"$(INTDIR)\tools.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\userdialog.c
+
+"$(INTDIR)\userdialog.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GnuPGw.pch"
+
+
+SOURCE=.\resource.rc
+
+"$(INTDIR)\resource.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
+
+
+
+!ENDIF
+
diff --git a/plugins/CryptoPP/GPGw/Release/GnuPGw.dll b/plugins/CryptoPP/GPGw/Release/GnuPGw.dll Binary files differnew file mode 100644 index 0000000000..7dba65ea45 --- /dev/null +++ b/plugins/CryptoPP/GPGw/Release/GnuPGw.dll diff --git a/plugins/CryptoPP/GPGw/Release/GnuPGw.map b/plugins/CryptoPP/GPGw/Release/GnuPGw.map new file mode 100644 index 0000000000..ec55dd6734 --- /dev/null +++ b/plugins/CryptoPP/GPGw/Release/GnuPGw.map @@ -0,0 +1,259 @@ + GnuPGw
+
+ Timestamp is 49fdd7b0 (Sun May 03 21:43:12 2009)
+
+ Preferred load address is 46100000
+
+ Start Length Name Class
+ 0001:00000000 00001976H .text CODE
+ 0002:00000000 000000e0H .idata$5 DATA
+ 0002:000000e0 00000064H .idata$2 DATA
+ 0002:00000144 00000014H .idata$3 DATA
+ 0002:00000158 000000e0H .idata$4 DATA
+ 0002:00000238 00000314H .idata$6 DATA
+ 0002:00000550 0000017fH .edata DATA
+ 0003:00000000 000006c0H .data DATA
+ 0003:000006c0 00000e60H .bss DATA
+ 0004:00000000 00000088H .rsrc$01 DATA
+ 0004:00000090 000002a0H .rsrc$02 DATA
+
+ Address Publics by Value Rva+Base Lib:Object
+
+ 0001:00000000 _LogMessage 46101000 f commonheaders.obj
+ 0001:0000004b _detectKeys 4610104b f gpg.obj
+ 0001:00000157 _gpgListPublicKeys 46101157 f gpg.obj
+ 0001:00000225 _gpgListSecretKeys 46101225 f gpg.obj
+ 0001:000002f3 _gpgDetectUserID 461012f3 f gpg.obj
+ 0001:000004a3 _gpgEncrypt 461014a3 f gpg.obj
+ 0001:00000611 _gpgDecrypt 46101611 f gpg.obj
+ 0001:00000791 _initKeyUserIDs 46101791 f keys.obj
+ 0001:000007a7 _updateKeyUserIDs 461017a7 f keys.obj
+ 0001:00000880 _releaseKeyUserIDs 46101880 f keys.obj
+ 0001:00000893 _getKeyUserID 46101893 f keys.obj
+ 0001:000008a8 _getKeyUserIDCount 461018a8 f keys.obj
+ 0001:000008b4 __gpg_init 461018b4 f main.obj
+ 0001:000008e4 __gpg_done 461018e4 f main.obj
+ 0001:000008fd __gpg_open_keyrings 461018fd f main.obj
+ 0001:0000096b __gpg_close_keyrings 4610196b f main.obj
+ 0001:0000096f __gpg_get_error 4610196f f main.obj
+ 0001:00000972 __gpg_set_log 46101972 f main.obj
+ 0001:00000999 __gpg_set_tmp 46101999 f main.obj
+ 0001:000009c9 __gpg_get_passphrases 461019c9 f main.obj
+ 0001:00000a71 __gpg_set_passphrases 46101a71 f main.obj
+ 0001:00000b0f __gpg_encrypt 46101b0f f main.obj
+ 0001:00000b8f __gpg_decrypt 46101b8f f main.obj
+ 0001:00000dfb __gpg_size_keyid 46101dfb f main.obj
+ 0001:00000dff __gpg_select_keyid 46101dff f main.obj
+ 0001:00000e4c _GetRegValue 46101e4c f main.obj
+ 0001:00000eb4 _GetEnvValue 46101eb4 f main.obj
+ 0001:00000ef1 _ShowSelectExecDlg 46101ef1 f main.obj
+ 0001:00000fb0 _ShowSelectHomeDlg 46101fb0 f main.obj
+ 0001:0000108c _dllmain@12 4610208c f main.obj
+ 0001:0000109b _PassphraseDialogProcedure@16 4610209b f passdialog.obj
+ 0001:00001109 _initPassphrases 46102109 f passphrases.obj
+ 0001:00001118 _releasePassphrases 46102118 f passphrases.obj
+ 0001:00001161 _addPassphrase 46102161 f passphrases.obj
+ 0001:000011c7 _getPassphrase 461021c7 f passphrases.obj
+ 0001:00001210 _isWindowsNT 46102210 f pipeexec.obj
+ 0001:00001254 _storeOutput 46102254 f pipeexec.obj
+ 0001:000012aa _pxExecute 461022aa f pipeexec.obj
+ 0001:00001498 _replace 46102498 f tools.obj
+ 0001:00001517 _getNextPart 46102517 f tools.obj
+ 0001:0000156c _appendText 4610256c f tools.obj
+ 0001:000015bb _existsFile 461025bb f tools.obj
+ 0001:000015e3 _existsPath 461025e3 f tools.obj
+ 0001:0000160b _writeToFile 4610260b f tools.obj
+ 0001:00001694 _readFromFile 46102694 f tools.obj
+ 0001:0000171c _getTemporaryFileName 4610271c f tools.obj
+ 0001:00001733 _UserIdDialogProcedure@16 46102733 f userdialog.obj
+ 0001:0000186e _RefreshListView 4610286e f userdialog.obj
+ 0001:00001914 _GetOpenFileNameA@4 46102914 f comdlg32:comdlg32.dll
+ 0001:0000191a _strcat 4610291a f msvcrt:MSVCRT.dll
+ 0001:00001920 _strcpy 46102920 f msvcrt:MSVCRT.dll
+ 0001:00001926 _strcmp 46102926 f msvcrt:MSVCRT.dll
+ 0001:0000192c _strlen 4610292c f msvcrt:MSVCRT.dll
+ 0001:00001940 __alloca_probe 46102940 f msvcrt:chkstk.obj
+ 0001:00001940 __chkstk 46102940 f msvcrt:chkstk.obj
+ 0001:00001970 _memset 46102970 f msvcrt:MSVCRT.dll
+ 0002:00000000 __imp__RegCloseKey@4 46103000 advapi32:ADVAPI32.dll
+ 0002:00000004 __imp__RegOpenKeyA@12 46103004 advapi32:ADVAPI32.dll
+ 0002:00000008 __imp__SetSecurityDescriptorDacl@16 46103008 advapi32:ADVAPI32.dll
+ 0002:0000000c __imp__InitializeSecurityDescriptor@8 4610300c advapi32:ADVAPI32.dll
+ 0002:00000010 __imp__RegQueryValueExA@24 46103010 advapi32:ADVAPI32.dll
+ 0002:00000014 \177ADVAPI32_NULL_THUNK_DATA 46103014 advapi32:ADVAPI32.dll
+ 0002:00000018 __imp__PeekNamedPipe@24 46103018 kernel32:KERNEL32.dll
+ 0002:0000001c __imp__WaitForSingleObject@8 4610301c kernel32:KERNEL32.dll
+ 0002:00000020 __imp__WriteFile@20 46103020 kernel32:KERNEL32.dll
+ 0002:00000024 __imp__GetExitCodeProcess@8 46103024 kernel32:KERNEL32.dll
+ 0002:00000028 __imp__CreateProcessA@40 46103028 kernel32:KERNEL32.dll
+ 0002:0000002c __imp__ReadFile@20 4610302c kernel32:KERNEL32.dll
+ 0002:00000030 __imp__CloseHandle@4 46103030 kernel32:KERNEL32.dll
+ 0002:00000034 __imp__CreatePipe@16 46103034 kernel32:KERNEL32.dll
+ 0002:00000038 __imp__GetFileAttributesA@4 46103038 kernel32:KERNEL32.dll
+ 0002:0000003c __imp__GetTempFileNameA@16 4610303c kernel32:KERNEL32.dll
+ 0002:00000040 __imp__GetVersionExA@4 46103040 kernel32:KERNEL32.dll
+ 0002:00000044 __imp__GetEnvironmentVariableA@12 46103044 kernel32:KERNEL32.dll
+ 0002:00000048 __imp__LocalFree@4 46103048 kernel32:KERNEL32.dll
+ 0002:0000004c __imp__LocalAlloc@8 4610304c kernel32:KERNEL32.dll
+ 0002:00000050 __imp__GetStartupInfoA@4 46103050 kernel32:KERNEL32.dll
+ 0002:00000054 __imp__GetTempPathA@8 46103054 kernel32:KERNEL32.dll
+ 0002:00000058 \177KERNEL32_NULL_THUNK_DATA 46103058 kernel32:KERNEL32.dll
+ 0002:0000005c __imp__free 4610305c msvcrt:MSVCRT.dll
+ 0002:00000060 __imp__fseek 46103060 msvcrt:MSVCRT.dll
+ 0002:00000064 __imp__ftell 46103064 msvcrt:MSVCRT.dll
+ 0002:00000068 __imp__fread 46103068 msvcrt:MSVCRT.dll
+ 0002:0000006c __imp__fwrite 4610306c msvcrt:MSVCRT.dll
+ 0002:00000070 __imp__strncat 46103070 msvcrt:MSVCRT.dll
+ 0002:00000074 __imp__memmove 46103074 msvcrt:MSVCRT.dll
+ 0002:00000078 __imp__strchr 46103078 msvcrt:MSVCRT.dll
+ 0002:0000007c __imp__strncpy 4610307c msvcrt:MSVCRT.dll
+ 0002:00000080 __imp__memset 46103080 msvcrt:MSVCRT.dll
+ 0002:00000084 __imp__realloc 46103084 msvcrt:MSVCRT.dll
+ 0002:00000088 __imp__strcat 46103088 msvcrt:MSVCRT.dll
+ 0002:0000008c __imp__strcpy 4610308c msvcrt:MSVCRT.dll
+ 0002:00000090 __imp__fclose 46103090 msvcrt:MSVCRT.dll
+ 0002:00000094 __imp__fputs 46103094 msvcrt:MSVCRT.dll
+ 0002:00000098 __imp__fopen 46103098 msvcrt:MSVCRT.dll
+ 0002:0000009c __imp__strcmp 4610309c msvcrt:MSVCRT.dll
+ 0002:000000a0 __imp__malloc 461030a0 msvcrt:MSVCRT.dll
+ 0002:000000a4 __imp__remove 461030a4 msvcrt:MSVCRT.dll
+ 0002:000000a8 __imp__strstr 461030a8 msvcrt:MSVCRT.dll
+ 0002:000000ac __imp__strncmp 461030ac msvcrt:MSVCRT.dll
+ 0002:000000b0 __imp__strlen 461030b0 msvcrt:MSVCRT.dll
+ 0002:000000b4 \177MSVCRT_NULL_THUNK_DATA 461030b4 msvcrt:MSVCRT.dll
+ 0002:000000b8 __imp__DialogBoxParamA@20 461030b8 user32:USER32.dll
+ 0002:000000bc __imp__SetDlgItemTextA@12 461030bc user32:USER32.dll
+ 0002:000000c0 __imp__EndDialog@8 461030c0 user32:USER32.dll
+ 0002:000000c4 __imp__GetDlgItemTextA@16 461030c4 user32:USER32.dll
+ 0002:000000c8 __imp__EnableWindow@8 461030c8 user32:USER32.dll
+ 0002:000000cc __imp__GetDlgItem@8 461030cc user32:USER32.dll
+ 0002:000000d0 __imp__SendMessageA@16 461030d0 user32:USER32.dll
+ 0002:000000d4 \177USER32_NULL_THUNK_DATA 461030d4 user32:USER32.dll
+ 0002:000000d8 __imp__GetOpenFileNameA@4 461030d8 comdlg32:comdlg32.dll
+ 0002:000000dc \177comdlg32_NULL_THUNK_DATA 461030dc comdlg32:comdlg32.dll
+ 0002:000000e0 __IMPORT_DESCRIPTOR_KERNEL32 461030e0 kernel32:KERNEL32.dll
+ 0002:000000f4 __IMPORT_DESCRIPTOR_USER32 461030f4 user32:USER32.dll
+ 0002:00000108 __IMPORT_DESCRIPTOR_comdlg32 46103108 comdlg32:comdlg32.dll
+ 0002:0000011c __IMPORT_DESCRIPTOR_ADVAPI32 4610311c advapi32:ADVAPI32.dll
+ 0002:00000130 __IMPORT_DESCRIPTOR_MSVCRT 46103130 msvcrt:MSVCRT.dll
+ 0002:00000144 __NULL_IMPORT_DESCRIPTOR 46103144 kernel32:KERNEL32.dll
+ 0003:00000000 _szModuleName 46104000 commonheaders.obj
+ 0003:00000004 _szVersionStr 46104004 commonheaders.obj
+ 0003:00000008 _txtbeginpgpmessage 46104008 commonheaders.obj
+ 0003:0000000c _txtendpgpmessage 4610400c commonheaders.obj
+ 0003:00000010 ??_C@_0BK@JOKF@?9?9?9?9?9END?5PGP?5MESSAGE?9?9?9?9?9?$AA@ 46104010 commonheaders.obj
+ 0003:0000002c ??_C@_0BM@JJIG@?9?9?9?9?9BEGIN?5PGP?5MESSAGE?9?9?9?9?9?$AA@ 4610402c commonheaders.obj
+ 0003:00000048 ??_C@_0BE@LAIP@GnuPG?5DLL?5?$CI1?40?44?41?$CJ?$AA@ 46104048 commonheaders.obj
+ 0003:0000005c ??_C@_05KOGF@GnuPG?$AA@ 4610405c commonheaders.obj
+ 0003:00000064 ??_C@_01FCOA@?5?$AA@ 46104064 commonheaders.obj
+ 0003:00000068 ??_C@_01FNLH@a?$AA@ 46104068 commonheaders.obj
+ 0003:0000006c _txtgpgargslistpublickeys 4610406c gpg.obj
+ 0003:00000070 _txtgpgargslistsecretkeys 46104070 gpg.obj
+ 0003:00000074 _txtgpgargsimportpublickey 46104074 gpg.obj
+ 0003:00000078 _txtgpgargsexportpublickey 46104078 gpg.obj
+ 0003:0000007c _txtgpgargsdetectuserid 4610407c gpg.obj
+ 0003:00000080 _txtgpgargsencrypt 46104080 gpg.obj
+ 0003:00000084 _txtgpgargsdecrypt 46104084 gpg.obj
+ 0003:00000088 _txtpub 46104088 gpg.obj
+ 0003:0000008c _txtsec 4610408c gpg.obj
+ 0003:00000090 _txtcrlf 46104090 gpg.obj
+ 0003:00000094 _txtcolon 46104094 gpg.obj
+ 0003:00000098 _txtquotationmark 46104098 gpg.obj
+ 0003:0000009c _txtgpgcolon 4610409c gpg.obj
+ 0003:000000a0 _txtplainfile 461040a0 gpg.obj
+ 0003:000000a4 _txtcipherfile 461040a4 gpg.obj
+ 0003:000000a8 _txtuserid 461040a8 gpg.obj
+ 0003:000000ac _txtkeyfile 461040ac gpg.obj
+ 0003:000000b0 _txthome 461040b0 gpg.obj
+ 0003:000000b4 _txtidseparator 461040b4 gpg.obj
+ 0003:000000b8 ??_C@_02GIEM@?0?5?$AA@ 461040b8 gpg.obj
+ 0003:000000bc ??_C@_06HJED@?$CFhome?$CF?$AA@ 461040bc gpg.obj
+ 0003:000000c4 ??_C@_09KME@?$CFkeyfile?$CF?$AA@ 461040c4 gpg.obj
+ 0003:000000d0 ??_C@_08OBEK@?$CFuserid?$CF?$AA@ 461040d0 gpg.obj
+ 0003:000000dc ??_C@_0N@OPDF@?$CFcipherfile?$CF?$AA@ 461040dc gpg.obj
+ 0003:000000ec ??_C@_0M@MB@?$CFplainfile?$CF?$AA@ 461040ec gpg.obj
+ 0003:000000f8 ??_C@_04GMI@gpg?3?$AA@ 461040f8 gpg.obj
+ 0003:00000100 ??_C@_01HMO@?$CC?$AA@ 46104100 gpg.obj
+ 0003:00000104 ??_C@_01PKAG@?3?$AA@ 46104104 gpg.obj
+ 0003:00000108 ??_C@_02PIMC@?$AN?6?$AA@ 46104108 gpg.obj
+ 0003:0000010c ??_C@_03CLEA@sec?$AA@ 4610410c gpg.obj
+ 0003:00000110 ??_C@_03BNEF@pub?$AA@ 46104110 gpg.obj
+ 0003:00000114 ??_C@_0FL@MOKP@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9yes?5?9?9passp@ 46104114 gpg.obj
+ 0003:00000170 ??_C@_0IK@JPKD@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9batch?5?9?9yes@ 46104170 gpg.obj
+ 0003:000001fc ??_C@_0DE@MKBK@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9batch?5?9?9dec@ 461041fc gpg.obj
+ 0003:00000230 ??_C@_0FH@ECPM@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9batch?5?9?9yes@ 46104230 gpg.obj
+ 0003:00000288 ??_C@_0CI@MMOA@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9import?5?$CC?$CFke@ 46104288 gpg.obj
+ 0003:000002b0 ??_C@_0DD@DLMD@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9with?9colon?5@ 461042b0 gpg.obj
+ 0003:000002e4 ??_C@_0DD@DFNM@?9?9homedir?5?$CC?$CFhome?$CF?$CC?5?9?9with?9colon?5@ 461042e4 gpg.obj
+ 0003:00000318 ??_C@_04BBGP@?2x3a?$AA@ 46104318 gpg.obj
+ 0003:00000320 ??_C@_04DKNC@?$DO?$DO?$DO?5?$AA@ 46104320 gpg.obj
+ 0003:00000328 ??_C@_0BB@JNKM@list?5public?5keys?$AA@ 46104328 gpg.obj
+ 0003:0000033c ??_C@_01BJG@?6?$AA@ 4610433c gpg.obj
+ 0003:00000340 ??_C@_0BB@JDLD@list?5secret?5keys?$AA@ 46104340 gpg.obj
+ 0003:00000354 ??_C@_0P@LHID@detect?5user?5id?$AA@ 46104354 gpg.obj
+ 0003:00000364 ??_C@_07CGOE@encrypt?$AA@ 46104364 gpg.obj
+ 0003:0000036c ??_C@_07BLJA@decrypt?$AA@ 4610436c gpg.obj
+ 0003:00000374 _txtlistpublickeysfailed 46104374 language.obj
+ 0003:00000378 _txtlistsecretkeysfailed 46104378 language.obj
+ 0003:0000037c _txtwarning 4610437c language.obj
+ 0003:00000380 _txterror 46104380 language.obj
+ 0003:00000384 _txtdetectuseridfailed 46104384 language.obj
+ 0003:00000388 _txtunknownuserid 46104388 language.obj
+ 0003:0000038c _txtencryptfailed 4610438c language.obj
+ 0003:00000390 ??_C@_0CP@IGDB@Could?5not?5encrypt?5the?5message?4?5I@ 46104390 language.obj
+ 0003:000003c0 ??_C@_0BA@BMKJ@Unknown?5User?5ID?$AA@ 461043c0 language.obj
+ 0003:000003d0 ??_C@_0GH@PFNF@You?5received?5an?5encrypted?5messag@ 461043d0 language.obj
+ 0003:00000438 ??_C@_0BF@MLAH@GnuPG?5Plugin?5?9?5Error?$AA@ 46104438 language.obj
+ 0003:00000450 ??_C@_0BH@MLOA@GnuPG?5Plugin?5?9?5Warning?$AA@ 46104450 language.obj
+ 0003:00000468 ??_C@_0DE@HEGN@Could?5not?5generate?5a?5list?5of?5the@ 46104468 language.obj
+ 0003:0000049c ??_C@_0DE@LKHI@Could?5not?5generate?5a?5list?5of?5the@ 4610449c language.obj
+ 0003:000004d0 ??_C@_01FFCO@?$AC?$AA@ 461044d0 main.obj
+ 0003:000004d4 ??_C@_01KKJH@?$AB?$AA@ 461044d4 main.obj
+ 0003:000004d8 ??_C@_01FEHD@?$AN?$AA@ 461044d8 main.obj
+ 0003:000004dc ??_C@_0BI@DIOP@Select?5GnuPG?5executable?$AA@ 461044dc main.obj
+ 0003:000004f4 ??_C@_0DI@KIMG@GnuPG?5executable?5?$CIgpg?4exe?$CJ?$AAgpg?4e@ 461044f4 main.obj
+ 0003:0000052c ??_C@_08GIFB@?2gpg?4exe?$AA@ 4610452c main.obj
+ 0003:00000538 ??_C@_0BC@PKCH@Install?5Directory?$AA@ 46104538 main.obj
+ 0003:0000054c ??_C@_0L@KPLK@gpgProgram?$AA@ 4610454c main.obj
+ 0003:00000558 ??_C@_0BD@FFCB@Software?2GNU?2GnuPG?$AA@ 46104558 main.obj
+ 0003:0000056c ??_C@_0BE@JBON@Open?5Public?5Keyring?$AA@ 4610456c main.obj
+ 0003:00000580 ??_C@_0EA@FLAI@Public?5key?5rings?5?$CIpubring?4gpg?$CJ?$AAp@ 46104580 main.obj
+ 0003:000005c0 ??_C@_06OEPH@?2gnupg?$AA@ 461045c0 main.obj
+ 0003:000005c8 ??_C@_07DBHH@APPDATA?$AA@ 461045c8 main.obj
+ 0003:000005d0 ??_C@_07DAJH@HomeDir?$AA@ 461045d0 main.obj
+ 0003:000005d8 ??_C@_09IHAA@GNUPGHOME?$AA@ 461045d8 main.obj
+ 0003:000005e4 ??_C@_08PBHE@output?3?6?$AA@ 461045e4 pipeexec.obj
+ 0003:000005f0 ??_C@_0BG@BFBG@create?5process?5failed?$AA@ 461045f0 pipeexec.obj
+ 0003:00000608 ??_C@_04IGAC@?9?9?9?5?$AA@ 46104608 pipeexec.obj
+ 0003:00000610 ??_C@_0BD@CKEI@create?5pipe?5failed?$AA@ 46104610 pipeexec.obj
+ 0003:00000624 ??_C@_0O@FMDH@commandline?3?6?$AA@ 46104624 pipeexec.obj
+ 0003:00000638 _escsequence 46104638 tools.obj
+ 0003:00000650 _escsequencecount 46104650 tools.obj
+ 0003:00000654 ??_C@_01POCP@?7?$AA@ 46104654 tools.obj
+ 0003:00000658 ??_C@_02NLPO@?2t?$AA@ 46104658 tools.obj
+ 0003:0000065c ??_C@_02CEIM@?2r?$AA@ 4610465c tools.obj
+ 0003:00000660 ??_C@_02HDBI@?2n?$AA@ 46104660 tools.obj
+ 0003:00000664 ??_C@_0L@JBPC@filename?3?6?$AA@ 46104664 tools.obj
+ 0003:00000670 ??_C@_0O@HMCP@write?5to?5file?$AA@ 46104670 tools.obj
+ 0003:00000680 ??_C@_02NGAF@wb?$AA@ 46104680 tools.obj
+ 0003:00000684 ??_C@_03MOIF@gpg?$AA@ 46104684 tools.obj
+ 0003:00000688 ??_C@_0P@EGMO@read?5from?5file?$AA@ 46104688 tools.obj
+ 0003:00000698 ??_C@_02JKAF@rb?$AA@ 46104698 tools.obj
+ 0003:000006ac ??_C@_07GIAA@User?5ID?$AA@ 461046ac userdialog.obj
+ 0003:000006b4 ??_C@_06LGJA@Key?5ID?$AA@ 461046b4 userdialog.obj
+ 0003:000006c0 ??_C@_00A@?$AA@ 461046c0 gpg.obj
+ 0003:000007cc _passphrasecount 461047cc <common>
+ 0003:000007d0 _passphrases 461047d0 <common>
+ 0003:000007e0 _dlgpassphrase 461047e0 <common>
+ 0003:000008e0 _keyuseridcount 461048e0 <common>
+ 0003:000008e8 _keyuserids 461048e8 <common>
+ 0003:00000900 _gpgHomeDirectory 46104900 <common>
+ 0003:00000b00 _gpgExecutable 46104b00 <common>
+ 0003:00000d00 _g_hInst 46104d00 <common>
+ 0003:00000d20 _logfile 46104d20 <common>
+ 0003:00001120 _temporarydirectory 46105120 <common>
+
+ entry point at 0000:00000000
+
+ Static symbols
+
diff --git a/plugins/CryptoPP/GPGw/commonheaders.c b/plugins/CryptoPP/GPGw/commonheaders.c new file mode 100644 index 0000000000..5404e4ed80 --- /dev/null +++ b/plugins/CryptoPP/GPGw/commonheaders.c @@ -0,0 +1,42 @@ +#include "commonheaders.h"
+
+LPCSTR szModuleName = MODULENAME;
+LPCSTR szVersionStr = MODULENAME" DLL ("__VERSION_STRING")";
+HINSTANCE g_hInst;
+
+char temporarydirectory[fullfilenamesize];
+char logfile[fullfilenamesize];
+/*
+char *txtbeginpgppublickeyblock="-----BEGIN PGP PUBLIC KEY BLOCK-----";
+char *txtendpgppublickeyblock="-----END PGP PUBLIC KEY BLOCK-----";
+*/
+char *txtbeginpgpmessage="-----BEGIN PGP MESSAGE-----";
+char *txtendpgpmessage="-----END PGP MESSAGE-----";
+
+
+void __cdecl ErrorMessage(const char *alevel, const char *atext, const char *ahint)
+{
+ char buffer[errormessagesize];
+
+ strcpy(buffer, atext);
+ strcat(buffer, " ");
+ strcat(buffer, ahint);
+ MessageBox(NULL, buffer, alevel, MB_OK);
+}
+
+
+void __cdecl LogMessage(const char *astart, const char *atext, const char *aend)
+{
+ FILE *log;
+
+ if(logfile[0]=='\0') return;
+
+ log=fopen(logfile, "a");
+ if(log!=NULL)
+ {
+ fputs(astart, log);
+ fputs(atext, log);
+ fputs(aend, log);
+ fclose(log);
+ }
+}
diff --git a/plugins/CryptoPP/GPGw/commonheaders.h b/plugins/CryptoPP/GPGw/commonheaders.h new file mode 100644 index 0000000000..4ae6e155a7 --- /dev/null +++ b/plugins/CryptoPP/GPGw/commonheaders.h @@ -0,0 +1,79 @@ +// Windows API
+
+#pragma once
+#define _WIN32_IE 0x0500
+//#define WIN32_LEAN_AND_MEAN
+//#pragma warning(disable: 4078)
+
+#include <windows.h>
+//#include <afxwin.h>
+#include <commdlg.h>
+#include <commctrl.h>
+#include <stdio.h>
+#include "..\version.h"
+
+// gnupg plugin
+#include "resource.h"
+#include "size.h"
+#include "language.h"
+#include "pipeexec.h"
+#include "gpg.h"
+#include "tools.h"
+#include "passphrases.h"
+#include "passdialog.h"
+#include "userdialog.h"
+#include "keys.h"
+
+// debug makro
+#define debugout(mtext) MessageBox(NULL, (mtext), "GnuPG Plugin - Debug", MB_OK)
+
+// passphrase typ
+struct passphrase
+{
+ char keyuserid[keyuseridsize];
+ char passphrase[passphrasesize];
+};
+
+extern struct passphrase *passphrases;
+extern int passphrasecount;
+
+extern char temporarydirectory[fullfilenamesize];
+extern char logfile[fullfilenamesize];
+
+extern char *txtbeginpgppublickeyblock;
+extern char *txtendpgppublickeyblock;
+extern char *txtbeginpgpmessage;
+extern char *txtendpgpmessage;
+
+#ifdef _MSC_VER
+//#pragma comment(linker,"/merge:.rdata=.text")
+#pragma comment(linker,"/entry:dllmain")
+#pragma comment(linker,"/nodefaultlib")
+#pragma comment(linker,"/subsystem:windows")
+#pragma optimize("gsy", on)
+#endif
+
+#define MODULENAME "GnuPG"
+
+extern LPCSTR szModuleName;
+extern LPCSTR szVersionStr;
+extern HINSTANCE g_hInst;
+
+#define DLLEXPORT __declspec(dllexport)
+
+extern DLLEXPORT int __cdecl _gpg_init(void);
+extern DLLEXPORT int __cdecl _gpg_done(void);
+extern DLLEXPORT int __cdecl _gpg_open_keyrings(LPSTR,LPSTR);
+extern DLLEXPORT int __cdecl _gpg_close_keyrings(void);
+extern DLLEXPORT void __cdecl _gpg_set_log(LPCSTR);
+extern DLLEXPORT void __cdecl _gpg_set_tmp(LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_get_error(void);
+extern DLLEXPORT int __cdecl _gpg_size_keyid(void);
+extern DLLEXPORT int __cdecl _gpg_select_keyid(HWND,LPSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_encrypt(LPCSTR,LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_decrypt(LPCSTR);
+extern DLLEXPORT LPSTR __cdecl _gpg_get_passphrases();
+extern DLLEXPORT void __cdecl _gpg_set_passphrases(LPCSTR);
+
+void __cdecl ErrorMessage(const char *alevel, const char *atext, const char *ahint);
+void __cdecl LogMessage(const char *astart, const char *atext, const char *aend);
diff --git a/plugins/CryptoPP/GPGw/gnupgw.dsw b/plugins/CryptoPP/GPGw/gnupgw.dsw new file mode 100644 index 0000000000..1c2166cbc1 --- /dev/null +++ b/plugins/CryptoPP/GPGw/gnupgw.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "GnuPGw"=.\GnuPGw.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/plugins/CryptoPP/GPGw/gpg.c b/plugins/CryptoPP/GPGw/gpg.c new file mode 100644 index 0000000000..354e455a94 --- /dev/null +++ b/plugins/CryptoPP/GPGw/gpg.c @@ -0,0 +1,366 @@ +#include "commonheaders.h"
+#include <stdio.h>
+
+char *txtgpgargslistpublickeys=
+ "--homedir \"%home%\""
+ " --with-colon" // felder durch : voneinander abgetrennt
+ " --list-public-keys"; // oeffentliche schluessel auflisten
+char *txtgpgargslistsecretkeys=
+ "--homedir \"%home%\""
+ " --with-colon"
+ " --list-secret-keys"; // geheime schluessel auflisten
+char *txtgpgargsimportpublickey=
+ "--homedir \"%home%\""
+ " --import \"%keyfile%\""; // schluessel importieren
+char *txtgpgargsexportpublickey=
+ "--homedir \"%home%\""
+ " --batch"
+ " --yes" // abfragen mit ja beantworten
+ " --armor" // ausgabe als text
+ " --comment \"\"" // kommentar unterdruecken ("Comment: For info see http://www.gnupg.org")
+ " --no-version" // ausgabe der version unterdruecken ("Version: GnuPG v1.0.6 (MingW32)")
+ " --export \"%userid%\""; // export des schluessels %userid%
+char *txtgpgargsdetectuserid=
+ "--homedir \"%home%\""
+ " --batch" // interaktion verhindern (daraus folgt fehler)
+ " --decrypt \"%cipherfile%\""; // datei %cipherfile% entschluesseln
+char *txtgpgargsencrypt=
+ "--homedir \"%home%\""
+ " --batch"
+ " --yes" // abfragen mit ja beantworten
+ " --armor" // textausgabe
+ " --comment \"\"" // kein kommentar hinzufuegen
+ " --no-version" // keine versions informationen hinzufuegen
+ " --recipient \"%userid%\"" // %userid% des empfaengers
+ " --output \"%cipherfile%\"" // ausgabe in datei %cipherfile%
+ " --encrypt \"%plainfile%\""; // eingabe kommt aus %plainfile%
+char *txtgpgargsdecrypt=
+ "--homedir \"%home%\""
+ " --yes" // abfragen mit ja beantworten
+ " --passphrase-fd 0" // passphrase von stdin
+ " --output \"%plainfile%\"" // ausgabe in datei %plainfile%
+ " --decrypt \"%cipherfile%\""; // eingabe kommt aus %cipherfile%
+
+// oeffentliche zeichenketten
+char gpgExecutable[argumentsize];
+char gpgHomeDirectory[argumentsize];
+
+
+// zeichenketten fuer den internen gebrauch
+char *txtpub="pub";
+char *txtsec="sec";
+char *txtcrlf="\r\n";
+char *txtcolon=":";
+char *txtquotationmark="\"";
+char *txtgpgcolon="gpg:";
+char *txtplainfile="%plainfile%";
+char *txtcipherfile="%cipherfile%";
+char *txtuserid="%userid%";
+char *txtkeyfile="%keyfile%";
+char *txthome="%home%";
+char *txtidseparator=", ";
+
+
+void assembleCommandLine(char *aresult, const char *aexecutable, const char *aargs)
+{
+ strcpy(aresult, aexecutable);
+ strcat(aresult, " ");
+ strcat(aresult, aargs);
+}
+
+
+void detectKeys(char *aresult, char *aoutput, const char *alabel)
+{
+ char line[linesize];
+ char part[linesize];
+ char *linepos;
+ char *partpos;
+ long i;
+
+ strcpy(aresult, "");
+ linepos=aoutput;
+
+ do
+ {
+ linepos=getNextPart(line, linepos, txtcrlf);
+ if(linepos==NULL) break;
+
+ partpos=line;
+ partpos=getNextPart(part, partpos, txtcolon);
+
+ if(strcmp(part, alabel)==0)
+ for(i=1; i<=10; i++)
+ {
+ partpos=getNextPart(part, partpos, txtcolon);
+
+ switch(i)
+ {
+ case 4:
+ strcat(aresult, part);
+ strcat(aresult, txtidseparator);
+ break;
+ case 9:
+ strcat(aresult, part);
+ strcat(aresult, txtcrlf);
+ break;
+ }
+ }
+ }
+ while(linepos!=NULL);
+
+ replace(aresult, "\\x3a", ":");
+}
+
+
+gpgResult gpgListPublicKeys(char *aresult)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "list public keys", "\n");
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargslistpublickeys);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+
+ if((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ detectKeys(aresult, output, txtpub);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgListSecretKeys(char *aresult)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "list secret keys", "\n");
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargslistsecretkeys);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+
+ if((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ detectKeys(aresult, output, txtsec);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgImportPublicKey(const char *akey)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char filename[fullfilenamesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "import public key", "\n");
+ if(! writeToFile(filename, akey)) return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsimportpublickey);
+ replace(commandline, txtkeyfile, filename);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+ remove(filename);
+ free(output);
+
+ if((pxresult!=pxSuccess)||(exitcode!=0))
+ return gpgExecuteFailed;
+
+ return gpgSuccess;
+}
+
+
+gpgResult gpgExportPublicKey(char *aresult, const char *auserid)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "export public key", "\n");
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsexportpublickey);
+ replace(commandline, txtuserid, auserid);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+
+ if((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ strcpy(aresult, "");
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ strcpy(aresult, output);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgDetectUserID(char *aresult, const char *aciphertext)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char filename[fullfilenamesize];
+ char line[linesize];
+ char part[linesize];
+ char *linepos;
+ char *partpos;
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "detect user id", "\n");
+ strcpy(aresult, "");
+
+ if(! writeToFile(filename, aciphertext))
+ return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsdetectuserid);
+ replace(commandline, txtcipherfile, filename);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+ remove(filename);
+
+ if((pxresult!=pxSuccess)&&(pxresult!=pxSuccessExitCodeInvalid))
+ {
+ free(output);
+ return gpgExecuteFailed;
+ }
+
+ linepos=output;
+
+ do
+ {
+ linepos=getNextPart(line, linepos, txtcrlf);
+ if(strncmp(line, txtgpgcolon, strlen(txtgpgcolon))!=0 && strstr(line, txtgpgcolon)==0)
+ {
+ partpos=line;
+ partpos=getNextPart(part, partpos, txtquotationmark);
+ getNextPart(part, partpos, txtquotationmark);
+ linepos=NULL;
+ }
+ }
+ while(linepos!=NULL);
+ strcpy(aresult, part);
+
+ free(output);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgEncrypt(char *aresult, const char *auserid, const char *aplaintext)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char plainfile[fullfilenamesize];
+ char cipherfile[fullfilenamesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "encrypt", "\n");
+ strcpy(aresult, "");
+
+ if(! writeToFile(plainfile, aplaintext))
+ return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ getTemporaryFileName(cipherfile);
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsencrypt);
+ replace(commandline, txtcipherfile, cipherfile);
+ replace(commandline, txtplainfile, plainfile);
+ replace(commandline, txtuserid, auserid);
+ replace(commandline, txthome, gpgHomeDirectory);
+ pxresult=pxExecute(commandline, "", &output, &exitcode);
+ remove(plainfile);
+ free(output);
+
+ if((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ remove(cipherfile);
+ return gpgExecuteFailed;
+ }
+
+ if(! readFromFile(aresult, cipherfile))
+ {
+ remove(cipherfile);
+ return gpgReadFromFileFailed;
+ }
+
+ remove(cipherfile);
+ return gpgSuccess;
+}
+
+
+gpgResult gpgDecrypt(char *aresult, const char *aciphertext, const char *apassphrase)
+{
+ pxResult pxresult;
+ char commandline[commandlinesize];
+ char plainfile[fullfilenamesize];
+ char cipherfile[fullfilenamesize];
+ char passphrase[linesize];
+ DWORD exitcode;
+ char *output;
+
+ LogMessage(">>> ", "decrypt", "\n");
+ strcpy(aresult, "");
+
+ if(! writeToFile(cipherfile, aciphertext))
+ return gpgWriteToFileFailed;
+
+ output=(char *)malloc(1);
+ strcpy(output, "");
+ getTemporaryFileName(plainfile);
+ assembleCommandLine(commandline, gpgExecutable, txtgpgargsdecrypt);
+ replace(commandline, txtcipherfile, cipherfile);
+ replace(commandline, txtplainfile, plainfile);
+ replace(commandline, txthome, gpgHomeDirectory);
+ strcpy(passphrase, apassphrase);
+ strcat(passphrase, txtcrlf);
+ pxresult=pxExecute(commandline, passphrase, &output, &exitcode);
+ remove(cipherfile);
+ free(output);
+
+ if((pxresult!=pxSuccess)||(exitcode!=0))
+ {
+ remove(plainfile);
+ return gpgExecuteFailed;
+ }
+
+ if(! readFromFile(aresult, plainfile))
+ {
+ remove(plainfile);
+ return gpgReadFromFileFailed;
+ }
+
+ remove(plainfile);
+ return gpgSuccess;
+}
+
diff --git a/plugins/CryptoPP/GPGw/gpg.h b/plugins/CryptoPP/GPGw/gpg.h new file mode 100644 index 0000000000..5a06071e4a --- /dev/null +++ b/plugins/CryptoPP/GPGw/gpg.h @@ -0,0 +1,40 @@ +#ifndef __GPG_H__
+#define __GPG_H__
+
+typedef enum
+{
+ gpgSuccess,
+ gpgUnknownError,
+ gpgWriteToFileFailed,
+ gpgReadFromFileFailed,
+ gpgExecuteFailed
+}
+gpgResult;
+
+// konstanten fuer die initialisierung der parameter
+extern char *txtgpgargslistpublickeys;
+extern char *txtgpgargslistsecretkeys;
+extern char *txtgpgargsimportpublickey;
+extern char *txtgpgargsexportpublickey;
+extern char *txtgpgargsdetectuserid;
+extern char *txtgpgargsencrypt;
+extern char *txtgpgargsdecrypt;
+
+// sonstige konstanten
+extern char *txtcrlf;
+extern char *txtidseparator;
+
+// zeichenketten
+extern char gpgExecutable[];
+extern char gpgHomeDirectory[];
+
+// funktionsprototypen
+gpgResult gpgListPublicKeys(char *aresult);
+gpgResult gpgListSecretKeys(char *aresult);
+gpgResult gpgImportPublicKey(const char *akey);
+gpgResult gpgExportPublicKey(char *aresult, const char *auserid);
+gpgResult gpgDetectUserID(char *aresult, const char *aciphertext);
+gpgResult gpgEncrypt(char *aresult, const char *auserid, const char *aplaintext);
+gpgResult gpgDecrypt(char *aresult, const char *aciphertext, const char *apassphrase);
+
+#endif // __GPG_H__
diff --git a/plugins/CryptoPP/GPGw/gpgw.msp b/plugins/CryptoPP/GPGw/gpgw.msp new file mode 100644 index 0000000000..36a8ceedc8 --- /dev/null +++ b/plugins/CryptoPP/GPGw/gpgw.msp @@ -0,0 +1,110 @@ +[Project]
+name=gpgw
+type=2
+defaultConfig=1
+
+
+[Debug]
+// compiler
+workingDirectory=
+arguments=
+intermediateFilesDirectory=Debug
+outputFilesDirectory=Debug
+compilerPreprocessor=
+extraCompilerOptions=
+compilerIncludeDirectory=
+noWarning=0
+defaultWarning=0
+allWarning=1
+extraWarning=0
+isoWarning=0
+warningsAsErrors=0
+debugType=1
+debugLevel=2
+exceptionEnabled=1
+runtimeTypeEnabled=1
+optimizeLevel=0
+
+// linker
+libraryPath=
+outputFilename=Debug\gpgw.dll
+libraries=comdlg32
+extraLinkerOptions=
+ignoreStartupFile=0
+ignoreDefaultLibs=0
+stripExecutableFile=0
+
+// archive
+extraArchiveOptions=
+
+//resource
+resourcePreprocessor=
+resourceIncludeDirectory=
+extraResourceOptions=
+
+[Release]
+// compiler
+workingDirectory=
+arguments=
+intermediateFilesDirectory=Release
+outputFilesDirectory=Release
+compilerPreprocessor=
+extraCompilerOptions=
+compilerIncludeDirectory=
+noWarning=0
+defaultWarning=0
+allWarning=1
+extraWarning=0
+isoWarning=0
+warningAsErrors=0
+debugType=0
+debugLevel=1
+exceptionEnabled=0
+runtimeTypeEnabled=0
+optimizeLevel=4
+
+// linker
+libraryPath=
+outputFilename=Release\gpgw.dll
+libraries=comdlg32
+extraLinkerOptions=
+ignoreStartupFile=0
+ignoreDefaultLibs=0
+stripExecutableFile=1
+
+// archive
+extraArchiveOptions=
+
+//resource
+resourcePreprocessor=
+resourceIncludeDirectory=
+extraResourceOptions=
+
+[Source]
+1=commonheaders.c
+2=gpg.c
+3=keys.c
+4=language.c
+5=main.c
+6=passdialog.c
+7=passphrases.c
+8=pipeexec.c
+9=tools.c
+10=userdialog.c
+[Header]
+1=commonheaders.h
+2=gpg.h
+3=keys.h
+4=language.h
+5=passdialog.h
+6=passphrases.h
+7=pipeexec.h
+8=resource.h
+9=size.h
+10=tools.h
+11=userdialog.h
+[Resource]
+1=resource.rc
+[Other]
+[History]
+pipeexec.c,1120
diff --git a/plugins/CryptoPP/GPGw/keys.c b/plugins/CryptoPP/GPGw/keys.c new file mode 100644 index 0000000000..4cfbe4f71d --- /dev/null +++ b/plugins/CryptoPP/GPGw/keys.c @@ -0,0 +1,67 @@ +#include "commonheaders.h"
+
+typedef char tkeyuserid[keyuseridsize];
+
+tkeyuserid *keyuserids[2];
+int keyuseridcount[2];
+
+
+void initKeyUserIDs(const int atype)
+{
+ keyuseridcount[atype]=0;
+ keyuserids[atype]=NULL;
+}
+
+
+void updateKeyUserIDs(const int atype)
+{
+ char *pos;
+ gpgResult gpgresult;
+ char buffer[largebuffersize];
+ char keyuserid[keyuseridsize];
+
+ releaseKeyUserIDs(atype);
+ initKeyUserIDs(atype);
+
+ ZeroMemory(buffer, sizeof(buffer));
+ if(atype==publickeyuserid) gpgresult=gpgListPublicKeys(buffer);
+ else gpgresult=gpgListSecretKeys(buffer);
+
+ if(gpgresult!=gpgSuccess)
+ {
+// if(atype==publickeyuserid) ErrorMessage(txterror, txtlistpublickeysfailed, txtverifyoptions);
+// else ErrorMessage(txterror, txtlistsecretkeysfailed, txtverifyoptions);
+ return;
+ }
+
+ for(pos=buffer; pos!=NULL; )
+ {
+ pos=getNextPart(keyuserid, pos, txtcrlf);
+
+ if(pos!=NULL)
+ {
+ keyuseridcount[atype]++;
+ keyuserids[atype]=realloc(keyuserids[atype], sizeof(tkeyuserid)*keyuseridcount[atype]);
+ strcpy(keyuserids[atype][keyuseridcount[atype]-1], keyuserid);
+ }
+ }
+}
+
+
+void releaseKeyUserIDs(const int atype)
+{
+ free(keyuserids[atype]);
+}
+
+
+char *getKeyUserID(const int atype, const int aindex)
+{
+ return keyuserids[atype][aindex];
+}
+
+
+int getKeyUserIDCount(const int atype)
+{
+ return keyuseridcount[atype];
+}
+
diff --git a/plugins/CryptoPP/GPGw/keys.h b/plugins/CryptoPP/GPGw/keys.h new file mode 100644 index 0000000000..394c6c05b8 --- /dev/null +++ b/plugins/CryptoPP/GPGw/keys.h @@ -0,0 +1,13 @@ +#ifndef __KEYS_H__
+#define __KEYS_H__
+
+#define publickeyuserid 0
+#define secretkeyuserid 1
+
+void initKeyUserIDs(const int atype);
+void updateKeyUserIDs(const int atype);
+void releaseKeyUserIDs(const int atype);
+char *getKeyUserID(const int atype, const int aindex);
+int getKeyUserIDCount(const int atype);
+
+#endif // __KEYS_H__
diff --git a/plugins/CryptoPP/GPGw/language.c b/plugins/CryptoPP/GPGw/language.c new file mode 100644 index 0000000000..4997711629 --- /dev/null +++ b/plugins/CryptoPP/GPGw/language.c @@ -0,0 +1,27 @@ +#include "commonheaders.h"
+
+//char *txtverifyoptions="Please verify your settings in M->Options->Plugins->GnuPG and GnuPG Advanced."; /*lang*/
+//char *txtinvalidexecutable="The GnuPG Plugin requires the GnuPG executable \"gpg.exe\"."; /*lang*/
+//char *txtinvaliduserid="Could not obtain the GnuPG user id."; /*lang*/
+//char *txtexportpublickeyfailed="The export of your public key failed."; /*lang*/
+//char *txtimportpublickeyfailed="The import of the key failed."; /*lang*/
+char *txtlistpublickeysfailed="Could not generate a list of the public GnuPG keys."; /*lang*/
+char *txtlistsecretkeysfailed="Could not generate a list of the secret GnuPG keys."; /*lang*/
+//char *txtplugins="Plugins"; /*lang*/
+//char *txtgnupgplugin="GnuPG Plugin"; /*lang*/
+//char *txtexecutablefiles="Executable Files"; /*lang*/
+//char *txtselectexecutable="Select GnuPG Executable"; /*lang*/
+char *txtwarning="GnuPG Plugin - Warning"; /*lang*/
+char *txterror="GnuPG Plugin - Error"; /*lang*/
+//char *txtnone="<none>"; /*lang*/
+//char *txtuseencryption="Use GnuPG Encryption"; /*lang*/
+//char *txtsendpublickey="Send GnuPG Key"; /*lang*/
+//char *txtpublickeyreceived="You received a public key."; /*lang*/
+//char *txtpublickeyreceivedstored="You received a public key. It was added to your keyring."; /*lang*/
+char *txtdetectuseridfailed="You received an encrypted message. Could not detect the user id of the public key, used to encrypt it."; /*lang*/
+char *txtunknownuserid="Unknown User ID"; /*lang*/
+char *txtencryptfailed="Could not encrypt the message. It wasn't sent."; /*lang*/
+//char *txtoptions="GnuPG"; /*lang*/
+//char *txtexpertoptions="GnuPG Advanced"; /*lang*/
+
+
diff --git a/plugins/CryptoPP/GPGw/language.h b/plugins/CryptoPP/GPGw/language.h new file mode 100644 index 0000000000..6c3548b4c3 --- /dev/null +++ b/plugins/CryptoPP/GPGw/language.h @@ -0,0 +1,29 @@ +#ifndef __TEXT_H__
+#define __TEXT_H__
+
+// textkonstanten, die uebersetzt werden muessen
+extern char *txtverifyoptions;
+extern char *txtinvalidexecutable;
+extern char *txtinvaliduserid;
+extern char *txtexportpublickeyfailed;
+extern char *txtimportpublickeyfailed;
+extern char *txtlistpublickeysfailed;
+extern char *txtlistsecretkeysfailed;
+extern char *txtplugins;
+extern char *txtgnupgplugin;
+extern char *txtexecutablefiles;
+extern char *txtselectexecutable;
+extern char *txtwarning;
+extern char *txterror;
+extern char *txtnone;
+extern char *txtuseencryption;
+extern char *txtsendpublickey;
+extern char *txtpublickeyreceived;
+extern char *txtpublickeyreceivedstored;
+extern char *txtdetectuseridfailed;
+extern char *txtunknownuserid;
+extern char *txtencryptfailed;
+extern char *txtoptions;
+extern char *txtexpertoptions;
+
+#endif // __TEXT_H__
diff --git a/plugins/CryptoPP/GPGw/main.c b/plugins/CryptoPP/GPGw/main.c new file mode 100644 index 0000000000..766d491704 --- /dev/null +++ b/plugins/CryptoPP/GPGw/main.c @@ -0,0 +1,369 @@ +#include "commonheaders.h"
+
+
+BOOL ShowSelectExecDlg(LPSTR);
+BOOL ShowSelectHomeDlg(LPSTR);
+
+
+int __cdecl _gpg_init()
+{
+ GetTempPath(sizeof(temporarydirectory),temporarydirectory);
+ logfile[0]='\0';
+ initPassphrases();
+ initKeyUserIDs(publickeyuserid);
+ initKeyUserIDs(secretkeyuserid);
+ return 1;
+}
+
+
+int __cdecl _gpg_done()
+{
+ releaseKeyUserIDs(secretkeyuserid);
+ releaseKeyUserIDs(publickeyuserid);
+ releasePassphrases();
+ return 1;
+}
+
+
+int __cdecl _gpg_open_keyrings(LPSTR ExecPath, LPSTR HomePath)
+{
+ if( !ExecPath || (!*ExecPath && !ShowSelectExecDlg(ExecPath)) ) {
+ return 0;
+ }
+ if( !HomePath || (!*HomePath && !ShowSelectHomeDlg(HomePath)) ) {
+ return 0;
+ }
+ if( !existsFile(ExecPath) ) {
+// ErrorMessage(txtwarning, txtinvalidexecutable, txtverifyoptions);
+ return 0;
+ }
+ strcpy(gpgExecutable, ExecPath);
+ strcpy(gpgHomeDirectory, HomePath);
+ updateKeyUserIDs(publickeyuserid);
+ updateKeyUserIDs(secretkeyuserid);
+ return 1;
+}
+
+
+int __cdecl _gpg_close_keyrings()
+{
+ return 1;
+}
+
+
+LPSTR __cdecl _gpg_get_error()
+{
+ return 0;
+}
+
+
+void __cdecl _gpg_set_log(LPCSTR LogPath)
+{
+ if(LogPath) strncpy(logfile,LogPath,sizeof(logfile));
+ else logfile[0]='\0';
+}
+
+
+void __cdecl _gpg_set_tmp(LPCSTR TmpPath)
+{
+ if(TmpPath) strncpy(temporarydirectory,TmpPath,sizeof(temporarydirectory));
+ else GetTempPath(sizeof(temporarydirectory),temporarydirectory);
+}
+
+
+LPSTR __cdecl _gpg_get_passphrases()
+{
+ size_t i; char *b, x;
+
+ b = (char *) LocalAlloc(LPTR,(keyuseridsize+passphrasesize)*passphrasecount+1); *b = '\0';
+
+ for(i=0; i<(size_t)passphrasecount; i++) {
+ strcat(b,passphrases[i].keyuserid); strcat(b,"\x01");
+ strcat(b,passphrases[i].passphrase); strcat(b,"\x02");
+ }
+
+ // encrypt
+ for(i=0; i<strlen(b); i++)
+ if( b[i]>2 ) {
+ x = b[i] ^ ( (i&0x7f) ^ 13);
+ if( x>2 ) b[i]=x;
+ }
+
+ return b;
+}
+
+
+void __cdecl _gpg_set_passphrases(LPCSTR buffer)
+{
+ size_t i, l = strlen(buffer); char *t, *p, *b, x;
+
+ if( !l ) return;
+
+ b = (char *) LocalAlloc(LPTR,l+1);
+ strcpy(b, buffer);
+
+ // decrypt
+ for(i=0; i<strlen(b); i++)
+ if( b[i]>2 ) {
+ x = b[i] ^ ( (i&0x7f) ^ 13);
+ if( x>2 ) b[i]=x;
+ }
+
+ while(*b) {
+ t = strchr(b, '\x02');
+ if(t) {
+ *t = '\0';
+ p = strchr(b, '\x01');
+ *p = '\0';
+ addPassphrase(b, p+1);
+ t++;
+ }
+ b = t;
+ }
+ LocalFree(b);
+}
+
+
+LPSTR __cdecl _gpg_encrypt(LPCSTR message, LPCSTR keyid)
+{
+ char buffer[ciphertextsize];
+ char *encmessage = 0;
+ int encmessagelen;
+ gpgResult gpgresult;
+
+ if(strlen(keyid))
+ {
+ ZeroMemory(buffer, sizeof(buffer));
+ gpgresult=gpgEncrypt(buffer, keyid, message);
+
+ if(gpgresult!=gpgSuccess)
+ {
+// ErrorMessage(txterror, txtencryptfailed, txtverifyoptions);
+ return 0;
+ }
+ encmessagelen = strlen(buffer)+1;
+ encmessage = (char *) LocalAlloc(LPTR,encmessagelen);
+ MoveMemory(encmessage, buffer, encmessagelen);
+ }
+
+ return encmessage;
+}
+
+
+LPSTR __cdecl _gpg_decrypt(LPCSTR message)
+{
+ char buffer[ciphertextsize];
+ char plaintext[plaintextsize];
+ char keyuserid[keyuseridsize];
+ char *begin, *end;
+ int dlgresult;
+ BOOL useridvalid;
+ char *storedpassphrase;
+ char passphrase[passphrasesize];
+ char *decmessage = 0;
+ int decmessagelen;
+ gpgResult gpgresult;
+
+ begin=strstr(message, txtbeginpgpmessage);
+ end=strstr(message, txtendpgpmessage);
+
+ if((begin!=NULL)&&(end!=NULL))
+ {
+ strcpy(buffer, "");
+ strncat(buffer, begin, end-begin+strlen(txtendpgpmessage));
+ replace(buffer, "\r", "");
+ replace(buffer, "\n", txtcrlf);
+
+ ZeroMemory(keyuserid, sizeof(keyuserid));
+ gpgresult=gpgDetectUserID(keyuserid, buffer);
+ storedpassphrase=NULL;
+
+ if(gpgresult!=gpgSuccess)
+ {
+// ErrorMessage(txtwarning, txtdetectuseridfailed, txtverifyoptions);
+ strcpy(keyuserid, txtunknownuserid);
+ useridvalid=FALSE;
+ }
+ else
+ {
+ storedpassphrase=getPassphrase(keyuserid);
+ useridvalid=TRUE;
+ }
+
+ if(storedpassphrase!=NULL)
+ {
+ strcpy(passphrase, storedpassphrase);
+ ZeroMemory(plaintext, sizeof(plaintext));
+ gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
+ }
+ else gpgresult=gpgUnknownError;
+
+ dlgresult=IDOK;
+ while((gpgresult!=gpgSuccess)&&(dlgresult!=IDCANCEL))
+ {
+ dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_PASSPHRASE), NULL, PassphraseDialogProcedure, (LPARAM)keyuserid);
+
+ if(dlgresult==IDOK)
+ {
+ strcpy(passphrase, dlgpassphrase);
+ ZeroMemory(dlgpassphrase, passphrasesize);
+ strcat(passphrase, txtcrlf);
+ ZeroMemory(plaintext, sizeof(plaintext));
+ gpgresult=gpgDecrypt(plaintext, buffer, passphrase);
+ }
+ }
+
+ if(gpgresult==gpgSuccess)
+ {
+ strcpy(buffer, plaintext);
+ }
+
+ if( gpgresult==gpgSuccess && useridvalid==TRUE)
+ addPassphrase(keyuserid, passphrase);
+
+ ZeroMemory(passphrase, sizeof(passphrase));
+
+ decmessagelen = strlen(buffer)+1;
+ decmessage = (char *) LocalAlloc(LPTR,decmessagelen);
+ MoveMemory(decmessage, buffer, decmessagelen);
+ }
+
+ return decmessage;
+}
+
+
+int __cdecl _gpg_size_keyid()
+{
+ return keyidsize;
+}
+
+
+int __cdecl _gpg_select_keyid(HWND hdlg, LPSTR keyid)
+{
+ int dlgresult;
+
+ ZeroMemory(keyid, keyidsize);
+ dlgresult=DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_SELECTKEY), hdlg, UserIdDialogProcedure, (LPARAM)keyid);
+
+ if(dlgresult!=IDOK)
+ ZeroMemory(keyid, keyidsize);
+
+ return (dlgresult==IDOK);
+}
+
+
+void noBackslash(LPSTR path) {
+ LPSTR ptr;
+ ptr = path + strlen(path) - 1;
+ if( *ptr=='\\' ) *ptr = '\0';
+}
+
+
+static char buf[MAX_PATH];
+
+
+LPSTR GetRegValue(HKEY hKey , LPCSTR szPath, LPCSTR szName){
+ DWORD len=MAX_PATH,type;
+ LPSTR ret=0;
+
+ RegOpenKey(hKey,szPath,&hKey);
+ if( RegQueryValueEx(hKey,szName,NULL,&type,(LPBYTE)&buf,&len)==ERROR_SUCCESS ){
+ noBackslash((LPSTR)&buf);
+ ret = (LPSTR)&buf;
+ }
+ RegCloseKey(hKey);
+
+ return ret;
+}
+
+
+LPSTR GetEnvValue(LPCSTR szName){
+ LPSTR ret=0;
+
+ if( GetEnvironmentVariable(szName, buf, MAX_PATH) > 0 ) {
+ noBackslash((LPSTR)&buf);
+ ret = (LPSTR)&buf;
+ }
+
+ return ret;
+}
+
+
+BOOL ShowSelectExecDlg(LPSTR path)
+{
+ OPENFILENAME ofn;
+ ZeroMemory(&ofn,sizeof(ofn));
+
+ ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","gpgProgram");
+ if( ofn.lpstrFile && existsFile(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetRegValue(HKEY_LOCAL_MACHINE,"Software\\GNU\\GnuPG","Install Directory");
+ if( ofn.lpstrFile ) {
+ strcat(ofn.lpstrFile,"\\gpg.exe");
+ if( existsFile(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ }
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
+
+ ofn.lpstrFile = path;
+ ofn.lpstrFilter = "GnuPG executable (gpg.exe)\0gpg.exe\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Select GnuPG executable";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ return TRUE;
+}
+
+
+BOOL ShowSelectHomeDlg(LPSTR path)
+{
+ int i;
+ OPENFILENAME ofn;
+
+ ofn.lpstrFile = GetEnvValue("GNUPGHOME");
+ if( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetRegValue(HKEY_CURRENT_USER,"Software\\GNU\\GnuPG","HomeDir");
+ if( ofn.lpstrFile && existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ ofn.lpstrFile = GetEnvValue("APPDATA");
+ if( ofn.lpstrFile ) {
+ strcat(ofn.lpstrFile,"\\gnupg");
+ if( existsPath(ofn.lpstrFile) ) {
+ strcpy(path, ofn.lpstrFile);
+ return TRUE;
+ }
+ }
+
+ ofn.lStructSize = sizeof(ofn);
+ ofn.nMaxFile = MAX_PATH;
+ ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON;
+
+ ofn.lpstrFile = path;
+ ofn.lpstrFilter = "Public key rings (pubring.gpg)\0pubring.gpg\0All files (*.*)\0*.*\0";
+ ofn.lpstrTitle = "Open Public Keyring";
+ if (!GetOpenFileName(&ofn)) return FALSE;
+
+ for(i=strlen(path);i && path[i]!='\\';i--);
+ path[i] = 0;
+
+ return TRUE;
+}
+
+
+// dllmain
+BOOL WINAPI dllmain(HINSTANCE hInst, DWORD dwReason, LPVOID lpVoid) {
+ g_hInst = hInst;
+ return TRUE;
+}
+
diff --git a/plugins/CryptoPP/GPGw/passdialog.c b/plugins/CryptoPP/GPGw/passdialog.c new file mode 100644 index 0000000000..cbba1139ab --- /dev/null +++ b/plugins/CryptoPP/GPGw/passdialog.c @@ -0,0 +1,29 @@ +#include "commonheaders.h"
+
+char dlgpassphrase[passphrasesize];
+
+
+BOOL CALLBACK PassphraseDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ SetDlgItemText(hdlg, IDC_USERID, (char *)lparam);
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wparam))
+ {
+ case IDOK:
+ ZeroMemory(dlgpassphrase, sizeof(dlgpassphrase));
+ GetDlgItemText(hdlg, IDC_PASSPHRASE, dlgpassphrase, sizeof(dlgpassphrase));
+ case IDCANCEL:
+ EndDialog(hdlg, wparam);
+ return TRUE;
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
diff --git a/plugins/CryptoPP/GPGw/passdialog.h b/plugins/CryptoPP/GPGw/passdialog.h new file mode 100644 index 0000000000..b59f421b3c --- /dev/null +++ b/plugins/CryptoPP/GPGw/passdialog.h @@ -0,0 +1,8 @@ +#ifndef __PASSDIALOG_H__
+#define __PASSDIALOG_H__
+
+extern char dlgpassphrase[];
+
+BOOL CALLBACK PassphraseDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam);
+
+#endif // __PASSDIALOG_H__
diff --git a/plugins/CryptoPP/GPGw/passphrases.c b/plugins/CryptoPP/GPGw/passphrases.c new file mode 100644 index 0000000000..5e93936ffc --- /dev/null +++ b/plugins/CryptoPP/GPGw/passphrases.c @@ -0,0 +1,50 @@ +#include "commonheaders.h"
+
+// globale variablen
+struct passphrase *passphrases;
+int passphrasecount;
+
+
+void initPassphrases(void)
+{
+ passphrasecount=0;
+ passphrases=NULL;
+}
+
+
+void releasePassphrases(void)
+{
+ int i;
+
+ for(i=0; i<passphrasecount; i++)
+ ZeroMemory(passphrases[i].passphrase, sizeof(passphrases[i].passphrase));
+
+ free(passphrases);
+}
+
+
+void addPassphrase(const char *akeyuserid, const char *apassphrase)
+{
+ passphrasecount++;
+ passphrases=realloc(passphrases, sizeof(struct passphrase)*passphrasecount);
+
+ strcpy(passphrases[passphrasecount-1].keyuserid, akeyuserid);
+ strcpy(passphrases[passphrasecount-1].passphrase, apassphrase);
+}
+
+
+char *getPassphrase(const char *akeyuserid)
+{
+ int i;
+ char *result;
+
+ result=NULL;
+ for(i=0; i<passphrasecount; i++)
+ {
+ if(strcmp(passphrases[i].keyuserid, akeyuserid)==0)
+ result=passphrases[i].passphrase;
+ }
+
+ return result;
+}
+
diff --git a/plugins/CryptoPP/GPGw/passphrases.h b/plugins/CryptoPP/GPGw/passphrases.h new file mode 100644 index 0000000000..9a2c25dadd --- /dev/null +++ b/plugins/CryptoPP/GPGw/passphrases.h @@ -0,0 +1,10 @@ +#ifndef __PASSPHRASES_H__
+#define __PASSPHRASES_H__
+
+// funktions prototypen
+void initPassphrases(void);
+void releasePassphrases(void);
+void addPassphrase(const char *akeyuserid, const char *apassphrase);
+char *getPassphrase(const char *akeyuserid);
+
+#endif // __PASSPHRASES_H__
diff --git a/plugins/CryptoPP/GPGw/pipeexec.c b/plugins/CryptoPP/GPGw/pipeexec.c new file mode 100644 index 0000000000..871dfbe3b4 --- /dev/null +++ b/plugins/CryptoPP/GPGw/pipeexec.c @@ -0,0 +1,134 @@ +#include "commonheaders.h"
+
+
+BOOL isWindowsNT(void)
+{
+ BOOL result;
+ OSVERSIONINFO ovi;
+
+ ZeroMemory(&ovi, sizeof(ovi));
+ ovi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
+ GetVersionEx(&ovi);
+
+ if(ovi.dwPlatformId==VER_PLATFORM_WIN32_NT) result=TRUE;
+ else result=FALSE;
+
+ return result;
+}
+
+
+void storeOutput(HANDLE ahandle, char **aoutput)
+{
+ DWORD success;
+ char readbuffer[10];
+ DWORD transfered;
+ DWORD available;
+
+ do
+ {
+ PeekNamedPipe(ahandle, NULL, 0, NULL, &available, NULL);
+
+ if(available==0) continue;
+
+ success=ReadFile(ahandle, readbuffer, sizeof(readbuffer), &transfered, NULL);
+
+ if((success)&&(transfered!=0))
+ appendText(aoutput, readbuffer, transfered);
+ }
+ while(available>0);
+}
+
+
+pxResult pxExecute(char *acommandline, char *ainput, char **aoutput, LPDWORD aexitcode)
+{
+ BOOL success;
+ STARTUPINFO startupinfo;
+ SECURITY_ATTRIBUTES securityattributes;
+ SECURITY_DESCRIPTOR securitydescriptor;
+ PROCESS_INFORMATION processinformation;
+ HANDLE newstdin, newstdout, readstdout, writestdin;
+ char *inputpos;
+ DWORD transfered;
+ int size;
+
+ LogMessage("commandline:\n", acommandline, "\n");
+
+ ZeroMemory(&securityattributes, sizeof(securityattributes));
+ securityattributes.nLength=sizeof(SECURITY_ATTRIBUTES);
+ securityattributes.bInheritHandle=TRUE;
+
+ if(isWindowsNT())
+ {
+ InitializeSecurityDescriptor(&securitydescriptor, SECURITY_DESCRIPTOR_REVISION);
+ SetSecurityDescriptorDacl(&securitydescriptor, TRUE, NULL, FALSE);
+ securityattributes.lpSecurityDescriptor=&securitydescriptor;
+ }
+ else securityattributes.lpSecurityDescriptor=NULL;
+
+ success=CreatePipe(&newstdin, &writestdin ,&securityattributes ,0);
+ if(! success)
+ {
+ LogMessage("--- ", "create pipe failed", "\n");
+ return pxCreatePipeFailed;
+ }
+
+ success=CreatePipe(&readstdout, &newstdout, &securityattributes, 0);
+ if(! success)
+ {
+ LogMessage("--- ", "create pipe failed", "\n");
+ CloseHandle(newstdin);
+ CloseHandle(writestdin);
+ return pxCreatePipeFailed;
+ }
+
+ GetStartupInfo(&startupinfo);
+ startupinfo.dwFlags=STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
+ startupinfo.wShowWindow=SW_HIDE;
+ startupinfo.hStdOutput=newstdout;
+ startupinfo.hStdError=newstdout;
+ startupinfo.hStdInput=newstdin;
+
+ success=CreateProcess(NULL, acommandline, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &startupinfo, &processinformation);
+
+ if(! success)
+ {
+ LogMessage("--- ", "create process failed", "\n");
+ CloseHandle(newstdin);
+ CloseHandle(writestdin);
+ CloseHandle(newstdout);
+ CloseHandle(readstdout);
+ return pxCreateProcessFailed;
+ }
+
+ inputpos=ainput;
+
+ while(TRUE)
+ {
+ success=GetExitCodeProcess(processinformation.hProcess, aexitcode);
+ if((success)&&(*aexitcode!=STILL_ACTIVE)) break;
+
+ storeOutput(readstdout, aoutput);
+
+ if(*inputpos!='\0') size=1;
+ else size=0;
+
+ success=WriteFile(writestdin, inputpos, size, &transfered, NULL);
+
+ inputpos+=transfered;
+ }
+
+ storeOutput(readstdout, aoutput);
+ WaitForSingleObject(processinformation.hProcess, INFINITE);
+
+ LogMessage("output:\n", *aoutput, "");
+
+ CloseHandle(processinformation.hThread);
+ CloseHandle(processinformation.hProcess);
+ CloseHandle(newstdin);
+ CloseHandle(newstdout);
+ CloseHandle(readstdout);
+ CloseHandle(writestdin);
+
+ return pxSuccess;
+}
+
diff --git a/plugins/CryptoPP/GPGw/pipeexec.h b/plugins/CryptoPP/GPGw/pipeexec.h new file mode 100644 index 0000000000..241e071a53 --- /dev/null +++ b/plugins/CryptoPP/GPGw/pipeexec.h @@ -0,0 +1,24 @@ +#ifndef __PIPEEXEC_H__
+#define __PIPEEXEC_H__
+
+#include <windows.h>
+
+// typen
+typedef enum
+{
+ pxSuccess,
+ pxSuccessExitCodeInvalid,
+ pxCreatePipeFailed,
+ pxDuplicateHandleFailed,
+ pxCloseHandleFailed,
+ pxCreateProcessFailed,
+ pxThreadWaitFailed,
+ pxReadFileFailed,
+ pxBufferOverflow
+}
+pxResult;
+
+pxResult pxExecute(char *acommandline, char *ainput, char **aoutput, LPDWORD aexitcode);
+
+#endif // __PIPEEXEC_H__
+
diff --git a/plugins/CryptoPP/GPGw/resource.h b/plugins/CryptoPP/GPGw/resource.h new file mode 100644 index 0000000000..af5efe29d7 --- /dev/null +++ b/plugins/CryptoPP/GPGw/resource.h @@ -0,0 +1,21 @@ +//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by resource.rc
+//
+#define IDD_PASSPHRASE 101
+#define IDD_SELECTKEY 102
+#define IDC_PASSPHRASE 1000
+#define IDC_USERID 1001
+#define IDC_KEYLIST 1002
+#define IDC_REFRESH 1003
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 103
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1004
+#define _APS_NEXT_SYMED_VALUE 103
+#endif
+#endif
diff --git a/plugins/CryptoPP/GPGw/resource.rc b/plugins/CryptoPP/GPGw/resource.rc new file mode 100644 index 0000000000..53968a5d2e --- /dev/null +++ b/plugins/CryptoPP/GPGw/resource.rc @@ -0,0 +1,112 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1251)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_PASSPHRASE DIALOG 0, 0, 238, 46
+STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "GnuPG Plugin - Passphrase"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ LTEXT "Enter passphrase for the secret key of user:", IDC_STATIC,6,4,168,8
+ LTEXT "User ID",IDC_USERID,6,14,168,8
+ EDITTEXT IDC_PASSPHRASE,6,24,168,12,ES_PASSWORD | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "Ok",IDOK,181,7,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,181,24,50,14
+END
+
+IDD_SELECTKEY DIALOGEX 0, 0, 272, 208
+STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "GnuPG Plugin - Select public key"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CONTROL "",IDC_KEYLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
+ LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,258,174
+ PUSHBUTTON "Refresh",IDC_REFRESH,7,187,50,14
+ DEFPUSHBUTTON "Ok",IDOK,154,187,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,215,187,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_SELECTKEY, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 265
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 201
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/plugins/CryptoPP/GPGw/size.h b/plugins/CryptoPP/GPGw/size.h new file mode 100644 index 0000000000..e9382f7a2b --- /dev/null +++ b/plugins/CryptoPP/GPGw/size.h @@ -0,0 +1,21 @@ +#ifndef __SIZE_H__
+#define __SIZE_H__
+
+// array groessen
+#define contactsize 256
+#define passphrasesize 256
+#define errormessagesize 512
+#define keybuffersize 8192
+#define fullfilenamesize 1024
+#define argumentsize 512
+#define commandlinesize 2048
+#define linesize 512
+#define filenamesize L_tmpnam
+#define ciphertextsize 16384
+#define plaintextsize 16384
+#define plugintagsize 128
+#define keyuseridsize 512
+#define keyidsize 80
+#define largebuffersize 16384
+
+#endif // __SIZE_H__
diff --git a/plugins/CryptoPP/GPGw/tools.c b/plugins/CryptoPP/GPGw/tools.c new file mode 100644 index 0000000000..ee7adde761 --- /dev/null +++ b/plugins/CryptoPP/GPGw/tools.c @@ -0,0 +1,191 @@ +#include "commonheaders.h"
+
+// escape sequence type
+struct escapesequence
+{
+ char *sequence;
+ char *code;
+};
+
+// supported escape sequences
+struct escapesequence escsequence[]=
+{
+ {"\\n", "\n"},
+ {"\\r", "\r"},
+ {"\\t", "\t"}
+};
+
+// number of supported escape sequences
+int escsequencecount=sizeof(escsequence)/sizeof(struct escapesequence);
+
+
+void replace(char *atext, const char *apattern, const char *areplacement)
+{
+ char *pos, *last;
+ long textsize;
+ long patternsize;
+ long replacementsize;
+
+ pos=atext;
+ patternsize=strlen(apattern);
+ replacementsize=strlen(areplacement);
+
+ do
+ {
+ // textstelle suchen
+ last=pos;
+ pos=strstr(pos, apattern);
+ // etwas gefunden?
+ if(pos==NULL) break;
+
+ // laenge des textes ermitteln
+ textsize=strlen(last);
+ // platz schaffen
+ memmove(pos+replacementsize, pos+patternsize, textsize-((pos-last)+patternsize)+1);
+ // ersetzen
+ strncpy(pos, areplacement, replacementsize);
+ pos+=replacementsize;
+ }
+ while(pos!=NULL);
+}
+
+
+char *getNextPart(char *aresult, char *atext, const char *aseparator)
+{
+ char *pos;
+
+ strcpy(aresult, "");
+ pos=strstr(atext, aseparator);
+
+ if(pos!=NULL)
+ {
+ strncat(aresult, atext, pos-atext);
+ pos+=strlen(aseparator);
+ }
+ else strcpy(aresult, atext);
+
+ return pos;
+}
+
+
+void getLastPart(char *aresult, char *atext)
+{
+ strcpy(aresult, atext);
+}
+
+
+void appendText(char **abuffer, const char *atext, int atextsize)
+{
+ int size;
+
+ if(*abuffer==NULL) size=0;
+ else size=strlen(*abuffer);
+ size++; // abschliessende 0
+ if(atextsize==0) atextsize=strlen(atext);
+ size+=atextsize;
+
+ *abuffer=(char *)realloc(*abuffer, size);
+ strncat(*abuffer, atext, atextsize);
+}
+
+
+BOOL existsFile(const char *afilename)
+{
+ int attr;
+
+ if(strlen(afilename)==0) return FALSE;
+
+ attr = GetFileAttributes(afilename);
+
+ return ( (attr!=-1) && ((attr&FILE_ATTRIBUTE_DIRECTORY)==0));
+}
+
+
+BOOL existsPath(const char *apathname)
+{
+ int attr;
+
+ if(strlen(apathname)==0) return FALSE;
+
+ attr = GetFileAttributes(apathname);
+
+ return ( (attr!=-1) && (attr&FILE_ATTRIBUTE_DIRECTORY) );
+}
+
+
+BOOL writeToFile(char *afilename, const char *atext)
+{
+ FILE *handle;
+ size_t written;
+ size_t length;
+
+ getTemporaryFileName(afilename);
+
+ handle=fopen(afilename, "wb");
+
+ if(handle==NULL)
+ {
+ LogMessage("--- ", "write to file", "\n");
+ LogMessage("filename:\n", afilename, "\n");
+ return FALSE;
+ }
+
+ length=strlen(atext);
+ written=fwrite(atext, sizeof(char), length, handle);
+
+ if(written!=length) return FALSE;
+
+ fclose(handle);
+ return TRUE;
+}
+
+
+BOOL readFromFile(char *aresult, const char *afilename)
+{
+ FILE *handle;
+ size_t filesize;
+ size_t read;
+
+ handle=fopen(afilename, "rb");
+ if(handle==NULL)
+ {
+ LogMessage("--- ", "read from file", "\n");
+ LogMessage("filename:\n", afilename, "\n");
+ return FALSE;
+ }
+
+ fseek(handle, 0, SEEK_END);
+ filesize=ftell(handle);
+ fseek(handle, 0, SEEK_SET);
+
+ read=fread(aresult, sizeof(char), filesize, handle);
+ if(read!=filesize) return FALSE;
+
+ fclose(handle);
+ return TRUE;
+}
+
+
+void getTemporaryFileName(char *aresult)
+{
+ GetTempFileName(temporarydirectory,"gpg",0,aresult);
+}
+
+
+void quoteEscapeSequences(char *atext)
+{
+ int i;
+
+ for(i=0; i<escsequencecount; i++)
+ replace(atext, escsequence[i].code, escsequence[i].sequence);
+}
+
+
+void unquoteEscapeSequences(char *atext)
+{
+ int i;
+
+ for(i=0; i<escsequencecount; i++)
+ replace(atext, escsequence[i].sequence, escsequence[i].code);
+}
+
diff --git a/plugins/CryptoPP/GPGw/tools.h b/plugins/CryptoPP/GPGw/tools.h new file mode 100644 index 0000000000..74da8552d3 --- /dev/null +++ b/plugins/CryptoPP/GPGw/tools.h @@ -0,0 +1,25 @@ +#ifndef __TOOLS_H__
+#define __TOOLS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void replace(char *atext, const char *apattern, const char *areplacement);
+char *getNextPart(char *aresult, char *atext, const char *aseparator);
+void getLastPart(char *aresult, char *atext);
+void appendText(char **abuffer, const char *atext, int atextsize);
+void quoteEscapeSequences(char *atext);
+void unquoteEscapeSequences(char *atext);
+
+BOOL existsFile(const char *afilename);
+BOOL existsPath(const char *apathname);
+BOOL writeToFile(char *afilename, const char *atext);
+BOOL readFromFile(char *aresult, const char *afilename);
+void getTemporaryFileName(char *aresult);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TOOLS_H__
diff --git a/plugins/CryptoPP/GPGw/userdialog.c b/plugins/CryptoPP/GPGw/userdialog.c new file mode 100644 index 0000000000..bb82917c55 --- /dev/null +++ b/plugins/CryptoPP/GPGw/userdialog.c @@ -0,0 +1,81 @@ +#include "commonheaders.h"
+
+
+void RefreshListView(HWND hLV);
+
+
+BOOL CALLBACK UserIdDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
+{
+ static char *keyid;
+ HWND hLV = GetDlgItem(hdlg,IDC_KEYLIST);
+
+ switch(msg)
+ {
+ case WM_INITDIALOG:
+ {
+ int i;
+ LVCOLUMN lvc;
+ static char *szColHdr[] = { "Key ID", "User ID" };
+ static int iColWidth[] = { 110, 255 };
+ keyid = (char *)lparam;
+
+ ZeroMemory(&lvc,sizeof(LVCOLUMN));
+ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
+ lvc.fmt = LVCFMT_LEFT;
+ for (i = 0; i < 2; i++) {
+ lvc.iSubItem = i;
+ lvc.pszText = szColHdr[i];
+ lvc.cx = iColWidth[i];
+ ListView_InsertColumn(hLV, i, &lvc);
+ }
+
+ RefreshListView(hLV);
+
+ ListView_SetExtendedListViewStyle(hLV, ListView_GetExtendedListViewStyle(hLV) | LVS_EX_FULLROWSELECT);
+ ListView_SetItemState(hLV, 0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
+ EnableWindow(hLV, TRUE);
+ }
+ break;
+ case WM_COMMAND:
+ switch(LOWORD(wparam))
+ {
+ case IDOK:
+ ListView_GetItemText(hLV, ListView_GetNextItem(hLV, -1, LVNI_SELECTED), 0, keyid, keyidsize);
+ case IDCANCEL:
+ EndDialog(hdlg, wparam);
+ return TRUE;
+ break;
+ case IDC_REFRESH:
+ updateKeyUserIDs(publickeyuserid);
+ updateKeyUserIDs(secretkeyuserid);
+ RefreshListView(hLV);
+ break;
+ }
+ break;
+ }
+
+ return FALSE;
+}
+
+
+void RefreshListView(HWND hLV) {
+
+ LVITEM lvi;
+ int i;
+
+ ListView_DeleteAllItems(hLV);
+ ZeroMemory(&lvi,sizeof(LVITEM));
+ lvi.mask = LVIF_TEXT;
+ for (i = 0; i < getKeyUserIDCount(publickeyuserid); i++) {
+
+ char keyid[keyidsize];
+ char *userid;
+ char *keyuserid = getKeyUserID(publickeyuserid, i);
+
+ userid = getNextPart(keyid, keyuserid, txtidseparator);
+
+ lvi.iItem++;
+ lvi.pszText = keyid;
+ ListView_SetItemText(hLV, ListView_InsertItem(hLV, &lvi), 1, userid);
+ }
+}
diff --git a/plugins/CryptoPP/GPGw/userdialog.h b/plugins/CryptoPP/GPGw/userdialog.h new file mode 100644 index 0000000000..5f49882a29 --- /dev/null +++ b/plugins/CryptoPP/GPGw/userdialog.h @@ -0,0 +1,6 @@ +#ifndef __USERDIALOG_H__
+#define __USERDIALOG_H__
+
+BOOL CALLBACK UserIdDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam);
+
+#endif // __USERDIALOG_H__
|