# Removing Padded Value in Decrypted Message

How to remove padded value in Decrypted Message?

I am using AES Algorithm.

Let's take this as the decrypted message:

"abcdefghijklmn  "


There is a 2 space in that decrypted message which is equivalent to 0x00. how can I removed that value? during decryption to show the exact message before it was encrypted.

I am using ECB Mode, I know that ECB mode is not secured, but I only want to know how to remove padded value in my decrypted message.

-

PKCS#7 padding can always be removed because the last byte of the padded message tells you how much padding there is. If your original message is 02 02 02 ... 02 02, and the padded message is 02 02 02 ... 02 02 02 02, then you know that the last two bytes, and only the last two bytes, are padding. The other bytes are the actual message. –  rossum Jun 5 '12 at 21:04