title: DES ciphertext length decreased during transmission and is not a multiple of 8 bytes
body: <p>For a project a try to encrypt a pwd with DES algorithm. </p>
  
  <p>When I try this </p>
  
  <pre><code>    private static String key = "my8bcode"; /*Key 8 bytes or 56 bit supported by algo OF*/
      private static byte[] byteKey = key.getBytes(); 
  
      public static void main(String[] args) throws Exception {
            String ss = "yuyuvdzdsfdsfsdsdsdsdsa";
            byte[] plainText = ss.getBytes();//Conversion en byte
  
          try {
              SecretKeySpec secretKeySpec = new SecretKeySpec(byteKey, "DES");
  
              Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); // Request the use of the DES algorithm, using the ECB mode (Electronic CodeBook) and style padding PKCS-5.
              cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
              byte[] myCipherText = cipher.doFinal(plainText);
              System.out.println(new String(myCipherText, "UTF8"));
              System.out.println(myCipherText.length);
  
               System.out.println("\nStart decryption");
               cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
               byte[] newPlainText = cipher.doFinal(myCipherText);
               System.out.println(new String(newPlainText, "UTF8"));
          } catch (Exception e) {
              e.printStackTrace();
          }
  </code></pre>
  
  <p>I have no problems, but to go further, i try to do this  in two separate steps with this code :</p>
  
  <pre><code>    try {
          SecretKeySpec secretKeySpec = new SecretKeySpec(byteKey, "DES");
  
          Cipher cipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); //Request the use of the DES algorithm, using the ECB mode (Electronic CodeBook) and style padding PKCS-5.
          cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec);
          byte[] myCipherText = cipher.doFinal(plainText);
          byte[] test = (new String(myCipherText, "UTF8")).getBytes();
  
           System.out.println("\nStart decryption");
           cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
           byte[] newPlainText = cipher.doFinal(test);
           System.out.println(new String(newPlainText, "UTF8"));
      } catch (Exception e) {
          e.printStackTrace();
      }
  </code></pre>
  
  <p>It doesn't work, i have this message in my console :</p>
  
  <blockquote>
    <p>javax.crypto.IllegalBlockSizeException: Input length must be multiple of 8 </p>
  </blockquote>
  
  <p>Indeed, the length of test[] is 7 and not 8. How is possible ?</p>
  
  <p>Why did I lose a byte during my transcription?</p>
  
  <p>Help me please to understand and to solve my problem ;)</p>