응용 계층 프로토콜 협상(Application-Layer Protocol Negotiation, ALPN)은 추가적인 왕복을 피하고 응용 계층 프로토콜과 독립적인 방식으로 보안 연결을 통해 어떤 프로토콜을 수행해야 하는지 응용 계층이 협상할 수 있도록 하는 전송 계층 보안(TLS) 확장이다. 이것은 추가적인 왕복 없이 HTTP/2 연결을 설정하는 데 사용된다(클라이언트와 서버는 이전에 HTTPS에 할당된 두 포트를 통해 HTTP/1.1과 통신하고 HTTP/2를 사용하도록 업그레이드하거나 초기 연결을 닫지 않고 HTTP/1.1을 계속 사용할 수 있다).
ALPN은 다음 라이브러리에서 지원된다:
2010년 1월, 구글은 IETF 표준 초안인 다음 프로토콜 협상 TLS 확장을 도입했다. 이 확장은 구글 크롬과 일부 구글 서버 간의 실험적인 SPDY 연결을 협상하는 데 사용되었다. SPDY가 발전함에 따라 NPN은 ALPN으로 대체되었다.
2014년 7월 11일, ALPN은 RFC 7301로 발표되었다. ALPN은 다음 프로토콜 협상(NPN) 확장을 대체한다.
TLS False Start는 2012년 버전 20부터 구글 크롬에서 비활성화되었지만, 이전 NPN 확장을 사용하는 웹사이트는 예외였다.
ALPN은 초기 TLS 핸드셰이크 '클라이언트 헬로'에서 전송되는 TLS 확장으로, 클라이언트(예: 웹 브라우저)가 지원하는 프로토콜을 나열한다.
Handshake Type: Client Hello (1)
Length: 141
Version: TLS 1.2 (0x0303)
Random: dd67b5943e5efd0740519f38071008b59efbd68ab3114587...
Session ID Length: 0
Cipher Suites Length: 10
Cipher Suites (5 suites)
Compression Methods Length: 1
Compression Methods (1 method)
Extensions Length: 90
[other extensions omitted]
Extension: application_layer_protocol_negotiation (len=14)
Type: application_layer_protocol_negotiation (16)
Length: 14
ALPN Extension Length: 12
ALPN Protocol
ALPN string length: 2
ALPN Next Protocol: h2
ALPN string length: 8
ALPN Next Protocol: http/1.1
웹 서버의 결과 '서버 헬로'에도 ALPN 확장이 포함되며, 이는 HTTP 요청에 사용될 프로토콜을 확인한다.
Handshake Type: Server Hello (2)
Length: 94
Version: TLS 1.2 (0x0303)
Random: 44e447964d7e8a7d3b404c4748423f02345241dcc9c7e332...
Session ID Length: 32
Session ID: 7667476d1d698d0a90caa1d9a449be814b89a0b52f470e2d...
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Compression Method: null (0)
Extensions Length: 22
[other extensions omitted]
Extension: application_layer_protocol_negotiation (len=5)
Type: application_layer_protocol_negotiation (16)
Length: 5
ALPN Extension Length: 3
ALPN Protocol
ALPN string length: 2
ALPN Next Protocol: h2