Subversion Repositories Applications.framework

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
297 jpm 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
  <html xmlns="http://www.w3.org/1999/xhtml">
3
		<head>
4
			<!-- template designed by Marco Von Ballmoos  -->
5
			<title>Docs For Class DiffieHellmanUtil</title>
6
			<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
7
			<link rel="stylesheet" href="../media/stylesheet.css" />
8
						<script src="../media/lib/classTree.js"></script>
9
												<script language="javascript" type="text/javascript">
10
				var imgPlus = new Image();
11
				var imgMinus = new Image();
12
				imgPlus.src = "../media/images/plus.png";
13
				imgMinus.src = "../media/images/minus.png";
14
 
15
				function showNode(Node){
16
							switch(navigator.family){
17
								case 'nn4':
18
									// Nav 4.x code fork...
19
							var oTable = document.layers["span" + Node];
20
							var oImg = document.layers["img" + Node];
21
									break;
22
								case 'ie4':
23
									// IE 4/5 code fork...
24
							var oTable = document.all["span" + Node];
25
							var oImg = document.all["img" + Node];
26
									break;
27
								case 'gecko':
28
									// Standards Compliant code fork...
29
							var oTable = document.getElementById("span" + Node);
30
							var oImg = document.getElementById("img" + Node);
31
									break;
32
							}
33
					oImg.src = imgMinus.src;
34
					oTable.style.display = "block";
35
				}
36
 
37
				function hideNode(Node){
38
							switch(navigator.family){
39
								case 'nn4':
40
									// Nav 4.x code fork...
41
							var oTable = document.layers["span" + Node];
42
							var oImg = document.layers["img" + Node];
43
									break;
44
								case 'ie4':
45
									// IE 4/5 code fork...
46
							var oTable = document.all["span" + Node];
47
							var oImg = document.all["img" + Node];
48
									break;
49
								case 'gecko':
50
									// Standards Compliant code fork...
51
							var oTable = document.getElementById("span" + Node);
52
							var oImg = document.getElementById("img" + Node);
53
									break;
54
							}
55
					oImg.src = imgPlus.src;
56
					oTable.style.display = "none";
57
				}
58
 
59
				function nodeIsVisible(Node){
60
							switch(navigator.family){
61
								case 'nn4':
62
									// Nav 4.x code fork...
63
							var oTable = document.layers["span" + Node];
64
									break;
65
								case 'ie4':
66
									// IE 4/5 code fork...
67
							var oTable = document.all["span" + Node];
68
									break;
69
								case 'gecko':
70
									// Standards Compliant code fork...
71
							var oTable = document.getElementById("span" + Node);
72
									break;
73
							}
74
					return (oTable && oTable.style.display == "block");
75
				}
76
 
77
				function toggleNodeVisibility(Node){
78
					if (nodeIsVisible(Node)){
79
						hideNode(Node);
80
					}else{
81
						showNode(Node);
82
					}
83
				}
84
			</script>
85
					</head>
86
		<body>
87
			<div class="page-body">
88
<h2 class="class-name">Class DiffieHellmanUtil</h2>
89
 
90
<a name="sec-description"></a>
91
<div class="info-box">
92
	<div class="info-box-title">Description</div>
93
	<div class="nav-bar">
94
					<span class="disabled">Description</span> |
95
															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
96
 
97
											<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
98
 
99
			</div>
100
	<div class="info-box-body">
101
        		<!-- ========== Info from phpDoc block ========= -->
