Blowfish has a 64 bit block size, that is 8 bytes. AES has a block size of 128 bits, that is 16 bytes.
Block size implies it can only do that size blocks. So something with a block size of 8 bytes cannot do 7,6,5,4,3,2,1 bytes.
If you have less than th required number of bits or bytes (8 and 16 bytes here), you have to pad those with something to arrive at a 8/16 byte long block. (Padding in English means you have to append unused bits/bytes - sometimes of content prescribed by the protocol/algorithm, sometimes content doesn't matter) until you have something that is of the required size.)
Both errors complain about bad padding. So my hunch is that you are not passing the right size (length) of data to the encryption/decryption algorithms. Check your documentation to see whether they accept as input data:
- exactly one block (8 or 16 bytes here)
- an exact multiple of the block size (= in this case you will have to do the padding)
- an arbitrary size of data (= you don't have to do padding - but then why did you get the error to begin with?)
Any chance you have accidentally done your UU/Base64/Hex encoding before the encryption step?
You should:
- do the encryption first,
- then the UU/Base64/Hex Encoding,
- then sending the data out.
Obviously, reverse the sequence upon receipt of the data:
- first UU/Base64/Hex decode,
- then decrypt,
- then use the data.