Saturday, May 3, 2008

Understanding OpenID Association

Before getting into more details of how OpenID Association works, better we start with understanding how Diffie-Hellman key-exchange works.

Let's discuss this under the context of OpenID.

We have two parties interested in sharing a secret key through a non-secured media.

Let one of these be an OpenID Relying Party [RP] and the other be the OpenID Provider [OP].

So, RP and OP want to share a secret key between each other through a non-secured media.

Under Diffie-Hellman key-exchange, they need to do the following to establish a secret key.





























Step 1: Both RP & OP agree on two values "g" and "p". The values of "g" and "p" can be known to any body - even other than the RP and the OP. Under the context of OpenID, these values are defined in the OpenID Authentication Specification. Basically, "p" is a large prime number and "g" is a small number.

Step 2: RP selects a secret number, say "x" - which is typically a large number and compute another number, "X" - with the values of "g" and "p", where X = g^x mod p. Now RP can share "X" with OP [or anybody else] - which is the public key of RP - but it will still maintain "x" as a secret.

Step 3: OP will also select a secret number, say "y" - which is typically a large number and compute another number, "Y" - with the values of "g" and "p", where Y = g^y mod p. Now OP can share "Y" with RP [or anybody else] - which is the public key of OP - but it will still maintain "y" as a secret.

Step 4: Since the public key of OP - "Y" is known to anyone - RP can derive the Diffie-Hellman secret key [Kx] between OP and RP.

Kx = Y^x mod p

Although, "Y" is known publicly - "x" is kept as a secret at the RP - so nobody other than RP, can compute the value of Kx.

Step 5: Since the public key of RP - "X" is known to anyone - OP can derive the Diffie-Hellman secret key [Ky] between OP and RP.

Ky = X^y mod p

Although, "X" is known publicly - "y" is kept as a secret at the OP - so nobody other than OP, can compute the value of Ky.

Step 6: All set - we are done. Under the Diffie-Hellman key-exchange, Kx=Ky - so OP and RP shared a secret key between each other.

Okay - now we are done understanding Diffie-Hellman key-exchange. Let's start with understanding how OpenID Association works.

OpenID Authentication supports both a "smart mode" and "dumb mode" to accommodate Consumers of differing capabilities. A smart Consumer does a little more work at the beginning to save itself work later, but requires local caching of state information. A dumb Consumer is completely stateless, but requires extra an HTTP request.

Under "smart mode", it's recommended that a RP first submits an associate request (associate) to the End User's OP and requests a shared secret if the RP does not already have one cached.

So, the request for "Association" will take place after the "Discovery" - that is after the OP server url being discovered from a given OpenID.

The "Association" request is initiated by the RP using direct communication message called "associate" with an HTTP POST.

Let's discuss some of the important parameters included in an "associate" request.

1. openid.mode : This will have the value "associate" - indicates OP that this is an "associate" request.

2. openid.assoc_type : This defines the algorithm to be used to sign subsequent messages. OpenID 1.1 supported only HMAC-SHA1. HMAC-SHA256 was added in OpenID 2.0. In other words once an "association" being established between OP and RP - the same will be used for subsequent OpenID authentication requests between these OP and RP.

3. openid.session_type : This defines the method used to encrypt the association's MAC key in transit. MAC key is the shared key established between the OP and RP. Don't confuse this with the Diffie-Hellman shared secret. We basically use Diffie-Hellman shared secret to protect the MAC key [shared key] - will explain this more further later in this post.

openid.session_type can have any of the following values.

a. no-encryption
b. DH-SHA1
c. DH-SHA256 [Added in 2.0]

In a "no-encryption" association session, the OP sends the association MAC key in plain-text to the Relying Party. This makes it possible for an eavesdropper to intercept the key and forge messages to this Relying Party when not using transport layer encryption. Therefore, "no-encryption" association sessions MUST NOT be used unless the messages are using transport layer encryption.

