Tuesday, October 23, 2007

Marlin 小結

1. 先前看Marlin文件時,了解到Marlin使用NEMO framework來安全地交換訊息,而NEMO中又在訊息中使用SAML,便想來認識SAML


2.
web service 組成大致如圖













(from: http://upload.wikimedia.org/wikipedia/en/4/4a/Webservices.png)

是service provider向service requester提供service,它們利用java或是.NET的SOAP framework來溝通,並可利用SAML來確保溝通的安全性。



SAML protocol中















(from: http://upload.wikimedia.org/wikipedia/en/a/ae/Saml-use-case.gif)

當service requester向service provider送出請求後,provider會將requester重導向identity provider, 對requester進行authentication, 通過後便assert該requester為合法的使用者並通知service provider
* 這樣的架構也就是SAML實現SSO的方式
* SAML的訊息也需要加密,
方法一是使用SSL[transport-level security]
另一方法是使用XML Signature與XML Encryption[message-level security]
** WSS(Web service Security)
XML Signature可提供WSS中的message integrity
XML Encryption可提供WSS中的message confidentiality
from: Web Services Security: SOAP Message Security 1.1 (WS-Security 2004)
(wss-v1.1-spec-os-SOAPMessageSecurity.pdf)

3.
Marlin就採用SAML把service provider, identity provider分開的作法。這樣應該可以達到,使用content而不限service provider的可能,也就是說當我購買了"不能說的秘密"後,就能透過中華電信MOD收看,或是透過其他付費管道收看(如yam天空的寬頻電視服務)?!


todo
--
1. Web service 和 widget (e.g. yahoo widget engine) 關係

這次我想

常常會想"如果不是我,應該會更好吧!"
或是"如果是〈誰〉,一定會比現在好!"

如果負責這件案子的人,
如果在這個座位上,
如果今天跟你說話的這個人是,
...

這次我打算和這些想法對抗到底。

Sunday, October 14, 2007

Bug Fix #1

I worked on repelling a program bug for almost a week. Surprisingly, the most time-taking part isn't on how to fix it, but on how to find it. For the purpose, I had to realize the program flow to make sure where the program crashed. Not only c codes but javascript codes are involved in, which make the task a little harder, and even now I don't get the whole picture of the entire program. Thanks to the finding that the bug dwells in a function, I can stop looking into the deeper part of the program.
Here is the simplified problematic segment,

system("rm -f filename.txt");
fp = fopen("filename.txt", "w");
...
fclose(fp);

Got it? The program may crash if it trying to access the file but the file is removed by system(), which fork another process to do removal. And the problem isn't how system() does, but when it does. (The removal process created by system() may executed after fopen() called, and it depends on the os scheculer.)
I replace system() with remove() to remove file.

To look back, I can't stand how stupid that I am by means of how much time was wasted. But I am glad to be free to go ahead.

Friday, October 12, 2007

不只在心裡的心理學

心理學(psycology)來自於對於靈魂(soul)的研究(study),長時間的研究進展下來,心理學的的研究範圍區分出許多領域(perception, cognition, emotion, personality, behavior, and interpersonal relationships),也發展出許多流派。(了解心理學發展的歷史可能是蠻有趣的事,特別是對照起當時哲學和科學的發展,可以見到一些互相影響的痕跡)

我想心理學或許可以說是研究"你為什麼做這件事"的學問。
問問自己,
這件事發生的時空環境裡,你感知到的有哪些呢?
是為什麼會做這一件事呢?(為什麼不是別件?)
為什麼用這個方法呢(例如逃避可能的威脅)
你對這件事的解讀是什麼?
你在做這件事時的情緒反應是什麼?是怎麼來的?
你做這件事想得到什麼?

心理學關係到的不只是你的腦袋怎麼想(mental),還關係到你心裡(heart)的感受是怎麼樣。
有時候關於腦袋的理性這塊和關於心裡的感性那塊會有些意見不合或是不愉快,那你就會有機會幫她們調停,來認識專屬於自己的平衡。也許一些小說(理性與感性)中的人物和故事可以讓你對理性和感性的作為有些認識。

我要說的是在心理學的範疇裡,不只有研究心裡怎麼想的,腦袋怎麼運作的也在其中。Got it?

Friday, October 05, 2007

Marlin, A DRM System

Marlin是一套DRM的系統,
它運作的方式大致是這樣的,當我想要在我的player(或任一項具備Marlin Client能力的播放設備)上面播放一部影片(任何以Marlin format保護的檔案),我的player必須要具備網路連線的能力,藉由連線向DRM server取得影片解密所需要的key

Server端在我購買影片的時候會作下紀錄,將來我可以在任意播放設備上播放我所購買的影片。

Server保存了播放影片時解密所需要的key,當我登入Server後,便可取得加密後的content key(在license bundle內)。(一個解密的key被加了密,所以需要另一key來解密這用來解密的key。)這個key又使用了我發佈的public key加密過,所以只有我使用只我知道的private key才能取得。Server端使用我的public key為影片content key加密的作法便是"Binding"

但我的設備並不總是都能取得這份license bundle, Server會考慮這份license的"Target"條件來決定是不是允許license的請求,基本條件是設定為:需要是購買人我發出的請求。如果我的設備這次所請求的license bundle就是這樣的條件,設備便能取回license bundle並正常播放。若是多加了條件表示這份影片是有限期的租用,那Server端便得在確定我的租約還有效後才能放行。為license設定取得條件的動作便是"Targeting"

Reference:
Marlin Architecture Overview

Wednesday, October 03, 2007

我行我素 & 當爛人

最近工作時有點自以為是,看不清楚其他人的容貌,聽不清楚他們的要求,也沒有想要改善這樣的情況。

當爛人還蠻容易上癮的。
如果接到疑問是"你怎麼這樣?",我大概會很高興想"很高興能成為你眼中的那樣"吧!
如果不堅持盡量做好每件事,承認總是有些是是我沒辦法的,似乎就更能接受有些事情是不能改變的或是挑戰不了的了。

目前還沒有打算嘗試新的樣子哩!

Monday, October 01, 2007

UDP Broadcasting

Refer to the following site, use setsockopt/getsockopt to enable udp
broadcasting.

Linux-Kernel Archive: Re: ping: sendto: Permission denied
http://uwsg.iu.edu/hypermail/linux/kernel/9903.0/0411.html