Search Mailing List Archives

Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[liberationtech] pgp message encryption and decrypion using just a browser

David Dahl david at
Thu Feb 10 08:21:28 PST 2011


Thanks! The threat of physical access will sink just about any
precautions. Protecting against that is more a matter of adding delete
timeouts to your in-memory passphrases and private keys. I have been
thinking about creating a self-destruct timeout as well - so that if
you have not used the client application for X days or hours, the next
launch of the browser will delete all persistent data.

I have basically taken the approach (with my experiments on of openssh, as they just dump the public and private
key in your home directory with the warning "don't lose your
computer!". A better solution is needed.

Thanks for the pointer on destroying the key and passphrase in the
decrypt function. I need more eyeballs on this initial bit of code.
You are correct, they should be deleted asap.



On Thu, Feb 10, 2011 at 3:17 AM, Anders Sundman
<sundman.anders at> wrote:
> Great project! I hope you get a lot of useful feedback from people on
> this list and elsewhere.
> Since your threat model seems to be based around a remote attacker,
> this might not be entirely relevant; but extending the threat model to
> an attacker with access to the computer that the browser is running on
> seems like a logical next step.
> In that case you will have to struggle with a common problem with any
> type of crypto application. How to store the passphrase / priv.key in
> a way that makes it as hard as possible for an attacker with access to
> the computer to recover that data.
> In the function:
> function decrypt()
> {
>  var cryptoObj = {
>    privKey: window.crypt.privKey,
>    passphrase: document.getElementById("passphrase").value,
>    aSalt: window.crypt.salt,
>    aIV: window.crypt.iv
>  };
>  var decrypted =
>    window.crypt.decrypt(document.currentMessage,
> window.crypt.pubKey,cryptoObj);
>  document.getElementById("decrypted").innerHTML = decrypted;
> }
> you call: decrypt: function DAPI_decrypt(aMsg, aPubKey, aCryptoObj) { [...]
> This will off course put the privkey + passphrase in memory (there's
> really no way around that). I'm no JavaScript expert so I might be
> dead wrong here, but since JS is garbage collected, the cryptoObj
> won't be destroyed right away (and the sensitive data will linger in
> RAM longer that necessary). Setting the privKey/passphrase = 0 after
> the decrypt call won't solve the problem entirely, but at least
> tighten the vulnerable time frame. This will also make the risk of the
> data getting paged to disc smaller (but won't eliminate it). I'm not
> sure how Firefox handles the decrypted document once it's displayed,
> but you would probably want to look in to stuff like caching, etc..
> The torbutton design doc might com in handy:
> All the best,
> Anders
> On Wed, Feb 9, 2011 at 12:48 AM, David Dahl <david at> wrote:
>> I have been wanting to follow up on this thread, which means writing
>> some code.:)
>> I have distilled the 3 methods needed to construct any kind of
>> PGP-like web application. My new extension, DOMCrypt, attaches a
>> 'crypt' property to each web page giving Javascript developers
>> crypt.generateKeyPair(), crypt.encrypt() and crypt.decrypt().
>> All of the underlying crypto code is handled by NSS - the same library
>> used for the SSL/HTTPS. This is not a 'native JS' solution. It is fast
>> C code under the hood.
>> See for a demo, the code
>> is here:
>> Regards,
>> David
>> On Sun, Sep 26, 2010 at 6:21 AM, David Dahl <david at> wrote:
>>> I have been experimenting with the JavaScript API for PKI that is
>>> provided by Firefox Sync. The underlying bits are implemented in C++
>>> (NSS), so it is pretty fast. I am slowly building up a toolkit for
>>> messaging in a pseudo-anonymous fashion called "Droplettr" and am
>>> looking for contributors. The entire thing is open source and is
>>> designed to be  used like a protocol instead of a walled garden.
>>> Repo:
>>> Site:
>>> Things are in a state of brokenness at the moment, as this is a side
>>> research project of mine.
>>> Regards,
>>> David
>>> On Sat, Sep 25, 2010 at 12:00 AM, Danny O'Brien <DObrien at> wrote:
>>>> This really isn't what you want Frank (at all!), but its bizarreness plus tangential connection to your question was too good to miss:
>>>> It's TLS (including client-side certificates), re-implemented in in-browser Javascript. Ben's point is that such an implementation allows greater experimentation with security UI, which I think everyone agrees is the current Hard Problem.
>>>> d.
>>>> On Sep 23, 2010, at 11:08 PM, Frank Corrigan wrote:
>>>>> For some time I have been investigating the availability of web pages
>>>>> that provide easy to use password creation and message encryption
>>>>> functions, which only depend upon web browsers inbuilt javascript
>>>>> capabilities and can therefore be downloaded and used off line. And
>>>>> works across all common OSs and browsers.
>>>>> Examples are
>>>>> as one of many options for password creation
>>>>> and
>>>>> to encrypt messages using a recipients pgp Public key.
>>>>> The help I am requesting is whether anyone knows of an online resource,
>>>>> that meets the above criteria, that can not only encrypt text using a
>>>>> pgp Public key but also has a facility to decrypt a pgp message with the
>>>>> recipients Private key?
>>>>> I am aware of FireGPG:
>>>>> which is excellent, though sadly now discontinued, but it is tied to
>>>>> Fire Fox through an add-on and it's functions are dependent upon a local
>>>>> install of GPG.
>>>>> Thanks
>>>>> Frank
>>>>> _______________________________________________
>>>>> liberationtech mailing list
>>>>> liberationtech at
>>>>> Should you need to change your subscription options, please go to:
>>>> _______________________________________________
>>>> liberationtech mailing list
>>>> liberationtech at
>>>> Should you need to change your subscription options, please go to:
>> _______________________________________________
>> liberationtech mailing list
>> liberationtech at
>> Should you need to change your subscription options, please go to:
>> If you would like to receive a daily digest, click "yes" (once you click above) next to "would you like to receive list mail batched in a daily digest?"
>> You will need the user name and password you receive from the list moderator in monthly reminders.
>> Should you need immediate assistance, please contact the list moderator.
>> Please don't forget to follow us on!/Liberationtech

More information about the liberationtech mailing list