Silk Road forums

Discussion => Security => Topic started by: VHSplayer on August 13, 2013, 07:08 am

Title: PGP tutorial for iPad/iPhone - by VHSplayer
Post by: VHSplayer on August 13, 2013, 07:08 am
SR,

I am happy to present a VHSplayer original tutorial on how to get PGP working on your iPad/iPhone!

**Please note: This method is for creating a completely new private key**
(I am still ironing out kinks on how to import an existing private key, as I have not yet needed to)

**It helps for app-sake if you have a Jailbroken iPod/iPad with Cydia + Appcake/vShare/any other app store pirating program**
***The only purchase you will have to make is Topener which is only 99 cents. Ipgmail is on Appcake***

Please reply with any comments or questions you have regarding the tutorial, and I will do my best to answer questions accordingly.

¥¥ This is my own personal method of how I do things, there might be easier ways to do it, I have not found one. ¥¥

-/-/-/-/-/-

What you will need:
Ipgmail (app) - This app will be used to generate private keys, as well as be a keyring for all public keys. It will also be used to sign/encrypt messages, as well as decrypt messages of your selecting.
**At this time, Ipgmail only allows for generation of 2048 bit key sizes**

Dropbox (app) - This app will be used to upload .asc (PGP key) files and allow for importation into Ipgmail.

Topener (app) - This app will be used to paste users keys and for said key to be saved in .asc format.

A throw away email to link to your devices mail app - This will be so you can email yourself the saved .asc file, so you can open it and export it straight to Dropbox.

~~~~ Once you have obtained the above, proceed on! ~~~~

-/-/-/-/-/-

:: Create a Dropbox account ::

You are going to want to create a Dropbox account.

You must be asking: Why?

The answer is simple. The people who created Ipgmail wanted to make everything a pain in the ass. To import other people's keys in Ipgmail, there are one of two ways to do it. Via searching public PGP servers, or importing it through Dropbox.

Open the Dropbox app, and create a dummy account. All information should be BS. You don't even have to put a valid email address.

Once you have created an account, proceed on!

-/-/-/-/-/-

:: Create a dummy email ::

Create a dummy email account you will be able to sync your device to. You will only be using this mail to email yourself .asc key files to be uploaded to Dropbox for the purpose of adding to your public keyring in Ipgmail.

Once you have created it, go to 'Settings' on your device, then the mail tab. Go ahead and add it to your device.

-/-/-/-/-/-

:: Generating your private key + obtaining your public key ::

Open Ipgmail

Once you have Ipgmail loaded, your first task will be to link your Dropbox account you have recently created to Ipgmail.

To do so, choose 'Settings' at the bottom of the app. This will load all the editable settings of Ipgmail. Locate the 'Dropbox Link' option, and turn it on. Dropbox should open, and ask you if Ipgmail has your permission to link to Dropbox. Choose yes.

Now you are ready to generate your private key.....
--

To do so, locate the "Keys" button at the bottom of the screen. Once you have that open, select 'Private' at the top, and then hit the + button at the top right. You will then get to a screen to fill in details about your key. Create your own passphrase, as well as expiration (set 0 for a non-expiring key), as well as the name and email you would like. For ease sake, set your name to your SR username.

Next tap 'Create' in the top right, and it will generate and create your RSA keypair, both public and private. Now you can click the 'Keys' button at the bottom of the app, and click the 'Public' tab at the top. This will bring you to your public keyring. Remember the key you just created? See how it magically appeared? Now you are all set to share your public key with the world!

To do this, hit the name of the key you just created. This will bring you to a screen showing you detailed information in regards to the selected public key. To export it to your devices clipboard, hit the button in the top right and select the button export to clipboard. Vola! Feel free to post your public key where your heart desires.

-/-/-/-/-/-

:: Importing other people's private keys ::

Now that you have entered the world of iPad/iPhone PGP, you are surely going to want to add other users keys to your private key ring.

To do so, select the key from wherever it is located, and copy it to your devices clipboard. Now we are going to want to put Topener to use.

In the Topener app, it will load with a quote from Steve Jobs. How cool! The interface is a little complicated to use, but I will make it simple for you. The purpose of this app is to be able to create a .asc file. This file will contain a public key. The reason we need it to be a .asc is again because Ipgmail is pesky.

When in Topener, select the text box field where you see the quote. Erase it, and paste the public key which you would like to import into Ipgmail. Once you have it pasted, right below you will see the file name. It should be a .txt. It is next to an icon that looks like an open book.