The "DH-SHA1" and "DH-SHA256" association session types use Diffie-Hellman Key Exchange to securely transmit the shared secret - that is MAC key. In other words if you use "DH-SHA1" or "DH-SHA256" as the association session type - first OP and RP will derive a Diffie-Hellman shared secret, as explained in the beginning of this post, and will use that shared secret to encrypt the MAC key.

The following parameters are common to requests whose requested association session type is "DH-SHA1" or "DH-SHA256".

4. openid.dh_modulus : This is the value of "p" used in Diffie-Hellman key-exchange, where the default value defined in the spec.

5. openid.dh_gen : This is the value of "g" used in Diffie-Hellman key-exchange, where the default value defined in the spec.

6. openid.dh_consumer_public : This is the public key of RP for Diffie-Hellman key-exchange [X].

Once the OP receives the "associate" request - it will generate a MAC key and encrypt the MAC key [if "DH-SHA1" or "DH-SHA256" being used] with the Diffie-Hellman shared secret. OP will also share it's Diffie-Hellman public key with the RP through the response - so RP can derive the Diffie-Hellman shared secret from it and decrypt the MAC key.

Following are the important parameters is in the "associate" response.

1. assoc_handle : The association handle is used as a key to refer to this association in subsequent messages. assoc_handle will be used as key at both the OP and RP ends to cache the values associated with "associate" message.

2. expires_in : The lifetime, in seconds, of this association. The Relying Party MUST NOT use the association after this time has passed.

3. mac_key : The MAC key (shared secret) for this association, when "no-encryption" is used for session_type in the "associate" request.

4. dh_server_public : OP's Diffie-Hellman public key

5. enc_mac_key : The MAC key (shared secret), encrypted with the secret Diffie-Hellman value.

Once an "association" is established between the OP and the RP - the same "association" will be used for subsequent authentication requests. In other words, when a RP requests authentication for a given OpenID - it will include the already established assoc_handle in the authentication request.

Since the assoc_handle is passed to the OP - it will retrieve the cached MAC key using assoc_handle as a key, and will use that to "sign" the attributes before sending the response.

19 comments:

bkkissel said...

For anyone looking to deploy OpenID on your website, there are open source libraries at www.openidenabled.com or a free hosted service at http://rpxnow.com

Anonymous said...

Nice post, helped a lot to understand

crystal said...

Fantastic!God bless you!Meanwhile,you can visit my China Wholesale,we have the highest quality but the lowest price fashion products wholesale from China.Here are the most popular China Wholesale productsfor all of you.You can visit http://chinaclothes.net.Also the polo clothing is a great choice for you.
http://www.pumafr.com/blog
http://poloshirtsonline.blogspot.com
http://thediary.org/mensclothing
http://blog.livedoor.jp/dokoma
http://www.itimes.com/my_blog.php

venus said...

Do not mean bad.Thank you so much!I just want to show some fashion things to all of you.I like puma speed, puma femmes and other puma shoes. These puma sport items are at store recently and available for anyone.

crystal said...

Perfect!!You are a outstanding person!Have you ever wore chaussures puma,Here are the most popular puma CAT,Puma shoes store gives some preview of puma speed cat,and casual but no sweat puma basket.
http://blog.livedoor.jp/lljj332
http://shoes-puma.jugem.jp
http://poloshirts--myfashion.blogspot.com
http://blades.blogsome.com
http://gillettefusion.edublogs.org

venus said...

God bless you!I really agree with your opinions.Also,there are some new fashion things here,gillette razor blades.gillette mach3 razor bladesfor men.As for ladies,gillette venus razor blades must the best gift for you in summer,gillette fusion blades are all the best choice for you.

venus said...

Awesome!!!Best wishes for you !!cheap polo shirts is the father of the summer should be prepared to most commonly used item, it has both style and shape of Ralph Lauren Polo, and vest with a random function polo ralph lauren, so that in the short-sleeved apply to both on many occasions, the pink and black color men's polo shirts brought into effect, lightweight cotton, linen texture to demonstrate masculine temperament and sense of fashion exhaustively.

