Class NoPadding

  • All Implemented Interfaces:
    IPadding

    public class NoPadding
    extends java.lang.Object
    implements IPadding
    • Constructor Summary

      Constructors 
      Constructor Description
      NoPadding​(int blockSize)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getName()  
      int getPaddingLength​(int inputLength)  
      void pad​(java.io.ByteArrayOutputStream in)
      Adds the given number of padding bytes to the data input.
      byte[] unpad​(byte[] in)
      Returns the index where the padding starts.
      • Methods inherited from class java.lang.Object

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

      • NoPadding

        public NoPadding​(int blockSize)
    • Method Detail

      • pad

        public void pad​(java.io.ByteArrayOutputStream in)
        Adds the given number of padding bytes to the data input. The value of the padding bytes is determined by the specific padding mechanism that implements this interface.
        Specified by:
        pad in interface IPadding
        Parameters:
        in - the input buffer with the data to pad
        off - the offset in in where the padding bytes are appended
        len - the number of padding bytes to add
        Throws:
        javax.crypto.ShortBufferException - if in is too small to hold the padding bytes
      • unpad

        public byte[] unpad​(byte[] in)
        Returns the index where the padding starts.

        Given a buffer with padded data, this method returns the index where the padding starts.

        Specified by:
        unpad in interface IPadding
        Parameters:
        in - the buffer with the padded data
        off - the offset in in where the padded data starts
        len - the length of the padded data
        Returns:
        the index where the padding starts, or -1 if the input is not properly padded
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface IPadding
      • getPaddingLength

        public int getPaddingLength​(int inputLength)
        Specified by:
        getPaddingLength in interface IPadding