Stephen Hoffman <seao...@hoffmanlabs.invalid> wrote:
> On 2012-09-12 05:01:51 +0000, Fritz Wuehler said:
>
> > Stephen Hoffman <seao...@hoffmanlabs.invalid> wrote:
> >
> >> On 2012-09-11 14:07:54 +0000, sampsa said:
> >>
> >>> 02 Password PIC X(30).
> >>
> >> And FWIW, that's potentially a bug, too.
> >>
> >> In general, don't store a password. Store a hash where you can; bcrypt
> >> or scrypt for that, and do not use a SHA nor any other fast hash.
> >
> > Why should you not use SHAx?
>
> Because SHA is intentionally very fast and very efficient and with
> intentionally low overhead, and can variously be performed with
> hardware assists.
I don't know what bcrypt or scrypt are, but I will take a standardized,
known-good hash that was approved by trials and a panel of real
cryptographers who's reputations and jobs matter, over unknown people's
stuff even when they base it on established crypto and *especially* when
they work for google. It is fairly well known in cryptography that layering
things when those effects are not fully understood (and understanding their
effects is usually very difficult) often leads to weaknesses that weren't
found in the original cipher. And as Bruce Schneier said, "nobody ever got
fired for using the standard". Don't use whatever crap comes with your OS
unless it is a known good implementation of an official, in-service cipher
or hash.
> You want slow, ugly, and memory-intensive; bcrypt or scrypt.
Just because it's slow, ugly, and memory intensive in whatever OS we're
talking about doesn't mean people with no sense of humor haven't already
written much faster implementations and created lookup tables.
If you have a password authentication scheme then hashing with SHAx is safer
and smarter than xcrypt all other things being equal. If your adversary has
the horsepower to crack 160 bit hashes or has precomputed lookup tables for
SHA1 it's Game Over anyway, so you may as well use the standard since it's
fast, cheap, and the standard.
> >
> >> store a certificate; a private or public key, as appropriate.
> >
> > Storing an unencrypted private key is worse than storing a password.
>
> It depends on what the application is doing; I'd rather use certificate
> authentication for the client-server connection than a password,
> because folks that are giving you passwords will tend to give you
> passwords that they're using elsewhere. If you or the user generates a
> certificate pair for the user, you know that "password" won't get
> reused.
Yes, passwords are usually weak and have other issues. Public key stuff is
fine when deployed properly. But see above, storing an unencrypted private
key is worse than storing a password. In a normal pubkey (certificate)
scenario, the private key doesn't go into a database. It stays with the
user, who sends his public key (certificate) to people who want to
authenticate him and they store that on their database.