> Let us say I want to distribute a series of files to a group of
> people. I am prepared to give them a decryption key of some kind
[quoted text clipped - 12 lines]
>
> What algorithms are reasonable candidates?
I've never used PGP, and if they were my customers, I wouldn't force
them to install PGP, but ... I hear that PGP has password-based
symmetric file encryption using the -c option on the command line. This
option is viable even if the customers are overseas, since you would not
export the PGP code.
If the recipients are all where you don't need an export license and
you want to write it yourself, you need an implementation of SHA-1 and
an implementation of a block cipher, such as AES, or stream cipher, such
as RC4 (which IMHO needs too much coddling for a secure implementation).
The basic plan for each file is,
generate an AES encryption key using SecureRandom.
Generate an HMAC-SHA1 authentication key using SecureRandom.
Encrypt the file using AES in counter mode. The initial counter value
can be fixed, say 0. Each block is ciphertext=plaintext XOR
AES_k(counter++). No need for padding.
Form the HMAC-SHA1 message authentication code of the ciphertext and
append it or prepend it.
Post the ciphertext with its MAC to the web site.
The decryption code first checks the MAC of the ciphertext using the
authentication key, then XORs the ciphertext with the successive
AES_k(counter++) values to recover the plaintext.
> The particular application in mind is a scheme for drug company
> researchers to share proprietary information about unreleased drugs.
>
> I gather I'd get in trouble sending out a few CDs to act as a one time
> pad.
A CD with a OTP is practical, certainly if you're not going to do
this very often. A few lines of Java would suffice for the decoding. You
can run AES in counter mode to generate the pad using a random key, then
throw away the key. You'd still want an MD5 or SHA1 implementation, for
the authentication.
Note: This wouldn't be a OTP in Shannon's sense. For that, you'd need
something more like SecureRandom.getSeed().
The interesting part is the key distribution. If you're not going to
put the entire keystream and authentication key onto a CD, you could
generate the encryption and authentication keys by hashing a
high-entropy password, then distribute the password secretly.
Generate the keys at random and protect them by XORing with the hash
of a password that you distribute secretly.
If you have more interaction with the recipients, if in particular
they can generate public/private key pairs, there are more possibilities.
For RSA, generate the (symmetric) keys at random, pad with OAEP,
encrypt them with each recipient's unique public key, and send (or post)
the results openly.
For DH, generate an ephemeral public-private key pair for each
recipient, send the public key and the XOR of the symmetric keys and a
hash of the shared secret, to each recipient openly. Then throw away the
ephemeral private key.
Each of these key distribution methods can be made to work, and each
has its own set of gotchas.
--Mike Amling
Roedy Green - 29 Sep 2003 00:20 GMT
> If the recipients are all where you don't need an export license
I am in Canada preparing this for a guy in Colorado. The clients I
presume will mostly be American, but potentially could be outside the
US as well. Are there any restrictions on the encryption I use?
In other words, is the restriction on the author of the software or
the user of the software?
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Michael Amling - 29 Sep 2003 04:22 GMT
>> If the recipients are all where you don't need an export license
>
[quoted text clipped - 4 lines]
> In other words, is the restriction on the author of the software or
> the user of the software?
The US restrictions are on the exporter taking it or sending it
outside the US. I haven't looked into Canada's regulations.
--Mike Amling
Michael Amling - 29 Sep 2003 20:06 GMT
>> If the recipients are all where you don't need an export license
>
[quoted text clipped - 4 lines]
> In other words, is the restriction on the author of the software or
> the user of the software?
I haven't looked at Canadian regulations, but
http://www.efc.ca/pages/doc/crypto-export.html, though somewhat dated,
looks like one place to start.
--Mike Amling
Roedy Green - 05 Oct 2003 23:59 GMT
>In other words, is the restriction on the author of the software or
>the user of the software?
I applied for a free Thawte email cert just to see if I could figure
out how they work. I got an X.509. They seem to offer various types
for different browsers. I never actually saw the cert or consciously
generated a private key. It just appeared in my list of certs after I
clicked the "fetch" button.
I presume the browser must have automatically generated a private key
at the time the request was generated.
I think there are fields in the X.509 that get digitally signed saying
what the cert is good for.
Is your approach going to be you will accept any cert signed by your
mini signing authority? Or do you collect a list of public keys that
you will accept. If the second, you might get this to work by getting
your clients to apply for free email certs.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Roedy Green - 29 Sep 2003 00:27 GMT
> For RSA, generate the (symmetric) keys at random, pad with OAEP,
>encrypt them with each recipient's unique public key, and send (or post)
>the results openly.
There are perhaps 40 MB of files which are continuously updated. My
software handles noticing what's new and what has been deleted, and
arranging that just that is downloaded. There may be dozens of clients
with access. I can't very well afford to upload a separate version
for each client.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Michael Amling - 29 Sep 2003 14:28 GMT
>>For RSA, generate the (symmetric) keys at random, pad with OAEP,
>>encrypt them with each recipient's unique public key, and send (or post)
[quoted text clipped - 5 lines]
> with access. I can't very well afford to upload a separate version
> for each client.
The (40 MB) files are each encrypted once. It's the keys that you
would reencrypt into a 1K or 2K RSA block for each customer.
Having a separate public key for each customer allows dropping a
customer without redistributing fresh key material to the remaining
customers. Perhaps that is more than you're looking for.
At the low end, you could encrypt each file with the same key. It's
then important that the counter values not be reused. Choosing a random
128-bit initial counter value for each file is sufficient to prevent
that. Prepend the initial counter value to the ciphertext, and include
it in the MAC.
If the web site could be spoofed, then append or prepend a digital
signature to each file. An RSA signature takes about 10 lines of Java,
not counting the PSS padding and the SHA1 hash.
--Mike Amling
Roedy Green - 29 Sep 2003 01:24 GMT
>Generate an HMAC-SHA1 authentication key using SecureRandom.
That part could be handled with jarsigner could it not?
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Michael Amling - 29 Sep 2003 04:22 GMT
>>Generate an HMAC-SHA1 authentication key using SecureRandom.
>
> That part could be handled with jarsigner could it not?
If I knew, I would tell you, but I'm not familiar with jarsigner (or
the JCE). We use our own source code for AES, 3DES, MD5, SHA-1, NMAC,
HMAC, RSA, and ECC.
--Mike Amling
> Let us say I want to distribute a series of files to a group of
> people. I am prepared to give them a decryption key of some kind
[quoted text clipped - 10 lines]
> 4. I'd like this to work on a vanilla http website without any
> serverside code.
If you are already willing to go with HTTPS why not have just have a
secure web site with HTTPS where you need a user name and password to
get to the items they are allowed to download ?
In any case once they get hold of the encrypted bob and they decrypted,
it is out of your hand in term of security and if they wanted to
redistribute it and you would not know about it.
If you wanted security on the destination site because the off site
people are using notebook, and the main users are not people that deal
with security in general, the best solution we found was to use pgpdisk
or some program like that would let you encrypt a whole partition. So
anything confidential should go to that encrypted drive.
Minh Tran-Le.
Roedy Green - 02 Oct 2003 19:12 GMT
>If you are already willing to go with HTTPS why not have just have a
>secure web site with HTTPS where you need a user name and password to
>get to the items they are allowed to download ?
I wanted this also to work on a website that did not offer HTTPS.
As I said in my original post:
I'd prefer this over HTTPS for several reasons:
1. added security on the FTP upload.
2. faster downloads for those with dialup connections.
3. generic solution that is not tied into the authentication scheme of
some particular server.
4. I'd like this to work on a vanilla http website without any
serverside code.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.