Message specification
=====================

Source: Provozní řád ISDS, version 2009-10-30, Page 13
Source: Webové služby ISDS pro manipulaci s datovými zprávami, version 2.6
    (2010-01-18) [DataMessage_ws.pdf]

Message ::= Envelope, Content

Message format is defined in Appendinx 1, file dmBaseTypes.xsd.

Content ::= (Document)+

Content involves one or more attachments (= Documents). Allowed Document
formats are defined in Appendix 3 of Vyhláška o stanovení podrobností užívání
a provozování ISDS.

Currently (2009-11-18) allowed formats are (quotation follows):

    – pdf (Portable Document Format)
    – PDF/A (Portable Document Format for the Long-term Archiving)
    – xml (Extensible Markup Language Document); must be valid against
    free available XML Schema published by recipient
    – fo/zfo (602XML Filler dokument)
    – html/htm (Hypertext Markup Language Document)
    – odt (Open Document Text)
    – ods (Open Document Spreadsheet)
    – odp (Open Document Presentation)
    – txt (plain text)
    – rtf (Rich Text Format)
    – doc (MS Word Document)
    – xls (MS Excel Spreadsheet)
    – ppt (MS PowerPoint Presentation)
    – jpg/jpeg/jfif (Joint Photographic Experts Group File Interchange Format)
    – png (Portable Network Graphics)
    – tiff (Tagged Image File Format)
    – gif (Graphics Interchange Format)
    – mpeg1/mpeg2 (Moving Picture Experts Group Phase 1 / Phase 2)
    – wav (Waveform Audio Format)
    – mp2/mp3 (MPEG-1 Audio Layer 2 / Layer 3)
    – isdoc/isdocx (Information System Document) version 5.2 or higher

Document format declaration inside Document and conformace checks change
during time. XML Schemas provide attribute for Document MIME type and Document
annotation.

Attrimbute dmMimeType must present, but may be empty, may contain file name
extension, or may contain official MIME type. If MIME type is declared, ISDS
checks Document content for conformance to the MIME type.

There is MIME type blacklist: application/x-zip-compressed,
application/x-msdownload.

Attribute dmFileDescr (so called annotation) must present and must containt
file name of the Document. Even if dmMimeType exists, ISDS uses THIS attribute
to detect Document format (according file name extension) and checks content
for format conformance.

There is list of allowed file name extensions: pdf, xml, fo, zfo, html, htm,
odt, ods, odp, txt, rtf, doc, xls, ppt, jpg, jpeg, jfif, png, tiff, gif, mpeg1
mpeg2, wav, mp2, mp3, isdoc, isdocx, cer, crt, der, pk7, p7b, p7c, p7f, p7m,
p7s, tst (time stamp).

Document ::= Binary_Document | XML_Document

Document is Base64 encoded binary format or XML.

There exist special Document type, ESS format, that can exist in Content only
once.

Note: ESS format is special XML language designed as interface between
Electronic Document Systems (ESS). It's defined in Appendix 4 of Provozní řád
ISDS.

Message with `malicious code' will be refused by ISDS.

Maximal total size of Documents in a Message is 10 MB. Binary document size is
size before encoding into Base64, XML document size is size in bytes as is
serialized inside SOAP request.

A Message can be addressed to 50 recipients at maximum.

Life time of Message:

    – 90 days for delivered message
    – unlimited for delivered through fiction messages, however they can be
    moved to off-line storage after 90 days. User can request to move the
    Message back into his box (off-line only currently).

Deleted messages are stored off-line as Envelope only without Content.

Note: Delivery through fiction is currently defined as new unread for more
than 10 days after delivery.


Digital Signatures
==================

Emeded digital signatures are PKCS#7 to avoid expensive XML canonicalization.


System messages
===============

There exists special message type iniciated by ISDS (i.e. from system, not from
other box). Such message has reserved from-box `aaaaaaa' (7 × `a') value and
sender type `0' and it contains always document of type HTML. There are
following cases defined:

1   Outgoing message contained malicious code
2   You, administrator, deleted other user
3   Outgoing message could not been delivered because recipeient box had been
    made unaccessible
4   Outgoing commercial message has not been accepted by recipient
5   User has been added to the box
6   User permissions has been changed


Commercial messages
===================

Users can allow commercial message receiving explicitelly. Commercial message
are not considered as accepted by recipient automatically (in opposite to
standard messages), recipient must call ConfirmDelivery to move message from
state Delivered (4) to state Received (6).

User can request to assign permission to send commercial messages. Permission
can be assigned by Czech Post. Commecial recipient can not be searched. Sender
must know exact box ID.

Commercial message can be recognised by @dmType="K" in message envelope. If
@dmType is "V" or attribute is missing, message is so called public (i.e.
standard noncommercial with acceptence time outs etc.).


Message states
==============

Value   Meaning
1       Message has been put into ISDS
2       Message stamped by TSA
3       Message included virues, infected document has been removed
4       Message delivered (dmDeliveryTime stored)
5       Message delivered through fiction (dmAcceptanceTime stored)
6       Message delivered by user login or user explicit request (in case of
        commercial message) (dmAcceptanceTime stored)
7       Message has been read by user
8       Message could not been delivered (e.g. recipent box has been made
        unaccessible meantime)
9       Message content deleted (thus can not be obtained on-line)
10      Message stored into data safe (this is optional commercial service)
