You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
@ -29,7 +29,6 @@
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if NET_2_0
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
@ -1050,20 +1049,16 @@ namespace System.Web.Security {
|
||||
string alg_type = section.HashAlgorithmType;
|
||||
if (alg_type.Length == 0) {
|
||||
alg_type = MachineKeySection.Config.Validation.ToString ();
|
||||
#if NET_4_0
|
||||
// support new (4.0) custom algorithms
|
||||
if (alg_type.StartsWith ("alg:"))
|
||||
alg_type = alg_type.Substring (4);
|
||||
#endif
|
||||
}
|
||||
using (HashAlgorithm hash = HashAlgorithm.Create (alg_type)) {
|
||||
#if NET_4_0
|
||||
// for compatibility (with 2.0) we'll allow MD5 and SHA1 not to map to HMACMD5 and HMACSHA1
|
||||
// but that won't work with new (4.0) algorithms, like HMACSHA256|384|512 or custom, won't work without using the key
|
||||
KeyedHashAlgorithm kha = (hash as KeyedHashAlgorithm);
|
||||
if (kha != null)
|
||||
kha.Key = MachineKeySection.Config.GetValidationKey ();
|
||||
#endif
|
||||
hash.TransformFinalBlock (hashBytes, 0, hashBytes.Length);
|
||||
return Convert.ToBase64String (hash.Hash);
|
||||
}
|
||||
@ -1237,5 +1232,4 @@ namespace System.Web.Security {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user