summary refs log tree commit diff
path: root/crypto/src/crmf
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/crmf
parentUpdate IPAddress from bc-java (diff)
downloadBouncyCastle.NET-ed25519-7610f647360313aa86d89884c45ce6d334876b73.tar.xz
Misc. refactoring after bc-fips-csharp updates
Diffstat (limited to 'crypto/src/crmf')
-rw-r--r--crypto/src/crmf/ProofOfPossessionSigningKeyBuilder.cs10
1 files changed, 3 insertions, 7 deletions
diff --git a/crypto/src/crmf/ProofOfPossessionSigningKeyBuilder.cs b/crypto/src/crmf/ProofOfPossessionSigningKeyBuilder.cs
index 4530b18b8..8d2ea0bac 100644
--- a/crypto/src/crmf/ProofOfPossessionSigningKeyBuilder.cs
+++ b/crypto/src/crmf/ProofOfPossessionSigningKeyBuilder.cs
@@ -30,7 +30,6 @@ namespace Org.BouncyCastle.Crmf
         public ProofOfPossessionSigningKeyBuilder SetSender(GeneralName name)
         {
             this._name = name;
-
             return this;
         }
 
@@ -84,18 +83,15 @@ namespace Org.BouncyCastle.Crmf
 
         private ProofOfPossessionSigningKeyBuilder ImplSetPublicKeyMac(IMacFactory fact)
         {
-            byte[] d = _pubKeyInfo.GetDerEncoded();
-
             IStreamCalculator<IBlockResult> calc = fact.CreateCalculator();
             using (var stream = calc.Stream)
             {
-                stream.Write(d, 0, d.Length);
+                _pubKeyInfo.EncodeTo(stream, Asn1Encodable.Der);
             }
 
-            this._publicKeyMAC = new PKMacValue(
-                (AlgorithmIdentifier)fact.AlgorithmDetails,
-                new DerBitString(calc.GetResult().Collect()));
+            var mac = calc.GetResult().Collect();
 
+            this._publicKeyMAC = new PKMacValue((AlgorithmIdentifier)fact.AlgorithmDetails, new DerBitString(mac));
             return this;
         }
     }