Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: trunk/source/proto/xmpp/uim-protocols-xmpp-client.adb
- ===================================================================
- --- trunk/source/proto/xmpp/uim-protocols-xmpp-client.adb (revision 388)
- +++ trunk/source/proto/xmpp/uim-protocols-xmpp-client.adb (working copy)
- @@ -61,6 +61,8 @@
- with Network.Utils;
- +with GNUTLS.SASL;
- +
- package body UIM.Protocols.XMPP.Client is
- use Ada.Strings.Unbounded;
- @@ -74,10 +76,11 @@
- use Sax.Readers;
- use Unicode.CES;
- use Unicode.CES.Utf8;
- - use Ada.Strings.Unbounded;
- use Ada.Exceptions;
- + use GNUTLS.SASL;
- +
- use type Ada.Streams.Stream_Element_Offset;
- XML_String : Ada.Strings.Unbounded.Unbounded_String;
- @@ -89,21 +92,6 @@
- Host : String := "localhost";
- Password : String := "123";
- - function Hex_To_Oct (Sum : String) return String is
- - Result : String (Sum'First .. Sum'Last / 2);
- - J : Integer := Sum'First;
- -
- - begin
- - for Idx in Result'Range loop
- - Result (Idx)
- - := Character'Val (Integer'Value (("16#" & Sum (J .. J + 1) & "#")));
- -
- - J := J + 2;
- - end loop;
- -
- - return Result;
- - end Hex_To_Oct;
- -
- --------------
- -- Create --
- --------------
- @@ -471,68 +459,6 @@
- end Parse_Challenge;
- -
- - function Generate_SASL_String (JID_Par : String;
- - Pass_Par : String;
- - Host_Par : String;
- - Nonce_Par : String) -- Generates SASL string
- - return String
- - is
- - CNonce : String := "1a2f0ee81279451956625d2368";
- -
- - SY : String := Hex_To_Oct (GNAT.MD5.Digest (JID_Par &
- - ":" &
- - Host_Par &
- - ":" &
- - Pass_Par));
- -
- - HA1 : String := GNAT.MD5.Digest (SY & ":"
- - & Nonce_Par
- - & ":" & CNonce);
- - HA2 : String := GNAT.MD5.Digest ("AUTHENTICATE:xmpp/" & Host_Par);
- - Z : String := GNAT.MD5.Digest (HA1 & ":"
- - & Nonce_Par
- - & ":00000001:"
- - & CNonce & ":auth:"
- - & HA2);
- -
- - Realm_Reply : String
- - := "username="""
- - & JID_Par
- - & """,realm=""" & Host_Par
- - & """,nonce=""" & Nonce_Par
- - & """,cnonce=""" & CNonce
- - & """,nc=00000001"
- - & ",qop=auth,digest-uri=""xmpp/"
- - & Host_Par
- - & """,response=" & Z
- - & ",charset=utf-8";
- -
- - X : Integer := 4 * (Realm_Reply'Length + 2) / 3;
- - Y : Integer := X + 2 * (X / 76);
- -
- - Realm_Reply_Base_64 : String (Realm_Reply'First .. Y);
- - Len : Natural;
- -
- - begin
- - Ada.Text_IO.Put_Line ("SY = " & SY);
- - Ada.Text_IO.Put_Line ("HA1 = " & HA1);
- - Ada.Text_IO.Put_Line ("HA2 = " & HA2);
- - Ada.Text_IO.Put_Line ("Z = " & Z);
- - Ada.Text_IO.Put_Line ("Realm_Reply = " & Realm_Reply);
- - Utils.Base64.Encode
- - (Network.Utils.To_Stream_Element_Array (Realm_Reply),
- - Realm_Reply_Base_64,
- - Len);
- - Ada.Text_IO.Put_Line ("Realm_Reply_Base_64 = " & Realm_Reply_Base_64);
- -
- - return
- - "<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>"
- - & Realm_Reply_Base_64 (Realm_Reply_Base_64'First .. Len)
- - & "</response>";
- -
- - end Generate_SASL_String;
- -
- -----------------------------
- -- Parse_Stream_Features --
- -----------------------------
- Index: trunk/source/agnutls/agnutls.gpr
- ===================================================================
- --- trunk/source/agnutls/agnutls.gpr (revision 387)
- +++ trunk/source/agnutls/agnutls.gpr (working copy)
- @@ -33,6 +33,8 @@
- -- $Revision$ $Author$
- -- $Date$
- ------------------------------------------------------------------------------
- +with "../core/network/network";
- +with "../utils/utils";
- project Agnutls is
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement