bwLehrpool Masterserver
Manages authentication and sharing of virtual machines between participating institutions
Static Public Member Functions | Static Package Attributes | Static Private Member Functions | Static Private Attributes | List of all members
org.openslx.imagemaster.util.Sha512Crypt Class Reference
+ Collaboration diagram for org.openslx.imagemaster.util.Sha512Crypt:

Static Public Member Functions

static final String Sha512_crypt (String keyStr, String saltStr, int roundsCount)
 
static final boolean verifyPassword (String plaintextPass, String sha512CryptText)
 
static final boolean verifyHashTextFormat (String sha512CryptText)
 
static void selfTest ()
 

Static Package Attributes

static final ThreadLocal
< MessageDigest > 
sha2 = newThreadLocalSha512()
 

Static Private Member Functions

static ThreadLocal< MessageDigest > newThreadLocalSha512 ()
 For instantiating TL sha512, so we don't have to copy this stuff twice. More...
 
static final String b64_from_24bit (byte B2, byte B1, byte B0, int size)
 

Static Private Attributes

static final String sha512_salt_prefix = "$6$"
 
static final String sha512_rounds_prefix = "rounds="
 
static final int SALT_LEN_MAX = 16
 
static final int ROUNDS_DEFAULT = 5000
 
static final int ROUNDS_MIN = 1000
 
static final int ROUNDS_MAX = 999999999
 
static final String SALTCHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
 
static final String itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
 
static final ThreadLocal
< MessageDigest > 
sha1 = newThreadLocalSha512()
 Cache of sha512 digesters. More...
 

Detailed Description

This class defines a method, Sha512_crypt(), which takes a password and a salt string and generates a Sha512 encrypted password entry.

This class implements the new generation, scalable, SHA512-based Unix 'crypt' algorithm developed by a group of engineers from Red Hat, Sun, IBM, and HP for common use in the Unix and Linux /etc/shadow files.

The Linux glibc library (starting at version 2.7) includes support for validating passwords hashed using this algorithm.

The algorithm itself was released into the Public Domain by Ulrich Drepper <drepp.nosp@m.er@r.nosp@m.edhat.nosp@m..com>. A discussion of the rationale and development of this algorithm is at

http://people.redhat.com/drepper/sha-crypt.html

and the specification and a sample C language implementation is at

http://people.redhat.com/drepper/SHA-crypt.txt

Definition at line 81 of file Sha512Crypt.java.

Member Function Documentation

static final String org.openslx.imagemaster.util.Sha512Crypt.b64_from_24bit ( byte  B2,
byte  B1,
byte  B0,
int  size 
)
staticprivate

Definition at line 362 of file Sha512Crypt.java.

+ Here is the caller graph for this function:

static ThreadLocal<MessageDigest> org.openslx.imagemaster.util.Sha512Crypt.newThreadLocalSha512 ( )
staticprivate

For instantiating TL sha512, so we don't have to copy this stuff twice.

Returns
thread local sha512 digester

Definition at line 103 of file Sha512Crypt.java.

static void org.openslx.imagemaster.util.Sha512Crypt.selfTest ( )
static

Validate our implementation using test data from Ulrich Drepper's C implementation.

Definition at line 452 of file Sha512Crypt.java.

+ Here is the call graph for this function:

static final String org.openslx.imagemaster.util.Sha512Crypt.Sha512_crypt ( String  keyStr,
String  saltStr,
int  roundsCount 
)
static

This method actually generates an Sha512 crypted password hash from a plaintext password and a salt.

The resulting string will be in the form '$6$<rounds=n>$<salt>$<hashed mess>

Parameters
keyStrPlaintext password
saltStrAn encoded salt/roundes which will be consulted to determine the salt and round count, if not null
roundsCountIf this value is not 0, this many rounds will used to generate the hash text.
Returns
The Sha512 Unix Crypt hash text for the keyStr

Definition at line 137 of file Sha512Crypt.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static final boolean org.openslx.imagemaster.util.Sha512Crypt.verifyHashTextFormat ( String  sha512CryptText)
static

Returns true if sha512CryptText is a valid Sha512Crypt hashtext, false if not.

Definition at line 404 of file Sha512Crypt.java.

static final boolean org.openslx.imagemaster.util.Sha512Crypt.verifyPassword ( String  plaintextPass,
String  sha512CryptText 
)
static

This method tests a plaintext password against a SHA512 Unix Crypt'ed hash and returns true if the password matches the hash.

Parameters
plaintextPassThe plaintext password text to test.
sha512CryptTextThe hash text we're testing against. We'll extract the salt and the round count from this String.

Definition at line 387 of file Sha512Crypt.java.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

final String org.openslx.imagemaster.util.Sha512Crypt.itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
staticprivate

Definition at line 90 of file Sha512Crypt.java.

final int org.openslx.imagemaster.util.Sha512Crypt.ROUNDS_DEFAULT = 5000
staticprivate

Definition at line 86 of file Sha512Crypt.java.

final int org.openslx.imagemaster.util.Sha512Crypt.ROUNDS_MAX = 999999999
staticprivate

Definition at line 88 of file Sha512Crypt.java.

final int org.openslx.imagemaster.util.Sha512Crypt.ROUNDS_MIN = 1000
staticprivate

Definition at line 87 of file Sha512Crypt.java.

final int org.openslx.imagemaster.util.Sha512Crypt.SALT_LEN_MAX = 16
staticprivate

Definition at line 85 of file Sha512Crypt.java.

final String org.openslx.imagemaster.util.Sha512Crypt.SALTCHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
staticprivate

Definition at line 89 of file Sha512Crypt.java.

final ThreadLocal<MessageDigest> org.openslx.imagemaster.util.Sha512Crypt.sha1 = newThreadLocalSha512()
staticprivate

Cache of sha512 digesters.

Definition at line 96 of file Sha512Crypt.java.

final ThreadLocal<MessageDigest> org.openslx.imagemaster.util.Sha512Crypt.sha2 = newThreadLocalSha512()
staticpackage

Definition at line 97 of file Sha512Crypt.java.

final String org.openslx.imagemaster.util.Sha512Crypt.sha512_rounds_prefix = "rounds="
staticprivate

Definition at line 84 of file Sha512Crypt.java.

final String org.openslx.imagemaster.util.Sha512Crypt.sha512_salt_prefix = "$6$"
staticprivate

Definition at line 83 of file Sha512Crypt.java.


The documentation for this class was generated from the following file: