1 /* 2 * JBoss, the OpenSource J2EE webOS 3 * 4 * Distributable under LGPL license. 5 * See terms of license at gnu.org. 6 */ 7 package org.jboss.crypto.digest; 8 9 import java.util.Map; 10 import java.security.MessageDigest; 11 12 /** 13 * An interface that can be used to augment the behavior of a digest hash. 14 * One example usecase is with the password based login modules to 15 * modify the behavior of the hashing to introduce prefix/suffix salts. 16 * 17 * @author Scott.Stark@jboss.org 18 * @version $Revision: 1.1 $ 19 */ 20 public interface DigestCallback 21 { 22 /** Pass through access to the login module options. When coming from a 23 * login module this includes the following keys: 24 * javax.security.auth.login.name - for the username 25 * javax.security.auth.login.password - for the String password 26 */ 27 public void init(Map options); 28 /** 29 * Pre-hash callout to allow for content before the password. Any content 30 * should be added using the MessageDigest update methods. 31 * @param digest - the security digest being used for the one-way hash 32 */ 33 public void preDigest(MessageDigest digest); 34 /** Post-hash callout afer the password has been added to allow for content 35 * after the password has been added. Any content should be added using the 36 * MessageDigest update methods. 37 * @param digest - the security digest being used for the one-way hash 38 */ 39 public void postDigest(MessageDigest digest); 40 } 41