<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Encryption on Geek Cabinet</title>
    <link>https://geekcabi.net/tags/encryption/</link>
    <description>Recent content in Encryption on Geek Cabinet</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 27 Aug 2023 00:00:00 +0000</lastBuildDate><atom:link href="https://geekcabi.net/tags/encryption/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>But What if I HAVE to Encrypt with 7zip?</title>
      <link>https://geekcabi.net/posts/encrypt-with-7z/</link>
      <pubDate>Sun, 27 Aug 2023 00:00:00 +0000</pubDate>
      
      <guid>https://geekcabi.net/posts/encrypt-with-7z/</guid>
      <description>&lt;p&gt;Yes, I know I updated the &lt;a href=&#34;https://geekcabi.net/tools/#file-encryption&#34;&gt;tools page&lt;/a&gt; and now recommend &lt;strong&gt;against&lt;/strong&gt; encrypting with 7zip. But sometimes we have to do things we don&amp;rsquo;t &lt;strong&gt;want&lt;/strong&gt; to do.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Yes, I know I updated the <a href="/tools/#file-encryption">tools page</a> and now recommend <strong>against</strong> encrypting with 7zip. But sometimes we have to do things we don&rsquo;t <strong>want</strong> to do.</p>
<p>Like eat our vegetables. Wait. No, that&rsquo;s actually <strong>good</strong> for you.</p>
<p>Whatever.</p>
<p>You get the idea.</p>
<p>Encrypting a file with 7zip is simple. Use the <code>-p</code> option:</p>
<pre tabindex="0"><code>~$ 7z a archive.7z -pSTRONG_PASSWORD_THAT_IS_REALLY_LONG_HERE! folder/

7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive:
1 folder, 4 files, 0 bytes

Creating archive: archive.7z

Items to compress: 5

    
Files read from disk: 0
Archive size: 186 bytes (1 KiB)
Everything is Ok
</code></pre><p>I have always loved 7zip&rsquo;s attempt to make me feel better.</p>
<p>&ldquo;Don&rsquo;t worry. Everything is Ok.&rdquo; :thumbs_up: :grinning_squinting_face:</p>
<blockquote>
<p><strong>Note:</strong>
There is <strong>no space</strong> between the option and the password. That&rsquo;s an oddity with 7z that I just don&rsquo;t see with many other CLI tools.</p>
</blockquote>
<p>You may notice, however, that when you go to list the contents of the archive, the folder and file names are listed <strong>without</strong> prompting for the password!</p>
<pre tabindex="0"><code>~$ 7z l archive.7z                   

7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive for archives:
1 file, 186 bytes (1 KiB)

Listing archive: archive.7z

--
Path = archive.7z
Type = 7z
Physical Size = 186
Headers Size = 186
Solid = -
Blocks = 0

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2023-08-23 16:01:10 D....            0            0  folder
2023-08-23 16:01:10 ....A            0            0  folder/bank_info.xlsx
2023-08-23 16:01:10 ....A            0            0  folder/classified.txt
2023-08-23 16:01:10 ....A            0            0  folder/file1.txt
2023-08-23 16:01:10 ....A            0            0  folder/file2.txt
------------------- ----- ------------ ------------  ------------------------
2023-08-23 16:01:10                  0            0  4 files, 1 folders
</code></pre><p>Showing folder and file names without requiring the password is probably not acceptable for encrypted files. (Then again, ideally we wouldn&rsquo;t be using 7zip for encryption, but&hellip;.I already made that point.)</p>
<p>To encrypt the folder and file names, too, we need to use an option that only shows up on the <code>man</code> page of 7zip and not in the CLI help output:</p>
<pre tabindex="0"><code>-mhe=on|off
   7z format only : enables or disables archive header encryption (Default : off)
</code></pre><p>So all of this only works on the 7z format vs traditional zip, etc&hellip;</p>
<p>With this, our example changes to:</p>
<pre tabindex="0"><code>7z a archive.7z -mhe=on -pSTRONG_PASSWORD_THAT_IS_REALLY_LONG_HERE! folder/
</code></pre><p>The output is the same until the file contents are listed:</p>
<pre tabindex="0"><code>7z l archive.7z                           

7-Zip [64] 17.04 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.04 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs x64)

Scanning the drive for archives:
1 file, 221 bytes (1 KiB)

Listing archive: archive.7z


