I'm encrypting employee class below using AES and saving it as sealedObject as part of serviceA.
org.company.serviceA.model.employee;
class employee{
Integer ssn;
String name;
}
org.company.serviceB.model.employee;
class employee{
Integer ssn;
String name;
}
And In serviceB, when I try to decrypt the sealedObject back to employee class.
employee emp = (employee) sealedObject.getObject;
It throws ClassNotFoundException saying org.company.serviceA.model.employee not found.
Clearly it is trying to find the employee class of ServiceA by fully qualified name, even when I have created a similar class in serviceB.
When both encrypt and decrypt are done in the same service, it works fine. But when they are done in different service, decrypt throws ClassNotFoundException.
So is there a way to overcome ClassNotFoundException and decrypt the sealed object in serviceB ?