Prakash,
The language does not matter: protocols are strictly defined and language agnostic.
It is about the protocol chain, if we don't know the correct protocol chain, we can'thelp you.
The order is:
1. the key exchange protocol, likely dh, this is asymmetric encryption
2. the encryption protocol itself, in the case of ecb likely aes or des, symmetric
3. the bitness of that: likely 128 or 256, but can be higher
4. the padding method
The examples from paweld take care of 2,3 and 4 and assumes 2/3. to be aes128 and 4. to be pkcs7. (which we derived from your code snippet)
We need to know 1. and we need to know the exact 3. Otherwise there is no way to help you any further. As I already wrote Pawel's code is 100% standards compliant, but does not implement 1. and assumes aes128.
We really need to know the things we asked, so get that information.We also need to know if the block protocol is really ecb and not cbc. (the latter makes more sense)
You can't write proper code without knowing the exact! protocol chain.
exact, exact,exact,exact. Clear?
And the programming language really has nothing to do with your issue, it may as well be written in BrainFuck, we need the exact protocols.
If we have that, your problem would have been solved in a day instead of almost a week. Get that information, only then you will make progress.
Both Pawel and I spend quite some time to help you and we have put you in the right direction, but you give us incomplete information.
Now , please make sure you ask for the protocols in detail.
You already forced us to make assumptions and in the case of encrypted data that is never a good idea. You can not make assumptions. It is the detail.
If the third-party gave you interface code, plz give that as complete as possible (and not half pascalized). Both Pawel and I are proficient in many programming languages. Good enough to see what we need to do to make it work in Pascal.