You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2003/09/08 17:29:48 UTC

cvs commit: jakarta-turbine-fulcrum/crypto/xdocs changes.xml index.xml

epugh       2003/09/08 08:29:48

  Modified:    crypto   project.xml
               crypto/xdocs index.xml
  Added:       crypto/src/java/org/apache/fulcrum/crypto/provider
                        OldJavaCrypt.java JavaCrypt.java ClearCrypt.java
                        UnixCrypt.java package.html
               crypto/xdocs changes.xml
  Log:
  Fix build.  Some files that should be in CVS were not.  Get example to match actual code!
  
  Revision  Changes    Path
  1.2       +10 -0     jakarta-turbine-fulcrum/crypto/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/crypto/project.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.xml	16 Aug 2003 02:41:46 -0000	1.1
  +++ project.xml	8 Sep 2003 15:29:48 -0000	1.2
  @@ -39,5 +39,15 @@
     </dependencies>
   
   
  +  <unitTest>
  +   <resources>      
  +      <resource>       
  +        <includes>
  +          <include>*.xml</include>
  +        </includes>
  +      </resource>          
  +    </resources>      
  +  </unitTest>
  +
   </project>
   
  
  
  
  1.1                  jakarta-turbine-fulcrum/crypto/src/java/org/apache/fulcrum/crypto/provider/OldJavaCrypt.java
  
  Index: OldJavaCrypt.java
  ===================================================================
  package org.apache.fulcrum.crypto.provider;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and 
   *    "Apache Turbine" must not be used to endorse or promote products 
   *    derived from this software without prior written permission. For 
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without 
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import javax.mail.internet.MimeUtility;
  import java.security.MessageDigest;
  import java.io.OutputStream;
  import java.io.ByteArrayOutputStream;
  
  import org.apache.fulcrum.crypto.CryptoAlgorithm;
  
  /**
   * This is the Message Digest Implementation of Turbine 2.1. It does
   * not pad the Base64 encryption of the Message Digests correctly but
   * truncates after 20 chars. This leads to interoperability problems
   * if you want to use e.g. database columns between two languages.
   *
   * If you upgrade an application from Turbine 2.1 and have already used
   * the Security Service with encrypted passwords and no way to rebuild
   * your databases, use this provider. It is bug-compatible.
   *
   * DO NOT USE THIS PROVIDER FOR ANY NEW APPLICATION!
   * 
   * Nevertheless it can be used as the default crypto algorithm .
   *
   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
   * @version $Id: OldJavaCrypt.java,v 1.1 2003/09/08 15:29:48 epugh Exp $
   */
  
  public class OldJavaCrypt 
      implements CryptoAlgorithm
  {
  
      /** The default cipher */
      public static final String DEFAULT_CIPHER = "SHA";
  
      /** The cipher to use for encryption */
      private String cipher = null;
  
  
      /**
       * C'tor
       *
       */
  
      public OldJavaCrypt()
      {
          this.cipher = DEFAULT_CIPHER;
      }
  
      /**
       * Setting the actual cipher requested. If not
       * called, then the default cipher (SHA) is used.
       *
       * This will never throw an error even if there is no
       * provider for this cipher. The error will be thrown
       * by encrypt() (Fixme?)
       *
       * @param cipher     The cipher to use.
       *
       */
  
      public void setCipher(String cipher)
      {
          this.cipher = cipher;
      }
  
      /**
       * This class never uses a seed, so this is
       * just a dummy.
       *
       * @param seed        Seed (ignored)
       *
       */
  
      public void setSeed(String seed)
      {
          /* dummy */
      }
  
      /**
       * encrypt the supplied string with the requested cipher
       *
       * @param value       The value to be encrypted
       *
       * @return The encrypted value
       *
       * @throws Exception An Exception of the underlying implementation.
       */
  
      public String encrypt(String value)
          throws Exception
      {
          MessageDigest md = MessageDigest.getInstance(cipher);
  
          // We need to use unicode here, to be independent of platform's
          // default encoding. Thanks to SGawin for spotting this.
  
          byte[] digest = md.digest(value.getBytes("UTF-8"));
          ByteArrayOutputStream bas = 
              new ByteArrayOutputStream(digest.length + digest.length / 3 + 1);
          OutputStream encodedStream = MimeUtility.encode(bas, "base64");
          encodedStream.write(digest);
          return bas.toString();
      }
  }
  
  
  
  1.1                  jakarta-turbine-fulcrum/crypto/src/java/org/apache/fulcrum/crypto/provider/JavaCrypt.java
  
  Index: JavaCrypt.java
  ===================================================================
  package org.apache.fulcrum.crypto.provider;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and 
   *    "Apache Turbine" must not be used to endorse or promote products 
   *    derived from this software without prior written permission. For 
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without 
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.security.MessageDigest;
  
  import org.apache.commons.codec.base64.Base64;
  
  import org.apache.fulcrum.crypto.CryptoAlgorithm;
  
  /**
   * Implements the normal java.security.MessageDigest stream cipers.
   * Base64 strings returned by this provider are correctly padded to 
   * multiples of four bytes. If you run into interoperability problems
   * with other languages, especially perl and the Digest::MD5 module, 
   * note that the md5_base64 function from this package incorrectly drops
   * the pad bytes. Use the MIME::Base64 package instead.
   *
   * If you upgrade from Turbine 2.1 and suddently your old stored passwords
   * no longer work, please take a look at the OldJavaCrypt provider for 
   * bug-to-bug compatibility.
   *
   * This provider can be used as the default crypto algorithm provider.
   *
   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
   * @version $Id: JavaCrypt.java,v 1.1 2003/09/08 15:29:48 epugh Exp $
   */
  
  public class JavaCrypt 
      implements CryptoAlgorithm
  {
  
      /** The default cipher */
      public static final String DEFAULT_CIPHER = "SHA";
  
      /** The cipher to use for encryption */
      private String cipher = null;
  
  
      /**
       * C'tor
       *
       */
  
      public JavaCrypt()
      {
          this.cipher = DEFAULT_CIPHER;
      }
  
      /**
       * Setting the actual cipher requested. If not
       * called, then the default cipher (SHA) is used.
       *
       * This will never throw an error even if there is no
       * provider for this cipher. The error will be thrown
       * by encrypt() (Fixme?)
       *
       * @param cipher     The cipher to use.
       *
       */
  
      public void setCipher(String cipher)
      {
          this.cipher = cipher;
      }
  
      /**
       * This class never uses a seed, so this is
       * just a dummy.
       *
       * @param seed        Seed (ignored)
       *
       */
  
      public void setSeed(String seed)
      {
          /* dummy */
      }
  
      /**
       * encrypt the supplied string with the requested cipher
       *
       * @param value       The value to be encrypted
       *
       * @return The encrypted value
       *
       * @throws Exception An Exception of the underlying implementation.
       */
  
      public String encrypt(String value)
          throws Exception
      {
          MessageDigest md = MessageDigest.getInstance(cipher);
  
          // We need to use unicode here, to be independent of platform's
          // default encoding. Thanks to SGawin for spotting this.
          byte[] digest = md.digest(value.getBytes("UTF-8"));
  
          // Base64-encode the digest.
          byte[] encodedDigest = Base64.encode(digest);
          return (encodedDigest == null ? null :
                  new String(encodedDigest));
      }
  }
  
  
  
  1.1                  jakarta-turbine-fulcrum/crypto/src/java/org/apache/fulcrum/crypto/provider/ClearCrypt.java
  
  Index: ClearCrypt.java
  ===================================================================
  package org.apache.fulcrum.crypto.provider;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and 
   *    "Apache Turbine" must not be used to endorse or promote products 
   *    derived from this software without prior written permission. For 
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without 
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import org.apache.fulcrum.crypto.CryptoAlgorithm;
  
  /**
   * This is a dummy for "cleartext" encryption. It goes through
   * the notions of the CryptoAlgorithm interface but actually does
   * nothing. It can be used as a replacement for the "encrypt = no" 
   * setting in TurbineResources.
   *
   * Can be used as the default crypto algorithm 
   *
   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
   * @version $Id: ClearCrypt.java,v 1.1 2003/09/08 15:29:48 epugh Exp $
   */
  
  public class ClearCrypt 
      implements CryptoAlgorithm
  {
      /**
       * C'tor
       *
       */
  
      public ClearCrypt()
      {
      }
  
      /**
       * This class never uses an algorithm, so this is
       * just a dummy.
       *
       * @param cipher    Cipher (ignored)
       */
  
      public void setCipher(String cipher)
      {
          /* dummy */
      }
  
      /**
       * This class never uses a seed, so this is
       * just a dummy.
       *
       * @param seed        Seed (ignored)
       */
  
      public void setSeed(String seed)
      {
          /* dummy */
      }
  
      /**
       * encrypt the supplied string with the requested cipher
       *
       * @param value       The value to be encrypted
       *
       * @return The encrypted value
       *
       * @throws Exception An Exception of the underlying implementation.
       *
       */
  
      public String encrypt(String value)
          throws Exception
      {
          /*
           * Ultra-clever implementation. ;-) 
           */
  
          return value;
      }
  }
  
  
  
  1.1                  jakarta-turbine-fulcrum/crypto/src/java/org/apache/fulcrum/crypto/provider/UnixCrypt.java
  
  Index: UnixCrypt.java
  ===================================================================
  package org.apache.fulcrum.crypto.provider;
  
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and 
   *    "Apache Turbine" must not be used to endorse or promote products 
   *    derived from this software without prior written permission. For 
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Turbine", nor may "Apache" appear in their name, without 
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import org.apache.fulcrum.crypto.CryptoAlgorithm;
  
  /**
   * Implements Standard Unix crypt(3) for use with the Crypto Service.
   *
   * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
   * @version $Id: UnixCrypt.java,v 1.1 2003/09/08 15:29:48 epugh Exp $
   */
  
  public class UnixCrypt
      implements CryptoAlgorithm
  {
  
      /** The seed to use */
      private String seed = null;
  
      /** standard Unix crypt chars (64) */
      private static final char[] SALT_CHARS =
          (("abcdefghijklmnopqrstuvwxyz" +
           "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./").toCharArray());
  
  
      /**
       * C'tor
       *
       */
  
      public UnixCrypt()
      {
      }
  
      /**
       * This class never uses anything but
       * UnixCrypt, so it is just a dummy
       * (Fixme: Should we throw an exception if 
       * something is requested that we don't support?
       *
       * @param cipher    Cipher (ignored)
       */
  
      public void setCipher(String cipher)
      {
          /* dummy */
      }
  
      /**
       * Setting the seed for the UnixCrypt
       * algorithm. If a null value is supplied,
       * or no seed is set, then a random seed is used.
       *
       * @param seed     The seed value to use.
       */
  
      public void setSeed(String seed)
      {
          this.seed = seed;
      }
  
      /**
       * encrypt the supplied string with the requested cipher
       *
       * @param value       The value to be encrypted
       *
       * @return The encrypted value
       *
       * @throws Exception An Exception of the underlying implementation.
       */
  
      public String encrypt(String value)
          throws Exception
      {
          if (seed == null)
          {
              java.util.Random randomGenerator = new java.util.Random();
              int numSaltChars = SALT_CHARS.length;
  
              seed = (new StringBuffer())
                  .append(SALT_CHARS[Math.abs(randomGenerator.nextInt()) 
                                     % numSaltChars])
                  .append(SALT_CHARS[Math.abs(randomGenerator.nextInt()) 
                                     % numSaltChars])
                  .toString();
          }
  
          /* UnixCrypt seems to be a really widespread name... */
          return new cryptix.tools.UnixCrypt(seed).crypt(value);
      }
  }
  
  
  
  1.1                  jakarta-turbine-fulcrum/crypto/src/java/org/apache/fulcrum/crypto/provider/package.html
  
  Index: package.html
  ===================================================================
  <html>
  <head>
  <!-- head part is ignored -->
  </head>
  
  <body>
  Algorithm providers for the Crypto Service.
  <br>
  <font size="-2">$Id: package.html,v 1.1 2003/09/08 15:29:48 epugh Exp $</font>
  </body>
  </html>
  
  
  
  1.2       +93 -4     jakarta-turbine-fulcrum/crypto/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/crypto/xdocs/index.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- index.xml	16 Aug 2003 02:41:46 -0000	1.1
  +++ index.xml	8 Sep 2003 15:29:48 -0000	1.2
  @@ -11,8 +11,13 @@
   
     <section name="Overview">
       <p>
  -      This component wraps provides encrypting passwords.  It is written 
  -      for use in Turbine but it can be used in any container compatible 
  +      The Crypto Service allows an application to request various encryption
  +      algorithms provided by the normal Java crypto providers and 3rd party
  +      providers such as <a href="http://www.cryptix.org/">Cryptix</a>.
  +    </p>
  +  
  +    <p>
  +      It is written for use in Turbine but it can be used in any container compatible 
         with Avalon's ECM container.
       </p>    
     </section>
  @@ -41,7 +46,7 @@
   <![CDATA[
       <crypto>
         <algorithm>
  -      	<unix>org.apache.fulcrum.crypto.provider.UnixCrypt</unix>
  +        <unix>org.apache.fulcrum.crypto.provider.UnixCrypt</unix>
           <clear>org.apache.fulcrum.crypto.provider.ClearCrypt</clear>
           <java>org.apache.fulcrum.crypto.provider.JavaCrypt</java>   
           <oldjava>org.apache.fulcrum.crypto.provider.OldJavaCrypt</oldjava>   
  @@ -52,11 +57,95 @@
   </source>
   
     </section>
  +  
  +<section name="Usage">
  +
  +<p>
  +If you want to encrypt a clear text with a MessageDigest Cipher, you can
  +do it like this:
  +</p>
  +
  +<source><![CDATA[
  +import org.apache.fulcrum.crypto.CryptoAlgorithm;
  +import org.apache.fulcrum.crypto.CryptoService;
  +
  +public class CryptoExample
  +{
  +    public String doMD5Encryption(String input)
  +    {
  +        CryptoService cs  = (CryptoService) avalonComponentService.lookup(CryptoService.ROLE);
  +        CryptoAlgorithm ca = CryptoService.getCryptoAlgorithm("default");
  +
  +        ca.setCipher("MD5");
  +
  +        return ca.encrypt(input);
  +    }
  +}
  +]]></source>
  +
  +<p>
  +To see an example, look at the test case 
  +<a href="xref-test/org/apache/fulcrum/crypto/CryptoServiceTest.html">CryptoServiceTest</a>.
  +</p>
  +
  +</section>
  +
  +  <section name="Default Provider">
   
  -  <section name="Usage">
       <p>
  +    In the source code and the example above, there is talk about a
  +    "default" provider which is used if no encryption algorithm is
  +    specifically requested. The reason for this comes from the first user
  +    of the crypto service, the <a href="security-service.html">Security
  +    Service</a>. It gives you the ability to select an encryption
  +    algorithm like MD5 or SHA1 which is in turn used with the normal java
  +    crypto providers. As we just wanted to "add" new algorithms and still
  +    be able to use the old java.security names like MD5 and SHA1, we
  +    decided to add a "catchall" algorithm to the crypto service.
       </p>
  +    <p>
  +    If you don't set the default provider explicitly, the
  +    org.apache.fulcrum.crypto.provider.JavaCrypt class is used. If you
  +    don't set the Cipher of this class explicitly, then SHA is used.
  +    </p>
  +
     </section>  
  +
  +  <section name="Included Providers">
  +    <p>The following algorithm providers are included in the Cryptoservice:</p>
  +
  +    <p>
  +    <ol>
  +    <li>
  +    <b>ClearCrypt</b> (org.apache.fulcrum.crypto.provider.ClearCrypt). This is
  +    the simplest algorithm which does nothing. It is still useful because
  +    you can use the Crypto Service all the time even if you don't want to
  +    actually encrypt something. Just request the "cleartext" algorithm.
  +    </li>
  +    <li>
  +    <b>UnixCrypt</b> (org.apache.fulcrum.crypto.provider.UnixCrypt). This is an
  +    implementation of the Unix crypt(3) algorithm. Its main use is when
  +    you need to access legacy information or databases which already
  +    contain crypted passwords. UnixCrypt needs the cryptix32.jar from <a
  +    href="http://www.cryptix.org/">Cryptix</a>.
  +    </li>
  +    <li>
  +    <b>JavaCrypt</b> (org.apache.fulcrum.crypto.provider.JavaCrypt).  This is the 
  +     default crypto provider. It implements the normal Java MessageDigest ciphers
  +     You need not to have this, it is the default if no algorithms are given. The default
  +     provider gives you all the Java MessageDigest Ciphers including MD5, and SHA1.
  +    </li>
  +    <li>
  +    <b>OldJavaCrypt</b> (org.apache.fulcrum.crypto.provider.OldJavaCrypt). Accessing
  +    the MessageDigest functions from java.security was buggy in Turbine 2.1, because
  +    the Security Service didn't pad the base64 values correctly but simply cut them
  +    off after 20 bytes. If you're stuck with an old database full of passwords and can't
  +    upgrade, please use this provider to keep going. DO NOT USE THIS PROVIDER FOR NEW
  +    APPLICATIONS!.
  +    </li>
  +    </ol>
  +    </p>
  +  </section>
   
   </body>
   </document>
  
  
  
  1.1                  jakarta-turbine-fulcrum/crypto/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  <?xml version="1.0"?>
  <document>
    <properties>
      <title>Fulcrum Crypto</title>
      <author email="epugh@upstate.com">Eric Pugh</author>
    </properties>
  
    <body>
      <release version="Not applicable" date="">
        <action dev="epugh" type="add">
          Integrated howto documentation on main page.
        </action>
      </release>
  
    </body>
  </document>