summary refs log tree commit diff
path: root/crypto/src/cmp/ProtectedPkiMessage.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-02-04 02:17:04 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-02-04 02:17:04 +0700
commit7610f647360313aa86d89884c45ce6d334876b73 (patch)
treeb01a0b682c5064cae4b5e1f075089410edfbfdbe /crypto/src/cmp/ProtectedPkiMessage.cs
parentUpdate IPAddress from bc-java (diff)
downloadBouncyCastle.NET-ed25519-7610f647360313aa86d89884c45ce6d334876b73.tar.xz
Misc. refactoring after bc-fips-csharp updates
Diffstat (limited to 'crypto/src/cmp/ProtectedPkiMessage.cs')
-rw-r--r--crypto/src/cmp/ProtectedPkiMessage.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/src/cmp/ProtectedPkiMessage.cs b/crypto/src/cmp/ProtectedPkiMessage.cs
index 8bc9e4f4d..fdcdeb90d 100644
--- a/crypto/src/cmp/ProtectedPkiMessage.cs
+++ b/crypto/src/cmp/ProtectedPkiMessage.cs
@@ -111,10 +111,11 @@ namespace Org.BouncyCastle.Cmp
                 throw new InvalidOperationException("protection algorithm is not mac based");
 
             PbmParameter parameter = PbmParameter.GetInstance(m_pkiMessage.Header.ProtectionAlg.Parameters);
-
             pkMacBuilder.SetParameters(parameter);
 
-            IBlockResult result = Process(pkMacBuilder.Build(password).CreateCalculator());
+            var macFactory = pkMacBuilder.Build(password);
+
+            IBlockResult result = Process(macFactory.CreateCalculator());
 
             return Arrays.FixedTimeEquals(result.Collect(), m_pkiMessage.Protection.GetBytes());
         }
@@ -126,10 +127,11 @@ namespace Org.BouncyCastle.Cmp
                 throw new InvalidOperationException("protection algorithm is not mac based");
 
             PbmParameter parameter = PbmParameter.GetInstance(m_pkiMessage.Header.ProtectionAlg.Parameters);
-
             pkMacBuilder.SetParameters(parameter);
 
-            IBlockResult result = Process(pkMacBuilder.Build(password).CreateCalculator());
+            var macFactory = pkMacBuilder.Build(password);
+
+            IBlockResult result = Process(macFactory.CreateCalculator());
 
             return Arrays.FixedTimeEquals(result.Collect(), m_pkiMessage.Protection.GetBytes());
         }