doc: Update maximal message size
[libisds.git] / doc / message
blob50de51a6ff554db0c463287492850b4a42675074
1 Message specification
2 =====================
4 Source: Provozní řád ISDS, version 2016-02-07
5 Source: Webové služby rozhranní ISDS pro manipulaci s datovými zprávami,
6     version 2.48 (2015-11-01)
7 Source: MIME Media Types
8     <http://www.iana.org/assignments/media-types/index.html>
9 Source: O2. Datové schránky: Informace pro dodavatele aplikací, version
10     2010-04-28, Page 18
11 Source: Vyhláška 194/2009 Sb., o stanovení podrobností užívání a provozování
12     informačního systému datových schránek, updated by 422/2010 Coll.
14 Message ::= Envelope, Content
16 Message format is defined in Appendix 1, file dmBaseTypes.xsd.
18 Content ::= (Document)+
20 Content involves one or more attachments (= Documents). Allowed Document
21 formats are defined in Vyhláška o stanovení podrobností užívání a provozování
22 ISDS, 194/2009 Coll.
24 Currently (2011-02-21) allowed formats are (quotation follows):
26     – pdf (Portable Document Format)
27     – PDF/A (Portable Document Format for the Long-term Archiving)
28     – xml (Extensible Markup Language Document); must be valid against
29     freely available XML Schema published by recipient
30     – fo, zfo (602XML Filler Document)
31     – html/htm (Hypertext Markup Language Document)
32     – odt (Open Document Text)
33     – ods (Open Document Spreadsheet)
34     – odp (Open Document Presentation)
35     – txt (plain text)
36     – rtf (Rich Text Format)
37     – doc, docx (MS Word Document)
38     – xls, xlsx (MS Excel Spreadsheet)
39     – ppt, pptx (MS PowerPoint Presentation)
40     – jpg, jpeg, jfif (Joint Photographic Experts Group File Interchange
41     Format)
42     – png (Portable Network Graphics)
43     – tif, tiff (Tagged Image File Format)
44     – gif (Graphics Interchange Format)
45     – mpeg1, mpeg2 (Moving Picture Experts Group Phase 1 / Phase 2)
46     – wav (Waveform Audio Format)
47     – mp2, mp3 (MPEG-1 Audio Layer 2 / Layer 3)
48     – isdoc, isdocx (Information System Document) version 5.2 or higher
49     - edi (international standard EDIFACT, standards for electotronic
50     interchange of business documents [EDI] ODETTE and EANCOM)
51     - dwg (AutoCAD DraWinG File Format) version 2007 or higher
52     - shp, dbf, shx, prj, qix, sbn, sbx (ESRI Shapefile)
53     - dgn (Bentley MicroStation Format) version V7 or V8
54     - gml, gfs, xsd (Geography Markup Language Document)
56 Document format declaration inside Document and conformance checks change
57 during time. XML Schemas provide attribute for Document MIME type and Document
58 annotation.
60 Attribute dmMimeType must present, but may be empty, may contain file name
61 extension, or may contain official MIME type. If MIME type is declared, ISDS
62 checks Document content for conformance to the MIME type.
64 There is MIME type blacklist: application/x-zip-compressed,
65 application/x-msdownload.
67 Attribute dmFileDescr (so called annotation) must present and must contain
68 file name of the Document. Even if dmMimeType exists, ISDS uses THIS attribute
69 to detect Document format (according file name extension) and checks content
70 for format conformance.
72 List of allowed MIME types is copied (and sometimes agumented) in appendix
73 of Webové služby rozhranní ISDS pro manipulaci s datovými zprávami.
75 There is list of allowed file name extensions and MIME type mapping
76 (types ordered in decreasing prefference):
78 Extensions  MIME type               Description
79 -------------------------------------------------------------------------------
80 cer, crt, der
81             application/x-x509-ca-cert  X.509 Certificate (different serialization)
82 doc         application/msword          Microsoft Word Document
83 docx        application/vnd.openxmlformats-officedocument.wordprocessingml.document
84                                         Microsoft OpenXML Document
85 dbf, prj, qix, sbn, sbx, shp, shx
86             application/octet-stream    ESRI Shapefile
87 dgn         application/octet-stream    Bentley Microstation Format
88 dwg         image/vnd.dwg               AutoCAD Drawing
89 edi         application/edifact         EDIFACT (ODETTE, EANCOM standards for
90             application/edi-x12         inernational bussines document
91             application/edi-consent     exchange)
92             text/plain
93             text/xml
94             application/xml
95 fo          application/vnd.software602.filler.form+xml
96             application/xml
97                                         602XML form (uncompressed)
98 gfs, gml    application/xml             Geography Markup Language Document
99             text/xml
100 gif         image/gif                   Graphics Interchange Format
101 html, htm   text/html                   Hyper Text MarkUp Language
102 isdoc       text/isdoc                  Information System Document
103                                         (version >= 5.2)
104 isdocx      text/isdocx                 Information System Document
105                                         (version >= 5.2)
106 jfif, jpeg, jpg
107             image/jpeg                  JFIF/JPEG image
108             image/pjpeg
109 mpeg, mpeg1, mpeg2, mpg
110             video/mpeg                  Motion Joint Picture Expert Group
111             video/mpeg1
112             video/mpeg2
113             video/mpg
114 mp2, mp3    audio/mpeg                  MPEG-1 Audio Layer II
115 odp         application/vnd.oasis.opendocument.presentation
116                                         Open Document Format Presentation
117 ods         application/vnd.oasis.opendocument.spreadsheet
118                                         Open Document Format Spreadsheet
119 odt         application/vnd.oasis.opendocument.text
120                                         Open Document Format Text
121 pdf         application/pdf             Portable Document Format
122 p7b         application/pkcs7-certificates
123             application/pkcs7-mime      
124             application/x-pkcs7-certificates
125                                         Crypto Message Syntax
126 p7c, p7m    application/pkcs7-mime      Crypto Message Syntax
127             application/x-pkcs7-mime
128 p7f         application/pkcs7-signature
129                                         Crypto Message Syntax
130 p7s         application/pkcs7-signature      
131             application/x-pkcs7-signature      
132                                         Crypto Message Syntax
133 pk7         application/pkcs7-mime      Crypto Message Syntax signatures
134             application/x-pkcs7-mime
135 png         image/png                   Portable Network Graphics
136             image/x-png
137 ppt         application/vnd.ms-powerpoint
138                                         Microsoft PowerPoint Document
139 pptx        application/vnd.openxmlformats-officedocument.presentationml.presentation
140                                         Microsoft OpenXML Presentation
141 rtf         application/msword          Rich Text Format
142             text/rtf
143             application/rtf
144 tif, tiff   image/tiff                  Tag Image File Format
145 tsr, tst    application/timestamp-reply 
146                                         Time Stamp Token (RFC 3161)
147 txt         text/plain                  Plain text
148                                         (no charset nor encoding signalled)
149 wav         audio/wav                   RIFF Waveform Audio File Format
150             audio/wave
151             audio/x-wav
152 xls         application/vnd.ms-excel    Microsoft Excel Document
153 xlsx        application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
154                                         Microsoft OpenXML WorkBook
155 xml         application/xml             Extensible MarkUp Language
156             text/xml
157 xsd         application/xml             XML Schema
158             text/xml
159 zfo         application/vnd.software602.filler.form-xml-zip
160                                         602XML form (zipped XML form with
161                                         XSL-FO styles) or data box message
163 Document ::= Binary_Document | XML_Document
165 Document is Base64 encoded binary format or XML.
167 There exist special Document type, ESS format, that can exist in Content only
168 once.
170 Note: ESS format is special XML language designed as interface between
171 Electronic Document Systems (ESS). It's defined in Appendix 4 of Provozní řád
172 ISDS.
174 Message with `malicious code' will be refused by ISDS.
176 Maximal total size of Documents in a Message is usually 20 MB. (Some boxes
177 allow messages up to 50 MB.) Binary document size is size before encoding
178 into Base64, XML document size is size in bytes after serializing into SOAP
179 request.
181 A Message can be addressed to 50 recipients at maximum.
183 Life time of Message:
185     – 90 days for delivered message, 100 days for system message
186     – unlimited for delivered through fiction messages, however they can be
187     moved to off-line storage after 90 days. User can request to move the
188     Message back into his box (off-line only currently).
190 Deleted messages are stored off-line as Envelope only without Content. Since
191 2010-06-01, some services has access to off-line stored envelopes
192 (Get(Signed)DeliveryInfo, MessageEnvelopeDownload, VerifyMessage,
193 AuthenticateMessage).
195 Note: Delivery through fiction is currently defined as new unread for more
196 than 10 days after delivery.
199 Digital Signatures
200 ==================
202 Some SOAP services (GetSignedDeliveryInfo etc.) returns response that embeds
203 digitally signed ISDS message or delivery info. The digital signature is
204 Base64-encoded BER CMS. (xmldsig is not used to avoid expensive XML
205 canonicalization).
207 The CMS should carry one certificate and one signed body.
209 Since 2011-04, a time stamp is embedded into the CMS (get-message responses
210 currently only). The data structure is compliant with RFC 5126 (CMS Advanced
211 Electronic Signatures (CAdES)) and RFC 3161 (Internet X.509 Public Key
212 Infrastructure Time-Stamp Protocol (TSP)).
214 Stamp is stored in id-aa-signatureTimeStampToken object (iso(1).
215 member-body(2).us(840).rsadsi(113549).pkcs(1).pkcs-9(9).smime(16).
216 id-aa(2).14). Input for stamp is CMS SignerInfo.SignatureValue object.
218 Since 2014-09, the time stamp conforms to ATSv3 format defined by CAdES
219 Signatures Baseline Profile, ETSI TS 103 173, version 2.2.1. See
220 <http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=41927>.
222 The signature and time stamp is computed on-the-fly, for each reponse again.
224 If time stamp authority is irresponsive, CMS without time stamp is returned
225 with special ISDS error code 0005. Client can retry to get the same stamped
226 response two times in 20 minutes. Exceeding this quota leads to 50-second
227 delay or error code 3005.
229 If time stamp authority is failing, error code 9502 is returned without any
230 message. 
233 Message hash
234 ============
236 Message checksum is a hashed bit stream of part of a message. Exact message
237 part to hash must preserve physical XML serialization. The hash value is
238 carried inside a message, it's stored in ISDS and it's used as a input form
239 digital time stamp.
241 Currently SHA-1 and SHA-256 algortihms are defined. They are identified by
242 dmHash/@algorithm attribute. Algorithm name in attribute value contains hyphen
243 character.
246 System messages
247 ===============
249 There exists special message type initiated by ISDS (i.e. from system, not
250 from other box). Such message has reserved from-box `aaaaaaa' (7 × `a') value
251 and sender type `0' and it always contains a document of type HTML and
252 sometimes a document of type XML. The XML one provides structured reason of
253 sending the system message, the HTML one is a human-readable form. There are
254 following cases defined:
256 Case    Meaning
257 -------------------------------------------------------------------------------
258 1       Outgoing message contained malicious code.
259 2       You, administrator, deleted other user.
260 3       Outgoing message could not been delivered because recipient box had
261         been made inaccessible retrospectively.
262 4       Outgoing commercial message has been deleted before accepting it by the
263         recipient.
264 5       User has been added to your box.
265 6       User permissions has been changed.
266 7       Box has been made temporary inaccessible on court desicion (e.g. user
267         has been found eligable unresponsible).
268 8       Box has been made temporary inaccessible on box owner or administrator
269         request.
270 9       Box has been made permanently inaccessible because organization does
271         not exist anymore.
272 10      Box has been made permanently inaccessible because owner has died.
273 11      Personal data of box owner does not match central register.
275 The XML document has following structures:
277 SystemMessage – Attribute `type' is a number of case 1, or 4.
278     + dmID – message ID
279     + dbIDRecipient – recipient box ID
281 SystemMessage – Attribute `type' is a number of case 2, 5, or 6.
282     + userID – user ID
283     + userName – user proper name
285 SystemMessage – Attribute `type' is a number of case 3.
286     + dmID – undeliverable message ID
287     + dbIDRecipient – inaccessible recipient box ID
288     + dbName – recipent box name
289     + undelivDate – date when the box was made inaccessible
290     + dmAnnotation – message subject
291     + dmSenderRefNumber – sender's reference number of the message
292     + dmSenderIdent – sender's identity number of the message
294 SystemMessage – Attribute `type' is a number of case 7, 8, 9, 10, or 11.
295     No elements are defined.
298 Notification messages
299 =====================
301 ISDS administrator can send business messages from dedicated box `zzzzzzq'.
302 Such a message contains a PDF document with a notification about business
303 activities of the ISDS administrator. Business activity is e.g. a support
304 for commercial messages.
306 Non-normative: The originating box as well as the message are of type system.
309 Commercial messages
310 ===================
312 Users can allow commercial message receiving explicitly in opposite to
313 standard messages.
315 User can request to assign permission to send commercial messages. Permission
316 can be assigned by Czech Post. Or sending some commercial messages can be
317 offered and paid by third party. Then user don't need special permission from
318 Czech Post to send the specific commercial message. See PDZInfo service for
319 more details. Commercial recipient can not be searched. Sender must know exact
320 box ID.
322 Commercial outgoing message is automatically recognized by ISDS using sender
323 and recipient box type, commercial sending/receiving permission, and OVM
324 message flag. All messages are noncommercial, so called public, except
325 following combinations when the message is considered as commercial:
327         Sender                         Recipient
328 Gross type  Commercial sending  Gross type  Commercial receiving    OVM flag
329 ----------------------------------------------------------------------------
330 non-OVM     allowed             non-OVM     allowed                 any
331 any         any                 non-OVM     allowed                 false
333 When sending message, the commercial status can be refined by @dmType
334 attribute in the message envelope:
336 Value   Meaning
337 -----------------------------------------------------------------------------
338 I       Commercial message offering paying the response instead of the
339         recipient (so called initiatory message)
340 K       Commercial message
341 O       Commercial message as a response paid by sender of initiatory message
342 V       Noncommercial standard message
344 Incoming message or downloaded sent message can have @dmType attribute in the
345 message envelope with following meaning:
347 Value   Meaning
348 -----------------------------------------------------------------------------
349 A       Subsidized initiatory commercial message which can pay a response
350 B       Subsidized initiatory commercial message which has already paid the
351         response 
352 C       Subsidized initiatory commercial message where the response offer has
353         expired
354 D       Externally subsidized commercial messsage
355 E       Prepaid stamp
356 G       Paid by a sponsor
357 I       Initiatory commercial message which can pay a response
358 K       Commercial message paid by sender
359 O       Commercial message as a response paid by sended of initiatory message
360 X       Initiatory commercial message where the response offer has expired
361 Y       Initiatory commercial message which has already paid the response
362 Z       Limitedly subsidized commercial message
364 Missing @dmType attribute means noncommercial standard message.
366 Relation between initiatory message and reply paid by initiatory message
367 sender is established by an identifier defined in dmSenderRefNumber element of
368 initiatory message and the same value copied into dmRecipientRefNumber element
369 of response message.
372 Message states
373 ==============
375 Value   Meaning
376 1       Message has been put into ISDS
377 2       Message stamped by TSA
378 3       Message included viruses, infected document has been removed
379 4       Message delivered (dmDeliveryTime stored)
380 5       Message delivered through fiction (dmAcceptanceTime stored)
381 6       Message delivered by user log-in or user explicit request (in case of
382         commercial message) (dmAcceptanceTime stored)
383 7       Message has been read by user
384 8       Message could not been delivered (e.g. recipient box has been made
385         inaccessible meantime)
386 9       Message content deleted (thus can not be obtained on-line)
387 10      Message saved in long term storage (this is optional commercial service)