-
Notifications
You must be signed in to change notification settings - Fork 6
settings
ASAP peer behaviour can be defined by some setting.
An ASAP session is initiated when ASAP peers encounter each other. ASAP protocol data units are transmitted during that session from one peer to another. We call it a point-to-point connection. PDUs are not encrypted or signed per default. Maybe it is not even necessary. It depends on the used protocol. If you find you protocol safe enough, you can avoid any additional security settings.
Switching signing and encryption on is simple:
ASAPPeer alicePeer = ... // was created somewhere
alicePeer.getASAPCommunicationControl().setSendEncryptedMessages(true);
alicePeer.getASAPCommunicationControl().setSendSignedMessages(true);
There are four setting. You can choose to send signed and/or encrypted PDUs. You need access the ASAPCommunicationSetting
set encryption and or signing on or off. Both are switched on in our example.
Any PDU issued by alicePeer
would now be signed and encrypted. Signing works anytime if the security environment had been setup accordingly. The PDU would be signed with Alice’ private key. This signature is attached to the ASAP message.
Encryption can fail if alicePeer
has no public key of the recipient. That is the peer with which Alice has running ASAP session. Nothing would happens in that case. Alice would not send any data.
Peers can define that they only accept signed or encrypted PDUs.
alicePeer.getASAPEnginePermissionSettings().setReceivedMessagesMustBeEncrypted(true);
alicePeer.getASAPEnginePermissionSettings().setReceivedMessagesMustBeSigned(true);
Encryption works anytime if the security environment had been setup accordingly and sender used the valid public key of Alice.
alicePeer
would only process PDUs which encrypted and the signature can be verified. Verifying can fail for two reasons: alicePeer
has a public key of the encountered peer but cannot verify the signature. In that case, the sender cheats about its identity or alicePeer
has a wrong public key. Second reason is a missing public key on alicePeer
side. Either way, the PDU is not processed.
ASAP peers exchange messages during an encounter. Routing is an essential feature of ASAP. Peers also exchange received messages. Alice might get a message from Bob. Alice would send this message to Clara during an encounter. This feature can be set on or off. We highly recommend to set it on.
ASAPPeer peer = ...;
peer.setASAPRoutingAllowed(APP_NAME, false); // switch routing off for this app
peer.setASAPRoutingAllowed(APP_NAME, true); // switch routing on again - better