IdSASL_CRAMBase.pas 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. Rev 1.9 2004.02.07 5:03:08 PM czhower
  18. .net fixes.
  19. Rev 1.8 2004.02.03 5:45:42 PM czhower
  20. Name changes
  21. Rev 1.7 30/1/2004 4:48:52 PM SGrobety
  22. Fix problem in win32 version. Now works in both world
  23. Rev 1.6 1/30/2004 11:57:42 AM BGooijen
  24. Compiles in D7
  25. Rev 1.5 29/1/2004 6:08:58 PM SGrobety
  26. Now with extra crunchy DotNet compatibility!
  27. Rev 1.4 1/21/2004 3:31:18 PM JPMugaas
  28. InitComponent
  29. Rev 1.3 10/19/2003 5:57:14 PM DSiders
  30. Added localization comments.
  31. Rev 1.2 5/15/2003 10:24:04 PM BGooijen
  32. Added IdGlobal to uses for pbyte on D5
  33. Rev 1.1 11/5/2003 10:58:54 AM SGrobety
  34. Indy implementation of the CRAM-MD5 authentication protocol
  35. Rev 1.0 10/5/2003 10:00:00 AM SGrobety
  36. Indy implementation of the CRAM-MD5 authentication protocol
  37. S.G. 9/5/2003: First implementation of the CRAM-MD5 authentication algorythm
  38. }
  39. unit IdSASL_CRAMBase;
  40. {
  41. Refs: RFC 1321 (MD5)
  42. RFC 2195 (IMAP/POP3 AUTHorize Extension for Simple Challenge/Response)
  43. IETF draft draft-ietf-ipsec-hmac-md5-txt.00
  44. }
  45. interface
  46. {$i IdCompilerDefines.inc}
  47. uses
  48. IdSASL,
  49. IdSASLUserPass;
  50. type
  51. TIdSASLCRAMBase = class(TIdSASLUserPass)
  52. public
  53. class function BuildKeydAuth(const APassword, AChallenge: string): string; virtual;
  54. function StartAuthenticate(const AChallenge, AHost, AProtocolName:string) : String; override;
  55. function ContinueAuthenticate(const ALastResponse, AHost, AProtocolName: String): string; override;
  56. end;
  57. implementation
  58. uses
  59. IdGlobal,
  60. SysUtils;
  61. class function TIdSASLCRAMBase.BuildKeydAuth(const APassword,
  62. AChallenge: string): string;
  63. begin
  64. //we can't make this abstract in C++Builder
  65. Result := '';
  66. end;
  67. function TIdSASLCRAMBase.ContinueAuthenticate(const ALastResponse, AHost, AProtocolName: String): String;
  68. //this is not called
  69. begin
  70. Result:='';
  71. end;
  72. function TIdSASLCRAMBase.StartAuthenticate(const AChallenge, AHost, AProtocolName: string): String;
  73. begin
  74. if Length(AChallenge) > 0 then
  75. begin
  76. result := GetUsername + ' ' + BuildKeydAuth(GetPassword, AChallenge);
  77. end
  78. else
  79. result := '';
  80. end;
  81. end.