Enter password (will not be echoed):
--
Path = archive.7z
Type = 7z
Physical Size = 221
Headers Size = 221
Solid = -
Blocks = 0

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2023-08-23 16:01:10 D....            0            0  folder
2023-08-23 16:01:10 ....A            0            0  folder/bank_info.xlsx
2023-08-23 16:01:10 ....A            0            0  folder/classified.txt
2023-08-23 16:01:10 ....A            0            0  folder/file1.txt
2023-08-23 16:01:10 ....A            0            0  folder/file2.txt
------------------- ----- ------------ ------------  ------------------------
2023-08-23 16:01:10                  0            0  4 files, 1 folders
</code></pre><p>One other thing to note: encrypting a file in this manner will leave the password in your shell history file. I will leave as an exercise to the reader the following search: &ldquo;<a href="https://duckduckgo.com/?q=histcontrol%3Dignorespace" rel="noopener" target="_blank" class="external">HISTCONTROL=ignorespace</a>&rdquo; &#x1f60f;</p>]]></content:encoded>
    </item>
    
    <item>
      <title>How to Use miniLock - a Simple Way to Encrypt Files</title>
      <link>https://geekcabi.net/posts/how-to-use-minilock/</link>
      <pubDate>Fri, 22 Apr 2016 09:00:01 +0000</pubDate>
      
      <guid>https://geekcabi.net/posts/how-to-use-minilock/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;I originally posted this entry on our family&amp;rsquo;s Wordpress blog, back in 2015. I decided to update and repost the content here, since &lt;del&gt;it&amp;rsquo;s still relevant and&lt;/del&gt; it fits better here anyway&amp;hellip;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;miniLock is no longer actively maintained and is no longer recommended as an encrypton option.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There are lots of different ways to encrypt a file and today I want to cover one of the more obscure, and I believe more unique methods.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<blockquote>
<p>I originally posted this entry on our family&rsquo;s Wordpress blog, back in 2015. I decided to update and repost the content here, since <del>it&rsquo;s still relevant and</del> it fits better here anyway&hellip;</p>
</blockquote>
<blockquote>
<p><strong>miniLock is no longer actively maintained and is no longer recommended as an encrypton option.</strong></p>
</blockquote>
<p>There are lots of different ways to encrypt a file and today I want to cover one of the more obscure, and I believe more unique methods.</p>
<p>miniLock <del>is</del> was a Chrome app and relies on the combination of an email address and a strong passphrase as the key. This is both a positive and a negative.</p>
<p>That&rsquo;s great because it means you can encrypt and decrypt files on a Chromebook, or any other machine without storing the private key locally. It&rsquo;s bad because most people don&rsquo;t have good passwords – much less <strong>passphrases</strong>.</p>
<p>Still, it&rsquo;s a simple way to encrypt files, and I like to have options.</p>
<p>At the risk of making the process more complicated than it really is, I took some screenshots and walked through the installation and encryption process below.</p>
<h2 id="installation">Installation</h2>
<p>Step 1: Install</p>
<p>Installation is super simple. Visit <a href="http://minilock.io" rel="noopener" target="_blank" class="external">minilock.io</a> and click the link to the Chrome App Store</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-01-install-from-website.png" type="" alt="01 - Install from website"  /></p>
<p>Click &ldquo;Add to Chrome&rdquo;</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-02-add-to-chrome.png" type="" alt="02 - Add to Chrome"  /></p>
<p>Step 2: Launch</p>
<p>Go to the installed Apps in Chrome and click on the light blue padlock</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-03-launch-from-apps.png" type="" alt="Yes, I&rsquo;m a baseball fan&hellip;"  /></p>
<p>Step 3: Create key</p>
<p>This is done by entering your email address and a strong passphrase.</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-04-login.png" type="" alt="04 - Login"  /></p>
<h2 id="encryption">Encryption</h2>
<p>Step 4: Select file</p>
<p>Your miniLock ID is shown at the bottom of this window. This key can be posted or sent anywhere – and should be if you want others to be able to send you encrypted files with miniLock. I <del>currently have</del> even had my ID in <a href="https://twitter.com/ubahmapk" rel="noopener" target="_blank" class="external">my Twitter bio line</a> - and in fact, the entire key ID fits in a single tweet.</p>
<p>My miniLock ID is UXTFUyqcoM3spXNMtqpZGqqNzjZyZsGiQQwezVH1UYNR5.</p>
<p>Now you can either drag the file you want to encrypt, or click the big square box to find your file.</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-05-add-files.png" type="" alt="05 - Add files"  /></p>
<p>Step 5: Encrypt</p>
<p>Paste in the miniLock IDs of the file recipients. I strongly recommend keeping these in a text file or email or Evernote or something similar. Again, they are not sensitive, so it really doesn&rsquo;t matter where you keep them. A file in <a href="https://www.dropbox.com/referrals/NTE1NDEzMDk?src=global9" title="Referral link" rel="noopener" target="_blank" class="external">Dropbox</a> would work just fine. :-)</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-06-add-minilock-ids-and-encrypt.png" type="" alt="06 - Add miniLock IDs and encrypt"  /></p>
<p>You can add more miniLock IDs if you need to.</p>
<p>Step 7: Save encrypted file</p>
<p>Once complete, you can download the encrypted file by clicking on the down arrow. This &ldquo;.minilock&rdquo; file can be attached to an email or sent via Dropbox or put on a USB stick or stored and distributed anywhere, really.</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-07-download-encrypted-file.png" type="" alt="07 - Download encrypted file"  /></p>
<h2 id="decryption">Decryption</h2>
<p>Decrypting a &ldquo;.minilock&rdquo; file is just as easy. Simply drag and drop the file onto the window from Step 4. The file will decrypt (assuming it was encrypted to your miniLock ID) and you can download and save the original file.</p>
<p><img loading="lazy" src="/posts/how-to-use-minilock/minilock-08-download-decrypted-file.png" type="" alt="08 - Download decrypted file"  /></p>
<h2 id="conclusion">Conclusion</h2>
<p>That&rsquo;s really all there is to it.</p>
<p>I believe the greatest weakness and strength of the entire miniLock system is the keys. (Of course, that should be said of any good encryption system - and this solution hasn&rsquo;t been elevated to that status yet.)</p>
<p>It&rsquo;s a strength because the private key isn&rsquo;t stored anywhere - it&rsquo;s generated by the login process. It&rsquo;s a weakness because there isn&rsquo;t a good way to store the keys for others. Which means key distribution with miniLock has the same problem as PGP. Except there isn&rsquo;t a way to sign the keys of others, so there&rsquo;s no good way to establish trust, making the miniLock less ideal than PGP.</p>
<p>I still prefer <a href="https://en.wikipedia.org/wiki/Pretty_Good_Privacy" rel="noopener" target="_blank" class="external">PGP</a>  (or <a href="https://gnupg.org" title="Gnu Privacy Guard - Open Source PGP implementation" rel="noopener" target="_blank" class="external">GnuPG</a>) for encryption, but it&rsquo;s good to have alternatives to work with. <del>So I consider this just another option.</del></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Using SSL Connections Over ncat</title>
      <link>https://geekcabi.net/posts/using-ssl-connections-over-ncat/</link>
      <pubDate>Sun, 20 Mar 2016 09:00:01 +0000</pubDate>
      
      <guid>https://geekcabi.net/posts/using-ssl-connections-over-ncat/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://nmap.org/ncat/&#34; rel=&#34;noopener&#34; target=&#34;_blank&#34; class=&#34;external&#34;&gt;ncat&lt;/a&gt; is a full rewrite from the nmap team of the traditional &lt;a href=&#34;http://nc110.sourceforge.net/&#34; rel=&#34;noopener&#34; target=&#34;_blank&#34; class=&#34;external&#34;&gt;netcat&lt;/a&gt; (nc) network &amp;ldquo;Swiss Army Knife&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;ncat is full of really slick new features, but the one I will cover here is the ability to do all the wonderful things nc could do, but over an SSL connection. (Yes, yes, yes: I should call it a TLS connection instead, but since the ncat documentation still refers to it as &amp;ldquo;SSL&amp;rdquo;, I will do the same here.)&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><a href="https://nmap.org/ncat/" rel="noopener" target="_blank" class="external">ncat</a> is a full rewrite from the nmap team of the traditional <a href="http://nc110.sourceforge.net/" rel="noopener" target="_blank" class="external">netcat</a> (nc) network &ldquo;Swiss Army Knife&rdquo;.</p>
<p>ncat is full of really slick new features, but the one I will cover here is the ability to do all the wonderful things nc could do, but over an SSL connection. (Yes, yes, yes: I should call it a TLS connection instead, but since the ncat documentation still refers to it as &ldquo;SSL&rdquo;, I will do the same here.)</p>
<p>To establish an encrypted ncat session, simply pass the &ldquo;&ndash;ssl&rdquo; option to ncat, along with the hostname or IP and destination port, like you would with any other connection:</p>
<pre><code>ubahmapk@laptop:~ &gt; echo -e &quot;GET / HTTP/1.1\r\nHost: \
ubahmapk.github.io\r\nUser-Agent: ncat\r\nAccept: */*\r\nReferer: \
https://www.google.com/?gws_rd=ssl#q=ncat+ssl\r\n\r\n&quot; \ 
| ncat --ssl -v ubahmapk.github.io 443
Ncat: Version 6.49SVN ( http://nmap.org/ncat )
Ncat: SSL connection to 23.235.44.133:443. Fastly, Inc.
Ncat: SHA-1 fingerprint: 2199 1384 6372 1713 B9ED 0E8F 00A5 9B73 0DD0 5658
HTTP/1.1 200 OK
Server: GitHub.com
Content-Type: text/html; charset=utf-8
Last-Modified: Mon, 21 Mar 2016 02:14:16 GMT
Access-Control-Allow-Origin: *
Expires: Mon, 21 Mar 2016 03:42:50 GMT
Cache-Control: max-age=600
X-GitHub-Request-Id: 17EB2C2C:38FF:984CD29:56EF6B60
Content-Length: 12733
Accept-Ranges: bytes
Date: Mon, 21 Mar 2016 03:32:50 GMT
Via: 1.1 varnish
Age: 0
Connection: keep-alive
X-Served-By: cache-dfw1826-DFW
X-Cache: MISS
X-Cache-Hits: 0
X-Timer: S1458531170.944139,VS0,VE49
Vary: Accept-Encoding
X-Fastly-Request-ID: f9a65b919e4649f5ef6f24397ecdf953fee840dd

[trimmed output]
</code></pre>
<p>The &lsquo;-v&rsquo; option above caused ncat to include the three lines at the top beginning with &ldquo;Ncat: &ldquo;, which confirm the version running, along with the SSL connection connection information. Adding three &lsquo;-v&rsquo; options would add information like this:</p>
<pre><code> NCAT DEBUG: Using system default trusted CA certificates and those in /usr/local/share/ncat/ca-bundle.crt.
 Ncat: Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
 Ncat: Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
 Ncat: SHA-1 fingerprint: 5FB7 EE06 33E2 59DB AD0C 4C9A E6D3 8F1A 61C7 DC25
 Ncat: Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert SHA2 High Assurance Server CA
 Ncat: Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
 Ncat: SHA-1 fingerprint: A031 C467 82E6 E6C6 62C2 C87C 76DA 9AA6 2CCA BD8E
 Ncat: Subject: C=US, ST=California, L=San Francisco, O=Fastly, Inc., CN=www.github.com
 Ncat: Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert SHA2 High Assurance Server CA
 Ncat: SHA-1 fingerprint: 2199 1384 6372 1713 B9ED 0E8F 00A5 9B73 0DD0 5658
 NCAT DEBUG: Checking certificate DNS name &quot;www.github.com&quot; against &quot;ubahmapk.github.io&quot;.
 NCAT DEBUG: Checking certificate DNS name &quot;*.github.com&quot; against &quot;ubahmapk.github.io&quot;.
 NCAT DEBUG: Checking certificate DNS name &quot;github.com&quot; against &quot;ubahmapk.github.io&quot;.
 NCAT DEBUG: Checking certificate DNS name &quot;*.github.io&quot; against &quot;ubahmapk.github.io&quot;.
 Ncat: SSL connection to 23.235.40.133:443. Fastly, Inc.
 Ncat: SHA-1 fingerprint: 2199 1384 6372 1713 B9ED 0E8F 00A5 9B73 0DD0 5658
</code></pre>
<p>But it also includes a great deal of other details from the libnsock library and can greatly clutter up the output.</p>
<p>Inbound connections with ncat can also utilize the ssl option:</p>
<pre><code>ncat --ssl -l -p 443 -e /bin/bash
</code></pre>
<p>(The above is a <em>terrible</em> thing to run. Do <em>NOT</em> do that&hellip;)</p>
<p>The code snippet below shows the options used to specify public and private SSL keys; certificate validation behavior and which file should be used to validate certificates; and which SSL ciphers to accept (or reject):</p>
<pre><code>--ssl-cert             Specify SSL certificate file (PEM) for listening
--ssl-key              Specify SSL private key (PEM) for listening
--ssl-verify           Verify trust and domain name of certificates
--ssl-trustfile        PEM file containing trusted SSL certificates
--ssl-ciphers          Cipherlist containing SSL ciphers to use
</code></pre>
<p>If you needed to make SSL connections with the traditional nc client, you could either create an stunnel connection or utilize the openssl s_client command as a ncat client:</p>
<pre><code>ubahmapk@laptop:~ &gt; openssl s_client -host ubahmapk.github.io -port 443 
CONNECTED(00000003)
depth=2 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert High Assurance EV Root CA
verify return:1
depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 High Assurance Server CA
verify return:1
depth=0 C = US, ST = California, L = San Francisco, O = &quot;Fastly, Inc.&quot;, CN = www.github.com
verify return:1
---
Certificate chain
0 s:/C=US/ST=California/L=San Francisco/O=Fastly, Inc./CN=www.github.com
i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
---
Server certificate

[output trimmed]
</code></pre>
<p>But this method isn&rsquo;t nearly as clean, and doesn&rsquo;t allow for all the other functionality of netcat!</p>
<p>In fact, I&rsquo;ll probably start a series on the different ncat options just for fun&hellip; :-)</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