Once you have the key in the text box, hit the name of the file. We are going to want to rename it. In the 'New Name' field, type whatever you want the file name to be, followed by a .asc file extension.

Let's say you want to name your file: vhskey. You would type in vhskey.asc

Once you have your name selected, hit the button that says 'Rename!'. You have successfully renamed your file properly! Next step is to email the file to yourself so you can send it to Dropbox. Hit the back button in Topener to get back to the main screen you were at originally.

Next, hit the button on the left hand side that looks like a pad of paper and a pen. This button will bring up the mail app. You need to use the dummy account you created, and compose the email to yourself. You will notice the .asc file you just created as an attachment to the email you are composing.

Once emailed to yourself, open the Mail app on your device, and open the email you just composed yourself in Topener. Tap on the .asc file attachment at the bottom of the email. Once opened, tap the button in the top right of the screen, and choose 'Open in Dropbox'. Once you do that, Dropbox will open and prompt you to save said file to Dropbox. Tap 'Save' at the top right corner of the box. Bam! This key is ready to be imported into Ipgmail.

Open Ipgmail, and tap 'Files' at the bottom of the app. Tap the button on the top right, and choose 'View Dropbox'. This will open the files that you currently have uploaded to your Dropbox account. Locate that .asc file you just uploaded to your account, then tap 'Download' at the top right. Once the download is complete, tap 'Dismiss' and then tap the done button at the top left.

You will notice the file you have chosen is now located in your files screen! Tap the .asc key file you would like to add to your ring, and choose 'Decode File'. Bam! The users public key you wanted to import is now added to your public key ring!

-/-/-/-/-/-

:: Creating an encrypted PGP message ::

Now that you have the users key you would like to create an encrypted message to, it's time to do so.

In Ipgmail, tap 'Compose' at the bottom. You will see 3 things. A place to chose your private key, a place to select the public key, and a text field to type your message. At the top, choose 'Both'. This will both encrypt and digitally sign your encrypted message. Next, tap the + next to 'Senders Private Key ID' and select your key. You will be prompted for your password. Next, tap the + next to 'Recipients Public Key ID' and select the person for whom the message is intended. Now, type the message you wish to encrypt. Once you have the desired message, tap the icon in the top right, and chose export to clipboard. Vola! Your encrypted message is ready to be sent to the recipient! Just paste it wherever you are communicating with the other individual.

-/-/-/-/-/-

:: Decrypting a PGP message sent to you ::

Now that you are sending encrypted messages from your iDevice, you are going to want to be able to receive them as well.

Locate the information you would like to decrypt, and select and copy it. Now you are going to want to open Topener. Tap the text box, and paste in the encrypted message.

***Please note this part sucks. The formatting of the encrypted message is all sloppy and jumbled. You are going to have to fix it manually. Move the cursor to the the front of each beginning line that is formatted properly (a full line of text without a break). Backspace it one character, so it makes the line above it (that had a line break and not a full line of text) appears to be a full line. Do this to all the lines until there are no funky line breaks**

Once you have fixed it, tap below where the name is. We are going to want to rename it to a .pgp extension (this is so it can be opened and decrypted by Ipgmail). Rename it to whatever you like, but remember to put .pgp at the end. Once it's renamed, we are going to want to mail it to ourselves, and open it in the Mail app, and send it to Dropbox (like we did when importing public keys). Once it's added to. Dropbox, select it in the files tab in Ipgmail. Once it's added to your files list, select the file name.pgp you just added to the list, and choose 'Decode File'. You will be prompted for your password. Put in your password, and boom! The message will be decrypted if you followed the above step to fix the formatting correctly!

~#~#~#~#~#~#~#~#~#~#~

I hope you enjoyed the tutorial and set your iDevice up for encrypting/decrypting PGP messages.

It is always beneficial to use PGP communication, as it keeps prying eyes from being able to read your conversations with other individuals.

Feel free to post my tutorial elsewhere if you desire, just make sure you give me credit.

If you feel like this tutorial is awesome, please donate some BitCoins to me. PM me if you would like to do so, and I'll send you my address.

Happy encryption!
Title: Re: PGP tutorial for iPad/iPhone - by VHSplayer
Post by: VHSplayer on August 13, 2013, 09:28 pm
Bumping this up so people can see it!
Title: Re: PGP tutorial for iPad/iPhone - by VHSplayer
Post by: Hungry ghost on August 13, 2013, 11:01 pm
I wrote a tutorial for using gpg on jail broken idevice a while ago, thought I would add it to this thread. You can also use oPenGP which you can probably get for free if you look for it, or its about £5 on appstore. It supports importing keys and messages to and from clipboard which is a great convenience.

Basically you can use all command line features of GPG, such as making alterations to the .conf file. I belive a SR member called Louis Cypher posted some good guides on how to use this.




       Ok, so a while ago i was looking for a GPG app for the iPhone. Since I already have a Tor browser for it (Onion Browser) I thought it would be useful. I am away from my computer most days and only can use GPG at night. This means if I need to communicate with a vendor it takes a day for each message/reply cycle, causing me potentially to have to wait longer for my drugs. Not ideal I think you will agree.
        I found two, one a official Symnatec PGP which requires you to already own PGP official software. The other was a low budget job that couldnt import the keys I wanted so no good.
        However in the course of my research I discovered that my jailbroken phone already has a command line GnuPG installed as part of the Cydia software. At the time I left it alone but now I have got my head round it.

PLEASE NOTE: if perfect security is important to you its probably best to stick to established methods. I am happy to use this as I am only a small time personal buyer.

First to check you have this package: Open Cydia>Manage>packages and switch to 'expert' setting. It should show up under the g's. I assumed it came with Cydia but it may have installed as a dependency for some other package I installed.

To use it you will need Mobile Terminal (install latest version from xsellize repo) and iFile. Also a SSH program on your PC will be handy. I use iFunbox; it has a stupid name but is the most useful.

Open Mobile Terminal. You do not need root privileges to use this. Type:

gpg

This will set up your pub and sec keyrings and a .conf file. These are in /var/mobile. in a folder .GnuPG which is invisible to iFile for some reason but will show up in iFunbox.

From now on any file will be put in /var/mobile. I dont know if this is vital but it seems to make sense to me.

To import your secret key, export it as a .asc file from your current GPG program. Put the .asc file in /var/mobile. You will probably want to shorten its name to something more managable: seckey.asc

Open Mobile Terminal and type

gpg --allow-secret-key-import --import seckey.asc

this will add your public and private keys to your keyring.

To import a public key:

gpg --import pubkey.asc   (where pubkey is the name of the file)

If you want you can create a file in /var/mobile using iFile called "pubkey.asc" and just copy/paste the public key block into it.

So now you have your private keys and whoevers public keys you want, to see them type

gpg --list-keys

gpg --list-secret-keys

This will show a list of keys with User Names.

Ok, now to encrypt a message.

Create a file in /var/mobile. Call it msg.asc
Copy/paste or type your message in this file.

then in MT type

gpg -e -a -r "recipients user name" msg.asc

the -a tells it to encrypt the text within the file and output another .asc file. If you dont use this it will treat the file as data and encrypt it to a .gpg file which is no good to us. (it is fairly easygoing about user names; it will recognise a small portion, like for me "hungry" would do)

Return to /var/mobile in iFile. There will be a file called msg.asc.asc which will contain encrypted text which you can copy/paste to wherever you want it.

To decrypt a message:

Again, create msg.asc file in /var/mobile. Copy/paste encrypted text to it.

Open MT. type:

gpg -d -a msg.asc

you will be prompted for passphrase, then it will output in MT.

If you want it to output to a file:

gpg -o output.asc -d -a msg.asc

this will output to a file called output.asc

Obviously you can use whatever filenames suit you.

I think this also works with .txt files but since it outputs to .asc I thought keep it simple.

There is obviously a lot more to command line GPG but this is a quick and dirty start up.
I am fed up typing now, will add more perhaps later. If anyone else would like to contribute who has more expertise in command line GPG I would welcome advice and help.

I have already found this very useful. It might be an idea to delete public keys when not in use....

gpg --delete-key "User name"

...nothing worse than being caught with drugs in your letterbox and a SR vendors PGP key in your iPhone, i
imagine.

Edit: I have found it useful to leave two files in var/mobile
One called msg.asc for messages
One called key.asc for keys

You can then create shortcuts in mobile terminal for many basic functions using these files to copy paste messages or keys to. This saves a lot of typing.
forgot to mention:
you can also generate a keypair:

gpg --gen-key

it will walk you through process.

Also, to export a public key to a file called "key.asc"

gpg --export -a "user name">key.asc

You can then copy/paste it for example to the bottom of your message.