Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Basically, anyone with access to your program and a debugger <em>can</em> and <em>will</em> find the key in the application if they want to.</p> <p>But, if you just want to make sure the key doesn't show up when running <code>strings</code> on your binary, you could for instance make sure that the key is not within the printable range.</p> <p><strong>Obscuring key with XOR</strong></p> <p>For instance, you could use XOR to split the key into two byte arrays:</p> <pre><code>key = key1 XOR key2 </code></pre> <p>If you create key1 with the same byte-length as <code>key</code> you can use (completely) random byte values and then compute <code>key2</code>:</p> <pre><code>key1[n] = crypto_grade_random_number(0..255) key2[n] = key[n] XOR key1[n] </code></pre> <p>You can do this in your build environment, and then only store <code>key1</code>and <code>key2</code> in your application.</p> <p><strong>Protecting your binary</strong></p> <p>Another approach is to use a tool to protect your binary. For instance, there are several security tools that can make sure your binary is obfuscated and starts a virtual machine that it runs on. This makes it hard(er) to debug, and is also the convential way many commercial grade secure applications (also, alas, malware) is protected.</p> <p>One of the premier tools is <a href="http://www.oreans.com/products.php" rel="noreferrer">Themida</a>, which does an awesome job of protecting your binaries. It is often used by well known programs, such as Spotify, to protect against reverse engineering. It has features to prevent debugging in programs such as OllyDbg and Ida Pro.</p> <p>There is also a larger list, maybe somewhat outdated, of <a href="http://www.google.com/Top/Computers/Security/Products_and_Tools/Software_Protection_and_License_Control/" rel="noreferrer">tools to protect your binary</a>.<br> Some of them are free.</p> <p><strong>Password matching</strong></p> <p>Someone here discussed hashing password+salt. </p> <p>If you need to store the key to match it against some kind of user submitted password, you should use a one-way hashing function, preferrably by combining username, password and a salt. The problem with this, though, is that your application has to know the salt to be able to do the one-way and compare the resulting hashes. So therefore you still need to store the salt somewhere in your application. But, as @Edward points out in the comments below, this will effectively protect against a dictionary attack using, e.g, rainbow tables.</p> <p>Finally, you can use a combination of all the techniques above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload