Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, no it is not a problem with every programming environment. OpenSSL which is written in C has support for large keys for example. From experience with both JCE and JNI I would however suggest that you find a way to use pure Java instead of loading a native library through JNI. It is just a lot easier.</p> <p><strong>A practical solution:</strong> Is your application installed using some kind of installer application during installation? If so, then one solution could be to use this installer to also install JCE.</p> <p>BouncyCastle unfortunately also uses JCE as stated in their <a href="http://www.bouncycastle.org/wiki/display/JA1/Frequently+Asked+Questions" rel="nofollow">FAQ</a>.</p> <p><strong>UPDATE 1:</strong> I found this library which might be what you are looking for. It doesn't seem to be maintained any longer however: <a href="http://www.cryptix.org/" rel="nofollow">http://www.cryptix.org/</a></p> <p><strong>UPDATE 2:</strong> GNU has a library which implements AES256: <a href="http://www.gnu.org/software/gnu-crypto/" rel="nofollow">http://www.gnu.org/software/gnu-crypto/</a> . More on the available ciphers here: <a href="http://www.gnu.org/software/gnu-crypto/manual/Ciphers.html" rel="nofollow">http://www.gnu.org/software/gnu-crypto/manual/Ciphers.html</a></p> <p>Code example using GNU-Crypto given that you already have your key loaded in <code>key_bytes</code>:</p> <pre><code>IBlockCipher cipher = CipherFactory.getInstance("AES"); Map attributes = new HashMap(); attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE, new Integer(16)); attributes.put(IBlockCipher.KEY_MATERIAL, key_bytes); cipher.init(attributes); int bs = cipher.currentBlockSize(); for (int i = 0; i + bs &lt; pt.length; i += bs) { cipher.encryptBlock(pt, i, ct, i); } for (int i = 0; i + bs &lt; cpt.length; i += bs) { cipher.decryptBlock(ct, i, cpt, i); } </code></pre> <p>Please insure that you use a cryptographically secure random number generator such as <a href="http://docs.oracle.com/javase/6/docs/api/java/security/SecureRandom.html" rel="nofollow">SecureRandom</a> to create your 256 bytes for the key:</p> <pre><code>byte[] seed = xxx; // Be sure to get a good new seed on every client machine. SecureRandom random = new SecureRandom(seed); byte[] key_bytes = new byte[256]; random.nextBytes(key_bytes); </code></pre>
    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. 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