Author: spouliot
Date: 2007-03-22 11:48:06 -0500 (Thu, 22 Mar 2007)
New Revision: 74817
Modified:
trunk/mcs/class/corlib/System.Security.Cryptography/ChangeLog
trunk/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
Log:
2007-03-22 Sebastien Pouliot <[EMAIL PROTECTED]>
* CryptoStream.cs: 2.0 introduce different exceptions/behaviors in
corner cases.
Modified: trunk/mcs/class/corlib/System.Security.Cryptography/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Security.Cryptography/ChangeLog
2007-03-22 16:45:31 UTC (rev 74816)
+++ trunk/mcs/class/corlib/System.Security.Cryptography/ChangeLog
2007-03-22 16:48:06 UTC (rev 74817)
@@ -1,6 +1,8 @@
-2007-03-22 Sebastien Pouliot <[EMAIL PROTECTED]>
+2007-03-22 Sebastien Pouliot <[EMAIL PROTECTED]>
* CryptoConfig.cs: Names are case-insensitive only since fx 2.0.
+ * CryptoStream.cs: 2.0 introduce different exceptions/behaviors in
+ corner cases.
2007-03-05 Sebastien Pouliot <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
===================================================================
--- trunk/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
2007-03-22 16:45:31 UTC (rev 74816)
+++ trunk/mcs/class/corlib/System.Security.Cryptography/CryptoStream.cs
2007-03-22 16:48:06 UTC (rev 74817)
@@ -145,10 +145,13 @@
Locale.GetText ("buffer overflow"));
}
// for some strange reason ObjectDisposedException
isn't throw
- // instead we get a ArgumentNullException (probably
from an internal method)
if (_workingBlock == null) {
- throw new ArgumentNullException (
- Locale.GetText ("object _disposed"));
+#if NET_2_0
+ return 0;
+#else
+ // instead we get a ArgumentNullException
(probably from an internal method)
+ throw new ArgumentNullException (Locale.GetText
("CryptoStream was disposed."));
+#endif
}
int result = 0;
@@ -312,15 +315,17 @@
public void FlushFinalBlock ()
{
- if (_flushedFinalBlock) {
- throw new NotSupportedException (
- Locale.GetText ("This method cannot be
called twice."));
- }
- if (_mode != CryptoStreamMode.Write) {
- throw new NotSupportedException (
- Locale.GetText ("cannot flush a
non-writeable CryptoStream"));
- }
-
+ if (_flushedFinalBlock)
+ throw new NotSupportedException (Locale.GetText
("This method cannot be called twice."));
+#if NET_2_0
+ if (_disposed)
+ throw new NotSupportedException (Locale.GetText
("CryptoStream was disposed."));
+ if (_mode != CryptoStreamMode.Write)
+ return;
+#else
+ if (_mode != CryptoStreamMode.Write)
+ throw new NotSupportedException (Locale.GetText
("cannot flush a non-writeable CryptoStream"));
+#endif
_flushedFinalBlock = true;
byte[] finalBuffer = _transform.TransformFinalBlock
(_workingBlock, 0, _partialCount);
if (_stream != null) {
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches