You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
; the recipient's key for DH exchange to derive the secret
130
+
; that the sender will use to encrypt delivered messages
131
+
132
+
encryptionScheme = %s"x25519"
133
+
; x25519 scheme means [NaCl crypto_box][16] encryption scheme (curve25519xsalsa20poly1305).
134
+
135
+
x509UrlEncoded = <base64url X509 key encoding>
126
136
```
127
137
128
138
`hostname` can be IP address or domain name, as defined in RFC 1123, section 2.1.
@@ -345,24 +355,35 @@ The clients can optionally instruct a dedicated push notification server to subs
345
355
-`subscribeNotifications` (`"NSUB"`) - see [Subscribe to queue notifications](#subscribe-to-queue-notifications).
346
356
-`messageNotification` (`"NMSG"`) - see [Deliver message notification](#deliver-message-notification).
347
357
348
-
## SMP commands
358
+
## SMP Transmission structure
349
359
350
-
Commands syntax below is provided using [ABNF][8] with [case-sensitive strings extension][8a].
360
+
Each transport block (SMP transmission) has a fixed size of 16384 bytes for traffic uniformity.
351
361
352
-
Each transmission between the client and the server must have this format/syntax (after the decryption):
362
+
Some parts of SMP transmission are padded to a fixed size; this padding is uniformly added as a word16 encoded in network byte order - see `paddedString` syntax.
353
363
354
-
```abnf
355
-
transmission = [signature] SP signedSize SP signed SP pad ; pad to the fixed block size
356
-
signedSize = 1*DIGIT
357
-
signed = sessionIdentifier SP [corrId] SP [queueId] SP cmd ; corrId is required in client commands and server responses,
The syntax of specific commands and responses is defined below.
375
408
376
409
### Correlating responses with commands
@@ -534,10 +567,16 @@ Currently SMP defines only one command that can be used by senders - `send` mess
534
567
This command is sent to the server by the sender both to confirm the queue after the sender received out-of-band message from the recipient and to send messages after the queue is secured:
535
568
536
569
```abnf
537
-
send = %s"SEND" SP size SP msgBody SP
538
-
; the last SP is in addition to SP in the transmission
539
-
size = 1*DIGIT ; size in bytes
540
-
msgBody = *OCTET ; any binary content of specified size
570
+
send = %s"SEND" SP smpEncMessage
571
+
smpEncMessage = smpPubHeader sentMsgBody ; message up to 15968 bytes
572
+
smpPubHeader = smpClientVersion encodedLenKey
573
+
smpClientVersion = word16
574
+
encodedLenKey = keyLen x509binary
575
+
keyLen = word16
576
+
x509binary = <binary X509 key encoding>
577
+
sentMsgBody = 15842*15842 OCTET
578
+
; E2E-encrypted smpClientMessage padded to 15842 bytes before encryption
579
+
word16 = 2*2 OCTET
541
580
```
542
581
543
582
The first message is sent to confirm the queue - it should contain sender's server key (see decrypted message syntax below) - this first message must be sent without signature.
@@ -555,15 +594,85 @@ Until the queue is secured, the server should accept any number of unsigned mess
555
594
The body should be encrypted with the recipient's "public" key (`EK`); once decrypted it must have this format:
senderKey = encodedLenKey ; the sender's public key to sign SEND commands for this queue
603
+
clientMsgBody = *OCTET ; up to 15784 in case of emptyHeader
563
604
```
564
605
565
606
`clientHeader` in the initial unsigned message is used to transmit sender's server key and can be used in the future revisions of SMP protocol for other purposes.
@@ -602,8 +711,6 @@ timestamp = <date-time defined in RFC3339>
602
711
603
712
`timestamp` - the UTC time when the server received the message from the sender, must be in date-time format defined by [RFC 3339][10]
604
713
605
-
`msgBody` - see syntax in [Send message](#send-message)
606
-
607
714
When server delivers the messages to the recipient, message body should be encrypted with the secret derived from DH exchange using the keys passed during the queue creation and returned with `queueIds` response.
608
715
609
716
This is done to prevent the possibility of correlation of incoming and outgoing traffic of SMP server inside transport protocol.
@@ -637,24 +744,24 @@ No further messages should be delivered to unsubscribed transport connection.
637
744
#### Error responses
638
745
639
746
- incorrect block format, encoding or signature size (`BLOCK`).
747
+
- missing or different session ID - tls-unique binding of TLS transport (`SESSION`)
640
748
- command errors (`CMD`):
641
749
- error parsing command (`SYNTAX`)
642
750
- prohibited command (`PROHIBITED`) - any server response sent from client or `ACK` sent without active subscription or without message delivery.
643
-
- incorrect RSA key size in `NEW` or `KEY` commands - only 1024, 2048 and 4096-bit keys are allowed (`KEY_SIZE`).
644
751
- transmission has no required signature or queue ID (`NO_AUTH`)
645
752
- transmission has unexpected credentials (`HAS_AUTH`)
646
753
- transmission has no required queue ID (`NO_QUEUE`)
647
754
- authentication error (`AUTH`) - incorrect signature, unknown (or suspended) queue, sender's ID is used in place of recipient's and vice versa, and some other cases (see [Send message](#send-message) command).
648
755
- message queue quota exceeded error (`QUOTA`) - too many messages were sent to the message queue. Further messages can only be sent after the recipient retrieves the messages.
649
-
-incorrect message body size (`SIZE`).
756
+
-sent message is too large (> 15968) to be delivered (`LARGE_MSG`).
Server implementations must aim to respond within the same time for each command in all cases when `"ERR AUTH"` response is required to prevent timing attacks (e.g., the server should perform signature verification even when the queue does not exist on the server or the signature of different size is sent, using any RSA key with the same size as the signature size).
0 commit comments