IIS e download file p7m

Se da un sito in IIS occorre scaricare dei file con estensione .p7m (pfd firmati digitalmente) è possibile che si verifichi il problema che il file venga salvato con estensione .p7c (file di certificato digitale) anziché .p7m.

Il problema dipende dal fatto che sia l’estensione .p7c che l’estensione .p7m sono assegnate allo stesso MIME Type ovvero application/pkcs7-mime.

Per risolvere il problema è possibile eliminare il MIME Type relativo all’estensione .p7c se si ritiene di non utilizzare tale estensione. Si noti che i MIME Types possono essere configurati a livello di server, sito, directory virtuale e applicazione tramite il file Web.config.

In alternativa è possibile modificare il MIME Type relativo all’estensione .p7m in x-application/pkcs7-mime. Per quanto riguarda l’uso del prefisso “x-” nei MIME Types si veda il seguente Media type:

“Media types in this tree cannot be registered. According to RFC 6838 (published in January 2013), any use of types in the unregistered tree is strongly discouraged. In addition, subtypes prefixed with x- or X- are no longer considered to be members of this tree.

According to obsoleted RFC 2048 (published in November 1996)—it should rarely, if ever, be necessary to use unregistered types, and as such use of any x., x- or X- prefixes is discouraged. Obsoleted RFC 1590 (published in September 1993) stated that the use of the x- or X- prefix may be used for unregistered subtypes.

Media types that have been widely deployed (with a subtype prefixed with x- or X-) without being registered, should be, if possible, re-registered with a proper prefixed subtype. If this is not possible, the media type can, after an approval by both the media types reviewer and the IESG, be registered in the standards tree with its unprefixed subtype.”