S/mime для подписи и шифрования сообщенийs/mime for message signing and encryption

Список типов MIME: файлы изображений

заявка Тип MIME Расширение файла
Битовая карта Изображение / BMP ВМР
скомпилированный исходный код изображение / цис-трески треска
графический обменный формат изображение / GIF GIF
файл изображения Изображение / ИЭФ ИЭФ
Изображение в формате JPEG изображение / JPEG JPE
Изображение в формате JPEG изображение / JPEG JPEG
Изображение в формате JPEG изображение / JPEG JPG
Формат обмена файлами JPEG Изображение / pipeg JFIF
масштабируемая векторная графика Изображение / SVG + XML SVG
Изображение TIF Изображение / TIFF TIF
Изображение TIF Изображение / TIFF размолвка
Растровая графика Солнца Изображение / х-CMU-растрового РАН
Файл изображения обмена метафайлами Corel Изображение / х-CMX CMX
значок / Х-значок изображения ICO
переносить любое изображение карты изображение / х Переносной-anymap рпт
переносное растровое изображение Изображение / х-портативный-точечный рисунок постоянный репер
переносное изображение graymap изображение / х Переносной-graymap МПГ
портативное изображение pixmap изображение / х Переносной-пиксельная м.д.
Растровое изображение RGB Изображение / х-RGB RGB
Растровое изображение X11 Изображение / х-xbitmap XBM
X11 pixmap Изображение / х-XPixMap XPM
Изображение дампа X-Windows Изображение / х-xwindowdump XWD

MIME類別的結構

最簡單的MIME類別由主類別(type)和子類別(subtype)組成。兩個都是字串,並由一個斜線(/)相接,且不能包含任何空格:

type/subtype

主類別(type)代表廣泛性的分類,譬如或 。子類別(subtype) 則定義該資料精確的MIME類別。例如MIME 類別為, 子類可能會是  (純文字), (HTML 源碼), 或 (iCalendar/) 檔案。

每一種主類別都可能有一組自己的子類別,MIME類別永遠都有主類別和子類別,從來不會只有單一個。

後面加上的參數可以提供更多細節:

type/subtype;parameter=value

例如一個MIME類別的主類是 , 選擇性的  參數可以用來指明資料種所使用的字元集。如果沒有指明 ,預設使用 ASCII () ,除非被user agent’s 的設定覆蓋過去。 要指明一個UTF-8 的文字檔,可以使用 的MIME類別。

MIME 類別對大小寫不敏感,但通常都會使用小寫。

The discrete types currently registered with the IANA are:

Any kind of binary data that doesn’t fall explicitly into one of the other types; either data that will be executed or interpreted in some way or binary data that requires a specific application or category of application to use. Generic binary data (or binary data whose true type is unknown) is . Other common examples include , , and .
Audio or music data. Examples include , .
Reserved for use as a placeholder in examples showing how to use MIME types. These should never be used outside of sample code listings and documentation. can also be used as a subtype; for instance, in an example related to working with audio on the web, the MIME type can be used to indicate that the type is a placeholder and should be replaced with an appropriate one when using the code in the real world.
Font/typeface data. Common examples include , , and .
Image or graphical data including both bitmap and vector still images as well as animated versions of still image formats such as animated GIF or APNG. Common examples are , , and .
Model data for a 3D object or scene. Examples include and .
Text-only data including any human-readable content, source code, or textual data such as comma-separated value (CSV) formatted data. Examples include , , and .
Video data or files, such as MP4 movies ().

For text documents without a specific subtype, should be used. Similarly, for binary documents without a specific or known subtype, should be used.

With the exception of , used in the  method of HTML Forms, and , used with to send part of a document, HTTP doesn’t handle multipart documents in a special way: the message is transmitted to the browser (which will likely show a «Save As» window if it doesn’t know how to display the document).

There are two multipart types:

A message that encapsulates other messages. This can be used, for instance, to represent an email that includes a forwarded message as part of its data, or to allow sending very large messages in chunks as if it were multiple messages. Examples include (for forwarded or replied-to message quoting) and to allow breaking a large message into smaller ones automatically to be reassembled by the recipient.

Файлы изображений

