summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs9
-rw-r--r--src/DotNetOpenAuth/Messaging/MessagingStrings.resx5
-rw-r--r--src/DotNetOpenAuth/Messaging/MessagingUtilities.cs7
3 files changed, 17 insertions, 4 deletions
diff --git a/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs b/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs
index f600330..235e558 100644
--- a/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs
+++ b/src/DotNetOpenAuth/Messaging/MessagingStrings.Designer.cs
@@ -619,6 +619,15 @@ namespace DotNetOpenAuth.Messaging {
}
/// <summary>
+ /// Looks up a localized string similar to This blob is not a recognized encryption format..
+ /// </summary>
+ internal static string UnsupportedEncryptionAlgorithm {
+ get {
+ return ResourceManager.GetString("UnsupportedEncryptionAlgorithm", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to The HTTP verb &apos;{0}&apos; is unrecognized and unsupported..
/// </summary>
internal static string UnsupportedHttpVerb {
diff --git a/src/DotNetOpenAuth/Messaging/MessagingStrings.resx b/src/DotNetOpenAuth/Messaging/MessagingStrings.resx
index 7f9d91b..fdeb756 100644
--- a/src/DotNetOpenAuth/Messaging/MessagingStrings.resx
+++ b/src/DotNetOpenAuth/Messaging/MessagingStrings.resx
@@ -315,4 +315,7 @@
<data name="MessageTimestampInFuture" xml:space="preserve">
<value>This message has a timestamp of {0}, which is beyond the allowable clock skew for in the future.</value>
</data>
-</root>
+ <data name="UnsupportedEncryptionAlgorithm" xml:space="preserve">
+ <value>This blob is not a recognized encryption format.</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs
index 96b1fcf..7d0b913 100644
--- a/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs
+++ b/src/DotNetOpenAuth/Messaging/MessagingUtilities.cs
@@ -513,7 +513,7 @@ namespace DotNetOpenAuth.Messaging {
var ms = new MemoryStream();
var binaryWriter = new BinaryWriter(ms);
- binaryWriter.Write(crypto.IV.Length);
+ binaryWriter.Write((byte)1); // version of encryption algorithm
binaryWriter.Write(crypto.IV);
binaryWriter.Flush();
@@ -535,8 +535,9 @@ namespace DotNetOpenAuth.Messaging {
var ms = new MemoryStream(buffer);
var binaryReader = new BinaryReader(ms);
- int ivLength = binaryReader.ReadInt32();
- crypto.IV = binaryReader.ReadBytes(ivLength);
+ int algorithmVersion = binaryReader.ReadByte();
+ ErrorUtilities.VerifyProtocol(algorithmVersion == 1, MessagingStrings.UnsupportedEncryptionAlgorithm);
+ crypto.IV = binaryReader.ReadBytes(crypto.IV.Length);
// Allocate space for the decrypted buffer. We don't know how long it will be yet,
// but it will never be larger than the encrypted buffer.