Re: [Enigmail] Importing PGP key via code

2020-11-04 Thread it_support via enigmail-users
--- Begin Message ---
i have figured out how to add a PGP key to Thunderbird, in case anyone 
finds it useful:


|var pcUser = "Administrator"; // <== Put your Windows user name var 
privateKeysFolder = "C:\\Users\\" + pcUser + 
"\\Desktop\\gpg-private-keys"; // <== place your priv keys here! 
Components.utils.import("resource://gre/modules/FileUtils.jsm"); var 
EnigmailKeyRing = 
ChromeUtils.import("chrome://openpgp/content/modules/keyRing.jsm").EnigmailKeyRing; 
function importSecretKeyFromFile(filename){ var file = new 
FileUtils.File(filename); let resultKeys = {}; let errorMsgObj = {}; 
EnigmailKeyRing.importKeyFromFile( window, function(win, fpr, 
userFlags){ resultFlags.canceled = false; return ""; }, // <== returns 
key passphrase, if any file, errorMsgObj, resultKeys, false, true); 
return resultKeys.keys[0]; } var k = 
importSecretKeyFromFile(privateKeysFolder + 
"\\privatekey_em...@example.com.asc"); console.log("imported key id: " + 
k); |


Now i just need to associate the imported key to an identity, and i've 
asked about it on bugzilla 
https://bugzilla.mozilla.org/show_bug.cgi?id=1671834
They don't seem to reply though. Anyway i have basically tried with 
Services.prefs.setStringPref , but it doesn't work||


|var { Services } = 
ChromeUtils.import("resource://gre/modules/Services.jsm"); 
Services.prefs.setStringPref( "mail.identity." + identity.key + 
".openpgp_key_id", k ); // associate this pgp key with identity... won't 
work|


From the identity manager popup of the Thunderbird UI i don't see any 

PGP key for the identity, under "End-to-end cryptography" tab.
I have even tried removing the "0x" prefix from the key id ( the "k" 
variable), ... no difference. I see the PGP key in the OpenPGP key 
manager popup though, and the email of the key matches with identity.email


Do you have any idea please? Thanks

--- End Message ---
___
enigmail-users mailing list
enigmail-users@enigmail.net
To unsubscribe or make changes to your subscription click here:
https://admin.hostpoint.ch/mailman/listinfo/enigmail-users_enigmail.net


Re: [Enigmail] Importing PGP key via code

2020-11-02 Thread Patrick Brunschwig
On 01/11/2020 19:29, it_support via enigmail-users wrote:
> Hello,
> 
> i have asked bugzilla how to import a PGP key file via Javascript (i will run 
> it from the Thunderbird console).
> 
> But they told me they don't give add-on support there. So i guess i have to 
> ask you about this.

That answer is wrong. The code is in Thunderbird, and not in an add-on.
> 
> Anyway, i have found the functions i need to call to do this:
> 
> it's getGpgKeyData
> 
> from 
> https://hg.mozilla.org/comm-central/file/595dddfbd18b/mail/extensions/openpgp/content/modules/cryptoAPI/gnupg-keylist.jsm
> 
> or  importKeyFromFileAPI
> 
> from 
> https://hg.mozilla.org/comm-central/file/595dddfbd18b/mail/extensions/openpgp/content/modules/cryptoAPI/gnupg-key.jsm
> 
> But both of them are not implemented. Indeed they do nothing other than 
> throwing a "Not implemented" exception.
> 
> Are you going to implement those methods soon? Or do you suggest another 
> solution?

I can't give a definitive answer because I'm not a Thunderbird staff
member. But from my POV it's most unlikely that these functions will
ever be implemented. Thunderbird uses RNP, and does not support GnuPG
(apart for some basic functions for signing and decryption). I think
these files are a left-over from the code imported from Thunderbird and
are not used anymore.

-Patrick




signature.asc
Description: OpenPGP digital signature
___
enigmail-users mailing list
enigmail-users@enigmail.net
To unsubscribe or make changes to your subscription click here:
https://admin.hostpoint.ch/mailman/listinfo/enigmail-users_enigmail.net


[Enigmail] Importing PGP key via code

2020-11-01 Thread it_support via enigmail-users
--- Begin Message ---

Hello,

i have asked bugzilla how to import a PGP key file via Javascript (i 
will run it from the Thunderbird console).


But they told me they don't give add-on support there. So i guess i have 
to ask you about this.


Anyway, i have found the functions i need to call to do this:

it's getGpgKeyData

from 
https://hg.mozilla.org/comm-central/file/595dddfbd18b/mail/extensions/openpgp/content/modules/cryptoAPI/gnupg-keylist.jsm 



or  importKeyFromFileAPI

from 
https://hg.mozilla.org/comm-central/file/595dddfbd18b/mail/extensions/openpgp/content/modules/cryptoAPI/gnupg-key.jsm


But both of them are not implemented. Indeed they do nothing other than 
throwing a "Not implemented" exception.


Are you going to implement those methods soon? Or do you suggest another 
solution?


Thanks


--- End Message ---
___
enigmail-users mailing list
enigmail-users@enigmail.net
To unsubscribe or make changes to your subscription click here:
https://admin.hostpoint.ch/mailman/listinfo/enigmail-users_enigmail.net