Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Java : Education - Tutorials
Java security, Part 1: Crypto basics
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
4. Keeping a message confidential
  


What is padding? page 3 of 7


As we mentioned in the previous panel, if a block cipher is used and the message length is not a multiple of the block length, the last block must be padded with bytes to yield a full block size. There are many ways to pad a block, such as using all zeroes or ones. In this tutorial, we'll be using PKCS5 padding for private key encryption and PKCS1 for public key encryption.

With PKCS5, a short block is padded with a repeating byte whose value represents the number of remaining bytes. We won't be discussing padding algorithms further in this tutorial, but for your information, JDK 1.4 supports the following padding techniques:

  • No padding
  • PKCS5
  • OAEP
  • SSL3

The BouncyCastle library (see Security is enriched with third-party libraries and Resources) supports additional padding techniques.


Main menuSection menuFeedbackPreviousNext
About IBM | Privacy | Legal | Contact