15 |
16 |
20 |
36 |
37 |
38 |
39 |
Cr-gpg (Version : )
40 |
This plugin is Alpha
41 |
Cr-gpg is a quick hack to allow you to use common cryptographic functionality (provided by gpg) inside Gmail.
42 | It uses firebreath for browser compatability.
43 | (We said it was a quick hack!)
44 |
45 |
Hacked together by: jameel@thinkst.com
46 | Grab new versions at: http://thinkst.com/tools/cr-gpg
47 |
48 |
49 |
home |
blog |Copyright © 2012 - thinkst.com
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/gmailGPG/generic/Win/projectDef.cmake:
--------------------------------------------------------------------------------
1 | #/**********************************************************\
2 | # Auto-generated Windows project definition file for the
3 | # gmailGPG project
4 | #\**********************************************************/
5 |
6 | # Windows template platform definition CMake file
7 | # Included from ../CMakeLists.txt
8 |
9 | # remember that the current source dir is the project root; this file is in Win/
10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
11 | Win/[^.]*.cpp
12 | Win/[^.]*.h
13 | Win/[^.]*.cmake
14 | )
15 |
16 | # use this to add preprocessor definitions
17 | add_definitions(
18 | /D "_ATL_STATIC_REGISTRY"
19 | )
20 |
21 | SOURCE_GROUP(Win FILES ${PLATFORM})
22 |
23 | set (SOURCES
24 | ${SOURCES}
25 | ${PLATFORM}
26 | )
27 |
28 | add_windows_plugin(${PROJECT_NAME} SOURCES)
29 |
30 | # This is an example of how to add a build step to sign the plugin DLL before
31 | # the WiX installer builds. The first filename (certificate.pfx) should be
32 | # the path to your pfx file. If it requires a passphrase, the passphrase
33 | # should be located inside the second file. If you don't need a passphrase
34 | # then set the second filename to "". If you don't want signtool to timestamp
35 | # your DLL then make the last parameter "".
36 | #
37 | # Note that this will not attempt to sign if the certificate isn't there --
38 | # that's so that you can have development machines without the cert and it'll
39 | # still work. Your cert should only be on the build machine and shouldn't be in
40 | # source control!
41 | # -- uncomment lines below this to enable signing --
42 | #firebreath_sign_plugin(${PROJECT_NAME}
43 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx"
44 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt"
45 | # "http://timestamp.verisign.com/scripts/timestamp.dll")
46 |
47 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing!
48 | target_link_libraries(${PROJECT_NAME}
49 | ${PLUGIN_INTERNAL_DEPS}
50 | )
51 |
52 | set(WIX_HEAT_FLAGS
53 | -gg # Generate GUIDs
54 | -srd # Suppress Root Dir
55 | -cg PluginDLLGroup # Set the Component group name
56 | -dr INSTALLDIR # Set the directory ID to put the files in
57 | )
58 |
59 | add_wix_installer( ${PLUGIN_NAME}
60 | ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/gmailGPGInstaller.wxs
61 | PluginDLLGroup
62 | ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/
63 | ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll
64 | ${PROJECT_NAME}
65 | )
66 |
67 | # This is an example of how to add a build step to sign the WiX installer
68 | # -- uncomment lines below this to enable signing --
69 | #firebreath_sign_file("${PLUGIN_NAME}_WiXInstall"
70 | # "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.msi"
71 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx"
72 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt"
73 | # "http://timestamp.verisign.com/scripts/timestamp.dll")
74 |
--------------------------------------------------------------------------------
/gmailGPG/windows/Win/projectDef.cmake:
--------------------------------------------------------------------------------
1 | #/**********************************************************\
2 | # Auto-generated Windows project definition file for the
3 | # gmailGPG project
4 | #\**********************************************************/
5 |
6 | # Windows template platform definition CMake file
7 | # Included from ../CMakeLists.txt
8 |
9 | # remember that the current source dir is the project root; this file is in Win/
10 | file (GLOB PLATFORM RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
11 | Win/[^.]*.cpp
12 | Win/[^.]*.h
13 | Win/[^.]*.cmake
14 | )
15 |
16 | # use this to add preprocessor definitions
17 | add_definitions(
18 | /D "_ATL_STATIC_REGISTRY"
19 | )
20 |
21 | SOURCE_GROUP(Win FILES ${PLATFORM})
22 |
23 | set (SOURCES
24 | ${SOURCES}
25 | ${PLATFORM}
26 | )
27 |
28 | add_windows_plugin(${PROJECT_NAME} SOURCES)
29 |
30 | # This is an example of how to add a build step to sign the plugin DLL before
31 | # the WiX installer builds. The first filename (certificate.pfx) should be
32 | # the path to your pfx file. If it requires a passphrase, the passphrase
33 | # should be located inside the second file. If you don't need a passphrase
34 | # then set the second filename to "". If you don't want signtool to timestamp
35 | # your DLL then make the last parameter "".
36 | #
37 | # Note that this will not attempt to sign if the certificate isn't there --
38 | # that's so that you can have development machines without the cert and it'll
39 | # still work. Your cert should only be on the build machine and shouldn't be in
40 | # source control!
41 | # -- uncomment lines below this to enable signing --
42 | #firebreath_sign_plugin(${PROJECT_NAME}
43 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx"
44 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt"
45 | # "http://timestamp.verisign.com/scripts/timestamp.dll")
46 |
47 | # add library dependencies here; leave ${PLUGIN_INTERNAL_DEPS} there unless you know what you're doing!
48 | target_link_libraries(${PROJECT_NAME}
49 | ${PLUGIN_INTERNAL_DEPS}
50 | )
51 |
52 | set(WIX_HEAT_FLAGS
53 | -gg # Generate GUIDs
54 | -srd # Suppress Root Dir
55 | -cg PluginDLLGroup # Set the Component group name
56 | -dr INSTALLDIR # Set the directory ID to put the files in
57 | )
58 |
59 | add_wix_installer( ${PLUGIN_NAME}
60 | ${CMAKE_CURRENT_SOURCE_DIR}/Win/WiX/gmailGPGInstaller.wxs
61 | PluginDLLGroup
62 | ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/
63 | ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll
64 | ${PROJECT_NAME}
65 | )
66 |
67 | # This is an example of how to add a build step to sign the WiX installer
68 | # -- uncomment lines below this to enable signing --
69 | #firebreath_sign_file("${PLUGIN_NAME}_WiXInstall"
70 | # "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.msi"
71 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx"
72 | # "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt"
73 | # "http://timestamp.verisign.com/scripts/timestamp.dll")
74 |
--------------------------------------------------------------------------------
/chromeExtension/jquery.client.js:
--------------------------------------------------------------------------------
1 | (function() {
2 |
3 | var BrowserDetect = {
4 | init: function () {
5 | this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
6 | this.version = this.searchVersion(navigator.userAgent)
7 | || this.searchVersion(navigator.appVersion)
8 | || "an unknown version";
9 | this.OS = this.searchString(this.dataOS) || "an unknown OS";
10 | },
11 | searchString: function (data) {
12 | for (var i=0;i
2 |
3 |
4 |
5 |
6 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
35 |
36 |
43 |
44 |
45 |
46 |
47 |
54 |
55 |
56 |
57 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/gmailGPG/windows/Win/WiX/gmailGPGInstaller.wxs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
33 |
34 |
35 |
36 |
43 |
44 |
45 |
46 |
47 |
54 |
55 |
56 |
57 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/chromeExtension/general.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
10 |
11 |
12 |
18 |
19 |
To import a users key, paste the ascii armored key below
20 |
21 |
22 | Import Key
23 |
24 |
home |
blog |Copyright © 2012 - thinkst.com
25 |
26 |
27 |
Encrypt Text
28 |
29 | Recipients (comma separated) :
30 |
31 |
32 | Encrypt Text
33 |
34 |
home |
blog |Copyright © 2012 - thinkst.com
35 |
36 |
37 |
Sign Message
38 |
39 | Password :
40 |
41 |
42 |
43 |
44 |
Sign Message
45 |
Verify Message
46 |
47 |
home |
blog |Copyright © 2012 - thinkst.com
48 |
49 |
50 |
Decrypt Message
51 |
52 | Password :
53 |
54 |
55 |
56 | Decrypt Message
57 |
58 |
home |
blog |Copyright © 2012 - thinkst.com
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/chromeExtension/popup.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
To import a users key, paste the ascii armored key below
21 |
22 |
23 | Import Key
24 |
25 |
home |
blog |Copyright © 2012 - thinkst.com
26 |
27 |
28 |
Encrypt Text
29 |
30 | Recipients (comma separated) :
31 |
32 |
33 | Encrypt Text
34 |
35 |
home |
blog |Copyright © 2012 - thinkst.com
36 |
37 |
38 |
Sign Message
39 |
40 |
41 |
42 |
Sign Message
43 |
Verify Message
44 |
45 |
home |
blog |Copyright © 2012 - thinkst.com
46 |
47 |
48 |
49 |
50 |
51 |
Cr-gpg (Version : )
52 |
This plugin is Beta
53 |
Cr-gpg is a quick hack to allow you to use common cryptographic functionality (provided by gpg) inside Gmail.
54 | It uses firebreath for browser compatability and doesnt use GPGME!
55 | (We said it was a quick hack!)
56 |
57 |
Hacked together by: jameel@thinkst.com
58 | Grab new versions at: http://thinkst.com/tools/cr-gpg
59 |
60 |
61 |
home |
blog |Copyright © 2012 - thinkst.com
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/gmailGPG/generic/gmailGPG.cpp:
--------------------------------------------------------------------------------
1 | /**********************************************************\
2 |
3 | Auto-generated gmailGPG.cpp
4 |
5 | This file contains the auto-generated main plugin object
6 | implementation for the gmailGPG project
7 |
8 | \**********************************************************/
9 |
10 | #include "gmailGPGAPI.h"
11 |
12 | #include "gmailGPG.h"
13 |
14 | ///////////////////////////////////////////////////////////////////////////////
15 | /// @fn gmailGPG::StaticInitialize()
16 | ///
17 | /// @brief Called from PluginFactory::globalPluginInitialize()
18 | ///
19 | /// @see FB::FactoryBase::globalPluginInitialize
20 | ///////////////////////////////////////////////////////////////////////////////
21 | void gmailGPG::StaticInitialize()
22 | {
23 | // Place one-time initialization stuff here; As of FireBreath 1.4 this should only
24 | // be called once per process
25 | }
26 |
27 | ///////////////////////////////////////////////////////////////////////////////
28 | /// @fn gmailGPG::StaticInitialize()
29 | ///
30 | /// @brief Called from PluginFactory::globalPluginDeinitialize()
31 | ///
32 | /// @see FB::FactoryBase::globalPluginDeinitialize
33 | ///////////////////////////////////////////////////////////////////////////////
34 | void gmailGPG::StaticDeinitialize()
35 | {
36 | // Place one-time deinitialization stuff here. As of FireBreath 1.4 this should
37 | // always be called just before the plugin library is unloaded
38 | }
39 |
40 | ///////////////////////////////////////////////////////////////////////////////
41 | /// @brief gmailGPG constructor. Note that your API is not available
42 | /// at this point, nor the window. For best results wait to use
43 | /// the JSAPI object until the onPluginReady method is called
44 | ///////////////////////////////////////////////////////////////////////////////
45 | gmailGPG::gmailGPG()
46 | {
47 | }
48 |
49 | ///////////////////////////////////////////////////////////////////////////////
50 | /// @brief gmailGPG destructor.
51 | ///////////////////////////////////////////////////////////////////////////////
52 | gmailGPG::~gmailGPG()
53 | {
54 | // This is optional, but if you reset m_api (the shared_ptr to your JSAPI
55 | // root object) and tell the host to free the retained JSAPI objects then
56 | // unless you are holding another shared_ptr reference to your JSAPI object
57 | // they will be released here.
58 | releaseRootJSAPI();
59 | m_host->freeRetainedObjects();
60 | }
61 |
62 | void gmailGPG::onPluginReady()
63 | {
64 | // When this is called, the BrowserHost is attached, the JSAPI object is
65 | // created, and we are ready to interact with the page and such. The
66 | // PluginWindow may or may not have already fire the AttachedEvent at
67 | // this point.
68 | }
69 |
70 | void gmailGPG::shutdown()
71 | {
72 | // This will be called when it is time for the plugin to shut down;
73 | // any threads or anything else that may hold a shared_ptr to this
74 | // object should be released here so that this object can be safely
75 | // destroyed. This is the last point that shared_from_this and weak_ptr
76 | // references to this object will be valid
77 | }
78 |
79 | ///////////////////////////////////////////////////////////////////////////////
80 | /// @brief Creates an instance of the JSAPI object that provides your main
81 | /// Javascript interface.
82 | ///
83 | /// Note that m_host is your BrowserHost and shared_ptr returns a
84 | /// FB::PluginCorePtr, which can be used to provide a
85 | /// boost::weak_ptr for your JSAPI class.
86 | ///
87 | /// Be very careful where you hold a shared_ptr to your plugin class from,
88 | /// as it could prevent your plugin class from getting destroyed properly.
89 | ///////////////////////////////////////////////////////////////////////////////
90 | FB::JSAPIPtr gmailGPG::createJSAPI()
91 | {
92 | // m_host is the BrowserHost
93 | return boost::make_shared(FB::ptr_cast(shared_from_this()), m_host);
94 | }
95 |
96 | bool gmailGPG::onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *)
97 | {
98 | //printf("Mouse down at: %d, %d\n", evt->m_x, evt->m_y);
99 | return false;
100 | }
101 |
102 | bool gmailGPG::onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *)
103 | {
104 | //printf("Mouse up at: %d, %d\n", evt->m_x, evt->m_y);
105 | return false;
106 | }
107 |
108 | bool gmailGPG::onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *)
109 | {
110 | //printf("Mouse move at: %d, %d\n", evt->m_x, evt->m_y);
111 | return false;
112 | }
113 | bool gmailGPG::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *)
114 | {
115 | // The window is attached; act appropriately
116 | return false;
117 | }
118 |
119 | bool gmailGPG::onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *)
120 | {
121 | // The window is about to be detached; act appropriately
122 | return false;
123 | }
124 |
125 |
--------------------------------------------------------------------------------
/gmailGPG/windows/gmailGPG.cpp:
--------------------------------------------------------------------------------
1 | /**********************************************************\
2 |
3 | Auto-generated gmailGPG.cpp
4 |
5 | This file contains the auto-generated main plugin object
6 | implementation for the gmailGPG project
7 |
8 | \**********************************************************/
9 |
10 | #include "gmailGPGAPI.h"
11 |
12 | #include "gmailGPG.h"
13 |
14 | ///////////////////////////////////////////////////////////////////////////////
15 | /// @fn gmailGPG::StaticInitialize()
16 | ///
17 | /// @brief Called from PluginFactory::globalPluginInitialize()
18 | ///
19 | /// @see FB::FactoryBase::globalPluginInitialize
20 | ///////////////////////////////////////////////////////////////////////////////
21 | void gmailGPG::StaticInitialize()
22 | {
23 | // Place one-time initialization stuff here; As of FireBreath 1.4 this should only
24 | // be called once per process
25 | }
26 |
27 | ///////////////////////////////////////////////////////////////////////////////
28 | /// @fn gmailGPG::StaticInitialize()
29 | ///
30 | /// @brief Called from PluginFactory::globalPluginDeinitialize()
31 | ///
32 | /// @see FB::FactoryBase::globalPluginDeinitialize
33 | ///////////////////////////////////////////////////////////////////////////////
34 | void gmailGPG::StaticDeinitialize()
35 | {
36 | // Place one-time deinitialization stuff here. As of FireBreath 1.4 this should
37 | // always be called just before the plugin library is unloaded
38 | }
39 |
40 | ///////////////////////////////////////////////////////////////////////////////
41 | /// @brief gmailGPG constructor. Note that your API is not available
42 | /// at this point, nor the window. For best results wait to use
43 | /// the JSAPI object until the onPluginReady method is called
44 | ///////////////////////////////////////////////////////////////////////////////
45 | gmailGPG::gmailGPG()
46 | {
47 | }
48 |
49 | ///////////////////////////////////////////////////////////////////////////////
50 | /// @brief gmailGPG destructor.
51 | ///////////////////////////////////////////////////////////////////////////////
52 | gmailGPG::~gmailGPG()
53 | {
54 | // This is optional, but if you reset m_api (the shared_ptr to your JSAPI
55 | // root object) and tell the host to free the retained JSAPI objects then
56 | // unless you are holding another shared_ptr reference to your JSAPI object
57 | // they will be released here.
58 | releaseRootJSAPI();
59 | m_host->freeRetainedObjects();
60 | }
61 |
62 | void gmailGPG::onPluginReady()
63 | {
64 | // When this is called, the BrowserHost is attached, the JSAPI object is
65 | // created, and we are ready to interact with the page and such. The
66 | // PluginWindow may or may not have already fire the AttachedEvent at
67 | // this point.
68 | }
69 |
70 | void gmailGPG::shutdown()
71 | {
72 | // This will be called when it is time for the plugin to shut down;
73 | // any threads or anything else that may hold a shared_ptr to this
74 | // object should be released here so that this object can be safely
75 | // destroyed. This is the last point that shared_from_this and weak_ptr
76 | // references to this object will be valid
77 | }
78 |
79 | ///////////////////////////////////////////////////////////////////////////////
80 | /// @brief Creates an instance of the JSAPI object that provides your main
81 | /// Javascript interface.
82 | ///
83 | /// Note that m_host is your BrowserHost and shared_ptr returns a
84 | /// FB::PluginCorePtr, which can be used to provide a
85 | /// boost::weak_ptr for your JSAPI class.
86 | ///
87 | /// Be very careful where you hold a shared_ptr to your plugin class from,
88 | /// as it could prevent your plugin class from getting destroyed properly.
89 | ///////////////////////////////////////////////////////////////////////////////
90 | FB::JSAPIPtr gmailGPG::createJSAPI()
91 | {
92 | // m_host is the BrowserHost
93 | return boost::make_shared(FB::ptr_cast(shared_from_this()), m_host);
94 | }
95 |
96 | bool gmailGPG::onMouseDown(FB::MouseDownEvent *evt, FB::PluginWindow *)
97 | {
98 | //printf("Mouse down at: %d, %d\n", evt->m_x, evt->m_y);
99 | return false;
100 | }
101 |
102 | bool gmailGPG::onMouseUp(FB::MouseUpEvent *evt, FB::PluginWindow *)
103 | {
104 | //printf("Mouse up at: %d, %d\n", evt->m_x, evt->m_y);
105 | return false;
106 | }
107 |
108 | bool gmailGPG::onMouseMove(FB::MouseMoveEvent *evt, FB::PluginWindow *)
109 | {
110 | //printf("Mouse move at: %d, %d\n", evt->m_x, evt->m_y);
111 | return false;
112 | }
113 | bool gmailGPG::onWindowAttached(FB::AttachedEvent *evt, FB::PluginWindow *)
114 | {
115 | // The window is attached; act appropriately
116 | return false;
117 | }
118 |
119 | bool gmailGPG::onWindowDetached(FB::DetachedEvent *evt, FB::PluginWindow *)
120 | {
121 | // The window is about to be detached; act appropriately
122 | return false;
123 | }
124 |
125 |
--------------------------------------------------------------------------------
/chromeExtension/background.js:
--------------------------------------------------------------------------------
1 | var alerted = false;
2 | function plugin0()
3 | {
4 | return document.getElementById('plugin0');
5 | }
6 |
7 | chrome.extension.onRequest.addListener(
8 | function(request, sender, sendResponse) {
9 | if (request.messageType == 'encrypt'){
10 | var mailList = request.encrypt.maillist;
11 | if( localStorage["useAutoInclude"] && localStorage["useAutoInclude"] != 'false'){
12 | mailList.push(localStorage["personaladdress"]);
13 | }
14 | var mailMessage = request.encrypt.message;
15 | var currentPubKeyList = [];
16 | var list = plugin0().getPublicKeyList();
17 | for(var k in list)
18 | {
19 | currentPubKeyList.push(list[k].email);
20 | }
21 | for(var encRec in mailList)
22 | {
23 | if(currentPubKeyList.indexOf(mailList[encRec]) == -1){
24 | sendResponse({error:true,message: 'You do not have a public key stored for '+mailList[encRec] + ' please remove the user or import their public key',domid:request.encrypt.domel});
25 | return;
26 | }
27 |
28 | }
29 |
30 | var enc_result = plugin0().gpgEncrypt(mailMessage, mailList, '', '');
31 | if(!enc_result.error && enc_result.data){
32 | sendResponse({message: enc_result.data,domid:request.encrypt.domel});
33 | }else{
34 | sendResponse({error:true,message: enc_result.error_string,domid:request.encrypt.domel});
35 | };
36 | }else if(request.messageType == 'importkey'){
37 | var import_status = plugin0().gpgImportKey(request.import.message);
38 | sendResponse({message: import_status});
39 | }else if(request.messageType == 'sign'){
40 | var signing_key = '';
41 | var privKeySet = plugin0().getPrivateKeyList();
42 | var keyIDs = Object.keys(privKeySet);
43 | if(keyIDs.length > 0){
44 | if(localStorage["signingKeyID"] && localStorage["signingKeyID"] != ''){
45 | if(keyIDs.indexOf(localStorage["signingKeyID"]) != -1){
46 | signing_key = localStorage["signingKeyID"];
47 | }else{
48 | if(request.sign.currentMail){
49 | for(var sKey in privKeySet){
50 | if(privKeySet[sKey].email == request.sign.currentMail){
51 | signing_key = sKey;
52 | break;
53 | };
54 | };
55 | if(signing_key == ''){
56 | signing_key = keyIDs[0];
57 | };
58 | }else{
59 | signing_key = keyIDs[0];
60 | };
61 |
62 | };
63 | }else{
64 | if(request.sign.currentMail){
65 | for(var sKey in privKeySet){
66 | if(privKeySet[sKey].email == request.sign.currentMail){
67 | signing_key = sKey;
68 | break;
69 | };
70 | };
71 | if(signing_key == ''){
72 | signing_key = keyIDs[0];
73 | };
74 | }else{
75 | signing_key = keyIDs[0];
76 | };
77 | };
78 | };
79 | var sign_status = plugin0().gpgSignText([signing_key],request.sign.message, 2);
80 | sendResponse({message: sign_status,domid:request.sign.domel});
81 | }else if(request.messageType == 'verify'){
82 | var verify_status = plugin0().gpgVerify(request.verify.message);
83 | sendResponse({message: verify_status ,domid:request.verify.domel})
84 | }else if(request.messageType == 'verifyDetached'){
85 | sendResponse({message:'Not Yet Support',domid:request.verify.domel});
86 | //sendResponse({message: plugin0().verifyMessageDetached(request.verify.message,request.verify.sig),domid:request.verify.domel});
87 | }else if(request.messageType == 'decrypt'){
88 | //TODO : Make sure you handle the multidec call which handles encryption within encryption
89 | var dec_result = plugin0().gpgDecrypt(request.decrypt.message);
90 | if(!dec_result.error){
91 | sendResponse({message: dec_result.data,domid:request.decrypt.domel});
92 | }else{
93 | sendResponse({message: 'An Error Occured',domid:request.decrypt.domel});
94 | };
95 | }else if(request.messageType == 'optionLoad'){
96 | chrome.tabs.create({'selected':true,'url': chrome.extension.getURL('options.html')});
97 | sendResponse('options opened');
98 | }else if(request.messageType == 'testSettings'){
99 | var returnMessage = plugin0().getPublicKeyList();
100 | sendResponse(returnMessage);
101 | }
102 | }
103 | );
104 |
--------------------------------------------------------------------------------
/gmailGPG/generic/t-support.h:
--------------------------------------------------------------------------------
1 | /* t-support.h - Helper routines for regression tests.
2 | Copyright (C) 2000 Werner Koch (dd9jn)
3 | Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
4 |
5 | This file is part of GPGME.
6 |
7 | GPGME is free software; you can redistribute it and/or modify it
8 | under the terms of the GNU Lesser General Public License as
9 | published by the Free Software Foundation; either version 2.1 of
10 | the License, or (at your option) any later version.
11 |
12 | GPGME is distributed in the hope that it will be useful, but
13 | WITHOUT ANY WARRANTY; without even the implied warranty of
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 | Lesser General Public License for more details.
16 |
17 | You should have received a copy of the GNU Lesser General Public
18 | License along with this program; if not, write to the Free Software
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 | 02111-1307, USA. */
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #ifdef HAVE_W32_SYSTEM
28 | #include
29 | #endif
30 |
31 | #include
32 |
33 | #ifndef DIM
34 | #define DIM(v) (sizeof(v)/sizeof((v)[0]))
35 | #endif
36 |
37 | #define fail_if_err(err) \
38 | do \
39 | { \
40 | if (err) \
41 | { \
42 | fprintf (stderr, "%s:%d: %s: %s\n", \
43 | __FILE__, __LINE__, gpgme_strsource (err), \
44 | gpgme_strerror (err)); \
45 | exit (1); \
46 | } \
47 | } \
48 | while (0)
49 |
50 |
51 | static const char *
52 | nonnull (const char *s)
53 | {
54 | return s? s :"[none]";
55 | }
56 |
57 |
58 | std::string
59 | print_data (gpgme_data_t dh)
60 | {
61 | #define BUF_SIZE 512
62 | char buf[BUF_SIZE + 1];
63 | int ret;
64 | std::string rtd = "";
65 |
66 | ret = gpgme_data_seek (dh, 0, SEEK_SET);
67 | if (ret)
68 | fail_if_err(gpgme_err_code_from_errno (errno));
69 | while ((ret = gpgme_data_read (dh, buf, BUF_SIZE)) > 0)
70 | rtd.append(buf);
71 |
72 | return rtd;
73 | }
74 |
75 |
76 | gpgme_error_t
77 | passphrase_cb (void *opaque, const char *uid_hint, const char *passphrase_info,
78 | int last_was_bad, int fd)
79 | {
80 | #ifdef HAVE_W32_SYSTEM
81 | DWORD written;
82 | WriteFile ((HANDLE) fd, "abc\n", 4, &written, 0);
83 | #else
84 | int res;
85 | char *pass = "abc\n";
86 | int passlen = strlen (pass);
87 | int off = 0;
88 |
89 | do
90 | {
91 | res = write (fd, &pass[off], passlen - off);
92 | if (res > 0)
93 | off += res;
94 | }
95 | while (res > 0 && off != passlen);
96 |
97 | return off == passlen ? 0 : gpgme_error_from_errno (errno);
98 | #endif
99 |
100 | return 0;
101 | }
102 |
103 |
104 | /*char *
105 | make_filename (const char *fname)
106 | {
107 | const char *srcdir = getenv ("srcdir");
108 | char *buf;
109 |
110 | if (!srcdir)
111 | srcdir = ".";
112 | buf = malloc (strlen(srcdir) + strlen(fname) + 2);
113 | if (!buf)
114 | exit (8);
115 | strcpy (buf, srcdir);
116 | strcat (buf, "/");
117 | strcat (buf, fname);
118 | return buf;
119 | }
120 | */
121 |
122 | void
123 | init_gpgme (gpgme_protocol_t proto)
124 | {
125 | gpgme_error_t err;
126 |
127 | gpgme_check_version (NULL);
128 | setlocale (LC_ALL, "");
129 | gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL));
130 | #ifndef HAVE_W32_SYSTEM
131 | gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL));
132 | #endif
133 |
134 | err = gpgme_engine_check_version (proto);
135 | fail_if_err (err);
136 | }
137 |
138 |
139 | void
140 | print_import_result (gpgme_import_result_t r)
141 | {
142 | gpgme_import_status_t st;
143 |
144 | for (st=r->imports; st; st = st->next)
145 | {
146 | printf (" fpr: %s err: %d (%s) status:", nonnull (st->fpr),
147 | st->result, gpg_strerror (st->result));
148 | if (st->status & GPGME_IMPORT_NEW)
149 | fputs (" new", stdout);
150 | if (st->status & GPGME_IMPORT_UID)
151 | fputs (" uid", stdout);
152 | if (st->status & GPGME_IMPORT_SIG)
153 | fputs (" sig", stdout);
154 | if (st->status & GPGME_IMPORT_SUBKEY)
155 | fputs (" subkey", stdout);
156 | if (st->status & GPGME_IMPORT_SECRET)
157 | fputs (" secret", stdout);
158 | putchar ('\n');
159 | }
160 | printf ("key import summary:\n"
161 | " considered: %d\n"
162 | " no user id: %d\n"
163 | " imported: %d\n"
164 | " imported_rsa: %d\n"
165 | " unchanged: %d\n"
166 | " new user ids: %d\n"
167 | " new subkeys: %d\n"
168 | " new signatures: %d\n"
169 | " new revocations: %d\n"
170 | " secret read: %d\n"
171 | " secret imported: %d\n"
172 | " secret unchanged: %d\n"
173 | " skipped new keys: %d\n"
174 | " not imported: %d\n",
175 | r->considered,
176 | r->no_user_id,
177 | r->imported,
178 | r->imported_rsa,
179 | r->unchanged,
180 | r->new_user_ids,
181 | r->new_sub_keys,
182 | r->new_signatures,
183 | r->new_revocations,
184 | r->secret_read,
185 | r->secret_imported,
186 | r->secret_unchanged,
187 | r->skipped_new_keys,
188 | r->not_imported);
189 | }
190 |
191 |
--------------------------------------------------------------------------------
/chromeExtension/jquery-ui-1.8.13.custom.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * jQuery UI Dialog 1.8.13
3 | *
4 | * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
5 | * Dual licensed under the MIT or GPL Version 2 licenses.
6 | * http://jquery.org/license
7 | *
8 | * http://docs.jquery.com/UI/Dialog
9 | *
10 | * Depends:
11 | * jquery.ui.core.js
12 | * jquery.ui.widget.js
13 | * jquery.ui.button.js
14 | * jquery.ui.draggable.js
15 | * jquery.ui.mouse.js
16 | * jquery.ui.position.js
17 | * jquery.ui.resizable.js
18 | */
19 | (function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,
20 | position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
21 | b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),
22 | h=c(' ').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c(" ")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c(" ").addClass("ui-dialog-title").attr("id",
23 | e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
24 | a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
25 | b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=
26 | 1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
27 | f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,
28 | function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c(' ').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",
29 | handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,
30 | originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",
31 | f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):
32 | [a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);
33 | if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):
34 | e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=
35 | this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-
36 | b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.13",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),
37 | create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex() ").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),
38 | height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
39 | b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a