summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenId/Association.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-08-13 04:25:00 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2008-08-13 04:25:00 -0700
commitfd6acdc9b14b51fc0bf4c1b4fa815cc1f0d7ce26 (patch)
treea345806393382207e9d75a14f820457906f5878e /src/DotNetOpenId/Association.cs
parentba48275ccaae1218b1e8574029f7e009eb3f8735 (diff)
downloadDotNetOpenAuth-fd6acdc9b14b51fc0bf4c1b4fa815cc1f0d7ce26.zip
DotNetOpenAuth-fd6acdc9b14b51fc0bf4c1b4fa815cc1f0d7ce26.tar.gz
DotNetOpenAuth-fd6acdc9b14b51fc0bf4c1b4fa815cc1f0d7ce26.tar.bz2
Made HMAC-SHA association types a table instead of several classes.
Diffstat (limited to 'src/DotNetOpenId/Association.cs')
-rw-r--r--src/DotNetOpenId/Association.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/DotNetOpenId/Association.cs b/src/DotNetOpenId/Association.cs
index 5c9c302..ee3fd70 100644
--- a/src/DotNetOpenId/Association.cs
+++ b/src/DotNetOpenId/Association.cs
@@ -56,11 +56,11 @@ namespace DotNetOpenId {
TimeSpan remainingLifeLength = expires - DateTime.UtcNow;
byte[] secret = privateData; // the whole of privateData is the secret key for now.
// We figure out what derived type to instantiate based on the length of the secret.
- if(secret.Length == CryptUtil.Sha1.HashSize / 8)
- return new HmacSha1Association(handle, secret, remainingLifeLength);
- if (secret.Length == CryptUtil.Sha256.HashSize / 8)
- return new HmacSha256Association(handle, secret, remainingLifeLength);
- throw new ArgumentException(Strings.BadAssociationPrivateData, "privateData");
+ try {
+ return HmacShaAssociation.Create(secret.Length, handle, secret, remainingLifeLength);
+ } catch (ArgumentException ex) {
+ throw new ArgumentException(Strings.BadAssociationPrivateData, "privateData", ex);
+ }
}
static TimeSpan minimumUsefulAssociationLifetime {