? Editing: Post:21.body Save Delete Cancel
Content changed Sign & Publish new content

muja's blog

Same language, different code

Follow in NewsfeedFollowing

Recent comments:

New post

Title

21 hours ago · 2 min read 4
Post body
Keep reading

Changing and encrypting ZeroIds

on Mar 05, 2016 · 2 min read

You've been reading about this encryption thing, but what can you use it for?

I've seen that lots of people want to know how to change their ZeroId, so I made a script that will encrypt your current user, decrypt your other user and then change your user. Sounds good?


If you use anything that's not Linux (or maybe Mac), then this won't work for you. You should try Linux, it's what cool people use this days ( :P ) and you don't need to uninstall your current operating system. A lot of people recommend Linux Mint for beginners.

This "tutorial" assumes that your ZeroNet client is not running and that you have two users.json files both registered with ZeroIds. Simply move your current file to another folder and a new one will be created when you start ZeroNet (or maybe even while running).

First thing you gotta do is get yourself some encryption keys.

A few notes before:

The majority of people [citation needed] (;P) advertise against RSA-4096 (that's the size of the key in bits) saying that it's unnecessary since you gain less and less security as your key size increases (see Diminishing returns). My take is that you can't have too much of a good thing (how naive). But read this to see why they say it's unnecessary.

Pro-tip: since we are going to use these keys for scripts, give it some simple, one word name, it'll help later.

So, when they ask you for your Real name, call it Scripts.

Run gpg --gen-key

Nice!

Now, before I give you the script, make a folder where you will save your encrypted ZeroIds. For example /home/muja/backups/zeronet/users or whatever works best for you. Just remember to put it on the script bellow.

Open a text editor and paste the second code-block (not changer.sh) on it.

changer.sh

#!/bin/bash

# Backup current user

mkdir -p /tmp/zeronet/users/$1 > /dev/null 2>&1
cp /path/to/zeronet/data/users.json /tmp/zeronet/users/$1/users.json
cp /path/to/zeronet/data/sites.json /tmp/zeronet/users/$1/sites.json
cd /tmp/zeronet/users
zip -rq $1.zip $1/ > /dev/null 2>&1
gpg --yes -r Scripts -o /home/muja/backups/zeronet/users/$1.zip.asc -aes /tmp/zeronet/users/$1.zip
rm -f $1.zip
rm -rf $1/

# Change user

gpg -o /tmp/zeronet/users/$2.zip /home/muja/backups/zeronet/users/$2.zip.asc
unzip $2.zip  > /dev/null 2>&1
cp $2/users.json /path/to/zeronet/data/users.json
rm -f $2.zip
rm -rf $2/

After you make the necessary changes (the path to your zeronet folder, the backup folder, your key name...) give the script permissions to run, like so:

chmod 755 changer.sh

Get an alias to call your script, like so:

echo "alias zch='/path/changer.sh'" >> ~/.bashrc

Run the script (zch muja muja). Change muja to your user (yes, two times).

Cool, your user (and your sites list) should be encrypted on /home/muja/backups/zeronet/users/muja.zip.asc.

Now put your other user on /path/to/zeronet/data/users.json and run the command again, but this time calling your other user:

zch othermuja muja

The first is your current user and the second is the one you want to change to.

This script is a lot simpler than it might look. If anyone tried doing this and it did not work, make sure you changed these things:

/path/to/zeronet # Path to your zeronet folder
Scripts # Your Real name on your key
/home/muja/backups/zeronet/users #The place to save your users

There's also the chance that I, while adapting this code for publishing, may have made some errors. So feel free to comment bellow or send me a ZeroMail.

It's very unlikely that someone will do this since it's such a niche thing, I just wanted to publish it anyway :)

4 Comments:

user_name1 day ago
Reply
Body
tkaritaon Jul 30, 2016
Reply

Windows users could do this if they install Cygwin.

Some sanity checks would protect against weird behavior if the script were accidentally called with the wrong number of arguments.

mujaon Apr 29, 2016
Reply

frayoshi:
I mean, security is the priority when your identity is at risk.. we have control over the real world because It's our body.. online they can take control of it ;)

Oh yeah, not only with ZeroNet. Identify theft is pretty scary.

Another solution could be an usb key with our identity, so when we wanna use It we can mount It and run part of this script! difference is that it will exchange the data in the /path/to/zeronet/data/users.json with the data in /path/to/the/mounted/data/ZN-login/users.json

Good point. By the way, I'm working on a system to encrypt data so that it can be "safely" and efficiently stored on cloud storage systems. I'm still thinking up the protocol and how it would work, writing it should be pretty fast. It'll be out soon-ish.

actually, this is a very useful post!

Glad you found it useful :)

frayoshion Apr 29, 2016
Reply

actually, this is a very useful post!
I mean, security is the priority when your identity is at risk.. we have control over the real world because It's our body.. online they can take control of it ;)

and ehi!
Another solution could be an usb key with our identity, so when we wanna use It we can mount It and run part of this script! difference is that it will exchange the data in the /path/to/zeronet/data/users.json with the data in /path/to/the/mounted/data/ZN-login/users.json

just an idea i'm sharing :·)
Cool post muja!
THANKS :D

erkanon Mar 06, 2016
Reply

I just wanted to publish it anyway :)
thx
It's very unlikely that someone will do this since it's such a niche thing
yeah, I saw yesterday a few requests regarding changing ZeroIDs

This page is a snapshot of ZeroNet. Start your own ZeroNet for complete experience. Learn More