102
<p class="short-description">Classe utilitaire proposant des fonctions permettant la réalisation d'un  échange de clé Diffie Hellman</p>
103
<p class="description"><p>&quot;En cryptographie, l'échange de clés Diffie-Hellman, du nom de ses auteurs   Whitfield Diffie et Martin Hellman, est une méthode par laquelle deux   personnes peuvent se mettre d'accord sur un nombre (qu'ils peuvent utiliser   comme clé pour chiffrer la conversation suivante) sans qu'une troisième   personne appelée Ève puisse découvrir le nombre, même en ayant écouté tous   leurs échanges.&quot;</p><p>Voir http://fr.wikipedia.org/wiki/%C3%89change_de_cl%C3%A9s_Diffie-Hellman</p></p>
104
		<p class="notes">
105
			Located in <a class="field" href="_utilitaires---DiffieHellmanUtil.php.html">/utilitaires/DiffieHellmanUtil.php</a> (line <span class="field"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a17">17</a></span>)
106
		</p>
107
 
108
 
109
		<pre></pre>
110
 
111
			</div>
112
</div>
113
 
114
 
115
	<a name="sec-const-summary"></a>
116
	<div class="info-box">
117
		<div class="info-box-title">Class Constant Summary</span></div>
118
		<div class="nav-bar">
119
			<a href="#sec-description">Description</a> |
120
						<span class="disabled">Constants</span> (<a href="#sec-consts">details</a>)
121
										|
122
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
123
 
124
					</div>
125
		<div class="info-box-body">
126
			<div class="const-summary">
127
								<div class="const-title">
128
					<img src="../media/images/Constant.png" alt=" " />
129
					<a href="#DH_G" title="details" class="const-name">DH_G</a> = 					<span class="var-type"> '02'</span>
130
 
131
				</div>
132
								<div class="const-title">
133
					<img src="../media/images/Constant.png" alt=" " />
134
					<a href="#DH_P" title="details" class="const-name">DH_P</a> = 					<span class="var-type"> 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'</span>
135
 
136
				</div>
137
							</div>
138
		</div>
139
	</div>
140
 
141
 
142
	<a name="sec-method-summary"></a>
143
	<div class="info-box">
144
		<div class="info-box-title">Method Summary</span></div>
145
		<div class="nav-bar">
146
			<a href="#sec-description">Description</a> |
147
															<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
148
 
149
									<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
150
		</div>
151
		<div class="info-box-body">
152
			<div class="method-summary">
153
 
154
				<div class="method-definition">
155
					static 						<span class="method-result">mixed</span>
156
										<a href="#createDhKey" title="details" class="method-name">createDhKey</a>
157
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$p</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$g</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$priv_key</span> = <span class="var-default">null</span>])
158
									</div>
159
 
160
				<div class="method-definition">
161
					static 						<span class="method-result">array</span>
162
										<a href="#getDhKeyDetails" title="details" class="method-name">getDhKeyDetails</a>
163
											(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
164
									</div>
165
 
166
				<div class="method-definition">
167
					static 						<span class="method-result">int</span>
168
										<a href="#strlen" title="details" class="method-name">strlen</a>
169
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
170
									</div>
171
 
172
				<div class="method-definition">
173
											<span class="method-result">mixed</span>
174
										<a href="#binToBigNum" title="details" class="method-name">binToBigNum</a>
175
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$bin</span>)
176
									</div>
177
 
178
				<div class="method-definition">
179
											<span class="method-result">string</span>
180
										<a href="#btwoc" title="details" class="method-name">btwoc</a>
181
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
182
									</div>
183
 
184
				<div class="method-definition">
185
											<span class="method-result">string</span>
186
										<a href="#computeDhSecret" title="details" class="method-name">computeDhSecret</a>
187
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$pub_key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
188
									</div>
189
 
190
				<div class="method-definition">
191
											<span class="method-result">string</span>
192
										<a href="#randomBytes" title="details" class="method-name">randomBytes</a>
193
											(<span class="var-type">integer</span>&nbsp;<span class="var-name">$len</span>)
194
									</div>
195
																			</div>
196
		</div>
197
	</div>
198
 
199
 
200
	<a name="sec-methods"></a>
201
	<div class="info-box">
202
		<div class="info-box-title">Methods</div>
203
		<div class="nav-bar">
204
			<a href="#sec-description">Description</a> |
205
																		<a href="#sec-const-summary">Constants</a> (<a href="#sec-consts">details</a>)
206
 
207
										<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
208
 
209
		</div>
210
		<div class="info-box-body">
211
			<A NAME='method_detail'></A>
212
<a name="methodcreateDhKey" id="createDhKey"><!-- --></a>
213
<div class="evenrow">
214
 
215
	<div class="method-header">
216
		<span class="method-title">static createDhKey</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a40">40</a></span>)
217
	</div>
218
 
219
	<!-- ========== Info from phpDoc block ========= -->
220
<p class="short-description">Performs the first step of a Diffie-Hellman key exchange by generating</p>
221
<p class="description"><p>private and public DH values based on given prime number $p and  generator $g. Both sides of key exchange MUST have the same prime number  and generator. In this case they will able to create a random shared  secret that is never send from one to the other.</p></p>
222
	<ul class="tags">
223
				<li><span class="field">access:</span> public</li>
224
			</ul>
225
 
226
	<div class="method-signature">
227
		static <span class="method-result">mixed</span>
228
		<span class="method-name">
229
			createDhKey
230
		</span>
231
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$p</span>, <span class="var-type">string</span>&nbsp;<span class="var-name">$g</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$priv_key</span> = <span class="var-default">null</span>])
232
			</div>
233
 
234
			<ul class="parameters">
235
					<li>
236
				<span class="var-type">string</span>
237
				<span class="var-name">$p</span><span class="var-description">: prime number in binary representation</span>			</li>
238
					<li>
