Class PBM

  • All Implemented Interfaces:
    java.lang.Cloneable

    public final class PBM
    extends javax.crypto.MacSpi
    implements java.lang.Cloneable
    This is an implementation of the HMAC-SHA1 algorithm.
    • Constructor Summary

      Constructors 
      Constructor Description
      PBM()
      Empty constructor Verify the JCE framework in the constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected byte[] engineDoFinal()
      Completes the PBM computation and resets the PBM for further use, maintaining the secret key that the PBM was initialized with.
      protected int engineGetMacLength()
      Returns the length of the PBM in bytes.
      protected void engineInit​(java.security.Key key, java.security.spec.AlgorithmParameterSpec params)
      Initializes the PBM with the given secret key and algorithm parameters.
      protected void engineReset()
      Resets the PBM for further use, maintaining the secret key that the PBM was initialized with.
      protected void engineUpdate​(byte input)
      Processes the given byte.
      protected void engineUpdate​(byte[] input, int offset, int len)
      Processes the first len bytes in input, starting at offset.
      • Methods inherited from class javax.crypto.MacSpi

        clone, engineUpdate
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PBM

        public PBM()
            throws java.security.NoSuchAlgorithmException
        Empty constructor Verify the JCE framework in the constructor.
        Throws:
        java.security.NoSuchAlgorithmException - if the required cipher mode (CBC) is unavailable
        java.lang.SecurityException - if this constructor fails to authenticate the JCE framework.
    • Method Detail

      • engineGetMacLength

        protected int engineGetMacLength()
        Returns the length of the PBM in bytes.
        Specified by:
        engineGetMacLength in class javax.crypto.MacSpi
        Returns:
        the PBM length in bytes.
      • engineInit

        protected void engineInit​(java.security.Key key,
                                  java.security.spec.AlgorithmParameterSpec params)
                           throws java.security.InvalidKeyException,
                                  java.security.InvalidAlgorithmParameterException
        Initializes the PBM with the given secret key and algorithm parameters.
        Specified by:
        engineInit in class javax.crypto.MacSpi
        Parameters:
        key - the secret key.
        params - the algorithm parameters.
        Throws:
        java.security.InvalidKeyException - if the given key is inappropriate for initializing this MAC.
        java.security.InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this MAC.
      • engineUpdate

        protected void engineUpdate​(byte input)
        Processes the given byte.
        Specified by:
        engineUpdate in class javax.crypto.MacSpi
        Parameters:
        input - the input byte to be processed.
      • engineUpdate

        protected void engineUpdate​(byte[] input,
                                    int offset,
                                    int len)
        Processes the first len bytes in input, starting at offset.
        Specified by:
        engineUpdate in class javax.crypto.MacSpi
        Parameters:
        input - the input buffer.
        offset - the offset in input where the input starts.
        len - the number of bytes to process.
      • engineDoFinal

        protected byte[] engineDoFinal()
        Completes the PBM computation and resets the PBM for further use, maintaining the secret key that the PBM was initialized with.
        Specified by:
        engineDoFinal in class javax.crypto.MacSpi
        Returns:
        the PBM result.
      • engineReset

        protected void engineReset()
        Resets the PBM for further use, maintaining the secret key that the PBM was initialized with.
        Specified by:
        engineReset in class javax.crypto.MacSpi