crystal said...

Thank you so much!!polo shirt men'ssweate,Burberry Polo Shirts lacoste sweater, ralph lauren Columbia Jackets,ski clothing. Free Shipping, PayPal Payment. Enjoy your shopping experience on mensclothingus.com.You can find the father who desire fashionable, intellectual mens clothing simultaneously.

Unknown said...

Nice information,Ankara escort
many thanks to the author.Ankara escort
It is incomprehensible to me nowAnkara escort
, but in general,Escort ankara bayan
the usefulness and significance is overwhelming.Ankara escort
Thanks again and good luck!
Ankara escort
became the first designer in Wimbledon's 133-year history to create official uniforms for the tournamentescort bayan ankara
As part of this year's event, which starts next week.
will introduces the first ...Escort ankara
determinationEscort ankara
to maintain and enhance the values for which our two brands are famous throughout the world.Escort ankara
The rugby ralph lauren brand brings to Wimbledon the look of timeless elegance,Escort ankara
drawing on our rich history and traditionsEscort ankara
expert and i like your blog and the information you have
mentioned in this post about the Google tools is really great!
Thanks for sharing!
escort bayan ankara
escort bayan ankara
escort bayan ankara
escort bayan ankara kızılay
Escort ankara bayan
escort bayan ankara çankaya
Ankara escort bayan
Ankara escort bayan
.Ankara Escort

escort ankara said...

Ankara Escort,
Escort Bayan Ankara,
Ankara Escort,
Escort Ankara,
Escort Ankara,
Ankara Escort,
Escort Bayan Ankara,
Ankara Escort,
Escort Bayan Ankara,
Escort Ankara,
Escort Bayan Ankara,
Escort Bayan Kayseri,
Escort Kayseri,
Kayseri Escort,
Escort Ankara,

London Crumpet said...

London Crumpet has a message board where London escorts and agencies can post their messages about their services or announce people about any update of their profile. Visitors can also rate the escorts on Hot or Not gallery and give some credentials to the escorts they like.

Bayan Ankara Escort said...

Ankara Escort Bayan
Ankara Escort Bayan ilan tanıtım sitesi.Ankara'da yaşayan escort bayanların profilleri, telefonları ve resimlerini içerir.Sadece Ankara'ya ait olan onlarca escort kızlar birbirinden güzel fotoğraflarıyla erkeklerin hayalini süsleyecek.Bayan escort hizmeti veren siteler arasında en kaliteli eskort kızları sizler için biraraya topladık.Escort Ankara bayan partner bulma tanışma ve sohbet sohbet sitesidir.
Escort Bayan Ankara,
Escort Bayan,
Ankara Escort,
Ankara Escort Bayan,
Escort Bayan Ankara,
Escort Bayan,
Escort Ankara Bayan,
Ankara Escort,
Ankara Escort Bayan,
Escort Bayan Ankara
Ankara Escort Bayan
Escort Ankara
Bayan Ankara Escort

Bayan Ankara Escort said...

Seksi Escort Ankara
Ankara Escort  seksi genç eskort kızlar için bir eskort ajansı . Escort Bayan  ajansı, Ankara'nın en güzel bayan escort en güzel erotik hizmetler sağlar.

Escort Bayan Ankara, hizmeti, sexi escort kızlar , sarışın escort, balık etli escort , çıtır escort, Independent Ankara Escort ve Ankara eskortları size vip hizmet sunmaya hazır bekliyor .


Eskort Bayanlar Ankara, eskort sevimli görünüyor ve dostu doğanın güzelliği ve cazibesi Ankara eskort kızlar, için bilinen,
kendi tutku ve sıcak eğrileri, onların güzel güneş ankara escort  kız Latin eskort pürüzsüz bir cilt öptü ...
ve onlar için mevcut tüm Incall ve outcall randevular için size en güzel kıyafetleri ile karşılamak ve en güzel fantazileri yaşatmak için bütün imkankarını zorlayacklardır.
bayan ankara escort dahil olmak üzere uygun merkezi yerlerde .

