summary refs log tree commit diff
path: root/crypto/src/cms/CMSEnvelopedHelper.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-04-13 16:48:27 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-04-13 16:48:27 +0700
commita0b75007cc33d1ead75b2aed6439a7b272469bed (patch)
tree4a831e9dfc6fc39b99246610e878bd7917b67c62 /crypto/src/cms/CMSEnvelopedHelper.cs
parentGuard against null nonce and clone returned nonce (diff)
downloadBouncyCastle.NET-ed25519-a0b75007cc33d1ead75b2aed6439a7b272469bed.tar.xz
Refactoring around AeadParameters and ParametersWIthIV
Diffstat (limited to 'crypto/src/cms/CMSEnvelopedHelper.cs')
-rw-r--r--crypto/src/cms/CMSEnvelopedHelper.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/src/cms/CMSEnvelopedHelper.cs b/crypto/src/cms/CMSEnvelopedHelper.cs
index 40c5e6868..c623ec677 100644
--- a/crypto/src/cms/CMSEnvelopedHelper.cs
+++ b/crypto/src/cms/CMSEnvelopedHelper.cs
@@ -1,4 +1,7 @@
 using System;
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+using System.Buffers;
+#endif
 using System.Collections.Generic;
 using System.IO;
 
@@ -240,7 +243,12 @@ namespace Org.BouncyCastle.Cms
 							|| alg.Equals(CmsEnvelopedGenerator.IdeaCbc)
 							|| alg.Equals(CmsEnvelopedGenerator.Cast5Cbc))
 						{
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+							cipherParameters = ParametersWithIV.Create<byte>(cipherParameters, 8, 0,
+								(bytes, state) => bytes.Fill(state));
+#else
 							cipherParameters = new ParametersWithIV(cipherParameters, new byte[8]);
+#endif
 						}
 					}