Re: Random access to an encrypted file

Discussion in 'Java' started by Roedy Green, Apr 27, 2010.

  1. Roedy Green

    Roedy Green Guest

    On Mon, 26 Apr 2010 10:41:36 -0500, Spud <> wrote,
    quoted or indirectly quoted someone who said :

    >We've been told that we need to implement on-disk encryption of our data
    >files. We currently write them using RandomAccessFile and read them
    >using FileChannel.read(ByteBuffer).
    >
    >Before I go off on my own, slog through java.security, and write a
    >wrapper around these routines to encrypt/decrypt, is there an easy way
    >to do it? Perhaps something built into the JDK that I'm missing?


    The easy way would be to find a database that does encryption.
    see http://mindprod.com/jgloss/sqlvendors.html
    for candidates.

    The awkward thing about roll your own is the growth factor that
    encryption penalises you is not usually accurately predictable.

    Check out JCE and benchmark some algorithms. There is quite a
    difference in speed. In particular check out the new AES.

    See http://mindprod.com/jgloss/jce.html
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    It’s amazing how much structure natural languages have when you consider who speaks them and how they evolved.
    Roedy Green, Apr 27, 2010
    #1
    1. Advertising

  2. Roedy Green

    Arne Vajhøj Guest

    On 27-04-2010 04:15, Roedy Green wrote:
    > On Mon, 26 Apr 2010 10:41:36 -0500, Spud<> wrote,
    > quoted or indirectly quoted someone who said :
    >> We've been told that we need to implement on-disk encryption of our data
    >> files. We currently write them using RandomAccessFile and read them
    >> using FileChannel.read(ByteBuffer).
    >>
    >> Before I go off on my own, slog through java.security, and write a
    >> wrapper around these routines to encrypt/decrypt, is there an easy way
    >> to do it? Perhaps something built into the JDK that I'm missing?

    >
    > The easy way would be to find a database that does encryption.
    > see http://mindprod.com/jgloss/sqlvendors.html
    > for candidates.
    >
    > The awkward thing about roll your own is the growth factor that
    > encryption penalises you is not usually accurately predictable.


    I would expect every algorithm to have a very well defined
    function for the size after encryption depending on the
    size before encryption. 100% predictable.

    Arne
    Arne Vajhøj, Apr 28, 2010
    #2
    1. Advertising

  3. Arne Vajhøj wrote:
    > On 27-04-2010 04:15, Roedy Green wrote:
    >> On Mon, 26 Apr 2010 10:41:36 -0500, Spud<> wrote,
    >> quoted or indirectly quoted someone who said :
    >>> We've been told that we need to implement on-disk encryption of our
    >>> data files. We currently write them using RandomAccessFile and read
    >>> them using FileChannel.read(ByteBuffer).
    >>>
    >>> Before I go off on my own, slog through java.security, and write a
    >>> wrapper around these routines to encrypt/decrypt, is there an easy
    >>> way to do it? Perhaps something built into the JDK that I'm missing?

    >>
    >> The easy way would be to find a database that does encryption.
    >> see http://mindprod.com/jgloss/sqlvendors.html
    >> for candidates.
    >>
    >> The awkward thing about roll your own is the growth factor that
    >> encryption penalises you is not usually accurately predictable.

    >
    > I would expect every algorithm to have a very well defined
    > function for the size after encryption depending on the
    > size before encryption. 100% predictable.


    I wouldn't. E.g an algortihm whose first step is to convert an array of
    chars to an array of bytes encoded in UTF-8.
    Mike Schilling, Apr 28, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin
    Replies:
    19
    Views:
    1,118
    Tris Orendorff
    Feb 13, 2006
  2. globalrev
    Replies:
    4
    Views:
    745
    Gabriel Genellina
    Apr 20, 2008
  3. Martin Gregorie

    Re: Random access to an encrypted file

    Martin Gregorie, Apr 26, 2010, in forum: Java
    Replies:
    11
    Views:
    556
    The Frog
    Apr 28, 2010
  4. John B. Matthews

    Re: Random access to an encrypted file

    John B. Matthews, Apr 27, 2010, in forum: Java
    Replies:
    1
    Views:
    383
    The Frog
    Apr 29, 2010
  5. VK
    Replies:
    15
    Views:
    1,126
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page