заявка Тип MIME Расширение файла
Битовая карта Изображение / BMP ВМР
скомпилированный исходный код изображение / цис-трески треска
графический обменный формат изображение / GIF GIF
файл изображения Изображение / ИЭФ ИЭФ
Изображение в формате JPEG изображение / JPEG JPE
Изображение в формате JPEG изображение / JPEG JPEG
Изображение в формате JPEG изображение / JPEG JPG
Формат обмена файлами JPEG Изображение / pipeg JFIF
масштабируемая векторная графика Изображение / SVG + XML SVG
Изображение TIF Изображение / TIFF TIF
Изображение TIF Изображение / TIFF размолвка
Растровая графика Солнца Изображение / х-CMU-растрового РАН
Файл изображения обмена метафайлами Corel Изображение / х-CMX CMX
значок / Х-значок изображения ICO
переносить любое изображение карты изображение / х Переносной-anymap рпт
переносное растровое изображение Изображение / х-портативный-точечный рисунок постоянный репер
переносное изображение graymap изображение / х Переносной-graymap МПГ
портативное изображение pixmap изображение / х Переносной-пиксельная м.д.
Растровое изображение RGB Изображение / х-RGB RGB
Растровое изображение X11 Изображение / х-xbitmap XBM
X11 pixmap Изображение / х-XPixMap XPM
Изображение дампа X-Windows Изображение / х-xwindowdump XWD

Поддерживаемые сценарии и технические особенности S/MIMESupported scenarios and technical considerations for S/MIME

S/MIME можно настроить для работы со следующими конечными точками:You can set up S/MIME to work with any of the following end points:

  • Outlook 2010 или более поздней версии;Outlook 2010 or later

  • Outlook в Интернете (предыдущее название Outlook Web App);Outlook on the web (formerly known as Outlook Web App)

  • Exchange ActiveSync (EAS).Exchange ActiveSync (EAS)

Действия по настройке S/MIME для каждой из этих конечных точек несколько различаются. Ниже приведены общие инструкции.The steps that you follow to set up S/MIME with each of these endpoints are slightly different. Generally, you need to complete these steps:

  1. Установка центра сертификации на основе Windows и настройка инфраструктуры открытых ключей для выдачи сертификатов S/MIME.Install a Windows-based Certification Authority and set up a public key infrastructure to issue S/MIME certificates. Поддерживаются сертификаты, выданные сторонними поставщиками сертификатов.Certificates issued by third-party certificate providers are supported. Подробнее: Обзор развертывания сертификата сервера.For details, see Server Certificate Deployment Overview.

  2. Опубликуйте сертификат пользователя в локальной учетной записи доменных служб Active Directory (AD DS) в атрибутах UserSMIMECertificate и/или UserCertificate .Publish the user certificate in an on-premises Active Directory Domain Services (AD DS) account in the UserSMIMECertificate and/or UserCertificate attributes. Доменные службы Active Directory должны располагаться на компьютерах в физическом расположении, которое вы управляете, а не в удаленном средстве или облачной службе в другом месте в Интернете.Your AD DS needs to be located on computers at a physical location that you control and not at a remote facility or cloud-based service somewhere on the Internet. Для получения дополнительных сведений о доменных службах Active Directory обратитесь к разделу Обзор доменных служб Active Directory.For more information about AD DS, see Active Directory Domain Services Overview.

  3. Настройте конечную точку Outlook или EAS для использования S/MIME.Set up the Outlook or EAS end point to use S/MIME.

Mime API

Both and return instances of the MIME
class, documented below.

Note: Inputs to this API are case-insensitive. Outputs (returned values) will
be lowercase.

new Mime(typeMap, … more maps)

Most users of this module will not need to create Mime instances directly.
However if you would like to create custom mappings, you may do so as follows

// Require Mime class
const Mime = require('mime/Mime');

// Define mime type -> extensions map
const typeMap = {
  'text/abc': 'abc', 'alpha', 'bet',
  'text/def': 'leppard'
};

// Create and use Mime instance
const myMime = new Mime(typeMap);
myMime.getType('abc');            // ⇨ 'text/abc'
myMime.getExtension('text/def');  // ⇨ 'leppard'

If more than one map argument is provided, each map is ed (see below), in order.

mime.getType(pathOrExtension)

Get mime type for the given path or extension. E.g.

mime.getType('js');             // ⇨ 'application/javascript'
mime.getType('json');           // ⇨ 'application/json'

mime.getType('txt');            // ⇨ 'text/plain'
mime.getType('dir/text.txt');   // ⇨ 'text/plain'
mime.getType('dir\\text.txt');  // ⇨ 'text/plain'
mime.getType('.text.txt');      // ⇨ 'text/plain'
mime.getType('.txt');           // ⇨ 'text/plain'

is returned in cases where an extension is not detected or recognized

mime.getType('foo/txt');        // ⇨ null
mime.getType('bogus_type');     // ⇨ null

mime.getExtension(type)

Get extension for the given mime type. Charset options (often included in
Content-Type headers) are ignored.

