Capture encryption error (using TROAESEncryptionEnvelope)

delphi

(Marcos Cunha Lima) #1

Hi

I’m using TROAESEncryptionEnvelope adding it (filled with a password) to RoBinMessage envelopes collection in the client and server. It works very well.
The problem is when I setup a client password that is not the same at server. When it tries do connect, it throws an error “Invalid Binary Header” and shows the header as garbage.
Is there a way or event at client at which I can intercept this error and shows a more user-friendly message?


(EvgenyK) #2

Hi,

TROAESEncryptionEnvelope doesn’t know how it decodes message: correctly or not. so there is no possibility to detect this case.

What I can suggest: create descendant from TROAESEncryptionEnvelope and write some kind of checksum in intProcessOutgoing method.
in intProcessIncoming you can validate this checksum and raise user-friendly message.