index.html
311 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html lang="en" dir="ltr">
<head>
<title>XML Encryption Syntax and Processing Version 1.1</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<!-- <script src='../../../dap-dev/ReSpec.js/js/respec.js' class='remove'></script> -->
<style type="text/css">
/*****************************************************************
* ReSpec CSS
* Robin Berjon (robin at berjon dot com)
* v0.05 - 2009-07-31
*****************************************************************/
/* --- INLINES --- */
em.rfc2119 {
text-transform: lowercase;
font-variant: small-caps;
font-style: normal;
color: #900;
}
h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
border: none;
}
dfn {
font-weight: bold;
}
a.internalDFN {
color: inherit;
border-bottom: 1px solid #99c;
text-decoration: none;
}
a.externalDFN {
color: inherit;
border-bottom: 1px dotted #ccc;
text-decoration: none;
}
a.bibref {
text-decoration: none;
}
code {
color: #ff4500;
}
/* --- WEB IDL --- */
pre.idl {
border-top: 1px solid #90b8de;
border-bottom: 1px solid #90b8de;
padding: 1em;
line-height: 120%;
}
pre.idl::before {
content: "WebIDL";
display: block;
width: 150px;
background: #90b8de;
color: #fff;
font-family: initial;
padding: 3px;
font-weight: bold;
margin: -1em 0 1em -1em;
}
.idlType {
color: #ff4500;
font-weight: bold;
text-decoration: none;
}
/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID, .idlDictionaryID {
font-weight: bold;
color: #005a9c;
}
.idlSuperclass {
font-style: italic;
color: #005a9c;
}
/*.idlAttribute*/
.idlAttrType, .idlFieldType, .idlMemberType {
color: #005a9c;
}
.idlAttrName, .idlFieldName, .idlMemberName {
color: #ff4500;
}
.idlAttrName a, .idlFieldName a, .idlMemberName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlMethod*/
.idlMethType {
color: #005a9c;
}
.idlMethName {
color: #ff4500;
}
.idlMethName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlParam*/
.idlParamType {
color: #005a9c;
}
.idlParamName {
font-style: italic;
}
.extAttr {
color: #666;
}
/*.idlConst*/
.idlConstType {
color: #005a9c;
}
.idlConstName {
color: #ff4500;
}
.idlConstName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlException*/
.idlExceptionID {
font-weight: bold;
color: #c00;
}
.idlTypedefID, .idlTypedefType {
color: #005a9c;
}
.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
color: #c00;
font-weight: normal;
}
.excName a {
font-family: monospace;
}
.idlRaises a.idlType, .excName a.idlType {
border-bottom: 1px dotted #c00;
}
.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
width: 45px;
text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; }
.idlImplements a {
font-weight: bold;
}
dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members {
margin-left: 2em;
}
.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt {
font-weight: normal;
}
.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code {
font-weight: bold;
color: #000;
font-family: monospace;
}
.attributes dt code, .fields dt code, .dictionary-members dt code {
background: #ffffd2;
}
.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code {
color: #005a9c;
background: transparent;
font-family: inherit;
font-weight: normal;
font-style: italic;
}
.methods dt code {
background: #d9e6f8;
}
.constants dt code {
background: #ddffd2;
}
.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd {
margin-bottom: 1em;
}
table.parameters, table.exceptions {
border-spacing: 0;
border-collapse: collapse;
margin: 0.5em 0;
width: 100%;
}
table.parameters { border-bottom: 1px solid #90b8de; }
table.exceptions { border-bottom: 1px solid #deb890; }
.parameters th, .exceptions th {
color: #fff;
padding: 3px 5px;
text-align: left;
font-family: initial;
font-weight: normal;
text-shadow: #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }
.parameters td, .exceptions td {
padding: 3px 10px;
border-top: 1px solid #ddd;
vertical-align: top;
}
.parameters tr:first-child td, .exceptions tr:first-child td {
border-top: none;
}
.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
width: 100px;
}
.parameters td.prmType {
width: 120px;
}
table.exceptions table {
border-spacing: 0;
border-collapse: collapse;
width: 100%;
}
/* --- TOC --- */
.toc a {
text-decoration: none;
}
a .secno {
color: #000;
}
/* --- TABLE --- */
table.simple {
border-spacing: 0;
border-collapse: collapse;
border-bottom: 3px solid #005a9c;
}
.simple th {
background: #005a9c;
color: #fff;
padding: 3px 5px;
text-align: left;
}
.simple th[scope="row"] {
background: inherit;
color: inherit;
border-top: 1px solid #ddd;
}
.simple td {
padding: 3px 10px;
border-top: 1px solid #ddd;
}
.simple tr:nth-child(even) {
background: #f0f6ff;
}
/* --- DL --- */
.section dd > p:first-child {
margin-top: 0;
}
.section dd > p:last-child {
margin-bottom: 0;
}
.section dd {
margin-bottom: 1em;
}
.section dl.attrs dd, .section dl.eldef dd {
margin-bottom: 0;
}
/* --- EXAMPLES --- */
pre.example {
border-top: 1px solid #ff4500;
border-bottom: 1px solid #ff4500;
padding: 1em;
margin-top: 1em;
}
pre.example::before {
content: "Example";
display: block;
width: 150px;
background: #ff4500;
color: #fff;
font-family: initial;
padding: 3px;
font-weight: bold;
margin: -1em 0 1em -1em;
}
/* --- EDITORIAL NOTES --- */
.issue {
padding: 1em;
margin: 1em 0em 0em;
border: 1px solid #f00;
background: #ffc;
}
.issue::before {
content: "Issue";
display: block;
width: 150px;
margin: -1.5em 0 0.5em 0;
font-weight: bold;
border: 1px solid #f00;
background: #fff;
padding: 3px 1em;
}
.note {
margin: 1em 0em 0em;
padding: 1em;
border: 2px solid #cff6d9;
background: #e2fff0;
}
.note::before {
content: "Note";
display: block;
width: 150px;
margin: -1.5em 0 0.5em 0;
font-weight: bold;
border: 1px solid #cff6d9;
background: #fff;
padding: 3px 1em;
}
/* --- Best Practices --- */
div.practice {
border: solid #bebebe 1px;
margin: 2em 1em 1em 2em;
}
span.practicelab {
margin: 1.5em 0.5em 1em 1em;
font-weight: bold;
font-style: italic;
}
span.practicelab { background: #dfffff; }
span.practicelab {
position: relative;
padding: 0 0.5em;
top: -1.5em;
}
p.practicedesc {
margin: 1.5em 0.5em 1em 1em;
}
@media screen {
p.practicedesc {
position: relative;
top: -2em;
padding: 0;
margin: 1.5em 0.5em -1em 1em;
}
}
/* --- SYNTAX HIGHLIGHTING --- */
pre.sh_sourceCode {
background-color: white;
color: black;
font-style: normal;
font-weight: normal;
}
pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; } /* language keywords */
pre.sh_sourceCode .sh_type { color: #666; } /* basic types */
pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
pre.sh_sourceCode .sh_specialchar { color: #ffc0cb; font-family: monospace; } /* e.g., \n, \t, \\ */
pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; } /* comments */
pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; } /* e.g., #include, import */
pre.sh_sourceCode .sh_symbol { color: blue; } /* e.g., *, + */
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; } /* TODO and FIXME */
/* Predefined variables and functions (for instance glsl) */
pre.sh_sourceCode .sh_predef_var { color: #00008B; }
pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }
/* for OOP */
pre.sh_sourceCode .sh_classname { color: teal; }
/* line numbers (not yet implemented) */
pre.sh_sourceCode .sh_linenum { display: none; }
/* Internet related */
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
/* for ChangeLog and Log files */
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }
/* for Prolog, Perl... */
pre.sh_sourceCode .sh_variable { color: #006400; }
/* for LaTeX */
pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
pre.sh_sourceCode .sh_argument { color: #006400; }
pre.sh_sourceCode .sh_optionalargument { color: purple; }
pre.sh_sourceCode .sh_math { color: orange; }
pre.sh_sourceCode .sh_bibtex { color: blue; }
/* for diffs */
pre.sh_sourceCode .sh_oldfile { color: orange; }
pre.sh_sourceCode .sh_newfile { color: #006400; }
pre.sh_sourceCode .sh_difflines { color: blue; }
/* for css */
pre.sh_sourceCode .sh_selector { color: purple; }
pre.sh_sourceCode .sh_property { color: blue; }
pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }
/* other */
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
pre.sh_sourceCode .sh_paren { color: red; }
pre.sh_sourceCode .sh_attribute { color: #006400; }
</style><link href="http://www.w3.org/StyleSheets/TR/W3C-WD" rel="stylesheet" type="text/css" charset="utf-8"></head><body style="display: inherit; "><div class="head"><p><a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a></p><h1 class="title" id="title">XML Encryption Syntax and Processing Version 1.1</h1><h2 id="w3c-working-draft-05-january-2012"><acronym title="World Wide Web Consortium">W3C</acronym> Working Draft 05 January 2012</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2012/WD-xmlenc-core1-20120105/">http://www.w3.org/TR/2012/WD-xmlenc-core1-20120105/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/xmlenc-core1/">http://www.w3.org/TR/xmlenc-core1/</a></dd><dt>Latest editor's draft:</dt><dd><a href="http://www.w3.org/2008/xmlsec/Drafts/xmlenc-core-11/">http://www.w3.org/2008/xmlsec/Drafts/xmlenc-core-11/</a></dd><dt>Previous version:</dt><dd><a href="http://www.w3.org/TR/2011/CR-xmlenc-core1-20110303/">http://www.w3.org/TR/2011/CR-xmlenc-core1-20110303/</a></dd><dt>Latest recommendation:</dt><dd><a href="http://www.w3.org/TR/xmlenc-core/">http://www.w3.org/TR/xmlenc-core/</a></dd><dt>Editors:</dt><dd><span>Donald Eastlake</span>, <span class="ed_mailto"><a href="mailto:d3e3e3@gmail.com">d3e3e3@gmail.com</a></span> </dd>
<dd><span>Joseph Reagle</span>, <span class="ed_mailto"><a href="mailto:reagle@mit.edu">reagle@mit.edu</a></span> </dd>
<dd><span>Frederick Hirsch</span>, <span class="ed_mailto"><a href="mailto:frederick.hirsch@nokia.com">frederick.hirsch@nokia.com</a></span> ( 1.1 )</dd>
<dd><span>Thomas Roessler</span>, <span class="ed_mailto"><a href="mailto:tlr@w3.org">tlr@w3.org</a></span> ( 1.1 )</dd>
<dt>Authors:</dt><dd><span>Takeshi Imamura</span>, <span class="ed_mailto"><a href="mailto:IMAMU@jp.ibm.com">IMAMU@jp.ibm.com</a></span> </dd>
<dd><span>Blair Dillaway</span>, <span class="ed_mailto"><a href="mailto:blaird@microsoft.com">blaird@microsoft.com</a></span> </dd>
<dd><span>Ed Simon</span>, <span class="ed_mailto"><a href="mailto:edsimon@xmlsec.com">edsimon@xmlsec.com</a></span> </dd>
<dd><span>Kelvin Yiu</span>, <span class="ed_mailto"><a href="mailto:kelviny@microsoft.com">kelviny@microsoft.com</a></span> ( 1.1 )</dd>
<dd><span>Magnus Nyström</span>, <span class="ed_mailto"><a href="mailto:mnystrom@microsoft.com">mnystrom@microsoft.com</a></span> ( 1.1 )</dd>
</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2012 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. <acronym title="World Wide Web Consortium">W3C</acronym> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p><hr></div>
<div id="abstract" class="introductory section"><h2>Abstract</h2>
<p>This document specifies a process for encrypting data and
representing the result in XML. The data may be in a variety
of formats, including octet streams and other unstructured
data, or structured data formats such as XML documents, an
XML element, or XML element content. The result of
encrypting data is an XML Encryption element that contains or
references the cipher data.</p>
</div><div id="sotd" class="introductory section"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <acronym title="World Wide Web Consortium">W3C</acronym> publications and the latest revision of this technical report can be found in the <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym> technical reports index</a> at http://www.w3.org/TR/.</em></p>
<p>At the time of this publication, the most recent <acronym title="World Wide Web Consortium">W3C</acronym>
Recommendation of XML Encryption 1 is the
<a href="http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/">10
December 2002 XML Encryption Recommendation</a>. Please
review <a href="Overview-diff-rec.html">differences between the
previous XML Encryption Recommendation and this Working
Draft</a>; a detailed <a href="explain.html">explanation of
changes</a> is also available.
</p>
<p>Conformance-affecting changes against this previous
recommendation mainly affect the set of
mandatory to implement cryptographic algorithms, by adding Elliptic
Curve Diffie-Hellman Key Agreement, making AES-128 GCM
mandatory and adding optional RSA-OEAP algorithm variants. </p>
<p>The most recent publication of this draft is the
<a href="http://www.w3.org/TR/2011/CR-xmlenc-core1-20110303/">CR draft of
March 2011</a>. Changes since that publication include the
following substantive changes:
</p><ul>
<li> Added type='anyURI' to Algorithm for AlgorithmIdentifierType.</li>
<li> Made AES-128-GCM mandatory and added warnings for CBC block
encryption algorithms and the related reference.</li>
<li> Added a new algorithm for RSA-OAEP that allows definition of mask generation function, with new URI.</li>
<li> Added URI definitions for MGF1 with SHA*, add RFC 4055 reference.</li>
<li> Revised the security considerations section.</li>
</ul>
Editorial changes include:
<ul>
<li>Changed "[XMLENC-CORE1]" to "(XMLENC-CORE1, this document)" in the
media type section to avoid generating normative self reference, to
resolve LC-2541.</li>
<li>Revised the base64 note in algorithms section, and added an item for
Encoding in 3.1. Clarifications to resolve LC-2542.</li>
<li> Namespace denoting ("&xenc;") related edits.</li>
<li> Added a Note re ConcatKDF nonce in section 5.4.1.</li>
<li> Added clarification on PBKDF2 key length.</li>
<li> Minor spelling and formatting fixes.</li>
</ul>
Please review <a href="Overview_diff.html">differences between the
previous CR draft and this Working Draft</a>.
<p><strong>Patent disclosures on this specification.</strong> <acronym title="World Wide Web Consortium">W3C</acronym>
has received several patent disclosures regarding this
specification and its use of Elliptic Curve cryptography. In accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Exception">section
7 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>, the staff has launched a <a href="http://www.w3.org/2011/xmlsec-pag/Overview.html">Patent
Advisory Group (PAG)</a> to address them. Please refer to the
<a href="http://www.w3.org/2011/02/xmlsec-pag-charter.html">PAG charter</a> for more details.</p>
<p>This document was published by the <a href="http://www.w3.org/2008/xmlsec/">XML Security Working Group</a> as a Last Call Working Draft. This document is intended to become a <acronym title="World Wide Web Consortium">W3C</acronym> Recommendation. If you wish to make comments regarding this document, please send them to <a href="mailto:public-xmlsec@w3.org">public-xmlsec@w3.org</a> (<a href="mailto:public-xmlsec-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-xmlsec/">archives</a>). The Last Call period ends 16 February 2012. All feedback is welcome.</p><p>Publication as a Working Draft does not imply endorsement by the <acronym title="World Wide Web Consortium">W3C</acronym> Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p><p>This is a Last Call Working Draft and thus the Working Group has determined that this document has satisfied the relevant technical requirements and is sufficiently stable to advance through the Technical Recommendation process.</p><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>. <acronym title="World Wide Web Consortium">W3C</acronym> maintains a <a href="http://www.w3.org/2004/01/pp-impl/42458/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <acronym title="World Wide Web Consortium">W3C</acronym> Patent Policy</a>.</p><p><a href="http://www.w3.org/2011/02/09-xmlsec-status.html">Additional information related to the IPR status of XML Signature 1.1</a> is available.</p></div><div id="toc" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#sec-Introduction" class="tocxref"><span class="secno">1. </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#sec-Editorial" class="tocxref"><span class="secno">1.1 </span>Editorial and Conformance Conventions</a></li><li class="tocline"><a href="#sec-Design" class="tocxref"><span class="secno">1.2 </span>Design Philosophy</a></li><li class="tocline"><a href="#sec-Versions" class="tocxref"><span class="secno">1.3 </span>Versions, Namespaces, URIs, and Identifiers</a></li><li class="tocline"><a href="#sec-Acknowledgements" class="tocxref"><span class="secno">1.4 </span>Acknowledgements</a></li></ul></li><li class="tocline"><a href="#sec-Overview" class="tocxref"><span class="secno">2. </span>Encryption Overview and Examples</a><ul class="toc"><li class="tocline"><a href="#sec-eg-Granularity" class="tocxref"><span class="secno">2.1 </span>Encryption Granularity</a><ul class="toc"><li class="tocline"><a href="#sec-eg-Element" class="tocxref"><span class="secno">2.1.1 </span>Encrypting an XML Element</a></li><li class="tocline"><a href="#sec-eg-Element-Content" class="tocxref"><span class="secno">2.1.2 </span>Encrypting XML Element Content (Elements)</a></li><li class="tocline"><a href="#sec-eg-Element-Content-Character" class="tocxref"><span class="secno">2.1.3 </span>Encrypting XML Element Content (Character
Data)</a></li><li class="tocline"><a href="#sec-eg-Arbitrary-Data" class="tocxref"><span class="secno">2.1.4 </span>Encrypting Arbitrary Data and XML Documents</a></li><li class="tocline"><a href="#sec-eg-Super-Encryption" class="tocxref"><span class="secno">2.1.5 </span>Super-Encryption: Encrypting EncryptedData</a></li></ul></li><li class="tocline"><a href="#sec-Usage" class="tocxref"><span class="secno">2.2 </span><code>EncryptedData</code> and <code>EncryptedKey</code> Usage</a><ul class="toc"><li class="tocline"><a href="#sec-eg-Symmetric-Key" class="tocxref"><span class="secno">2.2.1 </span><code>EncryptedData</code> with Symmetric Key (<code>KeyName</code>)</a></li><li class="tocline"><a href="#sec-eg-EncryptedKey" class="tocxref"><span class="secno">2.2.2 </span><code>EncryptedKey</code>
(<code>ReferenceList</code>, <code>ds:RetrievalMethod</code>,
<code>CarriedKeyName</code>)</a></li></ul></li></ul></li><li class="tocline"><a href="#sec-Encryption-Syntax" class="tocxref"><span class="secno">3. </span>Encryption Syntax</a><ul class="toc"><li class="tocline"><a href="#sec-EncryptedType" class="tocxref"><span class="secno">3.1 </span>The <code>EncryptedType</code> Element</a></li><li class="tocline"><a href="#sec-EncryptionMethod" class="tocxref"><span class="secno">3.2 </span>The <code>EncryptionMethod</code> Element</a></li><li class="tocline"><a href="#sec-CipherData" class="tocxref"><span class="secno">3.3 </span>The <code>CipherData</code> Element</a><ul class="toc"><li class="tocline"><a href="#sec-CipherReference" class="tocxref"><span class="secno">3.3.1 </span>The <code>CipherReference</code> Element</a></li></ul></li><li class="tocline"><a href="#sec-EncryptedData" class="tocxref"><span class="secno">3.4 </span>The <code>EncryptedData</code> Element</a></li><li class="tocline"><a href="#sec-Extensions-to-KeyInfo" class="tocxref"><span class="secno">3.5 </span>Extensions to <code>ds:KeyInfo</code> Element</a><ul class="toc"><li class="tocline"><a href="#sec-EncryptedKey" class="tocxref"><span class="secno">3.5.1 </span>The <code>EncryptedKey</code> Element</a></li><li class="tocline"><a href="#sec-DerivedKey" class="tocxref"><span class="secno">3.5.2 </span>The <code>DerivedKey</code> Element</a></li><li class="tocline"><a href="#sec-ds-RetrievalMethod" class="tocxref"><span class="secno">3.5.3 </span>The <code>ds:RetrievalMethod</code> Element</a></li></ul></li><li class="tocline"><a href="#sec-ReferenceList" class="tocxref"><span class="secno">3.6 </span>The <code>ReferenceList</code> Element</a></li><li class="tocline"><a href="#sec-EncryptionProperties" class="tocxref"><span class="secno">3.7 </span>The <code>EncryptionProperties</code> Element</a></li></ul></li><li class="tocline"><a href="#sec-Processing" class="tocxref"><span class="secno">4. </span>Processing Rules</a><ul class="toc"><li class="tocline"><a href="#sec-Intended-Processing" class="tocxref"><span class="secno">4.1 </span>Intended Application Model</a></li><li class="tocline"><a href="#sec-Type-Parameters" class="tocxref"><span class="secno">4.2 </span>Well-known <code>Type</code> parameter values</a></li><li class="tocline"><a href="#sec-Processing-Encryption" class="tocxref"><span class="secno">4.3 </span>Encryption</a></li><li class="tocline"><a href="#sec-Processing-Decryption" class="tocxref"><span class="secno">4.4 </span>Decryption</a></li><li class="tocline"><a href="#sec-Processing-XML" class="tocxref"><span class="secno">4.5 </span>XML Encryption</a><ul class="toc"><li class="tocline"><a href="#sec-Decrypt-Imp" class="tocxref"><span class="secno">4.5.1 </span>A Decrypt
Implementation (Non-normative)</a></li><li class="tocline"><a href="#sec-Decrypt-Replace-Imp" class="tocxref"><span class="secno">4.5.2 </span>A Decrypt and Replace Implementation (Non-normative)</a></li><li class="tocline"><a href="#sec-Serializing-XML" class="tocxref"><span class="secno">4.5.3 </span>Serializing XML (Non-normative)</a><ul class="toc"><li class="tocline"><a href="#sec-Default-Namespace-Considerations" class="tocxref"><span class="secno">4.5.3.1 </span>Default Namespace Considerations</a></li><li class="tocline"><a href="#sec-XML-Attribute-Considerations" class="tocxref"><span class="secno">4.5.3.2 </span>XML Attribute Considerations</a></li></ul></li><li class="tocline"><a href="#sec-Text-Wrapping" class="tocxref"><span class="secno">4.5.4 </span>Text Wrapping</a></li></ul></li></ul></li><li class="tocline"><a href="#sec-Algorithms" class="tocxref"><span class="secno">5. </span>Algorithms</a><ul class="toc"><li class="tocline"><a href="#sec-AlgID" class="tocxref"><span class="secno">5.1 </span>Algorithm Identifiers and Implementation Requirements</a><ul class="toc"><li class="tocline"><a href="#sec-Table-of-Algorithms" class="tocxref"><span class="secno">5.1.1 </span>Table of Algorithms</a></li></ul></li><li class="tocline"><a href="#sec-Alg-Block" class="tocxref"><span class="secno">5.2 </span>Block Encryption Algorithms</a><ul class="toc"><li class="tocline"><a href="#sec-Padding" class="tocxref"><span class="secno">5.2.1 </span>Padding</a></li><li class="tocline"><a href="#sec-tripledes-cbc" class="tocxref"><span class="secno">5.2.2 </span>Triple DES</a></li><li class="tocline"><a href="#sec-AES" class="tocxref"><span class="secno">5.2.3 </span>AES</a></li><li class="tocline"><a href="#sec-AES-GCM" class="tocxref"><span class="secno">5.2.4 </span>AES-GCM</a></li></ul></li><li class="tocline"><a href="#sec-Alg-Stream" class="tocxref"><span class="secno">5.3 </span>Stream Encryption Algorithms</a></li><li class="tocline"><a href="#sec-Alg-KeyDerivation" class="tocxref"><span class="secno">5.4 </span>Key Derivation</a><ul class="toc"><li class="tocline"><a href="#sec-ConcatKDF" class="tocxref"><span class="secno">5.4.1 </span>ConcatKDF</a></li><li class="tocline"><a href="#sec-PBKDF2" class="tocxref"><span class="secno">5.4.2 </span>PBKDF2</a></li></ul></li><li class="tocline"><a href="#sec-Alg-KeyTransport" class="tocxref"><span class="secno">5.5 </span>Key Transport</a><ul class="toc"><li class="tocline"><a href="#sec-RSA-1_5" class="tocxref"><span class="secno">5.5.1 </span>RSA Version 1.5</a></li><li class="tocline"><a href="#sec-RSA-OAEP" class="tocxref"><span class="secno">5.5.2 </span>RSA-OAEP</a></li></ul></li><li class="tocline"><a href="#sec-Alg-KeyAgreement" class="tocxref"><span class="secno">5.6 </span>Key Agreement</a><ul class="toc"><li class="tocline"><a href="#sec-DHKeyValue" class="tocxref"><span class="secno">5.6.1 </span>Diffie-Hellman Key
Values</a></li><li class="tocline"><a href="#sec-DHKeyAgreement" class="tocxref"><span class="secno">5.6.2 </span>Diffie-Hellman
Key Agreement</a><ul class="toc"><li class="tocline"><a href="#sec-DHKeyAgreementExplicitKDF" class="tocxref"><span class="secno">5.6.2.1 </span>Diffie-Hellman Key Agreement with Explicit Key Derivation Functions</a></li><li class="tocline"><a href="#sec-DHKeyAgreementLegacyKDF" class="tocxref"><span class="secno">5.6.2.2 </span>Diffie-Hellman
Key Agreement with Legacy Key Derivation Function</a></li></ul></li><li class="tocline"><a href="#sec-ECCKeyValue" class="tocxref"><span class="secno">5.6.3 </span>Elliptic Curve Diffie-Hellman (ECDH) Key
Values</a></li><li class="tocline"><a href="#sec-ECDH-ES" class="tocxref"><span class="secno">5.6.4 </span>Elliptic Curve Diffie-Hellman (ECDH)
Key Agreement (Ephemeral-Static Mode)</a></li></ul></li><li class="tocline"><a href="#sec-Alg-SymmetricKeyWrap" class="tocxref"><span class="secno">5.7 </span>Symmetric Key Wrap</a><ul class="toc"><li class="tocline"><a href="#sec-kw-tripledes" class="tocxref"><span class="secno">5.7.1 </span>CMS Triple DES Key
Wrap</a></li><li class="tocline"><a href="#sec-kw-aes" class="tocxref"><span class="secno">5.7.2 </span>AES KeyWrap</a></li><li class="tocline"><a href="#sec-kw-aes-with-pad" class="tocxref"><span class="secno">5.7.3 </span>AES KeyWrap with Padding</a></li></ul></li><li class="tocline"><a href="#sec-Alg-MessageDigest" class="tocxref"><span class="secno">5.8 </span>Message Digest</a><ul class="toc"><li class="tocline"><a href="#sec-SHA1" class="tocxref"><span class="secno">5.8.1 </span>SHA1</a></li><li class="tocline"><a href="#sec-SHA256" class="tocxref"><span class="secno">5.8.2 </span>SHA256</a></li><li class="tocline"><a href="#sec-SHA384" class="tocxref"><span class="secno">5.8.3 </span>SHA384</a></li><li class="tocline"><a href="#sec-SHA512" class="tocxref"><span class="secno">5.8.4 </span>SHA512</a></li><li class="tocline"><a href="#sec-RIPEMD-160" class="tocxref"><span class="secno">5.8.5 </span>RIPEMD-160</a></li></ul></li><li class="tocline"><a href="#sec-Alg-Canonicalition" class="tocxref"><span class="secno">5.9 </span>Canonicalization</a><ul class="toc"><li class="tocline"><a href="#sec-Inclusive-Canonicalization" class="tocxref"><span class="secno">5.9.1 </span>Inclusive
Canonicalization</a></li><li class="tocline"><a href="#sec-Exclusive-Canonicalization" class="tocxref"><span class="secno">5.9.2 </span>Exclusive
Canonicalization</a></li></ul></li></ul></li><li class="tocline"><a href="#sec-Security" class="tocxref"><span class="secno">6. </span>Security Considerations</a><ul class="toc"><li class="tocline"><a href="#sec-chosen-ciphertext-attacks" class="tocxref"><span class="secno">6.1 </span>Chosen-Ciphertext Attacks</a><ul class="toc"><li class="tocline"><a href="#sec-edata-attacks" class="tocxref"><span class="secno">6.1.1 </span> Attacks against the encrypted data (<code><EncryptedData></code> part)</a></li><li class="tocline"><a href="#sec-bleichenbacher-attack" class="tocxref"><span class="secno">6.1.2 </span>Attacks against the encrypted key (Bleichenbacher's Million
question attack on PKCS#1.5)</a></li></ul></li><li class="tocline"><a href="#sec-Sign-with-Encrypt" class="tocxref"><span class="secno">6.2 </span>Relationship to XML Digital Signatures</a></li><li class="tocline"><a href="#sec-InformationRevealed" class="tocxref"><span class="secno">6.3 </span>Information Revealed</a></li><li class="tocline"><a href="#sec-Nonce" class="tocxref"><span class="secno">6.4 </span>Nonce and IV (Initialization Value or Vector)</a></li><li class="tocline"><a href="#sec-Denial" class="tocxref"><span class="secno">6.5 </span>Denial of Service</a></li><li class="tocline"><a href="#sec-Unsafe-Content" class="tocxref"><span class="secno">6.6 </span>Unsafe Content</a></li><li class="tocline"><a href="#sec-Errors" class="tocxref"><span class="secno">6.7 </span>Error Messages</a></li><li class="tocline"><a href="#sec-TimingAttacks" class="tocxref"><span class="secno">6.8 </span>Timing Attacks</a></li><li class="tocline"><a href="#sec-cbcBlockEncryptionAttacks" class="tocxref"><span class="secno">6.9 </span>CBC Block Encryption Vulnerability</a></li></ul></li><li class="tocline"><a href="#sec-Conformance" class="tocxref"><span class="secno">7. </span>Conformance</a></li><li class="tocline"><a href="#sec-MediaType" class="tocxref"><span class="secno">8. </span>XML Encryption Media Type</a><ul class="toc"><li class="tocline"><a href="#sec-MediaType-Introduction" class="tocxref"><span class="secno">8.1 </span>Introduction</a></li><li class="tocline"><a href="#sec-MediaType-Registration" class="tocxref"><span class="secno">8.2 </span>application/xenc+xml Registration</a></li></ul></li><li class="tocline"><a href="#sec-Schema" class="tocxref"><span class="secno">9. </span>Schema</a><ul class="toc"><li class="tocline"><a href="#sec-xsdSchema" class="tocxref"><span class="secno">9.1 </span>XSD Schema</a></li><li class="tocline"><a href="#sec-rngSchema" class="tocxref"><span class="secno">9.2 </span>RNG Schema</a></li></ul></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">A.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.2 </span>Informative references</a></li></ul></li></ul></div>
<div id="sec-Introduction" class="section">
<!--OddPage--><h2><span class="secno">1. </span>Introduction</h2>
<p>This document specifies a process for encrypting data and representing the
result in XML. The data may be arbitrary data (including an XML document), an
XML element, or XML element content. The result of encrypting data is an XML
Encryption <code>EncryptedData</code> element that contains (via one of its
children's content) or identifies (via a URI reference) the cipher data.</p>
<p>When encrypting an XML element or element content the
<code>EncryptedData</code> element replaces the element or content
(respectively) in the encrypted version of the XML document.</p>
<p>When encrypting arbitrary data (including entire XML documents), the
<code>EncryptedData</code> element may become the root of a new XML document
or become a child element in an application-chosen XML document.</p>
<div id="sec-Editorial" class="section">
<h3><span class="secno">1.1 </span>Editorial and Conformance Conventions</h3>
<p>This specification uses XML schemas [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-1">XMLSCHEMA-1</a></cite>],
[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-2">XMLSCHEMA-2</a></cite>] to describe the content model.
The full normative grammar is defined by the XSD schema
and the normative text in this specification. The standalone XSD
schema file is authoritative in case there is any disagreement between
it and the XSD schema portions.
</p>
<p>The key words "<em class="rfc2119" title="must">must</em>", "<em class="rfc2119" title="must not">must not</em>", "<em class="rfc2119" title="required">required</em>", "<em class="rfc2119" title="shall">shall</em>", "<em class="rfc2119" title="shall not">shall not</em>",
"<em class="rfc2119" title="should">should</em>", "<em class="rfc2119" title="should not">should not</em>", "<em class="rfc2119" title="recommended">recommended</em>", "<em class="rfc2119" title="may">may</em>", and "<em class="rfc2119" title="optional">optional</em>" in this
specification are to be interpreted as described in [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2119">RFC2119</a></cite>]:</p>
<blockquote>
<p>"They <em class="rfc2119" title="must">must</em> only be used where it is actually required for interoperation
or to limit behavior which has potential for causing harm (e.g., limiting
retransmissions)"</p>
</blockquote>
<p>Consequently, we use these capitalized keywords to unambiguously specify
requirements over protocol and application features and behavior that affect
the interoperability and security of implementations. These key words are not
used (capitalized) to describe XML grammar; schema definitions unambiguously
describe such requirements and we wish to reserve the prominence of these
terms for the natural language descriptions of protocols and features. For
instance, an XML attribute might be described as being "optional." Compliance
with the XML-namespace specification [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-NAMES">XML-NAMES</a></cite>] is
described as "<em class="rfc2119" title="required">required</em>."</p>
</div>
<div id="sec-Design" class="section">
<h3><span class="secno">1.2 </span>Design Philosophy</h3>
<p>The design philosophy and requirements of this specification (including
the limitations related to instance validity) are addressed in the
original <a href="http://www.w3.org/TR/xml-encryption-req">XML Encryption
Requirements</a> [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-ENCRYPTION-REQ">XML-ENCRYPTION-REQ</a></cite>]
and the XML Security 1.1 Requirements document [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSEC11-REQS">XMLSEC11-REQS</a></cite>].
</p>
</div>
<div id="sec-Versions" class="section">
<h3><span class="secno">1.3 </span>Versions, Namespaces, URIs, and Identifiers</h3>
<p>This specification makes use of XML namespaces, and uses Uniform
Resource Identifiers [<cite><a class="bibref" rel="biblioentry" href="#bib-URI">URI</a></cite>] to identify resources, algorithms, and
semantics.</p>
<p>Implementations of this specification <em class="rfc2119" title="must">must</em> use the following XML
namespace URIs:</p>
<table class="namespaces">
<thead>
<tr><th>URI</th><th>namespace prefix</th><th>XML internal entity</th></tr>
</thead>
<tbody>
<tr><td><code>http://www.w3.org/2001/04/xmlenc#</code></td><td><i>default namespace</i>,
<code>xenc:</code></td><td><code><!ENTITY xenc "http://www.w3.org/2001/04/xmlenc#"></code></td></tr>
<tr><td><code>http://www.w3.org/2009/xmlenc11#</code></td><td><code>xenc11:</code></td><td><code><!ENTITY xenc11 "http://www.w3.org/2009/xmlenc11#"></code></td></tr>
</tbody>
</table>
<p>The <code>http://www.w3.org/2001/04/xmlenc#</code> (<code>xenc:</code>) namespace was
introduced in version 1.0 of this specification. The present version does not coin any new
elements or algorithm identifiers in that namespace; instead, the
<code>http://www.w3.org/2009/xmlenc11#</code> (<code>xenc11:</code>)
namespace
is used.</p>
<p>No provision is made for an explicit version number in this syntax. If a future version of
this specification requires explicit versioning of the document format, a different namespace will
be used.</p>
<p>Additionally, this specification uses elements and algorithm identifiers from the XML Signature name spaces [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>]:</p>
<table class="namespaces">
<thead>
<tr><th>URI</th><th>namespace prefix</th><th>XML internal entity</th></tr>
</thead>
<tbody>
<tr><td><code>http://www.w3.org/2000/09/xmldsig#</code></td><td><i>default namespace</i>,
<code>ds:</code>, <code>dsig:</code></td><td><code><!ENTITY dsig "http://www.w3.org/2000/09/xmldsig#"></code></td></tr>
<tr><td><code>http://www.w3.org/2009/xmldsig11#</code></td><td><code>dsig11:</code></td><td><code><!ENTITY dsig11 "http://www.w3.org/2009/xmldsig11#"></code></td></tr>
</tbody>
</table>
</div>
<div id="sec-Acknowledgements" class="section">
<h3><span class="secno">1.4 </span>Acknowledgements</h3>
<p>The contributions of the following Working Group members to this specification are gratefully
acknowledged in accordance with the <a href="http://www.w3.org/Encryption/2001/Contributor.html">contributor policies</a> and the active <a href="http://www.w3.org/Encryption/2001/Participants.html">WG roster</a>: Joseph Ashwood, Simon
Blake-Wilson, Certicom, Frank D. Cavallito, BEA Systems, Eric Cohen, PricewaterhouseCoopers, Blair
Dillaway, Microsoft (Author), Blake Dournaee, RSA Security, Donald Eastlake, Motorola (Editor), Barb
Fox, Microsoft, Christian Geuer-Pollmann, University of Siegen, Tom Gindin, IBM, Jiandong Guo,
Phaos, Phillip Hallam-Baker, Verisign, Amir Herzberg, NewGenPay, Merlin Hughes, Baltimore, Frederick
Hirsch, Maryann Hondo, IBM, Takeshi Imamura, IBM (Author), Mike Just, Entrust, Inc., Brian
LaMacchia, Microsoft, Hiroshi Maruyama, IBM, John Messing, Law-on-Line, Shivaram Mysore, Sun
Microsystems, Thane Plambeck, Verisign, Joseph Reagle, <acronym title="World Wide Web Consortium">W3C</acronym> (Chair, Editor), Aleksey Sanin, Jim
Schaad, Soaring Hawk Consulting, Ed Simon, XMLsec (Author), Daniel Toth, Ford, Yongge Wang,
Certicom, Steve Wiley, myProof.
</p>
<p>Additionally, we thank the following for their comments during and subsequent to Last Call:
Martin Dürst, <acronym title="World Wide Web Consortium">W3C</acronym>, Dan Lanz, Zolera, Susan Lesch, <acronym title="World Wide Web Consortium">W3C</acronym>, David Orchard, BEA Systems, Ronald
Rivest, <acronym title="Massachusetts Institute of Technology">MIT</acronym>.</p>
<p>Contributions for version 1.1 were received from the members of the XML Security Working Group:
Scott Cantor, Juan Carlos Cruellas, Pratik Datta, Gerald Edgar, Ken Graf, Phillip Hallam-Baker, Brad
Hill, Frederick Hirsch, Brian LaMacchia, Konrad Lanz, Hal Lockhart, Cynthia Martin, Rob Miller, Sean
Mullan, Shivaram Mysore, Magnus Nyström, Bruce Rich, Thomas Roessler, Ed Simon, Chris Solc, John
Wray, Kelvin Yiu.</p>
<p>The working group also acknowledges the contribution of Juraj
Somorovsky raising the issue of the CBC chosen ciphertext attack
and contributions to revising the security considerations of XML
Encryption 1.1.</p>
</div>
</div>
<div id="sec-Overview" class="informative section">
<!--OddPage--><h2><span class="secno">2. </span>Encryption Overview and Examples</h2><p><em>This section is non-normative.</em></p>
<p>This section provides an overview and examples of XML Encryption syntax.
The formal syntax is found in <a class="sectionRef" href="#sec-Encryption-Syntax">section 3. Encryption Syntax</a> ; the specific
processing is given in <a class="link-sec" href="http://www.w3.org/TR/2000/WD-xmldsig-core-20000104/#sec-Processing">Processing
Rules</a> (section 4).</p>
<p>Expressed in shorthand form, the <code><a href="#sec-EncryptedData">EncryptedData</a></code> element has the following
structure (where "?" denotes zero or one occurrence; "+" denotes one or more
occurrences; "*" denotes zero or more occurrences; "|" denotes a choice; and the empty element tag
means the element must be empty ):</p>
<pre class="sh_xml sh_sourceCode"> <span class="sh_keyword"><EncryptedData</span> <span class="sh_type">Id?</span><span class="sh_normal"> </span><span class="sh_type">Type?</span><span class="sh_normal"> </span><span class="sh_type">MimeType?</span><span class="sh_normal"> </span><span class="sh_type">Encoding?</span><span class="sh_keyword">></span>
<span class="sh_keyword"><EncryptionMethod/></span>?
<span class="sh_keyword"><ds:KeyInfo></span>
<span class="sh_keyword"><EncryptedKey></span>?
<span class="sh_keyword"><AgreementMethod></span>?
<span class="sh_keyword"><ds:KeyName></span>?
<span class="sh_keyword"><ds:RetrievalMethod></span>?
<span class="sh_keyword"><ds:</span><span class="sh_type">*</span><span class="sh_keyword">></span>?
<span class="sh_keyword"></ds:KeyInfo></span>?
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span> | <span class="sh_keyword"><CipherReference</span> <span class="sh_type">URI?</span><span class="sh_keyword">></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"><EncryptionProperties></span>?
<span class="sh_keyword"></EncryptedData></span></pre>
<p>The <code>CipherData</code> element envelopes or references the raw
encrypted data. A <code>CipherData</code> element must have either a <code>CipherValue</code> or <code>CipherReference</code> child element. If enveloping, the raw encrypted data is the
<code>CipherValue</code> element's content; if referencing, the
<code>CipherReference</code> element's <code>URI</code> attribute points to
the location of the raw encrypted data</p>
<div id="sec-eg-Granularity" class="section">
<h3><span class="secno">2.1 </span>Encryption Granularity</h3>
<p>Note: Examples in this document do not consider plaintext guessing
attacks or other risks, and are only for illustrative purposes.</p>
<p>Consider the following fictitious payment information, which includes
identification information and information appropriate to a payment method
(e.g., credit card, money transfer, or electronic check):</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span><span class="sh_preproc">?></span>
<span class="sh_keyword"><PaymentInfo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/paymentv2"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><Name></span>John Smith<span class="sh_keyword"></Name></span>
<span class="sh_keyword"><CreditCard</span> <span class="sh_type">Limit</span><span class="sh_symbol">=</span><span class="sh_string">"5,000"</span> <span class="sh_type">Currency</span><span class="sh_symbol">=</span><span class="sh_string">"USD"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><Number></span>4019 2445 0277 5567<span class="sh_keyword"></Number></span>
<span class="sh_keyword"><Issuer></span>Example Bank<span class="sh_keyword"></Issuer></span>
<span class="sh_keyword"><Expiration></span>04/02<span class="sh_keyword"></Expiration></span>
<span class="sh_keyword"></CreditCard></span>
<span class="sh_keyword"></PaymentInfo></span></pre>
<p>This markup represents that John Smith is using his credit card with a
limit of $5,000USD.</p>
<div id="sec-eg-Element" class="section">
<h4><span class="secno">2.1.1 </span>Encrypting an XML Element</h4>
<p>Smith's credit card number is sensitive information! If the application
wishes to keep that information confidential, it can encrypt the
<code>CreditCard</code> element:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span><span class="sh_preproc">?></span>
<span class="sh_keyword"><PaymentInfo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/paymentv2"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><Name></span>John Smith<span class="sh_keyword"></Name></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#Element"</span>
<span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>A23B45C56<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span>
<span class="sh_keyword"></PaymentInfo></span></pre>
<p>By encrypting the entire <code>CreditCard</code> element from its start to
end tags, the identity of the element itself is hidden. (An eavesdropper
doesn't know whether he used a credit card or money transfer.) The
<code>CipherData</code> element contains the encrypted serialization of the
<code>CreditCard</code> element.</p>
</div>
<div id="sec-eg-Element-Content" class="section">
<h4><span class="secno">2.1.2 </span>Encrypting XML Element Content (Elements)</h4>
<p>As an alternative scenario, it may be useful for intermediate agents to
know that John used a credit card with a particular limit, but not the card's
number, issuer, and expiration date. In this case, the content (character
data or children elements) of the <code>CreditCard</code> element can be
encrypted:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span><span class="sh_preproc">?></span>
<span class="sh_keyword"><PaymentInfo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/paymentv2"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><Name></span>John Smith<span class="sh_keyword"></Name></span>
<span class="sh_keyword"><CreditCard</span> <span class="sh_type">Limit</span><span class="sh_symbol">=</span><span class="sh_string">"5,000"</span> <span class="sh_type">Currency</span><span class="sh_symbol">=</span><span class="sh_string">"USD"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#Content"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>A23B45C56<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span>
<span class="sh_keyword"></CreditCard></span>
<span class="sh_keyword"></PaymentInfo></span></pre>
</div>
<div id="sec-eg-Element-Content-Character" class="section">
<h4><span class="secno">2.1.3 </span>Encrypting XML Element Content (Character
Data)</h4>
<p>Alternatively, consider the scenario in which all the information <em>except</em> the
actual credit card number can be in the clear, including the fact that the
Number element exists:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span><span class="sh_preproc">?></span>
<span class="sh_keyword"><PaymentInfo</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/paymentv2"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><Name></span>John Smith<span class="sh_keyword"></Name></span>
<span class="sh_keyword"><CreditCard</span> <span class="sh_type">Limit</span><span class="sh_symbol">=</span><span class="sh_string">"5,000"</span> <span class="sh_type">Currency</span><span class="sh_symbol">=</span><span class="sh_string">"USD"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><Number></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#Content"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>A23B45C56<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span>
<span class="sh_keyword"></Number></span>
<span class="sh_keyword"><Issuer></span>Example Bank<span class="sh_keyword"></Issuer></span>
<span class="sh_keyword"><Expiration></span>04/02<span class="sh_keyword"></Expiration></span>
<span class="sh_keyword"></CreditCard></span>
<span class="sh_keyword"></PaymentInfo></span></pre>
<p>Both <code>CreditCard</code> and <code>Number</code> are in the clear, but
the character data content of <code>Number</code> is encrypted.</p>
</div>
<div id="sec-eg-Arbitrary-Data" class="section">
<h4><span class="secno">2.1.4 </span>Encrypting Arbitrary Data and XML Documents</h4>
<p>If the application scenario requires all of the information to be
encrypted, the whole document is encrypted as an octet sequence. This applies
to arbitrary data including XML documents.</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span><span class="sh_preproc">?></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">MimeType</span><span class="sh_symbol">=</span><span class="sh_string">"text/xml"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>A23B45C56<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span></pre>
<p>
Where appropriate, such as in the case of encrypting an entire EXI
stream, the Type attribute <em class="rfc2119" title="should">should</em> be provided
and indicate the use of EXI. The optional MimeType <em class="rfc2119" title="may">may</em> be used to
record the actual (non-EXI-encoded) type, but is not necessary and may
be omitted, as in the following EXI encryption example:
</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span><span class="sh_preproc">?></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#EXI"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>A23B45C56<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span></pre>
</div>
<div id="sec-eg-Super-Encryption" class="section">
<h4><span class="secno">2.1.5 </span>Super-Encryption: Encrypting EncryptedData</h4>
<p>An XML document may contain zero or more <code>EncryptedData</code>
elements. <code>EncryptedData</code> cannot be the parent or child of another
<code>EncryptedData</code> element. However, the actual data encrypted can be
anything, including <code>EncryptedData</code> and <code>EncryptedKey</code>
elements (i.e., super-encryption). During super-encryption of an
<code>EncryptedData</code> or <code>EncryptedKey</code> element, one must
encrypt the entire element. Encrypting only the content of these elements, or
encrypting selected child elements is an invalid instance under the provided
schema.<br></p>
<p>For example, consider the following:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><pay:PaymentInfo</span> <span class="sh_type">xmlns:pay</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/paymentv2"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">Id</span><span class="sh_symbol">=</span><span class="sh_string">"ED1"</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#Element"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>originalEncryptedData<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span>
<span class="sh_keyword"></pay:PaymentInfo></span></pre>
<p>A valid super-encryption of "<code>//xenc:EncryptedData[@Id='ED1']</code>"
would be:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><pay:PaymentInfo</span> <span class="sh_type">xmlns:pay</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/paymentv2"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">Id</span><span class="sh_symbol">=</span><span class="sh_string">"ED2"</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#Element"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>newEncryptedData<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span>
<span class="sh_keyword"></pay:PaymentInfo></span></pre>
<p>where the <code>CipherValue</code> content of
'<code>newEncryptedData</code>' is the base64 encoding of the encrypted octet
sequence resulting from encrypting the <code>EncryptedData</code> element
with <code>Id='ED1'</code>.</p>
</div>
</div>
<div id="sec-Usage" class="section">
<h3><span class="secno">2.2 </span><code>EncryptedData</code> and <code>EncryptedKey</code> Usage</h3>
<div id="sec-eg-Symmetric-Key" class="section">
<h4><span class="secno">2.2.1 </span><code>EncryptedData</code> with Symmetric Key (<code>KeyName</code>)</h4>
<pre class="example sh_xml sh_sourceCode">[s1] <span class="sh_keyword"><EncryptedData</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#Element"</span><span class="sh_keyword">></span>
[s2] <span class="sh_keyword"><EncryptionMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#tripledes-cbc"</span><span class="sh_keyword">/></span>
[s3] <span class="sh_keyword"><ds:KeyInfo</span> <span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span><span class="sh_keyword">></span>
[s4] <span class="sh_keyword"><ds:KeyName></span>John Smith<span class="sh_keyword"></ds:KeyName></span>
[s5] <span class="sh_keyword"></ds:KeyInfo></span>
[s6] <span class="sh_keyword"><CipherData><CipherValue></span>DEADBEEF<span class="sh_keyword"></CipherValue></CipherData></span>
[s7] <span class="sh_keyword"></EncryptedData></span></pre>
<p><code>[s1]</code> The type of data encrypted may be represented as an
attribute value to aid in decryption and subsequent processing. In this case,
the data encrypted was an 'element'. Other alternatives include 'content' of
an element, or an external octet sequence which can also be identified via
the <code>MimeType</code> and <code>Encoding</code> attributes.</p>
<p><code>[s2]</code> This (3DES CBC) is a symmetric key cipher.</p>
<p><code>[s4]</code> The symmetric key has an associated name "John
Smith".</p>
<p><code>[s6]</code> <code>CipherData</code> contains a
<code>CipherValue</code>, which is a base64 encoded octet sequence.
Alternately, it could contain a <code>CipherReference</code>, which is a URI
reference along with transforms necessary to obtain the encrypted data as an
octet sequence</p>
</div>
<div id="sec-eg-EncryptedKey" class="section">
<h4><span class="secno">2.2.2 </span><code>EncryptedKey</code>
(<code>ReferenceList</code>, <code>ds:RetrievalMethod</code>,
<code>CarriedKeyName</code>)</h4>
<p>The following <code>EncryptedData</code> structure is very similar to the
one above, except this time the key is referenced using a
<code>ds:RetrievalMethod</code>:</p>
<pre class="example sh_xml sh_sourceCode">[t01] <span class="sh_keyword"><EncryptedData</span> <span class="sh_type">Id</span><span class="sh_symbol">=</span><span class="sh_string">"ED"</span>
<span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span><span class="sh_keyword">></span>
[t02] <span class="sh_keyword"><EncryptionMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#aes128-cbc"</span><span class="sh_keyword">/></span>
[t03] <span class="sh_keyword"><ds:KeyInfo</span> <span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span><span class="sh_keyword">></span>
[t04] <span class="sh_keyword"><ds:RetrievalMethod</span> <span class="sh_type">URI</span><span class="sh_symbol">=</span><span class="sh_string">"#EK"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#EncryptedKey"</span><span class="sh_keyword">/></span>
[t05] <span class="sh_keyword"><ds:KeyName></span>Sally Doe<span class="sh_keyword"></ds:KeyName></span>
[t06] <span class="sh_keyword"></ds:KeyInfo></span>
[t07] <span class="sh_keyword"><CipherData><CipherValue></span>DEADBEEF<span class="sh_keyword"></CipherValue></CipherData></span>
[t08] <span class="sh_keyword"></EncryptedData></span></pre>
<p><code>[t02]</code> This (AES-128-CBC) is a symmetric key cipher.</p>
<p><code>[t04]</code> <code>ds:RetrievalMethod</code> is used to indicate the
location of a key with type <code>xenc:EncryptedKey</code>. The (AES)
key is located at '#EK'.</p>
<p><code>[t05]</code> <code>ds:KeyName</code> provides an alternative method
of identifying the key needed to decrypt the <code>CipherData</code>. Either
or both the <code>ds:KeyName</code> and <code>ds:KeyRetrievalMethod</code>
could be used to identify the same key.</p>
<p>Within the same XML document, there existed an <code>EncryptedKey</code>
structure that was referenced within <code>[t04]</code>:</p>
<pre class="example sh_xml sh_sourceCode">[t09] <span class="sh_keyword"><EncryptedKey</span> <span class="sh_type">Id</span><span class="sh_symbol">=</span><span class="sh_string">"EK"</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span><span class="sh_keyword">></span>
[t10] <span class="sh_keyword"><EncryptionMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#rsa-1_5"</span><span class="sh_keyword">/></span>
[t11] <span class="sh_keyword"><ds:KeyInfo</span> <span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span><span class="sh_keyword">></span>
[t12] <span class="sh_keyword"><ds:KeyName></span>John Smith<span class="sh_keyword"></ds:KeyName></span>
[t13] <span class="sh_keyword"></ds:KeyInfo></span>
[t14] <span class="sh_keyword"><CipherData><CipherValue></span>xyzabc<span class="sh_keyword"></CipherValue></CipherData></span>
[t15] <span class="sh_keyword"><ReferenceList></span>
[t16] <span class="sh_keyword"><DataReference</span> <span class="sh_type">URI</span><span class="sh_symbol">=</span><span class="sh_string">"#ED"</span><span class="sh_keyword">/></span>
[t17] <span class="sh_keyword"></ReferenceList></span>
[t18] <span class="sh_keyword"><CarriedKeyName></span>Sally Doe<span class="sh_keyword"></CarriedKeyName></span>
[t19] <span class="sh_keyword"></EncryptedKey></span></pre>
<p><code>[t09]</code> The <code>EncryptedKey</code> element is similar to the
<code>EncryptedData</code> element except that the data encrypted is always a
key value.</p>
<p><code>[t10]</code> The <code>EncryptionMethod</code> is the RSA public key
algorithm.</p>
<p><code>[t12]</code> <code>ds:KeyName</code> of "John Smith" is a property
of the key necessary for decrypting (using RSA) the
<code>CipherData</code>.</p>
<p><code>[t14]</code> The <code>CipherData</code>'s <code>CipherValue</code>
is an octet sequence that is processed (serialized, encrypted, and encoded)
by a referring encrypted object's <code>EncryptionMethod</code>. (Note, an
EncryptedKey's <code>EncryptionMethod</code> is the algorithm used to encrypt
these octets and does not speak about what type of octets they are.)</p>
<p><code>[t15-17]</code> A <code>ReferenceList</code> identifies the
encrypted objects (<code>DataReference</code> and <code>KeyReference</code>)
encrypted with this key. The <code>ReferenceList</code> contains a list of
references to data encrypted by the symmetric key carried within this
structure.</p>
<p><code>[t18]</code> The <code>CarriedKeyName</code> element is used to
identify the encrypted key value which may be referenced by the
<code>KeyName</code> element in <code>ds:KeyInfo</code>. (Since ID attribute
values must be unique to a document,<code>CarriedKeyName</code> can indicate
that several <code>EncryptedKey</code> structures contain the same key value
encrypted for different recipients.)</p>
</div>
</div>
</div>
<div id="sec-Encryption-Syntax" class="section">
<!--OddPage--><h2><span class="secno">3. </span>Encryption Syntax</h2>
<p>This section provides a detailed description of the syntax and features
for XML Encryption. Features described in this section <em class="rfc2119" title="must">must</em> be implemented
unless otherwise noted. The syntax is defined via [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-1">XMLSCHEMA-1</a></cite>], [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-2">XMLSCHEMA-2</a></cite>] with the following XML preamble,
declaration, internal entity, and import:</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span> <span class="sh_type">encoding</span><span class="sh_symbol">=</span><span class="sh_string">"utf-8"</span><span class="sh_preproc">?></span>
<span class="sh_preproc"><!DOCTYPE</span> <span class="sh_type">schema</span><span class="sh_normal"> </span><span class="sh_type">PUBLIC</span><span class="sh_normal"> </span><span class="sh_string">"-//</span><acronym title="World Wide Web Consortium"><span class="sh_string">W3C</span></acronym><span class="sh_string">//DTD XMLSchema 200102//EN"</span>
<span class="sh_string">"http://www.w3.org/2001/XMLSchema.dtd"</span>
<span class="sh_type">[</span>
<span class="sh_type"><!ATTLIST</span><span class="sh_normal"> </span><span class="sh_type">schema</span>
<span class="sh_type">xmlns:xenc</span><span class="sh_normal"> </span><span class="sh_type">CDATA</span><span class="sh_normal"> </span><span class="sh_type">#FIXED</span><span class="sh_normal"> </span><span class="sh_type">'http://www.w3.org/2001/04/xmlenc'#</span>
<span class="sh_type">xmlns:ds</span><span class="sh_normal"> </span><span class="sh_type">CDATA</span><span class="sh_normal"> </span><span class="sh_type">#FIXED</span><span class="sh_normal"> </span><span class="sh_type">'http://www.w3.org/2000/09/xmldsig#'</span><span class="sh_preproc">></span>
<!ENTITY xenc 'http://www.w3.org/2001/04/xmlenc#'>
<!ENTITY % p ''>
<!ENTITY % s ''>
]>
<span class="sh_keyword"><schema</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span>
<span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span>
<span class="sh_type">xmlns:xenc</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">targetNamespace</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">elementFormDefault</span><span class="sh_symbol">=</span><span class="sh_string">"qualified"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><import</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span>
<span class="sh_type">schemaLocation</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/TR/2002/</span>
<span class="sh_string"> REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"</span><span class="sh_keyword">/></span></pre>
(Note: A newline has been added to the schemaLocation URI to fit on this page, but is not part of the URI.)
<p>Additional markup defined in this specification uses the <code>xenc11:</code> namespace. The syntax is defined in an XML schema with the following preamble:</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_preproc"><?xml</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span> <span class="sh_type">encoding</span><span class="sh_symbol">=</span><span class="sh_string">"utf-8"</span><span class="sh_preproc">?></span>
<span class="sh_preproc"><!DOCTYPE</span> <span class="sh_type">schema</span><span class="sh_normal"> </span><span class="sh_type">PUBLIC</span><span class="sh_normal"> </span><span class="sh_string">"-//</span><acronym title="World Wide Web Consortium"><span class="sh_string">W3C</span></acronym><span class="sh_string">//DTD XMLSchema 200102//EN"</span>
<span class="sh_string">"http://www.w3.org/2001/XMLSchema.dtd"</span>
<span class="sh_type">[</span>
<span class="sh_type"><!ATTLIST</span><span class="sh_normal"> </span><span class="sh_type">schema</span>
<span class="sh_type">xmlns:xenc</span><span class="sh_normal"> </span><span class="sh_type">CDATA</span><span class="sh_normal"> </span><span class="sh_type">#FIXED</span><span class="sh_normal"> </span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">xmlns:ds</span><span class="sh_normal"> </span><span class="sh_type">CDATA</span><span class="sh_normal"> </span><span class="sh_type">#FIXED</span><span class="sh_normal"> </span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span>
<span class="sh_type">xmlns:xenc11</span><span class="sh_normal"> </span><span class="sh_type">CDATA</span><span class="sh_normal"> </span><span class="sh_type">#FIXED</span><span class="sh_normal"> </span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#"</span><span class="sh_preproc">></span>
<!ENTITY xenc "http://www.w3.org/2001/04/xmlenc#">
<!ENTITY % p "">
<!ENTITY % s "">
]>
<span class="sh_keyword"><schema</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema"</span> <span class="sh_type">version</span><span class="sh_symbol">=</span><span class="sh_string">"1.0"</span>
<span class="sh_type">xmlns:xenc</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">xmlns:xenc11</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#"</span>
<span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span>
<span class="sh_type">targetNamespace</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#"</span>
<span class="sh_type">elementFormDefault</span><span class="sh_symbol">=</span><span class="sh_string">"qualified"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><import</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span>
<span class="sh_type">schemaLocation</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/TR/2002/</span>
<span class="sh_string"> REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><import</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">schemaLocation</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/TR/2002/</span>
<span class="sh_string"> REC-xmlenc-core-20021210/xenc-schema.xsd"</span><span class="sh_keyword">/></span></pre>
(Note: A newline has been added to the schemaLocation URI to fit on this page, but is not part of the URI.)
<div id="sec-EncryptedType" class="section">
<h3><span class="secno">3.1 </span>The <code>EncryptedType</code> Element</h3>
<p><code>EncryptedType</code> is the abstract type from which
<code>EncryptedData</code> and <code>EncryptedKey</code> are derived. While
these two latter element types are very similar with respect to their content
models, a syntactical distinction is useful to processing. Implementations
<em class="rfc2119" title="must">must</em> generate laxly schema valid [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-1">XMLSCHEMA-1</a></cite>], [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-2">XMLSCHEMA-2</a></cite>]
<code>EncryptedData</code> or <code>EncryptedKey</code> elements as specified by the
subsequent schema declarations. (Note the laxly schema valid generation means
that the content permitted by <code>xsd:ANY</code> need not be valid.)
Implementations <em class="rfc2119" title="should">should</em> create these XML structures
(<code>EncryptedType</code> elements and their descendants/content) in
Normalization Form C [<cite><a class="bibref" rel="biblioentry" href="#bib-NFC">NFC</a></cite>].</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptedType"</span> <span class="sh_type">abstract</span><span class="sh_symbol">=</span><span class="sh_string">"true"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptionMethod"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptionMethodType"</span>
<span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"ds:KeyInfo"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:CipherData"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptionProperties"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Id"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ID"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Type"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"MimeType"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"string"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Encoding"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span></pre>
<p><code>EncryptionMethod</code> is an optional element that describes the
encryption algorithm applied to the cipher data. If the element is absent,
the encryption algorithm must be known by the recipient or the decryption
will fail.</p>
<p><code>ds:KeyInfo</code> is an optional element, defined by [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>], that carries information about the key
used to encrypt the data. Subsequent sections of this specification define
new elements that may appear as children of <code>ds:KeyInfo</code>.</p>
<p><code>CipherData</code> is a mandatory element that contains the
<code>CipherValue</code> or <code>CipherReference</code> with the encrypted
data.</p>
<p><code>EncryptionProperties</code> can contain additional information
concerning the generation of the <code>EncryptedType</code> (e.g., date/time
stamp).</p>
<p><code>Id</code> is an optional attribute providing for the standard method
of assigning a string id to the element within the document context.</p>
<p><code>Type</code> is an optional attribute identifying type information
about the plaintext form of the encrypted content. While optional, this
specification takes advantage of it for processing described in <a class="sectionRef" href="#sec-Processing-Decryption">section 4.4 Decryption</a>. If the <code>EncryptedData</code> element
contains data of <code>Type</code> 'element' or element 'content', and
replaces that data in an XML document context, or contains data of
<code>Type</code> 'EXI', it is strongly recommended the
<code>Type</code> attribute be provided. Without this information, the
decryptor will be unable to automatically restore the XML document to its
original cleartext form.</p>
<p><code>MimeType</code> is an optional (advisory) attribute which describes
the media type of the data which has been encrypted. The value of this
attribute is a string with values defined by [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2045">RFC2045</a></cite>].
For example, if the data that is encrypted is a base64 encoded PNG, the
transfer <code>Encoding</code> may be specified as '<a href="http://www.w3.org/2000/09/xmldsig#base64">http://www.w3.org/2000/09/xmldsig#base64</a>'
and the <code>MimeType</code> as 'image/png'. This attribute is purely
advisory; no validation of the <code>MimeType</code> information is required
and it does not indicate the encryption application must do any additional
processing. Note, this information may not be necessary if it is already
bound to the identifier in the <code>Type</code> attribute. For example, the
Element and Content types defined in this specification are always UTF-8
encoded text.
In the case of Type EXI the MimeType attribute is not necessary, but
if used should reflect the underlying type and not "EXI".
</p>
<p><code>Encoding</code> is an optional (advisory) attribute which describes
the transfer encoding of the data that has been encrypted.
</p>
</div>
<div id="sec-EncryptionMethod" class="section">
<h3><span class="secno">3.2 </span>The <code>EncryptionMethod</code> Element</h3>
<p>EncryptionMethod is an optional element that describes the encryption
algorithm applied to the cipher data. If the element is absent, the
encryption algorithm must be known to the recipient or the decryption will
fail.</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptionMethodType"</span> <span class="sh_type">mixed</span><span class="sh_symbol">=</span><span class="sh_string">"true"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"KeySize"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:KeySizeType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"OAEPparams"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"base64Binary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><any</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"##other"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Algorithm"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"required"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span></pre>
<p>The permitted child elements of the <code>EncryptionMethod</code> are
determined by the specific value of the <code>Algorithm</code> attribute URI,
and the <code>KeySize</code> child element is always permitted. For example,
the RSA-OAEP algorithm (<a href="#sec-RSA-OAEP" class="sectionRef">section 5.5.2 RSA-OAEP</a>) uses the
<code>ds:DigestMethod</code> and <code>OAEPparams</code> elements, and
may use the <code>xenc11:MGF</code> element when needed. (We rely
upon the <code>ANY</code> schema construct because it is not possible to
specify element content based on the value of an attribute.)</p>
<p>The presence of any child element under <code>EncryptionMethod</code>
that is not permitted by the algorithm or the presence of a
<code>KeySize</code> child inconsistent with the algorithm <em class="rfc2119" title="must">must</em> be treated as
an error. (All algorithm URIs specified in this document imply a key size but
this is not true in general. Most popular stream cipher algorithms take
variable size keys.)</p>
</div>
<div id="sec-CipherData" class="section">
<h3><span class="secno">3.3 </span>The <code>CipherData</code> Element</h3>
<p>The <code>CipherData</code> is a mandatory element that provides the
encrypted data. It must either contain the encrypted octet sequence as base64
encoded text as element content of the <code>CipherValue</code> element, or provide a reference
to an external location containing the encrypted octet sequence via the
<code>CipherReference</code> element.</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"CipherData"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:CipherDataType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"CipherDataType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><choice></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"CipherValue"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"base64Binary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:CipherReference"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></choice></span>
<span class="sh_keyword"></complexType></span></pre>
<div id="sec-CipherReference" class="section">
<h4><span class="secno">3.3.1 </span>The <code>CipherReference</code> Element</h4>
<p>If <code>CipherValue</code> is not supplied directly, the
<code>CipherReference</code> identifies a source which, when processed,
yields the encrypted octet sequence.</p>
<p>The actual value is obtained as follows. The <code>CipherReference</code>
<code>URI</code> contains an identifier that is dereferenced. Should the
<code>CipherReference</code> element contain an <em class="rfc2119" title="optional">optional</em> sequence of
<code>Transform</code>s, the data resulting from dereferencing the URI is
transformed as specified so as to yield the intended cipher value. For
example, if the value is base64 encoded within an XML document; the
transforms could specify an XPath expression followed by a base64 decoding so
as to extract the octets.</p>
<p>
The syntax of the URI and Transforms is defined in XML Signature
[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>], however XML Encryption places
the <code>Transforms</code> element in the XML Encryption namespace
since it is
used in XML Encryption to obtain an octet stream for decryption.
In [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>] both generation and validation processing
start with the same source data and perform that transform in the same order.
In encryption, the decryptor has only the cipher data and the specified
transforms are enumerated for the decryptor, in the order necessary to obtain
the octets. Consequently, because it has different semantics
<code>Transforms</code> is in the <code>xenc:</code> namespace.</p>
<p>For example, if the relevant cipher value is captured within a
<code>CipherValue</code> element within a different XML document, the
<code>CipherReference</code> might look as follows:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><CipherReference</span> <span class="sh_type">URI</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.example.com/CipherValues.xml"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><Transforms></span>
<span class="sh_keyword"><ds:Transform</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/TR/1999/REC-xpath-19991116"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ds:XPath</span> <span class="sh_type">xmlns:xenc</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span><span class="sh_keyword">></span>
self::text()[parent::enc:CipherValue[@Id="example1"]]
<span class="sh_keyword"></ds:XPath></span>
<span class="sh_keyword"></ds:Transform></span>
<span class="sh_keyword"><ds:Transform</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#base64"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></Transforms></span>
<span class="sh_keyword"></CipherReference></span></pre>
<p>Implementations <em class="rfc2119" title="must">must</em> support the <code>CipherReference</code> feature and
the same URI encoding, dereferencing, scheme, and HTTP response codes as that
of [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>]. The <code>Transform</code> feature
and particular transform algorithms are <em class="rfc2119" title="optional">optional</em>.</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"CipherReference"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:CipherReferenceType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"CipherReferenceType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Transforms"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:TransformsType"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"URI"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"required"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"TransformsType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"ds:Transform"</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"></complexType></span></pre>
</div>
</div>
<div id="sec-EncryptedData" class="section">
<h3><span class="secno">3.4 </span>The <code>EncryptedData</code> Element</h3>
<p>The <code>EncryptedData</code> element is the core element in the syntax.
Not only does its <code>CipherData</code> child contain the encrypted data,
but it's also the element that replaces the encrypted element, or
element content, or serves as
the new document root.</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptedData"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptedDataType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptedDataType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><complexContent></span>
<span class="sh_keyword"><extension</span> <span class="sh_type">base</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptedType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"></extension></span>
<span class="sh_keyword"></complexContent></span>
<span class="sh_keyword"></complexType></span></pre>
</div>
<div id="sec-Extensions-to-KeyInfo" class="section">
<h3><span class="secno">3.5 </span>Extensions to <code>ds:KeyInfo</code> Element</h3>
<p>There are three ways that the keying material needed to decrypt
<code>CipherData</code> can be provided:</p>
<ol>
<li>The <code>EncryptedData</code> or <code>EncryptedKey</code> element
specify the associated keying material via a child of
<code>ds:KeyInfo</code>. All of the child elements of
ds:<code>KeyInfo</code> specified in [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>] <em class="rfc2119" title="may">may</em> be used as qualified:
<ol>
<li>Support for <code>ds:KeyValue</code> is <em class="rfc2119" title="optional">optional</em> and may
be used to transport public keys, such as Diffie-Hellman Key
Values (<a href="#sec-DHKeyValue" class="sectionRef">section 5.6.1 Diffie-Hellman Key
Values</a>).
(Including the plaintext decryption key, whether a private key or a
secret key, is obviously <em class="rfc2119" title="not recommended">not recommended</em>.)</li>
<li>Support of <code>ds:KeyName</code> to refer to an
<code>EncryptedKey</code> <code>CarriedKeyName</code> is
<em class="rfc2119" title="recommended">recommended</em>.</li>
<li>Support for same document <code>ds:RetrievalMethod</code> is
<em class="rfc2119" title="required">required</em>.</li>
</ol>
<p>In addition, we provide two additional child elements: applications
<em class="rfc2119" title="must">must</em> support <code>EncryptedKey</code>
(<a href="#sec-EncryptedKey" class="sectionRef">section 3.5.1 The EncryptedKey Element</a>)
and <em class="rfc2119" title="may">may</em> support <code>AgreementMethod</code> (<a href="#sec-Alg-KeyAgreement" class="sectionRef">section 5.6 Key Agreement</a>).</p>
</li>
<li>A detached (not inside <code>ds:KeyInfo</code>)
<code>EncryptedKey</code> element can specify the
<code>EncryptedData</code> or <code>EncryptedKey</code> to which its
decrypted key will apply via a <code>DataReference</code> or
<code>KeyReference</code> (
<a class="sectionRef" href="#sec-ReferenceList">section 3.6 The ReferenceList Element</a>).
</li>
<li>The keying material can be determined by the recipient by application
context and thus need not be explicitly mentioned in the transmitted
XML.</li>
</ol>
<div id="sec-EncryptedKey" class="section">
<h4><span class="secno">3.5.1 </span>The <code>EncryptedKey</code> Element</h4>
<dl>
<dt>Identifier</dt>
<dd><code><a id="EncryptedKey">Type="http://www.w3.org/2001/04/xmlenc#EncryptedKey"</a></code>
<p>(This can be used within a <code>ds:RetrievalMethod</code> element
to identify the referent's type.)</p>
</dd>
</dl>
<p>The <code>EncryptedKey</code> element is used to transport encryption keys
from the originator to a known recipient(s). It may be used as a stand-alone
XML document, be placed within an application document, or appear inside an
<code>EncryptedData</code> element as a child of a <code>ds:KeyInfo</code>
element. The key value is always encrypted to the recipient(s). When
<code>EncryptedKey</code> is decrypted the resulting octets are made
available to the <code>EncryptionMethod</code> algorithm without any
additional processing.</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptedKey"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptedKeyType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptedKeyType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><complexContent></span>
<span class="sh_keyword"><extension</span> <span class="sh_type">base</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptedType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:ReferenceList"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"CarriedKeyName"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"string"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Recipient"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"string"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></extension></span>
<span class="sh_keyword"></complexContent></span>
<span class="sh_keyword"></complexType></span></pre>
<p><code>ReferenceList</code> is an optional element containing pointers to
data and keys encrypted using this key. The reference list may contain
multiple references to <code>EncryptedKey</code> and
<code>EncryptedData</code> elements. This is done using
<code>KeyReference</code> and <code>DataReference</code> elements
respectively. These are defined below.</p>
<p><code>CarriedKeyName</code> is an optional element for associating a user
readable name with the key value. This may then be used to reference the key
using the <code>ds:KeyName</code> element within <code>ds:KeyInfo</code>. The
same <code>CarriedKeyName</code> label, unlike an ID type, may occur multiple
times within a single document. The value of the key <em class="rfc2119" title="must">must</em> be the same in all
<code>EncryptedKey</code> elements identified with the same
<code>CarriedKeyName</code> label within a single XML document. Note that
because whitespace is significant in the value of the <code>ds:KeyName</code>
element, whitespace is also significant in the value of the
<code>CarriedKeyName</code> element.</p>
<p><code>Recipient</code> is an optional attribute that contains a hint as to
which recipient this encrypted key value is intended for. Its contents are
application dependent.</p>
<p>The <code>Type</code> attribute inherited from <code>EncryptedType</code>
can be used to further specify the type of the encrypted key if the
<code>EncryptionMethod</code> <code>Algorithm</code> does not define a
unambiguous encoding/representation. (Note, all the algorithms in this
specification have an unambiguous representation for their associated key
structures.)</p>
</div>
<div id="sec-DerivedKey" class="section">
<h4><span class="secno">3.5.2 </span>The <code>DerivedKey</code> Element</h4>
<dl>
<dt>Identifier</dt>
<dd><code><a id="DerivedKey">Type="http://www.w3.org/2009/xmlenc11#DerivedKey"</a></code>
<p>(This can be used within a <code>ds:RetrievalMethod</code> element
to identify the referent's type.)</p>
</dd>
</dl>
<p>
The <code>DerivedKey</code> element is used to transport information
about a derived key from the originator to recipient(s). It may be
used as a stand-alone XML document, be placed within an application
document, or appear inside an <code>EncryptedData</code> or
<code>Signature</code> element as a child of a <code>ds:KeyInfo</code>
element. The key value itself is never sent by the
originator. Rather, the originator provides information to the
recipient(s) by which the recipient(s) can derive the same key
value. When the key has been derived the resulting octets are made
available to the <code>EncryptionMethod</code> or
<code>SignatureMethod</code> algorithm without any additional
processing.
</p>
<pre class="sh_xml sh_sourceCode">Schema Definition:
<span class="sh_comment"><!-- targetNamespace='http://www.w3.org/2009/xmlenc11#' --></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"DerivedKey"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:DerivedKeyType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"DerivedKeyType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:KeyDerivationMethod"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:ReferenceList"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"DerivedKeyName"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"string"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"MasterKeyName"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"string"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Recipient"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"string"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Id"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ID"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Type"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"KeyDerivationMethod"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:KeyDerivationMethodType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"KeyDerivationMethodType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><any</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"##any"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Algorithm"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"required"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span>
</pre>
<p>
<code>KeyDerivationMethod</code> is an optional element that describes
the key derivation algorithm applied to the master (underlying)
key material. If the element is absent, the key derivation algorithm must
be known by the recipient or the recipient's key derivation will fail.
</p>
<p>
<code>ReferenceList</code> is an optional element containing pointers
to data and keys encrypted using this key. The reference list may
contain multiple references to <code>EncryptedKey</code> or
<code>EncryptedData</code> elements. This is done using
<code>KeyReference</code> and <code>DataReference</code> elements
from XML Encryption.
</p>
<p>
The optional <code>DerivedKeyName</code> element is used to identify
the derived key value. This element may then be referenced by the
<code>ds:KeyName</code> element in <code>ds:KeyInfo</code>. The
same <code>DerivedKeyName</code> label, unlike an ID type, may occur
multiple times within a single document. Note that because whitespace
is significant in the value of the <code>ds:KeyName</code> element,
whitespace is also significant in the value of the
<code>DerivedKeyName</code> element.
</p>
<p>
<code>MasterKeyName</code> is an optional element for associating a
user readable name with the master key (or secret) value. The
same <code>MasterKeyName</code> label, unlike an ID type, may occur
multiple times within a single document. The value of the master
key <em class="rfc2119" title="must">must</em> be the same in all <code>DerivedKey</code> elements
identified with the same <code>MasterKeyName</code> label within a
single XML document. If no <code>MasterKeyName</code> is provided, the
master key material must be known by the recipient or key
derivation will fail.
</p>
<p>
<code>Recipient</code> is an optional attribute that contains a hint
as to which recipient this derived key value is intended for. Its
contents are application dependent.
</p>
<p>
The optional <code>Id</code> attribute provides for the standard
method of assigning a string id to the element within the document
context.
</p>
<p>
The <code>Type</code> attribute can be used to further specify the
type of the derived key if the <code>KeyDerivationMethod</code>
algorithm does not define an unambiguous encoding/representation.
</p>
</div>
<div id="sec-ds-RetrievalMethod" class="section">
<h4><span class="secno">3.5.3 </span>The <code>ds:RetrievalMethod</code> Element</h4>
<p>The <code>ds:RetrievalMethod</code> <code>[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>]</code> with a <code>Type</code> of
'<code>http://www.w3.org/2001/04/xmlenc#EncryptedKey</code>' provides a way
to express a link to an <code>EncryptedKey</code> element containing the key
needed to decrypt the <code>CipherData</code> associated with an
<code>EncryptedData</code> or <code>EncryptedKey</code> element. The <code>ds:RetrievalMethod</code> <code>[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>]</code> with a <code>Type</code> of '<code>http://www.w3.org/2001/04/xmlenc#DerivedKey</code>' provides a way
to express a link to a <code>DerivedKey</code> element used to derive the key
needed to decrypt the <code>CipherData</code> associated with an
<code>EncryptedData</code> or <code>EncryptedKey</code> element. The
<code>ds:RetrievalMethod</code> with one of these types is always a child of the
<code>ds:KeyInfo</code> element and may appear multiple times. If there is
more than one instance of a <code>ds:RetrievalMethod</code> in a
<code>ds:KeyInfo</code> of this type, then the <code>EncryptedKey</code>
objects referred to must contain the same key value, possibly encrypted in
different ways or for different recipients.</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_comment"><!--</span>
<span class="sh_comment"> <attribute name='Type' type='anyURI' use='optional'/></span>
<span class="sh_comment"> --></span></pre>
</div>
</div>
<div id="sec-ReferenceList" class="section">
<h3><span class="secno">3.6 </span>The <code>ReferenceList</code> Element</h3>
<p><code>ReferenceList</code> is an element that contains pointers from a key
value of an <code>EncryptedKey</code> or <code>DerivedKey</code> to items encrypted by that key value
(<code>EncryptedData</code> or <code>EncryptedKey</code> elements).</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"ReferenceList"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><complexType></span>
<span class="sh_keyword"><choice</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"1"</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"DataReference"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:ReferenceType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"KeyReference"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:ReferenceType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></choice></span>
<span class="sh_keyword"></complexType></span>
<span class="sh_keyword"></element></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"ReferenceType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><any</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"##other"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"URI"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"required"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span></pre>
<p><code>DataReference</code> elements are used to refer to
<code>EncryptedData</code> elements that were encrypted using the key defined
in the enclosing <code>EncryptedKey</code> or <code>DerivedKey</code> element. Multiple
<code>DataReference</code> elements can occur if multiple
<code>EncryptedData</code> elements exist that are encrypted by the same
key.</p>
<p><code>KeyReference</code> elements are used to refer to
<code>EncryptedKey</code> elements that were encrypted using the key defined
in the enclosing <code>EncryptedKey</code> or <code>DerivedKey</code> element. Multiple
<code>KeyReference</code> elements can occur if multiple
<code>EncryptedKey</code> elements exist that are encrypted by the same
key.</p>
<p>For both types of references one may optionally specify child elements to
aid the recipient in retrieving the <code>EncryptedKey</code> and/or
<code>EncryptedData</code> elements. These could include information such as
XPath transforms, decompression transforms, or information on how to retrieve
the elements from a document storage facility. For example:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><ReferenceList></span>
<span class="sh_keyword"><DataReference</span> <span class="sh_type">URI</span><span class="sh_symbol">=</span><span class="sh_string">"#invoice34"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ds:Transforms></span>
<span class="sh_keyword"><ds:Transform</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/TR/1999/REC-xpath-19991116"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ds:XPath</span> <span class="sh_type">xmlns:xenc</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span><span class="sh_keyword">></span>
self::xenc:EncryptedData[@Id="example1"]
<span class="sh_keyword"></ds:XPath></span>
<span class="sh_keyword"></ds:Transform></span>
<span class="sh_keyword"></ds:Transforms></span>
<span class="sh_keyword"></DataReference></span>
<span class="sh_keyword"></ReferenceList></span></pre>
</div>
<div id="sec-EncryptionProperties" class="section">
<h3><span class="secno">3.7 </span>The <code>EncryptionProperties</code> Element</h3>
<dl>
<dt>Identifier</dt>
<dd><code><a id="EncryptionProperties">Type="http://www.w3.org/2001/04/xmlenc#EncryptionProperties"</a></code>
<p>(This can be used within a <code>ds:Reference</code> element to
identify the referent's type.)</p>
</dd>
</dl>
<p>Additional information items concerning the generation of the
<code>EncryptedData</code> or <code>EncryptedKey</code> can be placed in an
<code>EncryptionProperty</code> element (e.g., date/time stamp or the serial
number of cryptographic hardware used during encryption). The
<code>Target</code> attribute identifies the <code>EncryptedType</code>
structure being described. <code>anyAttribute</code> permits the inclusion of
attributes from the XML namespace to be included (i.e.,
<code>xml:space</code>, <code>xml:lang</code>, and <code>xml:base</code>).</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptionProperties"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptionPropertiesType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptionPropertiesType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptionProperty"</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Id"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ID"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptionProperty"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:EncryptionPropertyType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"EncryptionPropertyType"</span> <span class="sh_type">mixed</span><span class="sh_symbol">=</span><span class="sh_string">"true"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><choice</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><any</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"##other"</span> <span class="sh_type">processContents</span><span class="sh_symbol">=</span><span class="sh_string">"lax"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></choice></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Target"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Id"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ID"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"optional"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><anyAttribute</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/XML/1998/namespace"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span></pre>
</div>
</div>
<div id="sec-Processing" class="section">
<!--OddPage--><h2><span class="secno">4. </span>Processing Rules</h2>
<p>This section describes the operations to be performed as part of
encryption and decryption processing by implementations of this
specification. The conformance requirements are specified over the following
roles:</p>
<dl>
<dt><a id="def-Encryptor">Encryptor</a></dt>
<dd>An XML Encryption implementation with the role of encrypting
data.</dd>
<dt><a id="def-Decryptor">Decryptor</a></dt>
<dd>An XML Encryption implementation with the role of decrypting
data.</dd>
</dl>
<p>Encryptor and Decryptor are invoked by the <a id="def-Application">Application</a>. This specification does not include normative definitions for application behavior. However, this specification does include conformance requirements on encrypted data that may only be achievable through appropriate behavior by all three parties. It is up to specific deployment contexts how this is achieved.</p>
<div id="sec-Intended-Processing" class="section">
<h3><span class="secno">4.1 </span>Intended Application Model</h3>
<p>The processing rules for XML Encryption are designed around an intended application model that this version of the specification does not cover normatively.</p>
<p>In the intended processing model, XML Encryption is used to encrypt
an octet-stream, an EXI stream, or a fragment of an XML document that
matches either the <code>content</code> or <code>element</code>
production from [<cite><a class="bibref" rel="biblioentry" href="#bib-XML10">XML10</a></cite>].</p>
<p>If XML Encryption is used with some octet-stream, the precise encoding and meaning of that octet-stream is up to the application, but treated as opaque by the Encryptor or Decryptor. The application may use the <code>Type</code>, <code>Encoding</code> and <code>MimeType</code> parameters to transport further information about the nature of that octet-stream. Hence, an unknown <code>Type</code> parameter is, in general, not treated as an error by either the Encryptor or Decryptor, but instead simply passed through, along with the other relevant parameters and the cleartext octet-stream.</p>
<p>If XML Encryption is used with an XML <code>element</code> or XML <code>content</code>, then Encryptors and Decryptors commonly perform type-specific processing:</p>
<ul>
<li>If an <code>element</code> is encrypted, then the Encryptor
will replace the element in question with an appropriately
constructed <code>EncryptedData</code> element. The Decryptor
will, conversely, replace the <code>EncryptedData</code> element
with its cleartext.</li>
<li>If XML <code>content</code> is encrypted, then the Encryptor will likewise replace this content with an appropriately constructed <code>EncryptedData</code> element, and the Decryptor will reverse this operation.</li>
</ul>
<p>Note that the intended Encryptor behavior
will often cause the document with encrypted parts to become
invalid with respect to its schema
for
the hosting XML format, unless that format is specifically prepared
to be used with XML Encryption. An Encryptor or Decryptor that
implements the intended processing model is <em class="rfc2119" title="not required">not required</em> to ensure
that the resulting XML is schema-valid for the hosting XML
format.</p>
<p>If XML processing is handled inside the Encryptor and Decryptor, and the <code>Type</code> attribute values for <code>element</code> and <code>content</code> cleartext are used, then the Encryptor and Decryptor <em class="rfc2119" title="must">must</em> ensure that the XML cleartext is serialized as UTF-8 before encryption, and -- if needed -- converted back to whatever other encoding might be used by the surrounding XML context.</p>
<p>If XML Encryption is used with an EXI stream [<cite><a class="bibref" rel="biblioentry" href="#bib-EXI">EXI</a></cite>], then Encryptors and
Decryptors process content as for XML element or XML content processing, but taking into account EXI serialization. In particular,
the encryptor will replace the XML element or XML fragment in question
with an appropriately constructed EncryptedData element. The Decryptor
will conversely replace the EncryptedData element with its cleartext
XML element or XML fragment. Note that the XML document into which the
EncryptedData element is embedded may be encoded using EXI and/or EXI
may be used to encode the cleartext before encryption. </p>
</div>
<div id="sec-Type-Parameters" class="section">
<h3><span class="secno">4.2 </span>Well-known <code>Type</code> parameter values</h3>
<p>For interoperability purposes, the following types <em class="rfc2119" title="must">must</em> be implemented
such that an implementation will be able to take as input and yield as output
data matching the production rules 39 and 43 from [<cite><a class="bibref" rel="biblioentry" href="#bib-XML10">XML10</a></cite>]:</p>
<dl>
<dt><a id="Element">element</a> '<a href="http://www.w3.org/2001/04/xmlenc#Element">http://www.w3.org/2001/04/xmlenc#Element</a>'</dt>
<dd>"[39] <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-element">element</a>
::= <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-EmptyElemTag"><code>EmptyElemTag</code></a>
| <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-STag">STag</a>
<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-content">content</a>
<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-ETag">ETag</a>"</dd>
<dt><a id="Content">content</a> '<a href="http://www.w3.org/2001/04/xmlenc#Content">http://www.w3.org/2001/04/xmlenc#Content</a>'</dt>
<dd>"[43] <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-content">content</a>
::= <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-CharData"><code>CharData</code></a>?
((<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-element">element</a>
| <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-Reference">Reference</a>
| <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-CDSect">CDSect</a>
| <a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-PI">PI</a> |
<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-Comment">Comment</a>)
<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-CharData"><code>CharData</code></a>?)*"</dd>
</dl>
<p>Support for the following type is <em class="rfc2119" title="optional">optional</em> for Encryptors and Decryptors:</p>
<dl>
<dt><a href="http://www.w3.org/2009/xmlenc11#EXI" id="EXI">http://www.w3.org/2009/xmlenc11#EXI</a></dt>
<dd>Presence of this <code>Type</code> indicates that the cleartext is an EXI stream [<cite><a class="bibref" rel="biblioentry" href="#bib-EXI">EXI</a></cite>]. Encryptors and Decryptors that support this type <em class="rfc2119" title="may">may</em> operate directly on (parts of) EXI streams.</dd>
</dl>
<p>Encryptors and Decryptors <em class="rfc2119" title="should">should</em> handle unknown or empty <code>Type</code> attribute values as a signal that the cleartext is to be handled as an opaque octet-stream, whose specific processing is up to the invoking application. In this case, the <code>Type</code>, <code>MimeType</code> and <code>Encoding</code> parameters <em class="rfc2119" title="should">should</em> be treated as opaque data whose appropriate processing is up to the application.</p>
</div>
<div id="sec-Processing-Encryption" class="section">
<h3><span class="secno">4.3 </span>Encryption</h3>
<p>The selection of the algorithm, parameters, and encryption keys is out of scope for this specification.</p>
<p>The cleartext data are assumed to be present as an octet stream. If the cleartext is of type <code>element</code> or <code>content</code>, the data <em class="rfc2119" title="must">must</em> be serialized in UTF-8 as specified in [<cite><a class="bibref" rel="biblioentry" href="#bib-XML10">XML10</a></cite>], using Normal Form C [<cite><a class="bibref" rel="biblioentry" href="#bib-NFC">NFC</a></cite>].</p>
<p>For each data item to be encrypted as an <code>EncryptedData</code> or
<code>EncryptedKey</code> element, the <strong>encryptor</strong> <em class="rfc2119" title="must">must</em>:</p>
<ol>
<li>Obtain (or derive) and (optionally) represent the key.
<ol>
<li><p>If the key is to be identified (via naming, URI, or included in a
child element), construct the <code>ds:KeyInfo</code> as appropriate
(e.g., <code>ds:KeyName</code>, <code>ds:KeyValue</code>,
<code>ds:RetrievalMethod</code>, etc.)</p></li>
<li><p>If the key itself is to be encrypted, construct an
<code>EncryptedKey</code> element by recursively applying this
encryption process. The result may then be a child of
<code>ds:KeyInfo</code>, or it may exist elsewhere and may be
identified in the preceding step.</p></li>
<li><p>If the key was derived from a master key, construct a
<code>DerivedKey</code> element with associated child
elements. The result may, as in the <code>EncryptedKey</code>
case, be a child of <code>ds:KeyInfo</code>, or it may exist
elsewhere.</p></li>
</ol>
</li>
<li><p>Encrypt the data:
</p><ol>
<li><p>Encrypt the octets using the algorithm and key.</p></li>
<li>
<p>Unless the <strong>decryptor</strong> will implicitly know the type of the
encrypted data, the <strong>encryptor</strong> <em class="rfc2119" title="should">should</em> set the
<code>Type</code> to indicate the intended interpretation of the cleartext
data. See <a class="sectionRef" href="#sec-Type-Parameters">section 4.2 Well-known Type parameter values</a>
for known parameter values.</p>
<p>If the data is a
simple octet sequence it <em class="rfc2119" title="may">may</em> be described with the
<code>MimeType</code> and <code>Encoding</code> attributes. For
example, the data might be an XML document
(<code>MimeType="text/xml"</code>), sequence of characters
(<code>MimeType="text/plain"</code>), or binary image data
(<code>MimeType="image/png</code>").</p>
</li>
</ol>
</li>
<li>Build the <code>EncryptedData</code> or
<code>EncryptedKey</code> structure:
<p>An <code>EncryptedData</code> or <code>EncryptedKey</code> structure represents all of the
information previously discussed including the type of the encrypted
data, encryption algorithm, parameters, key, type of the encrypted data,
etc.</p>
<ol>
<li>If the encrypted octet sequence obtained in step 2 is to be stored
in the <code>CipherData</code> element within the
<code>EncryptedData</code> or <code>EncryptedKey</code> element, then the base64 representation of the encrypted octet sequence is
inserted as the content of a
<code>CipherValue</code> element.</li>
<li><p>If the encrypted octet sequence is stored externally to the
<code>EncryptedData</code> or <code>EncryptedKey</code> element,
then the URI and transforms (if
any) required for the Decryptor to retrieve the encrypted octet
sequence are described within a
<code>CipherReference</code> element.</p>
</li>
</ol>
</li>
</ol>
</div>
<div id="sec-Processing-Decryption" class="section">
<h3><span class="secno">4.4 </span>Decryption</h3>
<p>For each <code>EncryptedData</code> or <code>EncryptedKey</code> to be decrypted,
the <strong>decryptor</strong> <em class="rfc2119" title="must">must</em>:</p>
<ol>
<li>Determine the algorithm, parameters and key information to be used.
This information may be obtained out-of-band, or determined according to
a <code>ds:KeyInfo</code> element;
see <a href="#sec-Extensions-to-KeyInfo" class="sectionRef">section 3.5 Extensions to ds:KeyInfo Element</a>.
</li>
<li><p>Decrypt the data contained in the <code>CipherData</code> element.
</p><ol>
<li><p>If a <code>CipherValue</code> child element is present, then the
associated text value is retrieved and base64 decoded so as to obtain
the encrypted octet sequence.</p></li>
<li><p>If a <code>CipherReference</code> child element is present, the URI
and transforms (if any) are used to retrieve the encrypted octet
sequence.</p></li>
<li><p>The encrypted octet sequence is decrypted using the
algorithm, parameters and key value already determined from step 1.</p></li>
</ol>
</li>
</ol>
</div>
<div id="sec-Processing-XML" class="section">
<h3><span class="secno">4.5 </span>XML Encryption</h3>
<p>Encryption and decryption operations are operations on octets. The
<strong>application</strong> is responsible for the marshalling XML such that
it can be serialized into an octet sequence, encrypted, decrypted, and be of
use to the recipient.</p>
<p>For example, if the application wishes to canonicalize its data or
encode/compress the data in an XML packaging format, the application needs to
marshal the XML accordingly and identify the resulting type via the
<code>EncryptedData</code> <code>Type</code> attribute. The likelihood of
successful decryption and subsequent processing will be dependent on the
recipient's support for the given type. Also, if the data is intended to be
processed both before encryption and after decryption (e.g., XML Signature
[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>] validation or an XSLT transform) the
encrypting application must be careful to preserve information necessary for
that process's success.</p>
<p>The following sections contain specifications for decrypting, replacing,
and serializing XML content (i.e., <code>Type</code> '<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-element">element</a>' or
element '<a href="http://www.w3.org/TR/2008/REC-xml-20081126/#NT-content">content</a>')
using the [<cite><a class="bibref" rel="biblioentry" href="#bib-XPATH">XPATH</a></cite>] data model. These sections are
non-normative and <em class="rfc2119" title="optional">optional</em> to implementers of this specification, but they
may be normatively referenced by and be required by other specifications that
require a consistent processing for applications, such as [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLENC-DECRYPT">XMLENC-DECRYPT</a></cite>].</p>
<div id="sec-Decrypt-Imp" class="section">
<h4><span class="secno">4.5.1 </span>A Decrypt
Implementation (Non-normative)</h4>
<p>Where <em>P</em> is the context in which the serialized XML should be
parsed (a document node or element node) and <em>O</em> is the octet sequence
representing UTF-8 encoded characters resulting from step 4.3 in <a class="sectionRef" href="#sec-Processing-Decryption">section 4.4 Decryption</a>. <em>Y</em>
is node-set representing the decrypted content
obtained by the following steps:</p>
<ol>
<li>Let <em>C</em> be the <a class="def" id="def-parsing-context">parsing context</a>
of a child of <em>P</em>, which consists of the following items:
<ul>
<li>Prefix and namespace name of each namespace that is in scope for
<em>P</em>.</li>
<li>Name and value of each general entity that is effective for the XML
document causing <em>P</em>.</li>
</ul>
</li>
<li>Wrap the decrypted octet stream <em>O</em> in the context <em>C</em> as
specified in <a class="sectionRef" href="#sec-Text-Wrapping">section 4.5.4 Text Wrapping</a>.</li>
<li>Parse the wrapped octet stream as described in <a class="link-sec" href="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/#sec-ReferenceProcessingModel">The
Reference Processing Model</a> (section 4.3.3.2) of [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>], resulting in a node-set.</li>
<li><em>Y</em> is the node-set obtained by removing the root node, the
wrapping element node, and its associated set of attribute and namespace
nodes from the node-set obtained in Step 3.</li>
</ol>
</div>
<div id="sec-Decrypt-Replace-Imp" class="section">
<h4><span class="secno">4.5.2 </span>A Decrypt and Replace Implementation (Non-normative)</h4>
<p>Where <em>X</em> is the [<cite><a class="bibref" rel="biblioentry" href="#bib-XPATH">XPATH</a></cite>] node set
corresponding to an XML document and <em>e</em> is an
<code>EncryptedData</code> element node in <em>X</em>.</p>
<ol>
<li><em>Z</em> is an [<cite><a class="bibref" rel="biblioentry" href="#bib-XPATH">XPATH</a></cite>] node-set that
identical to X except where the element node <em>e</em> is an
<code>EncryptedData</code> element type. In which case:
<ol>
<li>Decrypt <em>e</em> in the context of its parent node as specified
in the <a class="sectionRef" href="#sec-Decrypt-Imp">section 4.5.1 A Decrypt
Implementation (Non-normative)</a>
yielding <em>Y</em>, an [<cite><a class="bibref" rel="biblioentry" href="#bib-XPATH">XPATH</a></cite>] node set.</li>
<li>Include <em>Y</em> in place of <em>e</em> and its descendants in
<em>X</em>. Since [<cite><a class="bibref" rel="biblioentry" href="#bib-XPATH">XPATH</a></cite>] does not define
methods of replacing node-sets from different documents, the result
<em class="rfc2119" title="must">must</em> be equivalent to replacing e with the octet stream resulting
from its decryption in the serialized form of <em>X</em> and
re-parsing the document. However, the actual method of performing this
operation is left to the implementor.</li>
</ol>
</li>
</ol>
</div>
<div id="sec-Serializing-XML" class="section">
<h4><span class="secno">4.5.3 </span>Serializing XML (Non-normative)</h4>
<div id="sec-Default-Namespace-Considerations" class="section">
<h5><span class="secno">4.5.3.1 </span>Default Namespace Considerations</h5>
<p>In <a class="sectionRef" href="#sec-Processing-Encryption">section 4.3 Encryption</a>
(step 3.1), when serializing an XML fragment special
care <em class="rfc2119" title="should">should</em> be taken with respect to default namespaces. If the data will be
subsequently decrypted in the context of a parent XML document then
serialization can produce elements in the wrong namespace. Consider the
following fragment of XML:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><Document</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ToBeEncrypted</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_keyword">/></span>
<span class="sh_keyword"></Document></span></pre>
<p>Serialization of the element <code>ToBeEncrypted</code> fragment via [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-C14N">XML-C14N</a></cite>] would result in the characters
"<code><ToBeEncrypted></ToBeEncrypted></code>" as an octet
stream. The resulting encrypted document would be:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><Document</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"..."</span><span class="sh_keyword">></span>
<span class="sh_comment"><!-- Containing the encrypted </span>
<span class="sh_comment"> "<ToBeEncrypted></ToBeEncrypted>" --></span>
<span class="sh_keyword"></EncryptedData></span>
<span class="sh_keyword"></Document></span></pre>
<p>Decrypting and replacing the <code>EncryptedData</code> within this
document would produce the following incorrect result:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><Document</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ToBeEncrypted/></span>
<span class="sh_keyword"></Document></span> </pre>
<p>This problem arises because most XML serializations assume that the
serialized data will be parsed directly in a context where there is no
default namespace declaration. Consequently, they do not redundantly declare
the empty default namespace with an <code>xmlns=""</code>. If, however, the
serialized data is parsed in a context where a default namespace declaration
is in scope (e.g., the parsing context as described in <a class="sectionRef" href="#sec-Decrypt-Imp">section 4.5.1 A Decrypt
Implementation (Non-normative)</a>), then
it may affect the interpretation of the serialized data.</p>
<p>To solve this problem, a canonicalization algorithm <em class="rfc2119" title="may">may</em> be augmented as
follows for use as an XML encryption serializer:</p>
<ul>
<li>A default namespace declaration with an empty value (i.e.,
<code>xmlns=""</code>) <em class="rfc2119" title="should">should</em> be emitted where it would normally be
suppressed by the canonicalization algorithm.</li>
</ul>
<p>While the result may not be in proper canonical form, this is harmless as
the resulting octet stream will not be used directly in a
[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>] signature value computation.
Returning to the preceding example with our new augmentation, the
<code>ToBeEncrypted</code> element would be serialized as follows:</p>
<pre><ToBeEncrypted xmlns=""></ToBeEncrypted></pre>
<p>When processed in the context of the parent document, this serialized
fragment will be parsed and interpreted correctly.</p>
<p>This augmentation can be retroactively applied to an existing
canonicalization implementation by canonicalizing each apex node and its
descendants from the node set, inserting <code>xmlns=""</code> at the
appropriate points, and concatenating the resulting octet streams.</p>
</div>
<div id="sec-XML-Attribute-Considerations" class="section">
<h5><span class="secno">4.5.3.2 </span>XML Attribute Considerations</h5>
<p>Similar attention between the relationship of a fragment and the context
into which it is being inserted should be given to the <code>xml:base</code>,
<code>xml:lang</code>, and <code>xml:space</code> attributes as mentioned in
the <a class="link-sec" href="http://www.w3.org/TR/xml-exc-c14n/#sec-Considerations">Security
Considerations</a> of [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-EXC-C14N">XML-EXC-C14N</a></cite>]. For
example, if the element:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><Bongo</span> <span class="sh_type">href</span><span class="sh_symbol">=</span><span class="sh_string">"example.xml"</span><span class="sh_keyword">/></span></pre>
<p>is taken from a context and serialized with no <code>xml:base</code> [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLBASE">XMLBASE</a></cite>] attribute and parsed in the context of the
element:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><Baz</span> <span class="sh_type">xml:base</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/"</span><span class="sh_keyword">/></span></pre>
<p>the result will be:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><Baz</span> <span class="sh_type">xml:base</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/"</span><span class="sh_keyword">><Bongo</span> <span class="sh_type">href</span><span class="sh_symbol">=</span><span class="sh_string">"example.xml"</span><span class="sh_keyword">/></Baz></span></pre>
<p><code>Bongo</code>'s <code>href</code> is subsequently interpreted as
"<code>http://example.org/example.xml</code>". If this is not the correct
URI, <code>Bongo</code> should have been serialized with its own
<code>xml:base</code> attribute.</p>
<p>Unfortunately, the recommendation that an empty value be emitted to
divorce the default namespace of the fragment from the context into which it
is being inserted cannot be made for <span>the attributes
<code>xml:base</code>, and <code>xml:space</code>. (<a class="link-sec" href="http://www.w3.org/XML/xml-V10-2e-errata#E41">Error 41</a> of the <a href="http://www.w3.org/XML/xml-V10-2e-errata">XML 1.0 Second Edition
Specification Errata</a> clarifies that an empty string value of the
attribute <code>xml:lang</code> <em>is</em> considered as if, "there is no
language information available, just as if <code>xml:lang</code> had not been
specified".)</span>The interpretation of an empty value for the
<code>xml:base</code> or <code>xml:space</code> attributes is undefined or
maintains the contextual value. Consequently, applications <em class="rfc2119" title="should">should</em> ensure (1)
fragments that are to be encrypted are not dependent on XML attributes, or
(2) if they are dependent and the resulting document is intended to be <a class="link-def" href="http://www.w3.org/TR/2008/REC-xml-20081126/#dt-valid">valid</a> [<cite><a class="bibref" rel="biblioentry" href="#bib-XML10">XML10</a></cite>], the fragment's definition permits the presence of
the attributes and that the attributes have non-empty values.</p>
</div>
</div>
<div id="sec-Text-Wrapping" class="information section">
<h4><span class="secno">4.5.4 </span>Text Wrapping</h4>
<p>This section specifies the process for wrapping text in a given parsing
context. The process is based on the proposal by Richard Tobin [<cite><a class="bibref" rel="biblioentry" href="#bib-Tobin">Tobin</a></cite>] for constructing the infoset [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-INFOSET">XML-INFOSET</a></cite>] of an external entity.</p>
<p>The process consists of the following steps:</p>
<ol>
<li><p>If the parsing context contains any general entities, then emit a
document type declaration that provides entity declarations.</p></li>
<li><p>Emit a <code>dummy</code> element start-tag with namespace declaration
attributes declaring all the namespaces in the parsing context.</p></li>
<li><p>Emit the text.</p></li>
<li><p>Emit a <code>dummy</code> element end-tag.</p></li>
</ol>
<p>In the above steps, the document type declaration and <code>dummy</code>
element tags <em class="rfc2119" title="must">must</em> be encoded in UTF-8.</p>
<p>Consider the following document containing an <code>EncryptedData</code>
element:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_preproc"><!DOCTYPE</span> <span class="sh_type">Document</span><span class="sh_normal"> </span><span class="sh_type">[</span>
<span class="sh_type"><!ENTITY</span><span class="sh_normal"> </span><span class="sh_type">dsig</span><span class="sh_normal"> </span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span><span class="sh_preproc">></span>
]>
<span class="sh_keyword"><Document</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><foo:Body</span> <span class="sh_type">xmlns:foo</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/foo"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><EncryptedData</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#Element"</span><span class="sh_keyword">></span>
...
<span class="sh_keyword"></EncryptedData></span>
<span class="sh_keyword"></foo:Body></span>
<span class="sh_keyword"></Document></span></pre>
<p>If the <code>EncryptedData</code> element is decrypted to
the text "<code><One><foo:Two/></One></code>", then the
wrapped form is as follows:</p>
<pre class="sh_xml sh_sourceCode"><span class="sh_preproc"><!DOCTYPE</span> <span class="sh_type">dummy</span><span class="sh_normal"> </span><span class="sh_type">[</span>
<span class="sh_type"><!ENTITY</span><span class="sh_normal"> </span><span class="sh_type">dsig</span><span class="sh_normal"> </span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span><span class="sh_preproc">></span>
]>
<span class="sh_keyword"><dummy</span> <span class="sh_type">xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/"</span>
<span class="sh_type">xmlns:foo</span><span class="sh_symbol">=</span><span class="sh_string">"http://example.org/foo"</span><span class="sh_keyword">><One><foo:Two/></One></dummy></span></pre>
</div>
</div>
</div>
<div id="sec-Algorithms" class="section">
<!--OddPage--><h2><span class="secno">5. </span>Algorithms</h2>
<p>This section discusses algorithms used with the XML Encryption
specification. Entries contain the identifier to be used as the value of the
<code>Algorithm</code> attribute of the <code>EncryptionMethod</code> element
or other element representing the role of the algorithm, a reference to the
formal specification, definitions for the representation of keys and the
results of cryptographic operations where applicable, and general
applicability comments.</p>
<div id="sec-AlgID" class="section">
<h3><span class="secno">5.1 </span>Algorithm Identifiers and Implementation Requirements</h3>
<p>All algorithms listed below have implicit parameters depending on their
role. For example, the data to be encrypted or decrypted, keying material,
and direction of operation (encrypting or decrypting) for encryption
algorithms. Any explicit additional parameters to an algorithm appear as
content elements within the element. Such parameter child elements have
descriptive element names, which are frequently algorithm specific, and
<em class="rfc2119" title="should">should</em> be in the same namespace as this XML Encryption specification, the XML
Signature specification, or in an algorithm specific namespace. An example of
such an explicit parameter could be a nonce (unique quantity) provided to a
key agreement algorithm.</p>
<p>This specification defines a set of algorithms, their URIs, and
requirements for implementation. Levels of requirement specified, such as
"<em class="rfc2119" title="required">required</em>" or "<em class="rfc2119" title="optional">optional</em>", refer to implementation, not use. Furthermore, the
mechanism is extensible, and alternative algorithms may be used.</p>
<div id="sec-Table-of-Algorithms" class="section">
<h4><span class="secno">5.1.1 </span>Table of Algorithms</h4>
<p>The table below lists the categories of algorithms. Within each category,
a brief name, the level of implementation requirement, and an identifying URI
are given for each algorithm.</p>
<dl>
<dt>Block Encryption</dt>
<dd><ol>
<li><em class="rfc2119" title="required">required</em> TRIPLEDES<br>
<a href="http://www.w3.org/2001/04/xmlenc#tripledes-cbc">http://www.w3.org/2001/04/xmlenc#tripledes-cbc</a></li>
<li><em class="rfc2119" title="required">required</em> AES-128<br>
<a href="http://www.w3.org/2001/04/xmlenc#aes128-cbc">http://www.w3.org/2001/04/xmlenc#aes128-cbc</a></li>
<li><em class="rfc2119" title="required">required</em> AES-256<br>
<a href="http://www.w3.org/2001/04/xmlenc#aes256-cbc">http://www.w3.org/2001/04/xmlenc#aes256-cbc</a></li>
<li><em class="rfc2119" title="required">required</em> AES128-GCM<br>
<a href="http://www.w3.org/2009/xmlenc11#aes128-gcm">http://www.w3.org/2009/xmlenc11#aes128-gcm</a></li>
<li><em class="rfc2119" title="optional">optional</em> AES-192<br>
<a href="http://www.w3.org/2001/04/xmlenc#aes192-cbc">http://www.w3.org/2001/04/xmlenc#aes192-cbc</a></li>
<li><em class="rfc2119" title="optional">optional</em> AES256-GCM<br>
<a href="http://www.w3.org/2009/xmlenc11#aes256-gcm">http://www.w3.org/2009/xmlenc11#aes256-gcm</a></li>
</ol>
<p>
<strong id="cbc-warning">Note:</strong> Use
of AES GCM is strongly recommended over any CBC block encryption
algorithms as recent
advances in cryptanalysis [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLENC-CBC-ATTACK">XMLENC-CBC-ATTACK</a></cite>][<cite><a class="bibref" rel="biblioentry" href="#bib-XMLENC-CBC-ATTACK-COUNTERMEASURES">XMLENC-CBC-ATTACK-COUNTERMEASURES</a></cite>]
have cast doubt on the ability of CBC block encryption algorithms to
protect plain text when used with XML Encryption. Other mitigations
should be considered when using CBC block encryption, such as
conveying the encrypted data over a secure channel such as TLS. The
CBC block encryption algorithms that are listed as required remain
so for backward compatibility.
</p>
</dd>
<dt>Stream Encryption</dt>
<dd><ol>
<li>none<br>
Syntax and recommendations are given below to support user
specified algorithms.</li>
</ol>
</dd>
<dt>Key Derivation</dt>
<dd><ol>
<li><em class="rfc2119" title="required">required</em> ConcatKDF<br>
<a href="http://www.w3.org/2009/xmlenc11#ConcatKDF">http://www.w3.org/2009/xmlenc11#ConcatKDF</a></li>
<li><em class="rfc2119" title="optional">optional</em> PBKDF2<br>
<a href="http://www.w3.org/2009/xmlenc11#pbkdf2">http://www.w3.org/2009/xmlenc11#pbkdf2</a></li>
</ol>
</dd>
<dt>Key Transport</dt>
<dd><ol>
<li><em class="rfc2119" title="required">required</em> RSA-v1.5<br>
<a href="http://www.w3.org/2001/04/xmlenc#rsa-1_5">http://www.w3.org/2001/04/xmlenc#rsa-1_5</a></li>
<li><em class="rfc2119" title="required">required</em> RSA-OAEP (including MGF1 with SHA1)<br>
<a href="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p</a></li>
<li>Optional RSA-OAEP<br>
<a href="http://www.w3.org/2009/xmlenc11#rsa-oaep">http://www.w3.org/2009/xmlenc11#rsa-oaep</a></li>
</ol>
</dd>
<dt>Key Agreement</dt>
<dd><ol>
<li><em class="rfc2119" title="required">required</em> Elliptic Curve Diffie-Hellman (Ephemeral-Static mode) <br>
<a href="http://www.w3.org/2009/xmlenc11#ECDH-ES">http://www.w3.org/2009/xmlenc11#ECDH-ES</a></li>
<li><em class="rfc2119" title="optional">optional</em> Diffie-Hellman Key Agreement (Ephemeral-Static mode) with Legacy Key Derivation Function<br>
<a href="http://www.w3.org/2001/04/xmlenc#dh">http://www.w3.org/2001/04/xmlenc#dh</a></li>
<li><em class="rfc2119" title="optional">optional</em> Diffie-Hellman Key Agreement (Ephemeral-Static
mode) with explicit Key Derivation Functions<br>
<a href="http://www.w3.org/2009/xmlenc11#dh-es">http://www.w3.org/2009/xmlenc11#dh-es</a></li>
</ol>
</dd>
<dt>Symmetric Key Wrap</dt>
<dd><ol>
<li><em class="rfc2119" title="required">required</em> TRIPLEDES KeyWrap<br>
<a href="http://www.w3.org/2001/04/xmlenc#kw-tripledes">http://www.w3.org/2001/04/xmlenc#kw-tripledes</a></li>
<li><em class="rfc2119" title="required">required</em> AES-128 KeyWrap<br>
<a href="http://www.w3.org/2001/04/xmlenc#kw-aes128">http://www.w3.org/2001/04/xmlenc#kw-aes128</a></li>
<li><em class="rfc2119" title="required">required</em> AES-256 KeyWrap<br>
<a href="http://www.w3.org/2001/04/xmlenc#kw-aes256">http://www.w3.org/2001/04/xmlenc#kw-aes256</a></li>
<li><em class="rfc2119" title="optional">optional</em> AES-192 KeyWrap<br>
<a href="http://www.w3.org/2001/04/xmlenc#kw-aes192">http://www.w3.org/2001/04/xmlenc#kw-aes192</a></li>
<li><em class="rfc2119" title="optional">optional</em> AES-128-pad KeyWrap<br>
<a href="http://www.w3.org/2009/xmlenc11#kw-aes-128-pad">http://www.w3.org/2009/xmlenc11#kw-aes-128-pad</a></li>
<li><em class="rfc2119" title="optional">optional</em> AES-192-pad KeyWrap<br>
<a href="http://www.w3.org/2009/xmlenc11#kw-aes-192-pad">http://www.w3.org/2009/xmlenc11#kw-aes-192-pad</a></li>
<li><em class="rfc2119" title="optional">optional</em> AES-256-pad KeyWrap<br>
<a href="http://www.w3.org/2009/xmlenc11#kw-aes-256-pad">http://www.w3.org/2009/xmlenc11#kw-aes-256-pad</a></li>
</ol>
</dd>
<dt>Message Digest</dt>
<dd><ol>
<li><em class="rfc2119" title="required">required</em> SHA1 (<em>Use is DISCOURAGED</em>; see below).<br>
<a href="http://www.w3.org/2000/09/xmldsig#sha1">http://www.w3.org/2000/09/xmldsig#sha1</a></li>
<li><em class="rfc2119" title="required">required</em> SHA256<br>
<a href="http://www.w3.org/2001/04/xmlenc#sha256">http://www.w3.org/2001/04/xmlenc#sha256</a></li>
<li><em class="rfc2119" title="optional">optional</em> SHA384<br>
<a href="http://www.w3.org/2001/04/xmlenc#sha384">http://www.w3.org/2001/04/xmlenc#sha384</a></li>
<li><em class="rfc2119" title="optional">optional</em> SHA512<br>
<a href="http://www.w3.org/2001/04/xmlenc#sha512">http://www.w3.org/2001/04/xmlenc#sha512</a></li>
<li><em class="rfc2119" title="optional">optional</em> RIPEMD-160<br>
<a href="http://www.w3.org/2001/04/xmlenc#ripemd160">http://www.w3.org/2001/04/xmlenc#ripemd160</a></li>
</ol>
</dd>
<dt>Canonicalization</dt>
<dd><ol>
<li><em class="rfc2119" title="optional">optional</em> Canonical XML 1.0 (omit comments)<br>
<a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</a></li>
<li><em class="rfc2119" title="optional">optional</em> Canonical XML 1.0 (with comments)<br>
<a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments">http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments</a></li>
<li><em class="rfc2119" title="optional">optional</em> Canonical XML 1.1 (omit comments)<br>
<a href="http://www.w3.org/2006/12/xml-c14n11">http://www.w3.org/2006/12/xml-c14n11</a></li>
<li><em class="rfc2119" title="optional">optional</em> Canonical XML 1.1 (with comments)<br>
<a href="http://www.w3.org/2006/12/xml-c14n11#WithComments">http://www.w3.org/2006/12/xml-c14n11#WithComments</a></li>
<li><em class="rfc2119" title="optional">optional</em> Exclusive XML Canonicalization 1.0 (omit comments)<br>
<a href="http://www.w3.org/2001/10/xml-exc-c14n#">http://www.w3.org/2001/10/xml-exc-c14n#</a></li>
<li><em class="rfc2119" title="optional">optional</em> Exclusive XML Canonicalization 1.0 (with comments)<br>
<a href="http://www.w3.org/2001/10/xml-exc-c14n#WithComments">http://www.w3.org/2001/10/xml-exc-c14n#WithComments</a></li>
</ol>
</dd>
<dt>Encoding</dt>
<dd><ol>
<li><em class="rfc2119" title="required">required</em> base64 (<a href="#base64note">*note</a>)<br>
<a href="http://www.w3.org/2000/09/xmldsig#base64">http://www.w3.org/2000/09/xmldsig#base64</a></li>
</ol>
</dd>
<dt>Transforms</dt>
<dd>
<ol>
<li><em class="rfc2119" title="required">required</em> base64 (<a href="#base64note">*note</a>)<br>
<a href="http://www.w3.org/2000/09/xmldsig#base64">http://www.w3.org/2000/09/xmldsig#base64</a></li>
</ol>
</dd>
</dl>
<div id="base64note">
<p>*note:
The same URI is used to identify base64 both in "encoding"
context (e.g. when used with the <code>Encoding</code> attribute
of an <code>EncryptedKey</code> element,
see <a href="#sec-EncryptedType" class="sectionRef">section 3.1 The EncryptedType Element</a>) as
well as in "transform" context (when identifying a base64
transform for a <code>CipherReference</code>, see <a href="#sec-CipherReference" class="sectionRef">section 3.3.1 The CipherReference Element</a>).</p>
</div>
</div>
</div>
<div id="sec-Alg-Block" class="section">
<h3><span class="secno">5.2 </span>Block Encryption Algorithms</h3>
<p>Block encryption algorithms are designed for encrypting and decrypting
data in fixed size, multiple octet blocks. Their identifiers appear as the
value of the <code>Algorithm</code> attributes of
<code>EncryptionMethod</code> elements that are children of
<code>EncryptedData</code>.</p>
<p>
<strong>Note</strong>: CBC block encryption algorithms should not be used without
consideration of <a href="#cbc-warning">possibly severe
security risks</a>.
</p>
<p>Block encryption algorithms take, as implicit arguments, the data to be
encrypted or decrypted, the keying material, and their direction of
operation. For all of these algorithms specified below, an initialization
vector (IV) is required that is encoded with the cipher text. For user
specified block encryption algorithms, the IV, if any, could be specified as
being with the cipher data, as an algorithm content element, or elsewhere.</p>
<p>The IV is encoded with and before the cipher text for the algorithms below
for ease of availability to the decryption code and to emphasize its
association with the cipher text. Good cryptographic practice requires that a
different IV be used for every encryption.</p>
<div id="sec-Padding" class="section">
<h4><span class="secno">5.2.1 </span>Padding</h4>
<p>Since the data being encrypted is an arbitrary number of octets, it may
not be a multiple of the block size. This is solved by padding the plain text
up to the block size before encryption and unpadding after decryption. The
padding algorithm is to calculate the smallest non-zero number of octets, say
<code>N</code>, that must be suffixed to the plain text to bring it up to a
multiple of the block size. We will assume the block size is <code>B</code>
octets so <code>N</code> is in the range of 1 to <code>B</code>. Pad by
suffixing the plain text with <code>N-1</code> arbitrary pad bytes and a
final byte whose value is <code>N</code>. On decryption, just take the last
byte and, after sanity checking it, strip that many bytes from the end of the
decrypted cipher text.</p>
<p>For example, assume an 8 byte block size and plain text of
<code>0x616263</code>. The padded plain text would then be
<code>0x616263????????05</code> where the "??" bytes can be any value.
Similarly, plain text of <code>0x2122232425262728</code> would be padded to
<code>0x2122232425262728??????????????08</code>.</p>
</div>
<div id="sec-tripledes-cbc" class="section">
<h4><span class="secno">5.2.2 </span>Triple DES</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="tripledes-cbc" href="http://www.w3.org/2001/04/xmlenc#tripledes-cbc">http://www.w3.org/2001/04/xmlenc#tripledes-cbc</a>
(<em class="rfc2119" title="required">required</em>)</dd>
</dl>
<p>NIST SP800-67 [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-67">SP800-67</a></cite>] specifies three
sequential FIPS 46-3 [<cite><a class="bibref" rel="biblioentry" href="#bib-DES">DES</a></cite>] operations. The XML
Encryption TRIPLEDES consists of a DES encrypt, a DES decrypt, and a DES
encrypt used in the Cipher Block Chaining (CBC) mode with 192 bits of key and
a 64 bit Initialization Vector (IV). Of the key bits, the first 64 are used
in the first DES operation, the second 64 bits in the middle DES operation,
and the third 64 bits in the last DES operation.</p>
<p>Note: Each of these 64 bits of key contain 56 effective bits and 8 parity
bits. Thus there are only 168 operational bits out of the 192 being
transported for a TRIPLEDES key. (Depending on the criterion used for
analysis, the effective strength of the key may be thought to be 112 bits
(due to meet in the middle attacks) or even less.)</p>
<p>The resulting cipher text is prefixed by the IV. If included in XML
output, it is then base64 encoded. An example TRIPLEDES EncryptionMethod is
as follows:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><EncryptionMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#tripledes-cbc"</span><span class="sh_keyword">/></span></pre>
<p>
<strong>Note</strong>: CBC block encryption algorithms should not be used without
consideration of <a href="#cbc-warning">possibly severe
security risks</a>.
</p>
</div>
<div id="sec-AES" class="section">
<h4><span class="secno">5.2.3 </span>AES</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="aes128-cbc" href="http://www.w3.org/2001/04/xmlenc#aes128-cbc">http://www.w3.org/2001/04/xmlenc#aes128-cbc</a>
(<em class="rfc2119" title="required">required</em>)</dd>
<dd><a id="aes192-cbc" href="http://www.w3.org/2001/04/xmlenc#aes192-cbc">http://www.w3.org/2001/04/xmlenc#aes192-cbc</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a id="aes256-cbc" href="http://www.w3.org/2001/04/xmlenc#aes256-cbc">http://www.w3.org/2001/04/xmlenc#aes256-cbc</a>
(<em class="rfc2119" title="required">required</em>)</dd>
</dl>
<p>[<cite><a class="bibref" rel="biblioentry" href="#bib-AES">AES</a></cite>] is used in the Cipher Block Chaining (CBC)
mode with a 128 bit initialization vector (IV). The resulting cipher text is
prefixed by the IV. If included in XML output, it is then base64 encoded. An
example AES EncryptionMethod is as follows:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><EncryptionMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#aes128-cbc"</span><span class="sh_keyword">/></span></pre>
<p>
<strong>Note</strong>: CBC block encryption algorithms should not be used without
consideration of <a href="#cbc-warning">possibly severe
security risks</a>.
</p>
</div>
<div id="sec-AES-GCM" class="section">
<h4><span class="secno">5.2.4 </span>AES-GCM</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="aes128-gcm" href="http://www.w3.org/2009/xmlenc11#aes128-gcm">http://www.w3.org/2009/xmlenc11#aes128-gcm</a>
(<em class="rfc2119" title="required">required</em>)</dd>
<dd><a id="aes256-gcm" href="http://www.w3.org/2009/xmlenc11#aes256-gcm">http://www.w3.org/2009/xmlenc11#aes256-gcm</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>
AES-GCM [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-38D">SP800-38D</a></cite>] is an authenticated encryption mechanism. It is
equivalent to doing these two operations in one step - AES
encryption followed by HMAC signing.</p>
<p>AES-GCM is very attractive from a performance point of
view because the cost of AES-GCM is similar to regular AES-CBC
encryption, yet it achieves the same result as encryption and HMAC
signing. Also AES-GCM can be pipelined so it is amenable to
hardware acceleration.
</p>
<p>For the purposes of this specification, AES-GCM shall be used with a
96 bit Initialization Vector (IV) and a 128 bit Authentication Tag
(T). The cipher text contains the IV first, followed by the encrypted
octets and finally the Authentication tag. No padding should be used
during encryption. During decryption the implementation should compare
the authentication tag computed during decryption with the specified
Authentication Tag, and fail if they don't match. For details on the
implementation of AES-GCM, see [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-38D">SP800-38D</a></cite>].
</p>
</div>
</div>
<div id="sec-Alg-Stream" class="section">
<h3><span class="secno">5.3 </span>Stream Encryption Algorithms</h3>
<p>Simple stream encryption algorithms generate, based on the key, a stream
of bytes which are XORed with the plain text data bytes to produce the cipher
text on encryption and with the cipher text bytes to produce plain text on
decryption. They are normally used for the encryption of data and are
specified by the value of the <code>Algorithm</code> attribute of the
<code>EncryptionMethod</code> child of an <code>EncryptedData</code>
element.</p>
<p>NOTE: It is critical that each simple stream encryption key (or key and
initialization vector (IV) if an IV is also used) be used once only. If the
same key (or key and IV) is ever used on two messages then, by XORing the two
cipher texts, you can obtain the XOR of the two plain texts. This is usually
very compromising.</p>
<p>No specific stream encryption algorithms are specified herein but this
section is included to provide general guidelines.</p>
<p>Stream algorithms typically use the optional <code>KeySize</code> explicit
parameter. In cases where the key size is not apparent from the algorithm URI
or key source, as in the use of key agreement methods, this parameter sets
the key size. If the size of the key to be used is apparent and disagrees
with the <code>KeySize</code> parameter, an error <em class="rfc2119" title="must">must</em> be returned.
Implementation of any stream algorithms is optional. The schema for the
KeySize parameter is as follows:</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><simpleType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"KeySizeType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><restriction</span> <span class="sh_type">base</span><span class="sh_symbol">=</span><span class="sh_string">"integer"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></simpleType></span></pre>
</div>
<div id="sec-Alg-KeyDerivation" class="section">
<h3><span class="secno">5.4 </span>Key Derivation</h3>
<p>
Key derivation is a well-established mechanism for generating new
cryptographic key material from some existing, original ("master")
key material and potentially other information. Derived keys are
used for a variety of purposes including data encryption and message
authentication. The reason for doing key derivation itself is
typically a combination of a desire to expand a given, but limited,
set of original key material and prudent security practices of
limiting use (exposure) of such key material. Key separation (such as
avoiding use of the same key material for multiple purposes) is an
example of such practices.
</p>
<p>
The key derivation process may be based on passphrases agreed upon
or remembered by users, or it can be based on some shared "master"
cryptographic keys (and be intended to reduce exposure of such master
keys), etc. Derived keys themselves may be used in XML Signature and
XML Encryption as any other keys; in particular, they may be used to
compute message authentication codes (e.g. digital signatures using
symmetric keys) or for encryption/decryption purposes.
</p>
<div id="sec-ConcatKDF" class="section">
<h4><span class="secno">5.4.1 </span>ConcatKDF</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="ConcatKDF" href="http://www.w3.org/2009/xmlenc11#ConcatKDF">http://www.w3.org/2009/xmlenc11#ConcatKDF</a>
(<em class="rfc2119" title="required">required</em>)</dd>
</dl>
<p>The ConcatKDF key derivation algorithm, defined in Section 5.8.1 of NIST
SP 800-56A [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-56A">SP800-56A</a></cite>] (and equivalent to
the KDF3 function defined in ANSI X9.44-2007 [<cite><a class="bibref" rel="biblioentry" href="#bib-ANSI-X9-44-2007">ANSI-X9-44-2007</a></cite>] when
the contents of the
<code>OtherInfo</code> parameter is structured as in NIST SP 800-56A),
takes several parameters. These parameters are represented in the
<code>xenc11:ConcatKDFParamsType</code>:
</p>
<pre class="sh_xml sh_sourceCode">Schema Definition:
<span class="sh_comment"><!-- targetNamespace='http://www.w3.org/2009/xmlenc11#' --></span>
<span class="sh_comment"><!-- use this element type as a child of xenc11:KeyDerivationMethod</span>
<span class="sh_comment"> when used with ConcatKDF --></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"ConcatKDFParams"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:ConcatKDFParamsType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"ConcatKDFParamsType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"ds:DigestMethod"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"AlgorithmID"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"hexBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"PartyUInfo"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"hexBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"PartyVInfo"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"hexBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"SuppPubInfo"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"hexBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"SuppPrivInfo"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"hexBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span>
</pre>
<p>
The <code>ds:DigestMethod</code> element identifies the digest
algorithm used by the KDF. Compliant implementations <em class="rfc2119" title="must">must</em> support
SHA-256 and SHA-1 (support for SHA-1 is present only for
backwards-compatibility reasons). Support for SHA-384 and SHA-512 is
<em class="rfc2119" title="optional">optional</em>.
</p>
<p>
The <code>AlgorithmID</code>, <code>PartyUInfo</code>,
<code>PartyVInfo</code>, <code>SuppPubInfo</code> and
<code>SuppPrivInfo</code> attributes are as defined in
[<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-56A">SP800-56A</a></cite>]. Their
presence is optional but <code>AlgorithmID</code>,
<code>PartyVInfo</code> and <code>PartyUInfo</code> <em class="rfc2119" title="must">must</em> be present
for applications that need to comply with [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-56A">SP800-56A</a></cite>].
Note: The <code>PartyUInfo</code> component shall include a nonce when
ConcatKDF is
used in conjunction with a static-static Diffie-Hellman (or
static-static ECDH) key agreement scheme; see further [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-56A">SP800-56A</a></cite>].
</p>
<p>
In [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-56A">SP800-56A</a></cite>], <code>AlgorithmID</code>, <code>PartyUInfo</code>, <code>PartyVInfo</code>, <code>SuppPubInfo</code>
and
<code>SuppPrivInfo</code> attributes are all defined as
arbitrary-length bitstrings, thus they may need to be padded in order
to be encoded into hexBinary for XML Encryption. The following
padding and encoding method <em class="rfc2119" title="must">must</em> be used when encoding bitstring
values for the <code>AlgorithmID</code>, <code>PartyUInfo</code>,
<code>PartyVInfo</code>, <code>SuppPubInfo</code> and
<code>SuppPrivInfo</code>:
</p>
<ol>
<li><p>
The bitstring is divided into octets using big-endian encoding. If
the length of the bitstring is not a multiple of 8 then add padding
bits (value 0) as necessary to the last octet to make it a multiple of
8.</p>
</li>
<li><p>
Prepend one octet to the octets string from step 1. This octet shall
identify (in a big-endian representation) the number of padding bits
added to the last octet in step 1.</p>
</li>
<li><p>
Encode the octet string resulting from step 2 as a hexBinary string.</p>
</li>
</ol>
<p>
Example: the bitstring <code>11011</code>, which is 5 bits long, gets
3 additional padding bits to become the
bitstring <code>11011000</code> (or <code>D8</code> in hex). This
bitstring is then prepended with one octet identifying the number of
padding bits to become the octet string (in hex) <code>03D8</code>, which then
finally is encoded as a hexBinary string value of "03D8".
</p>
<p>
Note that as specified in [<cite><a class="bibref" rel="biblioentry" href="#bib-SP800-56A">SP800-56A</a></cite>],
these attributes shall be concatenated to form a bit string
“OtherInfo” that is used with the key derivation function. The
concatenation <em class="rfc2119" title="shall">shall</em> be done using the original, unpadded bit string
values.” Applications <em class="rfc2119" title="must">must</em> also verify that these attributes, in an
application-specific way not defined in this document, identify
algorithms and parties in accordance with NIST SP800-56.
</p>
<p>
An example of an <code>xenc11:DerivedKey</code> element with this key
derivation algorithm given below. In this example, the bitstring
value of <code>AlgorithmID</code> is <code>00000000</code>, the
bitstring value of <code>PartyUInfo</code> is <code>11011</code> and
the bitstring value of <code>PartyVInfo</code> is <code>11010</code>:
</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><xenc11:DerivedKey</span>
<span class="sh_type">xmlns:xsi</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span>
<span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span>
<span class="sh_type">xmlns:xenc</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">xmlns:xenc11</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc11:KeyDerivationMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#ConcatKDF"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc11:ConcatKDFParams</span> <span class="sh_type">AlgorithmID</span><span class="sh_symbol">=</span><span class="sh_string">"0000"</span> <span class="sh_type">PartyUInfo</span><span class="sh_symbol">=</span><span class="sh_string">"03D8"</span> <span class="sh_type">PartyVInfo</span><span class="sh_symbol">=</span><span class="sh_string">"03D0"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ds:DigestMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#sha256"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></xenc11:ConcatKDFParams></span>
<span class="sh_keyword"></xenc11:KeyDerivationMethod></span>
<span class="sh_keyword"><xenc:ReferenceList></span>
<span class="sh_keyword"><xenc:DataReference</span> <span class="sh_type">URI</span><span class="sh_symbol">=</span><span class="sh_string">"#ED"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></xenc:ReferenceList></span>
<span class="sh_keyword"><xenc11:MasterKeyName></span>Our other secret<span class="sh_keyword"></xenc11:MasterKeyName></span>
<span class="sh_keyword"></xenc11:DerivedKey></span></pre>
<div class="note">
While any bit string can be used with ConcatKDF, it is <em class="rfc2119" title="recommended">recommended</em> to keep byte
aligned for greatest interoperability.
</div>
</div>
<div id="sec-PBKDF2" class="section">
<h4><span class="secno">5.4.2 </span>PBKDF2</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="PBKDF2" href="http://www.w3.org/2009/xmlenc11#pbkdf2">http://www.w3.org/2009/xmlenc11#pbkdf2</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>
The PBKDF2 key derivation algorithm and the ASN.1 type definitions for
its parameters are defined in PKCS #5 v2.0 [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS5">PKCS5</a></cite>]. The XML schema
definitions for the parameters is defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS5Amd1">PKCS5Amd1</a></cite>] and the same
can be specified by enclosing them within an <code>xenc11:PBKDF2-params</code> child
element of the <code>xenc11:KeyDerivationMethod</code> element.
</p>
<p>
</p><pre class="sh_xml sh_sourceCode">Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"PBKDF2-params"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:PBKDF2ParameterType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"PBKDF2ParameterType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Salt"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><complexType></span>
<span class="sh_keyword"><choice></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Specified"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"base64Binary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"OtherSource"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:AlgorithmIdentifierType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></choice></span>
<span class="sh_keyword"></complexType></span>
<span class="sh_keyword"></element></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"IterationCount"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"positiveInteger"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"KeyLength"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"positiveInteger"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"PRF"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:PRFAlgorithmIdentifierType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"></complexType></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"AlgorithmIdentifierType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Parameters"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Algorithm"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"PRFAlgorithmIdentifierType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><complexContent></span>
<span class="sh_keyword"><restriction</span> <span class="sh_type">base</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:AlgorithmIdentifierType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Algorithm"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></restriction></span>
<span class="sh_keyword"></complexContent></span>
<span class="sh_keyword"></complexType></span>
</pre>
<p>(Note: A newline has been added to the Algorithm attribute to fit on this page, but is not part of the URI.)</p>
<p>
The <code>PBKDF2-params</code> element and its child elements have the
same names
and meaning as the corresponding components of
the <code>PBKDF2-params</code> ASN.1
type in [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS5">PKCS5</a></cite>]. Note, in case of ConcatKDF and the Diffie Hellman
legacy KDF, <code>KeyLength</code> is an implied parameter and needs to be
inferred from the context, but in the case of PBKDF2
the <code>KeyLength</code> child
element has to be specified, as it has been made a mandatory parameter
to be consistent with PKCS5. For PBKDF2, the inferred key length must
match the specified key length, otherwise it is an error condition.
</p>
<p>
The <code>AlgorithmIdentifierType</code> corresponds to
the <code>AlgorithmIdentifier</code> type of [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS5">PKCS5</a></cite>] and carries the
algorithm identifier in the <code>Algorithm</code> attribute. Algorithm
specific parameters, where applicable, can be specified using
the <code>Parameters</code> element.
</p>
<p>
The <code>PRFAlgorithmIdentifierType</code> is derived from the
<code>AlgorithmIdentifierType</code> and constrains the choice of
algorithms to those contained in the PBKDF2-PRFs set defined in
[<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS5">PKCS5</a></cite>]. This type is used to specify a pseudorandom function (PRF)
for PBKDF2. Whereas HMAC-SHA1 is the default PRF algorithm in [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS5">PKCS5</a></cite>],
use of HMAC-SHA256 is <em class="rfc2119" title="recommended">recommended</em> by this specification (see [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>],
[<cite><a class="bibref" rel="biblioentry" href="#bib-HMAC">HMAC</a></cite>]).
</p>
<p>
An example of an <code>xenc11:DerivedKey</code> element with this key
derivation algorithm is:
</p>
<p>
</p><pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><xenc11:DerivedKey</span>
<span class="sh_type">xmlns:xsi</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span>
<span class="sh_type">xmlns:xenc</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">xmlns:xenc11</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc11:KeyDerivationMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#pbkdf2"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><xenc11:PBKDF2-params></span>
<span class="sh_keyword"><xenc11:Salt></span>
<span class="sh_keyword"><xenc11:Specified></span>Df3dRAhjGh8=<span class="sh_keyword"></xenc11:Specified></span>
<span class="sh_keyword"></xenc11:Salt></span>
<span class="sh_keyword"><xenc11:IterationCount></span>2000<span class="sh_keyword"></xenc11:IterationCount></span>
<span class="sh_keyword"><xenc11:KeyLength></span>16<span class="sh_keyword"></xenc11:KeyLength></span>
<span class="sh_keyword"><xenc11:PRF</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmldsig-more#hmac-sha256"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></xenc11:PBKDF2-params></span>
<span class="sh_keyword"></xenc11:KeyDerivationMethod></span>
<span class="sh_keyword"><xenc:ReferenceList></span>
<span class="sh_keyword"><xenc:DataReference</span> <span class="sh_type">URI</span><span class="sh_symbol">=</span><span class="sh_string">"#ED"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></xenc:ReferenceList></span>
<span class="sh_keyword"><xenc11:MasterKeyName></span>Our shared secret<span class="sh_keyword"></xenc11:MasterKeyName></span>
<span class="sh_keyword"></xenc11:DerivedKey></span></pre>
</div>
</div>
<div id="sec-Alg-KeyTransport" class="section">
<h3><span class="secno">5.5 </span>Key Transport</h3>
<p>Key Transport algorithms are public key encryption algorithms especially
specified for encrypting and decrypting keys. Their identifiers appear as
<code>Algorithm</code> attributes to <code>EncryptionMethod</code> elements
that are children of <code>EncryptedKey</code>. <code>EncryptedKey</code> is
in turn the child of a <code>ds:KeyInfo</code> element. The type of key being
transported, that is to say the algorithm in which it is planned to use the
transported key, is given by the <code>Algorithm</code> attribute of the
<code>EncryptionMethod</code> child of the <code>EncryptedData</code> or
<code>EncryptedKey</code> parent of this <code>ds:KeyInfo</code> element.</p>
<p>(Key Transport algorithms may optionally be used to encrypt data in which
case they appear directly as the <code>Algorithm</code> attribute of an
<code>EncryptionMethod</code> child of an <code>EncryptedData</code> element.
Because they use public key algorithms directly, Key Transport algorithms are
not efficient for the transport of any amounts of data significantly larger
than symmetric keys.)</p>
<div id="sec-RSA-1_5" class="section">
<h4><span class="secno">5.5.1 </span>RSA Version 1.5</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="rsa-1_5" href="http://www.w3.org/2001/04/xmlenc#rsa-1_5">http://www.w3.org/2001/04/xmlenc#rsa-1_5</a>
(<em class="rfc2119" title="required">required</em>)</dd>
</dl>
<p>The RSAES-PKCS1-v1_5 algorithm, specified in RFC 3447 [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS1">PKCS1</a></cite>], takes no explicit parameters. An example of an
RSA Version 1.5 <code>EncryptionMethod</code> element is:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><EncryptionMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#rsa-1_5"</span><span class="sh_keyword">/></span></pre>
<p>The <code>CipherValue</code> for such an encrypted key is the base64 [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2045">RFC2045</a></cite>] encoding of the octet string computed as per RFC
3447 [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS1">PKCS1</a></cite>], section 7.2.1: Encryption operation].
As specified in the EME-PKCS1-v1_5 function RFC 3447 [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS1">PKCS1</a></cite>],
section 7.2.1, the value input to the key
transport function is as follows:</p>
<pre class="example sh_xml sh_sourceCode">CRYPT ( PAD ( KEY ))</pre>
<p>where the padding is of the following special form:</p>
<pre class="example sh_xml sh_sourceCode">02 | PS* | 00 | key</pre>
<p>where "|" is concatenation, "02" and "00" are fixed octets of the
corresponding hexadecimal value, PS is a string of strong pseudo-random
octets [<cite><a class="bibref" rel="biblioentry" href="#bib-RANDOM">RANDOM</a></cite>] at least eight octets long,
containing no zero octets, and long enough that the value of the quantity
being CRYPTed is one octet shorter than the RSA modulus, and "key" is the key
being transported. The key is 192 bits for TRIPLEDES and 128, 192, or 256
bits for AES.</p>
<p>Implementations <em class="rfc2119" title="must">must</em> support this key transport algorithm for transporting 192-bit TRIPLEDES keys. Support of this algorithm for
transporting other keys is <em class="rfc2119" title="optional">optional</em>. RSA-OAEP is <em class="rfc2119" title="recommended">recommended</em> for the
transport of AES keys.</p>
<p>The resulting base64 [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2045">RFC2045</a></cite>] string is the value of
the child text node of the <code>CipherData</code> element, e.g.</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><CipherData></span>
<span class="sh_keyword"><CipherValue></span>IWijxQjUrcXBYoCei4QxjWo9Kg8D3p9tlWoT4
t0/gyTE96639In0FZFY2/rvP+/bMJ01EArmKZsR5VW3rwoPxw=
<span class="sh_keyword"></CipherValue></span>
<span class="sh_keyword"></CipherData></span></pre>
</div>
<div id="sec-RSA-OAEP" class="section">
<h4><span class="secno">5.5.2 </span>RSA-OAEP</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="rsa-oaep-mgf1p" href="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p</a>
(including <code>MGF1 with SHA1</code> mask generation function)</dd>
<dt>Identifier:</dt>
<dd><a id="rsa-oaep" href="http://www.w3.org/2009/xmlenc11#rsa-oaep">http://www.w3.org/2009/xmlenc11#rsa-oaep</a></dd>
</dl>
<p>
The RSAES-OAEP-ENCRYPT algorithm, as specified in RFC 3447 [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS1">PKCS1</a></cite>],
has options that define the message digest function and mask
generation function, as well as an optional <code>PSourceAlgorithm</code>
parameter. Default values defined in RFC 3447 are <code>SHA1</code>
for the message
digest and <code>MGF1 with SHA1</code> for the mask generation
function. Both the
message digest and mask generation functions are used in the
EME-OAEP-ENCODE operation as part of RSAES- OAEP-ENCRYPT. </p>
<p>
The http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p identifier defines
the mask generation function as the fixed value of <code>MGF1 with
SHA1</code>. In
this case the optional <code>xenc11:MGF</code> element of the
<code>xenc:EncryptionMethod</code> element <em class="rfc2119" title="must not">must not</em> be provided. </p>
<p>
The http://www.w3.org/2009/xmlenc11#rsa-oaep identifier defines the
mask generation function using the optional <code>xenc11:MGF</code>
element of the <code>xenc:EncryptionMethod</code> element. If not present, the
default of <code>MGF1 with SHA1</code> is to be used.</p>
<p>The following URIs define the various mask generation function URI
values that may be used. These correspond to the object identifiers
defined in RFC 4055 [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC4055">RFC4055</a></cite>]: </p>
<ul>
<li>MGF1 with SHA1: http://www.w3.org/2009/xmlenc11#mgf1sha1</li>
<li>MGF1 with SHA224: http://www.w3.org/2009/xmlenc11#mgf1sha224</li>
<li>MGF1 with SHA256: http://www.w3.org/2009/xmlenc11#mgf1sha256</li>
<li>MGF1 with SHA384: http://www.w3.org/2009/xmlenc11#mgf1sha384</li>
<li>MGF1 with SHA512: http://www.w3.org/2009/xmlenc11#mgf1sha512</li>
</ul>
<p>Otherwise the two identifiers define the same usage of the RSA-OAEP
algorithm, as follows. </p>
<p>The message digest function <em class="rfc2119" title="should">should</em> be specified using the Algorithm
attribute of the <code>ds:DigestMethod</code> child element
of the <code>xenc:EncryptionMethod</code> element. If it is not specified, the
default value of <code>SHA1</code> is to be used. </p>
<p>The optional RSA-OAEP <code>PSourceAlgorithm</code> parameter value <em class="rfc2119" title="may">may</em> be
explicitly provided by placing the base64 encoded octets in the
<code>xenc:OAEPparams</code> XML element. </p>
<pre class="sh_xml sh_sourceCode">Schema Definition:
<span class="sh_comment"><!-- use these element types as children of EncryptionMethod</span>
<span class="sh_comment"> when used with RSA-OAEP --></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"OAEPparams"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"base64Binary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">ref</span><span class="sh_symbol">=</span><span class="sh_string">"ds:DigestMethod"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"MGF"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:MGFType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"MGFType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><complexContent></span>
<span class="sh_keyword"><restriction</span> <span class="sh_type">base</span><span class="sh_symbol">=</span><span class="sh_string">"xenc11:AlgorithmIdentifierType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Algorithm"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"required"</span> <span class="sh_keyword">/></span>
<span class="sh_keyword"></restriction></span>
<span class="sh_keyword"></complexContent></span>
<span class="sh_keyword"></complexType></span>
</pre>
<p>An example of an RSA-OAEP element is:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><EncryptionMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><OAEPparams></span>9lWu3Q==<span class="sh_keyword"></OAEPparams></span>
<span class="sh_keyword"><ds:DigestMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#sha1"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><EncryptionMethod></span></pre>
<p>Another example is:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><EncryptionMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#rsa-oaep"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><OAEPparams></span>9lWu3Q==<span class="sh_keyword"></OAEPparams></span>
<span class="sh_keyword"><xenc11:MGF</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#MGF1withSHA1"</span> <span class="sh_keyword">/></span>
<span class="sh_keyword"><ds:DigestMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#sha1"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><EncryptionMethod></span></pre>
<p>The <code>CipherValue</code> for an RSA-OAEP encrypted key is the base64
[<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2045">RFC2045</a></cite>] encoding of the octet string computed as per
RFC 3447 [<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS1">PKCS1</a></cite>], section 7.1.1: Encryption
operation. As described in the EME-OAEP-ENCODE function RFC 3447
[<cite><a class="bibref" rel="biblioentry" href="#bib-PKCS1">PKCS1</a></cite>], section 7.1.1, the value input to the key
transport function is calculated using the message digest function and string
specified in the <code>DigestMethod</code> and <code>OAEPparams</code>
elements and using either the mask generator function specified with
the <code>xenc11:MGF</code> element or the default <code>MGF1 with
SHA1</code> specified in
RFC 3447. The desired output length for EME-OAEP-ENCODE is one byte shorter
than the RSA modulus.</p>
<p>The transported key size is 192 bits for TRIPLEDES and 128, 192, or 256
bits for AES. Implementations <em class="rfc2119" title="must">must</em> implement RSA-OAEP for the transport of
all key types and sizes that are mandatory to implement for symmetric
encryption. They <em class="rfc2119" title="may">may</em> implement RSA-OAEP for the transport of other
keys.</p>
</div>
</div>
<div id="sec-Alg-KeyAgreement" class="section">
<h3><span class="secno">5.6 </span>Key Agreement</h3>
<p>A Key Agreement algorithm provides for the derivation of a shared secret
key based on a shared secret computed from certain types of compatible public
keys from both the sender and the recipient. Information from the originator
to determine the secret is indicated by an optional
<code>OriginatorKeyInfo</code> parameter child of an
<code>AgreementMethod</code> element while that associated with the recipient
is indicated by an optional <code>RecipientKeyInfo</code>. A shared key is
derived from this shared secret by a method determined by the Key Agreement
algorithm.</p>
<p>Note: XML Encryption does not provide an online key agreement negotiation
protocol. The <code>AgreementMethod</code> element can be used by the
originator to identify the keys and computational procedure that were used to
obtain a shared encryption key. The method used to obtain or select the keys
or algorithm used for the agreement computation is beyond the scope of this
specification.</p>
<p>The <code>AgreementMethod</code> element appears as the content of a
<code>ds:KeyInfo</code> since, like other <code>ds:KeyInfo</code> children,
it yields a key. This <code>ds:KeyInfo</code> is in turn a child of an
<code>EncryptedData</code> or <code>EncryptedKey</code> element. The
<code>Algorithm</code> attribute and <code>KeySize</code> child of the
<code>EncryptionMethod</code> element under this <code>EncryptedData</code>
or <code>EncryptedKey</code> element are implicit parameters to the key
agreement computation. In cases where this <code>EncryptionMethod</code>
algorithm URI is insufficient to determine the key length, a
<code>KeySize</code> <em class="rfc2119" title="must">must</em> have been included.
</p>
<p>
Key derivation algorithms (with associated parameters) may be
explicitly declared by using the
<code>xenc11:KeyDerivationMethod</code> element. This element will
then be placed at the extensibility point of the
<code>xenc:AgreementMethodType</code> (see below).
</p>
<p>
In addition, the sender may place a <code>KA-Nonce</code> element under
<code>AgreementMethod</code> to assure that different keying material
is generated even for repeated agreements using the same sender and
recipient public keys. For example:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><EncryptedData></span>
<span class="sh_keyword"><EncryptionMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"Example:Block/Alg"</span>
<span class="sh_type"><KeySize</span><span class="sh_keyword">></span>80<span class="sh_keyword"></KeySize></span>
<span class="sh_keyword"></EncryptionMethod></span>
<span class="sh_keyword"><ds:KeyInfo</span> <span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><AgreementMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"example:Agreement/Algorithm"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><KA-Nonce></span>Zm9v<span class="sh_keyword"></KA-Nonce></span>
<span class="sh_keyword"><xenc11:KeyDerivationMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#ConcatKDF"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><xenc11:ConcatKDFParams</span>
<span class="sh_type">AlgorithmID</span><span class="sh_symbol">=</span><span class="sh_string">"00"</span> <span class="sh_type">PartyUInfo</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_type">PartyVInfo</span><span class="sh_symbol">=</span><span class="sh_string">""</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ds:DigestMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#sha256"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></xenc11:ConcatKDFParams></span>
<span class="sh_keyword"></xenc11:KeyDerivationMethod></span>
<span class="sh_keyword"><OriginatorKeyInfo></span>
<span class="sh_keyword"><ds:KeyValue></span>....<span class="sh_keyword"></ds:KeyValue></span>
<span class="sh_keyword"></OriginatorKeyInfo></span>
<span class="sh_keyword"><RecipientKeyInfo></span>
<span class="sh_keyword"><ds:KeyValue></span>....<span class="sh_keyword"></ds:KeyValue></span>
<span class="sh_keyword"></RecipientKeyInfo></span>
<span class="sh_keyword"></AgreementMethod></span>
<span class="sh_keyword"></ds:KeyInfo></span>
<span class="sh_keyword"><CipherData></span>...<span class="sh_keyword"></CipherData></span>
<span class="sh_keyword"></EncryptedData></span></pre>
<p>If the agreed key is being used to wrap a key, rather than data as above,
then <code>AgreementMethod</code> would appear inside a
<code>ds:KeyInfo</code> inside an <code>EncryptedKey</code> element.</p>
<p>The Schema for <code>AgreementMethod</code> is as follows:</p>
<pre class="sh_xml sh_sourceCode"> Schema Definition:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"AgreementMethod"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:AgreementMethodType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"AgreementMethodType"</span> <span class="sh_type">mixed</span><span class="sh_symbol">=</span><span class="sh_string">"true"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"KA-Nonce"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"base64Binary"</span><span class="sh_keyword">/></span>
<span class="sh_comment"><!-- <element ref="ds:DigestMethod" minOccurs="0"/> --></span>
<span class="sh_keyword"><any</span> <span class="sh_type">namespace</span><span class="sh_symbol">=</span><span class="sh_string">"##other"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span> <span class="sh_type">maxOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"unbounded"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"OriginatorKeyInfo"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span>
<span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:KeyInfoType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"RecipientKeyInfo"</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span>
<span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:KeyInfoType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><attribute</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Algorithm"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"anyURI"</span> <span class="sh_type">use</span><span class="sh_symbol">=</span><span class="sh_string">"required"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></complexType></span></pre>
<div id="sec-DHKeyValue" class="section">
<h4><span class="secno">5.6.1 </span>Diffie-Hellman Key
Values</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="DHKeyValue" href="http://www.w3.org/2001/04/xmlenc#DHKeyValue">http://www.w3.org/2001/04/xmlenc#DHKeyValue</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>Diffie-Hellman keys can appear directly within <code>KeyValue</code>
elements or be obtained by <code>ds:RetrievalMethod</code> fetches as well as
appearing in certificates and the like. The above identifier can be used as
the value of the <code>Type</code> attribute of <code>Reference</code> or
<code>ds:RetrievalMethod</code> elements.</p>
<p>As specified in [<cite><a class="bibref" rel="biblioentry" href="#bib-ESDH">ESDH</a></cite>], a DH public key consists
of up to six quantities, two large primes p and q, a "generator" g, the
public key, and validation parameters "seed" and "pgenCounter". These relate
as follows: The public key = ( g**x mod p ) where x is the corresponding
private key; p = j*q + 1 where j >= 2. "seed" and "pgenCounter" are
optional and can be used to determine if the Diffie-Hellman key has been
generated in conformance with the algorithm specified in [<cite><a class="bibref" rel="biblioentry" href="#bib-ESDH">ESDH</a></cite>]. Because the primes and generator can be safely
shared over many DH keys, they may be known from the application environment
and are optional. The schema for a <code>DHKeyValue</code> is as follows:</p>
<pre class="sh_xml sh_sourceCode">Schema:
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"DHKeyValue"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"xenc:DHKeyValueType"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><complexType</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"DHKeyValueType"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><sequence></span>
<span class="sh_keyword"><sequence</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"P"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:CryptoBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Q"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:CryptoBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Generator"</span><span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:CryptoBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"Public"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:CryptoBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><sequence</span> <span class="sh_type">minOccurs</span><span class="sh_symbol">=</span><span class="sh_string">"0"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"seed"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:CryptoBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><element</span> <span class="sh_type">name</span><span class="sh_symbol">=</span><span class="sh_string">"pgenCounter"</span> <span class="sh_type">type</span><span class="sh_symbol">=</span><span class="sh_string">"ds:CryptoBinary"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"></sequence></span>
<span class="sh_keyword"></complexType></span></pre>
</div>
<div id="sec-DHKeyAgreement" class="section">
<h4><span class="secno">5.6.2 </span>Diffie-Hellman
Key Agreement</h4>
<p>The Diffie-Hellman (DH) key agreement protocol [<cite><a class="bibref" rel="biblioentry" href="#bib-ESDH">ESDH</a></cite>] involves the derivation of shared secret
information based on compatible DH keys from the sender and recipient. Two DH
public keys are compatible if they have the same prime and generator. If, for
the second one, <code>Y = g**y mod p</code>, then the two parties can
calculate the shared secret <code>ZZ = ( g**(x*y) mod p )</code> even though
each knows only their own private key and the other party's public key.
Leading zero bytes <em class="rfc2119" title="must">must</em> be maintained in <code>ZZ</code> so it will be the
same length, in bytes, as <code>p</code>. The size of <code>p</code> <em class="rfc2119" title="must">must</em> be
at least 512 bits and <code>g</code> at least 160 bits. There are numerous
other complex security considerations in the selection of <code>g</code>,
<code>p</code>, and a random <code>x</code> as described in [<cite><a class="bibref" rel="biblioentry" href="#bib-ESDH">ESDH</a></cite>].</p>
<p>The Diffie-Hellman shared secret <code>zz</code> is used as the input to a KDF to produce a
secret key. XML Signature 1.0 defined a
specific KDF to be used with Diffie-Hellman; that KDF is now known as the "Legacy KDF" and is defined in Section 5.6.2.2.
Use of Diffie-Hellman with explicit KDFs is described in Section 5.6.2.1.</p>
<p>Implementation of Diffie-Hellman key agreement is <em class="rfc2119" title="optional">optional</em>. However, if implemented,
such implementations <em class="rfc2119" title="must">must</em> support the Legacy Key Derivation Function
and <em class="rfc2119" title="should">should</em> support Diffie-Hellman with explicit Key Derivation Functions</p>
<p>An example of a DH
<code>AgreementMethod</code> element using the Legacy Key Derivation Function
(Section 5.6.2.2) is as follows:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><AgreementMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#dh"</span>
<span class="sh_type">ds:xmlns</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><KA-Nonce></span>Zm9v<span class="sh_keyword"></KA-Nonce></span>
<span class="sh_keyword"><ds:DigestMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#sha1"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><OriginatorKeyInfo></span>
<span class="sh_keyword"><ds:X509Data><ds:X509Certificate></span>
...
<span class="sh_keyword"></ds:X509Certificate></ds:X509Data></span>
<span class="sh_keyword"></OriginatorKeyInfo></span>
<span class="sh_keyword"><RecipientKeyInfo><ds:KeyValue></span>
...
<span class="sh_keyword"></ds:KeyValue></span>
<span class="sh_keyword"></RecipientKeyInfo></span>
<span class="sh_keyword"></AgreementMethod></span></pre>
<p></p>
<div id="sec-DHKeyAgreementExplicitKDF" class="section">
<h5><span class="secno">5.6.2.1 </span>Diffie-Hellman Key Agreement with Explicit Key Derivation Functions</h5>
<dl>
<dt>Identifier:</dt>
<dd><a id="dh-es" href="http://www.w3.org/2009/xmlenc11#dh-es">http://www.w3.org/2009/xmlenc11#dh-es</a> (<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>It is <em class="rfc2119" title="recommended">recommended</em> that the shared key material for a Diffie-Hellman key agreement be calculated from the Diffie-Hellman shared secret
using a key derivation function (KDF) in accordance with <a href="#sec-Alg-KeyDerivation">Section 5.4</a>.
</p>
<p>
An example of a DH <code>AgreementMethod</code> element using an
explicit key derivation function is as follows:
</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><xenc:AgreementMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#dh-es"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc11:KeyDerivationMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#ConcatKDF"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc11:ConcatKDFParams</span> <span class="sh_type">AlgorithmID</span><span class="sh_symbol">=</span><span class="sh_string">"00"</span> <span class="sh_type">PartyUInfo</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_type">PartyVInfo</span><span class="sh_symbol">=</span><span class="sh_string">""</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ds:DigestMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#sha256"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></xenc11:ConcatKDFParams></span>
<span class="sh_keyword"></xenc11:KeyDerivationMethod></span>
<span class="sh_keyword"><xenc:OriginatorKeyInfo></span>
<span class="sh_keyword"><ds:X509Data></span>
<span class="sh_keyword"><ds:X509Certificate></span>
<span class="sh_comment"><!-- X.509 Certificate here --></span>
<span class="sh_keyword"></ds:X509Certificate></span>
<span class="sh_keyword"></ds:X509Data></span>
<span class="sh_keyword"></xenc:OriginatorKeyInfo></span>
<span class="sh_keyword"><xenc:RecipientKeyInfo></span>
<span class="sh_keyword"><ds:X509Data></span>
<span class="sh_keyword"><ds:X509SKI></ds:X509SKI></span>
<span class="sh_comment"><!-- hint for the recipient's private key --></span>
<span class="sh_keyword"></ds:X509Data></span>
<span class="sh_keyword"></xenc:RecipientKeyInfo></span>
<span class="sh_keyword"></xenc:AgreementMethod></span></pre>
</div>
<div id="sec-DHKeyAgreementLegacyKDF" class="section">
<h5><span class="secno">5.6.2.2 </span>Diffie-Hellman
Key Agreement with Legacy Key Derivation Function</h5>
<dl>
<dt>Identifier:</dt>
<dd><a id="dh" href="http://www.w3.org/2001/04/xmlenc#dh">http://www.w3.org/2001/04/xmlenc#dh</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>XML Signature 1.0 defined a specific KDF for use with Diffie-Hellman key agreement. In order to guarantee interoperability,
implementations that choose to implement Diffie-Hellman <em class="rfc2119" title="must">must</em> support the use of the Diffie-Hellman Legacy KDF defined in this section.
</p>
<p>Assume that the Diffie-Hellman shared secret is the octet sequence
<code>ZZ</code>. The Diffie-Hellman Legacy KDF calculates the shared keying material as follows:</p>
<pre class="example sh_xml sh_sourceCode">Keying Material = KM(1) | KM(2) | ...</pre>
<p>where "|" is byte stream concatenation and</p>
<pre class="example sh_xml sh_sourceCode">KM(counter) = DigestAlg ( ZZ | counter | EncryptionAlg |
KA-Nonce | KeySize )</pre>
<dl>
<dt><code>DigestAlg</code></dt>
<dd>The message digest algorithm specified by the
<code>DigestMethod</code> child of <code>AgreementMethod</code>.</dd>
<dt><code>EncryptionAlg</code></dt>
<dd>The URI of the encryption algorithm, including possible key wrap
algorithms, in which the derived keying material is to be used
("Example:Block/Alg" in the example above), not the URI of the
agreement algorithm. This is the value of the <code>Algorithm</code>
attribute of the <code>EncryptionMethod</code> child of the
<code>EncryptedData</code> or <code>EncryptedKey</code> grandparent of
<code>AgreementMethod</code>.</dd>
<dt><code>KA-Nonce</code></dt>
<dd>The base64 decoding the content of the <code>KA-Nonce</code> child of
<code>AgreementMethod</code>, if present. If the <code>KA-Nonce</code>
element is absent, it is null.</dd>
<dt><code>Counter</code></dt>
<dd>A one byte counter starting at one and incrementing by one. It is
expressed as two hex digits where letters A through F are in upper
case.</dd>
<dt><code>KeySize</code></dt>
<dd>The size in bits of the key to be derived from the shared secret as
the UTF-8 string for the corresponding decimal integer with only digits
in the string and no leading zeros. For some algorithms the key size is
inherent in the URI. For others, such as most stream ciphers, it must
be explicitly provided.</dd>
</dl>
<p>For example, the initial <code>(KM(1))</code> calculation for the
<code>EncryptionMethod</code> of the <a href="#sec-Alg-KeyAgreement">Key
Agreement</a> example (section 5.5) would be as follows, where the binary one
byte counter value of 1 is represented by the two character UTF-8 sequence
<code>01</code>, <code>ZZ</code> is the shared secret, and "<code>foo</code>"
is the base64 decoding of "<code>Zm9v</code>".</p>
<pre class="example sh_xml sh_sourceCode">SHA-1 ( ZZ01Example:Block/Algfoo80 )</pre>
<p>Assuming that <code>ZZ</code> is <code>0xDEADBEEF</code>, that would be</p>
<pre class="example sh_xml sh_sourceCode">SHA-1( 0xDEADBEEF30314578616D706C653A426C6F636B2F416C67666F6F3830 )</pre>
<p>whose value is</p>
<pre class="example sh_xml sh_sourceCode">0x534C9B8C4ABDCB50038B42015A181711068B08C1</pre>
<p>Each application of <code>DigestAlg</code> for successive values of
<code>Counter</code> will produce some additional number of bytes of keying
material. From the concatenated string of one or more <code>KM</code>'s,
enough leading bytes are taken to meet the need for an actual key and the
remainder discarded. For example, if <code>DigestAlg</code> is SHA-1 which
produces 20 octets of hash, then for 128 bit AES the first 16 bytes from
<code>KM(1)</code> would be taken and the remaining 4 bytes discarded. For
256 bit AES, all of <code>KM(1)</code> suffixed with the first 12 bytes of
KM(2) would be taken and the remaining 8 bytes of <code>KM(2)</code>
discarded.</p>
</div>
</div>
<div id="sec-ECCKeyValue" class="section">
<h4><span class="secno">5.6.3 </span>Elliptic Curve Diffie-Hellman (ECDH) Key
Values</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="ECKeyValue" href="http://www.w3.org/2009/xmldsig11#ECKeyValue">http://www.w3.org/2009/xmldsig11#ECKeyValue</a>
(<em class="rfc2119" title="recommended">recommended</em>)</dd>
</dl>
<p>ECDH has identical public key parameters as ECDSA and can be represented
with the <code>ECKeyValue</code> element [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>].
Note that if the curve parameters are explicitly stated using the ECParameters
element, then the Cofactor element <em class="rfc2119" title="must">must</em> be included.</p>
<p>As with Diffie-Hellman keys, Elliptic Curve Key Values can appear directly
within <code>KeyValue</code> elements or be obtained by
<code>ds:RetrievalMethod</code> fetches as well as appearing in certificates
and the like. The above identifier can be used as the value of the
<code>Type</code> attribute of <code>Reference</code> or
<code>ds:RetrievalMethod</code> elements.</p>
</div>
<div id="sec-ECDH-ES" class="section">
<h4><span class="secno">5.6.4 </span>Elliptic Curve Diffie-Hellman (ECDH)
Key Agreement (Ephemeral-Static Mode)</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="ECDH-ES" href="http://www.w3.org/2009/xmlenc11#ECDH-ES">http://www.w3.org/2009/xmlenc11#ECDH-ES</a> (<em class="rfc2119" title="required">required</em>)
</dd>
</dl>
<p>ECDH is the elliptic curve analogue to the Diffie-Hellman key agreement
algorithm. Details of the ECDH primitive can be found in
[<cite><a class="bibref" rel="biblioentry" href="#bib-ECC-ALGS">ECC-ALGS</a></cite>]. When ECDH is used in
Ephemeral-Static (ES) mode, the recipient has a static key pair, but the sender
generates a ephemeral key pair for each message. The same ephemeral key may be
used when there are multiple recipients that use the same curve parameters.</p>
<p>Compliant implementations are <em class="rfc2119" title="required">required</em> to support ECDH-ES key agreement
using the P-256 prime curve specified in Section D.2.3 of FIPS 186-3
[<cite><a class="bibref" rel="biblioentry" href="#bib-FIPS-186-3">FIPS-186-3</a></cite>]. (This is the same curve that
is <em class="rfc2119" title="required">required</em> in XML Signature 1.1 to be supported for the ECDSAwithSHA256
algorithm.) It is further <em class="rfc2119" title="recommended">recommended</em> that implementations also support
the P-384 and P-521 prime curves for ECDH-ES; these curves are defined
in Sections D.2.4 and D.2.5 of FIPS 186-3, respectively.</p>
<p>The shared key material is calculated from the Diffie-Hellman shared secret
using a key derivation function (KDF). While applications may define other
KDFs, compliant implementations <em class="rfc2119" title="must">must</em> implement ConcatKDF (see <a href="#sec-ConcatKDF" class="sectionRef">section 5.4.1 ConcatKDF</a>).
An example of <code>xenc:EncryptedData</code> using the ECDH-ES key
agreement algorithm with the ConcatKDF key derivation algorithm is as
follows:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><xenc:EncryptedData</span>
<span class="sh_type">xmlns:xsi</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/XMLSchema-instance"</span>
<span class="sh_type">xmlns:xenc</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span>
<span class="sh_type">xmlns:ds</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#"</span>
<span class="sh_type">xmlns:dsig11</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmldsig11#"</span>
<span class="sh_type">xmlns:xenc11</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#"</span>
<span class="sh_type">Type</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc:EncryptionMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#aes128-cbc"</span> <span class="sh_keyword">/></span>
<span class="sh_comment"><!-- describes the encrypted AES content encryption key --></span>
<span class="sh_keyword"><ds:KeyInfo></span>
<span class="sh_keyword"><xenc:EncryptedKey></span>
<span class="sh_keyword"><xenc:EncryptionMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#kw-aes128"</span><span class="sh_keyword">/></span>
<span class="sh_comment"><!-- describes the key encryption key --></span>
<span class="sh_keyword"><ds:KeyInfo></span>
<span class="sh_keyword"><xenc:AgreementMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#ECDH-ES"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc11:KeyDerivationMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2009/xmlenc11#ConcatKDF"</span><span class="sh_keyword">></span>
<span class="sh_keyword"><xenc11:ConcatKDFParams</span> <span class="sh_type">AlgorithmID</span><span class="sh_symbol">=</span><span class="sh_string">"00"</span> <span class="sh_type">PartyUInfo</span><span class="sh_symbol">=</span><span class="sh_string">""</span> <span class="sh_type">PartyVInfo</span><span class="sh_symbol">=</span><span class="sh_string">""</span><span class="sh_keyword">></span>
<span class="sh_keyword"><ds:DigestMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#sha256"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></xenc11:ConcatKDFParams></span>
<span class="sh_keyword"></xenc11:KeyDerivationMethod></span>
<span class="sh_keyword"><xenc:OriginatorKeyInfo></span>
<span class="sh_keyword"><ds:KeyValue></span>
<span class="sh_keyword"><dsig11:ECKeyValue></span>
<span class="sh_comment"><!-- ephemeral ECC public key of the originator --></span>
<span class="sh_keyword"></dsig11:ECKeyValue></span>
<span class="sh_keyword"></ds:KeyValue></span>
<span class="sh_keyword"></xenc:OriginatorKeyInfo></span>
<span class="sh_keyword"><xenc:RecipientKeyInfo></span>
<span class="sh_keyword"><ds:X509Data></span>
<span class="sh_keyword"><ds:X509SKI></ds:X509SKI></span>
<span class="sh_comment"><!-- hint for the recipient's private key --></span>
<span class="sh_keyword"></ds:X509Data></span>
<span class="sh_keyword"></xenc:RecipientKeyInfo></span>
<span class="sh_keyword"></xenc:AgreementMethod></span>
<span class="sh_keyword"></ds:KeyInfo></span>
<span class="sh_keyword"><xenc:CipherData></span>
<span class="sh_keyword"><xenc:CipherValue></span><span class="sh_comment"><!-- encrypted AES content encryption key --></span><span class="sh_keyword"></xenc:CipherValue></span>
<span class="sh_keyword"></xenc:CipherData></span>
<span class="sh_keyword"></xenc:EncryptedKey></span>
<span class="sh_keyword"></ds:KeyInfo></span>
<span class="sh_keyword"><xenc:CipherData></span>
<span class="sh_keyword"><xenc:CipherValue></span>
<span class="sh_comment"><!-- encrypted data --></span>
<span class="sh_keyword"></xenc:CipherValue></span>
<span class="sh_keyword"></xenc:CipherData></span>
<span class="sh_keyword"></xenc:EncryptedData></span></pre>
</div>
</div>
<div id="sec-Alg-SymmetricKeyWrap" class="section">
<h3><span class="secno">5.7 </span>Symmetric Key Wrap</h3>
<p>
Symmetric Key Wrap algorithms are shared secret key encryption
algorithms especially specified for encrypting and decrypting
symmetric keys. When wrapped keys are used, then an <code>EncryptedKey</code>
element will appear as a child of a <code>ds:KeyInfo</code> element. This
<code>EncryptedKey</code> element will have
an <code>EncryptionMethod</code> child whose
<code>Algorithm</code> attribute in turn identifies the key wrap algorithm.
</p>
<p>
The algorithm for which the encrypted key is intended depends on the
context of the <code>ds:KeyInfo</code>
element: <code>ds:KeyInfo</code> can occur as a child
of either an <code>EncryptedData</code> or <code>EncryptedKey</code>
element; in both cases,
<code>ds:KeyInfo</code> will have an <code>EncryptionMethod</code> sibling that
identifies the
algorithm.
</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><EncryptedData</span><span class="sh_type">|EncryptedKey</span><span class="sh_keyword">></span>
<span class="sh_keyword"><EncryptionMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"@alg1"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"><ds:KeyInfo></span>
<span class="sh_keyword"><EncryptedKey></span>
<span class="sh_keyword"><EncryptionMethod</span> <span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"@alg2"</span><span class="sh_keyword">/></span>
<span class="sh_keyword"></EncryptedKey></span>
<span class="sh_keyword"></ds:KeyInfo></span>
<span class="sh_keyword"></EncryptedData</span><span class="sh_type">|EncryptedKey</span><span class="sh_keyword">></span></pre>
<div id="sec-kw-tripledes" class="section">
<h4><span class="secno">5.7.1 </span>CMS Triple DES Key
Wrap</h4>
<dl>
<dt>Identifiers and Requirements:</dt>
<dd><a id="kw-tripledes" href="http://www.w3.org/2001/04/xmlenc#kw-tripledes">http://www.w3.org/2001/04/xmlenc#kw-tripledes</a>
(<em class="rfc2119" title="required">required</em>)</dd>
</dl>
<p>XML Encryption implementations <em class="rfc2119" title="must">must</em> support TRIPLEDES wrapping of 168 bit
keys as described in [<cite><a class="bibref" rel="biblioentry" href="#bib-CMS-WRAP">CMS-WRAP</a></cite>] and may optionally support TRIPLEDES wrapping of other keys.</p>
<p>An example of a TRIPLEDES Key Wrap <code>EncryptionMethod</code> element
is as follows:</p>
<pre class="example sh_xml sh_sourceCode"><code><span class="sh_keyword"><EncryptionMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#kw-tripledes"</span><span class="sh_keyword">/></span></code></pre>
</div>
<div id="sec-kw-aes" class="section">
<h4><span class="secno">5.7.2 </span>AES KeyWrap</h4>
<dl>
<dt>Identifiers and Requirements:</dt>
<dd><a id="kw-aes128" href="http://www.w3.org/2001/04/xmlenc#kw-aes128">http://www.w3.org/2001/04/xmlenc#kw-aes128</a>
(<em class="rfc2119" title="required">required</em>)</dd>
<dd><a id="kw-aes192" href="http://www.w3.org/2001/04/xmlenc#kw-aes192">http://www.w3.org/2001/04/xmlenc#kw-aes192</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a id="kw-aes256" href="http://www.w3.org/2001/04/xmlenc#kw-aes256">http://www.w3.org/2001/04/xmlenc#kw-aes256</a>
(<em class="rfc2119" title="required">required</em>)</dd>
</dl>
<p>Implementation of AES key wrap is described in [<cite><a class="bibref" rel="biblioentry" href="#bib-AES-WRAP">AES-WRAP</a></cite>].
It provides for confidentiality and integrity. This algorithm is defined only
for inputs which are a multiple of 64 bits. The information wrapped need not
actually be a key. The algorithm is the same whatever the size of the AES key
used in wrapping, called the key encrypting key or <code>KEK</code>. The
implementation requirements are indicated below.</p>
<dl>
<dt>128 bit AES Key Encrypting Key</dt>
<dd>Implementation of wrapping 128 bit keys <em class="rfc2119" title="required">required</em>.<br>
Wrapping of other key sizes <em class="rfc2119" title="optional">optional</em>.</dd>
<dt>192 bit AES Key Encrypting Key</dt>
<dd>All support <em class="rfc2119" title="optional">optional</em>.</dd>
<dt>256 bit AES Key Encrypting Key</dt>
<dd>Implementation of wrapping 256 bit keys <em class="rfc2119" title="required">required</em>.<br>
Wrapping of other key sizes <em class="rfc2119" title="optional">optional</em>.</dd>
</dl>
</div>
<div id="sec-kw-aes-with-pad" class="section">
<h4><span class="secno">5.7.3 </span>AES KeyWrap with Padding</h4>
<dl>
<dt>Identifiers and Requirements:</dt>
<dd><a id="kw-aes-128-pad" href="http://www.w3.org/2009/xmlenc11#kw-aes-128-pad">http://www.w3.org/2009/xmlenc11#kw-aes-128-pad</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a id="kw-aes-192-pad" href="http://www.w3.org/2009/xmlenc11#kw-aes-192-pad">http://www.w3.org/2009/xmlenc11#kw-aes-192-pad</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a id="kw-aes-256-pad" href="http://www.w3.org/2009/xmlenc11#kw-aes-256-pad">http://www.w3.org/2009/xmlenc11#kw-aes-256-pad</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>
These identifiers are used for symmetric key wrapping using the AES key wrap with padding
algorithm with a 128, 192, and 256 bit AES key encrypting key, respectively. Implementation of
AES key wrap with padding is defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-AES-WRAP-PAD">AES-WRAP-PAD</a></cite>]. The algorithm is defined for inputs
between 9 and 2^32 octets. Unlike the unpadded AES Key Wrap algorithm, the input length is not
constrained to multiples of 64 bits (8 octets).
</p>
<p>
Note that the wrapped key will be distinct from the one generated by the unpadded AES Key Wrap
algorithm, even if the input length is a multiple of 64 bits.
</p>
</div>
</div>
<div id="sec-Alg-MessageDigest" class="section">
<h3><span class="secno">5.8 </span>Message Digest</h3>
<p>Message digest algorithms can be used in
<code>AgreementMethod</code> as part of the key derivation, within
RSA-OAEP encryption as a hash function, and in connection with the
HMAC message authentication code method [<cite><a class="bibref" rel="biblioentry" href="#bib-HMAC">HMAC</a></cite>]
as described in [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>].) Use of SHA-256 is strongly
recommended over SHA-1 because recent advances in cryptanalysis (see
e.g. [<cite><a class="bibref" rel="biblioentry" href="#bib-SHA-1-Analysis">SHA-1-Analysis</a></cite>], [<cite><a class="bibref" rel="biblioentry" href="#bib-SHA-1-Collisions">SHA-1-Collisions</a></cite>] )
have cast doubt on the long-term collision resistance of SHA-1.
Therefore, SHA-1 support is <em class="rfc2119" title="required">required</em> in this specification only for
backwards-compatibility reasons.</p>
<div id="sec-SHA1" class="section">
<h4><span class="secno">5.8.1 </span>SHA1</h4>
<dl>
<dt>Identifier:</dt>
<dd><a href="http://www.w3.org/2000/09/xmldsig#sha1">http://www.w3.org/2000/09/xmldsig#sha1</a>
</dd>
</dl>
<p>The SHA-1 algorithm [<cite><a class="bibref" rel="biblioentry" href="#bib-FIPS-180-3">FIPS-180-3</a></cite>] takes no explicit
parameters. An example of an SHA-1 <code>DigestMethod</code> element is:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><DigestMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2000/09/xmldsig#sha1"</span><span class="sh_keyword">/></span></pre>
<p>A SHA-1 digest is a 160-bit string. The content of the
<code>DigestValue</code> element shall be the base64 encoding of this bit
string viewed as a 20-octet octet stream. For example, the
<code>DigestValue</code> element for the message digest:</p>
<pre class="example sh_xml sh_sourceCode"><code>A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D</code></pre>
<p>from Appendix A of the SHA-1 standard would be:</p>
<pre class="example sh_xml sh_sourceCode"><code><span class="sh_keyword"><DigestValue></span>qZk+NkcGgWq6PiVxeFDCbJzQ2J0=<span class="sh_keyword"></DigestValue></span></code></pre>
</div>
<div id="sec-SHA256" class="section">
<h4><span class="secno">5.8.2 </span>SHA256</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="sha256" href="http://www.w3.org/2001/04/xmlenc#sha256">http://www.w3.org/2001/04/xmlenc#sha256</a>
(<em class="rfc2119" title="required">required</em>)</dd>
</dl>
<p>The SHA-256 algorithm [<cite><a class="bibref" rel="biblioentry" href="#bib-FIPS-180-3">FIPS-180-3</a></cite>] takes no explicit
parameters. An example of an SHA-256 <code>DigestMethod</code> element is:</p>
<pre class="example sh_xml sh_sourceCode"><code><span class="sh_keyword"><DigestMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#sha256"</span><span class="sh_keyword">/></span></code></pre>
<p>A SHA-256 digest is a 256-bit string. The content of the
<code>DigestValue</code> element shall be the base64 encoding of this bit
string viewed as a 32-octet octet stream.</p>
</div>
<div id="sec-SHA384" class="section">
<h4><span class="secno">5.8.3 </span>SHA384</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="sha384" href="http://www.w3.org/2001/04/xmlenc#sha384">http://www.w3.org/2001/04/xmlenc#sha384</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>The SHA-384 algorithm [<cite><a class="bibref" rel="biblioentry" href="#bib-FIPS-180-3">FIPS-180-3</a></cite>] takes no explicit
parameters. An example of an SHA-384 <code>DigestMethod</code> element is:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><DigestMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#sha384"</span><span class="sh_keyword">/></span></pre>
<p>A SHA-384 digest is a 384-bit string. The content of the
<code>DigestValue</code> element shall be the base64 encoding of this bit
string viewed as a 48-octet octet stream.</p>
</div>
<div id="sec-SHA512" class="section">
<h4><span class="secno">5.8.4 </span>SHA512</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="sha512" href="http://www.w3.org/2001/04/xmlenc#sha512">http://www.w3.org/2001/04/xmlenc#sha512</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>The SHA-512 algorithm [<cite><a class="bibref" rel="biblioentry" href="#bib-FIPS-180-3">FIPS-180-3</a></cite>] takes no explicit
parameters. An example of an SHA-512 <code>DigestMethod</code> element is:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><DigestMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#sha512"</span><span class="sh_keyword">/></span></pre>
<p>A SHA-512 digest is a 512-bit string. The content of the
<code>DigestValue</code> element shall be the base64 encoding of this bit
string viewed as a 64-octet octet stream.</p>
</div>
<div id="sec-RIPEMD-160" class="section">
<h4><span class="secno">5.8.5 </span>RIPEMD-160</h4>
<dl>
<dt>Identifier:</dt>
<dd><a id="ripemd160" href="http://www.w3.org/2001/04/xmlenc#ripemd160">http://www.w3.org/2001/04/xmlenc#ripemd160</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>The RIPEMD-160 algorithm [<cite><a class="bibref" rel="biblioentry" href="#bib-RIPEMD-160">RIPEMD-160</a></cite>] takes
no explicit parameters. An example of an RIPEMD-160 <code>DigestMethod</code>
element is:</p>
<pre class="example sh_xml sh_sourceCode"><span class="sh_keyword"><DigestMethod</span>
<span class="sh_type">Algorithm</span><span class="sh_symbol">=</span><span class="sh_string">"http://www.w3.org/2001/04/xmlenc#ripemd160"</span><span class="sh_keyword">/></span></pre>
<p>A RIPEMD-160 digest is a 160-bit string. The content of the
<code>DigestValue</code> element shall be the base64 encoding of this bit
string viewed as a 20-octet octet stream.</p>
</div>
</div>
<div id="sec-Alg-Canonicalition" class="section">
<h3><span class="secno">5.9 </span>Canonicalization</h3>
<p>A Canonicalization of XML is a method of consistently serializing XML into
an octet stream as is necessary prior to encrypting XML.</p>
<div id="sec-Inclusive-Canonicalization" class="section">
<h4><span class="secno">5.9.1 </span>Inclusive
Canonicalization</h4>
<dl>
<dt>Identifiers:</dt>
<dd><a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments">http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a href="http://www.w3.org/2006/12/xml-c14n11">http://www.w3.org/2006/12/xml-c14n11</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a href="http://www.w3.org/2006/12/xml-c14n11#WithComments">http://www.w3.org/2006/12/xml-c14n11#WithComments</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>Canonical XML [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-C14N11">XML-C14N11</a></cite>] is a method of
serializing XML which includes the in scope namespace and xml namespace
attribute context from ancestors of the XML being serialized.</p>
<p>If XML is to be encrypted and then later decrypted into a different
environment and it is desired to preserve namespace prefix bindings and the
value of attributes in the "xml" namespace of its original environment, then
the canonical XML with comments version of the XML should be the
serialization that is encrypted.</p>
</div>
<div id="sec-Exclusive-Canonicalization" class="section">
<h4><span class="secno">5.9.2 </span>Exclusive
Canonicalization</h4>
<dl>
<dt>Identifiers:</dt>
<dd><a href="http://www.w3.org/2001/10/xml-exc-c14n#">http://www.w3.org/2001/10/xml-exc-c14n#</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
<dd><a href="http://www.w3.org/2001/10/xml-exc-c14n#WithComments">http://www.w3.org/2001/10/xml-exc-c14n#WithComments</a>
(<em class="rfc2119" title="optional">optional</em>)</dd>
</dl>
<p>Exclusive XML Canonicalization [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-EXC-C14N">XML-EXC-C14N</a></cite>]
serializes XML in such a way as to include to the minimum extent practical
the namespace prefix binding and xml namespace attribute context inherited
from ancestor elements.</p>
<p>It is the recommended method where the outer context of a fragment which
was signed and then encrypted may be changed. Otherwise the validation of the
signature over the fragment may fail because the canonicalization by
signature validation may include unnecessary namespaces into the fragment.</p>
</div>
</div>
</div>
<div id="sec-Security" class="section">
<!--OddPage--><h2><span class="secno">6. </span>Security Considerations</h2>
<div id="sec-chosen-ciphertext-attacks" class="section">
<h3><span class="secno">6.1 </span>Chosen-Ciphertext Attacks</h3>
<p>
A number of chosen-ciphertext attacks against implementations of this
specification have been published and demonstrated. They all
involve the following elements:
</p><p>
</p><ol>
<li>The attacker knows about the format of the
cleartext.</li>
<li>The attacker is able to submit substantial numbers of ciphertext messages.</li>
<li>The attacker is able to send arbitrary ciphertext, based on previous results.</li>
<li>The attacker is able to force the server to use the same key
(secret key by CBC-based attacks and server's private key by PKCS#1.5
attacks) for processing of the adapted ciphertext.</li>
<li>The server attempting to decrypt the ciphertext in some way
signals whether the decrypted text is well-formed or
not.</li>
</ol>
<p>
The attacker uses the knowledge of the format and the information
about well-formedness to construct a series of ciphertext
guesses which reveal the plaintext with much less work than
brute force. Attacks of this type have been demonstrated against
symmetric encryption using CBC mode [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLENC-CBC-ATTACK">XMLENC-CBC-ATTACK</a></cite>][<cite><a class="bibref" rel="biblioentry" href="#bib-XMLENC-CBC-ATTACK-COUNTERMEASURES">XMLENC-CBC-ATTACK-COUNTERMEASURES</a></cite>] and on
PKCS#1 v1.5. Other future attacks can be expected whenever
these conditions are met.
</p>
<div id="sec-edata-attacks" class="section">
<h4><span class="secno">6.1.1 </span> Attacks against the encrypted data (<code><EncryptedData></code> part)</h4>
<p>
Using the CBC-based chosen-ciphertext attacks, the attacker sends to the
server an XML document with modified encrypted data in the symmetric
part (<code><EncryptedData></code>). After a few requests, the
attacker is able to get the whole
cleartext without knowledge of the symmetric key.
</p><p>
It would seem that these attacks can be countered by by disrupting any
of the conditions, however in practice only preventing condition
3 (sending arbitrary ciphertext) is fully effective. To counter condition 3, it is necessary
for the decrypting system to require authenticated integrity
protection over the ciphertext. However, unless the mechanism
used is bound to the encryption key, there will no way to be sure
that the signer is not attempting to recover the plaintext. The
simplest and most efficient way to do this is to use an
authenticating block mode, such as GCM. An alternative would be
an HMAC based on the encryption key over the ciphertext, but it
is less efficient and provides no advantages.
</p><p>
Other countermeasures are not likely to be effective. Limiting the
number of messages presented or the number of messages using the
same key is not practical in large server farms. Attackers can
spread their attempts over different servers and long or short
periods of time, to foil attempts to detect attacks in progress
or determine the location of the attacker.
</p><p>
Signaling well-formedness can occur by emitting different messages for
distinct security errors or by exhibiting timing
differences. Implementations should avoid these practices,
however that is not sufficient to prevent such attacks in an XML
protocol environment, such as SOAP. Using a technique called
encryption wrapping, the attacker can insert the ciphertext in
some schema-legal part of the message. If the decryption code
notices a format error, an error will be returned, but if not
the message will be passed to the application which will ignore
the bogus plaintext and ultimately respond with an application
level success or failure message.
</p>
</div>
<div id="sec-bleichenbacher-attack" class="section">
<h4><span class="secno">6.1.2 </span>Attacks against the encrypted key (Bleichenbacher's Million
question attack on PKCS#1.5)</h4>
<p>
The goal of the attacker applying the Bleichenbacher's attack is to get
the symmetric secret key, which is encrypted in the <code><EncryptedKey></code> part.
Afterward, he would be able to decrypt the whole data carried in the
<code><EncryptedData></code> part.
</p><p>
The basic idea of this attack is to modify the data in the
<code><EncryptedKey></code> part, send the document to the server, and observe if the
modified ciphertext contains PKCS#1.5 conformant data. This can be
done by:
</p><ol>
<li>Observing fault messages of the server notifying directly that
the request was not PKCS#1.5 conformant (this should not happen).</li>
<li>Enlarging the data in the <code><EncryptedData></code> part and observing the
timing differences between inclusion of PKCS-valid and PKCS-invalid
keys: if the key is PKCS-valid, the session key is extracted, and the
large data is decrypted. Otherwise, the session key cannot be extracted
and the large data is not processed, which yields a timing difference.</li>
<li>Making specific modifications of the <code><EncryptedData></code> part based on CBC
and padding-properties.</li>
</ol>
<p></p><p>
These problems are described in detail in RFC 3281 [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC3218">RFC3218</a></cite>].
</p><p>
The most effective countermeasure against the timing attack (2) is to
generate a random secret key every time when the decrypted data was not
PKCS#1-conformant. This way, the attacker would not get any timing
side-channel.
</p><p>
Please note however that this is not a valid countermeasure against the
specific modification of the <code><EncryptedData></code>
described in part (3). The attacker
could still use a few millions of requests to decrypt the encrypted
symmetric key. Therefore, we recommend the usage of RSA-OAEP.
RSA-OAEP also has a risk of a chosen ciphertext attack [<cite><a class="bibref" rel="biblioentry" href="#bib-OAEP-ATTACK">OAEP-ATTACK</a></cite>] which
can be mitigated in security library implementations.
</p>
</div>
</div>
<div id="sec-Sign-with-Encrypt" class="section">
<h3><span class="secno">6.2 </span>Relationship to XML Digital Signatures</h3>
<p>The application of both encryption and digital signatures over portions of
an XML document can make subsequent decryption and signature verification
difficult. In particular, when verifying a signature one must know whether
the signature was computed over the encrypted or unencrypted form of
elements.</p>
<p>A separate, but important, issue is introducing cryptographic
vulnerabilities when combining digital signatures and encryption over a
common XML element. Hal Finney has suggested that encrypting digitally signed
data, while leaving the digital signature in the clear, may allow plaintext
guessing attacks. This vulnerability can be mitigated by using secure hashes
and the nonces in the text being processed.</p>
<p>In accordance with the requirements document [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-ENCRYPTION-REQ">XML-ENCRYPTION-REQ</a></cite>] the interaction of encryption and signing is
an application issue and out of scope of the specification. However, we make
the following recommendations:</p>
<ol>
<li><p>When data is encrypted, any digest or signature over that data should
be encrypted. This satisfies the first issue in that only those
signatures that can be seen can be validated. It also addresses the
possibility of a plaintext guessing vulnerability, though it may not be
possible to identify (or even know of) all the signatures over a given
piece of data.</p></li>
<li><p>Employ the "decrypt-except" signature transform [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLENC-DECRYPT">XMLENC-DECRYPT</a></cite>]. It works as follows:
during signature transform processing, if you encounter a decrypt
transform, decrypt all encrypted content in the document except for those
excepted by an enumerated set of references.</p></li>
</ol>
<p>Additionally, while the following warnings pertain to incorrect inferences
by the user about the authenticity of information encrypted, applications
should discourage user misapprehension by communicating clearly which
information has integrity, or is authenticated, confidential, or
non-repudiable when multiple processes (e.g., signature and encryption) and
algorithms (e.g., symmetric and asymmetric) are used:</p>
<ol>
<li><p>When an encrypted envelope contains a signature, the
signature does not
necessarily protect the authenticity or integrity of the
ciphertext [<cite><a class="bibref" rel="biblioentry" href="#bib-Davis">Davis</a></cite>].</p></li>
<li><p>While the signature secures plaintext it only covers that which is
signed, recipients of encrypted messages must not infer integrity or
authenticity of other unsigned information (e.g., headers) within the
encrypted envelope, see [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLDSIG-CORE1">XMLDSIG-CORE1</a></cite>], <a href="http://www.w3.org/TR/xmldsig-core/#sec-Secure">section 8.1.1 Only What is
Signed is Secure</a>].</p></li>
</ol>
</div>
<div id="sec-InformationRevealed" class="section">
<h3><span class="secno">6.3 </span>Information Revealed</h3>
<p>Where a symmetric key is shared amongst multiple recipients, that
symmetric key should <em>only</em> be used for the data intended for
<em>all</em> recipients; even if one recipient is not directed to information
intended (exclusively) for another in the same symmetric key, the information
might be discovered and decrypted.</p>
<p>Additionally, application designers should be careful not to reveal any
information in parameters or algorithm identifiers (e.g., information in a
URI) that weakens the encryption.</p>
</div>
<div id="sec-Nonce" class="section">
<h3><span class="secno">6.4 </span>Nonce and IV (Initialization Value or Vector)</h3>
<p>An undesirable characteristic of many encryption algorithms and/or their
modes is that the same plaintext when encrypted with the same key has the
same resulting ciphertext. While this is unsurprising, it invites various
attacks which are mitigated by including an arbitrary and non-repeating
(under a given key) data with the plaintext prior to encryption. In
encryption chaining modes this data is the first to be encrypted and is
consequently called the IV (initialization value or vector).</p>
<p>Different algorithms and modes have further requirements on the
characteristic of this information (e.g., randomness and secrecy) that affect
the features (e.g., confidentiality and integrity) and their resistance to
attack.</p>
<p>Given that XML data is redundant (e.g., Unicode encodings and repeated
tags ) and that attackers may know the data's structure (e.g., DTDs and
schemas) encryption algorithms must be carefully implemented and used in this
regard.</p>
<p>For the Cipher Block Chaining (CBC) mode used by this specification, the
IV must not be reused for any key and should be random, but it need not be
secret. Additionally, under this mode an adversary modifying the IV can make
a known change in the plain text after decryption. This attack can be avoided
by securing the integrity of the plain text data, for example by signing
it.</p>
<p>Note: CBC block encryption algorithms should not be used
without consideration of possibly severe security risks.
</p>
<p>
For the Galois/Counter Mode (GCM) used by this specification, the IV
must not be reused for any key and should be random, but it need
not be secret.
</p>
</div>
<div id="sec-Denial" class="section">
<h3><span class="secno">6.5 </span>Denial of Service</h3>
<p>This specification permits recursive processing. For example, the
following scenario is possible: <code>EncryptedKey</code> <strong>A</strong>
requires <code>EncryptedKey</code> <strong>B</strong> to be decrypted, which
itself requires <code>EncryptedKey</code> <strong>A</strong>! Or, an attacker
might submit an <code>EncryptedData</code> for decryption that references
network resources that are very large or continually redirected.
Consequently, implementations should be able to restrict arbitrary recursion
and the total amount of processing and networking resources a request can
consume.</p>
</div>
<div id="sec-Unsafe-Content" class="section">
<h3><span class="secno">6.6 </span>Unsafe Content</h3>
<p>XML Encryption can be used to obscure, via encryption, content
that applications (e.g., firewalls, virus detectors, etc.) consider unsafe
(e.g., executable code, viruses, etc.). Consequently, such applications must
consider encrypted content to be as unsafe as the unsafest content
transported in its application context. Consequently, such applications may
choose to (1) disallow such content, (2) require access to the decrypted form
for inspection, or (3) ensure that arbitrary content can be safely processed
by receiving applications.</p>
</div>
<div id="sec-Errors" class="section">
<h3><span class="secno">6.7 </span>Error Messages</h3>
<p>
Implementations <em class="rfc2119" title="should not">should not</em> provide detailed error responses related to
security algorithm processing. Error messages should be limited to a
generic error message to avoid providing information to a potential
attacker related to the specifics of the algorithm implementation. For
example, if an error occurs in decryption processing the error
response should be a generic message providing no
specifics on the details of the processing error.
</p>
</div>
<div id="sec-TimingAttacks" class="section">
<h3><span class="secno">6.8 </span>Timing Attacks</h3>
<p>
It has been known for some time that it is feasible for an attacker to
recover keys or cleartext by repeatedly sending chosen ciphertext and
measuring the time required to process different requests with
different types of errors. It has been demonstrated that attacks of
this type are practical even when communicating over large and busy
networks, especially if the receiver is willing to process large
numbers of ciphertext blocks.
</p><p>
Implementers <em class="rfc2119" title="should">should</em> ensure that distinct errors detected during
security algorithm processing do not consume systematically different
amounts of processing time from each other. Implementers <em class="rfc2119" title="should">should</em>
consult the technical literature for more details on specific attacks
and recommended countermeasures.
</p><p>
Deployments <em class="rfc2119" title="should">should</em> treat as suspect inputs when a large number of security
algorithm processing errors are detected within a short period of
time, especially in messages from the same origin.
</p>
</div>
<div id="sec-cbcBlockEncryptionAttacks" class="section">
<h3><span class="secno">6.9 </span>CBC Block Encryption Vulnerability</h3>
<p>
<strong>Note</strong>: CBC block encryption algorithms
should not be used without
consideration of <a href="#cbc-warning">possibly severe
security risks</a>.
</p>
</div>
</div>
<div id="sec-Conformance" class="section">
<!--OddPage--><h2><span class="secno">7. </span>Conformance</h2>
<p>An implementation is conformant to this specification if it successfully
generates syntax according to the schema definitions and satisfies all
<em class="rfc2119" title="must">must</em>/<em class="rfc2119" title="required">required</em>/<em class="rfc2119" title="shall">shall</em> requirements, including <a href="#sec-AlgID">algorithm</a> support and <a href="#sec-Processing">processing</a>. Processing requirements are specified
over the roles of <a class="link-def" href="#def-Decryptor"><strong>decryptor</strong>,</a> <a class="link-def" href="#def-Encryptor"><strong>encryptor</strong>,</a> and their calling <a class="link-def" href="#def-Application"><strong>application</strong></a>.</p>
</div>
<div id="sec-MediaType" class="section">
<!--OddPage--><h2><span class="secno">8. </span>XML Encryption Media Type</h2>
<div id="sec-MediaType-Introduction" class="section">
<h3><span class="secno">8.1 </span>Introduction</h3>
<p>XML Encryption Syntax and Processing (XMLENC-CORE1, this document)
specifies a process for encrypting
data and representing the result in XML. The data may be arbitrary data
(including an XML document), an XML element, or XML element content. The
result of encrypting data is an XML Encryption element which contains or
references the cipher data.</p>
<p>The <code>application/xenc+xml</code> media type allows XML Encryption
applications to identify encrypted documents. Additionally it allows
applications cognizant of this media-type (even if they are not XML
Encryption implementations) to note that the media type of the decrypted
(original) object might be a type other than XML.</p>
</div>
<div id="sec-MediaType-Registration" class="section">
<h3><span class="secno">8.2 </span>application/xenc+xml Registration</h3>
<p>This is a media type registration as defined in Multipurpose Internet Mail
Extensions (MIME) Part Four: Registration Procedures [<cite><a class="bibref" rel="biblioentry" href="#bib-MIME-REG">MIME-REG</a></cite>]</p>
<p>Type name: application</p>
<p>Subtype name: xenc+xml</p>
<p>Required parameters: none</p>
<p>Optional parameters: charset</p>
<blockquote>
<p>The allowable and recommended values for, and interpretation of the
charset parameter are identical to those given for 'application/xml' in
section 3.2 of RFC 3023 [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-MT">XML-MT</a></cite>].</p>
</blockquote>
<p>Encoding considerations:</p>
<blockquote>
<p>The encoding considerations are identical to those given for
'application/xml' in section 3.2 of RFC 3023 [<cite><a class="bibref" rel="biblioentry" href="#bib-XML-MT">XML-MT</a></cite>].</p>
</blockquote>
<p>Security considerations:</p>
<blockquote>
See the (XMLENC-CORE1, this document) <a href="#sec-Security">Security Considerations</a> section.</blockquote>
<p>Interoperability considerations: none</p>
<p>Published specification: (XMLENC-CORE1, this document)</p>
<p>Applications which use this media type:</p>
<blockquote>
XML Encryption is device-, platform-, and vendor-neutral and is supported
by a range of Web applications.</blockquote>
<p>Additional Information:</p>
<blockquote>
<p>Magic number(s): none</p>
<blockquote>
Although no byte sequences can be counted on to consistently identify XML
Encryption documents, there will be XML documents in which the root
element's <code>QName</code>'s <code>LocalPart</code> is
<code>'EncryptedData'</code> or '<code>EncryptedKey</code>' with an
associated namespace name of '<a href="http://www.w3.org/2001/04/xmlenc#">http://www.w3.org/2001/04/xmlenc#</a>'.
The <code>application/xenc+xml</code> type name <em class="rfc2119" title="must">must</em> only be used for
data objects in which the root element is from the XML Encryption
namespace. XML documents which contain these element types in places
other than the root element can be described using facilities such as [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-1">XMLSCHEMA-1</a></cite>], [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSCHEMA-2">XMLSCHEMA-2</a></cite>].</blockquote>
<p>File extension(s): .xml</p>
<p>Macintosh File Type Code(s): "TEXT"</p>
</blockquote>
<p>Person & email address to contact for further information:</p>
<blockquote>
<p>World Wide Web Consortium <web-human at w3.org></p>
</blockquote>
<p>Intended usage: COMMON</p>
<p>Author/Change controller:</p>
<p>The XML Encryption specification is a work product of the World Wide Web
Consortium (<acronym title="World Wide Web Consortium">W3C</acronym>) which has change control over the specification.</p>
</div>
</div>
<div id="sec-Schema" class="section">
<!--OddPage--><h2><span class="secno">9. </span>Schema</h2>
<div id="sec-xsdSchema" class="section">
<h3><span class="secno">9.1 </span>XSD Schema</h3>
<dl>
<dt>XML Encryption Core Schema Instance</dt>
<dd><a href="xenc-schema.xsd">xenc-schema.xsd</a></dd>
<dt>XML Encryption 1.1 Schema Instance</dt>
<dd><a href="xenc-schema-11.xsd">xenc-schema11.xsd</a></dd>
<dd>This schema document defines the additional material defined in
XML Encryption 1.1.</dd>
<dt>Example (non-normative)</dt>
<dd><a href="enc-example.xml">enc-example.xml</a> (not cryptographically
valid but exercises much of the schema)</dd>
</dl>
</div>
<div id="sec-rngSchema" class="informative section">
<h3><span class="secno">9.2 </span>RNG Schema</h3><p><em>This section is non-normative.</em></p>
<p>Non-normative RELAX NG schema [<cite><a class="bibref" rel="biblioentry" href="#bib-RELAXNG-SCHEMA">RELAXNG-SCHEMA</a></cite>] information is
available in a separate document [<cite><a class="bibref" rel="biblioentry" href="#bib-XMLSEC-RELAXNG">XMLSEC-RELAXNG</a></cite>].
</p>
</div>
</div>
<div id="references" class="appendix section"><!--OddPage--><h2><span class="secno">A. </span>References</h2><p>Dated references below are to the latest known or appropriate edition of the referenced work. The referenced works may be subject to revision, and conformant implementations may follow, and are encouraged to investigate the appropriateness of following, some or all more recent editions or replacements of the works cited. It is in each case implementation-defined which editions are supported.</p><div id="normative-references" class="section"><h3><span class="secno">A.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-AES">[AES]</dt><dd><a href="http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf"><cite>NIST FIPS 197: Advanced Encryption Standard (AES)</cite></a>. November 2001. URL: <a href="http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf">http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf</a>
</dd><dt id="bib-AES-WRAP">[AES-WRAP]</dt><dd>J. Schaad and R. Housley. <a href="http://www.ietf.org/rfc/rfc3394.txt"><cite>RFC3394: Advanced Encryption Standard (AES) Key Wrap Algorithm</cite></a>. IETF Informational RFC, September 2002. URL: <a href="http://www.rfc-editor.org/rfc/rfc3394.txt">http://www.rfc-editor.org/rfc/rfc3394.txt</a>
</dd><dt id="bib-AES-WRAP-PAD">[AES-WRAP-PAD]</dt><dd>R. Housley, M. Dworkin. <a href="http://www.ietf.org/rfc/rfc5649.txt"><cite>RFC 5649: Advanced Encryption Standard (AES) Key Wrap with Padding Algorithm</cite></a>. IETF Informational RFC, August 2009. URL: <a href="http://www.ietf.org/rfc/rfc5649.txt"> http://www.ietf.org/rfc/rfc5649.txt</a>.
</dd><dt id="bib-ANSI-X9-44-2007">[ANSI-X9-44-2007]</dt><dd><a href="http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.44-2007"><cite>ANSI X9.44-2007: Key Establishment Using Integer Factorization Cryptography.</cite></a> URL: <a href="http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.44-2007">http://webstore.ansi.org/RecordDetail.aspx?sku=ANSI+X9.44-2007</a>
</dd><dt id="bib-CMS-WRAP">[CMS-WRAP]</dt><dd>R. Housley. <a href="http://www.ietf.org/rfc/rfc3217.txt"><cite>RFC3217: Triple-DES and R2 Key Wrapping</cite></a>. IETF Informational RFC, December 2001. URL: <a href="http://www.ietf.org/rfc/rfc3217.txt">http://www.ietf.org/rfc/rfc3217.txt</a>
</dd><dt id="bib-DES">[DES]</dt><dd><a href="http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf"><cite>NIST FIPS 46-3: Data Encryption Standard (DES)</cite></a> . October 1999. URL: <a href="http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf">http://csrc.nist.gov/publications/fips/fips46-3/fips46-3.pdf</a>
</dd><dt id="bib-ESDH">[ESDH]</dt><dd>E. Rescorla. <a href="http://www.ietf.org/rfc/rfc2631.txt"><cite> Diffie-Hellman Key Agreement Method.</cite></a>. IETF RFC 2631 Standards Track, 1999. URL: <a href="http://www.ietf.org/rfc/rfc2631.txt">http://www.ietf.org/rfc/rfc2631.txt</a>
</dd><dt id="bib-EXI">[EXI]</dt><dd>Takuki Kamiya; John Schneider. <a href="http://www.w3.org/TR/2009/CR-exi-20091208/"><cite>Efficient XML Interchange (EXI) Format 1.0.</cite></a> 8 December 2009. W3C Candidate Recommendation. (Work in progress.) URL: <a href="http://www.w3.org/TR/2009/CR-exi-20091208/">http://www.w3.org/TR/2009/CR-exi-20091208/</a>
</dd><dt id="bib-FIPS-180-3">[FIPS-180-3]</dt><dd><a href="http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf"><cite>FIPS PUB 180-3 Secure Hash Standard</cite></a>. U.S. Department of Commerce/National Institute of Standards and Technology. URL: <a href="http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf">http://csrc.nist.gov/publications/fips/fips180-3/fips180-3_final.pdf</a>
</dd><dt id="bib-FIPS-186-3">[FIPS-186-3]</dt><dd><a href="http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf"><cite>FIPS PUB 186-3: Digital Signature Standard (DSS)</cite></a>. June 2009. U.S. Department of Commerce/National Institute of Standards and Technology. URL: <a href="http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf">http://csrc.nist.gov/publications/fips/fips186-3/fips_186-3.pdf</a>
</dd><dt id="bib-HMAC">[HMAC]</dt><dd>H. Krawczyk, M. Bellare, R. Canetti. <a href="http://www.ietf.org/rfc/rfc2104.txt"><cite>HMAC: Keyed-Hashing for Message Authentication</cite></a>. February 1997. IETF RFC 2104. URL: <a href="http://www.ietf.org/rfc/rfc2104.txt">http://www.ietf.org/rfc/rfc2104.txt</a>
</dd><dt id="bib-NFC">[NFC]</dt><dd>M. Davis, Ken Whistler. <a href="http://www.unicode.org/reports/tr15/"><cite>TR15, Unicode Normalization Forms.</cite></a>. 17 September 2010, URL: <a href="http://www.unicode.org/reports/tr15/">http://www.unicode.org/reports/tr15/</a>
</dd><dt id="bib-PKCS1">[PKCS1]</dt><dd>J. Jonsson and B. Kaliski. <a href="http://www.ietf.org/rfc/rfc3447.txt"><cite>Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1.</cite></a> RFC 3447 (Informational), February 2003. URL: <a href="http://www.ietf.org/rfc/rfc3447.txt">http://www.ietf.org/rfc/rfc3447.txt</a>
</dd><dt id="bib-PKCS5">[PKCS5]</dt><dd>B. Kaliski. <a href="http://www.ietf.org/rfc/rfc2898.txt"><cite>PKCS #5 v2.0: Password-Based Cryptography Standard</cite></a> IETF RFC 2898. September 2000. URL: <a href="http://www.ietf.org/rfc/rfc2898.txt">http://www.ietf.org/rfc/rfc2898.txt</a>
</dd><dt id="bib-PKCS5Amd1">[PKCS5Amd1]</dt><dd><a href="ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-5v2/pkcs-5v2-0a1.pdf"><cite>PKCS #5 v2.0 Amendment 1: XML Schema for Password-Based Cryptography</cite></a> RSA Laboratories, March 2007. URL: <a href="ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-5v2/pkcs-5v2-0a1.pdf">ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-5v2/pkcs-5v2-0a1.pdf</a>
</dd><dt id="bib-RANDOM">[RANDOM]</dt><dd>D. Eastlake, S. Crocker, J. Schiller. <a href="http://www.ietf.org/rfc/rfc4086.txt"><cite>Randomness Recommendations for Security.</cite></a>. IETF RFC 4086. June 2005. URL: <a href="http://www.ietf.org/rfc/rfc4086.txt">http://www.ietf.org/rfc/rfc4086.txt</a>
</dd><dt id="bib-RFC2045">[RFC2045]</dt><dd>N. Freed and N. Borenstein. <a href="http://www.ietf.org/rfc/rfc2045.txt"><cite>Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies.</cite></a> November 1996. URL: <a href="http://www.ietf.org/rfc/rfc2045.txt">http://www.ietf.org/rfc/rfc2045.txt</a>
</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
</dd><dt id="bib-RFC4055">[RFC4055]</dt><dd>J. Schaad, B. Kaliski, R. Housley. <a href="http://www.ietf.org/rfc/rfc4055.txt"><cite>Additional Algorithms and Identifiers for RSA Cryptography for use in the Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</cite></a>. June 2005. IETF RFC 4055. URL: <a href="http://www.ietf.org/rfc/rfc4055.txt">http://www.ietf.org/rfc/rfc4055.txt</a>
</dd><dt id="bib-RIPEMD-160">[RIPEMD-160]</dt><dd>B. Preneel, A. Bosselaers, and H. Dobbertin. <a href="http://www.cosic.esat.kuleuven.be/publications/article-317.pdf"><cite>The Cryptographic Hash Function RIPEMD-160</cite></a>. CryptoBytes, Volume 3, Number 2. pp. 9-14, RSA Laboratories 1997. URL: <a href="http://www.cosic.esat.kuleuven.be/publications/article-317.pdf">http://www.cosic.esat.kuleuven.be/publications/article-317.pdf</a>
</dd><dt id="bib-SP800-38D">[SP800-38D]</dt><dd>M. Dworkin. <a href="http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf"><cite> NIST Special Publication 800-38D: Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC</cite></a>. November 2007 URL: <a href="http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf">http://csrc.nist.gov/publications/nistpubs/800-38D/SP-800-38D.pdf</a>
</dd><dt id="bib-SP800-56A">[SP800-56A]</dt><dd><a href="http://csrc.nist.gov/publications/nistpubs/800-56A/SP800-56A_Revision1_Mar08-2007.pdf"><cite> NIST Special Publication 800-56A: Recommendation for Pair-Wise Key Establishment Schemes Using Discrete Logarithm Cryptography (Revised)</cite></a>. March 2007 URL: <a href="http://csrc.nist.gov/publications/nistpubs/800-56A/SP800-56A_Revision1_Mar08-2007.pdf">http://csrc.nist.gov/publications/nistpubs/800-56A/SP800-56A_Revision1_Mar08-2007.pdf</a>
</dd><dt id="bib-SP800-67">[SP800-67]</dt><dd><a href="http://csrc.nist.gov/publications/nistpubs/800-67/SP800-67.pdf"><cite> Recommendation for the Triple Data Encryption Algorithm (TDEA) Block Cipher, Revised 19 May 2008.</cite></a> SP800-67 Version 1.1. U.S. Department of Commerce/National Institute of Standards and Technology. URL: <a href="http://csrc.nist.gov/publications/nistpubs/800-67/SP800-67.pdf"> http://csrc.nist.gov/publications/nistpubs/800-67/SP800-67.pdf</a>
</dd><dt id="bib-URI">[URI]</dt><dd>T. Berners-Lee; R. Fielding; L. Masinter. <a href="http://www.ietf.org/rfc/rfc3986.txt"><cite>Uniform Resource Identifiers (URI): generic syntax.</cite></a> January 2005. Internet RFC 3986. URL: <a href="http://www.ietf.org/rfc/rfc3986.txt">http://www.ietf.org/rfc/rfc3986.txt</a>
</dd><dt id="bib-XML-ENCRYPTION-REQ">[XML-ENCRYPTION-REQ]</dt><dd>Joseph Reagle. <a href="http://www.w3.org/TR/2002/NOTE-xml-encryption-req-20020304"><cite>XML Encryption Requirements.</cite></a> 4 March 2002. W3C Note. URL: <a href="http://www.w3.org/TR/2002/NOTE-xml-encryption-req-20020304">http://www.w3.org/TR/2002/NOTE-xml-encryption-req-20020304</a>
</dd><dt id="bib-XML-NAMES">[XML-NAMES]</dt><dd>Richard Tobin; et al. <a href="http://www.w3.org/TR/2009/REC-xml-names-20091208/"><cite>Namespaces in XML 1.0 (Third Edition).</cite></a> 8 December 2009. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2009/REC-xml-names-20091208/">http://www.w3.org/TR/2009/REC-xml-names-20091208/</a>
</dd><dt id="bib-XML10">[XML10]</dt><dd>C. M. Sperberg-McQueen; et al. <a href="http://www.w3.org/TR/2008/REC-xml-20081126/"><cite>Extensible Markup Language (XML) 1.0 (Fifth Edition).</cite></a> 26 November 2008. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2008/REC-xml-20081126/">http://www.w3.org/TR/2008/REC-xml-20081126/</a>
</dd><dt id="bib-XMLDSIG-CORE1">[XMLDSIG-CORE1]</dt><dd>D. Eastlake, J. Reagle, D. Solo, F. Hirsch, T. Roessler, K. Yiu. <a href="http://www.w3.org/TR/2011/CR-xmldsig-core1-20110303/"><cite>XML Signature Syntax and Processing Version 1.1.</cite></a> 3 March 2011. W3C Candidate Recommendation. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/CR-xmldsig-core1-20110303/">http://www.w3.org/TR/2011/CR-xmldsig-core1-20110303/</a>
</dd><dt id="bib-XMLSCHEMA-1">[XMLSCHEMA-1]</dt><dd>Henry S. Thompson; et al. <a href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/"><cite>XML Schema Part 1: Structures Second Edition.</cite></a> 28 October 2004. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/">http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/</a>
</dd><dt id="bib-XMLSCHEMA-2">[XMLSCHEMA-2]</dt><dd>Paul V. Biron; Ashok Malhotra. <a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/"><cite>XML Schema Part 2: Datatypes Second Edition.</cite></a> 28 October 2004. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/">http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/</a>
</dd><dt id="bib-XPATH">[XPATH]</dt><dd>James Clark; Steven DeRose. <a href="http://www.w3.org/TR/1999/REC-xpath-19991116/"><cite>XML Path Language (XPath) Version 1.0.</cite></a> 16 November 1999. W3C Recommendation. URL: <a href="http://www.w3.org/TR/1999/REC-xpath-19991116/">http://www.w3.org/TR/1999/REC-xpath-19991116/</a>
</dd></dl></div><div id="informative-references" class="section"><h3><span class="secno">A.2 </span>Informative references</h3><dl class="bibliography"><dt id="bib-Davis">[Davis]</dt><dd><a href="http://www.usenix.org/publications/library/proceedings/usenix01/davis.html"><cite>Defective Sign & Encrypt in S/MIME, PKCS#7, MOSS, PEM, PGP, and XML.</cite></a> D. Davis. USENIX Annual Technical Conference. 2001. URL: <a href="http://www.usenix.org/publications/library/proceedings/usenix01/davis.html">http://www.usenix.org/publications/library/proceedings/usenix01/davis.html</a>
</dd><dt id="bib-ECC-ALGS">[ECC-ALGS]</dt><dd>D. McGrew, K. Igoe, M. Salter. <a href="http://www.rfc-editor.org/rfc/rfc6090.txt"><cite>RFC 6090: Fundamental Elliptic Curve Cryptography Algorithms.</cite></a> February 2011. IETF Informational RFC. URL: <a href="http://www.rfc-editor.org/rfc/rfc6090.txt">http://www.rfc-editor.org/rfc/rfc6090.txt</a>
</dd><dt id="bib-MIME-REG">[MIME-REG]</dt><dd>N. Freed, J. Klensin. <a href="http://www.ietf.org/rfc/rfc4289.txt"><cite>RFC 4289: Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures</cite></a>. December 2005. Best Current Practice. URL: <a href="http://www.ietf.org/rfc/rfc4289.txt">http://www.ietf.org/rfc/rfc4289.txt</a>
</dd><dt id="bib-OAEP-ATTACK">[OAEP-ATTACK]</dt><dd>Manger, James. <a href="http://archiv.infsec.ethz.ch/education/fs08/secsem/Manger01.pdf"><cite> A Chosen Ciphertext Attack on RSA Optimal Asymmetric Encryption Padding (OAEP) as Standardized in PKCS #1 v2.0</cite></a>. URL: <a href="http://archiv.infsec.ethz.ch/education/fs08/secsem/Manger01.pdf">http://archiv.infsec.ethz.ch/education/fs08/secsem/Manger01.pdf</a>
</dd><dt id="bib-RELAXNG-SCHEMA">[RELAXNG-SCHEMA]</dt><dd><a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c052348_ISO_IEC_19757-2_2008(E).zip"><cite>Information technology -- Document Schema Definition Language (DSDL) -- Part 2: Regular-grammar-based validation -- RELAX NG</cite></a>. ISO/IEC 19757-2:2008. URL: <a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c052348_ISO_IEC_19757-2_2008(E).zip">http://standards.iso.org/ittf/PubliclyAvailableStandards/c052348_ISO_IEC_19757-2_2008(E).zip</a>
</dd><dt id="bib-RFC3218">[RFC3218]</dt><dd>Rescorla, E. <a href="http://tools.ietf.org/html/rfc3218"><cite>Preventing the Million Message Attack on Cryptographic Message Syntax.</cite></a>January 2002. Informational RFC 3218. URL: <a href="http://tools.ietf.org/html/rfc3218">http://tools.ietf.org/html/rfc3218</a>
</dd><dt id="bib-SHA-1-Analysis">[SHA-1-Analysis]</dt><dd>McDonald, C., Hawkes, P., and J. Pieprzyk. <a href="http://eurocrypt2009rump.cr.yp.to/837a0a8086fa6ca714249409ddfae43d.pdf"><cite>SHA-1 collisions now 2<sup>52</sup> </cite></a>. EuroCrypt 2009 Rump session. URL: <a href="http://eurocrypt2009rump.cr.yp.to/837a0a8086fa6ca714249409ddfae43d.pdf">http://eurocrypt2009rump.cr.yp.to/837a0a8086fa6ca714249409ddfae43d.pdf</a>
</dd><dt id="bib-SHA-1-Collisions">[SHA-1-Collisions]</dt><dd>X. Wang, Y.L. Yin, H. Yu. <a href="http://people.csail.mit.edu/yiqun/SHA1AttackProceedingVersion.pdf"><cite>Finding Collisions in the Full SHA-1</cite></a>. In Shoup, V., editor, Advances in Cryptology - CRYPTO 2005, 25th Annual International Cryptology Conference, Santa Barbara, California, USA, August 14-18, 2005, Proceedings, volume 3621 of LNCS, pages 17–36. Springer, 2005. URL: <a href="http://people.csail.mit.edu/yiqun/SHA1AttackProceedingVersion.pdf">http://people.csail.mit.edu/yiqun/SHA1AttackProceedingVersion.pdf</a> (also published in <a href="http://www.springerlink.com/content/26vljj3xhc28ux5m/">http://www.springerlink.com/content/26vljj3xhc28ux5m/</a>)
</dd><dt id="bib-Tobin">[Tobin]</dt><dd>R. Tobin. <a href="http://lists.w3.org/Archives/Member/w3c-xml-core-wg/2000OctDec/0054"><cite>Infoset for external entities.</cite></a> 2000. URL: <a href="http://lists.w3.org/Archives/Member/w3c-xml-core-wg/2000OctDec/0054">http://lists.w3.org/Archives/Member/w3c-xml-core-wg/2000OctDec/0054</a> [XML Core mailing list, <a href="http://cgi.w3.org/MemberAccess/AccessRequest">W3C Member Only</a>].
</dd><dt id="bib-XML-C14N">[XML-C14N]</dt><dd>John Boyer. <a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"><cite>Canonical XML Version 1.0.</cite></a> 15 March 2001. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2001/REC-xml-c14n-20010315">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</a>
</dd><dt id="bib-XML-C14N11">[XML-C14N11]</dt><dd>John Boyer, Glenn Marcy. <a href="http://www.w3.org/TR/2008/REC-xml-c14n11-20080502/"><cite>Canonical XML Version 1.1.</cite></a> 2 May 2008. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2008/REC-xml-c14n11-20080502/">http://www.w3.org/TR/2008/REC-xml-c14n11-20080502/</a>
</dd><dt id="bib-XML-EXC-C14N">[XML-EXC-C14N]</dt><dd>Donald E. Eastlake 3rd; Joseph Reagle; John Boyer. <a href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/"><cite>Exclusive XML Canonicalization Version 1.0.</cite></a> 18 July 2002. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/">http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/</a>
</dd><dt id="bib-XML-INFOSET">[XML-INFOSET]</dt><dd>John Cowan; Richard Tobin. <a href="http://www.w3.org/TR/2004/REC-xml-infoset-20040204/"><cite>XML Information Set (Second Edition).</cite></a> 4 February 2004. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2004/REC-xml-infoset-20040204/">http://www.w3.org/TR/2004/REC-xml-infoset-20040204/</a>
</dd><dt id="bib-XML-MT">[XML-MT]</dt><dd>M. Murata, S. St.Laurent, D. Kohn. <a href="http://www.ietf.org/rfc/rfc3023.txt"><cite>XML Media Types</cite></a>. IETF RFC 3023. URL: <a href="http://www.ietf.org/rfc/rfc3023.txt"> http://www.ietf.org/rfc/rfc3023.txt</a>.
</dd><dt id="bib-XMLBASE">[XMLBASE]</dt><dd>Jonathan Marsh, Richard Tobin. <a href="http://www.w3.org/TR/2009/REC-xmlbase-20090128/"><cite>XML Base (Second Edition).</cite></a> 28 January 2009. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2009/REC-xmlbase-20090128/">http://www.w3.org/TR/2009/REC-xmlbase-20090128/</a>
</dd><dt id="bib-XMLENC-CBC-ATTACK">[XMLENC-CBC-ATTACK]</dt><dd>Tibor Jager; Juraj Somorovsky. <a href="http://www.nds.rub.de/media/nds/veroeffentlichungen/2011/10/22/HowToBreakXMLenc.pdf"><cite>How to Break XML Encryption</cite></a> 17-21 October 2011. CCS' 11, ACM. URL: <a href="http://www.nds.rub.de/media/nds/veroeffentlichungen/2011/10/22/HowToBreakXMLenc.pdf">http://www.nds.rub.de/media/nds/veroeffentlichungen/2011/10/22/HowToBreakXMLenc.pdf</a>
</dd><dt id="bib-XMLENC-CBC-ATTACK-COUNTERMEASURES">[XMLENC-CBC-ATTACK-COUNTERMEASURES]</dt><dd>Juraj Somorovsky, Jörg Schwenk. <a href="http://www.w3.org/2008/xmlsec/papers/xmlEncCountermeasuresW3C.pdf"><cite>Technical Analysis of Countermeasures against Attack on XML Encryption - or - Just Another Motivation for Authenticated Encryption</cite></a>. 2011. URL: <a href="http://www.w3.org/2008/xmlsec/papers/xmlEncCountermeasuresW3C.pdf">http://www.w3.org/2008/xmlsec/papers/xmlEncCountermeasuresW3C.pdf</a>
</dd><dt id="bib-XMLENC-DECRYPT">[XMLENC-DECRYPT]</dt><dd>Takeshi Imamura; Merlin Hughes; Hiroshi Maruyama. <a href="http://www.w3.org/TR/2002/REC-xmlenc-decrypt-20021210"><cite>Decryption Transform for XML Signature.</cite></a> 10 December 2002. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2002/REC-xmlenc-decrypt-20021210">http://www.w3.org/TR/2002/REC-xmlenc-decrypt-20021210</a>
</dd><dt id="bib-XMLSEC-RELAXNG">[XMLSEC-RELAXNG]</dt><dd>Makoto Murata, Frederick Hirsch. <a href="http://www.w3.org/TR/2011/WD-xmlsec-rngschema-20110830/"><cite>XML Security RELAX NG Schemas.</cite></a> 30 August 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-xmlsec-rngschema-20110830/">http://www.w3.org/TR/2011/WD-xmlsec-rngschema-20110830/</a>
</dd><dt id="bib-XMLSEC11-REQS">[XMLSEC11-REQS]</dt><dd>Frederick Hirsch, Thomas Roessler. <a href="http://www.w3.org/TR/2011/WD-xmlsec-reqs-20110303/"><cite>XML Security 1.1 Requirements and Design Considerations.</cite></a> 3 March 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-xmlsec-reqs-20110303/">http://www.w3.org/TR/2011/WD-xmlsec-reqs-20110303/</a>
</dd></dl></div></div></body></html>