summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-03-11 16:48:34 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-03-11 16:48:34 -0700
commit34da8f975a0515d72fda97979d0602d3c004173f (patch)
treee9738b1b79bca6d347127ab456ce0c3a295a74d2 /src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
parent92ee03ce2e9528212ea363a0574240e6fc17bb47 (diff)
downloadDotNetOpenAuth-34da8f975a0515d72fda97979d0602d3c004173f.zip
DotNetOpenAuth-34da8f975a0515d72fda97979d0602d3c004173f.tar.gz
DotNetOpenAuth-34da8f975a0515d72fda97979d0602d3c004173f.tar.bz2
Changed the compile-time switch for DH support into a runtime check for the supporting assembling.
Fixes #87
Diffstat (limited to 'src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs')
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs b/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
index e40ecd2..f8a32b5 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/OpenIdUtilities.cs
@@ -10,6 +10,7 @@ namespace DotNetOpenAuth.OpenId {
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Globalization;
+ using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -19,6 +20,7 @@ namespace DotNetOpenAuth.OpenId {
using DotNetOpenAuth.OpenId.ChannelElements;
using DotNetOpenAuth.OpenId.Extensions;
using DotNetOpenAuth.OpenId.Messages;
+ using Org.Mentalis.Security.Cryptography;
/// <summary>
/// A set of utilities especially useful to OpenID.
@@ -29,6 +31,31 @@ namespace DotNetOpenAuth.OpenId {
/// </summary>
internal const string CustomParameterPrefix = "dnoa.";
+ private static bool? diffieHellmanPresent;
+
+ internal static bool IsDiffieHellmanPresent {
+ get {
+ if (!diffieHellmanPresent.HasValue) {
+ try {
+ LoadDiffieHellmanTypes();
+ diffieHellmanPresent = true;
+ } catch (FileNotFoundException) {
+ diffieHellmanPresent = false;
+ } catch (TypeLoadException) {
+ diffieHellmanPresent = false;
+ }
+
+ if (diffieHellmanPresent.Value) {
+ Logger.OpenId.Info("Diffie-Hellman supporting assemblies found and loaded.");
+ } else {
+ Logger.OpenId.Warn("Diffie-Hellman supporting assemblies failed to load. Only associations with HTTPS OpenID Providers will be supported.");
+ }
+ }
+
+ return diffieHellmanPresent.Value;
+ }
+ }
+
/// <summary>
/// Creates a random association handle.
/// </summary>
@@ -169,5 +196,9 @@ namespace DotNetOpenAuth.OpenId {
ErrorUtilities.VerifyOperation(aggregator != null, OpenIdStrings.UnsupportedChannelConfiguration);
return aggregator.Factories;
}
+
+ private static void LoadDiffieHellmanTypes() {
+ var dhAssemblyType = typeof(DiffieHellmanManaged);
+ }
}
}