------------------------------------------------------------------------------
--                              Ada Web Server                              --
--                                                                          --
--                     Copyright (C) 2008-2009, AdaCore                     --
--                                                                          --
--  This library is free software; you can redistribute it and/or modify    --
--  it under the terms of the GNU General Public License as published by    --
--  the Free Software Foundation; either version 2 of the License, or (at   --
--  your option) any later version.                                         --
--                                                                          --
--  This library is distributed in the hope that it will be useful, but     --
--  WITHOUT ANY WARRANTY; without even the implied warranty of              --
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU       --
--  General Public License for more details.                                --
--                                                                          --
--  You should have received a copy of the GNU General Public License       --
--  along with this library; if not, write to the Free Software Foundation, --
--  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.          --
--                                                                          --
------------------------------------------------------------------------------

with Ada.Strings.Unbounded;

package AWS.Jabber.Digest_Md5 is

   use Ada.Strings.Unbounded;

   --  DIGEST-MD5 authentication mechanism for python SASL implementation.
   --
   --  Normative reference: RFC 2831 <http://www.ietf.org/rfc/rfc2831.txt>

   type Challenge is record
      Nonce : Unbounded_String;
      Realm : Unbounded_String;
   end record;

   function Decode_Challenge
     (Encoded_Challenge : String) return Challenge;
   --  Decode the Base64 encoded message and returns the challenge

   function Reply_Challenge
     (Username, Realm, Password, Host, Nonce : String) return String;

end AWS.Jabber.Digest_Md5;
