<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Encryption on Janik von Rotz</title>
    <link>https://janikvonrotz.ch/tags/encryption/</link>
    <description>Recent content in Encryption on Janik von Rotz</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 10 Jan 2018 14:58:27 +0000</lastBuildDate>
    <atom:link href="https://janikvonrotz.ch/tags/encryption/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Create a soft wallet and transfer your Ether coins from an exchange</title>
      <link>https://janikvonrotz.ch/2018/01/10/create-a-soft-wallet-and-transfer-your-ether-coins-from-an-exchange/</link>
      <pubDate>Wed, 10 Jan 2018 14:58:27 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2018/01/10/create-a-soft-wallet-and-transfer-your-ether-coins-from-an-exchange/</guid>
      <description>&lt;p&gt;Intrigued by the title you might ask your self: What is the reason to store ether in a software wallet? Well, If you have cryptocoins on an exchange platform there is always the risk of the account getting hacked or the platform goes offline (see MtGox). Exchange platforms for cryptocoins are not as regulated and institutionalized as banks and trading centers are. The risk is in favor of the provider. To assert full control of your coins aka your money it is recommended to store them in a wallet.&lt;/p&gt;&#xA;&lt;p&gt;In the following tutorial I will show you how I have transferred my coins into a soft wallet.&lt;/p&gt;&#xA;&lt;p&gt;This tutorial assumes that the os environment is MacOS. Nonetheless, the platform does not matter to go through the tutorial, it also works for other platforms such as Windows or Linux.&lt;/p&gt;&#xA;&lt;h2 id=&#34;install-geth&#34;&gt;Install Geth&lt;/h2&gt;&#xA;&lt;p&gt;Lets get started by installing the go command line tool to interact with the Ethereum network.&lt;/p&gt;&#xA;&lt;p&gt;Use Homebrew to install the tool, make sure it is up-to-date.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;brew update&#xA;brew upgrade&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Install the &lt;strong&gt;g&lt;/strong&gt;o &lt;strong&gt;eth&lt;/strong&gt;erum cli.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;brew tap ethereum/ethereum&#xA;brew install ethereum&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;For other platforms use the according package manager.&lt;/p&gt;&#xA;&lt;h2 id=&#34;account-management&#34;&gt;Account Management&lt;/h2&gt;&#xA;&lt;p&gt;To receive Ether we need an account.&lt;/p&gt;&#xA;&lt;p&gt;Create an account and set a password.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;geth account new&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Make sure to store the password somewhere safe. There is no way to retrieve or reset the password for the account once lost.&lt;/p&gt;&#xA;&lt;p&gt;List all available accounts.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;geth account list&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Backup the keystore file of the new account.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;cp ~/Library/Ethereum/keystore/UTC--yyyy-mm-ddT12-59-07.353801000Z--927b07ac62ee6c10861b5024710a997937b20e31 /path/to/encrypted/storage/Etherum/_ADDRESS_.prv&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;sync&#34;&gt;Sync&lt;/h2&gt;&#xA;&lt;p&gt;Transactions are stored on the block chain. In order to see transactions and execute them you must sync the blockchain.&lt;/p&gt;&#xA;&lt;p&gt;Sync the Etherum blockchain in fast mode.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;geth --syncmode fast --cache 2048 &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;This mode allows us to sync the blockchain without processing and verifying each block.&lt;/p&gt;&#xA;&lt;p&gt;The second parameter sets the cache according to the computers available memory. Make sure to adjust the number.&lt;/p&gt;&#xA;&lt;p&gt;To see the progress of the sync an attached geth console must be started. An attached geth console is connected to the currently running geth process. Open a new terminal and run the command below.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;geth attached&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now check the syncing state.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;eth.syncing&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;As long as the current and highest block number do not match, further syncing is required.&lt;/p&gt;&#xA;&lt;h2 id=&#34;send-ether&#34;&gt;Send Ether&lt;/h2&gt;&#xA;&lt;p&gt;Once the sync is finished, we are ready to retrieve Ether.&lt;/p&gt;&#xA;&lt;p&gt;From your exchange platform (I am using Kraken) send the fewest  amount of Ether possible to the accounts address. &lt;strong&gt;Do not send all of your Ether.&lt;/strong&gt; We have to make sure everything works correctly.&lt;/p&gt;&#xA;&lt;p&gt;To see the transaction a sync of the chain is required.&lt;/p&gt;&#xA;&lt;p&gt;To check the accounts balance start the geth console.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;geth console&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now run this JavaScript code.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;function checkAllBalances() {&#xA;    var totalBal = 0;&#xA;    for (var acctNum in eth.accounts) {&#xA;        var acct = eth.accounts[acctNum];&#xA;        var acctBal = web3.fromWei(eth.getBalance(acct), &amp;quot;ether&amp;quot;);&#xA;        totalBal += parseFloat(acctBal);&#xA;        console.log(&amp;quot;  eth.accounts[&amp;quot; + acctNum + &amp;quot;]: \t&amp;quot; + acct + &amp;quot; \tbalance: &amp;quot; + acctBal + &amp;quot; ether&amp;quot;);&#xA;    }&#xA;    console.log(&amp;quot;  Total balance: &amp;quot; + totalBal + &amp;quot; ether&amp;quot;);&#xA;};&#xA;checkAllBalances();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The JavaScript function return the Ether balance for each registered account.&lt;/p&gt;&#xA;&lt;p&gt;If you see a positive Ether balance for your account then everything works fine and you are ready to send more Ether to the soft wallet.&lt;/p&gt;&#xA;&lt;h2 id=&#34;secure-storage&#34;&gt;Secure Storage&lt;/h2&gt;&#xA;&lt;p&gt;In case you want to know how I store my password and key files.&lt;/p&gt;&#xA;&lt;p&gt;I am using the &lt;a href=&#34;https://keybase.io/&#34;&gt;keybase file system&lt;/a&gt; to store the key file of the geth account and &lt;a href=&#34;https://keepassxc.org/&#34;&gt;KeePass&lt;/a&gt; to store the password. The KeePass database is encrypted with a password and a key file. All data can be accessed from my Windows and from my Mac computer. These tools are all open source. Further the hard disk of my Windows and Mac computer are encrypted.&lt;/p&gt;&#xA;&lt;h2 id=&#34;geth-alternative&#34;&gt;Geth Alternative&lt;/h2&gt;&#xA;&lt;p&gt;In case geth did not work you, try &lt;a href=&#34;https://www.parity.io/&#34;&gt;parity&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;source&#34;&gt;Source&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/ethereum/go-ethereum/wiki/Managing-your-accounts&#34;&gt;Etherum Wiki - Managing your accounts&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://etherscan.io&#34;&gt;Etherscan - Blockchain Explorer&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Say Goodbye to TrueCrypt</title>
      <link>https://janikvonrotz.ch/2014/05/30/say-goodbye-to-truecrypt/</link>
      <pubDate>Fri, 30 May 2014 07:21:00 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/05/30/say-goodbye-to-truecrypt/</guid>
      <description>&lt;p&gt;Apparently the developer of TrueCrypt threw in the towel this week.&lt;/p&gt;&#xA;&lt;p&gt;The official site &lt;a href=&#34;http://truecrypt.org&#34;&gt;http://truecrypt.org&lt;/a&gt; redirects to &lt;a href=&#34;http://truecrypt.sourceforge.net/&#34;&gt;http://truecrypt.sourceforge.net/&lt;/a&gt; where you&amp;rsquo;ll find instructions to migrate you TrueCrypt disk to Microsofts built-in solution Bitlocker.&lt;/p&gt;&#xA;&lt;p&gt;The reason for all this is obvious, TrueCrypt can&amp;rsquo;t compete against Microsofts Bitlocker as their software comes with every Windows 8 version (withWindows 7 you had to have an enterprise license in order to use Bitlocker).&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Create GPG Keys</title>
      <link>https://janikvonrotz.ch/2014/04/09/create-gpg-keys/</link>
      <pubDate>Wed, 09 Apr 2014 08:30:29 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/04/09/create-gpg-keys/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9543913&#34;&gt;https://gist.github.com/9543913&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;introuction&#34;&gt;Introuction&lt;/h1&gt;&#xA;&lt;p&gt;GPG keys are used for symmetric key encryption.&#xA;GnuPG is the most common tool to create such keys.&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/13/deploy-ubuntu-server/&#34;&gt;Ubuntu server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/25/install-ubuntu-packages/&#34;&gt;dGnuPG, rng-tools&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;instructions&#34;&gt;Instructions&lt;/h1&gt;&#xA;&lt;p&gt;Change the shell context to the user which uses the new GPG keys.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;su [user]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Or use the root user.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo su&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Give your server some work, otherwhise gpg won&amp;rsquo;t be able to generator random bytes.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo rngd -r /dev/urandom&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Genrate the gpg key.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gpg --gen-key&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Answert the prompts.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;Your selection?: (1) RSA and RSA (default)&#xA;What keysize do you want?: 2048&#xA;Key is valid for?: 0 = key does not expire&#xA;Is this correct?: y&#xA;Real name: [firstname] [surname]&#xA;Email address: [mail]@[example.org]&#xA;Comment:&#xA;Change ... (O)kay/(Q)uit?: O&#xA;Enter passphrase: [gpg passphrase]&#xA;Repeat passphrase: [gpg passphrase]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Kill the rngd task.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo service rng-tools stop&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Show the new GnuPG keys.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gpg -k&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;The &lt;code&gt;gpg key id&lt;/code&gt; is displayed in the line &lt;code&gt;pub   2048R/&amp;gt;&amp;gt;C58886FB&amp;lt;&amp;lt; 2014-03-14&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Export the public key into a text file and back it up in a secure place.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gpg --armor --export -a [gpg key id] &amp;gt; [firstname][surname][server name]#public.key&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Export the private key into a text file and back it up in a secure place.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;gpg --armor --export-secret-keys -a [gpg key id] &amp;gt; [firstname][surname][server name]#private.key&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Exit the user shell context if you have switched to another user.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;exit&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Store the &lt;code&gt;gpg passphrase&lt;/code&gt; in a secure place f.g. &lt;a href=&#34;http://keepass.info/&#34;&gt;KeePass Password Safe&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h1 id=&#34;source&#34;&gt;Source&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://www.debian-administration.org/articles/209#d0e109&#34;&gt;Unattended, Encrypted, Incremental Network Backups by Kellen&lt;/a&gt;&#xA;&lt;a href=&#34;http://blog.mypapit.net/2011/11/ubuntu-cli-create-entropy-gpg-key.html&#34;&gt;Ubuntu: How to create a lot of entropy for GPG key generation from command line&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Convert SSL certificates</title>
      <link>https://janikvonrotz.ch/2014/03/27/convert-ssl-certificates/</link>
      <pubDate>Thu, 27 Mar 2014 14:01:50 +0000</pubDate>
      <guid>https://janikvonrotz.ch/2014/03/27/convert-ssl-certificates/</guid>
      <description>&lt;p&gt;&lt;em&gt;This post is part of my &lt;a href=&#34;https://janikvonrotz.ch/your-own-virtual-private-server-hosting-solution/&#34;&gt;Your own Virtual Private Server hosting solution&lt;/a&gt; project.&lt;/em&gt;&lt;br&gt;&#xA;&lt;em&gt;Get the latest version of this article here: &lt;a href=&#34;https://gist.github.com/9413205&#34;&gt;https://gist.github.com/9413205&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h1 id=&#34;requirements&#34;&gt;Requirements&lt;/h1&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://janikvonrotz.ch/2014/03/26/get-a-free-verified-ssl-certificate-from-startssl/&#34;&gt;Get a free verified SSL certificate from StartSSL (optional)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h1 id=&#34;instructions&#34;&gt;Instructions&lt;/h1&gt;&#xA;&lt;p&gt;When buying a certificate from you CA (Certification Authority) e.g. a wildcard certificate for *.example.org, you have to convert this file to different formats in order to use them with your webserver installation.&lt;/p&gt;&#xA;&lt;p&gt;To convert these files use OpenSSL.&lt;/p&gt;&#xA;&lt;p&gt;First file you’ll need is the public certificate.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now you can chose between the encrypted and decrypted key file.&lt;/p&gt;&#xA;&lt;p&gt;If chosing the encrypted key file your webserver will prompt every time starting the web service for the certificate pass-phrase.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Otherwise your webserver won’t prompt for an pass-pharase, but be aware, if you’re losing this decrypted key file you certificate will be worthless.&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo openssl pkcs12 -in [yourfile.pfx] -nodes -out [keyfile-decrypted.key]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;h2 id=&#34;certificate-chain&#34;&gt;Certificate chain&lt;/h2&gt;&#xA;&lt;p&gt;During the SSL negotiation, a server provides its certificate along with the &amp;ldquo;intermediate&amp;rdquo; certificates that exist between it and the root. This allows clients to validate the server&amp;rsquo;s certificate without going through a discovery processes that not all browsers support, and for those that do, without an additional performance penalty.&lt;/p&gt;&#xA;&lt;p&gt;Download the CA server certificate on their website&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;sudo sh -c &amp;quot;cat [certificate.crt] &amp;gt; [certificate.crt.ca.bundle]&amp;quot;&#xA;sudo sh -c &amp;quot;cat [certificate.ca.crt] &amp;gt;&amp;gt; [certificate.crt.ca.bundle]&amp;quot;&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
  </channel>
</rss>
