diff options
author | Robert Gemmell <robbie@apache.org> | 2009-11-30 14:35:43 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2009-11-30 14:35:43 +0000 |
commit | d4cebdd93030e253d40c8c08162704016cec8a3c (patch) | |
tree | 72995979c12afb76d4b84a0dfd288b9fadfeb8ba /qpid/dotnet/Qpid.Sasl/Callbacks.cs | |
parent | 29ef52781edfe1d9a0abf81c1e80176ed631cb11 (diff) | |
download | qpid-python-d4cebdd93030e253d40c8c08162704016cec8a3c.tar.gz |
QPID-2222: Added new CramMD5HexSaslClient.cs and registered it in the Sasl Factory and the client CallbackHandler
Merge code changes from M2.x branch r663999,r664020
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@885435 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/Qpid.Sasl/Callbacks.cs')
-rw-r--r-- | qpid/dotnet/Qpid.Sasl/Callbacks.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/qpid/dotnet/Qpid.Sasl/Callbacks.cs b/qpid/dotnet/Qpid.Sasl/Callbacks.cs index 90e36beeb8..a5913eb61e 100644 --- a/qpid/dotnet/Qpid.Sasl/Callbacks.cs +++ b/qpid/dotnet/Qpid.Sasl/Callbacks.cs @@ -21,6 +21,8 @@ using System;
using System.Text;
+using System.Globalization;
+using System.Security.Cryptography;
namespace Apache.Qpid.Sasl
{
@@ -87,6 +89,37 @@ namespace Apache.Qpid.Sasl : base("password:", "", "")
{
}
+
+ public byte[] HashedText
+ {
+ get
+ {
+ string _text = this.Text;
+ System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
+ byte[] bs = x.ComputeHash(Encoding.UTF8.GetBytes(_text));
+ return bs;
+ }
+
+ }
+ } // class PasswordCallback
+
+ public class HashedPasswordCallback : TextSaslCallback
+ {
+ public HashedPasswordCallback()
+ : base("password:", "", "")
+ {
+ }
+
+ public byte[] HashedText
+ {
+ get {
+ string _text = this.Text;
+ System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
+ _text = _text.PadRight(16, '\0');
+ byte[] bs = x.ComputeHash(Encoding.UTF8.GetBytes(_text));
+ return bs;
+ }
+ }
} // class PasswordCallback
public class RealmCallback : TextSaslCallback
|