These are the possible fields where i think the error has been introduced.

1. Improper DH exchange: Secret can be generated as a SecretKey Object or array of bytes
(i used the prior. Infact i do not know which one should i actually use. generating as a bunch of bytes means that i'll be getting a binary representation of a big decimal, then i need to cast it to a Secret Key object. Isn't it same as simply generating it as a SecretKey object? On the other hand, does Cipher objects get initialized by SecretKey and Key objects only? other subclasses of Keys are refused?)

2. Incorrect casting of keys from Strings to associated Key objects.