-
Notifications
You must be signed in to change notification settings - Fork 34
Serialisation format
Toralf Wittner edited this page Sep 1, 2015
·
9 revisions
Proteus uses CBOR (RFC 7049) as its serialisation format. The following sections describe the serialised structure definitions using CDDL syntax.
Envelope = {
0: uint, ;; Version
1: bstr, ;; MAC
2: bstr ;; Message as embedded CBOR.
}
Message = (1, PlainMessage) / (2, PreKeyMessage)
PlainMessage = {
0: bstr, ;; Session tag
1: uint, ;; Counter
2: uint, ;; Previous counter
3: bstr, ;; Ratchet key
4: bstr ;; Cipher text
}
PreKeyMessage = {
0: uint, ;; Prekey ID
1: bstr, ;; Public Base key
2: bstr, ;; Public Identity key
PlainMessage
}
PreKeyBundle = {
0: uint, ;; Version
1: uint, ;; Prekey ID
2: bstr, ;; Public key
3: bstr ;; Public identity key
}
PreKey = {
0: uint, ;; Version
1: uint, ;; Prekey ID
2: bstr, ;; Secret key
3: bstr ;; Public key
}
IdentityKey = {
0: uint, ;; Version
1: bstr, ;; Secret key
2: bstr ;; Public key
}
Session = {
0: uint, ;; Version
1: bstr, ;; Session tag
2: bstr, ;; Local identity public key
3: bstr, ;; Remote identity public key
4: ?{
0: uint, ;; Prekey ID
1: bstr ;; Public prekey
},
5: [+ SessionState ]
}
SessionState = {
0: bstr, ;; Session tag
1: [+ ReceiveChain ],
2: SendChain
3: bstr, ;; Root key
4: uint, ;; Counter
5: [* MessageKeys ] ;; Skipped message keys
}
ReceiveChain = {
0: ChainKey,
1: bstr ;; Ratchet key
}
SendChain = {
0: ChainKey,
1: bstr, ;; Secret ratchet key
2: bstr ;; Public ratchet key
)
ChainKey = {
0: bstr, ;; MAC key
1: uint ;; Counter
}
MessageKeys = {
0: bstr, ;; Cipher key
1: bstr, ;; MAC key
2: uint ;; Counter
)