diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2011-10-10 21:13:50 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2011-10-10 21:13:50 -0700 |
commit | e28d275f1e328d1cc2939cfadb576db7ed7b56a3 (patch) | |
tree | 35eea80dd2325bb9ba64d60629b56a943b54bac1 /src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanRequest.cs | |
parent | 6cf86e7495159343bc41b2004fe1b9100c5c1423 (diff) | |
download | DotNetOpenAuth-e28d275f1e328d1cc2939cfadb576db7ed7b56a3.zip DotNetOpenAuth-e28d275f1e328d1cc2939cfadb576db7ed7b56a3.tar.gz DotNetOpenAuth-e28d275f1e328d1cc2939cfadb576db7ed7b56a3.tar.bz2 |
Fixed up Provider so that DH assoc requests don't result in exceptions.
Diffstat (limited to 'src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanRequest.cs')
-rw-r--r-- | src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanRequest.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanRequest.cs b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanRequest.cs index 5accf26..b4f809f 100644 --- a/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanRequest.cs +++ b/src/DotNetOpenAuth.OpenId/OpenId/Messages/AssociateDiffieHellmanRequest.cs @@ -12,7 +12,9 @@ namespace DotNetOpenAuth.OpenId.Messages { using System.Text; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.Messaging.Reflection; +#if !ExcludeDiffieHellman using Org.Mentalis.Security.Cryptography; +#endif /// <summary> /// An OpenID direct request from Relying Party to Provider to initiate an association that uses Diffie-Hellman encryption. @@ -76,6 +78,7 @@ namespace DotNetOpenAuth.OpenId.Messages { [MessagePart("openid.dh_consumer_public", IsRequired = true, AllowEmpty = false)] internal byte[] DiffieHellmanConsumerPublic { get; set; } +#if !ExcludeDiffieHellman /// <summary> /// Gets the Diffie-Hellman algorithm. /// </summary> @@ -83,11 +86,13 @@ namespace DotNetOpenAuth.OpenId.Messages { /// This property is initialized with a call to <see cref="InitializeRequest"/>. /// </remarks> internal DiffieHellman Algorithm { get; private set; } +#endif /// <summary> /// Called by the Relying Party to initialize the Diffie-Hellman algorithm and consumer public key properties. /// </summary> internal void InitializeRequest() { +#if !ExcludeDiffieHellman if (this.DiffieHellmanModulus == null || this.DiffieHellmanGen == null) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, OpenIdStrings.DiffieHellmanRequiredPropertiesNotSet, string.Join(", ", new string[] { "DiffieHellmanModulus", "DiffieHellmanGen" }))); } @@ -95,6 +100,9 @@ namespace DotNetOpenAuth.OpenId.Messages { this.Algorithm = new DiffieHellmanManaged(this.DiffieHellmanModulus ?? DefaultMod, this.DiffieHellmanGen ?? DefaultGen, DefaultX); byte[] consumerPublicKeyExchange = this.Algorithm.CreateKeyExchange(); this.DiffieHellmanConsumerPublic = DiffieHellmanUtilities.EnsurePositive(consumerPublicKeyExchange); +#else + throw new NotSupportedException(); +#endif } } } |