AirPlay

AirPlay is the marketing name of Apple's technology for streaming audio and video between iTunes and iOS devices. It is an evolution of AirTunes that was limited to streaming audio from iTunes to Airport Express base stations.

Audio-only content is streamed by using the AirTunes / RAOP (Remote Audio Output Protocol) technology. Video/photo content is based on HTTP live streaming.

Basically currently AirPlay and its protocols cover 4 streaming scenarios:


 * 1) Display photos and slideshows from an iOS device.
 * 2) Stream audio from an iOS device or iTunes. This used to be referred to as AirTunes and is now also often referred to as AirPlay.
 * 3) Display videos from an iOS device or iTunes. This is mostly referred to AirPlay as well.
 * 4) Show the screen content from an iOS device or OS X Mountain Lion. This is called AirPlay Mirroring.

AirPlay (streaming of photos, audio and video) was first introduced in iOS 4.2, AirPlay Mirroring came with iOS 5.0. Early developer builds had the feature integrated in all apps using the standard video controller, but in the final release it was limited to the iPod (videos on iPod touch and iPad) and YouTube apps. However, it is possible to enable AirPlay in 3rd party apps on jailbroken devices.

Currently the only supported target for video / photo streaming is 2nd gen and 3rd gen Apple TV, while other companies are expected to release compatible products in the future.

Mac users can download AirPlayer by Erica Sadun that can receive video from an iOS device. It is quite buggy at the moment, does not support audio, DRM-protected video, or iTunes as a source, but it's still an important achievement as the first independent implementation of AirPlay.

Encryption
AirPlay / AirTunes uses public-private-key cryptography to ensure that only valid devices 'talk' to each other. This ensures 2 things:


 * 1) Only valid software (iTunes) can send content (can encrypt content).
 * 2) * This is ensured by iTunes using the RSA public key (public maybe misleading here as Apple took good care that this key is not easily revealed) whenever content is sent encrypted. The public keys were found by Jon Lech Johansen in August, 2004. This allowed "invalid" (other than iTunes) software - e.g. ALSA under Linux - to stream audio to 'valid' AirPort Express devices.
 * 3) Only valid devices (Apple TV & Airport Express) can receive content (can decrypt content).
 * 4) * This is ensured by valid devices using the RSA private key. Only the private key can be used to decrypt content which was encrypted with the public key (1). The private key was found by James Laird in 2011, allowing "valid" software (iTunes) to stream audio to 'invalid' devices - e.g. a Linux system running Shairport.

RSA public key stored in iTunes
AirPort Express RSA Public Key, Modulus: 59dE8qLieItsH1WgjrcFRKj6eUWqi+bGLOX1HL3U3GhC/j0Qg90u3sG/1CUtwC 5vOYvfDmFI6oSFXi5ELabWJmT2dKHzBJKa3k9ok+8t9ucRqMd6DZHJ2YCCLlDR KSKv6kDqnw4UwPdpOMXziC/AMj3Z/lUVX1G7WSHCAWKf1zNS1eLvqr+boEjXuB OitnZ/bDzPHrTOZz0Dew0uowxf/+sG+NCK3eQJVxqcaJ/vEHKIVd2M+5qL71yJ Q+87X6oV3eaYvt3zWZYD6z5vYTcrtij2VZ9Zmni/UAaHqn9JdsBWLUEpVviYnh imNVvYFZeCXg/IdTQ+x4IRdiXNv5hEew==

Exponent:

Source: Jon Lech Johansen’s blog

List of all iTunes RSA Public keys found by Johansen.

By using these keys any application can stream audio to an AirPort Express.

RSA private key stored in AirPort Express
-BEGIN RSA PRIVATE KEY- MIIEpQIBAAKCAQEA59dE8qLieItsH1WgjrcFRKj6eUWqi+bGLOX1HL3U3GhC/j0Qg90u3sG/1CUt wC5vOYvfDmFI6oSFXi5ELabWJmT2dKHzBJKa3k9ok+8t9ucRqMd6DZHJ2YCCLlDRKSKv6kDqnw4U wPdpOMXziC/AMj3Z/lUVX1G7WSHCAWKf1zNS1eLvqr+boEjXuBOitnZ/bDzPHrTOZz0Dew0uowxf /+sG+NCK3eQJVxqcaJ/vEHKIVd2M+5qL71yJQ+87X6oV3eaYvt3zWZYD6z5vYTcrtij2VZ9Zmni/ UAaHqn9JdsBWLUEpVviYnhimNVvYFZeCXg/IdTQ+x4IRdiXNv5hEewIDAQABAoIBAQDl8Axy9XfW BLmkzkEiqoSwF0PsmVrPzH9KsnwLGH+QZlvjWd8SWYGN7u1507HvhF5N3drJoVU3O14nDY4TFQAa LlJ9VM35AApXaLyY1ERrN7u9ALKd2LUwYhM7Km539O4yUFYikE2nIPscEsA5ltpxOgUGCY7b7ez5 NtD6nL1ZKauw7aNXmVAvmJTcuPxWmoktF3gDJKK2wxZuNGcJE0uFQEG4Z3BrWP7yoNuSK3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