mime.getExtension('text/plain');               // ⇨ 'txt'
mime.getExtension('application/json');         // ⇨ 'json'
mime.getExtension('text/html; charset=utf-8');  // ⇨ 'html'

mime.define(typeMap)

Define type mappings.

is a map of type -> extensions, as documented in , above.

By default this method will throw an error if you try to map a type to an
extension that is already assigned to another type. Passing for the
argument will suppress this behavior (overriding any previous mapping).

mime.define({'text/x-abc': 'abc', 'abcd'});

mime.getType('abcd');            // ⇨ 'text/x-abc'
mime.getExtension('text/x-abc')  // ⇨ 'abc'

Список типов MIME: текстовые файлы

заявка Тип MIME Расширение файла
Каскадная таблица стилей текст / CSS CSS
Файл интернет-телефонии H.323 текст / h323 323
HTML-файл текст / html HTM
HTML-файл текст / html HTML
Файл потоковой передачи Exchange текст / html СТМ
Файл службы определения местоположения NetMeeting текст / iuls ULS
Файл исходного кода BASIC текст / обычный барельеф
Файл исходного кода C / C ++ текст / обычный с
C / C ++ / Objective C заголовочный файл текст / обычный час
текстовый файл текст / обычный текст
богатый текстовый файл Текст / RichText RTX
Файл непрерывного тонального файла Scitext текст / скриптлет разорванные облака
файл с разделителями разделов Текст / таб-отделенные-значение TSV
файл гипертекстового шаблона текст / webviewhtml HTT
HTML-компонентный файл Текст / х-компонента HTC
Файл кодировки шрифтов TeX текст / х-setext ETX
файл vCard текст / х-визитная карточка VCF

func TypeByExtension ¶

func TypeByExtension(ext ) 

TypeByExtension returns the MIME type associated with the file extension ext.
The extension ext should begin with a leading dot, as in «.html».
When ext has no associated type, TypeByExtension returns «».

Extensions are looked up first case-sensitively, then case-insensitively.

The built-in table is small but on unix it is augmented by the local
system’s mime.types file(s) if available under one or more of these
names:

/etc/mime.types
/etc/apache2/mime.types
/etc/apache/mime.types

On Windows, MIME types are extracted from the registry.

Text types have the charset parameter set to «utf-8» by default.

Список типов MIME: видеофайлы

заявка Тип MIME Расширение файла
MPEG-2 аудиофайл видео / MPEG mp2
MPEG-2 аудиофайл видео / MPEG мПа
Файл видео в формате MPEG видео / MPEG ПДВ
Файл видео в формате MPEG видео / MPEG MPEG
Файл видео в формате MPEG видео / MPEG мили на галлон
Видеопоток MPEG-2 видео / MPEG MPV2
MPEG-4, видео / mp4 mp4
Apple QuickTime фильм видео / QuickTime мов
Apple QuickTime фильм видео / QuickTime кварты
Файл системной библиотеки Logos видео / х-ла-АЧС LSF
потоковый медиа-ярлык видео / х-ла-АЧС LSX
файл форматированных систем видео / X-MS-АФС АФС
Удаленный документ ActionScript видео / X-MS-АФС аср
Редиректор Microsoft ASF видео / X-MS-АФС ASX
файл чередования аудио-видео видео / х-msvideo AVI
Apple QuickTime фильм видео / х-SGI-фильм кино

Mime .vs. mime-types .vs. mime-db modules

For those of you wondering about the difference between these NPM modules,
here’s a brief rundown …

is «the source of
truth» for MIME type information. It is not an API. Rather, it is a canonical
dataset of mime type definitions pulled from IANA, Apache, NGINX, and custom mappings
submitted by the Node.js community.

is a thin
wrapper around mime-db that provides an API drop-in compatible(ish) with API.

is, as of v2, a self-contained module bundled with a pre-optimized version
of the dataset. It provides a simplified API with the following characteristics:

  • Intelligently resolved type conflicts (See mime-score for details)
  • Method naming consistent with industry best-practices
  • Compact footprint. E.g. The minified+compressed sizes of the various modules:
Module Size
18 KB
same as mime-db
8 KB
2 KB

Importance of setting the correct MIME type

Most web servers send unrecognized resources as the MIME type. For security reasons, most browsers do not allow setting a custom default action for such resources, forcing the user to save it to disk to use it.

