KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > security > srp > SRPVerifierStore


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.security.srp;
23
24 import java.io.IOException JavaDoc;
25 import java.io.Serializable JavaDoc;
26 import java.io.ObjectStreamField JavaDoc;
27 import java.security.KeyException JavaDoc;
28
29 /** An interface describing the requirements of a password verifier store.
30 This is an abstraction that allows the <username, verifier, salt> information
31 needed by the server to be plugged in from various sources. E.g., LDAP
32 servers, databases, files, etc.
33
34  @author Scott.Stark@jboss.org
35  @version $Revision: 40096 $
36 */

37 public interface SRPVerifierStore
38 {
39    public static class VerifierInfo implements Serializable JavaDoc
40    {
41       /** The serial version UID @since 1.2.4.1 */
42       private static final long serialVersionUID = 7420301687504271098L;
43       private static final ObjectStreamField JavaDoc[] serialPersistentFields = {
44          new ObjectStreamField JavaDoc("username", String JavaDoc.class),
45          new ObjectStreamField JavaDoc("verifier", byte[].class),
46          new ObjectStreamField JavaDoc("salt", byte[].class),
47          new ObjectStreamField JavaDoc("g", byte[].class),
48          new ObjectStreamField JavaDoc("N", byte[].class),
49          new ObjectStreamField JavaDoc("hashAlgorithm", String JavaDoc.class),
50          new ObjectStreamField JavaDoc("cipherAlgorithm", String JavaDoc.class),
51          new ObjectStreamField JavaDoc("cipherIV", byte[].class)
52       };
53
54       /** The username the information applies to. Perhaps redundant but it
55        * makes the object self contained.
56        * @serialField username String username
57        */

58       public String JavaDoc username;
59       /** The SRP password verifier hash
60        * @serialField verifier byte[] password verifier
61        */

62       public byte[] verifier;
63       /** The random password salt originally used to verify the password
64        * @serialField salt originally used to verify the password
65        */

66       public byte[] salt;
67       /** The SRP algorithm primitive generator
68        * @serialField g primitive generator
69        */

70       public byte[] g;
71       /** The algorithm safe-prime modulus
72        * @serialField N safe-prime modulus
73        */

74       public byte[] N;
75       /** The algorithm to hash the session key to produce K. To be consistent
76        with the RFC2945 description this must be SHA_Interleave as implemented
77        by the JBossSX security provider. For compatibility with earlier JBossSX
78        SRP releases the algorithm must be SHA_ReverseInterleave. This name is
79        passed to java.security.MessageDigest.getInstance().
80        * @serialField hashAlgorithm algorithm to hash the session key
81        * @since 1.2.4.2
82        */

83       public String JavaDoc hashAlgorithm;
84       /** The algorithm to use for any encryption of data.
85        * @serialField cipherAlgorithm algorithm to use for any encryption
86        * @since 1.2.4.2
87        */

88       public String JavaDoc cipherAlgorithm;
89       /** The initialization vector to use for any encryption of data.
90        * @serialField cipherIV initialization vector to use for any encryption
91        * @since 1.6
92        */

93       public byte[] cipherIV;
94    }
95
96     /** Get the indicated user's password verifier information.
97      */

98     public VerifierInfo getUserVerifier(String JavaDoc username)
99       throws KeyException JavaDoc, IOException JavaDoc;
100     /** Set the indicated users' password verifier information. This is equivalent
101      to changing a user's password and should generally invalidate any existing
102      SRP sessions and caches.
103      */

104     public void setUserVerifier(String JavaDoc username, VerifierInfo info)
105       throws IOException JavaDoc;
106
107    /** Verify an optional auxillary challenge sent from the client to the server. The
108     * auxChallenge object will have been decrypted if it was sent encrypted from the
109     * client. An example of a auxillary challenge would be the validation of a hardware
110     * token (SafeWord, SecureID, iButton) that the server validates to further strengthen
111     * the SRP password exchange.
112     */

113    public void verifyUserChallenge(String JavaDoc username, Object JavaDoc auxChallenge)
114          throws SecurityException JavaDoc;
115 }
116
Popular Tags