Generate your Protonmail Private Key passphrase based on the KeySalt and MailBoxPassword
Special thanks to krisclarkdev, vinyll, Freebien and jooray.
- Install node.js (https://nodejs.org/en/download/package-manager/)
- Install pmpkpe
npm install pmpkpe -g
- cd into the newly cloned directory
cd pmpkpe
-
Recover your KeySalt and PrivateKey-s for each of your addresses (see below)
-
Execute this program against your saved salt and mailbox password that you save into a file (this is either your second password if you use two passwords or a single login password if you use the default recommended procedure of using just one password):
pmpkpe -s ./salt.txt -m ./mailboxpassword.txt
- The output of this program will be a passphrase that you can use to decrypt all the private keys for all your addresses. You can import them using:
gpg --import private-key.txt
for each key.
You can the list the imported keys:
gpg --list-secret-keys
and change the passphrase to some passphrase that you will remember:
gpg --edit-key KEYID passwd quit
(where key id can be a fingerprint from the previous list or your e-mail address)
enjoy
ProtonMail stores an encrypted version of your private key on its servers. From the settings pane of your account you can download your public key; unfortunately you cannot download your private key. The good news: you can very easilly find it using the development tools of your browser. Here's how:
- Open the ProtonMail app and log out completely. You should now see the login screen.
- Open the dev tools of your browser, and the Network tab to see all network calls.
- Enter your username and password and click Login button.
- In the network calls, find the one to “/api/auth”.
- In this network call, open the Response tab to see raw data returned from the server, find the line beginning with
"KeySalt":
and copy the value without quotes to a file. - Find a post call to “/api/users”, there will be a section with addresses, find sections starting with
"PrivateKey":
, and copy the rest of the line, from"-----BEGIN PGP PRIVATE KEY
to the last"
, without the trailing comma. - Open the Console tab of the dev tools, type
console.log(<PASTE THE COPIED CONTENT HERE>)
then press enter. - Copy the result of the command, and put it into a text file, that's it you have your private key!
- Repeat points 6-8 for all addresses to get all your private keys