Some common incorrect server configurations:

  • RAR-compressed files. In this case, the ideal would be the true type of the original files; this is often impossible as .RAR files can hold several resources of different types. In this case, configure the server to send .

  • Proprietary file types. Avoid using as most browsers do not allow defining a default behavior (like «Open in Word») for this generic MIME type. A specific type like lets users open such files automatically in the presentation software of their choice.

Получение содержимого MIME сообщения OutlookGet MIME content of an Outlook message

Вы можете получить представление сообщения в формате MIME, добавив сегмент при получении сообщения:You can get the MIME representation of a message by appending the segment when getting the message:

ПримерExample

Ниже приведен пример, в котором запрашивается возврат сообщения из почтового ящика вошедшего пользователя вместе с его содержимым в формате MIME.The following is an example that requests a message in the signed-in user’s mailbox to be returned with its MIME content.

Ниже приведен отклик.The following is the response. Содержимое MIME начинается с заголовка .The MIME content begins with the header.

type WordDecoder ¶ 1.5

A WordDecoder decodes MIME headers containing RFC 2047 encoded-words.

type WordDecoder struct {
    
    
    
    
    
    
    CharsetReader func(charset , input io.) (io., )
}

func (*WordDecoder)

1.5

func (d *) Decode(word ) (, )

Decode decodes an RFC 2047 encoded-word.

▹ Example

▾ Example

package main

import (
«bytes»
«fmt»
«io»
«io/ioutil»
«mime»
)

func main() {
dec := new(mime.WordDecoder)
header, err := dec.Decode(«=?utf-8?q?=C2=A1Hola,_se=C3=B1or!?=»)
if err != nil {
panic(err)
}
fmt.Println(header)

dec.CharsetReader = func(charset string, input io.Reader) (io.Reader, error) {
switch charset {
case «x-case»:
// Fake character set for example.
// Real use would integrate with packages such
// as code.google.com/p/go-charset
content, err := ioutil.ReadAll(input)
if err != nil {
return nil, err
}
return bytes.NewReader(bytes.ToUpper(content)), nil
default:
return nil, fmt.Errorf(«unhandled charset %q», charset)
}
}
header, err = dec.Decode(«=?x-case?q?hello!?=»)
if err != nil {
panic(err)
}
fmt.Println(header)
}

¡Hola, señor!
HELLO!

Run
Format

func (*WordDecoder)

1.5

func (d *) DecodeHeader(header ) (, )

DecodeHeader decodes all encoded-words of the given string. It returns an
error if and only if CharsetReader of d returns an error.

▹ Example

▾ Example

package main

import (
«bytes»
«fmt»
«io»
«io/ioutil»
«mime»
)

func main() {
dec := new(mime.WordDecoder)
header, err := dec.DecodeHeader(«=?utf-8?q?=C3=89ric?= <eric@example.org>, =?utf-8?q?Ana=C3=AFs?= <anais@example.org>»)
if err != nil {
panic(err)
}
fmt.Println(header)

header, err = dec.DecodeHeader(«=?utf-8?q?=C2=A1Hola,?= =?utf-8?q?_se=C3=B1or!?=»)
if err != nil {
panic(err)
}
fmt.Println(header)

dec.CharsetReader = func(charset string, input io.Reader) (io.Reader, error) {
switch charset {
case «x-case»:
// Fake character set for example.
// Real use would integrate with packages such
// as code.google.com/p/go-charset
content, err := ioutil.ReadAll(input)
if err != nil {
return nil, err
}
return bytes.NewReader(bytes.ToUpper(content)), nil
default:
return nil, fmt.Errorf(«unhandled charset %q», charset)
}
}
header, err = dec.DecodeHeader(«=?x-case?q?hello_?= =?x-case?q?world!?=»)
if err != nil {
panic(err)
}
fmt.Println(header)
}

Éric <eric@example.org>, Anaïs <anais@example.org>
¡Hola, señor!
HELLO WORLD!

Run
Format

Текстовые файлы

заявка Тип MIME Расширение файла
Каскадная таблица стилей текст / CSS CSS
Файл интернет-телефонии H.323 текст / h323 323
HTML-файл текст / html HTM
HTML-файл текст / html HTML
Файл потоковой передачи Exchange текст / html СТМ
Файл службы определения местоположения NetMeeting текст / iuls ULS
Файл исходного кода BASIC текст / обычный барельеф
Файл исходного кода C / C ++ текст / обычный с
C / C ++ / Objective C заголовочный файл текст / обычный час
текстовый файл текст / обычный текст
богатый текстовый файл Текст / RichText RTX
Файл непрерывного тонального файла Scitext текст / скриптлет разорванные облака
файл с разделителями разделов Текст / таб-отделенные-значение TSV
файл гипертекстового шаблона текст / webviewhtml HTT
HTML-компонентный файл Текст / х-компонента HTC
Файл кодировки шрифтов TeX текст / х-setext ETX
файл vCard текст / х-визитная карточка VCF

