summary refs log tree commit diff
path: root/crypto/src/cms
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-05-23 22:44:57 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-05-23 22:44:57 +0700
commit98b3ce6512812cd1d91c60ca0e69d69c32838d8e (patch)
tree8af69c097b389fe494e97401f7808590314a5b6b /crypto/src/cms
parentAdd ValidateBufferArguments (diff)
downloadBouncyCastle.NET-ed25519-98b3ce6512812cd1d91c60ca0e69d69c32838d8e.tar.xz
Work on Stream classes
- consistent naming, ordering
- CanRead/Seek/Write fixes
- argument validation
- some cases of blocking zero-byte Read calls
Diffstat (limited to 'crypto/src/cms')
-rw-r--r--crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs18
-rw-r--r--crypto/src/cms/CMSCompressedDataStreamGenerator.cs14
-rw-r--r--crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs14
-rw-r--r--crypto/src/cms/CMSSignedDataStreamGenerator.cs20
4 files changed, 25 insertions, 41 deletions
diff --git a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs
index b77758d1f..4ac2b34c9 100644
--- a/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs
+++ b/crypto/src/cms/CMSAuthenticatedDataStreamGenerator.cs
@@ -238,18 +238,14 @@ namespace Org.BouncyCastle.Cms
 				this.eiGen = eiGen;
 			}
 
-			public override void WriteByte(
-				byte b)
-			{
-				macStream.WriteByte(b);
-			}
+            public override void Write(byte[] buffer, int offset, int count)
+            {
+                macStream.Write(buffer, offset, count);
+            }
 
-			public override void Write(
-				byte[]	bytes,
-				int		off,
-				int		len)
+			public override void WriteByte(byte value)
 			{
-				macStream.Write(bytes, off, len);
+				macStream.WriteByte(value);
 			}
 
 #if PORTABLE
@@ -274,7 +270,7 @@ namespace Org.BouncyCastle.Cms
                 base.Dispose(disposing);
             }
 #else
-            public override void Close()
+			public override void Close()
 			{
                 Platform.Dispose(macStream);
 
diff --git a/crypto/src/cms/CMSCompressedDataStreamGenerator.cs b/crypto/src/cms/CMSCompressedDataStreamGenerator.cs
index 0cb1bb641..1a9513ce6 100644
--- a/crypto/src/cms/CMSCompressedDataStreamGenerator.cs
+++ b/crypto/src/cms/CMSCompressedDataStreamGenerator.cs
@@ -111,18 +111,14 @@ namespace Org.BouncyCastle.Cms
 				_eiGen = eiGen;
 			}
 
-			public override void WriteByte(
-				byte b)
+			public override void Write(byte[] buffer, int offset, int count)
 			{
-				_out.WriteByte(b);
+				_out.Write(buffer, offset, count);
 			}
 
-			public override void Write(
-				byte[]	bytes,
-				int		off,
-				int		len)
+			public override void WriteByte(byte value)
 			{
-				_out.Write(bytes, off, len);
+				_out.WriteByte(value);
 			}
 
 #if PORTABLE
@@ -141,7 +137,7 @@ namespace Org.BouncyCastle.Cms
                 base.Dispose(disposing);
             }
 #else
-            public override void Close()
+			public override void Close()
 			{
                 Platform.Dispose(_out);
 
diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs
index e0822aa8b..c08b30787 100644
--- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs
+++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs
@@ -241,18 +241,14 @@ namespace Org.BouncyCastle.Cms
 				_eiGen = eiGen;
 			}
 
-			public override void WriteByte(
-				byte b)
+			public override void Write(byte[] buffer, int offset, int count)
 			{
-				_out.WriteByte(b);
+				_out.Write(buffer, offset, count);
 			}
 
-			public override void Write(
-				byte[]	bytes,
-				int		off,
-				int		len)
+			public override void WriteByte(byte value)
 			{
-				_out.Write(bytes, off, len);
+				_out.WriteByte(value);
 			}
 
 #if PORTABLE
@@ -281,7 +277,7 @@ namespace Org.BouncyCastle.Cms
                 base.Dispose(disposing);
             }
 #else
-            public override void Close()
+			public override void Close()
 			{
                 Platform.Dispose(_out);
 
diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs
index e32f95d42..a6835f279 100644
--- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs
+++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs
@@ -795,19 +795,15 @@ namespace Org.BouncyCastle.Cms
                 _eiGen = eiGen;
             }
 
-			public override void WriteByte(
-                byte b)
-            {
-                _out.WriteByte(b);
-            }
+			public override void Write(byte[] buffer, int offset, int count)
+			{
+				_out.Write(buffer, offset, count);
+			}
 
-			public override void Write(
-                byte[]	bytes,
-                int		off,
-                int		len)
-            {
-                _out.Write(bytes, off, len);
-            }
+			public override void WriteByte(byte value)
+			{
+				_out.WriteByte(value);
+			}
 
 #if PORTABLE
             protected override void Dispose(bool disposing)