Add forgotten server example files
[libisds.git] / doc / message
blobe16f37aecd9dbd3edda13b4e071a9e85f299b6eb
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.49 (2016-02-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. Especially this attribute is subject of a string
71 rewrite.
73 List of allowed MIME types is copied (and sometimes agumented) in appendix
74 of Webové služby rozhranní ISDS pro manipulaci s datovými zprávami.
76 There is list of allowed file name extensions and MIME type mapping
77 (types ordered in decreasing prefference):
79 Extensions  MIME type               Description
80 -------------------------------------------------------------------------------
81 cer, crt, der
82             application/x-x509-ca-cert  X.509 Certificate (different serialization)
83 doc         application/msword          Microsoft Word Document
84 docx        application/vnd.openxmlformats-officedocument.wordprocessingml.document
85                                         Microsoft OpenXML Document
86 dbf, prj, qix, sbn, sbx, shp, shx
87             application/octet-stream    ESRI Shapefile
88 dgn         application/octet-stream    Bentley Microstation Format
89 dwg         image/vnd.dwg               AutoCAD Drawing
90 edi         application/edifact         EDIFACT (ODETTE, EANCOM standards for
91             application/edi-x12         inernational bussines document
92             application/edi-consent     exchange)
93             text/plain
94             text/xml
95             application/xml
96 fo          application/vnd.software602.filler.form+xml
97             application/xml
98                                         602XML form (uncompressed)
99 gfs, gml    application/xml             Geography Markup Language Document
100             text/xml
101 gif         image/gif                   Graphics Interchange Format
102 html, htm   text/html                   Hyper Text MarkUp Language
103 isdoc       text/isdoc                  Information System Document
104                                         (version >= 5.2)
105 isdocx      text/isdocx                 Information System Document
106                                         (version >= 5.2)
107 jfif, jpeg, jpg
108             image/jpeg                  JFIF/JPEG image
109             image/pjpeg
110 mpeg, mpeg1, mpeg2, mpg
111             video/mpeg                  Motion Joint Picture Expert Group
112             video/mpeg1
113             video/mpeg2
114             video/mpg
115 mp2, mp3    audio/mpeg                  MPEG-1 Audio Layer II
116 odp         application/vnd.oasis.opendocument.presentation
117                                         Open Document Format Presentation
118 ods         application/vnd.oasis.opendocument.spreadsheet
119                                         Open Document Format Spreadsheet
120 odt         application/vnd.oasis.opendocument.text
121                                         Open Document Format Text
122 pdf         application/pdf             Portable Document Format
123 p7b         application/pkcs7-certificates
124             application/pkcs7-mime      
125             application/x-pkcs7-certificates
126                                         Crypto Message Syntax
127 p7c, p7m    application/pkcs7-mime      Crypto Message Syntax
128             application/x-pkcs7-mime
129 p7f         application/pkcs7-signature
130                                         Crypto Message Syntax
131 p7s         application/pkcs7-signature      
132             application/x-pkcs7-signature      
133                                         Crypto Message Syntax
134 pk7         application/pkcs7-mime      Crypto Message Syntax signatures
135             application/x-pkcs7-mime
136 png         image/png                   Portable Network Graphics
137             image/x-png
138 ppt         application/vnd.ms-powerpoint
139                                         Microsoft PowerPoint Document
140 pptx        application/vnd.openxmlformats-officedocument.presentationml.presentation
141                                         Microsoft OpenXML Presentation
142 rtf         application/msword          Rich Text Format
143             text/rtf
144             application/rtf
145 tif, tiff   image/tiff                  Tag Image File Format
146 tsr, tst    application/timestamp-reply 
147                                         Time Stamp Token (RFC 3161)
148 txt         text/plain                  Plain text
149                                         (no charset nor encoding signalled)
150 wav         audio/wav                   RIFF Waveform Audio File Format
151             audio/wave
152             audio/x-wav
153 xls         application/vnd.ms-excel    Microsoft Excel Document
154 xlsx        application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
155                                         Microsoft OpenXML WorkBook
156 xml         application/xml             Extensible MarkUp Language
157             text/xml
158 xsd         application/xml             XML Schema
159             text/xml
160 zfo         application/vnd.software602.filler.form-xml-zip
161                                         602XML form (zipped XML form with
162                                         XSL-FO styles) or data box message
164 Document ::= Binary_Document | XML_Document
166 Document is Base64 encoded binary format or XML.
168 There exist special Document type, ESS format, that can exist in Content only
169 once.
171 Note: ESS format is special XML language designed as interface between
172 Electronic Document Systems (ESS). It's defined in Appendix 4 of Provozní řád
173 ISDS.
175 Message with `malicious code' will be refused by ISDS.
177 Maximal total size of Documents in a Message is usually 20 MB. (Some boxes
178 allow messages up to 50 MB.) Binary document size is size before encoding
179 into Base64, XML document size is size in bytes after serializing into SOAP
180 request.
182 A Message can be addressed to 50 recipients at maximum.
184 Life time of Message:
186     – 90 days for delivered message, 100 days for system message
187     – unlimited for delivered through fiction messages, however they can be
188     moved to off-line storage after 90 days. User can request to move the
189     Message back into his box (off-line only currently).
191 Deleted messages are stored off-line as Envelope only without Content. Since
192 2010-06-01, some services has access to off-line stored envelopes
193 (Get(Signed)DeliveryInfo, MessageEnvelopeDownload, VerifyMessage,
194 AuthenticateMessage).
196 Note: Delivery through fiction is currently defined as new unread for more
197 than 10 days after delivery.
200 Digital Signatures
201 ==================
203 Some SOAP services (GetSignedDeliveryInfo etc.) returns response that embeds
204 digitally signed ISDS message or delivery info. The digital signature is
205 Base64-encoded BER CMS. (xmldsig is not used to avoid expensive XML
206 canonicalization).
208 The CMS should carry one certificate and one signed body.
210 Since 2011-04, a time stamp is embedded into the CMS (get-message responses
211 currently only). The data structure is compliant with RFC 5126 (CMS Advanced
212 Electronic Signatures (CAdES)) and RFC 3161 (Internet X.509 Public Key
213 Infrastructure Time-Stamp Protocol (TSP)).
215 Stamp is stored in id-aa-signatureTimeStampToken object (iso(1).
216 member-body(2).us(840).rsadsi(113549).pkcs(1).pkcs-9(9).smime(16).
217 id-aa(2).14). Input for stamp is CMS SignerInfo.SignatureValue object.
219 Since 2014-09, the time stamp conforms to ATSv3 format defined by CAdES
220 Signatures Baseline Profile, ETSI TS 103 173, version 2.2.1. See
221 <http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=41927>.
223 The signature and time stamp is computed on-the-fly, for each reponse again.
225 If time stamp authority is irresponsive, CMS without time stamp is returned
226 with special ISDS error code 0005. Client can retry to get the same stamped
227 response two times in 20 minutes. Exceeding this quota leads to 50-second
228 delay or error code 3005.
230 If time stamp authority is failing, error code 9502 is returned without any
231 message. 
234 Message hash
235 ============
237 Message checksum is a hashed bit stream of part of a message. Exact message
238 part to hash must preserve physical XML serialization. The hash value is
239 carried inside a message, it's stored in ISDS and it's used as a input form
240 digital time stamp.
242 Currently SHA-1 and SHA-256 algortihms are defined. They are identified by
243 dmHash/@algorithm attribute. Algorithm name in attribute value contains hyphen
244 character.
247 System messages
248 ===============
250 There exists special message type initiated by ISDS (i.e. from system, not
251 from other box). Such message has reserved from-box `aaaaaaa' (7 × `a') value
252 and sender type `0' and it always contains a document of type HTML and
253 sometimes a document of type XML. The XML one provides structured reason of
254 sending the system message, the HTML one is a human-readable form. There are
255 following cases defined:
257 Case    Meaning
258 -------------------------------------------------------------------------------
259 1       Outgoing message contained malicious code.
260 2       You, administrator, deleted other user.
261 3       Outgoing message could not been delivered because recipient box had
262         been made inaccessible retrospectively.
263 4       Outgoing commercial message has been deleted before accepting it by the
264         recipient.
265 5       User has been added to your box.
266 6       User permissions has been changed.
267 7       Box has been made temporary inaccessible on court desicion (e.g. user
268         has been found eligable unresponsible).
269 8       Box has been made temporary inaccessible on box owner or administrator
270         request.
271 9       Box has been made permanently inaccessible because organization does
272         not exist anymore.
273 10      Box has been made permanently inaccessible because owner has died.
274 11      Personal data of box owner does not match central register.
276 The XML document has following structures:
278 SystemMessage – Attribute `type' is a number of case 1, or 4.
279     + dmID – message ID
280     + dbIDRecipient – recipient box ID
282 SystemMessage – Attribute `type' is a number of case 2, 5, or 6.
283     + userID – user ID
284     + userName – user proper name
286 SystemMessage – Attribute `type' is a number of case 3.
287     + dmID – undeliverable message ID
288     + dbIDRecipient – inaccessible recipient box ID
289     + dbName – recipent box name
290     + undelivDate – date when the box was made inaccessible
291     + dmAnnotation – message subject
292     + dmSenderRefNumber – sender's reference number of the message
293     + dmSenderIdent – sender's identity number of the message
295 SystemMessage – Attribute `type' is a number of case 7, 8, 9, 10, or 11.
296     No elements are defined.
299 Notification messages
300 =====================
302 ISDS administrator can send business messages from dedicated box `zzzzzzq'.
303 Such a message contains a PDF document with a notification about business
304 activities of the ISDS administrator. Business activity is e.g. a support
305 for commercial messages.
307 Non-normative: The originating box as well as the message are of type system.
310 Commercial messages
311 ===================
313 Users can allow commercial message receiving explicitly in opposite to
314 standard messages.
316 User can request to assign permission to send commercial messages. Permission
317 can be assigned by Czech Post. Or sending some commercial messages can be
318 offered and paid by third party. Then user don't need special permission from
319 Czech Post to send the specific commercial message. See PDZInfo service for
320 more details. Commercial recipient can not be searched. Sender must know exact
321 box ID.
323 Commercial outgoing message is automatically recognized by ISDS using sender
324 and recipient box type, commercial sending/receiving permission, and OVM
325 message flag. All messages are noncommercial, so called public, except
326 following combinations when the message is considered as commercial:
328         Sender                         Recipient
329 Gross type  Commercial sending  Gross type  Commercial receiving    OVM flag
330 ----------------------------------------------------------------------------
331 non-OVM     allowed             non-OVM     allowed                 any
332 any         any                 non-OVM     allowed                 false
334 When sending message, the commercial status can be refined by @dmType
335 attribute in the message envelope:
337 Value   Meaning
338 -----------------------------------------------------------------------------
339 I       Commercial message offering paying the response instead of the
340         recipient (so called initiatory message)
341 K       Commercial message
342 O       Commercial message as a response paid by sender of initiatory message
343 V       Noncommercial standard message
345 Incoming message or downloaded sent message can have @dmType attribute in the
346 message envelope with following meaning:
348 Value   Meaning
349 -----------------------------------------------------------------------------
350 A       Subsidized initiatory commercial message which can pay a response
351 B       Subsidized initiatory commercial message which has already paid the
352         response 
353 C       Subsidized initiatory commercial message where the response offer has
354         expired
355 D       Externally subsidized commercial messsage
356 E       Prepaid stamp
357 G       Paid by a sponsor
358 I       Initiatory commercial message which can pay a response
359 K       Commercial message paid by sender
360 O       Commercial message as a response paid by sended of initiatory message
361 X       Initiatory commercial message where the response offer has expired
362 Y       Initiatory commercial message which has already paid the response
363 Z       Limitedly subsidized commercial message
365 Missing @dmType attribute means noncommercial standard message.
367 Relation between initiatory message and reply paid by initiatory message
368 sender is established by an identifier defined in dmSenderRefNumber element of
369 initiatory message and the same value copied into dmRecipientRefNumber element
370 of response message.
373 Message states
374 ==============
376 Value   Meaning
377 1       Message has been put into ISDS
378 2       Message stamped by TSA
379 3       Message included viruses, infected document has been removed
380 4       Message delivered (dmDeliveryTime stored)
381 5       Message delivered through fiction (dmAcceptanceTime stored)
382 6       Message delivered by user log-in or user explicit request (in case of
383         commercial message) (dmAcceptanceTime stored)
384 7       Message has been read by user
385 8       Message could not been delivered (e.g. recipient box has been made
386         inaccessible meantime)
387 9       Message content deleted (thus can not be obtained on-line)
388 10      Message saved in long term storage (this is optional commercial service)