ankarada seçkin escort, yüksek sınıf bayan eskort, ve hizmetleri hakkında daha fazla bilgi edinin Ankara eskort bayan, fotoğraf galerisi keşfetmek!

Geç Incall ve outcall randevular için, ya da M25 ötesinde outcalls, hayal kırıklığı önlemek için önceden rezervasyon seçtiğiniz
escort ankara bayan tavsiye ederiz.

bayan escort ankara en iyi konum, bu nedenle ilk seçim yapmak! Hatta biseksüel,
seksi bir ikili randevu için bir eskort - seksi genç eskort, busty eskort, esmer ya da sarışın eskort arıyorsanız Eğer biz,
mükemmel bir tarih bulacağınızdan emin olacaksınız. sitemizde de olabilecek herhangi bir fantezi yerine getirmek için tam bir elit vip escort  hizmeti sunuyoruz!

eskort bayan kızın Bizim elit adult dating hizmetleri sağlayarak, yüksek standartları ve gizlilik gerektirir anlıyoruz.
Ankara eskort ajansı emin olmak için sürekli kontrol edilir.

Yüksek sınıf, sağduyulu ve samimi bir Ankara'daki en iyi eskort sunuyoruz.

escort ankara said...


Hi, Thank you write.
to share is Ankara Escort thank you share.
good site admin


Escort Ankara
Ankara Escort
Escort Bayan Ankara
Escort Bayan Ankara
Ankara Escort
Escort Ankara
Escort Ankara
Escort Ankara
Escort Bayan Ankara
Escort Ankara
Escort Ankara
Escort Ankara
Escort Ankara
Ankara Escort

ofis mobilyaları said...

[url=http://www.damlaofis.com.tr] ofis mobilyaları[/url]
Ofis Mobilyaları
Spot Ofis Mobilyaları
Ofis Mobilyaları fiyatları
Ofis Mobilyası
Ofis Mobilyaları istanbul
Büro Mobilyaları
Büro Mobilyaları Fiyatları
Büro Mobilyaları İstanbul
Büro Mobilyası
Ofis Koltukları
Ofis Mobilyaları fiyatları
Ofis Koltukları
Makam Koltukları
Çalışma Koltukları
Büro Mobilyaları İstanbul
Büro Mobilyaları
Büro Mobilyaları Fiyatları
Çevre Danışmanlık Firmaları
Çevre Danışmanlık Firması
Çevre Danışmanlık
Çevre
Çevre Firması
Çevre Firmaları
Danışmanlık Firması
Danışmanlık Firmaları
Çevre Danışmanlık Firmaları
Çevre Danışmanlık Firması
Çevre Danışmanlık
Çevre
Çevre Firması
Çevre Firmaları
Danışmanlık Firması
Danışmanlık Firmaları
Çevre İzin Lisansları
Çevre İzin Lisansları

Benhür Bolat said...

İstanbul geneli bayan escort gün geçtikçe artmaya başlıyor. bu konuda beylikdüzü bayan escort konusunda yeterince tecrübeli. tatbikî bunlar belirli kitlelere hitap ediyor. bazıları ünlü futbolcularla bile görüşüyor. bizde sizlere bu konuda kolayca ulaşabileceğiniz ve şık bir tasarım ve yazılımı ile favori bayan escort sistemini kurduk. ilgilendiğiniz kişiliği tamamen doğru bir şekilde ulaşabilirsiniz.
favori bayan escort
istanbul bayan escort

beyza eyüp said...

Adana Escort

Adana Eskort

Adana Escort Bayan

Escort Adana

Ankara İç Mimarlık said...

ankara escort
ankara escort bayan

Tharindu Edirisinghe said...

Clearly explains the association in OpenID. Thanks for the post !!