summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs')
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs b/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs
index bf0111d..2eaa8cf 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/HmacShaAssociation.cs
@@ -15,11 +15,11 @@ namespace DotNetOpenAuth.OpenId {
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OpenId;
using DotNetOpenAuth.OpenId.Messages;
+ using Validation;
/// <summary>
/// An association that uses the HMAC-SHA family of algorithms for message signing.
/// </summary>
- [ContractVerification(true)]
internal class HmacShaAssociation : Association {
/// <summary>
/// A list of HMAC-SHA algorithms in order of decreasing bit lengths.
@@ -43,8 +43,7 @@ namespace DotNetOpenAuth.OpenId {
Requires.NotNull(typeIdentity, "typeIdentity");
Requires.NotNullOrEmpty(handle, "handle");
Requires.NotNull(secret, "secret");
- Requires.InRange(totalLifeLength > TimeSpan.Zero, "totalLifeLength");
- Contract.Ensures(this.TotalLifeLength == totalLifeLength);
+ Requires.Range(totalLifeLength > TimeSpan.Zero, "totalLifeLength");
ErrorUtilities.VerifyProtocol(secret.Length == typeIdentity.SecretLength, OpenIdStrings.AssociationSecretAndTypeLengthMismatch, secret.Length, typeIdentity.GetAssociationType(Protocol.Default));
this.typeIdentity = typeIdentity;
@@ -73,7 +72,6 @@ namespace DotNetOpenAuth.OpenId {
Requires.NotNull(protocol, "protocol");
Requires.NotNullOrEmpty(associationType, "associationType");
Requires.NotNull(secret, "secret");
- Contract.Ensures(Contract.Result<HmacShaAssociation>() != null);
HmacSha match = hmacShaAssociationTypes.FirstOrDefault(sha => string.Equals(sha.GetAssociationType(protocol), associationType, StringComparison.Ordinal));
ErrorUtilities.VerifyProtocol(match != null, OpenIdStrings.NoAssociationTypeFoundByName, associationType);
return new HmacShaAssociation(match, handle, secret, totalLifeLength);
@@ -89,7 +87,6 @@ namespace DotNetOpenAuth.OpenId {
public static HmacShaAssociation Create(string handle, byte[] secret, TimeSpan totalLifeLength) {
Requires.NotNullOrEmpty(handle, "handle");
Requires.NotNull(secret, "secret");
- Contract.Ensures(Contract.Result<HmacShaAssociation>() != null);
HmacSha shaType = hmacShaAssociationTypes.FirstOrDefault(sha => sha.SecretLength == secret.Length);
ErrorUtilities.VerifyProtocol(shaType != null, OpenIdStrings.NoAssociationTypeFoundByLength, secret.Length);
@@ -211,7 +208,7 @@ namespace DotNetOpenAuth.OpenId {
[Pure]
protected override HashAlgorithm CreateHasher() {
var result = this.typeIdentity.CreateHasher(SecretKey);
- Contract.Assume(result != null);
+ Assumes.True(result != null);
return result;
}