Технологии шифрования сообщенийRelated message encryption technologies

Различные технологии шифрования используются совместно для обеспечения защиты сообщений, хранящихся в почтовых ящиках и при пересылке. Протокол S/MIME может работать одновременно со следующими технологиями, но не зависит от них:A variety of encryption technologies work together to provide protection for messages at rest and in transit. S/MIME can work simultaneously with the following technologies but isn’t dependent on them:

  • Примечание

    Теперь для шифрования данных, которыми обмениваются компьютерные системы, используется протокол TLS вместо протокола SSL. Эти протоколы настолько сходны между собой, что термины «SSL» и «TLS» (без версий) часто используются как взаимозаменяемые. Поэтому когда в статьях по Exchange, Центр администрирования Exchange и Командная консоль Exchange упоминается термин «SSL», часто под ним подразумевается как протокол SSL, так и протокол TLS. Как правило, термин «SSL» обозначает именно протокол SSL только в тех случаях, когда указан номер версии (например, SSL 3.0). О том, почему следует отключить протокол SSL и перейти на протокол TLS, см. в статье Как устранить уязвимость SSL 3.0.Secure Sockets Layer (SSL) is being replaced by Transport Layer Security (TLS) as the protocol that’s used to encrypt data sent between computer systems. They’re so closely related that the terms «SSL» and «TLS» (without versions) are often used interchangeably. Because of this similarity, references to «SSL» in Exchange topics, the Exchange admin center, and the Exchange Management Shell have often been used to encompass both the SSL and TLS protocols. Typically, «SSL» refers to the actual SSL protocol only when a version is also provided (for example, SSL 3.0). To find out why you should disable the SSL protocol and switch to TLS, check out Protecting you against the SSL 3.0 vulnerability.

  • BitLocker: шифрует данные на жестком диске в центре обработки данных, поэтому если кто-то получит несанкционированный доступ, он не сможет прочитать его.BitLocker: Encrypts the data on a hard drive in a datacenter so that if someone gets unauthorized access, they can’t read it. Дополнительные сведения см. в разделе BitLocker: как развертывать в Windows Server 2012 и более поздних версийFor more information, see BitLocker: How to deploy on Windows Server 2012 and later

type WordEncoder ¶ 1.5

A WordEncoder is an RFC 2047 encoded-word encoder.

type WordEncoder 

func (WordEncoder)

1.5

func (e ) Encode(charset, s ) 

Encode returns the encoded-word form of s. If s is ASCII without special
characters, it is returned unchanged. The provided charset is the IANA
charset name of s. It is case insensitive.

▹ Example

▾ Example

package main

import (
«fmt»
«mime»
)

func main() {
fmt.Println(mime.QEncoding.Encode(«utf-8», «¡Hola, señor!»))
fmt.Println(mime.QEncoding.Encode(«utf-8», «Hello!»))
fmt.Println(mime.BEncoding.Encode(«UTF-8», «¡Hola, señor!»))
fmt.Println(mime.QEncoding.Encode(«ISO-8859-1», «Caf\xE9»))
}

=?utf-8?q?=C2=A1Hola,_se=C3=B1or!?=
Hello!
=?UTF-8?b?wqFIb2xhLCBzZcOxb3Ih?=
=?ISO-8859-1?q?Caf=E9?=

Run
Format

Видео файлы

заявка Тип MIME Расширение файла
MPEG-2 аудиофайл видео / MPEG mp2
MPEG-2 аудиофайл видео / MPEG мПа
Файл видео в формате MPEG видео / MPEG ПДВ
Файл видео в формате MPEG видео / MPEG MPEG
Файл видео в формате MPEG видео / MPEG мили на галлон
Видеопоток MPEG-2 видео / MPEG MPV2
MPEG-4, видео / mp4 mp4
Apple QuickTime фильм видео / QuickTime мов
Apple QuickTime фильм видео / QuickTime кварты
Файл системной библиотеки Logos видео / х-ла-АЧС LSF
потоковый медиа-ярлык видео / х-ла-АЧС LSX
файл форматированных систем видео / X-MS-АФС АФС
Удаленный документ ActionScript видео / X-MS-АФС аср
Редиректор Microsoft ASF видео / X-MS-АФС ASX
файл чередования аудио-видео видео / х-msvideo AVI
Apple QuickTime фильм видео / х-SGI-фильм кино
Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Adblock
detector