Class PGPPadding

java.lang.Object
org.bouncycastle.openpgp.PGPPadding

public class PGPPadding extends Object
The PGPPadding contains random data, and can be used to defend against traffic analysis on version 2 SEIPD messages and Transferable Public Keys.

Such a padding packet MUST be ignored when received.

  • Field Details

    • MIN_PADDING_LEN

      public static final int MIN_PADDING_LEN
      Minimum random padding length in octets. Chosen totally arbitrarily.
      See Also:
    • MAX_PADDING_LEN

      public static final int MAX_PADDING_LEN
      Maximum random padding length. Chosen somewhat arbitrarily, as SSH also uses max 255 bytes for random padding.
      See Also:
  • Constructor Details

    • PGPPadding

      public PGPPadding(BCPGInputStream in) throws IOException
      Default constructor.
      Parameters:
      in - packet input stream
      Throws:
      IOException
    • PGPPadding

      public PGPPadding()
      Generate a new, random PGPPadding object. The padding consists of n random bytes, where n is a number between (inclusive) MIN_PADDING_LEN and MAX_PADDING_LEN.
    • PGPPadding

      public PGPPadding(SecureRandom random)
      Generate a new, random PGPPadding object. The padding consists of n random bytes, where n is a number between (inclusive) MIN_PADDING_LEN and MAX_PADDING_LEN.
      Parameters:
      random - random number generator instance
    • PGPPadding

      public PGPPadding(int len)
      Generate a new, random PGPPadding object. The padding consists of
      len
      random bytes.
    • PGPPadding

      public PGPPadding(int len, SecureRandom random)
      Generate a new, random PGPPadding object. The padding consists of
      len
      random bytes.
      Parameters:
      len - number of random octets
      random - random number generator instance
  • Method Details