239
				<span class="var-type">string</span>
240
				<span class="var-name">$g</span><span class="var-description">: generator in binary representation</span>			</li>
241
					<li>
242
				<span class="var-type">string</span>
243
				<span class="var-name">$priv_key</span><span class="var-description">: private key in binary representation</span>			</li>
244
				</ul>
245
 
246
 
247
	</div>
248
<a name="methodgetDhKeyDetails" id="getDhKeyDetails"><!-- --></a>
249
<div class="oddrow">
250
 
251
	<div class="method-header">
252
		<span class="method-title">static getDhKeyDetails</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a87">87</a></span>)
253
	</div>
254
 
255
	<!-- ========== Info from phpDoc block ========= -->
256
<p class="short-description">Returns an associative array with Diffie-Hellman key components in  binary representation. The array includes original prime number 'p' and  generator 'g', random private key 'priv_key' and corresponding public  key 'pub_key'.</p>
257
	<ul class="tags">
258
				<li><span class="field">access:</span> public</li>
259
			</ul>
260
 
261
	<div class="method-signature">
262
		static <span class="method-result">array</span>
263
		<span class="method-name">
264
			getDhKeyDetails
265
		</span>
266
					(<span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
267
			</div>
268
 
269
			<ul class="parameters">
270
					<li>
271
				<span class="var-type">mixed</span>
272
				<span class="var-name">$dh</span><span class="var-description">: Diffie-Hellman key</span>			</li>
273
				</ul>
274
 
275
 
276
	</div>
277
<a name="methodstrlen" id="strlen"><!-- --></a>
278
<div class="evenrow">
279
 
280
	<div class="method-header">
281
		<span class="method-title">static strlen</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a183">183</a></span>)
282
	</div>
283
 
284
	<!-- ========== Info from phpDoc block ========= -->
285
<p class="short-description">Returns lenght of binary string in bytes</p>
286
	<ul class="tags">
287
				<li><span class="field">return:</span> the string lenght</li>
288
				<li><span class="field">access:</span> public</li>
289
			</ul>
290
 
291
	<div class="method-signature">
292
		static <span class="method-result">int</span>
293
		<span class="method-name">
294
			strlen
295
		</span>
296
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
297
			</div>
298
 
299
			<ul class="parameters">
300
					<li>
301
				<span class="var-type">string</span>
302
				<span class="var-name">$str</span>			</li>
303
				</ul>
304
 
305
 
306
	</div>
307
<a name="methodbinToBigNum" id="binToBigNum"><!-- --></a>
308
<div class="oddrow">
309
 
310
	<div class="method-header">
311
		<span class="method-title">binToBigNum</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a202">202</a></span>)
312
	</div>
313
 
314
	<!-- ========== Info from phpDoc block ========= -->
315
<p class="short-description">Converts binary representation into ext/gmp or ext/bcmath big integer  representation.</p>
316
	<ul class="tags">
317
				<li><span class="field">throws:</span> Zend_OpenId_Exception</li>
318
				<li><span class="field">access:</span> protected</li>
319
			</ul>
320
 
321
	<div class="method-signature">
322
		<span class="method-result">mixed</span>
323
		<span class="method-name">
324
			binToBigNum
325
		</span>
326
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$bin</span>)
327
			</div>
328
 
329
			<ul class="parameters">
330
					<li>
331
				<span class="var-type">string</span>
332
				<span class="var-name">$bin</span><span class="var-description">: binary representation of big number</span>			</li>
333
				</ul>
334
 
335
 
336
	</div>
337
<a name="methodbtwoc" id="btwoc"><!-- --></a>
338
<div class="evenrow">
339
 
340
	<div class="method-header">
341
		<span class="method-title">btwoc</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a152">152</a></span>)
342
	</div>
343
 
344
	<!-- ========== Info from phpDoc block ========= -->
345
<p class="short-description">Takes an arbitrary precision integer and returns its shortest big-endian  two's complement representation.</p>
346
<p class="description"><p>Arbitrary precision integers MUST be encoded as big-endian signed two's  complement binary strings. Henceforth, &quot;btwoc&quot; is a function that takes  an arbitrary precision integer and returns its shortest big-endian two's  complement representation. All integers that are used with  Diffie-Hellman Key Exchange are positive. This means that the left-most  bit of the two's complement representation MUST be zero. If it is not,  implementations MUST add a zero byte at the front of the string.</p></p>
347
	<ul class="tags">
348
				<li><span class="field">return:</span> big-endian signed representation</li>
349
				<li><span class="field">access:</span> public</li>
350
			</ul>
351
 
352
	<div class="method-signature">
353
		<span class="method-result">string</span>
354
		<span class="method-name">
355
			btwoc
356
		</span>
357
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$str</span>)
358
			</div>
359
 
360
			<ul class="parameters">
361
					<li>
362
				<span class="var-type">string</span>
363
				<span class="var-name">$str</span><span class="var-description">: binary representation of arbitrary precision integer</span>			</li>
364
				</ul>
365
 
366
 
367
	</div>
368
<a name="methodcomputeDhSecret" id="computeDhSecret"><!-- --></a>
369
<div class="oddrow">
370
 
371
	<div class="method-header">
372
		<span class="method-title">computeDhSecret</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a112">112</a></span>)
373
	</div>
374
 
375
	<!-- ========== Info from phpDoc block ========= -->
376
<p class="short-description">Computes the shared secret from the private DH value $dh and the other  party's public value in $pub_key</p>
377
	<ul class="tags">
378
				<li><span class="field">throws:</span> Zend_OpenId_Exception</li>
379
				<li><span class="field">access:</span> public</li>
380
			</ul>
381
 
382
	<div class="method-signature">
383
		<span class="method-result">string</span>
384
		<span class="method-name">
385
			computeDhSecret
386
		</span>
387
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$pub_key</span>, <span class="var-type">mixed</span>&nbsp;<span class="var-name">$dh</span>)
388
			</div>
389
 
390
			<ul class="parameters">
391
					<li>
392
				<span class="var-type">string</span>
393
				<span class="var-name">$pub_key</span><span class="var-description">: other party's public value</span>			</li>
394
					<li>
395
				<span class="var-type">mixed</span>
396
				<span class="var-name">$dh</span><span class="var-description">: Diffie-Hellman key</span>			</li>
397
				</ul>
398
 
399
 
400
	</div>
401
<a name="methodrandomBytes" id="randomBytes"><!-- --></a>
402
<div class="evenrow">
403
 
404
	<div class="method-header">
405
		<span class="method-title">randomBytes</span> (line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a168">168</a></span>)
406
	</div>
407
 
408
	<!-- ========== Info from phpDoc block ========= -->
409
<p class="short-description">Produces string of random byte of given length.</p>
410
	<ul class="tags">
411
				<li><span class="field">return:</span> RAW random binary string</li>
412
				<li><span class="field">access:</span> public</li>
413
			</ul>
414
 
415
	<div class="method-signature">
416
		<span class="method-result">string</span>
417
		<span class="method-name">
418
			randomBytes
419
		</span>
420
					(<span class="var-type">integer</span>&nbsp;<span class="var-name">$len</span>)
421
			</div>
422
 
423
			<ul class="parameters">
424
					<li>
425
				<span class="var-type">integer</span>
426
				<span class="var-name">$len</span><span class="var-description">: length of requested string</span>			</li>
427
				</ul>
428
 
429
 
430
	</div>
431
 
432
		</div>
433
	</div>
434
 
435
	<a name="sec-consts"></a>
436
	<div class="info-box">
437
		<div class="info-box-title">Class Constants</div>
438
		<div class="nav-bar">
439
			<a href="#sec-description">Description</a> |
440
										<a href="#sec-var-summary">Constants</a> (<span class="disabled">details</span>)
441
 
442
 
443
										|
444
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
445
 
446
					</div>
447
		<div class="info-box-body">
448
			<a name="constDH_G" id="DH_G"><!-- --></A>
449
<div class="oddrow">
450
 
451
	<div class="const-header">
452
		<img src="../media/images/Variable.png" />
453
		<span class="const-title">
454
			<span class="const-name">DH_G</span>
455
			 = <span class="const-default"> '02'</span>
456
			(line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a23">23</a></span>)
457
		</span>
458
	</div>
459
 
460
	<!-- ========== Info from phpDoc block ========= -->
461
 
462
 
463
</div>
464
<a name="constDH_P" id="DH_P"><!-- --></A>
465
<div class="evenrow">
466
 
467
	<div class="const-header">
468
		<img src="../media/images/Variable.png" />
469
		<span class="const-title">
470
			<span class="const-name">DH_P</span>
471
			 = <span class="const-default"> 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab'</span>
472
			(line <span class="line-number"><a href="../__filesource/fsource_Framework__utilitairesDiffieHellmanUtil.php.html#a20">20</a></span>)
473
		</span>
474
	</div>
475
 
476
	<!-- ========== Info from phpDoc block ========= -->
477
 
478
 
479
</div>
480
 
481
		</div>
482
	</div>
483
 
484
	<p class="notes" id="credit">
302 jpm 485
		Documentation generated on Tue, 18 Jan 2011 15:30:48 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
297 jpm 486
	</p>
487
	</div></body>
488
</html>