test: server: Initialize TLS session
[libisds.git] / doc / message
blob55985db8af4f560e74b2b94e70f673c302ff0420
1 Message specification
2 =====================
4 Source: Provozní řád ISDS, version 2011-11-29, Page 5, 14
5 Source: Webové služby rozhranní ISDS pro manipulaci s datovými zprávami,
6     version 2.23 (2011-11-24)
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 10 MB. Binary document size is
177 size before encoding into Base64, XML document size is size in bytes as is
178 serialized inside SOAP request.
180 A Message can be addressed to 50 recipients at maximum.
182 Life time of Message:
184     – 90 days for delivered message, 100 days for system message
185     – unlimited for delivered through fiction messages, however they can be
186     moved to off-line storage after 90 days. User can request to move the
187     Message back into his box (off-line only currently).
189 Deleted messages are stored off-line as Envelope only without Content. Since
190 2010-06-01, some services has access to off-line stored envelopes
191 (Get(Signed)DeliveryInfo, MessageEnvelopeDownload, VerifyMessage,
192 AuthenticateMessage).
194 Note: Delivery through fiction is currently defined as new unread for more
195 than 10 days after delivery.
198 Digital Signatures
199 ==================
201 Some SOAP services (GetSignedDeliveryInfo etc.) returns response that embeds
202 digitally signed ISDS message or delivery info. The digital signature is
203 Base64-encoded BER CMS. (xmldsig is not used to avoid expensive XML
204 canonicalization).
206 The CMS should carry one certificate and one signed body. Since 2011-04,
207 a time stamp is embedded into the CMS (get-message responses currently only).
208 The data structure is compliant with RFC 5126 (CMS Advanced Electronic
209 Signatures (CAdES)) and RFC 3161 (Internet X.509 Public Key Infrastructure
210 Time-Stamp Protocol (TSP)).
212 Stamp is stored in id-aa-signatureTimeStampToken object (iso(1).
213 member-body(2).us(840).rsadsi(113549).pkcs(1).pkcs-9(9).smime(16).
214 id-aa(2).14). Input for stamp is CMS SignerInfo.SignatureValue object.
216 The signature and time stamp is computed on-the-fly, for each reponse again.
218 If time stamp authority is irresponsive, CMS without time stamp is returned
219 with special ISDS error code 0005. Client can retry to get the same stamped
220 response two times in 20 minutes. Exceeding this quota leads to 50-second
221 delay or error code 3005.
223 If time stamp authority is failing, error code 9502 is returned without any
224 message. 
227 Message hash
228 ============
230 Message checksum is a hashed bit stream of part of a message. Exact message
231 part to hash must preserve physical XML serialization. The hash value is
232 carried inside a message, it's stored in ISDS and it's used as a input form
233 digital time stamp.
235 Currently SHA-1 and SHA-256 algortihms are defined. They are identified by
236 dmHash/@algorithm attribute. Algorithm name in attribute value contains hyphen
237 character.
240 System messages
241 ===============
243 There exists special message type initiated by ISDS (i.e. from system, not
244 from other box). Such message has reserved from-box `aaaaaaa' (7 × `a') value
245 and sender type `0' and it alwyas contains a document of type HTML and
246 sometimes a document of type XML. The XML one provides structured reason of
247 sending the system message, the HTML one is a human-readable form. There are
248 following cases defined:
250 Case    Meaning
251 -------------------------------------------------------------------------------
252 1       Outgoing message contained malicious code.
253 2       You, administrator, deleted other user.
254 3       Outgoing message could not been delivered because recipient box had
255         been made inaccessible retrospectively.
256 4       Outgoing commercial message has been deleted before accepting it by the
257         recipient.
258 5       User has been added to your box.
259 6       User permissions has been changed.
260 7       Box has been made temporary inaccessible on court desicion (e.g. user
261         has been found eligable unresponsible).
262 8       Box has been made temporary inaccessible on box owner or administrator
263         request.
264 9       Box has been made permanently inaccessible because organization does
265         not exist anymore.
266 10      Box has been made permanently inaccessible because owner has died.
267 11      Personal data of box owner does not match central register.
269 The XML document has following structures:
271 SystemMessage – Attribute `type' is a number of case 1, 3, or 4.
272     + dmID – message ID
273     + dbIDRecipient – recipient box ID
275 SystemMessage – Attribute `type' is a number of case 2, 5, or 6.
276     + userID – user ID
277     + userName – user proper name
279 SystemMessage – Attribute `type' is a number of case 7, 8, 9, 10, or 11.
280     No elements are defined.
283 Commercial messages
284 ===================
286 Users can allow commercial message receiving explicitly in opposite to
287 standard messages.
289 User can request to assign permission to send commercial messages. Permission
290 can be assigned by Czech Post. Or sending some commercial messages can be
291 offered and paid by third party. Then user don't need special permission from
292 Czech Post to send the specific commercial message. See PDZInfo service for
293 more details. Commercial recipient can not be searched. Sender must know exact
294 box ID.
296 Commercial outgoing message is automatically recognized by ISDS using sender
297 and recipient box type, commercial sending/receiving permission, and OVM
298 message flag. All messages are noncommercial, so called public, except
299 following combinations when the message is considered as commercial:
301         Sender                         Recipient
302 Gross type  Commercial sending  Gross type  Commercial receiving    OVM flag
303 ----------------------------------------------------------------------------
304 non-OVM     allowed             non-OVM     allowed                 any
305 any         any                 non-OVM     allowed                 false
307 When sending message, the commercial status can be refined by @dmType
308 attribute in the message envelope:
310 Value   Meaning
311 -----------------------------------------------------------------------------
312 I       Commercial message offering paying the response instead of the
313         recipient (so called initiatory message)
314 K       Commercial message
315 O       Commercial message as a response paid by sender of initiatory message
316 V       Noncommercial standard message
318 Incoming message or downloaded sent message can have @dmType attribute in the
319 message envelope with following meaning:
321 Value   Meaning
322 -----------------------------------------------------------------------------
323 A       Subsidized initiatory commercial message which can pay a response
324 B       Subsidized initiatory commercial message which has already paid the
325         response 
326 C       Subsidized initiatory commercial message where the response offer has
327         expired
328 D       Externally subsidized commercial messsage
329 E       Prepaid stamp
330 G       Paid by a sponsor
331 I       Initiatory commercial message which can pay a response
332 K       Commercial message paid by sender
333 O       Commercial message as a response paid by sended of initiatory message
334 X       Initiatory commercial message where the response offer has expired
335 Y       Initiatory commercial message which has already paid the response
336 Z       Limitedly subsidized commercial message
338 Missing @dmType attribute means noncommercial standard message.
340 Relation between initiatory message and reply paid by initiatory message
341 sender is established by an identifier defined in dmSenderRefNumber element of
342 initiatory message and the same value copied into dmRecipientRefNumber element
343 of response message.
346 Message states
347 ==============
349 Value   Meaning
350 1       Message has been put into ISDS
351 2       Message stamped by TSA
352 3       Message included viruses, infected document has been removed
353 4       Message delivered (dmDeliveryTime stored)
354 5       Message delivered through fiction (dmAcceptanceTime stored)
355 6       Message delivered by user log-in or user explicit request (in case of
356         commercial message) (dmAcceptanceTime stored)
357 7       Message has been read by user
358 8       Message could not been delivered (e.g. recipient box has been made
359         inaccessible meantime)
360 9       Message content deleted (thus can not be obtained on-line)
361 10      Message saved in long term storage (this is optional commercial service)