Note that there are some explanatory texts on larger screens.

plurals
  1. POpublic key cryptograpy with Java and OpenSSL
    primarykey
    data
    text
    <p>In an application I want to store sensitive data (which can be arbitrarily large) so that it can later be used for researching. The point is that I don't want the data to lie around unprotected, so I want to encrypt it before saving it.</p> <p>On another computer (in a more trustworthy environment) I want to decrypt that data later. The decryption should be possible with readily available tools, for example OpenSSL. Now my question is: How do I do all that?</p> <p>I already know the abstract steps:</p> <ol> <li>Once and for all generate a public/private key pair.</li> <li>Encrypt a <code>byte[]</code> in Java using the public key, store it somewhere.</li> <li>Copy the encrypted data to a "safer" computer.</li> <li>Decrypt the saved data using a simple OpenSSL command line.</li> </ol> <p>What I'm missing now are the details:</p> <ul> <li>What kind of key pair do I need?</li> <li>What encryption scheme should I use? (it's probably something like "rsa-encrypt a symmetric key, then encrypt the data with that key")</li> <li>How does the simple OpenSSL command line look like?</li> </ul> <p><strong>[Update 2011-02-13]</strong></p> <p>After a little research I found a page that describes exactly what I want to do: <a href="http://blog.altudov.com/2010/09/27/using-openssl-for-asymmetric-encryption-of-backups/" rel="nofollow">http://blog.altudov.com/2010/09/27/using-openssl-for-asymmetric-encryption-of-backups/</a>. Basically the answer to my step 4 is this command line:</p> <pre><code>openssl smime -decrypt \ -in data.smime -binary -inform DER \ -inkey key.pem \ -out data </code></pre> <p>Now my question is: How can I generate a file from Java whose format is compatible to OpenSSL so I can decompress it using this command line? I want to do this hundrets of times per second, so invoking an external process seems too slow. That's why I want to do it directly in Java.</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.
 

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