comparison libpurple/protocols/msn/nexus.h @ 23513:1b98e2090a71

Update MSN nexus functions so that tokens are properly updateable. It also uses a callback to signify that the token has been updated. Note: The updating does not actually work yet, but this commit is so that the next two updates will compile.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 07 Jun 2008 06:08:01 +0000
parents 72aa2ccad28d
children 9fdf0accd4aa
comparison
equal deleted inserted replaced
23512:b3890180aa2e 23513:1b98e2090a71
93 "%s" /* Other RSTn tokens */\ 93 "%s" /* Other RSTn tokens */\
94 "</ps:RequestMultipleSecurityTokens>"\ 94 "</ps:RequestMultipleSecurityTokens>"\
95 "</Body>"\ 95 "</Body>"\
96 "</Envelope>" 96 "</Envelope>"
97 97
98 #define MSN_SSO_AUTHINFO_TEMPLATE \
99 "<ps:AuthInfo xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"PPAuthInfo\">"\
100 "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>"\
101 "<ps:BinaryVersion>4</ps:BinaryVersion>"\
102 "<ps:UIVersion>1</ps:UIVersion>"\
103 "<ps:Cookies></ps:Cookies>"\
104 "<ps:RequestParams>AQAAAAIAAABsYwQAAAA0MTA1</ps:RequestParams>"\
105 "</ps:AuthInfo>"
106 /* Not sure what's editable here, so I'll just hard-code the SHA1 hash */
107 #define MSN_SSO_AUTHINFO_SHA1_BASE64 "d2IeTF4DAkPEa/tVETHznsivEpc="
108
109 #define MSN_SSO_TIMESTAMP_TEMPLATE \
110 "<wsu:Timestamp Id=\"Timestamp\">"\
111 "<wsu:Created>%s</wsu:Created>"\
112 "<wsu:Expires>%s</wsu:Expires>"\
113 "</wsu:Timestamp>"
114
115 #define MSN_SSO_SIGNEDINFO_TEMPLATE \
116 "<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">"\
117 "<CanonicalizationMethod Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></CanonicalizationMethod>"\
118 "<SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#hmac-sha1\"></SignatureMethod>"\
119 "<Reference URI=\"#RST0\">"\
120 "<Transforms>"\
121 "<Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></Transform>"\
122 "</Transforms>"\
123 "<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod>"\
124 "<DigestValue>%s</DigestValue>"\
125 "</Reference>"\
126 "<Reference URI=\"#Timestamp\">"\
127 "<Transforms>"\
128 "<Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></Transform>"\
129 "</Transforms>"\
130 "<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod>"\
131 "<DigestValue>%s</DigestValue>"\
132 "</Reference>"\
133 "<Reference URI=\"#PPAuthInfo\">"\
134 "<Transforms>"\
135 "<Transform Algorithm=\"http://www.w3.org/2001/10/xml-exc-c14n#\"></Transform>"\
136 "</Transforms>"\
137 "<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"></DigestMethod>"\
138 "<DigestValue>" MSN_SSO_AUTHINFO_SHA1_BASE64 "</DigestValue>"\
139 "</Reference>"\
140 "</SignedInfo>"
141
142 #define MSN_SSO_TOKEN_UPDATE_TEMPLATE "<?xml version=\"1.0\" encoding=\"utf-8\"?>"\
143 "<Envelope"\
144 " xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\""\
145 " xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\""\
146 " xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\""\
147 " xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\""\
148 " xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\""\
149 " xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\""\
150 " xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\""\
151 " xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">"\
152 "<Header>"\
153 MSN_SSO_AUTHINFO_TEMPLATE /* ps:AuthInfo */ \
154 "<wsse:Security>"\
155 "<EncryptedData xmlns=\"http://www.w3.org/2001/04/xmlenc#\" Id=\"BinaryDAToken0\" Type=\"http://www.w3.org/2001/04/xmlenc#Element\">"\
156 "<EncryptionMethod Algorithm=\"http://www.w3.org/2001/04/xmlenc#tripledes-cbc\"></EncryptionMethod>"\
157 "<ds:KeyInfo xmlns:ds=\"http://www.w3.org/2000/09/xmldsig#\">"\
158 "<ds:KeyName>http://Passport.NET/STS</ds:KeyName>"\
159 "</ds:KeyInfo>"\
160 "<CipherData>"\
161 "<CipherValue>%s</CipherValue>"\
162 "</CipherData>"\
163 "</EncryptedData>"\
164 "<wssc:DerivedKeyToken Id=\"SignKey\">"\
165 "<wsse:RequestedTokenReference>"\
166 "<wsse:KeyIdentifier ValueType=\"http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID\" />"\
167 "<wsse:Reference URI=\"#BinaryDAToken0\" />"\
168 "</wsse:RequestedTokenReference>"\
169 "<wssc:Nonce>%s</wssc:Nonce>"\
170 "</wssc:DerivedKeyToken>"\
171 "%s" /* wsu:Timestamp */\
172 "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\">"\
173 "%s" /* SignedInfo */\
174 "<SignatureValue>%s</SignatureValue>"\
175 "<KeyInfo>"\
176 "<wsse:SecurityTokenReference>"\
177 "<wsse:Reference URI=\"#SignKey\" />"\
178 "</wsse:SecurityTokenReference>"\
179 "</KeyInfo>"\
180 "</Signature>"\
181 "</wsse:Security>"\
182 "</Header>"\
183 "<Body>"\
184 "%s" /* wst:RequestSecurityToken */ \
185 "</Body>"\
186 "</Envelope>"
187
98 typedef struct _MsnUsrKey MsnUsrKey; 188 typedef struct _MsnUsrKey MsnUsrKey;
99 struct _MsnUsrKey 189 struct _MsnUsrKey
100 { 190 {
101 int size; // 28. Does not count data 191 int size; // 28. Does not count data
102 int crypt_mode; // CRYPT_MODE_CBC (1) 192 int crypt_mode; // CRYPT_MODE_CBC (1)
121 typedef struct _MsnNexus MsnNexus; 211 typedef struct _MsnNexus MsnNexus;
122 212
123 struct _MsnNexus 213 struct _MsnNexus
124 { 214 {
125 MsnSession *session; 215 MsnSession *session;
216
217 /* From server via USR command */
126 char *policy; 218 char *policy;
127 char *nonce; 219 char *nonce;
128 220
221 /* From server via SOAP stuff */
222 char *cipher;
223 char *secret;
129 MsnTicketToken *tokens; 224 MsnTicketToken *tokens;
130 int token_len; 225 int token_len;
131 }; 226 };
132 227
133 void msn_nexus_connect(MsnNexus *nexus); 228 void msn_nexus_connect(MsnNexus *nexus);
134 MsnNexus *msn_nexus_new(MsnSession *session); 229 MsnNexus *msn_nexus_new(MsnSession *session);
135 void msn_nexus_destroy(MsnNexus *nexus); 230 void msn_nexus_destroy(MsnNexus *nexus);
136 GHashTable *msn_nexus_get_token(MsnNexus *session, MsnAuthDomains id); 231 GHashTable *msn_nexus_get_token(MsnNexus *nexus, MsnAuthDomains id);
137 const char *msn_nexus_get_token_str(MsnNexus *session, MsnAuthDomains id); 232 const char *msn_nexus_get_token_str(MsnNexus *nexus, MsnAuthDomains id);
138 233 void msn_nexus_update_token(MsnNexus *nexus, int id, GSourceFunc cb, gpointer data);
139 #endif /* _MSN_NEXUS_H_ */ 234 #endif /* _MSN_NEXUS_H_ */
140 235