summary refs log tree commit diff
path: root/crypto/src/crmf/ProofOfPossessionSigningKeyBuilder.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/crmf/ProofOfPossessionSigningKeyBuilder.cs')
-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;
         }
     }