Documentation ¶
Index ¶
- func DecryptAndRead(buffer *bytes.Buffer, encType openiot.EncryptionType, key []byte, ...) error
- func DecryptAndReadCBC(buffer *bytes.Buffer, key, iv []byte, msgs ...proto.Message) error
- func DecryptAndReadECB(buffer *bytes.Buffer, key []byte, msgs ...proto.Message) error
- func MakeReadyToSendDeviceMessage(dev *device.Device, msg proto.Message) ([]byte, error)
- func MakeReadyToSendMessage(hdr *openiot.Header, enc openiot.EncryptionType, key []byte, ...) ([]byte, error)
- func ReadPlain(buffer *bytes.Buffer, msgs ...proto.Message) error
- func ReadSingleMessage(buffer *bytes.Buffer, msg proto.Message) error
- func WriteAndEncrypt(buffer *bytes.Buffer, encType openiot.EncryptionType, key []byte, ...) error
- func WriteAndEncryptCBC(buffer *bytes.Buffer, key, iv []byte, msgs ...proto.Message) error
- func WriteAndEncryptECB(buffer *bytes.Buffer, key []byte, msgs ...proto.Message) error
- func WritePlain(buffer *bytes.Buffer, msgs ...proto.Message) error
- func WriteSingleMessage(buffer *bytes.Buffer, msg proto.Message) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptAndRead ¶
func DecryptAndRead( buffer *bytes.Buffer, encType openiot.EncryptionType, key []byte, msgs ...proto.Message) error
DecryptAndRead decrypts buffer using encoding from encType, then de-serializes all messages using "delimited" approach.
func DecryptAndReadCBC ¶
DecryptAndReadCBC decrypts buffer using AES-CBC with provided key and IV, then de-serializes all messages using "delimited" approach.
func DecryptAndReadECB ¶
DecryptAndReadECB decrypts buffer using AES-ECB with provided key, then de-serializes all messages using "delimited" approach.
func MakeReadyToSendDeviceMessage ¶
MakeReadyToSendDeviceMessage makes ready to be send bytes using device's settings and proto message It does: - Serializes protobuf message - Calculates CRC - Makes MessageInfo header - Encrypts all (if enabled on device) - Makes Header - Writes all messages into buffer and returns bytes
func MakeReadyToSendMessage ¶
func MakeReadyToSendMessage( hdr *openiot.Header, enc openiot.EncryptionType, key []byte, msgs ...proto.Message) ([]byte, error)
MakeReadyToSendMessage makes message ready to be send, it does: - Serialize all msgs - Calculate CRC - Optionally encrypt messages - Write all messages into buffer
func ReadPlain ¶
ReadPlain de-serializes all messages using "delimited" approach. It does not perform any decryption
func ReadSingleMessage ¶
ReadSingleMessage reads and de-serializes protobuf from buffer previously encoded using "delimited" approach, i.e. message length followed by message payload
func WriteAndEncrypt ¶
func WriteAndEncrypt( buffer *bytes.Buffer, encType openiot.EncryptionType, key []byte, msgs ...proto.Message) error
WriteAndEncrypt serializes all messages using "delimited" approach, then encodes result with encoding from encType.
func WriteAndEncryptCBC ¶
WriteAndEncryptCBC serializes all messages using "delimited" approach, then encodes result with AES-CBC using provided key and iv.
func WriteAndEncryptECB ¶
WriteAndEncryptECB serializes all messages using "delimited" approach, then encodes result with AES ECB using provided key.
func WritePlain ¶
WritePlain serializes all messages using "delimited" it does not performs any type of encryption, just writes messages into buffer
Types ¶
This section is empty.