diff options
Diffstat (limited to '')
-rw-r--r-- | crypto/src/security/MacUtilities.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crypto/src/security/MacUtilities.cs b/crypto/src/security/MacUtilities.cs index d1f8c89b4..d7fe91142 100644 --- a/crypto/src/security/MacUtilities.cs +++ b/crypto/src/security/MacUtilities.cs @@ -230,6 +230,14 @@ namespace Org.BouncyCastle.Security return (string) algorithms[oid.Id]; } + public static byte[] CalculateMac(string algorithm, ICipherParameters cp, byte[] input) + { + IMac mac = GetMac(algorithm); + mac.Init(cp); + mac.BlockUpdate(input, 0, input.Length); + return DoFinal(mac); + } + public static byte[] DoFinal(IMac mac) { byte[] b = new byte[mac.GetMacSize()]; |