4.3. Authentication

To charge individuals for used services it is necessary to have means of authentication for registration and call signaling. This section gives an overview on the mechanisms used for this purpose in H.323 and SIP.

The H.323 protocol framework uses H.235 "“Security and encryption for H-series (H.323 and other H.245-based) multimedia terminals”" for optional security features. This recommendation describes how to incorporate authentication, integrity and confidentiality for H.323 communication and what kind of security infrastructure and techniques are supported.

H.235 can be applied to all aspects of H.323 communication which can be broken into two basic categories: Security for signaling messages and Security for media streams.

Security for signaling messages includes the RAS channel (see Section 2.2.1.3) that is used for registration of endpoints, admission and status of calls, as well as the call signaling channel (H.225) that is used for call establishment and the media control channel (H.245).

Security for media streams is used to provide confidentiality for transmitted audio and video data.

Integrity refers to message integrity and ensures that a received message is identical to that which was transmitted by the sender and has not been modified.

H.235 supports two mechanisms to achieve integrity: the use of CryptoTokens and the IntegrityCheckValue.

  1. CryptoTokens are already described in Section 4.3.1.2. To allow an integrity check the whole message is used to compute a MAC/digital signature - instead of just a small subset required for authentication.

    This mechanism can be used for any signaling channel (RAS/H.225.0/H.245).

  2. IntegrityCheckValue refers to an element that occurs in RAS messages. Again the hash-value of the message (without the hash-value) is transmitted.

    This second mechanism was introduced before the adoption of H.235, because it was deemed critical that there was not a data integrity mechanism for the unreliable RAS channel. Since the adoption of H.235, the CryptoToken method is the preferred way to check integrity.

In this section we describe authentication mechanisms used in SIP based networks. First we describe basics of digest authentication, while in following sections we give a brief overview of how digest authentication applies to SIP messages, when it should be used and when it should not.

Digest authentication is a simple authentication mechanism developed originally for HTTP (it is often called HTTP digest) and it is described in RFC2671. The authentication mechanism is very simple. It is based on cryptographic hashes to prevent transferring of the user's password in clear-text.

Digest authentication verifies that both parties that communicate know a shared secret (a password).

When a server wants to authenticate a user, it generates digest challenge and sends it to user. A typical digest challenge looks like this:

Digest realm="iptel.org", qop="auth,auth-int",
  nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", opaque="", algorithm=MD5

It consists of a set of parameters that are sent to the user. The user then uses the parameters to generate proper digest reply and send it back to the server. The meaning of the parameters in the digest challenge is as follows:

After receiving the digest challenge, a user agent will prompt the user for username and password (if not preconfigured), generate a digest response and send the response to the server. A digest response might look like this:

Digest username="jan", realm="iptel.org",
  nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", uri="sip:iptel.org",
  qop=auth, nc=00000001, cnonce="0a4f113b",
  response="6629fae49393a05397450978507c4ef1", opaque=""

As we can see, the digest response is similar to the digest challenge. Those parameters that are the same have the same meaning as in the digest challenge. We will briefly describe only new parameters:

  • uri - The parameter contains URI the clients wants to access.
  • qop - The level of protection chosen by the client.
  • nc - Nonce count, the value is the hexadecimal count of the number of requests (including the current request) that the client has sent with the nonce value in this request. For example, in the first request sent in response to a given nonce value, the client sends “nc=00000001”. The purpose of this directive is to allow the server to detect request replays by maintaining its own copy of this count - if the same value is seen twice, then the request is a replay.
  • cnonce - The value is an opaque quoted string value provided by the client and used by both client and server to avoid chosen plain-text attacks, to provide mutual authentication, and to provide some message integrity protection.
  • response - A string computed by the user agent which proves that the user knows a password.

Upon reception of a digest response the server recalculates the value of the response parameter for comparison purposes, using attributes provided by the client and the password stored on the server. If the result is identical to the response received from the client then the client has proven knowledge of the password and he is authenticated.

We have described what digest challenge and response looks like, but we have not described yet how they are applied to SIP messages. Since the authentication mechanism was originally developed for the HTTP protocol and SIP is very similar to that protocol, mapping of digest challenge and response to SIP messages is easy and straightforward. It is described in RFC3261

When a SIP server receives a SIP request and wants to verify the authenticity of the user before processing the requests, it looks if the request contains digest credentials. If there are no credentials in the SIP request, it will generate a negative final response and include digest challenge into the response.

When a client receives the response (containing digest challenge), it is supposed to calculate proper digest response and send the request again, this time including the calculated digest credentials.

The server then verifies the digest response and processes the request is the verification was successful.

Proxy servers use “407 Proxy Authentication Required” response and include the digest challenge into the “Proxy-Authenticate” header field. An example of such a challenge might look like:

SIP/2.0 407 Proxy Authentication Required.
Via: SIP/2.0/UDP 195.37.78.121:5060.
From: sip:jan@iptel.org;tag=3944790419.
To: <sip:5060@iptel.org;user=phone>;tag=794fe65c16edfdf45da4fc39a5d2867
Call-ID: 3541699089@195.37.78.121.
CSeq: 1 INVITE.
Proxy-Authenticate: Digest realm="iptel.org", \
  nonce="3f9fc19cf91f65958f664122c1310d4c28cc61a2".
Content-Length: 0.

SIP user agents (including registrars and back-to-back user agents) use the “401 Unauthorized” response for the digest challenge. An example of such a challenge might be:

SIP/2.0 401 Unauthorized.
Via: SIP/2.0/UDP 218.79.100.193:65030;branch=z9hG4bK1ce21dab.
To: "IPTel844978" <sip:844978@iptel.org>;tag=794fe65c16edfdf45da4fc39
From: "IPTel844978" <sip:844978@iptel.org>;tag=1fd6218e.
Call-ID: 2d471abf-c0fbee95-bee93355-fea1736b@218.79.100.193.
CSeq: 88608141 REGISTER.
WWW-Authenticate: Digest realm="iptel.org", \
  nonce="3f9fc19cf91f65958f664122c1310d4c28cc61a2".
Content-Length: 0.

407 responses are used by SIP elements (mostly SIP proxy servers) that are not the final destination for the request and after authentication will forward the requests further. 401 responses are used by SIP elements that are the final destination for the request and after authentication will generate a final reply.

When including the digest response clients add “Authorization” or “Proxy-Authorization” header field that contains the digest response. The following example shows a REGISTER message containing digest credentials.

REGISTER sip:iptel.org SIP/2.0.
Via: SIP/2.0/UDP 195.37.78.121:5060.
From: sip:jan@iptel.org.
To: sip:jan@iptel.org.
Call-ID: 003094c3-bcfea44f-40bdf830-2a557714@195.37.78.121.
CSeq: 102 REGISTER.
User-Agent: CSCO/4.
Contact: <sip:jan@195.37.78.121:5060>.
Authorization: Digest username="jan",realm="iptel.org",
   uri="sip:iptel.org",response="dab81127b9a7169ed57aa4a6ca146184",
   nonce="3f9fc0f9619dd1a712b27723398303ea436e839a",algorithm=md5.
Content-Length: 0.
Expires: 10.

We have described what digest authentication looks like and how digest challenges and responses are carried in SIP messages. In this chapter we will look at which SIP messages can be challenged and which can not. We will also describe two most common situations in which digest authentication is used.

When a SIP user agent receives a digest challenge, it is supposed to re-send the same request again, but this time with proper digest credentials. That also means that the user agent must increase the CSeq number in the request in order to avoid treatment the new request as a retransmission by the server.

Because challenging a request means that the request will be sent again with higher CSeq, it is not possible to challenge ACK and CANCEL requests. Both the requests must have the same CSeq as the original request and thus can not be challenged.

All other requests can be challenged, although from time to time there appear implementations that seem to have problems with the challenging of the not so common SIP requests.

There are two cases which are deployed most often and deserve further description: authentication of REGISTER messages and authentication of INVITE messages. We will describe them in separate chapters.



[2] An unofficial list can be found at http://www.isg.rhul.ac.uk/~cjm/ISO-register/.