summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-02-09 08:29:36 -0800
committerAndrew Arnott <andrewarnott@gmail.com>2012-02-09 08:29:36 -0800
commitcd00f47e375106db6b04a32dff669e5b87c5affb (patch)
treeca2d8625561f2084250c3cebf6eae3813f71c8b2 /src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
parentb6a394fdde0b5ba09d3836ea80dd201f79e90a3a (diff)
downloadDotNetOpenAuth-cd00f47e375106db6b04a32dff669e5b87c5affb.zip
DotNetOpenAuth-cd00f47e375106db6b04a32dff669e5b87c5affb.tar.gz
DotNetOpenAuth-cd00f47e375106db6b04a32dff669e5b87c5affb.tar.bz2
Fixed FxCop messages in DNOA.Core #68
Diffstat (limited to 'src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs')
-rw-r--r--src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs b/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
index 0437c89..43df1f5 100644
--- a/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
+++ b/src/DotNetOpenAuth.Core/Messaging/DataBagFormatterBase.cs
@@ -7,6 +7,7 @@
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
@@ -143,6 +144,7 @@ namespace DotNetOpenAuth.Messaging {
/// </summary>
/// <param name="message">The message to serialize. Must not be null.</param>
/// <returns>A non-null, non-empty value.</returns>
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "No apparent problem. False positive?")]
public string Serialize(T message) {
message.UtcCreationDate = DateTime.UtcNow;
@@ -191,6 +193,7 @@ namespace DotNetOpenAuth.Messaging {
/// <param name="containingMessage">The message that contains the <see cref="DataBag"/> serialized value. Must not be nulll.</param>
/// <param name="value">The serialized form of the <see cref="DataBag"/> to deserialize. Must not be null or empty.</param>
/// <returns>The deserialized value. Never null.</returns>
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "No apparent problem. False positive?")]
public T Deserialize(IProtocolMessage containingMessage, string value) {
string symmetricSecretHandle = null;
if (this.encrypted && this.cryptoKeyStore != null) {
@@ -271,6 +274,7 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>
/// <c>true</c> if the signature is valid; otherwise, <c>false</c>.
/// </returns>
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "No apparent problem. False positive?")]
private bool IsSignatureValid(byte[] signedData, byte[] signature, string symmetricSecretHandle) {
Requires.NotNull(signedData, "signedData");
Requires.NotNull(signature, "signature");
@@ -292,6 +296,7 @@ namespace DotNetOpenAuth.Messaging {
/// <returns>
/// The calculated signature.
/// </returns>
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "No apparent problem. False positive?")]
private byte[] CalculateSignature(byte[] bytesToSign, string symmetricSecretHandle) {
Requires.NotNull(bytesToSign, "bytesToSign");
Requires.ValidState(this.asymmetricSigning != null || this.cryptoKeyStore != null);
@@ -303,7 +308,7 @@ namespace DotNetOpenAuth.Messaging {
}
} else {
var key = this.cryptoKeyStore.GetKey(this.cryptoKeyBucket, symmetricSecretHandle);
- ErrorUtilities.VerifyProtocol(key != null, "Missing decryption key.");
+ ErrorUtilities.VerifyProtocol(key != null, MessagingStrings.MissingDecryptionKeyForHandle, this.cryptoKeyBucket, symmetricSecretHandle);
using (var symmetricHasher = new HMACSHA256(key.Key)) {
return symmetricHasher.ComputeHash(bytesToSign);
}
@@ -346,7 +351,7 @@ namespace DotNetOpenAuth.Messaging {
return this.asymmetricEncrypting.DecryptWithRandomSymmetricKey(value);
} else {
var key = this.cryptoKeyStore.GetKey(this.cryptoKeyBucket, symmetricSecretHandle);
- ErrorUtilities.VerifyProtocol(key != null, "Missing decryption key.");
+ ErrorUtilities.VerifyProtocol(key != null, MessagingStrings.MissingDecryptionKeyForHandle, this.cryptoKeyBucket, symmetricSecretHandle);
return MessagingUtilities.Decrypt(value, key.Key);
}
}