summary refs log tree commit diff
path: root/crypto/src/x509/X509Utilities.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/x509/X509Utilities.cs')
-rw-r--r--crypto/src/x509/X509Utilities.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/src/x509/X509Utilities.cs b/crypto/src/x509/X509Utilities.cs
index 3ab6b926c..45fa75916 100644
--- a/crypto/src/x509/X509Utilities.cs
+++ b/crypto/src/x509/X509Utilities.cs
@@ -10,6 +10,7 @@ using Org.BouncyCastle.Asn1.TeleTrust;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Crypto;
+using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
 
 namespace Org.BouncyCastle.X509
@@ -204,6 +205,13 @@ namespace Org.BouncyCastle.X509
             return GenerateBitString(signatureFactory.CreateCalculator(), asn1Encodable);
         }
 
+        internal static bool VerifyMac(IMacFactory macFactory, Asn1Encodable asn1Encodable, DerBitString protection)
+        {
+            var result = CalculateResult(macFactory.CreateCalculator(), asn1Encodable);
+
+            return Arrays.FixedTimeEquals(result.Collect(), protection.GetBytes());
+        }
+
         internal static bool VerifySignature(IVerifierFactory verifierFactory, Asn1Encodable asn1Encodable,
 			DerBitString signature)
         {