Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.sasl.srp
Class PasswordFile  view PasswordFile download PasswordFile.java

java.lang.Object
  extended bycryptix.sasl.srp.PasswordFile
All Implemented Interfaces:
SRPParams

public class PasswordFile
extends java.lang.Object
implements SRPParams

The Cryptix implementation of the SRP password files.

For SRP, there are three (3) files:

  1. The password configuration file: tpasswd.conf. It contains the pairs indexed by a number for each pair used for a user. By default, this file's pathname is constructed from the base password file pathname by prepending it with the ".conf" suffix.
  2. The base password file: tpasswd. It contains the related password entries for all the users with values computed using SRP's default message digest algorithm: SHA-1 (with 160-bit output block size).
  3. The extended password file: tpasswd2. Its name is ALWAYS constructed by adding the suffix "2" to the fully qualified pathname of the base password file. It contains, in addition to the same fields as the base password file, albeit with a different verifier value, an extra field identifying the message digest algorithm used to compute this (verifier) value.
This implementation assumes the following message digest algorithm codes:

Since:
draft-burdis-cat-sasl-srp-03
Version:
$Revision: 1.9 $

Field Summary
private static org.apache.log4j.Category cat
           
private static java.lang.String CONFIG_FIELD
           
private  java.io.File configFile
           
private  java.util.HashMap configurations
           
private  java.lang.String confName
           
private static java.lang.String DEFAULT_FILE
           
private  java.util.HashMap entries
           
private  long lastmodConfigFile
           
private  long lastmodPasswd2File
           
private  long lastmodPasswdFile
           
private static java.math.BigInteger[] Nsrp
           
private  java.io.File passwd2File
           
private  java.io.File passwdFile
           
private  java.lang.String pw2Name
           
private  java.lang.String pwName
           
private static java.lang.String SALT_FIELD
           
private static java.util.HashMap srps
          The SRP algorithm instances used by this object.
private static java.lang.String USER_FIELD
           
private static java.lang.String VERIFIERS_FIELD
           
 
Fields inherited from interface cryptix.sasl.srp.SRPParams
AES, AVAILABLE_OPTIONS, BLOWFISH, CAST5, CHOSEN_OPTIONS, CLIENT_EVIDENCE, CLIENT_PUBLIC_KEY, CONFIDENTIALITY_ALGORITHMS, CONFIG_NDX_FIELD, DEFAULT_CONFIDENTIALITY, DEFAULT_INTEGRITY, DEFAULT_MANDATORY, DEFAULT_PASSWORD_FILE, DEFAULT_REPLAY_DETECTION, FIELD_GENERATOR, HMAC_MD5, HMAC_SHA1, INTEGRITY_ALGORITHMS, MANDATORY_CONFIDENTIALITY, MANDATORY_INTEGRITY, MANDATORY_NONE, MANDATORY_REPLAY_DETECTION, MD_NAME_FIELD, PASSWORD_FILE, PASSWORD_VERIFIER, SERVER_EVIDENCE, SERVER_PUBLIC_KEY, SHARED_MODULUS, SRP_CONFIDENTIALITY, SRP_DEFAULT_DIGEST_NAME, SRP_DIGEST_NAME, SRP_INTEGRITY_PROTECTION, SRP_MANDATORY, SRP_MD5_NAME, SRP_REPLAY_DETECTION, SRP_RIPEMD_128_NAME, SRP_RIPEMD_160_NAME, SRP_SHA_160_NAME, SRP_SHA_256_NAME, SRP_SHA_384_NAME, SRP_SHA_512_NAME, SRP_SHA_NAME, SRP_SHA1_NAME, USER_NAME, USER_ROLE, USER_SALT, USER_VERIFIER_FIELD
 
Constructor Summary
PasswordFile()
           
PasswordFile(java.io.File pwFile)
           
PasswordFile(java.lang.String pwName)
           
PasswordFile(java.lang.String pwName, java.lang.String confName)
           
PasswordFile(java.lang.String pwName, java.lang.String pw2Name, java.lang.String confName)
           
 
Method Summary
 void add(java.lang.String user, java.lang.String passwd, byte[] salt, java.lang.String index)
           
 void changePasswd(java.lang.String user, java.lang.String passwd)
           
private  void checkCurrent()
           
 boolean contains(java.lang.String user)
           
 boolean containsConfig(java.lang.String index)
           
 java.lang.String[] lookup(java.lang.String user, java.lang.String mdName)
          Returns the triplet: verifier, salt and configuration file index, of a designated user, and a designated message digest algorithm name, as an array of strings.
 java.lang.String[] lookupConfig(java.lang.String index)
           
private  java.util.HashMap newVerifiers(byte[] salt, java.lang.String username, java.lang.String password, java.lang.String index)
           
private  void readConf(java.io.InputStream in)
           
private  void readOrCreateConf()
           
private  void readPasswd(java.io.InputStream in)
           
private  void readPasswd2(java.io.InputStream in)
           
 void savePasswd()
           
private  void update()
           
private  void writeConf(java.io.PrintWriter pw)
           
private  void writePasswd(java.io.PrintWriter pw1, java.io.PrintWriter pw2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

private static org.apache.log4j.Category cat

USER_FIELD

private static final java.lang.String USER_FIELD
See Also:
Constant Field Values

VERIFIERS_FIELD

private static final java.lang.String VERIFIERS_FIELD
See Also:
Constant Field Values

SALT_FIELD

private static final java.lang.String SALT_FIELD
See Also:
Constant Field Values

CONFIG_FIELD

private static final java.lang.String CONFIG_FIELD
See Also:
Constant Field Values

DEFAULT_FILE

private static java.lang.String DEFAULT_FILE

srps

private static java.util.HashMap srps
The SRP algorithm instances used by this object.


confName

private java.lang.String confName

pwName

private java.lang.String pwName

pw2Name

private java.lang.String pw2Name

configFile

private java.io.File configFile

passwdFile

private java.io.File passwdFile

passwd2File

private java.io.File passwd2File

lastmodConfigFile

private long lastmodConfigFile

lastmodPasswdFile

private long lastmodPasswdFile

lastmodPasswd2File

private long lastmodPasswd2File

entries

private java.util.HashMap entries

configurations

private java.util.HashMap configurations

Nsrp

private static final java.math.BigInteger[] Nsrp
Constructor Detail

PasswordFile

public PasswordFile()
             throws java.io.IOException

PasswordFile

public PasswordFile(java.io.File pwFile)
             throws java.io.IOException

PasswordFile

public PasswordFile(java.lang.String pwName)
             throws java.io.IOException

PasswordFile

public PasswordFile(java.lang.String pwName,
                    java.lang.String confName)
             throws java.io.IOException

PasswordFile

public PasswordFile(java.lang.String pwName,
                    java.lang.String pw2Name,
                    java.lang.String confName)
             throws java.io.IOException
Method Detail

containsConfig

public boolean containsConfig(java.lang.String index)
                       throws java.io.IOException

lookupConfig

public java.lang.String[] lookupConfig(java.lang.String index)
                                throws java.io.IOException

contains

public boolean contains(java.lang.String user)
                 throws java.io.IOException

add

public void add(java.lang.String user,
                java.lang.String passwd,
                byte[] salt,
                java.lang.String index)
         throws java.io.IOException

changePasswd

public void changePasswd(java.lang.String user,
                         java.lang.String passwd)
                  throws java.io.IOException

savePasswd

public void savePasswd()
                throws java.io.IOException

lookup

public java.lang.String[] lookup(java.lang.String user,
                                 java.lang.String mdName)
                          throws java.io.IOException
Returns the triplet: verifier, salt and configuration file index, of a designated user, and a designated message digest algorithm name, as an array of strings.


readOrCreateConf

private void readOrCreateConf()
                       throws java.io.IOException

readConf

private void readConf(java.io.InputStream in)
               throws java.io.IOException

writeConf

private void writeConf(java.io.PrintWriter pw)
                throws java.io.IOException

newVerifiers

private java.util.HashMap newVerifiers(byte[] salt,
                                       java.lang.String username,
                                       java.lang.String password,
                                       java.lang.String index)
                                throws java.io.IOException

update

private void update()
             throws java.io.IOException

checkCurrent

private void checkCurrent()
                   throws java.io.IOException

readPasswd

private void readPasswd(java.io.InputStream in)
                 throws java.io.IOException

readPasswd2

private void readPasswd2(java.io.InputStream in)
                  throws java.io.IOException

writePasswd

private void writePasswd(java.io.PrintWriter pw1,
                         java.io.PrintWriter pw2)
                  throws java.io.IOException