The most detailed explanation of the underlying library is in the Particle firmware documentation.
https://docs.particle.io/reference/firmware/photon/#can-canbus-
It documents all the members of the CANMessage structure and has examples for transmitting and receiving.
When transmitting, check the return value of can.transmit(message)
. If it is true it means the transmit buffer is full which means either you're transmitting too fast or the messages are not being sent properly. Check the wiring and CAN bus speed. can.errorStatus() != CAN_NO_ERROR
would also indicate that the messages are not being sent properly.
To sniff the IDs you can use the example and just print out the IDs of every message you receive.
For transmitting, there's no additional security than not knowing what each byte in each messages represents to the modules receiving those messages.