java.lang.Object
org.miaixz.bus.core.lang.wrapper.SimpleWrapper<org.bouncycastle.crypto.Mac>
org.miaixz.bus.crypto.builtin.digest.mac.BCMac
All Implemented Interfaces:
org.miaixz.bus.core.lang.Wrapper<org.bouncycastle.crypto.Mac>, Mac
Direct Known Subclasses:
BCHMac, CBCBlockCipherMac

public class BCMac extends org.miaixz.bus.core.lang.wrapper.SimpleWrapper<org.bouncycastle.crypto.Mac> implements Mac
BouncyCastle的MAC算法实现引擎,使用Mac 实现摘要 当引入BouncyCastle库时自动使用其作为Provider
Since:
Java 17+
Author:
Kimi Liu
  • Field Summary

    Fields inherited from class org.miaixz.bus.core.lang.wrapper.SimpleWrapper

    raw
  • Constructor Summary

    Constructors
    Constructor
    Description
    BCMac(org.bouncycastle.crypto.Mac mac, org.bouncycastle.crypto.CipherParameters params)
    构造
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    结束并生成摘要
    获取当前算法
    int
    获取MAC算法块大小
    void
    重置
    void
    update(byte[] in, int inOff, int len)
    加入需要被摘要的内容

    Methods inherited from class org.miaixz.bus.core.lang.wrapper.SimpleWrapper

    getRaw

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.miaixz.bus.crypto.builtin.digest.mac.Mac

    digest, update
  • Constructor Details

    • BCMac

      public BCMac(org.bouncycastle.crypto.Mac mac, org.bouncycastle.crypto.CipherParameters params)
      构造
      Parameters:
      mac - Mac
      params - 参数,例如密钥可以用KeyParameter
  • Method Details

    • update

      public void update(byte[] in, int inOff, int len)
      Description copied from interface: Mac
      加入需要被摘要的内容
      Specified by:
      update in interface Mac
      Parameters:
      in - 内容
      inOff - 内容起始位置
      len - 内容长度
    • doFinal

      public byte[] doFinal()
      Description copied from interface: Mac
      结束并生成摘要
      Specified by:
      doFinal in interface Mac
      Returns:
      摘要内容
    • reset

      public void reset()
      Description copied from interface: Mac
      重置
      Specified by:
      reset in interface Mac
    • getMacLength

      public int getMacLength()
      Description copied from interface: Mac
      获取MAC算法块大小
      Specified by:
      getMacLength in interface Mac
      Returns:
      MAC算法块大小
    • getAlgorithm

      public String getAlgorithm()
      Description copied from interface: Mac
      获取当前算法
      Specified by:
      getAlgorithm in interface Mac
      Returns:
      算法