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 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 7106 7107 7108 7109 7110 7111 7112 7113 7114 7115 7116 7117 7118 7119 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 7140 7141 7142 7143 7144 7145 7146 7147 7148 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 7176 7177 7178 7179 7180 7181 7182 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 7215 7216 7217 7218 7219 7220 7221 7222 7223 7224 7225 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 7288 7289 7290 7291 7292 7293 7294 7295 7296 7297 7298 7299 7300 7301 7302 7303 7304 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 7597 7598 7599 7600 7601 7602 7603 7604 7605 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 7669 7670 7671 7672 7673 7674 7675 7676 7677 7678 7679 7680 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 7715 7716 7717 7718 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 7744 7745 7746 7747 7748 7749 7750 7751 7752 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 7795 7796 7797 7798 7799 7800 7801 7802 7803 7804 7805 7806 7807 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 7823 7824 7825 7826 7827 7828 7829 7830 7831 7832 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 7905 7906 7907 7908 7909 7910 7911 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 8907 8908 8909 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 9072 9073 9074 9075 9076 9077 9078 9079 9080 9081 9082 9083 9084 9085 9086 9087 9088 9089 9090 9091 9092 9093 9094 9095 9096 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 9112 9113 9114 9115 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 9134 9135 9136 9137 9138 9139 9140 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 10528 10529 10530 10531 10532 10533 10534 10535 10536 10537 10538 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 10577 10578 10579 10580 10581 10582 10583 10584 10585 10586 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 10602 10603 10604 10605 10606 10607 10608 10609 10610 10611 10612 10613 10614 10615 10616 10617 10618 10619 10620 10621 10622 10623 10624 10625 10626 10627 10628 10629 10630 10631 10632 10633 10634 10635 10636 10637 10638 10639 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 10655 10656 10657 10658 10659 10660 10661 10662 10663 10664 10665 10666 10667 10668 10669 10670 10671 10672 10673 10674 10675 10676 10677 10678 10679 10680 10681 10682 10683 10684 10685 10686 10687 10688 10689 10690 10691 10692 10693 10694 10695 10696 10697 10698 10699 10700 10701 10702 10703 10704 10705 10706 10707 10708 10709 10710 10711 10712 10713 10714 10715 10716 10717 10718 10719 10720 10721 10722 10723 10724 10725 10726 10727 10728 10729 10730 10731 10732 10733 10734 10735 10736 10737 10738 10739 10740 10741 10742 10743 10744 10745 10746 10747 10748 10749 10750 10751 10752 10753 10754 10755 10756 10757 10758 10759 10760 10761 10762 10763 10764 10765 10766 10767 10768 10769 10770 10771 10772 10773 10774 10775 10776 10777 10778 10779 10780 10781 10782 10783 10784 10785 10786 10787 10788 10789 10790 10791 10792 10793 10794 10795 10796 10797 10798 10799 10800 10801 10802 10803 10804 10805 10806 10807 10808 10809 10810 10811 10812 10813 10814 10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789 11790 11791 11792 11793 11794 11795 11796 11797 11798 11799 11800 11801 11802 11803 11804 11805 11806 11807 11808 11809 11810 11811 11812 11813 11814 11815 11816 11817 11818 11819 11820 11821 11822 11823 11824 11825 11826 11827 11828 11829 11830 11831 11832 11833 11834 11835 11836 11837 11838 11839 11840 11841 11842 11843 11844 11845 11846 11847 11848 11849 11850 11851 11852 11853 11854 11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205 12206 12207 12208 12209 12210 12211 12212 12213 12214 12215 12216 12217 12218 12219 12220 12221 12222 12223 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 12239 12240 12241 12242 12243 12244 12245 12246 12247 12248 12249 12250 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 12275 12276 12277 12278 12279 12280 12281 12282 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 12336 12337 12338 12339 12340 12341 12342 12343 12344 12345 12346 12347 12348 12349 12350 12351 12352 12353 12354 12355 12356 12357 12358 12359 12360 12361 12362 12363 12364 12365 12366 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 12387 12388 12389 12390 12391 12392 12393 12394 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 12413 12414 12415 12416 12417 12418 12419 12420 12421 12422 12423 12424 12425 12426 12427 12428 12429 12430 12431 12432 12433 12434 12435 12436 12437 12438 12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 12453 12454 12455 12456 12457 12458 12459 12460 12461 12462 12463 12464 12465 12466 12467 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 12483 12484 12485 12486 12487 12488 12489 12490 12491 12492 12493 12494 12495 12496 12497 12498 12499 12500 12501 12502 12503 12504 12505 12506 12507 12508 12509 12510 12511 12512 12513 12514 12515 12516 12517 12518 12519 12520 12521 12522 12523 12524 12525 12526 12527 12528 12529 12530 12531 12532 12533 12534 12535 12536 12537 12538 12539 12540 12541 12542 12543 12544 12545 12546 12547 12548 12549 12550 12551 12552 12553 12554 12555 12556 12557 12558 12559 12560 12561 12562 12563 12564 12565 12566 12567 12568 12569 12570 12571 12572 12573 12574 12575 12576 12577 12578 12579 12580 12581 12582 12583 12584 12585 12586 12587 12588 12589 12590 12591 12592 12593 12594 12595 12596 12597 12598 12599 12600 12601 12602 12603 12604 12605 12606 12607 12608 12609 12610 12611 12612 12613 12614 12615 12616 12617 12618 12619 12620 12621 12622 12623 12624 12625 12626 12627 12628 12629 12630 12631 12632 12633 12634 12635 12636 12637 12638 12639 12640 12641 12642 12643 12644 12645 12646 12647 12648 12649 12650 12651 12652 12653 12654 12655 12656 12657 12658 12659 12660 12661 12662 12663 12664 12665 12666 12667 12668 12669 12670 12671 12672 12673 12674 12675 12676 12677 12678 12679 12680 12681 12682 12683 12684 12685 12686 12687 12688 12689 12690 12691 12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 13074 13075 13076 13077 13078 13079 13080 13081 13082 13083 13084 13085 13086 13087 13088 13089 13090 13091 13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 13103 13104 13105 13106 13107 13108 13109 13110 13111 13112 13113 13114 13115 13116 13117 13118 13119 13120 13121 13122 13123 13124 13125 13126 13127 13128 13129 13130 13131 13132 13133 13134 13135 13136 13137 13138 13139 13140 13141 13142 13143 13144 13145 13146 13147 13148 13149 13150 13151 13152 13153 13154 13155 13156 13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 13171 13172 13173 13174 13175 13176 13177 13178 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 13200 13201 13202 13203 13204 13205 13206 13207 13208 13209 13210 13211 13212 13213 13214 13215 13216 13217 13218 13219 13220 13221 13222 13223 13224 13225 13226 13227 13228 13229 13230 13231 13232 13233 13234 13235 13236 13237 13238 13239 13240 13241 13242 13243 13244 13245 13246 13247 13248 13249 13250 13251 13252 13253 13254 13255 13256 13257 13258 13259 13260 13261 13262 13263 13264 13265 13266 13267 13268 13269 13270 13271 13272 13273 13274 13275 13276 13277 13278 13279 13280 13281 13282 13283 13284 13285 13286 13287 13288 13289 13290 13291 13292 13293 13294 13295 13296 13297 13298 13299 13300 13301 13302 13303 13304 13305 13306 13307 13308 13309 13310 13311 13312 13313 13314 13315 13316 13317 13318 13319 13320 13321 13322 13323 13324 13325 13326 13327 13328 13329 13330 13331 13332 13333 13334 13335 13336 13337 13338 13339 13340 13341 13342 13343 13344 13345 13346 13347 13348 13349 13350 13351 13352 13353 13354 13355 13356 13357 13358 13359 13360 13361 13362 13363 13364 13365 13366 13367 13368 13369 13370 13371 13372 13373 13374 13375 13376 13377 13378 13379 13380 13381 13382 13383 13384 13385 13386 13387 13388 13389 13390 13391 13392 13393 13394 13395 13396 13397 13398 13399 13400 13401 13402 13403 13404 13405 13406 13407 13408 13409 13410 13411 13412 13413 13414 13415 13416 13417 13418 13419 13420 13421 13422 13423 13424 13425 13426 13427 13428 13429 13430 13431 13432 13433 13434 13435 13436 13437 13438 13439 13440 13441 13442 13443 13444 13445 13446 13447 13448 13449 13450 13451 13452 13453 13454 13455 13456 13457 13458 13459 13460 13461 13462 13463 13464 13465 13466 13467 13468 13469 13470 13471 13472 13473 13474 13475 13476 13477 13478 13479 13480 13481 13482 13483 13484 13485 13486 13487 13488 13489 13490 13491 13492 13493 13494 13495 13496 13497 13498 13499 13500 13501 13502 13503 13504 13505 13506 13507 13508 13509 13510 13511 13512 13513 13514 13515 13516 13517 13518 13519 13520 13521 13522 13523 13524 13525 13526 13527 13528 13529 13530 13531 13532 13533 13534 13535 13536 13537 13538 13539 13540 13541 13542 13543 13544 13545 13546 13547 13548 13549 13550 13551 13552 13553 13554 13555 13556 13557 13558 13559 13560 13561 13562 13563 13564 13565 13566 13567 13568 13569 13570 13571 13572 13573 13574 13575 13576 13577 13578 13579 13580 13581 13582 13583 13584 13585 13586 13587 13588 13589 13590 13591 13592 13593 13594 13595 13596 13597 13598 13599 13600 13601 13602 13603 13604 13605 13606 13607 13608 13609 13610 13611 13612 13613 13614 13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 13629 13630 13631 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 13659 13660 13661 13662 13663 13664 13665 13666 13667 13668 13669 13670 13671 13672 13673 13674 13675 13676 13677 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 13694 13695 13696 13697 13698 13699 13700 13701 13702 13703 13704 13705 13706 13707 13708 13709 13710 13711 13712 13713 13714 13715 13716 13717 13718 13719 13720 13721 13722 13723 13724 13725 13726 13727 13728 13729 13730 13731 13732 13733 13734 13735 13736 13737 13738 13739 13740 13741 13742 13743 13744 13745 13746 13747 13748 13749 13750 13751 13752 13753 13754 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 13780 13781 13782 13783 13784 13785 13786 13787 13788 13789 13790 13791 13792 13793 13794 13795 13796 13797 13798 13799 13800 13801 13802 13803 13804 13805 13806 13807 13808 13809 13810 13811 13812 13813 13814 13815 13816 13817 13818 13819 13820 13821 13822 13823 13824 13825 13826 13827 13828 13829 13830 13831 13832 13833 13834 13835 13836 13837 13838 13839 13840 13841 13842 13843 13844 13845 13846 13847 13848 13849 13850 13851 13852 13853 13854 13855 13856 13857 13858 13859 13860 13861 13862 13863 13864 13865 13866 13867 13868 13869 13870 13871 13872 13873 13874 13875 13876 13877 13878 13879 13880 13881 13882 13883 13884 13885 13886 13887 13888 13889 13890 13891 13892 13893 13894 13895 13896 13897 13898 13899 13900 13901 13902 13903 13904 13905 13906 13907 13908 13909 13910 13911 13912 13913 13914 13915 13916 13917 13918 13919 13920 13921 13922 13923 13924 13925 13926 13927 13928 13929 13930 13931 13932 13933 13934 13935 13936 13937 13938 13939 13940 13941 13942 13943 13944 13945 13946 13947 13948 13949 13950 13951 13952 13953 13954 13955 13956 13957 13958 13959 13960 13961 13962 13963 13964 13965 13966 13967 13968 13969 13970 13971 13972 13973 13974 13975 13976 13977 13978 13979 13980 13981 13982 13983 13984 13985 13986 13987 13988 13989 13990 13991 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 14013 14014 14015 14016 14017 14018 14019 14020 14021 14022 14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 14039 14040 14041 14042 14043 14044 14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 14970 14971 14972 14973 14974 14975 14976 14977 14978 14979 14980 14981 14982 14983 14984 14985 14986 14987 14988 14989 14990 14991 14992 14993 14994 14995 14996 14997 14998 14999 15000 15001 15002 15003 15004 15005 15006 15007 15008 15009 15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 15021 15022 15023 15024 15025 15026 15027 15028 15029 15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 15041 15042 15043 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 15072 15073 15074 15075 15076 15077 15078 15079 15080 15081 15082 15083 15084 15085 15086 15087 15088 15089 15090 15091 15092 15093 15094 15095 15096 15097 15098 15099 15100 15101 15102 15103 15104 15105 15106 15107 15108 15109 15110 15111 15112 15113 15114 15115 15116 15117 15118 15119 15120 15121 15122 15123 15124 15125 15126 15127 15128 15129 15130 15131 15132 15133 15134 15135 15136 15137 15138 15139 15140 15141 15142 15143 15144 15145 15146 15147 15148 15149 15150 15151 15152 15153 15154 15155 15156 15157 15158 15159 15160 15161 15162 15163 15164 15165 15166 15167 15168 15169 15170 15171 15172 15173 15174 15175 15176 15177 15178 15179 15180 15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 15864 15865 15866 15867 15868 15869 15870 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 15913 15914 15915 15916 15917 15918 15919 15920 15921 15922 15923 15924 15925 15926 15927 15928 15929 15930 15931 15932 15933 15934 15935 15936 15937 15938 15939 15940 15941 15942 15943 15944 15945 15946 15947 15948 15949 15950 15951 15952 15953 15954 15955 15956 15957 15958 15959 15960 15961 15962 15963 15964 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 16045 16046 16047 16048 16049 16050 16051 16052 16053 16054 16055 16056 16057 16058 16059 16060 16061 16062 16063 16064 16065 16066 16067 16068 16069 16070 16071 16072 16073 16074 16075 16076 16077 16078 16079 16080 16081 16082 16083 16084 16085 16086 16087 16088 16089 16090 16091 16092 16093 16094 16095 16096 16097 16098 16099 16100 16101 16102 16103 16104 16105 16106 16107 16108 16109 16110 16111 16112 16113 16114 16115 16116 16117 16118 16119 16120 16121 16122 16123 16124 16125 16126 16127 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 16146 16147 16148 16149 16150 16151 16152 16153 16154 16155 16156 16157 16158 16159 16160 16161 16162 16163 16164 16165 16166 16167 16168 16169 16170 16171 16172 16173 16174 16175 16176 16177 16178 16179 16180 16181 16182 16183 16184 16185 16186 16187 16188 16189 16190 16191 16192 16193 16194 16195 16196 16197 16198 16199 16200 16201 16202 16203 16204 16205 16206 16207 16208 16209 16210 16211 16212 16213 16214 16215 16216 16217 16218 16219 16220 16221 16222 16223 16224 16225 16226 16227 16228 16229 16230 16231 16232 16233 16234 16235 16236 16237 16238 16239 16240 16241 16242 16243 16244 16245 16246 16247 16248 16249 16250 16251 16252 16253 16254 16255 16256 16257 16258 16259 16260 16261 16262 16263 16264 16265 16266 16267 16268 16269 16270 16271 16272 16273 16274 16275 16276 16277 16278 16279 16280 16281 16282 16283 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 16314 16315 16316 16317 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 16338 16339 16340 16341 16342 16343 16344 16345 16346 16347 16348 16349 16350 16351 16352 16353 16354 16355 16356 16357 16358 16359 16360 16361 16362 16363 16364 16365 16366 16367 16368 16369 16370 16371 16372 16373 16374 16375 16376 16377 16378 16379 16380 16381 16382 16383 16384 16385 16386 16387 16388 16389 16390 16391 16392 16393 16394 16395 16396 16397 16398 16399 16400 16401 16402 16403 16404 16405 16406 16407 16408 16409 16410 16411 16412 16413 16414 16415 16416 16417 16418 16419 16420 16421 16422 16423 16424 16425 16426 16427 16428 16429 16430 16431 16432 16433 16434 16435 16436 16437 16438 16439 16440 16441 16442 16443 16444 16445 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 16461 16462 16463 16464 16465 16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 16480 16481 16482 16483 16484 16485 16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 16560 16561 16562 16563 16564 16565 16566 16567 16568 16569 16570 16571 16572 16573 16574 16575 16576 16577 16578 16579 16580 16581 16582 16583 16584 16585 16586 16587 16588 16589 16590 16591 16592 16593 16594 16595 16596 16597 16598 16599 16600 16601 16602 16603 16604 16605 16606 16607 16608 16609 16610 16611 16612 16613 16614 16615 16616 16617 16618 16619 16620 16621 16622 16623 16624 16625 16626 16627 16628 16629 16630 16631 16632 16633 16634 16635 16636 16637 16638 16639 16640 16641 16642 16643 16644 16645 16646 16647 16648 16649 16650 16651 16652 16653 16654 16655 16656 16657 16658 16659 16660 16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 17029 17030 17031 17032 17033 17034 17035 17036 17037 17038 17039 17040 17041 17042 17043 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 17059 17060 17061 17062 17063 17064 17065 17066 17067 17068 17069 17070 17071 17072 17073 17074 17075 17076 17077 17078 17079 17080 17081 17082 17083 17084 17085 17086 17087 17088 17089 17090 17091 17092 17093 17094 17095 17096 17097 17098 17099 17100 17101 17102 17103 17104 17105 17106 17107 17108 17109 17110 17111 17112 17113 17114 17115 17116 17117 17118 17119 17120 17121 17122 17123 17124 17125 17126 17127 17128 17129 17130 17131 17132 17133 17134 17135 17136 17137 17138 17139 17140 17141 17142 17143 17144 17145 17146 17147 17148 17149 17150 17151 17152 17153 17154 17155 17156 17157 17158 17159 17160 17161 17162 17163 17164 17165 17166 17167 17168 17169 17170 17171 17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 17186 17187 17188 17189 17190 17191 17192 17193 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 17209 17210 17211 17212 17213 17214 17215 17216 17217 17218 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 17234 17235 17236 17237 17238 17239 17240 17241 17242 17243 17244 17245 17246 17247 17248 17249 17250 17251 17252 17253 17254 17255 17256 17257 17258 17259 17260 17261 17262 17263 17264 17265 17266 17267 17268 17269 17270 17271 17272 17273 17274 17275 17276 17277 17278 17279 17280 17281 17282 17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 17297 17298 17299 17300 17301 17302 17303 17304 17305 17306 17307 17308 17309 17310 17311 17312 17313 17314 17315 17316 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 17334 17335 17336 17337 17338 17339 17340 17341 17342 17343 17344 17345 17346 17347 17348 17349 17350 17351 17352 17353 17354 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 17372 17373 17374 17375 17376 17377 17378 17379 17380 17381 17382 17383 17384 17385 17386 17387 17388 17389 17390 17391 17392 17393 17394 17395 17396 17397 17398 17399 17400 17401 17402 17403 17404 17405 17406 17407 17408 17409 17410 17411 17412 17413 17414 17415 17416 17417 17418 17419 17420 17421 17422 17423 17424 17425 17426 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 17442 17443 17444 17445 17446 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 17462 17463 17464 17465 17466 17467 17468 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 17533 17534 17535 17536 17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 17571 17572 17573 17574 17575 17576 17577 17578 17579 17580 17581 17582 17583 17584 17585 17586 17587 17588 17589 17590 17591 17592 17593 17594 17595 17596 17597 17598 17599 17600 17601 17602 17603 17604 17605 17606 17607 17608 17609 17610 17611 17612 17613 17614 17615 17616 17617 17618 17619 17620 17621 17622 17623 17624 17625 17626 17627 17628 17629 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 17645 17646 17647 17648 17649 17650 17651 17652 17653 17654 17655 17656 17657 17658 17659 17660 17661 17662 17663 17664 17665 17666 17667 17668 17669 17670 17671 17672 17673 17674 17675 17676 17677 17678 17679 17680 17681 17682 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 17697 17698 17699 17700 17701 17702 17703 17704 17705 17706 17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 17721 17722 17723 17724 17725 17726 17727 17728 17729 17730 17731 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 18350 18351 18352 18353 18354 18355 18356 18357 18358 18359 18360 18361 18362 18363 18364 18365 18366 18367 18368 18369 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 18401 18402 18403 18404 18405 18406 18407 18408 18409 18410 18411 18412 18413 18414 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 18455 18456 18457 18458 18459 18460 18461 18462 18463 18464 18465 18466 18467 18468 18469 18470 18471 18472 18473 18474 18475 18476 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 18517 18518 18519 18520 18521 18522 18523 18524 18525 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 18555 18556 18557 18558 18559 18560 18561 18562 18563 18564 18565 18566 18567 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 18594 18595 18596 18597 18598 18599 18600 18601 18602 18603 18604 18605 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650 18651 18652 18653 18654 18655 18656 18657 18658 18659 18660 18661 18662 18663 18664 18665 18666 18667 18668 18669 18670 18671 18672 18673 18674 18675 18676 18677 18678 18679 18680 18681 18682 18683 18684 18685 18686 18687 18688 18689 18690 18691 18692 18693 18694 18695 18696 18697 18698 18699 18700 18701 18702 18703 18704 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 18734 18735 18736 18737 18738 18739 18740 18741 18742 18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 18798 18799 18800 18801 18802 18803 18804 18805 18806 18807 18808 18809 18810 18811 18812 18813 18814 18815 18816 18817 18818 18819 18820 18821 18822 18823 18824 18825 18826 18827 18828 18829 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 18850 18851 18852 18853 18854 18855 18856 18857 18858 18859 18860 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 18876 18877 18878 18879 18880 18881 18882 18883 18884 18885 18886 18887 18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 18902 18903 18904 18905 18906 18907 18908 18909 18910 18911 18912 18913 18914 18915 18916 18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 18946 18947 18948 18949 18950 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 18997 18998 18999 19000 19001 19002 19003 19004 19005 19006 19007 19008 19009 19010 19011 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 19028 19029 19030 19031 19032 19033 19034 19035 19036 19037 19038 19039 19040 19041 19042 19043 19044 19045 19046 19047 19048 19049 19050 19051 19052 19053 19054 19055 19056 19057 19058 19059 19060 19061 19062 19063 19064 19065 19066 19067 19068 19069 19070 19071 19072 19073 19074 19075 19076 19077 19078 19079 19080 19081 19082 19083 19084 19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 19099 19100 19101 19102 19103 19104 19105 19106 19107 19108 19109 19110 19111 19112 19113 19114 19115 19116 19117 19118 19119 19120 19121 19122 19123 19124 19125 19126 19127 19128 19129 19130 19131 19132 19133 19134 19135 19136 19137 19138 19139 19140 19141 19142 19143 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 19159 19160 19161 19162 19163 19164 19165 19166 19167 19168 19169 19170 19171 19172 19173 19174 19175 19176 19177 19178 19179 19180 19181 19182 19183 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 19200 19201 19202 19203 19204 19205 19206 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 19222 19223 19224 19225 19226 19227 19228 19229 19230 19231 19232 19233 19234 19235 19236 19237 19238 19239 19240 19241 19242 19243 19244 19245 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 19263 19264 19265 19266 19267 19268 19269 19270 19271 19272 19273 19274 19275 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 19294 19295 19296 19297 19298 19299 19300 19301 19302 19303 19304 19305 19306 19307 19308 19309 19310 19311 19312 19313 19314 19315 19316 19317 19318 19319 19320 19321 19322 19323 19324 19325 19326 19327 19328 19329 19330 19331 19332 19333 19334 19335 19336 19337 19338 19339 19340 19341 19342 19343 19344 19345 19346 19347 19348 19349 19350 19351 19352 19353 19354 19355 19356 19357 19358 19359 19360 19361 19362 19363 19364 19365 19366 19367 19368 19369 19370 19371 19372 19373 19374 19375 19376 19377 19378 19379 19380 19381 19382 19383 19384 19385 19386 19387 19388 19389 19390 19391 19392 19393 19394 19395 19396 19397 19398 19399 19400 19401 19402 19403 19404 19405 19406 19407 19408 19409 19410 19411 19412 19413 19414 19415 19416 19417 19418 19419 19420 19421 19422 19423 19424 19425 19426 19427 19428 19429 19430 19431 19432 19433 19434 19435 19436 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 19462 19463 19464 19465 19466 19467 19468 19469 19470 19471 19472 19473 19474 19475 19476 19477 19478 19479 19480 19481 19482 19483 19484 19485 19486 19487 19488 19489 19490 19491 19492 19493 19494 19495 19496 19497 19498 19499 19500 19501 19502 19503 19504 19505 19506 19507 19508 19509 19510 19511 19512 19513 19514 19515 19516 19517 19518 19519 19520 19521 19522 19523 19524 19525 19526 19527 19528 19529 19530 19531 19532 19533 19534 19535 19536 19537 19538 19539 19540 19541 19542 19543 19544 19545 19546 19547 19548 19549 19550 19551 19552 19553 19554 19555 19556 19557 19558 19559 19560 19561 19562 19563 19564 19565 19566 19567 19568 19569 19570 19571 19572 19573 19574 19575 19576 19577 19578 19579 19580 19581 19582 19583 19584 19585 19586 19587 19588 19589 19590 19591 19592 19593 19594 19595 19596 19597 19598 19599 19600 19601 19602 19603 19604 19605 19606 19607 19608 19609 19610 19611 19612 19613 19614 19615 19616 19617 19618 19619 19620 19621 19622 19623 19624 19625 19626 19627 19628 19629 19630 19631 19632 19633 19634 19635 19636 19637 19638 19639 19640 19641 19642 19643 19644 19645 19646 19647 19648 19649 19650 19651 19652 19653 19654 19655 19656 19657 19658 19659 19660 19661 19662 19663 19664 19665 19666 19667 19668 19669 19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 19726 19727 19728 19729 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 19779 19780 19781 19782 19783 19784 19785 19786 19787 19788 19789 19790 19791 19792 19793 19794 19795 19796 19797 19798 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 19855 19856 19857 19858 19859 19860 19861 19862 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884 19885 19886 19887 19888 19889 19890 19891 19892 19893 19894 19895 19896 19897 19898 19899 19900 19901 19902 19903 19904 19905 19906 19907 19908 19909 19910 19911 19912 19913 19914 19915 19916 19917 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 19954 19955 19956 19957 19958 19959 19960 19961 19962 19963 19964 19965 19966 19967 19968 19969 19970 19971 19972 19973 19974 19975 19976 19977 19978 19979 19980 19981 19982 19983 19984 19985 19986 19987 19988 19989 19990 19991 19992 19993 19994 19995 19996 19997 19998 19999 20000 20001 20002 20003 20004 20005 20006 20007 20008 20009 20010 20011 20012 20013 20014 20015 20016 20017 20018 20019 20020 20021 20022 20023 20024 20025 20026 20027 20028 20029 20030 20031 20032 20033 20034 20035 20036 20037 20038 20039 20040 20041 20042 20043 20044 20045 20046 20047 20048 20049 20050 20051 20052 20053 20054 20055 20056 20057 20058 20059 20060 20061 20062 20063 20064 20065 20066 20067 20068 20069 20070 20071 20072 20073 20074 20075 20076 20077 20078 20079 20080 20081 20082 20083 20084 20085 20086 20087 20088 20089 20090 20091 20092 20093 20094 20095 20096 20097 20098 20099 20100 20101 20102 20103 20104 20105 20106 20107 20108 20109 20110 20111 20112 20113 20114 20115 20116 20117 20118 20119 20120 20121 20122 20123 20124 20125 20126 20127 20128 20129 20130 20131 20132 20133 20134 20135 20136 20137 20138 20139 20140 20141 20142 20143 20144 20145 20146 20147 20148 20149 20150 20151 20152 20153 20154 20155 20156 20157 20158 20159 20160 20161 20162 20163 20164 20165 20166 20167 20168 20169 20170 20171 20172 20173 20174 20175 20176 20177 20178 20179 20180 20181 20182 20183 20184 20185 20186 20187 20188 20189 20190 20191 20192 20193 20194 20195 20196 20197 20198 20199 20200 20201 20202 20203 20204 20205 20206 20207 20208 20209 20210 20211 20212 20213 20214 20215 20216 20217 20218 20219 20220 20221 20222 20223 20224 20225 20226 20227 20228 20229 20230 20231 20232 20233 20234 20235 20236 20237 20238 20239 20240 20241 20242 20243 20244 20245 20246 20247 20248 20249 20250 20251 20252 20253 20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 20266 20267 20268 20269 20270 20271 20272 20273 20274 20275 20276 20277 20278 20279 20280 20281 20282 20283 20284 20285 20286 20287 20288 20289 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 20317 20318 20319 20320 20321 20322 20323 20324 20325 20326 20327 20328 20329 20330 20331 20332 20333 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 20352 20353 20354 20355 20356 20357 20358 20359 20360 20361 20362 20363 20364 20365 20366 20367 20368 20369 20370 20371 20372 20373 20374 20375 20376 20377 20378 20379 20380 20381 20382 20383 20384 20385 20386 20387 20388 20389 20390 20391 20392 20393 20394 20395 20396 20397 20398 20399 20400 20401 20402 20403 20404 20405 20406 20407 20408 20409 20410 20411 20412 20413 20414 20415 20416 20417 20418 20419 20420 20421 20422 20423 20424 20425 20426 20427 20428 20429 20430 20431 20432 20433 20434 20435 20436 20437 20438 20439 20440 20441 20442 20443 20444 20445 20446 20447 20448 20449 20450 20451 20452 20453 20454 20455 20456 20457 20458 20459 20460 20461 20462 20463 20464 20465 20466 20467 20468 20469 20470 20471 20472 20473 20474 20475 20476 20477 20478 20479 20480 20481 20482 20483 20484 20485 20486 20487 20488 20489 20490 20491 20492 20493 20494 20495 20496 20497 20498 20499 20500 20501 20502 20503 20504 20505 20506 20507 20508 20509 20510 20511 20512 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 20528 20529 20530 20531 20532 20533 20534 20535 20536 20537 20538 20539 20540 20541 20542 20543 20544 20545 20546 20547 20548 20549 20550 20551 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 20567 20568 20569 20570 20571 20572 20573 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 20589 20590 20591 20592 20593 20594 20595 20596 20597 20598 20599 20600 20601 20602 20603 20604 20605 20606 20607 20608 20609 20610 20611 20612 20613 20614 20615 20616 20617 20618 20619 20620 20621 20622 20623 20624 20625 20626 20627 20628 20629 20630 20631 20632 20633 20634 20635 20636 20637 20638 20639 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 20655 20656 20657 20658 20659 20660 20661 20662 20663 20664 20665 20666 20667 20668 20669 20670 20671 20672 20673 20674 20675 20676 20677 20678 20679 20680 20681 20682 20683 20684 20685 20686 20687 20688 20689 20690 20691 20692 20693 20694 20695 20696 20697 20698 20699 20700 20701 20702 20703 20704 20705 20706 20707 20708 20709 20710 20711 20712 20713 20714 20715 20716 20717 20718 20719 20720 20721 20722 20723 20724 20725 20726 20727 20728 20729 20730 20731 20732 20733 20734 20735 20736 20737 20738 20739 20740 20741 20742 20743 20744 20745 20746 20747 20748 20749 20750 20751 20752 20753 20754 20755 20756 20757 20758 20759 20760 20761 20762 20763 20764 20765 20766 20767 20768 20769 20770 20771 20772 20773 20774 20775 20776 20777 20778 20779 20780 20781 20782 20783 20784 20785 20786 20787 20788 20789 20790 20791 20792 20793 20794 20795 20796 20797 20798 20799 20800 20801 20802 20803 20804 20805 20806 20807 20808 20809 20810 20811 20812 20813 20814 20815 20816 20817 20818 20819 20820 20821 20822 20823 20824 20825 20826 20827 20828 20829 20830 20831 20832 20833 20834 20835 20836 20837 20838 20839 20840 20841 20842 20843 20844 20845 20846 20847 20848 20849 20850 20851 20852 20853 20854 20855 20856 20857 20858 20859 20860 20861 20862 20863 20864 20865 20866 20867 20868 20869 20870 20871 20872 20873 20874 20875 20876 20877 20878 20879 20880 20881 20882 20883 20884 20885 20886 20887 20888 20889 20890 20891 20892 20893 20894 20895 20896 20897 20898 20899 20900 20901 20902 20903 20904 20905 20906 20907 20908 20909 20910 20911 20912 20913 20914 20915 20916 20917 20918 20919 20920 20921 20922 20923 20924 20925 20926 20927 20928 20929 20930 20931 20932 20933 20934 20935 20936 20937 20938 20939 20940 20941 20942 20943 20944 20945 20946 20947 20948 20949 20950 20951 20952 20953 20954 20955 20956 20957 20958 20959 20960 20961 20962 20963 20964 20965 20966 20967 20968 20969 20970 20971 20972 20973 20974 20975 20976 20977 20978 20979 20980 20981 20982 20983 20984 20985 20986 20987 20988 20989 20990 20991 20992 20993 20994 20995 20996 20997 20998 20999 21000 21001 21002 21003 21004 21005 21006 21007 21008 21009 21010 21011 21012 21013 21014 21015 21016 21017 21018 21019 21020 21021 21022 21023 21024 21025 21026 21027 21028 21029 21030 21031 21032 21033 21034 21035 21036 21037 21038 21039 21040 21041 21042 21043 21044 21045 21046 21047 21048 21049 21050 21051 21052 21053 21054 21055 21056 21057 21058 21059 21060 21061 21062 21063 21064 21065 21066 21067 21068 21069 21070 21071 21072 21073 21074 21075 21076 21077 21078 21079 21080 21081 21082 21083 21084 21085 21086 21087 21088 21089 21090 21091 21092 21093 21094 21095 21096 21097 21098 21099 21100 21101 21102 21103 21104 21105 21106 21107 21108 21109 21110 21111 21112 21113 21114 21115 21116 21117 21118 21119 21120 21121 21122 21123 21124 21125 21126 21127 21128 21129 21130 21131 21132 21133 21134 21135 21136 21137 21138 21139 21140 21141 21142 21143 21144 21145 21146 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 21162 21163 21164 21165 21166 21167 21168 21169 21170 21171 21172 21173 21174 21175 21176 21177 21178 21179 21180 21181 21182 21183 21184 21185 21186 21187 21188 21189 21190 21191 21192 21193 21194 21195 21196 21197 21198 21199 21200 21201 21202 21203 21204 21205 21206 21207 21208 21209 21210 21211 21212 21213 21214 21215 21216 21217 21218 21219 21220 21221 21222 21223 21224 21225 21226 21227 21228 21229 21230 21231 21232 21233 21234 21235 21236 21237 21238 21239 21240 21241 21242 21243 21244 21245 21246 21247 21248 21249 21250 21251 21252 21253 21254 21255 21256 21257 21258 21259 21260 21261 21262 21263 21264 21265 21266 21267 21268 21269 21270 21271 21272 21273 21274 21275 21276 21277 21278 21279 21280 21281 21282 21283 21284 21285 21286 21287 21288 21289 21290 21291 21292 21293 21294 21295 21296 21297 21298 21299 21300 21301 21302 21303 21304 21305 21306 21307 21308 21309 21310 21311 21312 21313 21314 21315 21316 21317 21318 21319 21320 21321 21322 21323 21324 21325 21326 21327 21328 21329 21330 21331 21332 21333 21334 21335 21336 21337 21338 21339 21340 21341 21342 21343 21344 21345 21346 21347 21348 21349 21350 21351 21352 21353 21354 21355 21356 21357 21358 21359 21360 21361 21362 21363 21364 21365 21366 21367 21368 21369 21370 21371 21372 21373 21374 21375 21376 21377 21378 21379 21380 21381 21382 21383 21384 21385 21386 21387 21388 21389 21390 21391 21392 21393 21394 21395 21396 21397 21398 21399 21400 21401 21402 21403 21404 21405 21406 21407 21408 21409 21410 21411 21412 21413 21414 21415 21416 21417 21418 21419 21420 21421 21422 21423 21424 21425 21426 21427 21428 21429 21430 21431 21432 21433 21434 21435 21436 21437 21438 21439 21440 21441 21442 21443 21444 21445 21446 21447 21448 21449 21450 21451 21452 21453 21454 21455 21456 21457 21458 21459 21460 21461 21462 21463 21464 21465 21466 21467 21468 21469 21470 21471 21472 21473 21474 21475 21476 21477 21478 21479 21480 21481 21482 21483 21484 21485 21486 21487 21488 21489 21490 21491 21492 21493 21494 21495 21496 21497 21498 21499 21500 21501 21502 21503 21504 21505 21506 21507 21508 21509 21510 21511 21512 21513 21514 21515 21516 21517 21518 21519 21520 21521 21522 21523 21524 21525 21526 21527 21528 21529 21530 21531 21532 21533 21534 21535 21536 21537 21538 21539 21540 21541 21542 21543 21544 21545 21546 21547 21548 21549 21550 21551 21552 21553 21554 21555 21556 21557 21558 21559 21560 21561 21562 21563 21564 21565 21566 21567 21568 21569 21570 21571 21572 21573 21574 21575 21576 21577 21578 21579 21580 21581 21582 21583 21584 21585 21586 21587 21588 21589 21590 21591 21592 21593 21594 21595 21596 21597 21598 21599 21600 21601 21602 21603 21604 21605 21606 21607 21608 21609 21610 21611 21612 21613 21614 21615 21616 21617 21618 21619 21620 21621 21622 21623 21624 21625 21626 21627 21628 21629 21630 21631 21632 21633 21634 21635 21636 21637 21638 21639 21640 21641 21642 21643 21644 21645 21646 21647 21648 21649 21650 21651 21652 21653 21654 21655 21656 21657 21658 21659 21660 21661 21662 21663 21664 21665 21666 21667 21668 21669 21670 21671 21672 21673 21674 21675 21676 21677 21678 21679 21680 21681 21682 21683 21684 21685 21686 21687 21688 21689 21690 21691 21692 21693 21694 21695 21696 21697 21698 21699 21700 21701 21702 21703 21704 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 21716 21717 21718 21719 21720 21721 21722 21723 21724 21725 21726 21727 21728 21729 21730 21731 21732 21733 21734 21735 21736 21737 21738 21739 21740 21741 21742 21743 21744 21745 21746 21747 21748 21749 21750 21751 21752 21753 21754 21755 21756 21757 21758 21759 21760 21761 21762 21763 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 21779 21780 21781 21782 21783 21784 21785 21786 21787 21788 21789 21790 21791 21792 21793 21794 21795 21796 21797 21798 21799 21800 21801 21802 21803 21804 21805 21806 21807 21808 21809 21810 21811 21812 21813 21814 21815 21816 21817 21818 21819 21820 21821 21822 21823 21824 21825 21826 21827 21828 21829 21830 21831 21832 21833 21834 21835 21836 21837 21838 21839 21840 21841 21842 21843 21844 21845 21846 21847 21848 21849 21850 21851 21852 21853 21854 21855 21856 21857 21858 21859 21860 21861 21862 21863 21864 21865 21866 21867 21868 21869 21870 21871 21872 21873 21874 21875 21876 21877 21878 21879 21880 21881 21882 21883 21884 21885 21886 21887 21888 21889 21890 21891 21892 21893 21894 21895 21896 21897 21898 21899 21900 21901 21902 21903 21904 21905 21906 21907 21908 21909 21910 21911 21912 21913 21914 21915 21916 21917 21918 21919 21920 21921 21922 21923 21924 21925 21926 21927 21928 21929 21930 21931 21932 21933 21934 21935 21936 21937 21938 21939 21940 21941 21942 21943 21944 21945 21946 21947 21948 21949 21950 21951 21952 21953 21954 21955 21956 21957 21958 21959 21960 21961 21962 21963 21964 21965 21966 21967 21968 21969 21970 21971 21972 21973 21974 21975 21976 21977 21978 21979 21980 21981 21982 21983 21984 21985 21986 21987 21988 21989 21990 21991 21992 21993 21994 21995 21996 21997 21998 21999 22000 22001 22002 22003 22004 22005 22006 22007 22008 22009 22010 22011 22012 22013 22014 22015 22016 22017 22018 22019 22020 22021 22022 22023 22024 22025 22026 22027 22028 22029 22030 22031 22032 22033 22034 22035 22036 22037 22038 22039 22040 22041 22042 22043 22044 22045 22046 22047 22048 22049 22050 22051 22052 22053 22054 22055 22056 22057 22058 22059 22060 22061 22062 22063 22064 22065 22066 22067 22068 22069 22070 22071 22072 22073 22074 22075 22076 22077 22078 22079 22080 22081 22082 22083 22084 22085 22086 22087 22088 22089 22090 22091 22092 22093 22094 22095 22096 22097 22098 22099 22100 22101 22102 22103 22104 22105 22106 22107 22108 22109 22110 22111 22112 22113 22114 22115 22116 22117 22118 22119 22120 22121 22122 22123 22124 22125 22126 22127 22128 22129 22130 22131 22132 22133 22134 22135 22136 22137 22138 22139 22140 22141 22142 22143 22144 22145 22146 22147 22148 22149 22150 22151 22152 22153 22154 22155 22156 22157 22158 22159 22160 22161 22162 22163 22164 22165 22166 22167 22168 22169 22170 22171 22172 22173 22174 22175 22176 22177 22178 22179 22180 22181 22182 22183 22184 22185 22186 22187 22188 22189 22190 22191 22192 22193 22194 22195 22196 22197 22198 22199 22200 22201 22202 22203 22204 22205 22206 22207 22208 22209 22210 22211 22212 22213 22214 22215 22216 22217 22218 22219 22220 22221 22222 22223 22224 22225 22226 22227 22228 22229 22230 22231 22232 22233 22234 22235 22236 22237 22238 22239 22240 22241 22242 22243 22244 22245 22246 22247 22248 22249 22250 22251 22252 22253 22254 22255 22256 22257 22258 22259 22260 22261 22262 22263 22264 22265 22266 22267 22268 22269 22270 22271 22272 22273 22274 22275 22276 22277 22278 22279 22280 22281 22282 22283 22284 22285 22286 22287 22288 22289 22290 22291 22292 22293 22294 22295 22296 22297 22298 22299 22300 22301 22302 22303 22304 22305 22306 22307 22308 22309 22310 22311 22312 22313 22314 22315 22316 22317 22318 22319 22320 22321 22322 22323 22324 22325 22326 22327 22328 22329 22330 22331 22332 22333 22334 22335 22336 22337 22338 22339 22340 22341 22342 22343 22344 22345 22346 22347 22348 22349 22350 22351 22352 22353 22354 22355 22356 22357 22358 22359 22360 22361 22362 22363 22364 22365 22366 22367 22368 22369 22370 22371 22372 22373 22374 22375 22376 22377 22378 22379 22380 22381 22382 22383 22384 22385 22386 22387 22388 22389 22390 22391 22392 22393 22394 22395 22396 22397 22398 22399 22400 22401 22402 22403 22404 22405 22406 22407 22408 22409 22410 22411 22412 22413 22414 22415 22416 22417 22418 22419 22420 22421 22422 22423 22424 22425 22426 22427 22428 22429 22430 22431 22432 22433 22434 22435 22436 22437 22438 22439 22440 22441 22442 22443 22444 22445 22446 22447 22448 22449 22450 22451 22452 22453 22454 22455 22456 22457 22458 22459 22460 22461 22462 22463 22464 22465 22466 22467 22468 22469 22470 22471 22472 22473 22474 22475 22476 22477 22478 22479 22480 22481 22482 22483 22484 22485 22486 22487 22488 22489 22490 22491 22492 22493 22494 22495 22496 22497 22498 22499 22500 22501 22502 22503 22504 22505 22506 22507 22508 22509 22510 22511 22512 22513 22514 22515 22516 22517 22518 22519 22520 22521 22522 22523 22524 22525 22526 22527 22528 22529 22530 22531 22532 22533 22534 22535 22536 22537 22538 22539 22540 22541 22542 22543 22544 22545 22546 22547 22548 22549 22550 22551 22552 22553 22554 22555 22556 22557 22558 22559 22560 22561 22562 22563 22564 22565 22566 22567 22568 22569 22570 22571 22572 22573 22574 22575 22576 22577 22578 22579 22580 22581 22582 22583 22584 22585 22586 22587 22588 22589 22590 22591 22592 22593 22594 22595 22596 22597 22598 22599 22600 22601 22602 22603 22604 22605 22606 22607 22608 22609 22610 22611 22612 22613 22614 22615 22616 22617 22618 22619 22620 22621 22622 22623 22624 22625 22626 22627 22628 22629 22630 22631 22632 22633 22634 22635 22636 22637 22638 22639 22640 22641 22642 22643 22644 22645 22646 22647 22648 22649 22650 22651 22652 22653 22654 22655 22656 22657 22658 22659 22660 22661 22662 22663 22664 22665 22666 22667 22668 22669 22670 22671 22672 22673 22674 22675 22676 22677 22678 22679 22680 22681 22682 22683 22684 22685 22686 22687 22688 22689 22690 22691 22692 22693 22694 22695 22696 22697 22698 22699 22700 22701 22702 22703 22704 22705 22706 22707 22708 22709 22710 22711 22712 22713 22714 22715 22716 22717 22718 22719 22720 22721 22722 22723 22724 22725 22726 22727 22728 22729 22730 22731 22732 22733 22734 22735 22736 22737 22738 22739 22740 22741 22742 22743 22744 22745 22746 22747 22748 22749 22750 22751 22752 22753 22754 22755 22756 22757 22758 22759 22760 22761 22762 22763 22764 22765 22766 22767 22768 22769 22770 22771 22772 22773 22774 22775 22776 22777 22778 22779 22780 22781 22782 22783 22784 22785 22786 22787 22788 22789 22790 22791 22792 22793 22794 22795 22796 22797 22798 22799 22800 22801 22802 22803 22804 22805 22806 22807 22808 22809 22810 22811 22812 22813 22814 22815 22816 22817 22818 22819 22820 22821 22822 22823 22824 22825 22826 22827 22828 22829 22830 22831 22832 22833 22834 22835 22836 22837 22838 22839 22840 22841 22842 22843 22844 22845 22846 22847 22848 22849 22850 22851 22852 22853 22854 22855 22856 22857 22858 22859 22860 22861 22862 22863 22864 22865 22866 22867 22868 22869 22870 22871 22872 22873 22874 22875 22876 22877 22878 22879 22880 22881 22882 22883 22884 22885 22886 22887 22888 22889 22890 22891 22892 22893 22894 22895 22896 22897 22898 22899 22900 22901 22902 22903 22904 22905 22906 22907 22908 22909 22910 22911 22912 22913 22914 22915 22916 22917 22918 22919 22920 22921 22922 22923 22924 22925 22926 22927 22928 22929 22930 22931 22932 22933 22934 22935 22936 22937 22938 22939 22940 22941 22942 22943 22944 22945 22946 22947 22948 22949 22950 22951 22952 22953 22954 22955 22956 22957 22958 22959 22960 22961 22962 22963 22964 22965 22966 22967 22968 22969 22970 22971 22972 22973 22974 22975 22976 22977 22978 22979 22980 22981 22982 22983 22984 22985 22986 22987 22988 22989 22990 22991 22992 22993 22994 22995 22996 22997 22998 22999 23000 23001 23002 23003 23004 23005 23006 23007 23008 23009 23010 23011 23012 23013 23014 23015 23016 23017 23018 23019 23020 23021 23022 23023 23024 23025 23026 23027 23028 23029 23030 23031 23032 23033 23034 23035 23036 23037 23038 23039 23040 23041 23042 23043 23044 23045 23046 23047 23048 23049 23050 23051 23052 23053 23054 23055 23056 23057 23058 23059 23060 23061 23062 23063 23064 23065 23066 23067 23068 23069 23070 23071 23072 23073 23074 23075 23076 23077 23078 23079 23080 23081 23082 23083 23084 23085 23086 23087 23088 23089 23090 23091 23092 23093 23094 23095 23096 23097 23098 23099 23100 23101 23102 23103 23104 23105 23106 23107 23108 23109 23110 23111 23112 23113 23114 23115 23116 23117 23118 23119 23120 23121 23122 23123 23124 23125 23126 23127 23128 23129 23130 23131 23132 23133 23134 23135 23136 23137 23138 23139 23140 23141 23142 23143 23144 23145 23146 23147 23148 23149 23150 23151 23152 23153 23154 23155 23156 23157 23158 23159 23160 23161 23162 23163 23164 23165 23166 23167 23168 23169 23170 23171 23172 23173 23174 23175 23176 23177 23178 23179 23180 23181 23182 23183 23184 23185 23186 23187 23188 23189 23190 23191 23192 23193 23194 23195 23196 23197 23198 23199 23200 23201 23202 23203 23204 23205 23206 23207 23208 23209 23210 23211 23212 23213 23214 23215 23216 23217 23218 23219 23220 23221 23222 23223 23224 23225 23226 23227 23228 23229 23230 23231 23232 23233 23234 23235 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 23254 23255 23256 23257 23258 23259 23260 23261 23262 23263 23264 23265 23266 23267 23268 23269 23270 23271 23272 23273 23274 23275 23276 23277 23278 23279 23280 23281 23282 23283 23284 23285 23286 23287 23288 23289 23290 23291 23292 23293 23294 23295 23296 23297 23298 23299 23300 23301 23302 23303 23304 23305 23306 23307 23308 23309 23310 23311 23312 23313 23314 23315 23316 23317 23318 23319 23320 23321 23322 23323 23324 23325 23326 23327 23328 23329 23330 23331 23332 23333 23334 23335 23336 23337 23338 23339 23340 23341 23342 23343 23344 23345 23346 23347 23348 23349 23350 23351 23352 23353 23354 23355 23356 23357 23358 23359 23360 23361 23362 23363 23364 23365 23366 23367 23368 23369 23370 23371 23372 23373 23374 23375 23376 23377 23378 23379 23380 23381 23382 23383 23384 23385 23386 23387 23388 23389 23390 23391 23392 23393 23394 23395 23396 23397 23398 23399 23400 23401 23402 23403 23404 23405 23406 23407 23408 23409 23410 23411 23412 23413 23414 23415 23416 23417 23418 23419 23420 23421 23422 23423 23424 23425 23426 23427 23428 23429 23430 23431 23432 23433 23434 23435 23436 23437 23438 23439 23440 23441 23442 23443 23444 23445 23446 23447 23448 23449 23450 23451 23452 23453 23454 23455 23456 23457 23458 23459 23460 23461 23462 23463 23464 23465 23466 23467 23468 23469 23470 23471 23472 23473 23474 23475 23476 23477 23478 23479 23480 23481 23482 23483 23484 23485 23486 23487 23488 23489 23490 23491 23492 23493 23494 23495 23496 23497 23498 23499 23500 23501 23502 23503 23504 23505 23506 23507 23508 23509 23510 23511 23512 23513 23514 23515 23516 23517 23518 23519 23520 23521 23522 23523 23524 23525 23526 23527 23528 23529 23530 23531 23532 23533 23534 23535 23536 23537 23538 23539 23540 23541 23542 23543 23544 23545 23546 23547 23548 23549 23550 23551 23552 23553 23554 23555 23556 23557 23558 23559 23560 23561 23562 23563 23564 23565 23566 23567 23568 23569 23570 23571 23572 23573 23574 23575 23576 23577 23578 23579 23580 23581 23582 23583 23584 23585 23586 23587 23588 23589 23590 23591 23592 23593 23594 23595 23596 23597 23598 23599 23600 23601 23602 23603 23604 23605 23606 23607 23608 23609 23610 23611 23612 23613 23614 23615 23616 23617 23618 23619 23620 23621 23622 23623 23624 23625 23626 23627 23628 23629 23630 23631 23632 23633 23634 23635 23636 23637 23638 23639 23640 23641 23642 23643 23644 23645 23646 23647 23648 23649 23650 23651 23652 23653 23654 23655 23656 23657 23658 23659 23660 23661 23662 23663 23664 23665 23666 23667 23668 23669 23670 23671 23672 23673 23674 23675 23676 23677 23678 23679 23680 23681 23682 23683 23684 23685 23686 23687 23688 23689 23690 23691 23692 23693 23694 23695 23696 23697 23698 23699 23700 23701 23702 23703 23704 23705 23706 23707 23708 23709 23710 23711 23712 23713 23714 23715 23716 23717 23718 23719 23720 23721 23722 23723 23724 23725 23726 23727 23728 23729 23730 23731 23732 23733 23734 23735 23736 23737 23738 23739 23740 23741 23742 23743 23744 23745 23746 23747 23748 23749 23750 23751 23752 23753 23754 23755 23756 23757 23758 23759 23760 23761 23762 23763 23764 23765 23766 23767 23768 23769 23770 23771 23772 23773 23774 23775 23776 23777 23778 23779 23780 23781 23782 23783 23784 23785 23786 23787 23788 23789 23790 23791 23792 23793 23794 23795 23796 23797 23798 23799 23800 23801 23802 23803 23804 23805 23806 23807 23808 23809 23810 23811 23812 23813 23814 23815 23816 23817 23818 23819 23820 23821 23822 23823 23824 23825 23826 23827 23828 23829 23830 23831 23832 23833 23834 23835 23836 23837 23838 23839 23840 23841 23842 23843 23844 23845 23846 23847 23848 23849 23850 23851 23852 23853 23854 23855 23856 23857 23858 23859 23860 23861 23862 23863 23864 23865 23866 23867 23868 23869 23870 23871 23872 23873 23874 23875 23876 23877 23878 23879 23880 23881 23882 23883 23884 23885 23886 23887 23888 23889 23890 23891 23892 23893 23894 23895 23896 23897 23898 23899 23900 23901 23902 23903 23904 23905 23906 23907 23908 23909 23910 23911 23912 23913 23914 23915 23916 23917 23918 23919 23920 23921 23922 23923 23924 23925 23926 23927 23928 23929 23930 23931 23932 23933 23934 23935 23936 23937 23938 23939 23940 23941 23942 23943 23944 23945 23946 23947 23948 23949 23950 23951 23952 23953 23954 23955 23956 23957 23958 23959 23960 23961 23962 23963 23964 23965 23966 23967 23968 23969 23970 23971 23972 23973 23974 23975 23976 23977 23978 23979 23980 23981 23982 23983 23984 23985 23986 23987 23988 23989 23990 23991 23992 23993 23994 23995 23996 23997 23998 23999 24000 24001 24002 24003 24004 24005 24006 24007 24008 24009 24010 24011 24012 24013 24014 24015 24016 24017 24018 24019 24020 24021 24022 24023 24024 24025 24026 24027 24028 24029 24030 24031 24032 24033 24034 24035 24036 24037 24038 24039 24040 24041 24042 24043 24044 24045 24046 24047 24048 24049 24050 24051 24052 24053 24054 24055 24056 24057 24058 24059 24060 24061 24062 24063 24064 24065 24066 24067 24068 24069 24070 24071 24072 24073 24074 24075 24076 24077 24078 24079 24080 24081 24082 24083 24084 24085 24086 24087 24088 24089 24090 24091 24092 24093 24094 24095 24096 24097 24098 24099 24100 24101 24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 24114 24115 24116 24117 24118 24119 24120 24121 24122 24123 24124 24125 24126 24127 24128 24129 24130 24131 24132 24133 24134 24135 24136 24137 24138 24139 24140 24141 24142 24143 24144 24145 24146 24147 24148 24149 24150 24151 24152 24153 24154 24155 24156 24157 24158 24159 24160 24161 24162 24163 24164 24165 24166 24167 24168 24169 24170 24171 24172 24173 24174 24175 24176 24177 24178 24179 24180 24181 24182 24183 24184 24185 24186 24187 24188 24189 24190 24191 24192 24193 24194 24195 24196 24197 24198 24199 24200 24201 24202 24203 24204 24205 24206 24207 24208 24209 24210 24211 24212 24213 24214 24215 24216 24217 24218 24219 24220 24221 24222 24223 24224 24225 24226 24227 24228 24229 24230 24231 24232 24233 24234 24235 24236 24237 24238 24239 24240 24241 24242 24243 24244 24245 24246 24247 24248 24249 24250 24251 24252 24253 24254 24255 24256 24257 24258 24259 24260 24261 24262 24263 24264 24265 24266 24267 24268 24269 24270 24271 24272 24273 24274 24275 24276 24277 24278 24279 24280 24281 24282 24283 24284 24285 24286 24287 24288 24289 24290 24291 24292 24293 24294 24295 24296 24297 24298 24299 24300 24301 24302 24303 24304 24305 24306 24307 24308 24309 24310 24311 24312 24313 24314 24315 24316 24317 24318 24319 24320 24321 24322 24323 24324 24325 24326 24327 24328 24329 24330 24331 24332 24333 24334 24335 24336 24337 24338 24339 24340 24341 24342 24343 24344 24345 24346 24347 24348 24349 24350 24351 24352 24353 24354 24355 24356 24357 24358 24359 24360 24361 24362 24363 24364 24365 24366 24367 24368 24369 24370 24371 24372 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 24386 24387 24388 24389 24390 24391 24392 24393 24394 24395 24396 24397 24398 24399 24400 24401 24402 24403 24404 24405 24406 24407 24408 24409 24410 24411 24412 24413 24414 24415 24416 24417 24418 24419 24420 24421 24422 24423 24424 24425 24426 24427 24428 24429 24430 24431 24432 24433 24434 24435 24436 24437 24438 24439 24440 24441 24442 24443 24444 24445 24446 24447 24448 24449 24450 24451 24452 24453 24454 24455 24456 24457 24458 24459 24460 24461 24462 24463 24464 24465 24466 24467 24468 24469 24470 24471 24472 24473 24474 24475 24476 24477 24478 24479 24480 24481 24482 24483 24484 24485 24486 24487 24488 24489 24490 24491 24492 24493 24494 24495 24496 24497 24498 24499 24500 24501 24502 24503 24504 24505 24506 24507 24508 24509 24510 24511 24512 24513 24514 24515 24516 24517 24518 24519 24520 24521 24522 24523 24524 24525 24526 24527 24528 24529 24530 24531 24532 24533 24534 24535 24536 24537 24538 24539 24540 24541 24542 24543 24544 24545 24546 24547 24548 24549 24550 24551 24552 24553 24554 24555 24556 24557 24558 24559 24560 24561 24562 24563 24564 24565 24566 24567 24568 24569 24570 24571 24572 24573 24574 24575 24576 24577 24578 24579 24580 24581 24582 24583 24584 24585 24586 24587 24588 24589 24590 24591 24592 24593 24594 24595 24596 24597 24598 24599 24600 24601 24602 24603 24604 24605 24606 24607 24608 24609 24610 24611 24612 24613 24614 24615 24616 24617 24618 24619 24620 24621 24622 24623 24624 24625 24626 24627 24628 24629 24630 24631 24632 24633 24634 24635 24636 24637 24638 24639 24640 24641 24642 24643 24644 24645 24646 24647 24648 24649 24650 24651 24652 24653 24654 24655 24656 24657 24658 24659 24660 24661 24662 24663 24664 24665 24666 24667 24668 24669 24670 24671 24672 24673 24674 24675 24676 24677 24678 24679 24680 24681 24682 24683 24684 24685 24686 24687 24688 24689 24690 24691 24692 24693 24694 24695 24696 24697 24698 24699 24700 24701 24702 24703 24704 24705 24706 24707 24708 24709 24710 24711 24712 24713 24714 24715 24716 24717 24718 24719 24720 24721 24722 24723 24724 24725 24726 24727 24728 24729 24730 24731 24732 24733 24734 24735 24736 24737 24738 24739 24740 24741 24742 24743 24744 24745 24746 24747 24748 24749 24750 24751 24752 24753 24754 24755 24756 24757 24758 24759 24760 24761 24762 24763 24764 24765 24766 24767 24768 24769 24770 24771 24772 24773 24774 24775 24776 24777 24778 24779 24780 24781 24782 24783 24784 24785 24786 24787 24788 24789 24790 24791 24792 24793 24794 24795 24796 24797 24798 24799 24800 24801 24802 24803 24804 24805 24806 24807 24808 24809 24810 24811 24812 24813 24814 24815 24816 24817 24818 24819 24820 24821 24822 24823 24824 24825 24826 24827 24828 24829 24830 24831 24832 24833 24834 24835 24836 24837 24838 24839 24840 24841 24842 24843 24844 24845 24846 24847 24848 24849 24850 24851 24852 24853 24854 24855 24856 24857 24858 24859 24860 24861 24862 24863 24864 24865 24866 24867 24868 24869 24870 24871 24872 24873 24874 24875 24876 24877 24878 24879 24880 24881 24882 24883 24884 24885 24886 24887 24888 24889 24890 24891 24892 24893 24894 24895 24896 24897 24898 24899 24900 24901 24902 24903 24904 24905 24906 24907 24908 24909 24910 24911 24912 24913 24914 24915 24916 24917 24918 24919 24920 24921 24922 24923 24924 24925 24926 24927 24928 24929 24930 24931 24932 24933 24934 24935 24936 24937 24938 24939 24940 24941 24942 24943 24944 24945 24946 24947 24948 24949 24950 24951 24952 24953 24954 24955 24956 24957 24958 24959 24960 24961 24962 24963 24964 24965 24966 24967 24968 24969 24970 24971 24972 24973 24974 24975 24976 24977 24978 24979 24980 24981 24982 24983 24984 24985 24986 24987 24988 24989 24990 24991 24992 24993 24994 24995 24996 24997 24998 24999 25000 25001 25002 25003 25004 25005 25006 25007 25008 25009 25010 25011 25012 25013 25014 25015 25016 25017 25018 25019 25020 25021 25022 25023 25024 25025 25026 25027 25028 25029 25030 25031 25032 25033 25034 25035 25036 25037 25038 25039 25040 25041 25042 25043 25044 25045 25046 25047 25048 25049 25050 25051 25052 25053 25054 25055 25056 25057 25058 25059 25060 25061 25062 25063 25064 25065 25066 25067 25068 25069 25070 25071 25072 25073 25074 25075 25076 25077 25078 25079 25080 25081 25082 25083 25084 25085 25086 25087 25088 25089 25090 25091 25092 25093 25094 25095 25096 25097 25098 25099 25100 25101 25102 25103 25104 25105 25106 25107 25108 25109 25110 25111 25112 25113 25114 25115 25116 25117 25118 25119 25120 25121 25122 25123 25124 25125 25126 25127 25128 25129 25130 25131 25132 25133 25134 25135 25136 25137 25138 25139 25140 25141 25142 25143 25144 25145 25146 25147 25148 25149 25150 25151 25152 25153 25154 25155 25156 25157 25158 25159 25160 25161 25162 25163 25164 25165 25166 25167 25168 25169 25170 25171 25172 25173 25174 25175 25176 25177 25178 25179 25180 25181 25182 25183 25184 25185 25186 25187 25188 25189 25190 25191 25192 25193 25194 25195 25196 25197 25198 25199 25200 25201 25202 25203 25204 25205 25206 25207 25208 25209 25210 25211 25212 25213 25214 25215 25216 25217 25218 25219 25220 25221 25222 25223 25224 25225 25226 25227 25228 25229 25230 25231 25232 25233 25234 25235 25236 25237 25238 25239 25240 25241 25242 25243 25244 25245 25246 25247 25248 25249 25250 25251 25252 25253 25254 25255 25256 25257 25258 25259 25260 25261 25262 25263 25264 25265 25266 25267 25268 25269 25270 25271 25272 25273 25274 25275 25276 25277 25278 25279 25280 25281 25282 25283 25284 25285 25286 25287 25288 25289 25290 25291 25292 25293 25294 25295 25296 25297 25298 25299 25300 25301 25302 25303 25304 25305 25306 25307 25308 25309 25310 25311 25312 25313 25314 25315 25316 25317 25318 25319 25320 25321 25322 25323 25324 25325 25326 25327 25328 25329 25330 25331 25332 25333 25334 25335 25336 25337 25338 25339 25340 25341 25342 25343 25344 25345 25346 25347 25348 25349 25350 25351 25352 25353 25354 25355 25356 25357 25358 25359 25360 25361 25362 25363 25364 25365 25366 25367 25368 25369 25370 25371 25372 25373 25374 25375 25376 25377 25378 25379 25380 25381 25382 25383 25384 25385 25386 25387 25388 25389 25390 25391 25392 25393 25394 25395 25396 25397 25398 25399 25400 25401 25402 25403 25404 25405 25406 25407 25408 25409 25410 25411 25412 25413 25414 25415 25416 25417 25418 25419 25420 25421 25422 25423 25424 25425 25426 25427 25428 25429 25430 25431 25432 25433 25434 25435 25436 25437 25438 25439 25440 25441 25442 25443 25444 25445 25446 25447 25448 25449 25450 25451 25452 25453 25454 25455 25456 25457 25458 25459 25460 25461 25462 25463 25464 25465 25466 25467 25468 25469 25470 25471 25472 25473 25474 25475 25476 25477 25478 25479 25480 25481 25482 25483 25484 25485 25486 25487 25488 25489 25490 25491 25492 25493 25494 25495 25496 25497 25498 25499 25500 25501 25502 25503 25504 25505 25506 25507 25508 25509 25510 25511 25512 25513 25514 25515 25516 25517 25518 25519 25520 25521 25522 25523 25524 25525 25526 25527 25528 25529 25530 25531 25532 25533 25534 25535 25536 25537 25538 25539 25540 25541 25542 25543 25544 25545 25546 25547 25548 25549 25550 25551 25552 25553 25554 25555 25556 25557 25558 25559 25560 25561 25562 25563 25564 25565 25566 25567 25568 25569 25570 25571 25572 25573 25574 25575 25576 25577 25578 25579 25580 25581 25582 25583 25584 25585 25586 25587 25588 25589 25590 25591 25592 25593 25594 25595 25596 25597 25598 25599 25600 25601 25602 25603 25604 25605 25606 25607 25608 25609 25610 25611 25612 25613 25614 25615 25616 25617 25618 25619 25620 25621 25622 25623 25624 25625 25626 25627 25628 25629 25630 25631 25632 25633 25634 25635 25636 25637 25638 25639 25640 25641 25642 25643 25644 25645 25646 25647 25648 25649 25650 25651 25652 25653 25654 25655 25656 25657 25658 25659 25660 25661 25662 25663 25664 25665 25666 25667 25668 25669 25670 25671 25672 25673 25674 25675 25676 25677 25678 25679 25680 25681 25682 25683 25684 25685 25686 25687 25688 25689 25690 25691 25692 25693 25694 25695 25696 25697 25698 25699 25700 25701 25702 25703 25704 25705 25706 25707 25708 25709 25710 25711 25712 25713 25714 25715 25716 25717 25718 25719 25720 25721 25722 25723 25724 25725 25726 25727 25728 25729 25730 25731 25732 25733 25734 25735 25736 25737 25738 25739 25740 25741 25742 25743 25744 25745 25746 25747 25748 25749 25750 25751 25752 25753 25754 25755 25756 25757 25758 25759 25760 25761 25762 25763 25764 25765 25766 25767 25768 25769 25770 25771 25772 25773 25774 25775 25776 25777 25778 25779 25780 25781 25782 25783 25784 25785 25786 25787 25788 25789 25790 25791 25792 25793 25794 25795 25796 25797 25798 25799 25800 25801 25802 25803 25804 25805 25806 25807 25808 25809 25810 25811 25812 25813 25814 25815 25816 25817 25818 25819 25820 25821 25822 25823 25824 25825 25826 25827 25828 25829 25830 25831 25832 25833 25834 25835 25836 25837 25838 25839 25840 25841 25842 25843 25844 25845 25846 25847 25848 25849 25850 25851 25852 25853 25854 25855 25856 25857 25858 25859 25860 25861 25862 25863 25864 25865 25866 25867 25868 25869 25870 25871 25872 25873 25874 25875 25876 25877 25878 25879 25880 25881 25882 25883 25884 25885 25886 25887 25888 25889 25890 25891 25892 25893 25894 25895 25896 25897 25898 25899 25900 25901 25902 25903 25904 25905 25906 25907 25908 25909 25910 25911 25912 25913 25914 25915 25916 25917 25918 25919 25920 25921 25922 25923 25924 25925 25926 25927 25928 25929 25930 25931 25932 25933 25934 25935 25936 25937 25938 25939 25940 25941 25942 25943 25944 25945 25946 25947 25948 25949 25950 25951 25952 25953 25954 25955 25956 25957 25958 25959 25960 25961 25962 25963 25964 25965 25966 25967 25968 25969 25970 25971 25972 25973 25974 25975 25976 25977 25978 25979 25980 25981 25982 25983 25984 25985 25986 25987 25988 25989 25990 25991 25992 25993 25994 25995 25996 25997 25998 25999 26000 26001 26002 26003 26004 26005 26006 26007 26008 26009 26010 26011 26012 26013 26014 26015 26016 26017 26018 26019 26020 26021 26022 26023 26024 26025 26026 26027 26028 26029 26030 26031 26032 26033 26034 26035 26036 26037 26038 26039 26040 26041 26042 26043 26044 26045 26046 26047 26048 26049 26050 26051 26052 26053 26054 26055 26056 26057 26058 26059 26060 26061 26062 26063 26064 26065 26066 26067 26068 26069 26070 26071 26072 26073 26074 26075 26076 26077 26078 26079 26080 26081 26082 26083 26084 26085 26086 26087 26088 26089 26090 26091 26092 26093 26094 26095 26096 26097 26098 26099 26100 26101 26102 26103 26104 26105 26106 26107 26108 26109 26110 26111 26112 26113 26114 26115 26116 26117 26118 26119 26120 26121 26122 26123 26124 26125 26126 26127 26128 26129 26130 26131 26132 26133 26134 26135 26136 26137 26138 26139 26140 26141 26142 26143 26144 26145 26146 26147 26148 26149 26150 26151 26152 26153 26154 26155 26156 26157 26158 26159 26160 26161 26162 26163 26164 26165 26166 26167 26168 26169 26170 26171 26172 26173 26174 26175 26176 26177 26178 26179 26180 26181 26182 26183 26184 26185 26186 26187 26188 26189 26190 26191 26192 26193 26194 26195 26196 26197 26198 26199 26200 26201 26202 26203 26204 26205 26206 26207 26208 26209 26210 26211 26212 26213 26214 26215 26216 26217 26218 26219 26220 26221 26222 26223 26224 26225 26226 26227 26228 26229 26230 26231 26232 26233 26234 26235 26236 26237 26238 26239 26240 26241 26242 26243 26244 26245 26246 26247 26248 26249 26250 26251 26252 26253 26254 26255 26256 26257 26258 26259 26260 26261 26262 26263 26264 26265 26266 26267 26268 26269 26270 26271 26272 26273 26274 26275 26276 26277 26278 26279 26280 26281 26282 26283 26284 26285 26286 26287 26288 26289 26290 26291 26292 26293 26294 26295 26296 26297 26298 26299 26300 26301 26302 26303 26304 26305 26306 26307 26308 26309 26310 26311 26312 26313 26314 26315 26316 26317 26318 26319 26320 26321 26322 26323 26324 26325 26326 26327 26328 26329 26330 26331 26332 26333 26334 26335 26336 26337 26338 26339 26340 26341 26342 26343 26344 26345 26346 26347 26348 26349 26350 26351 26352 26353 26354 26355 26356 26357 26358 26359 26360 26361 26362 26363 26364 26365 26366 26367 26368 26369 26370 26371 26372 26373 26374 26375 26376 26377 26378 26379 26380 26381 26382 26383 26384 26385 26386 26387 26388 26389 26390 26391 26392 26393 26394 26395 26396 26397 26398 26399 26400 26401 26402 26403 26404 26405 26406 26407 26408 26409 26410 26411 26412 26413 26414 26415 26416 26417 26418 26419 26420 26421 26422 26423 26424 26425 26426 26427 26428 26429 26430 26431 26432 26433 26434 26435 26436 26437 26438 26439 26440 26441 26442 26443 26444 26445 26446 26447 26448 26449 26450 26451 26452 26453 26454 26455 26456 26457 26458 26459 26460 26461 26462 26463 26464 26465 26466 26467 26468 26469 26470 26471 26472 26473 26474 26475 26476 26477 26478 26479 26480 26481 26482 26483 26484 26485 26486 26487 26488 26489 26490 26491 26492 26493 26494 26495 26496 26497 26498 26499 26500 26501 26502 26503 26504 26505 26506 26507 26508 26509 26510 26511 26512 26513 26514 26515 26516 26517 26518 26519 26520 26521 26522 26523 26524 26525 26526 26527 26528 26529 26530 26531 26532 26533 26534 26535 26536 26537 26538 26539 26540 26541 26542 26543 26544 26545 26546 26547 26548 26549 26550 26551 26552 26553 26554 26555 26556 26557 26558 26559 26560 26561 26562 26563 26564 26565 26566 26567 26568 26569 26570 26571 26572 26573 26574 26575 26576 26577 26578 26579 26580 26581 26582 26583 26584 26585 26586 26587 26588 26589 26590 26591 26592 26593 26594 26595 26596 26597 26598 26599 26600 26601 26602 26603 26604 26605 26606 26607 26608 26609 26610 26611 26612 26613 26614 26615 26616 26617 26618 26619 26620 26621 26622 26623 26624 26625 26626 26627 26628 26629 26630 26631 26632 26633 26634 26635 26636 26637 26638 26639 26640 26641 26642 26643 26644 26645 26646 26647 26648 26649 26650 26651 26652 26653 26654 26655 26656 26657 26658 26659 26660 26661 26662 26663 26664 26665 26666 26667 26668 26669 26670 26671 26672 26673 26674 26675 26676 26677 26678 26679 26680 26681 26682 26683 26684 26685 26686 26687 26688 26689 26690 26691 26692 26693 26694 26695 26696 26697 26698 26699 26700 26701 26702 26703 26704 26705 26706 26707 26708 26709 26710 26711 26712 26713 26714 26715 26716 26717 26718 26719 26720 26721 26722 26723 26724 26725 26726 26727 26728 26729 26730 26731 26732 26733 26734 26735 26736 26737 26738 26739 26740 26741 26742 26743 26744 26745 26746 26747 26748 26749 26750 26751 26752 26753 26754 26755 26756 26757 26758 26759 26760 26761 26762 26763 26764 26765 26766 26767 26768 26769 26770 26771 26772 26773 26774 26775 26776 26777 26778 26779 26780 26781 26782 26783 26784 26785 26786 26787 26788 26789 26790 26791 26792 26793 26794 26795 26796 26797 26798 26799 26800 26801 26802 26803 26804 26805 26806 26807 26808 26809 26810 26811 26812 26813 26814 26815 26816 26817 26818 26819 26820 26821 26822 26823 26824 26825 26826 26827 26828 26829 26830 26831 26832 26833 26834 26835 26836 26837 26838 26839 26840 26841 26842 26843 26844 26845 26846 26847 26848 26849 26850 26851 26852 26853 26854 26855 26856 26857 26858 26859 26860 26861 26862 26863 26864 26865 26866 26867 26868 26869 26870 26871 26872 26873 26874 26875 26876 26877 26878 26879 26880 26881 26882 26883 26884 26885 26886 26887 26888 26889 26890 26891 26892 26893 26894 26895 26896 26897 26898 26899 26900 26901 26902 26903 26904 26905 26906 26907 26908 26909 26910 26911 26912 26913 26914 26915 26916 26917 26918 26919 26920 26921 26922 26923 26924 26925 26926 26927 26928 26929 26930 26931 26932 26933 26934 26935 26936 26937 26938 26939 26940 26941 26942 26943 26944 26945 26946 26947 26948 26949 26950 26951 26952 26953 26954 26955 26956 26957 26958 26959 26960 26961 26962 26963 26964 26965 26966 26967 26968 26969 26970 26971 26972 26973 26974 26975 26976 26977 26978 26979 26980 26981 26982 26983 26984 26985 26986 26987 26988 26989 26990 26991 26992 26993 26994 26995 26996 26997 26998 26999 27000 27001 27002 27003 27004 27005 27006 27007 27008 27009 27010 27011 27012 27013 27014 27015 27016 27017 27018 27019 27020 27021 27022 27023 27024 27025 27026 27027 27028 27029 27030 27031 27032 27033 27034 27035 27036 27037 27038 27039 27040 27041 27042 27043 27044 27045 27046 27047 27048 27049 27050 27051 27052 27053 27054 27055 27056 27057 27058 27059 27060 27061 27062 27063 27064 27065 27066 27067 27068 27069 27070 27071 27072 27073 27074 27075 27076 27077 27078 27079 27080 27081 27082 27083 27084 27085 27086 27087 27088 27089 27090 27091 27092 27093 27094 27095 27096 27097 27098 27099 27100 27101 27102 27103 27104 27105 27106 27107 27108 27109 27110 27111 27112 27113 27114 27115 27116 27117 27118 27119 27120 27121 27122 27123 27124 27125 27126 27127 27128 27129 27130 27131 27132 27133 27134 27135 27136 27137 27138 27139 27140 27141 27142 27143 27144 27145 27146 27147 27148 27149 27150 27151 27152 27153 27154 27155 27156 27157 27158 27159 27160 27161 27162 27163 27164 27165 27166 27167 27168 27169 27170 27171 27172 27173 27174 27175 27176 27177 27178 27179 27180 27181 27182 27183 27184 27185 27186 27187 27188 27189 27190 27191 27192 27193 27194 27195 27196 27197 27198 27199 27200 27201 27202 27203 27204 27205 27206 27207 27208 27209 27210 27211 27212 27213 27214 27215 27216 27217 27218 27219 27220 27221 27222 27223 27224 27225 27226 27227 27228 27229 27230 27231 27232 27233 27234 27235 27236 27237 27238 27239 27240 27241 27242 27243 27244 27245 27246 27247 27248 27249 27250 27251 27252 27253 27254 27255 27256 27257 27258 27259 27260 27261 27262 27263 27264 27265 27266 27267 27268 27269 27270 27271 27272 27273 27274 27275 27276 27277 27278 27279 27280 27281 27282 27283 27284 27285 27286 27287 27288 27289 27290 27291 27292 27293 27294 27295 27296 27297 27298 27299 27300 27301 27302 27303 27304 27305 27306 27307 27308 27309 27310 27311 27312 27313 27314 27315 27316 27317 27318 27319 27320 27321 27322 27323 27324 27325 27326 27327 27328 27329 27330 27331 27332 27333 27334 27335 27336 27337 27338 27339 27340 27341 27342 27343 27344 27345 27346 27347 27348 27349 27350 27351 27352 27353 27354 27355 27356 27357 27358 27359 27360 27361 27362 27363 27364 27365 27366 27367 27368 27369 27370 27371 27372 27373 27374 27375 27376 27377 27378 27379 27380 27381 27382 27383 27384 27385 27386 27387 27388 27389 27390 27391 27392 27393 27394 27395 27396 27397 27398 27399 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 27412 27413 27414 27415 27416 27417 27418 27419 27420 27421 27422 27423 27424 27425 27426 27427 27428 27429 27430 27431 27432 27433 27434 27435 27436 27437 27438 27439 27440 27441 27442 27443 27444 27445 27446 27447 27448 27449 27450 27451 27452 27453 27454 27455 27456 27457 27458 27459 27460 27461 27462 27463 27464 27465 27466 27467 27468 27469 27470 27471 27472 27473 27474 27475 27476 27477 27478 27479 27480 27481 27482 27483 27484 27485 27486 27487 27488 27489 27490 27491 27492 27493 27494 27495 27496 27497 27498 27499 27500 27501 27502 27503 27504 27505 27506 27507 27508 27509 27510 27511 27512 27513 27514 27515 27516 27517 27518 27519 27520 27521 27522 27523 27524 27525 27526 27527 27528 27529 27530 27531 27532 27533 27534 27535 27536 27537 27538 27539 27540 27541 27542 27543 27544 27545 27546 27547 27548 27549 27550 27551 27552 27553 27554 27555 27556 27557 27558 27559 27560 27561 27562 27563 27564 27565 27566 27567 27568 27569 27570 27571 27572 27573 27574 27575 27576 27577 27578 27579 27580 27581 27582 27583 27584 27585 27586 27587 27588 27589 27590 27591 27592 27593 27594 27595 27596 27597 27598 27599 27600 27601 27602 27603 27604 27605 27606 27607 27608 27609 27610 27611 27612 27613 27614 27615 27616 27617 27618 27619 27620 27621 27622 27623 27624 27625 27626 27627 27628 27629 27630 27631 27632 27633 27634 27635 27636 27637 27638 27639 27640 27641 27642 27643 27644 27645 27646 27647 27648 27649 27650 27651 27652 27653 27654 27655 27656 27657 27658 27659 27660 27661 27662 27663 27664 27665 27666 27667 27668 27669 27670 27671 27672 27673 27674 27675 27676 27677 27678 27679 27680 27681 27682 27683 27684 27685 27686 27687 27688 27689 27690 27691 27692 27693 27694 27695 27696 27697 27698 27699 27700 27701 27702 27703 27704 27705 27706 27707 27708 27709 27710 27711 27712 27713 27714 27715 27716 27717 27718 27719 27720 27721 27722 27723 27724 27725 27726 27727 27728 27729 27730 27731 27732 27733 27734 27735 27736 27737 27738 27739 27740 27741 27742 27743 27744 27745 27746 27747 27748 27749 27750 27751 27752 27753 27754 27755 27756 27757 27758 27759 27760 27761 27762 27763 27764 27765 27766 27767 27768 27769 27770 27771 27772 27773 27774 27775 27776 27777 27778 27779 27780 27781 27782 27783 27784 27785 27786 27787 27788 27789 27790 27791 27792 27793 27794 27795 27796 27797 27798 27799 27800 27801 27802 27803 27804 27805 27806 27807 27808 27809 27810 27811 27812 27813 27814 27815 27816 27817 27818 27819 27820 27821 27822 27823 27824 27825 27826 27827 27828 27829 27830 27831 27832 27833 27834 27835 27836 27837 27838 27839 27840 27841 27842 27843 27844 27845 27846 27847 27848 27849 27850 27851 27852 27853 27854 27855 27856 27857 27858 27859 27860 27861 27862 27863 27864 27865 27866 27867 27868 27869 27870 27871 27872 27873 27874 27875 27876 27877 27878 27879 27880 27881 27882 27883 27884 27885 27886 27887 27888 27889 27890 27891 27892 27893 27894 27895 27896 27897 27898 27899 27900 27901 27902 27903 27904 27905 27906 27907 27908 27909 27910 27911 27912 27913 27914 27915 27916 27917 27918 27919 27920 27921 27922 27923 27924 27925 27926 27927 27928 27929 27930 27931 27932 27933 27934 27935 27936 27937 27938 27939 27940 27941 27942 27943 27944 27945 27946 27947 27948 27949 27950 27951 27952 27953 27954 27955 27956 27957 27958 27959 27960 27961 27962 27963 27964 27965 27966 27967 27968 27969 27970 27971 27972 27973 27974 27975 27976 27977 27978 27979 27980 27981 27982 27983 27984 27985 27986 27987 27988 27989 27990 27991 27992 27993 27994 27995 27996 27997 27998 27999 28000 28001 28002 28003 28004 28005 28006 28007 28008 28009 28010 28011 28012 28013 28014 28015 28016 28017 28018 28019 28020 28021 28022 28023 28024 28025 28026 28027 28028 28029 28030 28031 28032 28033 28034 28035 28036 28037 28038 28039 28040 28041 28042 28043 28044 28045 28046 28047 28048 28049 28050 28051 28052 28053 28054 28055 28056 28057 28058 28059 28060 28061 28062 28063 28064 28065 28066 28067 28068 28069 28070 28071 28072 28073 28074 28075 28076 28077 28078 28079 28080 28081 28082 28083 28084 28085 28086 28087 28088 28089 28090 28091 28092 28093 28094 28095 28096 28097 28098 28099 28100 28101 28102 28103 28104 28105 28106 28107 28108 28109 28110 28111 28112 28113 28114 28115 28116 28117 28118 28119 28120 28121 28122 28123 28124 28125 28126 28127 28128 28129 28130 28131 28132 28133 28134 28135 28136 28137 28138 28139 28140 28141 28142 28143 28144 28145 28146 28147 28148 28149 28150 28151 28152 28153 28154 28155 28156 28157 28158 28159 28160 28161 28162 28163 28164 28165 28166 28167 28168 28169 28170 28171 28172 28173 28174 28175 28176 28177 28178 28179 28180 28181 28182 28183 28184 28185 28186 28187 28188 28189 28190 28191 28192 28193 28194 28195 28196 28197 28198 28199 28200 28201 28202 28203 28204 28205 28206 28207 28208 28209 28210 28211 28212 28213 28214 28215 28216 28217 28218 28219 28220 28221 28222 28223 28224 28225 28226 28227 28228 28229 28230 28231 28232 28233 28234 28235 28236 28237 28238 28239 28240 28241 28242 28243 28244 28245 28246 28247 28248 28249 28250 28251 28252 28253 28254 28255 28256 28257 28258 28259 28260 28261 28262 28263 28264 28265 28266 28267 28268 28269 28270 28271 28272 28273 28274 28275 28276 28277 28278 28279 28280 28281 28282 28283 28284 28285 28286 28287 28288 28289 28290 28291 28292 28293 28294 28295 28296 28297 28298 28299 28300 28301 28302 28303 28304 28305 28306 28307 28308 28309 28310 28311 28312 28313 28314 28315 28316 28317 28318 28319 28320 28321 28322 28323 28324 28325 28326 28327 28328 28329 28330 28331 28332 28333 28334 28335 28336 28337 28338 28339 28340 28341 28342 28343 28344 28345 28346 28347 28348 28349 28350 28351 28352 28353 28354 28355 28356 28357 28358 28359 28360 28361 28362 28363 28364 28365 28366 28367 28368 28369 28370 28371 28372 28373 28374 28375 28376 28377 28378 28379 28380 28381 28382 28383 28384 28385 28386 28387 28388 28389 28390 28391 28392 28393 28394 28395 28396 28397 28398 28399 28400 28401 28402 28403 28404 28405 28406 28407 28408 28409 28410 28411 28412 28413 28414 28415 28416 28417 28418 28419 28420 28421 28422 28423 28424 28425 28426 28427 28428 28429 28430 28431 28432 28433 28434 28435 28436 28437 28438 28439 28440 28441 28442 28443 28444 28445 28446 28447 28448 28449 28450 28451 28452 28453 28454 28455 28456 28457 28458 28459 28460 28461 28462 28463 28464 28465 28466 28467 28468 28469 28470 28471 28472 28473 28474 28475 28476 28477 28478 28479 28480 28481 28482 28483 28484 28485 28486 28487 28488 28489 28490 28491 28492 28493 28494 28495 28496 28497 28498 28499 28500 28501 28502 28503 28504 28505 28506 28507 28508 28509 28510 28511 28512 28513 28514 28515 28516 28517 28518 28519 28520 28521 28522 28523 28524 28525 28526 28527 28528 28529 28530 28531 28532 28533 28534 28535 28536 28537 28538 28539 28540 28541 28542 28543 28544 28545 28546 28547 28548 28549 28550 28551 28552 28553 28554 28555 28556 28557 28558 28559 28560 28561 28562 28563 28564 28565 28566 28567 28568 28569 28570 28571 28572 28573 28574 28575 28576 28577 28578 28579 28580 28581 28582 28583 28584 28585 28586 28587 28588 28589 28590 28591 28592 28593 28594 28595 28596 28597 28598 28599 28600 28601 28602 28603 28604 28605 28606 28607 28608 28609 28610 28611 28612 28613 28614 28615 28616 28617 28618 28619 28620 28621 28622 28623 28624 28625 28626 28627 28628 28629 28630 28631 28632 28633 28634 28635 28636 28637 28638 28639 28640 28641 28642 28643 28644 28645 28646 28647 28648 28649 28650 28651 28652 28653 28654 28655 28656 28657 28658 28659 28660 28661 28662 28663 28664 28665 28666 28667 28668 28669 28670 28671 28672 28673 28674 28675 28676 28677 28678 28679 28680 28681 28682 28683 28684 28685 28686 28687 28688 28689 28690 28691 28692 28693 28694 28695 28696 28697 28698 28699 28700 28701 28702 28703 28704 28705 28706 28707 28708 28709 28710 28711 28712 28713 28714 28715 28716 28717 28718 28719 28720 28721 28722 28723 28724 28725 28726 28727 28728 28729 28730 28731 28732 28733 28734 28735 28736 28737 28738 28739 28740 28741 28742 28743 28744 28745 28746 28747 28748 28749 28750 28751 28752 28753 28754 28755 28756 28757 28758 28759 28760 28761 28762 28763 28764 28765 28766 28767 28768 28769 28770 28771 28772 28773 28774 28775 28776 28777 28778 28779 28780 28781 28782 28783 28784 28785 28786 28787 28788 28789 28790 28791 28792 28793 28794 28795 28796 28797 28798 28799 28800 28801 28802 28803 28804 28805 28806 28807 28808 28809 28810 28811 28812 28813 28814 28815 28816 28817 28818 28819 28820 28821 28822 28823 28824 28825 28826 28827 28828 28829 28830 28831 28832 28833 28834 28835 28836 28837 28838 28839 28840 28841 28842 28843 28844 28845 28846 28847 28848 28849 28850 28851 28852 28853 28854 28855 28856 28857 28858 28859 28860 28861 28862 28863 28864 28865 28866 28867 28868 28869 28870 28871 28872 28873 28874 28875 28876 28877 28878 28879 28880 28881 28882 28883 28884 28885 28886 28887 28888 28889 28890 28891 28892 28893 28894 28895 28896 28897 28898 28899 28900 28901 28902 28903 28904 28905 28906 28907 28908 28909 28910 28911 28912 28913 28914 28915 28916 28917 28918 28919 28920 28921 28922 28923 28924 28925 28926 28927 28928 28929 28930 28931 28932 28933 28934 28935 28936 28937 28938 28939 28940 28941 28942 28943 28944 28945 28946 28947 28948 28949 28950 28951 28952 28953 28954 28955 28956 28957 28958 28959 28960 28961 28962 28963 28964 28965 28966 28967 28968 28969 28970 28971 28972 28973 28974 28975 28976 28977 28978 28979 28980 28981 28982 28983 28984 28985 28986 28987 28988 28989 28990 28991 28992 28993 28994 28995 28996 28997 28998 28999 29000 29001 29002 29003 29004 29005 29006 29007 29008 29009 29010 29011 29012 29013 29014 29015 29016 29017 29018 29019 29020 29021 29022 29023 29024 29025 29026 29027 29028 29029 29030 29031 29032 29033 29034 29035 29036 29037 29038 29039 29040 29041 29042 29043 29044 29045 29046 29047 29048 29049 29050 29051 29052 29053 29054 29055 29056 29057 29058 29059 29060 29061 29062 29063 29064 29065 29066 29067 29068 29069 29070 29071 29072 29073 29074 29075 29076 29077 29078 29079 29080 29081 29082 29083 29084 29085 29086 29087 29088 29089 29090 29091 29092 29093 29094 29095 29096 29097 29098 29099 29100 29101 29102 29103 29104 29105 29106 29107 29108 29109 29110 29111 29112 29113 29114 29115 29116 29117 29118 29119 29120 29121 29122 29123 29124 29125 29126 29127 29128 29129 29130 29131 29132 29133 29134 29135 29136 29137 29138 29139 29140 29141 29142 29143 29144 29145 29146 29147 29148 29149 29150 29151 29152 29153 29154 29155 29156 29157 29158 29159 29160 29161 29162 29163 29164 29165 29166 29167 29168 29169 29170 29171 29172 29173 29174 29175 29176 29177 29178 29179 29180 29181 29182 29183 29184 29185 29186 29187 29188 29189 29190 29191 29192 29193 29194 29195 29196 29197 29198 29199 29200 29201 29202 29203 29204 29205 29206 29207 29208 29209 29210 29211 29212 29213 29214 29215 29216 29217 29218 29219 29220 29221 29222 29223 29224 29225 29226 29227 29228 29229 29230 29231 29232 29233 29234 29235 29236 29237 29238 29239 29240 29241 29242 29243 29244 29245 29246 29247 29248 29249 29250 29251 29252 29253 29254 29255 29256 29257 29258 29259 29260 29261 29262 29263 29264 29265 29266 29267 29268 29269 29270 29271 29272 29273 29274 29275 29276 29277 29278 29279 29280 29281 29282 29283 29284 29285 29286 29287 29288 29289 29290 29291 29292 29293 29294 29295 29296 29297 29298 29299 29300 29301 29302 29303 29304 29305 29306 29307 29308 29309 29310 29311 29312 29313 29314 29315 29316 29317 29318 29319 29320 29321 29322 29323 29324 29325 29326 29327 29328 29329 29330 29331 29332 29333 29334 29335 29336 29337 29338 29339 29340 29341 29342 29343 29344 29345 29346 29347 29348 29349 29350 29351 29352 29353 29354 29355 29356 29357 29358 29359 29360 29361 29362 29363 29364 29365 29366 29367 29368 29369 29370 29371 29372 29373 29374 29375 29376 29377 29378 29379 29380 29381 29382 29383 29384 29385 29386 29387 29388 29389 29390 29391 29392 29393 29394 29395 29396 29397 29398 29399 29400 29401 29402 29403 29404 29405 29406 29407 29408 29409 29410 29411 29412 29413 29414 29415 29416 29417 29418 29419 29420 29421 29422 29423 29424 29425 29426 29427 29428 29429 29430 29431 29432 29433 29434 29435 29436 29437 29438 29439 29440 29441 29442 29443 29444 29445 29446 29447 29448 29449 29450 29451 29452 29453 29454 29455 29456 29457 29458 29459 29460 29461 29462 29463 29464 29465 29466 29467 29468 29469 29470 29471 29472 29473 29474 29475 29476 29477 29478 29479 29480 29481 29482 29483 29484 29485 29486 29487 29488 29489 29490 29491 29492 29493 29494 29495 29496 29497 29498 29499 29500 29501 29502 29503 29504 29505 29506 29507 29508 29509 29510 29511 29512 29513 29514 29515 29516 29517 29518 29519 29520 29521 29522 29523 29524 29525 29526 29527 29528 29529 29530 29531 29532 29533 29534 29535 29536 29537 29538 29539 29540 29541 29542 29543 29544 29545 29546 29547 29548 29549 29550 29551 29552 29553 29554 29555 29556 29557 29558 29559 29560 29561 29562 29563 29564 29565 29566 29567 29568 29569 29570 29571 29572 29573 29574 29575 29576 29577 29578 29579 29580 29581 29582 29583 29584 29585 29586 29587 29588 29589 29590 29591 29592 29593 29594 29595 29596 29597 29598 29599 29600 29601 29602 29603 29604 29605 29606 29607 29608 29609 29610 29611 29612 29613 29614 29615 29616 29617 29618 29619 29620 29621 29622 29623 29624 29625 29626 29627 29628 29629 29630 29631 29632 29633 29634 29635 29636 29637 29638 29639 29640 29641 29642 29643 29644 29645 29646 29647 29648 29649 29650 29651 29652 29653 29654 29655 29656 29657 29658 29659 29660 29661 29662 29663 29664 29665 29666 29667 29668 29669 29670 29671 29672 29673 29674 29675 29676 29677 29678 29679 29680 29681 29682 29683 29684 29685 29686 29687 29688 29689 29690 29691 29692 29693 29694 29695 29696 29697 29698 29699 29700 29701 29702 29703 29704 29705 29706 29707 29708 29709 29710 29711 29712 29713 29714 29715 29716 29717 29718 29719 29720 29721 29722 29723 29724 29725 29726 29727 29728 29729 29730 29731 29732 29733 29734 29735 29736 29737 29738 29739 29740 29741 29742 29743 29744 29745 29746 29747 29748 29749 29750 29751 29752 29753 29754 29755 29756 29757 29758 29759 29760 29761 29762 29763 29764 29765 29766 29767 29768 29769 29770 29771 29772 29773 29774 29775 29776 29777 29778 29779 29780 29781 29782 29783 29784 29785 29786 29787 29788 29789 29790 29791 29792 29793 29794 29795 29796 29797 29798 29799 29800 29801 29802 29803 29804 29805 29806 29807 29808 29809 29810 29811 29812 29813 29814 29815 29816 29817 29818 29819 29820 29821 29822 29823 29824 29825 29826 29827 29828 29829 29830 29831 29832 29833 29834 29835 29836 29837 29838 29839 29840 29841 29842 29843 29844 29845 29846 29847 29848 29849 29850 29851 29852 29853 29854 29855 29856 29857 29858 29859 29860 29861 29862 29863 29864 29865 29866 29867 29868 29869 29870 29871 29872 29873 29874 29875 29876 29877 29878 29879 29880 29881 29882 29883 29884 29885 29886 29887 29888 29889 29890 29891 29892 29893 29894 29895 29896 29897 29898 29899 29900 29901 29902 29903 29904 29905 29906 29907 29908 29909 29910 29911 29912 29913 29914 29915 29916 29917 29918 29919 29920 29921 29922 29923 29924 29925 29926 29927 29928 29929 29930 29931 29932 29933 29934 29935 29936 29937 29938 29939 29940 29941 29942 29943 29944 29945 29946 29947 29948 29949 29950 29951 29952 29953 29954 29955 29956 29957 29958 29959 29960 29961 29962 29963 29964 29965 29966 29967 29968 29969 29970 29971 29972 29973 29974 29975 29976 29977 29978 29979 29980 29981 29982 29983 29984 29985 29986 29987 29988 29989 29990 29991 29992 29993 29994 29995 29996 29997 29998 29999 30000 30001 30002 30003 30004 30005 30006 30007 30008 30009 30010 30011 30012 30013 30014 30015 30016 30017 30018 30019 30020 30021 30022 30023 30024 30025 30026 30027 30028 30029 30030 30031 30032 30033 30034 30035 30036 30037 30038 30039 30040 30041 30042 30043 30044 30045 30046 30047 30048 30049 30050 30051 30052 30053 30054 30055 30056 30057 30058 30059 30060 30061 30062 30063 30064 30065 30066 30067 30068 30069 30070 30071 30072 30073 30074 30075 30076 30077 30078 30079 30080 30081 30082 30083 30084 30085 30086 30087 30088 30089 30090 30091 30092 30093 30094 30095 30096 30097 30098 30099 30100 30101 30102 30103 30104 30105 30106 30107 30108 30109 30110 30111 30112 30113 30114 30115 30116 30117 30118 30119 30120 30121 30122 30123 30124 30125 30126 30127 30128 30129 30130 30131 30132 30133 30134 30135 30136 30137 30138 30139 30140 30141 30142 30143 30144 30145 30146 30147 30148 30149 30150 30151 30152 30153 30154 30155 30156 30157 30158 30159 30160 30161 30162 30163 30164 30165 30166 30167 30168 30169 30170 30171 30172 30173 30174 30175 30176 30177 30178 30179 30180 30181 30182 30183 30184 30185 30186 30187 30188 30189 30190 30191 30192 30193 30194 30195 30196 30197 30198 30199 30200 30201 30202 30203 30204 30205 30206 30207 30208 30209 30210 30211 30212 30213 30214 30215 30216 30217 30218 30219 30220 30221 30222 30223 30224 30225 30226 30227 30228 30229 30230 30231 30232 30233 30234 30235 30236 30237 30238 30239 30240 30241 30242 30243 30244 30245 30246 30247 30248 30249 30250 30251 30252 30253 30254 30255 30256 30257 30258 30259 30260 30261 30262 30263 30264 30265 30266 30267 30268 30269 30270 30271 30272 30273 30274 30275 30276 30277 30278 30279 30280 30281 30282 30283 30284 30285 30286 30287 30288 30289 30290 30291 30292 30293 30294 30295 30296 30297 30298 30299 30300 30301 30302 30303 30304 30305 30306 30307 30308 30309 30310 30311 30312 30313 30314 30315 30316 30317 30318 30319 30320 30321 30322 30323 30324 30325 30326 30327 30328 30329 30330 30331 30332 30333 30334 30335 30336 30337 30338 30339 30340 30341 30342 30343 30344 30345 30346 30347 30348 30349 30350 30351 30352 30353 30354 30355 30356 30357 30358 30359 30360 30361 30362 30363 30364 30365 30366 30367 30368 30369 30370 30371 30372 30373 30374 30375 30376 30377 30378 30379 30380 30381 30382 30383 30384 30385 30386 30387 30388 30389 30390 30391 30392 30393 30394 30395 30396 30397 30398 30399 30400 30401 30402 30403 30404 30405 30406 30407 30408 30409 30410 30411 30412 30413 30414 30415 30416 30417 30418 30419 30420 30421 30422 30423 30424 30425 30426 30427 30428 30429 30430 30431 30432 30433 30434 30435 30436 30437 30438 30439 30440 30441 30442 30443 30444 30445 30446 30447 30448 30449 30450 30451 30452 30453 30454 30455 30456 30457 30458 30459 30460 30461 30462 30463 30464 30465 30466 30467 30468 30469 30470 30471 30472 30473 30474 30475 30476 30477 30478 30479 30480 30481 30482 30483 30484 30485 30486 30487 30488 30489 30490 30491 30492 30493 30494 30495 30496 30497 30498 30499 30500 30501 30502 30503 30504 30505 30506 30507 30508 30509 30510 30511 30512 30513 30514 30515 30516 30517 30518 30519 30520 30521 30522 30523 30524 30525 30526 30527 30528 30529 30530 30531 30532 30533 30534 30535 30536 30537 30538 30539 30540 30541 30542 30543 30544 30545 30546 30547 30548 30549 30550 30551 30552 30553 30554 30555 30556 30557 30558 30559 30560 30561 30562 30563 30564 30565 30566 30567 30568 30569 30570 30571 30572 30573 30574 30575 30576 30577 30578 30579 30580 30581 30582 30583 30584 30585 30586 30587 30588 30589 30590 30591 30592 30593 30594 30595 30596 30597 30598 30599 30600 30601 30602 30603 30604 30605 30606 30607 30608 30609 30610 30611 30612 30613 30614 30615 30616 30617 30618 30619 30620 30621 30622 30623 30624 30625 30626 30627 30628 30629 30630 30631 30632 30633 30634 30635 30636 30637 30638 30639 30640 30641 30642 30643 30644 30645 30646 30647 30648 30649 30650 30651 30652 30653 30654 30655 30656 30657 30658 30659 30660 30661 30662 30663 30664 30665 30666 30667 30668 30669 30670 30671 30672 30673 30674 30675 30676 30677 30678 30679 30680 30681 30682 30683 30684 30685 30686 30687 30688 30689 30690 30691 30692 30693 30694 30695 30696 30697 30698 30699 30700 30701 30702 30703 30704 30705 30706 30707 30708 30709 30710 30711 30712 30713 30714 30715 30716 30717 30718 30719 30720 30721 30722 30723 30724 30725 30726 30727 30728 30729 30730 30731 30732 30733 30734 30735 30736 30737 30738 30739 30740 30741 30742 30743 30744 30745 30746 30747 30748 30749 30750 30751 30752 30753 30754 30755 30756 30757 30758 30759 30760 30761 30762 30763 30764 30765 30766 30767 30768 30769 30770 30771 30772 30773 30774 30775 30776 30777 30778 30779 30780 30781 30782 30783 30784 30785 30786 30787 30788 30789 30790 30791 30792 30793 30794 30795 30796 30797 30798 30799 30800 30801 30802 30803 30804 30805 30806 30807 30808 30809 30810 30811 30812 30813 30814 30815 30816 30817 30818 30819 30820 30821 30822 30823 30824 30825 30826 30827 30828 30829 30830 30831 30832 30833 30834 30835 30836 30837 30838 30839 30840 30841 30842 30843 30844 30845 30846 30847 30848 30849 30850 30851 30852 30853 30854 30855 30856 30857 30858 30859 30860 30861 30862 30863 30864 30865 30866 30867 30868 30869 30870 30871 30872 30873 30874 30875 30876 30877 30878 30879 30880 30881 30882 30883 30884 30885 30886 30887 30888 30889 30890 30891 30892 30893 30894 30895 30896 30897 30898 30899 30900 30901 30902 30903 30904 30905 30906 30907 30908 30909 30910 30911 30912 30913 30914 30915 30916 30917 30918 30919 30920 30921 30922 30923 30924 30925 30926 30927 30928 30929 30930 30931 30932 30933 30934 30935 30936 30937 30938 30939 30940 30941 30942 30943 30944 30945 30946 30947 30948 30949 30950 30951 30952 30953 30954 30955 30956 30957 30958 30959 30960 30961 30962 30963 30964 30965 30966 30967 30968 30969 30970 30971 30972 30973 30974 30975 30976 30977 30978 30979 30980 30981 30982 30983 30984 30985 30986 30987 30988 30989 30990 30991 30992 30993 30994 30995 30996 30997 30998 30999 31000 31001 31002 31003 31004 31005 31006 31007 31008 31009 31010 31011 31012 31013 31014 31015 31016 31017 31018 31019 31020 31021 31022 31023 31024 31025 31026 31027 31028 31029 31030 31031 31032 31033 31034 31035 31036 31037 31038 31039 31040 31041 31042 31043 31044 31045 31046 31047 31048 31049 31050 31051 31052 31053 31054 31055 31056 31057 31058 31059 31060 31061 31062 31063 31064 31065 31066 31067 31068 31069 31070 31071 31072 31073 31074 31075 31076 31077 31078 31079 31080 31081 31082 31083 31084 31085 31086 31087 31088 31089 31090 31091 31092 31093 31094 31095 31096 31097 31098 31099 31100 31101 31102 31103 31104 31105 31106 31107 31108 31109 31110 31111 31112 31113 31114 31115 31116 31117 31118 31119 31120 31121 31122 31123 31124 31125 31126 31127 31128 31129 31130 31131 31132 31133 31134 31135 31136 31137 31138 31139 31140 31141 31142 31143 31144 31145 31146 31147 31148 31149 31150 31151 31152 31153 31154 31155 31156 31157 31158 31159 31160 31161 31162 31163 31164 31165 31166 31167 31168 31169 31170 31171 31172 31173 31174 31175 31176 31177 31178 31179 31180 31181 31182 31183 31184 31185 31186 31187 31188 31189 31190 31191 31192 31193 31194 31195 31196 31197 31198 31199 31200 31201 31202 31203 31204 31205 31206 31207 31208 31209 31210 31211 31212 31213 31214 31215 31216 31217 31218 31219 31220 31221 31222 31223 31224 31225 31226 31227 31228 31229 31230 31231 31232 31233 31234 31235 31236 31237 31238 31239 31240 31241 31242 31243 31244 31245 31246 31247 31248 31249 31250 31251 31252 31253 31254 31255 31256 31257 31258 31259 31260 31261 31262 31263 31264 31265 31266 31267 31268 31269 31270 31271 31272 31273 31274 31275 31276 31277 31278 31279 31280 31281 31282 31283 31284 31285 31286 31287 31288 31289 31290 31291 31292 31293 31294 31295 31296 31297 31298 31299 31300 31301 31302 31303 31304 31305 31306 31307 31308 31309 31310 31311 31312 31313 31314 31315 31316 31317 31318 31319 31320 31321 31322 31323 31324 31325 31326 31327 31328 31329 31330 31331 31332 31333 31334 31335 31336 31337 31338 31339 31340 31341 31342 31343 31344 31345 31346 31347 31348 31349 31350 31351 31352 31353 31354 31355 31356 31357 31358 31359 31360 31361 31362 31363 31364 31365 31366 31367 31368 31369 31370 31371 31372 31373 31374 31375 31376 31377 31378 31379 31380 31381 31382 31383 31384 31385 31386 31387 31388 31389 31390 31391 31392 31393 31394 31395 31396 31397 31398 31399 31400 31401 31402 31403 31404 31405 31406 31407 31408 31409 31410 31411 31412 31413 31414 31415 31416 31417 31418 31419 31420 31421 31422 31423 31424 31425 31426 31427 31428 31429 31430 31431 31432 31433 31434 31435 31436 31437 31438 31439 31440 31441 31442 31443 31444 31445 31446 31447 31448 31449 31450 31451 31452 31453 31454 31455 31456 31457 31458 31459 31460 31461 31462 31463 31464 31465 31466 31467 31468 31469 31470 31471 31472 31473 31474 31475 31476 31477 31478 31479 31480 31481 31482 31483 31484 31485 31486 31487 31488 31489 31490 31491 31492 31493 31494 31495 31496 31497 31498 31499 31500 31501 31502 31503 31504 31505 31506 31507 31508 31509 31510 31511 31512 31513 31514 31515 31516 31517 31518 31519 31520 31521 31522 31523 31524 31525 31526 31527 31528 31529 31530 31531 31532 31533 31534 31535 31536 31537 31538 31539 31540 31541 31542 31543 31544 31545 31546 31547 31548 31549 31550 31551 31552 31553 31554 31555 31556 31557 31558 31559 31560 31561 31562 31563 31564 31565 31566 31567 31568 31569 31570 31571 31572 31573 31574 31575 31576 31577 31578 31579 31580 31581 31582 31583 31584 31585 31586 31587 31588 31589 31590 31591 31592 31593 31594 31595 31596 31597 31598 31599 31600 31601 31602 31603 31604 31605 31606 31607 31608 31609 31610 31611 31612 31613 31614 31615 31616 31617 31618 31619 31620 31621 31622 31623 31624 31625 31626 31627 31628 31629 31630 31631 31632 31633 31634 31635 31636 31637 31638 31639 31640 31641 31642 31643 31644 31645 31646 31647 31648 31649 31650 31651 31652 31653 31654 31655 31656 31657 31658 31659 31660 31661 31662 31663 31664 31665 31666 31667 31668 31669 31670 31671 31672 31673 31674 31675 31676 31677 31678 31679 31680 31681 31682 31683 31684 31685 31686 31687 31688 31689 31690 31691 31692 31693 31694 31695 31696 31697 31698 31699 31700 31701 31702 31703 31704 31705 31706 31707 31708 31709 31710 31711 31712 31713 31714 31715 31716 31717 31718 31719 31720 31721 31722 31723 31724 31725 31726 31727 31728 31729 31730 31731 31732 31733 31734 31735 31736 31737 31738 31739 31740 31741 31742 31743 31744 31745 31746 31747 31748 31749 31750 31751 31752 31753 31754 31755 31756 31757 31758 31759 31760 31761 31762 31763 31764 31765 31766 31767 31768 31769 31770 31771 31772 31773 31774 31775 31776 31777 31778 31779 31780 31781 31782 31783 31784 31785 31786 31787 31788 31789 31790 31791 31792 31793 31794 31795 31796 31797 31798 31799 31800 31801 31802 31803 31804 31805 31806 31807 31808 31809 31810 31811 31812 31813 31814 31815 31816 31817 31818 31819 31820 31821 31822 31823 31824 31825 31826 31827 31828 31829 31830 31831 31832 31833 31834 31835 31836 31837 31838 31839 31840 31841 31842 31843 31844 31845 31846 31847 31848 31849 31850 31851 31852 31853 31854 31855 31856 31857 31858 31859 31860 31861 31862 31863 31864 31865 31866 31867 31868 31869 31870 31871 31872 31873 31874 31875 31876 31877 31878 31879 31880 31881 31882 31883 31884 31885 31886 31887 31888 31889 31890 31891 31892 31893 31894 31895 31896 31897 31898 31899 31900 31901 31902 31903 31904 31905 31906 31907 31908 31909 31910 31911 31912 31913 31914 31915 31916 31917 31918 31919 31920 31921 31922 31923 31924 31925 31926 31927 31928 31929 31930 31931 31932 31933 31934 31935 31936 31937 31938 31939 31940 31941 31942 31943 31944 31945 31946 31947 31948 31949 31950 31951 31952 31953 31954 31955 31956 31957 31958 31959 31960 31961 31962 31963 31964 31965 31966 31967 31968 31969 31970 31971 31972 31973 31974 31975 31976 31977 31978 31979 31980 31981 31982 31983 31984 31985 31986 31987 31988 31989 31990 31991 31992 31993 31994 31995 31996 31997 31998 31999 32000 32001 32002 32003 32004 32005 32006 32007 32008 32009 32010 32011 32012 32013 32014 32015 32016 32017 32018 32019 32020 32021 32022 32023 32024 32025 32026 32027 32028 32029 32030 32031 32032 32033 32034 32035 32036 32037 32038 32039 32040 32041 32042 32043 32044 32045 32046 32047 32048 32049 32050 32051 32052 32053 32054 32055 32056 32057 32058 32059 32060 32061 32062 32063 32064 32065 32066 32067 32068 32069 32070 32071 32072 32073 32074 32075 32076 32077 32078 32079 32080 32081 32082 32083 32084 32085 32086 32087 32088 32089 32090 32091 32092 32093 32094 32095 32096 32097 32098 32099 32100 32101 32102 32103 32104 32105 32106 32107 32108 32109 32110 32111 32112 32113 32114 32115 32116 32117 32118 32119 32120 32121 32122 32123 32124 32125 32126 32127 32128 32129 32130 32131 32132 32133 32134 32135 32136 32137 32138 32139 32140 32141 32142 32143 32144 32145 32146 32147 32148 32149 32150 32151 32152 32153 32154 32155 32156 32157 32158 32159 32160 32161 32162 32163 32164 32165 32166 32167 32168 32169 32170 32171 32172 32173 32174 32175 32176 32177 32178 32179 32180 32181 32182 32183 32184 32185 32186 32187 32188 32189 32190 32191 32192 32193 32194 32195 32196 32197 32198 32199 32200 32201 32202 32203 32204 32205 32206 32207 32208 32209 32210 32211 32212 32213 32214 32215 32216 32217 32218 32219 32220 32221 32222 32223 32224 32225 32226 32227 32228 32229 32230 32231 32232 32233 32234 32235 32236 32237 32238 32239 32240 32241 32242 32243 32244 32245 32246 32247 32248 32249 32250 32251 32252 32253 32254 32255 32256 32257 32258 32259 32260 32261 32262 32263 32264 32265 32266 32267 32268 32269 32270 32271 32272 32273 32274 32275 32276 32277 32278 32279 32280 32281 32282 32283 32284 32285 32286 32287 32288 32289 32290 32291 32292 32293 32294 32295 32296 32297 32298 32299 32300 32301 32302 32303 32304 32305 32306 32307 32308 32309 32310 32311 32312 32313 32314 32315 32316 32317 32318 32319 32320 32321 32322 32323 32324 32325 32326 32327 32328 32329 32330 32331 32332 32333 32334 32335 32336 32337 32338 32339 32340 32341 32342 32343 32344 32345 32346 32347 32348 32349 32350 32351 32352 32353 32354 32355 32356 32357 32358 32359 32360 32361 32362 32363 32364 32365 32366 32367 32368 32369 32370 32371 32372 32373 32374 32375 32376 32377 32378 32379 32380 32381 32382 32383 32384 32385 32386 32387 32388 32389 32390 32391 32392 32393 32394 32395 32396 32397 32398 32399 32400 32401 32402 32403 32404 32405 32406 32407 32408 32409 32410 32411 32412 32413 32414 32415 32416 32417 32418 32419 32420 32421 32422 32423 32424 32425 32426 32427 32428 32429 32430 32431 32432 32433 32434 32435 32436 32437 32438 32439 32440 32441 32442 32443 32444 32445 32446 32447 32448 32449 32450 32451 32452 32453 32454 32455 32456 32457 32458 32459 32460 32461 32462 32463 32464 32465 32466 32467 32468 32469 32470 32471 32472 32473 32474 32475 32476 32477 32478 32479 32480 32481 32482 32483 32484 32485 32486 32487 32488 32489 32490 32491 32492 32493 32494 32495 32496 32497 32498 32499 32500 32501 32502 32503 32504 32505 32506 32507 32508 32509 32510 32511 32512 32513 32514 32515 32516 32517 32518 32519 32520 32521 32522 32523 32524 32525 32526 32527 32528 32529 32530 32531 32532 32533 32534 32535 32536 32537 32538 32539 32540 32541 32542 32543 32544 32545 32546 32547 32548 32549 32550 32551 32552 32553 32554 32555 32556 32557 32558 32559 32560 32561 32562 32563 32564 32565 32566 32567 32568 32569 32570 32571 32572 32573 32574 32575 32576 32577 32578 32579 32580 32581 32582 32583 32584 32585 32586 32587 32588 32589 32590 32591 32592 32593 32594 32595 32596 32597 32598 32599 32600 32601 32602 32603 32604 32605 32606 32607 32608 32609 32610 32611 32612 32613 32614 32615 32616 32617 32618 32619 32620 32621 32622 32623 32624 32625 32626 32627 32628 32629 32630 32631 32632 32633 32634 32635 32636 32637 32638 32639 32640 32641 32642 32643 32644 32645 32646 32647 32648 32649 32650 32651 32652 32653 32654 32655 32656 32657 32658 32659 32660 32661 32662 32663 32664 32665 32666 32667 32668 32669 32670 32671 32672 32673 32674 32675 32676 32677 32678 32679 32680 32681 32682 32683 32684 32685 32686 32687 32688 32689 32690 32691 32692 32693 32694 32695 32696 32697 32698 32699 32700 32701 32702 32703 32704 32705 32706 32707 32708 32709 32710 32711 32712 32713 32714 32715 32716 32717 32718 32719 32720 32721 32722 32723 32724 32725 32726 32727 32728 32729 32730 32731 32732 32733 32734 32735 32736 32737 32738 32739 32740 32741 32742 32743 32744 32745 32746 32747 32748 32749 32750 32751 32752 32753 32754 32755 32756 32757 32758 32759 32760 32761 32762 32763 32764 32765 32766 32767 32768 32769 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779 32780 32781 32782 32783 32784 32785 32786 32787 32788 32789 32790 32791 32792 32793 32794 32795 32796 32797 32798 32799 32800 32801 32802 32803 32804 32805 32806 32807 32808 32809 32810 32811 32812 32813 32814 32815 32816 32817 32818 32819 32820 32821 32822 32823 32824 32825 32826 32827 32828 32829 32830 32831 32832 32833 32834 32835 32836 32837 32838 32839 32840 32841 32842 32843 32844 32845 32846 32847 32848 32849 32850 32851 32852 32853 32854 32855 32856 32857 32858 32859 32860 32861 32862 32863 32864 32865 32866 32867 32868 32869 32870 32871 32872 32873 32874 32875 32876 32877 32878 32879 32880 32881 32882 32883 32884 32885 32886 32887 32888 32889 32890 32891 32892 32893 32894 32895 32896 32897 32898 32899 32900 32901 32902 32903 32904 32905 32906 32907 32908 32909 32910 32911 32912 32913 32914 32915 32916 32917 32918 32919 32920 32921 32922 32923 32924 32925 32926 32927 32928 32929 32930 32931 32932 32933 32934 32935 32936 32937 32938 32939 32940 32941 32942 32943 32944 32945 32946 32947 32948 32949 32950 32951 32952 32953 32954 32955 32956 32957 32958 32959 32960 32961 32962 32963 32964 32965 32966 32967 32968 32969 32970 32971 32972 32973 32974 32975 32976 32977 32978 32979 32980 32981 32982 32983 32984 32985 32986 32987 32988 32989 32990 32991 32992 32993 32994 32995 32996 32997 32998 32999 33000 33001 33002 33003 33004 33005 33006 33007 33008 33009 33010 33011 33012 33013 33014 33015 33016 33017 33018 33019 33020 33021 33022 33023 33024 33025 33026 33027 33028 33029 33030 33031 33032 33033 33034 33035 33036 33037 33038 33039 33040 33041 33042 33043 33044 33045 33046 33047 33048 33049 33050 33051 33052 33053 33054 33055 33056 33057 33058 33059 33060 33061 33062 33063 33064 33065 33066 33067 33068 33069 33070 33071 33072 33073 33074 33075 33076 33077 33078 33079 33080 33081 33082 33083 33084 33085 33086 33087 33088 33089 33090 33091 33092 33093 33094 33095 33096 33097 33098 33099 33100 33101 33102 33103 33104 33105 33106 33107 33108 33109 33110 33111 33112 33113 33114 33115 33116 33117 33118 33119 33120 33121 33122 33123 33124 33125 33126 33127 33128 33129 33130 33131 33132 33133 33134 33135 33136 33137 33138 33139 33140 33141 33142 33143 33144 33145 33146 33147 33148 33149 33150 33151 33152 33153 33154 33155 33156 33157 33158 33159 33160 33161 33162 33163 33164 33165 33166 33167 33168 33169 33170 33171 33172 33173 33174 33175 33176 33177 33178 33179 33180 33181 33182 33183 33184 33185 33186 33187 33188 33189 33190 33191 33192 33193 33194 33195 33196 33197 33198 33199 33200 33201 33202 33203 33204 33205 33206 33207 33208 33209 33210 33211 33212 33213 33214 33215 33216 33217 33218 33219 33220 33221 33222 33223 33224 33225 33226 33227 33228 33229 33230 33231 33232 33233 33234 33235 33236 33237 33238 33239 33240 33241 33242 33243 33244 33245 33246 33247 33248 33249 33250 33251 33252 33253 33254 33255 33256 33257 33258 33259 33260 33261 33262 33263 33264 33265 33266 33267 33268 33269 33270 33271 33272 33273 33274 33275 33276 33277 33278 33279 33280 33281 33282 33283 33284 33285 33286 33287 33288 33289 33290 33291 33292 33293 33294 33295 33296 33297 33298 33299 33300 33301 33302 33303 33304 33305 33306 33307 33308 33309 33310 33311 33312 33313 33314 33315 33316 33317 33318 33319 33320 33321 33322 33323 33324 33325 33326 33327 33328 33329 33330 33331 33332 33333 33334 33335 33336 33337 33338 33339 33340 33341 33342 33343 33344 33345 33346 33347 33348 33349 33350 33351 33352 33353 33354 33355 33356 33357 33358 33359 33360 33361 33362 33363 33364 33365 33366 33367 33368 33369 33370 33371 33372 33373 33374 33375 33376 33377 33378 33379 33380 33381 33382 33383 33384 33385 33386 33387 33388 33389 33390 33391 33392 33393 33394 33395 33396 33397 33398 33399 33400 33401 33402 33403 33404 33405 33406 33407 33408 33409 33410 33411 33412 33413 33414 33415 33416 33417 33418 33419 33420 33421 33422 33423 33424 33425 33426 33427 33428 33429 33430 33431 33432 33433 33434 33435 33436 33437 33438 33439 33440 33441 33442 33443 33444 33445 33446 33447 33448 33449 33450 33451 33452 33453 33454 33455 33456 33457 33458 33459 33460 33461 33462 33463 33464 33465 33466 33467 33468 33469 33470 33471 33472 33473 33474 33475 33476 33477 33478 33479 33480 33481 33482 33483 33484 33485 33486 33487 33488 33489 33490 33491 33492 33493 33494 33495 33496 33497 33498 33499 33500 33501 33502 33503 33504 33505 33506 33507 33508 33509 33510 33511 33512 33513 33514 33515 33516 33517 33518 33519 33520 33521 33522 33523 33524 33525 33526 33527 33528 33529 33530 33531 33532 33533 33534 33535 33536 33537 33538 33539 33540 33541 33542 33543 33544 33545 33546 33547 33548 33549 33550 33551 33552 33553 33554 33555 33556 33557 33558 33559 33560 33561 33562 33563 33564 33565 33566 33567 33568 33569 33570 33571 33572 33573 33574 33575 33576 33577 33578 33579 33580 33581 33582 33583 33584 33585 33586 33587 33588 33589 33590 33591 33592 33593 33594 33595 33596 33597 33598 33599 33600 33601 33602 33603 33604 33605 33606 33607 33608 33609 33610 33611 33612 33613 33614 33615 33616 33617 33618 33619 33620 33621 33622 33623 33624 33625 33626 33627 33628 33629 33630 33631 33632 33633 33634 33635 33636 33637 33638 33639 33640 33641 33642 33643 33644 33645 33646 33647 33648 33649 33650 33651 33652 33653 33654 33655 33656 33657 33658 33659 33660 33661 33662 33663 33664 33665 33666 33667 33668 33669 33670 33671 33672 33673 33674 33675 33676 33677 33678 33679 33680 33681 33682 33683 33684 33685 33686 33687 33688 33689 33690 33691 33692 33693 33694 33695 33696 33697 33698 33699 33700 33701 33702 33703 33704 33705 33706 33707 33708 33709 33710 33711 33712 33713 33714 33715 33716 33717 33718 33719 33720 33721 33722 33723 33724 33725 33726 33727 33728 33729 33730 33731 33732 33733 33734 33735 33736 33737 33738 33739 33740 33741 33742 33743 33744 33745 33746 33747 33748 33749 33750 33751 33752 33753 33754 33755 33756 33757 33758 33759 33760 33761 33762 33763 33764 33765 33766 33767 33768 33769 33770 33771 33772 33773 33774 33775 33776 33777 33778 33779 33780 33781 33782 33783 33784 33785 33786 33787 33788 33789 33790 33791 33792 33793 33794 33795 33796 33797 33798 33799 33800 33801 33802 33803 33804 33805 33806 33807 33808 33809 33810 33811 33812 33813 33814 33815 33816 33817 33818 33819 33820 33821 33822 33823 33824 33825 33826 33827 33828 33829 33830 33831 33832 33833 33834 33835 33836 33837 33838 33839 33840 33841 33842 33843 33844 33845 33846 33847 33848 33849 33850 33851 33852 33853 33854 33855 33856 33857 33858 33859 33860 33861 33862 33863 33864 33865 33866 33867 33868 33869 33870 33871 33872 33873 33874 33875 33876 33877 33878 33879 33880 33881 33882 33883 33884 33885 33886 33887 33888 33889 33890 33891 33892 33893 33894 33895 33896 33897 33898 33899 33900 33901 33902 33903 33904 33905 33906 33907 33908 33909 33910 33911 33912 33913 33914 33915 33916 33917 33918 33919 33920 33921 33922 33923 33924 33925 33926 33927 33928 33929 33930 33931 33932 33933 33934 33935 33936 33937 33938 33939 33940 33941 33942 33943 33944 33945 33946 33947 33948 33949 33950 33951 33952 33953 33954 33955 33956 33957 33958 33959 33960 33961 33962 33963 33964 33965 33966 33967 33968 33969 33970 33971 33972 33973 33974 33975 33976 33977 33978 33979 33980 33981 33982 33983 33984 33985 33986 33987 33988 33989 33990 33991 33992 33993 33994 33995 33996 33997 33998 33999 34000 34001 34002 34003 34004 34005 34006 34007 34008 34009 34010 34011 34012 34013 34014 34015 34016 34017 34018 34019 34020 34021 34022 34023 34024 34025 34026 34027 34028 34029 34030 34031 34032 34033 34034 34035 34036 34037 34038 34039 34040 34041 34042 34043 34044 34045 34046 34047 34048 34049 34050 34051 34052 34053 34054 34055 34056 34057 34058 34059 34060 34061 34062 34063 34064 34065 34066 34067 34068 34069 34070 34071 34072 34073 34074 34075 34076 34077 34078 34079 34080 34081 34082 34083 34084 34085 34086 34087 34088 34089 34090 34091 34092 34093 34094 34095 34096 34097 34098 34099 34100 34101 34102 34103 34104 34105 34106 34107 34108 34109 34110 34111 34112 34113 34114 34115 34116 34117 34118 34119 34120 34121 34122 34123 34124 34125 34126 34127 34128 34129 34130 34131 34132 34133 34134 34135 34136 34137 34138 34139 34140 34141 34142 34143 34144 34145 34146 34147 34148 34149 34150 34151 34152 34153 34154 34155 34156 34157 34158 34159 34160 34161 34162 34163 34164 34165 34166 34167 34168 34169 34170 34171 34172 34173 34174 34175 34176 34177 34178 34179 34180 34181 34182 34183 34184 34185 34186 34187 34188 34189 34190 34191 34192 34193 34194 34195 34196 34197 34198 34199 34200 34201 34202 34203 34204 34205 34206 34207 34208 34209 34210 34211 34212 34213 34214 34215 34216 34217 34218 34219 34220 34221 34222 34223 34224 34225 34226 34227 34228 34229 34230 34231 34232 34233 34234 34235 34236 34237 34238 34239 34240 34241 34242 34243 34244 34245 34246 34247 34248 34249 34250 34251 34252 34253 34254 34255 34256 34257 34258 34259 34260 34261 34262 34263 34264 34265 34266 34267 34268 34269 34270 34271 34272 34273 34274 34275 34276 34277 34278 34279 34280 34281 34282 34283 34284 34285 34286 34287 34288 34289 34290 34291 34292 34293 34294 34295 34296 34297 34298 34299 34300 34301 34302 34303 34304 34305 34306 34307 34308 34309 34310 34311 34312 34313 34314 34315 34316 34317 34318 34319 34320 34321 34322 34323 34324 34325 34326 34327 34328 34329 34330 34331 34332 34333 34334 34335 34336 34337 34338 34339 34340 34341 34342 34343 34344 34345 34346 34347 34348 34349 34350 34351 34352 34353 34354 34355 34356 34357 34358 34359 34360 34361 34362 34363 34364 34365 34366 34367 34368 34369 34370 34371 34372 34373 34374 34375 34376 34377 34378 34379 34380 34381 34382 34383 34384 34385 34386 34387 34388 34389 34390 34391 34392 34393 34394 34395 34396 34397 34398 34399 34400 34401 34402 34403 34404 34405 34406 34407 34408 34409 34410 34411 34412 34413 34414 34415 34416 34417 34418 34419 34420 34421 34422 34423 34424 34425 34426 34427 34428 34429 34430 34431 34432 34433 34434 34435 34436 34437 34438 34439 34440 34441 34442 34443 34444 34445 34446 34447 34448 34449 34450 34451 34452 34453 34454 34455 34456 34457 34458 34459 34460 34461 34462 34463 34464 34465 34466 34467 34468 34469 34470 34471 34472 34473 34474 34475 34476 34477 34478 34479 34480 34481 34482 34483 34484 34485 34486 34487 34488 34489 34490 34491 34492 34493 34494 34495 34496 34497 34498 34499 34500 34501 34502 34503 34504 34505 34506 34507 34508 34509 34510 34511 34512 34513 34514 34515 34516 34517 34518 34519 34520 34521 34522 34523 34524 34525 34526 34527 34528 34529 34530 34531 34532 34533 34534 34535 34536 34537 34538 34539 34540 34541 34542 34543 34544 34545 34546 34547 34548 34549 34550 34551 34552 34553 34554 34555 34556 34557 34558 34559 34560 34561 34562 34563 34564 34565 34566 34567 34568 34569 34570 34571 34572 34573 34574 34575 34576 34577 34578 34579 34580 34581 34582 34583 34584 34585 34586 34587 34588 34589 34590 34591 34592 34593 34594 34595 34596 34597 34598 34599 34600 34601 34602 34603 34604 34605 34606 34607 34608 34609 34610 34611 34612 34613 34614 34615 34616 34617 34618 34619 34620 34621 34622 34623 34624 34625 34626 34627 34628 34629 34630 34631 34632 34633 34634 34635 34636 34637 34638 34639 34640 34641 34642 34643 34644 34645 34646 34647 34648 34649 34650 34651 34652 34653 34654 34655 34656 34657 34658 34659 34660 34661 34662 34663 34664 34665 34666 34667 34668 34669 34670 34671 34672 34673 34674 34675 34676 34677 34678 34679 34680 34681 34682 34683 34684 34685 34686 34687 34688 34689 34690 34691 34692 34693 34694 34695 34696 34697 34698 34699 34700 34701 34702 34703 34704 34705 34706 34707 34708 34709 34710 34711 34712 34713 34714 34715 34716 34717 34718 34719 34720 34721 34722 34723 34724 34725 34726 34727 34728 34729 34730 34731 34732 34733 34734 34735 34736 34737 34738 34739 34740 34741 34742 34743 34744 34745 34746 34747 34748 34749 34750 34751 34752 34753 34754 34755 34756 34757 34758 34759 34760 34761 34762 34763 34764 34765 34766 34767 34768 34769 34770 34771 34772 34773 34774 34775 34776 34777 34778 34779 34780 34781 34782 34783 34784 34785 34786 34787 34788 34789 34790 34791 34792 34793 34794 34795 34796 34797 34798 34799 34800 34801 34802 34803 34804 34805 34806 34807 34808 34809 34810 34811 34812 34813 34814 34815 34816 34817 34818 34819 34820 34821 34822 34823 34824 34825 34826 34827 34828 34829 34830 34831 34832 34833 34834 34835 34836 34837 34838 34839 34840 34841 34842 34843 34844 34845 34846 34847 34848 34849 34850 34851 34852 34853 34854 34855 34856 34857 34858 34859 34860 34861 34862 34863 34864 34865 34866 34867 34868 34869 34870 34871 34872 34873 34874 34875 34876 34877 34878 34879 34880 34881 34882 34883 34884 34885 34886 34887 34888 34889 34890 34891 34892 34893 34894 34895 34896 34897 34898 34899 34900 34901 34902 34903 34904 34905 34906 34907 34908 34909 34910 34911 34912 34913 34914 34915 34916 34917 34918 34919 34920 34921 34922 34923 34924 34925 34926 34927 34928 34929 34930 34931 34932 34933 34934 34935 34936 34937 34938 34939 34940 34941 34942 34943 34944 34945 34946 34947 34948 34949 34950 34951 34952 34953 34954 34955 34956 34957 34958 34959 34960 34961 34962 34963 34964 34965 34966 34967 34968 34969 34970 34971 34972 34973 34974 34975 34976 34977 34978 34979 34980 34981 34982 34983 34984 34985 34986 34987 34988 34989 34990 34991 34992 34993 34994 34995 34996 34997 34998 34999 35000 35001 35002 35003 35004 35005 35006 35007 35008 35009 35010 35011 35012 35013 35014 35015 35016 35017 35018 35019 35020 35021 35022 35023 35024 35025 35026 35027 35028 35029 35030 35031 35032 35033 35034 35035 35036 35037 35038 35039 35040 35041 35042 35043 35044 35045 35046 35047 35048 35049 35050 35051 35052 35053 35054 35055 35056 35057 35058 35059 35060 35061 35062 35063 35064 35065 35066 35067 35068 35069 35070 35071 35072 35073 35074 35075 35076 35077 35078 35079 35080 35081 35082 35083 35084 35085 35086 35087 35088 35089 35090 35091 35092 35093 35094 35095 35096 35097 35098 35099 35100 35101 35102 35103 35104 35105 35106 35107 35108 35109 35110 35111 35112 35113 35114 35115 35116 35117 35118 35119 35120 35121 35122 35123 35124 35125 35126 35127 35128 35129 35130 35131 35132 35133 35134 35135 35136 35137 35138 35139 35140 35141 35142 35143 35144 35145 35146 35147 35148 35149 35150 35151 35152 35153 35154 35155 35156 35157 35158 35159 35160 35161 35162 35163 35164 35165 35166 35167 35168 35169 35170 35171 35172 35173 35174 35175 35176 35177 35178 35179 35180 35181 35182 35183 35184 35185 35186 35187 35188 35189 35190 35191 35192 35193 35194 35195 35196 35197 35198 35199 35200 35201 35202 35203 35204 35205 35206 35207 35208 35209 35210 35211 35212 35213 35214 35215 35216 35217 35218 35219 35220 35221 35222 35223 35224 35225 35226 35227 35228 35229 35230 35231 35232 35233 35234 35235 35236 35237 35238 35239 35240 35241 35242 35243 35244 35245 35246 35247 35248 35249 35250 35251 35252 35253 35254 35255 35256 35257 35258 35259 35260 35261 35262 35263 35264 35265 35266 35267 35268 35269 35270 35271 35272 35273 35274 35275 35276 35277 35278 35279 35280 35281 35282 35283 35284 35285 35286 35287 35288 35289 35290 35291 35292 35293 35294 35295 35296 35297 35298 35299 35300 35301 35302 35303 35304 35305 35306 35307 35308 35309 35310 35311 35312 35313 35314 35315 35316 35317 35318 35319 35320 35321 35322 35323 35324 35325 35326 35327 35328 35329 35330 35331 35332 35333 35334 35335 35336 35337 35338 35339 35340 35341 35342 35343 35344 35345 35346 35347 35348 35349 35350 35351 35352 35353 35354 35355 35356 35357 35358 35359 35360 35361 35362 35363 35364 35365 35366 35367 35368 35369 35370 35371 35372 35373 35374 35375 35376 35377 35378 35379 35380 35381 35382 35383 35384 35385 35386 35387 35388 35389 35390 35391 35392 35393 35394 35395 35396 35397 35398 35399 35400 35401 35402 35403 35404 35405 35406 35407 35408 35409 35410 35411 35412 35413 35414 35415 35416 35417 35418 35419 35420 35421 35422 35423 35424 35425 35426 35427 35428 35429 35430 35431 35432 35433 35434 35435 35436 35437 35438 35439 35440 35441 35442 35443 35444 35445 35446 35447 35448 35449 35450 35451 35452 35453 35454 35455 35456 35457 35458 35459 35460 35461 35462 35463 35464 35465 35466 35467 35468 35469 35470 35471 35472 35473 35474 35475 35476 35477 35478 35479 35480 35481 35482 35483 35484 35485 35486 35487 35488 35489 35490 35491 35492 35493 35494 35495 35496 35497 35498 35499 35500 35501 35502 35503 35504 35505 35506 35507 35508 35509 35510 35511 35512 35513 35514 35515 35516 35517 35518 35519 35520 35521 35522 35523 35524 35525 35526 35527 35528 35529 35530 35531 35532 35533 35534 35535 35536 35537 35538 35539 35540 35541 35542 35543 35544 35545 35546 35547 35548 35549 35550 35551 35552 35553 35554 35555 35556 35557 35558 35559 35560 35561 35562 35563 35564 35565 35566 35567 35568 35569 35570 35571 35572 35573 35574 35575 35576 35577 35578 35579 35580 35581 35582 35583 35584 35585 35586 35587 35588 35589 35590 35591 35592 35593 35594 35595 35596 35597 35598 35599 35600 35601 35602 35603 35604 35605 35606 35607 35608 35609 35610 35611 35612 35613 35614 35615 35616 35617 35618 35619 35620 35621 35622 35623 35624 35625 35626 35627 35628 35629 35630 35631 35632 35633 35634 35635 35636 35637 35638 35639 35640 35641 35642 35643 35644 35645 35646 35647 35648 35649 35650 35651 35652 35653 35654 35655 35656 35657 35658 35659 35660 35661 35662 35663 35664 35665 35666 35667 35668 35669 35670 35671 35672 35673 35674 35675 35676 35677 35678 35679 35680 35681 35682 35683 35684 35685 35686 35687 35688 35689 35690 35691 35692 35693 35694 35695 35696 35697 35698 35699 35700 35701 35702 35703 35704 35705 35706 35707 35708 35709 35710 35711 35712 35713 35714 35715 35716 35717 35718 35719 35720 35721 35722 35723 35724 35725 35726 35727 35728 35729 35730 35731 35732 35733 35734 35735 35736 35737 35738 35739 35740 35741 35742 35743 35744 35745 35746 35747 35748 35749 35750 35751 35752 35753 35754 35755 35756 35757 35758 35759 35760 35761 35762 35763 35764 35765 35766 35767 35768 35769 35770 35771 35772 35773 35774 35775 35776 35777 35778 35779 35780 35781 35782 35783 35784 35785 35786 35787 35788 35789 35790 35791 35792 35793 35794 35795 35796 35797 35798 35799 35800 35801 35802 35803 35804 35805 35806 35807 35808 35809 35810 35811 35812 35813 35814 35815 35816 35817 35818 35819 35820 35821 35822 35823 35824 35825 35826 35827 35828 35829 35830 35831 35832 35833 35834 35835 35836 35837 35838 35839 35840 35841 35842 35843 35844 35845 35846 35847 35848 35849 35850 35851 35852 35853 35854 35855 35856 35857 35858 35859 35860 35861 35862 35863 35864 35865 35866 35867 35868 35869 35870 35871 35872 35873 35874 35875 35876 35877 35878 35879 35880 35881 35882 35883 35884 35885 35886 35887 35888 35889 35890 35891 35892 35893 35894 35895 35896 35897 35898 35899 35900 35901 35902 35903 35904 35905 35906 35907 35908 35909 35910 35911 35912 35913 35914 35915 35916 35917 35918 35919 35920 35921 35922 35923 35924 35925 35926 35927 35928 35929 35930 35931 35932 35933 35934 35935 35936 35937 35938 35939 35940 35941 35942 35943 35944 35945 35946 35947 35948 35949 35950 35951 35952 35953 35954 35955 35956 35957 35958 35959 35960 35961 35962 35963 35964 35965 35966 35967 35968 35969 35970 35971 35972 35973 35974 35975 35976 35977 35978 35979 35980 35981 35982 35983 35984 35985 35986 35987 35988 35989 35990 35991 35992 35993 35994 35995 35996 35997 35998 35999 36000 36001 36002 36003 36004 36005 36006 36007 36008 36009 36010 36011 36012 36013 36014 36015 36016 36017 36018 36019 36020 36021 36022 36023 36024 36025 36026 36027 36028 36029 36030 36031 36032 36033 36034 36035 36036 36037 36038 36039 36040 36041 36042 36043 36044 36045 36046 36047 36048 36049 36050 36051 36052 36053 36054 36055 36056 36057 36058 36059 36060 36061 36062 36063 36064 36065 36066 36067 36068 36069 36070 36071 36072 36073 36074 36075 36076 36077 36078 36079 36080 36081 36082 36083 36084 36085 36086 36087 36088 36089 36090 36091 36092 36093 36094 36095 36096 36097 36098 36099 36100 36101 36102 36103 36104 36105 36106 36107 36108 36109 36110 36111 36112 36113 36114 36115 36116 36117 36118 36119 36120 36121 36122 36123 36124 36125 36126 36127 36128 36129 36130 36131 36132 36133 36134 36135 36136 36137 36138 36139 36140 36141 36142 36143 36144 36145 36146 36147 36148 36149 36150 36151 36152 36153 36154 36155 36156 36157 36158 36159 36160 36161 36162 36163 36164 36165 36166 36167 36168 36169 36170 36171 36172 36173 36174 36175 36176 36177 36178 36179 36180 36181 36182 36183 36184 36185 36186 36187 36188 36189 36190 36191 36192 36193 36194 36195 36196 36197 36198 36199 36200 36201 36202 36203 36204 36205 36206 36207 36208 36209 36210 36211 36212 36213 36214 36215 36216 36217 36218 36219 36220 36221 36222 36223 36224 36225 36226 36227 36228 36229 36230 36231 36232 36233 36234 36235 36236 36237 36238 36239 36240 36241 36242 36243 36244 36245 36246 36247 36248 36249 36250 36251 36252 36253 36254 36255 36256 36257 36258 36259 36260 36261 36262 36263 36264 36265 36266 36267 36268 36269 36270 36271 36272 36273 36274 36275 36276 36277 36278 36279 36280 36281 36282 36283 36284 36285 36286 36287 36288 36289 36290 36291 36292 36293 36294 36295 36296 36297 36298 36299 36300 36301 36302 36303 36304 36305 36306 36307 36308 36309 36310 36311 36312 36313 36314 36315 36316 36317 36318 36319 36320 36321 36322 36323 36324 36325 36326 36327 36328 36329 36330 36331 36332 36333 36334 36335 36336 36337 36338 36339 36340 36341 36342 36343 36344 36345 36346 36347 36348 36349 36350 36351 36352 36353 36354 36355 36356 36357 36358 36359 36360 36361 36362 36363 36364 36365 36366 36367 36368 36369 36370 36371 36372 36373 36374 36375 36376 36377 36378 36379 36380 36381 36382 36383 36384 36385 36386 36387 36388 36389 36390 36391 36392 36393 36394 36395 36396 36397 36398 36399 36400 36401 36402 36403 36404 36405 36406 36407 36408 36409 36410 36411 36412 36413 36414 36415 36416 36417 36418 36419 36420 36421 36422 36423 36424 36425 36426 36427 36428 36429 36430 36431 36432 36433 36434 36435 36436 36437 36438 36439 36440 36441 36442 36443 36444 36445 36446 36447 36448 36449 36450 36451 36452 36453 36454 36455 36456 36457 36458 36459 36460 36461 36462 36463 36464 36465 36466 36467 36468 36469 36470 36471 36472 36473 36474 36475 36476 36477 36478 36479 36480 36481 36482 36483 36484 36485 36486 36487 36488 36489 36490 36491 36492 36493 36494 36495 36496 36497 36498 36499 36500 36501 36502 36503 36504 36505 36506 36507 36508 36509 36510 36511 36512 36513 36514 36515 36516 36517 36518 36519 36520 36521 36522 36523 36524 36525 36526 36527 36528 36529 36530 36531 36532 36533 36534 36535 36536 36537 36538 36539 36540 36541 36542 36543 36544 36545 36546 36547 36548 36549 36550 36551 36552 36553 36554 36555 36556 36557 36558 36559 36560 36561 36562 36563 36564 36565 36566 36567 36568 36569 36570 36571 36572 36573 36574 36575 36576 36577 36578 36579 36580 36581 36582 36583 36584 36585 36586 36587 36588 36589 36590 36591 36592 36593 36594 36595 36596 36597 36598 36599 36600 36601 36602 36603 36604 36605 36606 36607 36608 36609 36610 36611 36612 36613 36614 36615 36616 36617 36618 36619 36620 36621 36622 36623 36624 36625 36626 36627 36628 36629 36630 36631 36632 36633 36634 36635 36636 36637 36638 36639 36640 36641 36642 36643 36644 36645 36646 36647 36648 36649 36650 36651 36652 36653 36654 36655 36656 36657 36658 36659 36660 36661 36662 36663 36664 36665 36666 36667 36668 36669 36670 36671 36672 36673 36674 36675 36676 36677 36678 36679 36680 36681 36682 36683 36684 36685 36686 36687 36688 36689 36690 36691 36692 36693 36694 36695 36696 36697 36698 36699 36700 36701 36702 36703 36704 36705 36706 36707 36708 36709 36710 36711 36712 36713 36714 36715 36716 36717 36718 36719 36720 36721 36722 36723 36724 36725 36726 36727 36728 36729 36730 36731 36732 36733 36734 36735 36736 36737 36738 36739 36740 36741 36742 36743 36744 36745 36746 36747 36748 36749 36750 36751 36752 36753 36754 36755 36756 36757 36758 36759 36760 36761 36762 36763 36764 36765 36766 36767 36768 36769 36770 36771 36772 36773 36774 36775 36776 36777 36778 36779 36780 36781 36782 36783 36784 36785 36786 36787 36788 36789 36790 36791 36792 36793 36794 36795 36796 36797 36798 36799 36800 36801 36802 36803 36804 36805 36806 36807 36808 36809 36810 36811 36812 36813 36814 36815 36816 36817 36818 36819 36820 36821 36822 36823 36824 36825 36826 36827 36828 36829 36830 36831 36832 36833 36834 36835 36836 36837 36838 36839 36840 36841 36842 36843 36844 36845 36846 36847 36848 36849 36850 36851 36852 36853 36854 36855 36856 36857 36858 36859 36860 36861 36862 36863 36864 36865 36866 36867 36868 36869 36870 36871 36872 36873 36874 36875 36876 36877 36878 36879 36880 36881 36882 36883 36884 36885 36886 36887 36888 36889 36890 36891 36892 36893 36894 36895 36896 36897 36898 36899 36900 36901 36902 36903 36904 36905 36906 36907 36908 36909 36910 36911 36912 36913 36914 36915 36916 36917 36918 36919 36920 36921 36922 36923 36924 36925 36926 36927 36928 36929 36930 36931 36932 36933 36934 36935 36936 36937 36938 36939 36940 36941 36942 36943 36944 36945 36946 36947 36948 36949 36950 36951 36952 36953 36954 36955 36956 36957 36958 36959 36960 36961 36962 36963 36964 36965 36966 36967 36968 36969 36970 36971 36972 36973 36974 36975 36976 36977 36978 36979 36980 36981 36982 36983 36984 36985 36986 36987 36988 36989 36990 36991 36992 36993 36994 36995 36996 36997 36998 36999 37000 37001 37002 37003 37004 37005 37006 37007 37008 37009 37010 37011 37012 37013 37014 37015 37016 37017 37018 37019 37020 37021 37022 37023 37024 37025 37026 37027 37028 37029 37030 37031 37032 37033 37034 37035 37036 37037 37038 37039 37040 37041 37042 37043 37044 37045 37046 37047 37048 37049 37050 37051 37052 37053 37054 37055 37056 37057 37058 37059 37060 37061 37062 37063 37064 37065 37066 37067 37068 37069 37070 37071 37072 37073 37074 37075 37076 37077 37078 37079 37080 37081 37082 37083 37084 37085 37086 37087 37088 37089 37090 37091 37092 37093 37094 37095 37096 37097 37098 37099 37100 37101 37102 37103 37104 37105 37106 37107 37108 37109 37110 37111 37112 37113 37114 37115 37116 37117 37118 37119 37120 37121 37122 37123 37124 37125 37126 37127 37128 37129 37130 37131 37132 37133 37134 37135 37136 37137 37138 37139 37140 37141 37142 37143 37144 37145 37146 37147 37148 37149 37150 37151 37152 37153 37154 37155 37156 37157 37158 37159 37160 37161 37162 37163 37164 37165 37166 37167 37168 37169 37170 37171 37172 37173 37174 37175 37176 37177 37178 37179 37180 37181 37182 37183 37184 37185 37186 37187 37188 37189 37190 37191 37192 37193 37194 37195 37196 37197 37198 37199 37200 37201 37202 37203 37204 37205 37206 37207 37208 37209 37210 37211 37212 37213 37214 37215 37216 37217 37218 37219 37220 37221 37222 37223 37224 37225 37226 37227 37228 37229 37230 37231 37232 37233 37234 37235 37236 37237 37238 37239 37240 37241 37242 37243 37244 37245 37246 37247 37248 37249 37250 37251 37252 37253 37254 37255 37256 37257 37258 37259 37260 37261 37262 37263 37264 37265 37266 37267 37268 37269 37270 37271 37272 37273 37274 37275 37276 37277 37278 37279 37280 37281 37282 37283 37284 37285 37286 37287 37288 37289 37290 37291 37292 37293 37294 37295 37296 37297 37298 37299 37300 37301 37302 37303 37304 37305 37306 37307 37308 37309 37310 37311 37312 37313 37314 37315 37316 37317 37318 37319 37320 37321 37322 37323 37324 37325 37326 37327 37328 37329 37330 37331 37332 37333 37334 37335 37336 37337 37338 37339 37340 37341 37342 37343 37344 37345 37346 37347 37348 37349 37350 37351 37352 37353 37354 37355 37356 37357 37358 37359 37360 37361 37362 37363 37364 37365 37366 37367 37368 37369 37370 37371 37372 37373 37374 37375 37376 37377 37378 37379 37380 37381 37382 37383 37384 37385 37386 37387 37388 37389 37390 37391 37392 37393 37394 37395 37396 37397 37398 37399 37400 37401 37402 37403 37404 37405 37406 37407 37408 37409 37410 37411 37412 37413 37414 37415 37416 37417 37418 37419 37420 37421 37422 37423 37424 37425 37426 37427 37428 37429 37430 37431 37432 37433 37434 37435 37436 37437 37438 37439 37440 37441 37442 37443 37444 37445 37446 37447 37448 37449 37450 37451 37452 37453 37454 37455 37456 37457 37458 37459 37460 37461 37462 37463 37464 37465 37466 37467 37468 37469 37470 37471 37472 37473 37474 37475 37476 37477 37478 37479 37480 37481 37482 37483 37484 37485 37486 37487 37488 37489 37490 37491 37492 37493 37494 37495 37496 37497 37498 37499 37500 37501 37502 37503 37504 37505 37506 37507 37508 37509 37510 37511 37512 37513 37514 37515 37516 37517 37518 37519 37520 37521 37522 37523 37524 37525 37526 37527 37528 37529 37530 37531 37532 37533 37534 37535 37536 37537 37538 37539 37540 37541 37542 37543 37544 37545 37546 37547 37548 37549 37550 37551 37552 37553 37554 37555 37556 37557 37558 37559 37560 37561 37562 37563 37564 37565 37566 37567 37568 37569 37570 37571 37572 37573 37574 37575 37576 37577 37578 37579 37580 37581 37582 37583 37584 37585 37586 37587 37588 37589 37590 37591 37592 37593 37594 37595 37596 37597 37598 37599 37600 37601 37602 37603 37604 37605 37606 37607 37608 37609 37610 37611 37612 37613 37614 37615 37616 37617 37618 37619 37620 37621 37622 37623 37624 37625 37626 37627 37628 37629 37630 37631 37632 37633 37634 37635 37636 37637 37638 37639 37640 37641 37642 37643 37644 37645 37646 37647 37648 37649 37650 37651 37652 37653 37654 37655 37656 37657 37658 37659 37660 37661 37662 37663 37664 37665 37666 37667 37668 37669 37670 37671 37672 37673 37674 37675 37676 37677 37678 37679 37680 37681 37682 37683 37684 37685 37686 37687 37688 37689 37690 37691 37692 37693 37694 37695 37696 37697 37698 37699 37700 37701 37702 37703 37704 37705 37706 37707 37708 37709 37710 37711 37712 37713 37714 37715 37716 37717 37718 37719 37720 37721 37722 37723 37724 37725 37726 37727 37728 37729 37730 37731 37732 37733 37734 37735 37736 37737 37738 37739 37740 37741 37742 37743 37744 37745 37746 37747 37748 37749 37750 37751 37752 37753 37754 37755 37756 37757 37758 37759 37760 37761 37762 37763 37764 37765 37766 37767 37768 37769 37770 37771 37772 37773 37774 37775 37776 37777 37778 37779 37780 37781 37782 37783 37784 37785 37786 37787 37788 37789 37790 37791 37792 37793 37794 37795 37796 37797 37798 37799 37800 37801 37802 37803 37804 37805 37806 37807 37808 37809 37810 37811 37812 37813 37814 37815 37816 37817 37818 37819 37820 37821 37822 37823 37824 37825 37826 37827 37828 37829 37830 37831 37832 37833 37834 37835 37836 37837 37838 37839 37840 37841 37842 37843 37844 37845 37846 37847 37848 37849 37850 37851 37852 37853 37854 37855 37856 37857 37858 37859 37860 37861 37862 37863 37864 37865 37866 37867 37868 37869 37870 37871 37872 37873 37874 37875 37876 37877 37878 37879 37880 37881 37882 37883 37884 37885 37886 37887 37888 37889 37890 37891 37892 37893 37894 37895 37896 37897 37898 37899 37900 37901 37902 37903 37904 37905 37906 37907 37908 37909 37910 37911 37912 37913 37914 37915 37916 37917 37918 37919 37920 37921 37922 37923 37924 37925 37926 37927 37928 37929 37930 37931 37932 37933 37934 37935 37936 37937 37938 37939 37940 37941 37942 37943 37944 37945 37946 37947 37948 37949 37950 37951 37952 37953 37954 37955 37956 37957 37958 37959 37960 37961 37962 37963 37964 37965 37966 37967 37968 37969 37970 37971 37972 37973 37974 37975 37976 37977 37978 37979 37980 37981 37982 37983 37984 37985 37986 37987 37988 37989 37990 37991 37992 37993 37994 37995 37996 37997 37998 37999 38000 38001 38002 38003 38004 38005 38006 38007 38008 38009 38010 38011 38012 38013 38014 38015 38016 38017 38018 38019 38020 38021 38022 38023 38024 38025 38026 38027 38028 38029 38030 38031 38032 38033 38034 38035 38036 38037 38038 38039 38040 38041 38042 38043 38044 38045 38046 38047 38048 38049 38050 38051 38052 38053 38054 38055 38056 38057 38058 38059 38060 38061 38062 38063 38064 38065 38066 38067 38068 38069 38070 38071 38072 38073 38074 38075 38076 38077 38078 38079 38080 38081 38082 38083 38084 38085 38086 38087 38088 38089 38090 38091 38092 38093 38094 38095 38096 38097 38098 38099 38100 38101 38102 38103 38104 38105 38106 38107 38108 38109 38110 38111 38112 38113 38114 38115 38116 38117 38118 38119 38120 38121 38122 38123 38124 38125 38126 38127 38128 38129 38130 38131 38132 38133 38134 38135 38136 38137 38138 38139 38140 38141 38142 38143 38144 38145 38146 38147 38148 38149 38150 38151 38152 38153 38154 38155 38156 38157 38158 38159 38160 38161 38162 38163 38164 38165 38166 38167 38168 38169 38170 38171 38172 38173 38174 38175 38176 38177 38178 38179 38180 38181 38182 38183 38184 38185 38186 38187 38188 38189 38190 38191 38192 38193 38194 38195 38196 38197 38198 38199 38200 38201 38202 38203 38204 38205 38206 38207 38208 38209 38210 38211 38212 38213 38214 38215 38216 38217 38218 38219 38220 38221 38222 38223 38224 38225 38226 38227 38228 38229 38230 38231 38232 38233 38234 38235 38236 38237 38238 38239 38240 38241 38242 38243 38244 38245 38246 38247 38248 38249 38250 38251 38252 38253 38254 38255 38256 38257 38258 38259 38260 38261 38262 38263 38264 38265 38266 38267 38268 38269 38270 38271 38272 38273 38274 38275 38276 38277 38278 38279 38280 38281 38282 38283 38284 38285 38286 38287 38288 38289 38290 38291 38292 38293 38294 38295 38296 38297 38298 38299 38300 38301 38302 38303 38304 38305 38306 38307 38308 38309 38310 38311 38312 38313 38314 38315 38316 38317 38318 38319 38320 38321 38322 38323 38324 38325 38326 38327 38328 38329 38330 38331 38332 38333 38334 38335 38336 38337 38338 38339 38340 38341 38342 38343 38344 38345 38346 38347 38348 38349 38350 38351 38352 38353 38354 38355 38356 38357 38358 38359 38360 38361 38362 38363 38364 38365 38366 38367 38368 38369 38370 38371 38372 38373 38374 38375 38376 38377 38378 38379 38380 38381 38382 38383 38384 38385 38386 38387 38388 38389 38390 38391 38392 38393 38394 38395 38396 38397 38398 38399 38400 38401 38402 38403 38404 38405 38406 38407 38408 38409 38410 38411 38412 38413 38414 38415 38416 38417 38418 38419 38420 38421 38422 38423 38424 38425 38426 38427 38428 38429 38430 38431 38432 38433 38434 38435 38436 38437 38438 38439 38440 38441 38442 38443 38444 38445 38446 38447 38448 38449 38450 38451 38452 38453 38454 38455 38456 38457 38458 38459 38460 38461 38462 38463 38464 38465 38466 38467 38468 38469 38470 38471 38472 38473 38474 38475 38476 38477 38478 38479 38480 38481 38482 38483 38484 38485 38486 38487 38488 38489 38490 38491 38492 38493 38494 38495 38496 38497 38498 38499 38500 38501 38502 38503 38504 38505 38506 38507 38508 38509 38510 38511 38512 38513 38514 38515 38516 38517 38518 38519 38520 38521 38522 38523 38524 38525 38526 38527 38528 38529 38530 38531 38532 38533 38534 38535 38536 38537 38538 38539 38540 38541 38542 38543 38544 38545 38546 38547 38548 38549 38550 38551 38552 38553 38554 38555 38556 38557 38558 38559 38560 38561 38562 38563 38564 38565 38566 38567 38568 38569 38570 38571 38572 38573 38574 38575 38576 38577 38578 38579 38580 38581 38582 38583 38584 38585 38586 38587 38588 38589 38590 38591 38592 38593 38594 38595 38596 38597 38598 38599 38600 38601 38602 38603 38604 38605 38606 38607 38608 38609 38610 38611 38612 38613 38614 38615 38616 38617 38618 38619 38620 38621 38622 38623 38624 38625 38626 38627 38628 38629 38630 38631 38632 38633 38634 38635 38636 38637 38638 38639 38640 38641 38642 38643 38644 38645 38646 38647 38648 38649 38650 38651 38652 38653 38654 38655 38656 38657 38658 38659 38660 38661 38662 38663 38664 38665 38666 38667 38668 38669 38670 38671 38672 38673 38674 38675 38676 38677 38678 38679 38680 38681 38682 38683 38684 38685 38686 38687 38688 38689 38690 38691 38692 38693 38694 38695 38696 38697 38698 38699 38700 38701 38702 38703 38704 38705 38706 38707 38708 38709 38710 38711 38712 38713 38714 38715 38716 38717 38718 38719 38720 38721 38722 38723 38724 38725 38726 38727 38728 38729 38730 38731 38732 38733 38734 38735 38736 38737 38738 38739 38740 38741 38742 38743 38744 38745 38746 38747 38748 38749 38750 38751 38752 38753 38754 38755 38756 38757 38758 38759 38760 38761 38762 38763 38764 38765 38766 38767 38768 38769 38770 38771 38772 38773 38774 38775 38776 38777 38778 38779 38780 38781 38782 38783 38784 38785 38786 38787 38788 38789 38790 38791 38792 38793 38794 38795 38796 38797 38798 38799 38800 38801 38802 38803 38804 38805 38806 38807 38808 38809 38810 38811 38812 38813 38814 38815 38816 38817 38818 38819 38820 38821 38822 38823 38824 38825 38826 38827 38828 38829 38830 38831 38832 38833 38834 38835 38836 38837 38838 38839 38840 38841 38842 38843 38844 38845 38846 38847 38848 38849 38850 38851 38852 38853 38854 38855 38856 38857 38858 38859 38860 38861 38862 38863 38864 38865 38866 38867 38868 38869 38870 38871 38872 38873 38874 38875 38876 38877 38878 38879 38880 38881 38882 38883 38884 38885 38886 38887 38888 38889 38890 38891 38892 38893 38894 38895 38896 38897 38898 38899 38900 38901 38902 38903 38904 38905 38906 38907 38908 38909 38910 38911 38912 38913 38914 38915 38916 38917 38918 38919 38920 38921 38922 38923 38924 38925 38926 38927 38928 38929 38930 38931 38932 38933 38934 38935 38936 38937 38938 38939 38940 38941 38942 38943 38944 38945 38946 38947 38948 38949 38950 38951 38952 38953 38954 38955 38956 38957 38958 38959 38960 38961 38962 38963 38964 38965 38966 38967 38968 38969 38970 38971 38972 38973 38974 38975 38976 38977 38978 38979 38980 38981 38982 38983 38984 38985 38986 38987 38988 38989 38990 38991 38992 38993 38994 38995 38996 38997 38998 38999 39000 39001 39002 39003 39004 39005 39006 39007 39008 39009 39010 39011 39012 39013 39014 39015 39016 39017 39018 39019 39020 39021 39022 39023 39024 39025 39026 39027 39028 39029 39030 39031 39032 39033 39034 39035 39036 39037 39038 39039 39040 39041 39042 39043 39044 39045 39046 39047 39048 39049 39050 39051 39052 39053 39054 39055 39056 39057 39058 39059 39060 39061 39062 39063 39064 39065 39066 39067 39068 39069 39070 39071 39072 39073 39074 39075 39076 39077 39078 39079 39080 39081 39082 39083 39084 39085 39086 39087 39088 39089 39090 39091 39092 39093 39094 39095 39096 39097 39098 39099 39100 39101 39102 39103 39104 39105 39106 39107 39108 39109 39110 39111 39112 39113 39114 39115 39116 39117 39118 39119 39120 39121 39122 39123 39124 39125 39126 39127 39128 39129 39130 39131 39132 39133 39134 39135 39136 39137 39138 39139 39140 39141 39142 39143 39144 39145 39146 39147 39148 39149 39150 39151 39152 39153 39154 39155 39156 39157 39158 39159 39160 39161 39162 39163 39164 39165 39166 39167 39168 39169 39170 39171 39172 39173 39174 39175 39176 39177 39178 39179 39180 39181 39182 39183 39184 39185 39186 39187 39188 39189 39190 39191 39192 39193 39194 39195 39196 39197 39198 39199 39200 39201 39202 39203 39204 39205 39206 39207 39208 39209 39210 39211 39212 39213 39214 39215 39216 39217 39218 39219 39220 39221 39222 39223 39224 39225 39226 39227 39228 39229 39230 39231 39232 39233 39234 39235 39236 39237 39238 39239 39240 39241 39242 39243 39244 39245 39246 39247 39248 39249 39250 39251 39252 39253 39254 39255 39256 39257 39258 39259 39260 39261 39262 39263 39264 39265 39266 39267 39268 39269 39270 39271 39272 39273 39274 39275 39276 39277 39278 39279 39280 39281 39282 39283 39284 39285 39286 39287 39288 39289 39290 39291 39292 39293 39294 39295 39296 39297 39298 39299 39300 39301 39302 39303 39304 39305 39306 39307 39308 39309 39310 39311 39312 39313 39314 39315 39316 39317 39318 39319 39320 39321 39322 39323 39324 39325 39326 39327 39328 39329 39330 39331 39332 39333 39334 39335 39336 39337 39338 39339 39340 39341 39342 39343 39344 39345 39346 39347 39348 39349 39350 39351 39352 39353 39354 39355 39356 39357 39358 39359 39360 39361 39362 39363 39364 39365 39366 39367 39368 39369 39370 39371 39372 39373 39374 39375 39376 39377 39378 39379 39380 39381 39382 39383 39384 39385 39386 39387 39388 39389 39390 39391 39392 39393 39394 39395 39396 39397 39398 39399 39400 39401 39402 39403 39404 39405 39406 39407 39408 39409 39410 39411 39412 39413 39414 39415 39416 39417 39418 39419 39420 39421 39422 39423 39424 39425 39426 39427 39428 39429 39430 39431 39432 39433 39434 39435 39436 39437 39438 39439 39440 39441 39442 39443 39444 39445 39446 39447 39448 39449 39450 39451 39452 39453 39454 39455 39456 39457 39458 39459 39460 39461 39462 39463 39464 39465 39466 39467 39468 39469 39470 39471 39472 39473 39474 39475 39476 39477 39478 39479 39480 39481 39482 39483 39484 39485 39486 39487 39488 39489 39490 39491 39492 39493 39494 39495 39496 39497 39498 39499 39500 39501 39502 39503 39504 39505 39506 39507 39508 39509 39510 39511 39512 39513 39514 39515 39516 39517 39518 39519 39520 39521 39522 39523 39524 39525 39526 39527 39528 39529 39530 39531 39532 39533 39534 39535 39536 39537 39538 39539 39540 39541 39542 39543 39544 39545 39546 39547 39548 39549 39550 39551 39552 39553 39554 39555 39556 39557 39558 39559 39560 39561 39562 39563 39564 39565 39566 39567 39568 39569 39570 39571 39572 39573 39574 39575 39576 39577 39578 39579 39580 39581 39582 39583 39584 39585 39586 39587 39588 39589 39590 39591 39592 39593 39594 39595 39596 39597 39598 39599 39600 39601 39602 39603 39604 39605 39606 39607 39608 39609 39610 39611 39612 39613 39614 39615 39616 39617 39618 39619 39620 39621 39622 39623 39624 39625 39626 39627 39628 39629 39630 39631 39632 39633 39634 39635 39636 39637 39638 39639 39640 39641 39642 39643 39644 39645 39646 39647 39648 39649 39650 39651 39652 39653 39654 39655 39656 39657 39658 39659 39660 39661 39662 39663 39664 39665 39666 39667 39668 39669 39670 39671 39672 39673 39674 39675 39676 39677 39678 39679 39680 39681 39682 39683 39684 39685 39686 39687 39688 39689 39690 39691 39692 39693 39694 39695 39696 39697 39698 39699 39700 39701 39702 39703 39704 39705 39706 39707 39708 39709 39710 39711 39712 39713 39714 39715 39716 39717 39718 39719 39720 39721 39722 39723 39724 39725 39726 39727 39728 39729 39730 39731 39732 39733 39734 39735 39736 39737 39738 39739 39740 39741 39742 39743 39744 39745 39746 39747 39748 39749 39750 39751 39752 39753 39754 39755 39756 39757 39758 39759 39760 39761 39762 39763 39764 39765 39766 39767 39768 39769 39770 39771 39772 39773 39774 39775 39776 39777 39778 39779 39780 39781 39782 39783 39784 39785 39786 39787 39788 39789 39790 39791 39792 39793 39794 39795 39796 39797 39798 39799 39800 39801 39802 39803 39804 39805 39806 39807 39808 39809 39810 39811 39812 39813 39814 39815 39816 39817 39818 39819 39820 39821 39822 39823 39824 39825 39826 39827 39828 39829 39830 39831 39832 39833 39834 39835 39836 39837 39838 39839 39840 39841 39842 39843 39844 39845 39846 39847 39848 39849 39850 39851 39852 39853 39854 39855 39856 39857 39858 39859 39860 39861 39862 39863 39864 39865 39866 39867 39868 39869 39870 39871 39872 39873 39874 39875 39876 39877 39878 39879 39880 39881 39882 39883 39884 39885 39886 39887 39888 39889 39890 39891 39892 39893 39894 39895 39896 39897 39898 39899 39900 39901 39902 39903 39904 39905 39906 39907 39908 39909 39910 39911 39912 39913 39914 39915 39916 39917 39918 39919 39920 39921 39922 39923 39924 39925 39926 39927 39928 39929 39930 39931 39932 39933 39934 39935 39936 39937 39938 39939 39940 39941 39942 39943 39944 39945 39946 39947 39948 39949 39950 39951 39952 39953 39954 39955 39956 39957 39958 39959 39960 39961 39962 39963 39964 39965 39966 39967 39968 39969 39970 39971 39972 39973 39974 39975 39976 39977 39978 39979 39980 39981 39982 39983 39984 39985 39986 39987 39988 39989 39990 39991 39992 39993 39994 39995 39996 39997 39998 39999 40000 40001 40002 40003 40004 40005 40006 40007 40008 40009 40010 40011 40012 40013 40014 40015 40016 40017 40018 40019 40020 40021 40022 40023 40024 40025 40026 40027 40028 40029 40030 40031 40032 40033 40034 40035 40036 40037 40038 40039 40040 40041 40042 40043 40044 40045 40046 40047 40048 40049 40050 40051 40052 40053 40054 40055 40056 40057 40058 40059 40060 40061 40062 40063 40064 40065 40066 40067 40068 40069 40070 40071 40072 40073 40074 40075 40076 40077 40078 40079 40080 40081 40082 40083 40084 40085 40086 40087 40088 40089 40090 40091 40092 40093 40094 40095 40096 40097 40098 40099 40100 40101 40102 40103 40104 40105 40106 40107 40108 40109 40110 40111 40112 40113 40114 40115 40116 40117 40118 40119 40120 40121 40122 40123 40124 40125 40126 40127 40128 40129 40130 40131 40132 40133 40134 40135 40136 40137 40138 40139 40140 40141 40142 40143 40144 40145 40146 40147 40148 40149 40150 40151 40152 40153 40154 40155 40156 40157 40158 40159 40160 40161 40162 40163 40164 40165 40166 40167 40168 40169 40170 40171 40172 40173 40174 40175 40176 40177 40178 40179 40180 40181 40182 40183 40184 40185 40186 40187 40188 40189 40190 40191 40192 40193 40194 40195 40196 40197 40198 40199 40200 40201 40202 40203 40204 40205 40206 40207 40208 40209 40210 40211 40212 40213 40214 40215 40216 40217 40218 40219 40220 40221 40222 40223 40224 40225 40226 40227 40228 40229 40230 40231 40232 40233 40234 40235 40236 40237 40238 40239 40240 40241 40242 40243 40244 40245 40246 40247 40248 40249 40250 40251 40252 40253 40254 40255 40256 40257 40258 40259 40260 40261 40262 40263 40264 40265 40266 40267 40268 40269 40270 40271 40272 40273 40274 40275 40276 40277 40278 40279 40280 40281 40282 40283 40284 40285 40286 40287 40288 40289 40290 40291 40292 40293 40294 40295 40296 40297 40298 40299 40300 40301 40302 40303 40304 40305 40306 40307 40308 40309 40310 40311 40312 40313 40314 40315 40316 40317 40318 40319 40320 40321 40322 40323 40324 40325 40326 40327 40328 40329 40330 40331 40332 40333 40334 40335 40336 40337 40338 40339 40340 40341 40342 40343 40344 40345 40346 40347 40348 40349 40350 40351 40352 40353 40354 40355 40356 40357 40358 40359 40360 40361 40362 40363 40364 40365 40366 40367 40368 40369 40370 40371 40372 40373 40374 40375 40376 40377 40378 40379 40380 40381 40382 40383 40384 40385 40386 40387 40388 40389 40390 40391 40392 40393 40394 40395 40396 40397 40398 40399 40400 40401 40402 40403 40404 40405 40406 40407 40408 40409 40410 40411 40412 40413 40414 40415 40416 40417 40418 40419 40420 40421 40422 40423 40424 40425 40426 40427 40428 40429 40430 40431 40432 40433 40434 40435 40436 40437 40438 40439 40440 40441 40442 40443 40444 40445 40446 40447 40448 40449 40450 40451 40452 40453 40454 40455 40456 40457 40458 40459 40460 40461 40462 40463 40464 40465 40466 40467 40468 40469 40470 40471 40472 40473 40474 40475 40476 40477 40478 40479 40480 40481 40482 40483 40484 40485 40486 40487 40488 40489 40490 40491 40492 40493 40494 40495 40496 40497 40498 40499 40500 40501 40502 40503 40504 40505 40506 40507 40508 40509 40510 40511 40512 40513 40514 40515 40516 40517 40518 40519 40520 40521 40522 40523 40524 40525 40526 40527 40528 40529 40530 40531 40532 40533 40534 40535 40536 40537 40538 40539 40540 40541 40542 40543 40544 40545 40546 40547 40548 40549 40550 40551 40552 40553 40554 40555 40556 40557 40558 40559 40560 40561 40562 40563 40564 40565 40566 40567 40568 40569 40570 40571 40572 40573 40574 40575 40576 40577 40578 40579 40580 40581 40582 40583 40584 40585 40586 40587 40588 40589 40590 40591 40592 40593 40594 40595 40596 40597 40598 40599 40600 40601 40602 40603 40604 40605 40606 40607 40608 40609 40610 40611 40612 40613 40614 40615 40616 40617 40618 40619 40620 40621 40622 40623 40624 40625 40626 40627 40628 40629 40630 40631 40632 40633 40634 40635 40636 40637 40638 40639 40640 40641 40642 40643 40644 40645 40646 40647 40648 40649 40650 40651 40652 40653 40654 40655 40656 40657 40658 40659 40660 40661 40662 40663 40664 40665 40666 40667 40668 40669 40670 40671 40672 40673 40674 40675 40676 40677 40678 40679 40680 40681 40682 40683 40684 40685 40686 40687 40688 40689 40690 40691 40692 40693 40694 40695 40696 40697 40698 40699 40700 40701 40702 40703 40704 40705 40706 40707 40708 40709 40710 40711 40712 40713 40714 40715 40716 40717 40718 40719 40720 40721 40722 40723 40724 40725 40726 40727 40728 40729 40730 40731 40732 40733 40734 40735 40736 40737 40738 40739 40740 40741 40742 40743 40744 40745 40746 40747 40748 40749 40750 40751 40752 40753 40754 40755 40756 40757 40758 40759 40760 40761 40762 40763 40764 40765 40766 40767 40768 40769 40770 40771 40772 40773 40774 40775 40776 40777 40778 40779 40780 40781 40782 40783 40784 40785 40786 40787 40788 40789 40790 40791 40792 40793 40794 40795 40796 40797 40798 40799 40800 40801 40802 40803 40804 40805 40806 40807 40808 40809 40810 40811 40812 40813 40814 40815 40816 40817 40818 40819 40820 40821 40822 40823 40824 40825 40826 40827 40828 40829 40830 40831 40832 40833 40834 40835 40836 40837 40838 40839 40840 40841 40842 40843 40844 40845 40846 40847 40848 40849 40850 40851 40852 40853 40854 40855 40856 40857 40858 40859 40860 40861 40862 40863 40864 40865 40866 40867 40868 40869 40870 40871 40872 40873 40874 40875 40876 40877 40878 40879 40880 40881 40882 40883 40884 40885 40886 40887 40888 40889 40890 40891 40892 40893 40894 40895 40896 40897 40898 40899 40900 40901 40902 40903 40904 40905 40906 40907 40908 40909 40910 40911 40912 40913 40914 40915 40916 40917 40918 40919 40920 40921 40922 40923 40924 40925 40926 40927 40928 40929 40930 40931 40932 40933 40934 40935 40936 40937 40938 40939 40940 40941 40942 40943 40944 40945 40946 40947 40948 40949 40950 40951 40952 40953 40954 40955 40956 40957 40958 40959 40960 40961 40962 40963 40964 40965 40966 40967 40968 40969 40970 40971 40972 40973 40974 40975 40976 40977 40978 40979 40980 40981 40982 40983 40984 40985 40986 40987 40988 40989 40990 40991 40992 40993 40994 40995 40996 40997 40998 40999 41000 41001 41002 41003 41004 41005 41006 41007 41008 41009 41010 41011 41012 41013 41014 41015 41016 41017 41018 41019 41020 41021 41022 41023 41024 41025 41026 41027 41028 41029 41030 41031 41032 41033 41034 41035 41036 41037 41038 41039 41040 41041 41042 41043 41044 41045 41046 41047 41048 41049 41050 41051 41052 41053 41054 41055 41056 41057 41058 41059 41060 41061 41062 41063 41064 41065 41066 41067 41068 41069 41070 41071 41072 41073 41074 41075 41076 41077 41078 41079 41080 41081 41082 41083 41084 41085 41086 41087 41088 41089 41090 41091 41092 41093 41094 41095 41096 41097 41098 41099 41100 41101 41102 41103 41104 41105 41106 41107 41108 41109 41110 41111 41112 41113 41114 41115 41116 41117 41118 41119 41120 41121 41122 41123 41124 41125 41126 41127 41128 41129 41130 41131 41132 41133 41134 41135 41136 41137 41138 41139 41140 41141 41142 41143 41144 41145 41146 41147 41148 41149 41150 41151 41152 41153 41154 41155 41156 41157 41158 41159 41160 41161 41162 41163 41164 41165 41166 41167 41168 41169 41170 41171 41172 41173 41174 41175 41176 41177 41178 41179 41180 41181 41182 41183 41184 41185 41186 41187 41188 41189 41190 41191 41192 41193 41194 41195 41196 41197 41198 41199 41200 41201 41202 41203 41204 41205 41206 41207 41208 41209 41210 41211 41212 41213 41214 41215 41216 41217 41218 41219 41220 41221 41222 41223 41224 41225 41226 41227 41228 41229 41230 41231 41232 41233 41234 41235 41236 41237 41238 41239 41240 41241 41242 41243 41244 41245 41246 41247 41248 41249 41250 41251 41252 41253 41254 41255 41256 41257 41258 41259 41260 41261 41262 41263 41264 41265 41266 41267 41268 41269 41270 41271 41272 41273 41274 41275 41276 41277 41278 41279 41280 41281 41282 41283 41284 41285 41286 41287 41288 41289 41290 41291 41292 41293 41294 41295 41296 41297 41298 41299 41300 41301 41302 41303 41304 41305 41306 41307 41308 41309 41310 41311 41312 41313 41314 41315 41316 41317 41318 41319 41320 41321 41322 41323 41324 41325 41326 41327 41328 41329 41330 41331 41332 41333 41334 41335 41336 41337 41338 41339 41340 41341 41342 41343 41344 41345 41346 41347 41348 41349 41350 41351 41352 41353 41354 41355 41356 41357 41358 41359 41360 41361 41362 41363 41364 41365 41366 41367 41368 41369 41370 41371 41372 41373 41374 41375 41376 41377 41378 41379 41380 41381 41382 41383 41384 41385 41386 41387 41388 41389 41390 41391 41392 41393 41394 41395 41396 41397 41398 41399 41400 41401 41402 41403 41404 41405 41406 41407 41408 41409 41410 41411 41412 41413 41414 41415 41416 41417 41418 41419 41420 41421 41422 41423 41424 41425 41426 41427 41428 41429 41430 41431 41432 41433 41434 41435 41436 41437 41438 41439 41440 41441 41442 41443 41444 41445 41446 41447 41448 41449 41450 41451 41452 41453 41454 41455 41456 41457 41458 41459 41460 41461 41462 41463 41464 41465 41466 41467 41468 41469 41470 41471 41472 41473 41474 41475 41476 41477 41478 41479 41480 41481 41482 41483 41484 41485 41486 41487 41488 41489 41490 41491 41492 41493 41494 41495 41496 41497 41498 41499 41500 41501 41502 41503 41504 41505 41506 41507 41508 41509 41510 41511 41512 41513 41514 41515 41516 41517 41518 41519 41520 41521 41522 41523 41524 41525 41526 41527 41528 41529 41530 41531 41532 41533 41534 41535 41536 41537 41538 41539 41540 41541 41542 41543 41544 41545 41546 41547 41548 41549 41550 41551 41552 41553 41554 41555 41556 41557 41558 41559 41560 41561 41562 41563 41564 41565 41566 41567 41568 41569 41570 41571 41572 41573 41574 41575 41576 41577 41578 41579 41580 41581 41582 41583 41584 41585 41586 41587 41588 41589 41590 41591 41592 41593 41594 41595 41596 41597 41598 41599 41600 41601 41602 41603 41604 41605 41606 41607 41608 41609 41610 41611 41612 41613 41614 41615 41616 41617 41618 41619 41620 41621 41622 41623 41624 41625 41626 41627 41628 41629 41630 41631 41632 41633 41634 41635 41636 41637 41638 41639 41640 41641 41642 41643 41644 41645 41646 41647 41648 41649 41650 41651 41652 41653 41654 41655 41656 41657 41658 41659 41660 41661 41662 41663 41664 41665 41666 41667 41668 41669 41670 41671 41672 41673 41674 41675 41676 41677 41678 41679 41680 41681 41682 41683 41684 41685 41686 41687 41688 41689 41690 41691 41692 41693 41694 41695 41696 41697 41698 41699 41700 41701 41702 41703 41704 41705 41706 41707 41708 41709 41710 41711 41712 41713 41714 41715 41716 41717 41718 41719 41720 41721 41722 41723 41724 41725 41726 41727 41728 41729 41730 41731 41732 41733 41734 41735 41736 41737 41738 41739 41740 41741 41742 41743 41744 41745 41746 41747 41748 41749 41750 41751 41752 41753 41754 41755 41756 41757 41758 41759 41760 41761 41762 41763 41764 41765 41766 41767 41768 41769 41770 41771 41772 41773 41774 41775 41776 41777 41778 41779 41780 41781 41782 41783 41784 41785 41786 41787 41788 41789 41790 41791 41792 41793 41794 41795 41796 41797 41798 41799 41800 41801 41802 41803 41804 41805 41806 41807 41808 41809 41810 41811 41812 41813 41814 41815 41816 41817 41818 41819 41820 41821 41822 41823 41824 41825 41826 41827 41828 41829 41830 41831 41832 41833 41834 41835 41836 41837 41838 41839 41840 41841 41842 41843 41844 41845 41846 41847 41848 41849 41850 41851 41852 41853 41854 41855 41856 41857 41858 41859 41860 41861 41862 41863 41864 41865 41866 41867 41868 41869 41870 41871 41872 41873 41874 41875 41876 41877 41878 41879 41880 41881 41882 41883 41884 41885 41886 41887 41888 41889 41890 41891 41892 41893 41894 41895 41896 41897 41898 41899 41900 41901 41902 41903 41904 41905 41906 41907 41908 41909 41910 41911 41912 41913 41914 41915 41916 41917 41918 41919 41920 41921 41922 41923 41924 41925 41926 41927 41928 41929 41930 41931 41932 41933 41934 41935 41936 41937 41938 41939 41940 41941 41942 41943 41944 41945 41946 41947 41948 41949 41950 41951 41952 41953 41954 41955 41956 41957 41958 41959 41960 41961 41962 41963 41964 41965 41966 41967 41968 41969 41970 41971 41972 41973 41974 41975 41976 41977 41978 41979 41980 41981 41982 41983 41984 41985 41986 41987 41988 41989 41990 41991 41992 41993 41994 41995 41996 41997 41998 41999 42000 42001 42002 42003 42004 42005 42006 42007 42008 42009 42010 42011 42012 42013 42014 42015 42016 42017 42018 42019 42020 42021 42022 42023 42024 42025 42026 42027 42028 42029 42030 42031 42032 42033 42034 42035 42036 42037 42038 42039 42040 42041 42042 42043 42044 42045 42046 42047 42048 42049 42050 42051 42052 42053 42054 42055 42056 42057 42058 42059 42060 42061 42062 42063 42064 42065 42066 42067 42068 42069 42070 42071 42072 42073 42074 42075 42076 42077 42078 42079 42080 42081 42082 42083 42084 42085 42086 42087 42088 42089 42090 42091 42092 42093 42094 42095 42096 42097 42098 42099 42100 42101 42102 42103 42104 42105 42106 42107 42108 42109 42110 42111 42112 42113 42114 42115 42116 42117 42118 42119 42120 42121 42122 42123 42124 42125 42126 42127 42128 42129 42130 42131 42132 42133 42134 42135 42136 42137 42138 42139 42140 42141 42142 42143 42144 42145 42146 42147 42148 42149 42150 42151 42152 42153 42154 42155 42156 42157 42158 42159 42160 42161 42162 42163 42164 42165 42166 42167 42168 42169 42170 42171 42172 42173 42174 42175 42176 42177 42178 42179 42180 42181 42182 42183 42184 42185 42186 42187 42188 42189 42190 42191 42192 42193 42194 42195 42196 42197 42198 42199 42200 42201 42202 42203 42204 42205 42206 42207 42208 42209 42210 42211 42212 42213 42214 42215 42216 42217 42218 42219 42220 42221 42222 42223 42224 42225 42226 42227 42228 42229 42230 42231 42232 42233 42234 42235 42236 42237 42238 42239 42240 42241 42242 42243 42244 42245 42246 42247 42248 42249 42250 42251 42252 42253 42254 42255 42256 42257 42258 42259 42260 42261 42262 42263 42264 42265 42266 42267 42268 42269 42270 42271 42272 42273 42274 42275 42276 42277 42278 42279 42280 42281 42282 42283 42284 42285 42286 42287 42288 42289 42290 42291 42292 42293 42294 42295 42296 42297 42298 42299 42300 42301 42302 42303 42304 42305 42306 42307 42308 42309 42310 42311 42312 42313 42314 42315 42316 42317 42318 42319 42320 42321 42322 42323 42324 42325 42326 42327 42328 42329 42330 42331 42332 42333 42334 42335 42336 42337 42338 42339 42340 42341 42342 42343 42344 42345 42346 42347 42348 42349 42350 42351 42352 42353 42354 42355 42356 42357 42358 42359 42360 42361 42362 42363 42364 42365 42366 42367 42368 42369 42370 42371 42372 42373 42374 42375 42376 42377 42378 42379 42380 42381 42382 42383 42384 42385 42386 42387 42388 42389 42390 42391 42392 42393 42394 42395 42396 42397 42398 42399 42400 42401 42402 42403 42404 42405 42406 42407 42408 42409 42410 42411 42412 42413 42414 42415 42416 42417 42418 42419 42420 42421 42422 42423 42424 42425 42426 42427 42428 42429 42430 42431 42432 42433 42434 42435 42436 42437 42438 42439 42440 42441 42442 42443 42444 42445 42446 42447 42448 42449 42450 42451 42452 42453 42454 42455 42456 42457 42458 42459 42460 42461 42462 42463 42464 42465 42466 42467 42468 42469 42470 42471 42472 42473 42474 42475 42476 42477 42478 42479 42480 42481 42482 42483 42484 42485 42486 42487 42488 42489 42490 42491 42492 42493 42494 42495 42496 42497 42498 42499 42500 42501 42502 42503 42504 42505 42506 42507 42508 42509 42510 42511 42512 42513 42514 42515 42516 42517 42518 42519 42520 42521 42522 42523 42524 42525 42526 42527 42528 42529 42530 42531 42532 42533 42534 42535 42536 42537 42538 42539 42540 42541 42542 42543 42544 42545 42546 42547 42548 42549 42550 42551 42552 42553 42554 42555 42556 42557 42558 42559 42560 42561 42562 42563 42564 42565 42566 42567 42568 42569 42570 42571 42572 42573 42574 42575 42576 42577 42578 42579 42580 42581 42582 42583 42584 42585 42586 42587 42588 42589 42590 42591 42592 42593 42594 42595 42596 42597 42598 42599 42600 42601 42602 42603 42604 42605 42606 42607 42608 42609 42610 42611 42612 42613 42614 42615 42616 42617 42618 42619 42620 42621 42622 42623 42624 42625 42626 42627 42628 42629 42630 42631 42632 42633 42634 42635 42636 42637 42638 42639 42640 42641 42642 42643 42644 42645 42646 42647 42648 42649 42650 42651 42652 42653 42654 42655 42656 42657 42658 42659 42660 42661 42662 42663 42664 42665 42666 42667 42668 42669 42670 42671 42672 42673 42674 42675 42676 42677 42678 42679 42680 42681 42682 42683 42684 42685 42686 42687 42688 42689 42690 42691 42692 42693 42694 42695 42696 42697 42698 42699 42700 42701 42702 42703 42704 42705 42706 42707 42708 42709 42710 42711 42712 42713 42714 42715 42716 42717 42718 42719 42720 42721 42722 42723 42724 42725 42726 42727 42728 42729 42730 42731 42732 42733 42734 42735 42736 42737 42738 42739 42740 42741 42742 42743 42744 42745 42746 42747 42748 42749 42750 42751 42752 42753 42754 42755 42756 42757 42758 42759 42760 42761 42762 42763 42764 42765 42766 42767 42768 42769 42770 42771 42772 42773 42774 42775 42776 42777 42778 42779 42780 42781 42782 42783 42784 42785 42786 42787 42788 42789 42790 42791 42792 42793 42794 42795 42796 42797 42798 42799 42800 42801 42802 42803 42804 42805 42806 42807 42808 42809 42810 42811 42812 42813 42814 42815 42816 42817 42818 42819 42820 42821 42822 42823 42824 42825 42826 42827 42828 42829 42830 42831 42832 42833 42834 42835 42836 42837 42838 42839 42840 42841 42842 42843 42844 42845 42846 42847 42848 42849 42850 42851 42852 42853 42854 42855 42856 42857 42858 42859 42860 42861 42862 42863 42864 42865 42866 42867 42868 42869 42870 42871 42872 42873 42874 42875 42876 42877 42878 42879 42880 42881 42882 42883 42884 42885 42886 42887 42888 42889 42890 42891 42892 42893 42894 42895 42896 42897 42898 42899 42900 42901 42902 42903 42904 42905 42906 42907 42908 42909 42910 42911 42912 42913 42914 42915 42916 42917 42918 42919 42920 42921 42922 42923 42924 42925 42926 42927 42928 42929 42930 42931 42932 42933 42934 42935 42936 42937 42938 42939 42940 42941 42942 42943 42944 42945 42946 42947 42948 42949 42950 42951 42952 42953 42954 42955 42956 42957 42958 42959 42960 42961 42962 42963 42964 42965 42966 42967 42968 42969 42970 42971 42972 42973 42974 42975 42976 42977 42978 42979 42980 42981 42982 42983 42984 42985 42986 42987 42988 42989 42990 42991 42992 42993 42994 42995 42996 42997 42998 42999 43000 43001 43002 43003 43004 43005 43006 43007 43008 43009 43010 43011 43012 43013 43014 43015 43016 43017 43018 43019 43020 43021 43022 43023 43024 43025 43026 43027 43028 43029 43030 43031 43032 43033 43034 43035 43036 43037 43038 43039 43040 43041 43042 43043 43044 43045 43046 43047 43048 43049 43050 43051 43052 43053 43054 43055 43056 43057 43058 43059 43060 43061 43062 43063 43064 43065 43066 43067 43068 43069 43070 43071 43072 43073 43074 43075 43076 43077 43078 43079 43080 43081 43082 43083 43084 43085 43086 43087 43088 43089 43090 43091 43092 43093 43094 43095 43096 43097 43098 43099 43100 43101 43102 43103 43104 43105 43106 43107 43108 43109 43110 43111 43112 43113 43114 43115 43116 43117 43118 43119 43120 43121 43122 43123 43124 43125 43126 43127 43128 43129 43130 43131 43132 43133 43134 43135 43136 43137 43138 43139 43140 43141 43142 43143 43144 43145 43146 43147 43148 43149 43150 43151 43152 43153 43154 43155 43156 43157 43158 43159 43160 43161 43162 43163 43164 43165 43166 43167 43168 43169 43170 43171 43172 43173 43174 43175 43176 43177 43178 43179 43180 43181 43182 43183 43184 43185 43186 43187 43188 43189 43190 43191 43192 43193 43194 43195 43196 43197 43198 43199 43200 43201 43202 43203 43204 43205 43206 43207 43208 43209 43210 43211 43212 43213 43214 43215 43216 43217 43218 43219 43220 43221 43222 43223 43224 43225 43226 43227 43228 43229 43230 43231 43232 43233 43234 43235 43236 43237 43238 43239 43240 43241 43242 43243 43244 43245 43246 43247 43248 43249 43250 43251 43252 43253 43254 43255 43256 43257 43258 43259 43260 43261 43262 43263 43264 43265 43266 43267 43268 43269 43270 43271 43272 43273 43274 43275 43276 43277 43278 43279 43280 43281 43282 43283 43284 43285 43286 43287 43288 43289 43290 43291 43292 43293 43294 43295 43296 43297 43298 43299 43300 43301 43302 43303 43304 43305 43306 43307 43308 43309 43310 43311 43312 43313 43314 43315 43316 43317 43318 43319 43320 43321 43322 43323 43324 43325 43326 43327 43328 43329 43330 43331 43332 43333 43334 43335 43336 43337 43338 43339 43340 43341 43342 43343 43344 43345 43346 43347 43348 43349 43350 43351 43352 43353 43354 43355 43356 43357 43358 43359 43360 43361 43362 43363 43364 43365 43366 43367 43368 43369 43370 43371 43372 43373 43374 43375 43376 43377 43378 43379 43380 43381 43382 43383 43384 43385 43386 43387 43388 43389 43390 43391 43392 43393 43394 43395 43396 43397 43398 43399 43400 43401 43402 43403 43404 43405 43406 43407 43408 43409 43410 43411 43412 43413 43414 43415 43416 43417 43418 43419 43420 43421 43422 43423 43424 43425 43426 43427 43428 43429 43430 43431 43432 43433 43434 43435 43436 43437 43438 43439 43440 43441 43442 43443 43444 43445 43446 43447 43448 43449 43450 43451 43452 43453 43454 43455 43456 43457 43458 43459 43460 43461 43462 43463 43464 43465 43466 43467 43468 43469 43470 43471 43472 43473 43474 43475 43476 43477 43478 43479 43480 43481 43482 43483 43484 43485 43486 43487 43488 43489 43490 43491 43492 43493 43494 43495 43496 43497 43498 43499 43500 43501 43502 43503 43504 43505 43506 43507 43508 43509 43510 43511 43512 43513 43514 43515 43516 43517 43518 43519 43520 43521 43522 43523 43524 43525 43526 43527 43528 43529 43530 43531 43532 43533 43534 43535 43536 43537 43538 43539 43540 43541 43542 43543 43544 43545 43546 43547 43548 43549 43550 43551 43552 43553 43554 43555 43556 43557 43558 43559 43560 43561 43562 43563 43564 43565 43566 43567 43568 43569 43570 43571 43572 43573 43574 43575 43576 43577 43578 43579 43580 43581 43582 43583 43584 43585 43586 43587 43588 43589 43590 43591 43592 43593 43594 43595 43596 43597 43598 43599 43600 43601 43602 43603 43604 43605 43606 43607 43608 43609 43610 43611 43612 43613 43614 43615 43616 43617 43618 43619 43620 43621 43622 43623 43624 43625 43626 43627 43628 43629 43630 43631 43632 43633 43634 43635 43636 43637 43638 43639 43640 43641 43642 43643 43644 43645 43646 43647 43648 43649 43650 43651 43652 43653 43654 43655 43656 43657 43658 43659 43660 43661 43662 43663 43664 43665 43666 43667 43668 43669 43670 43671 43672 43673 43674 43675 43676 43677 43678 43679 43680 43681 43682 43683 43684 43685 43686 43687 43688 43689 43690 43691 43692 43693 43694 43695 43696 43697 43698 43699 43700 43701 43702 43703 43704 43705 43706 43707 43708 43709 43710 43711 43712 43713 43714 43715 43716 43717 43718 43719 43720 43721 43722 43723 43724 43725 43726 43727 43728 43729 43730 43731 43732 43733 43734 43735 43736 43737 43738 43739 43740 43741 43742 43743 43744 43745 43746 43747 43748 43749 43750 43751 43752 43753 43754 43755 43756 43757 43758 43759 43760 43761 43762 43763 43764 43765 43766 43767 43768 43769 43770 43771 43772 43773 43774 43775 43776 43777 43778 43779 43780 43781 43782 43783 43784 43785 43786 43787 43788 43789 43790 43791 43792 43793 43794 43795 43796 43797 43798 43799 43800 43801 43802 43803 43804 43805 43806 43807 43808 43809 43810 43811 43812 43813 43814 43815 43816 43817 43818 43819 43820 43821 43822 43823 43824 43825 43826 43827 43828 43829 43830 43831 43832 43833 43834 43835 43836 43837 43838 43839 43840 43841 43842 43843 43844 43845 43846 43847 43848 43849 43850 43851 43852 43853 43854 43855 43856 43857 43858 43859 43860 43861 43862 43863 43864 43865 43866 43867 43868 43869 43870 43871 43872 43873 43874 43875 43876 43877 43878 43879 43880 43881 43882 43883 43884 43885 43886 43887 43888 43889 43890 43891 43892 43893 43894 43895 43896 43897 43898 43899 43900 43901 43902 43903 43904 43905 43906 43907 43908 43909 43910 43911 43912 43913 43914 43915 43916 43917 43918 43919 43920 43921 43922 43923 43924 43925 43926 43927 43928 43929 43930 43931 43932 43933 43934 43935 43936 43937 43938 43939 43940 43941 43942 43943 43944 43945 43946 43947 43948 43949 43950 43951 43952 43953 43954 43955 43956 43957 43958 43959 43960 43961 43962 43963 43964 43965 43966 43967 43968 43969 43970 43971 43972 43973 43974 43975 43976 43977 43978 43979 43980 43981 43982 43983 43984 43985 43986 43987 43988 43989 43990 43991 43992 43993 43994 43995 43996 43997 43998 43999 44000 44001 44002 44003 44004 44005 44006 44007 44008 44009 44010 44011 44012 44013 44014 44015 44016 44017 44018 44019 44020 44021 44022 44023 44024 44025 44026 44027 44028 44029 44030 44031 44032 44033 44034 44035 44036 44037 44038 44039 44040 44041 44042 44043 44044 44045 44046 44047 44048 44049 44050 44051 44052 44053 44054 44055 44056 44057 44058 44059 44060 44061 44062 44063 44064 44065 44066 44067 44068 44069 44070 44071 44072 44073 44074 44075 44076 44077 44078 44079 44080 44081 44082 44083 44084 44085 44086 44087 44088 44089 44090 44091 44092 44093 44094 44095 44096 44097 44098 44099 44100 44101 44102 44103 44104 44105 44106 44107 44108 44109 44110 44111 44112 44113 44114 44115 44116 44117 44118 44119 44120 44121 44122 44123 44124 44125 44126 44127 44128 44129 44130 44131 44132 44133 44134 44135 44136 44137 44138 44139 44140 44141 44142 44143 44144 44145 44146 44147 44148 44149 44150 44151 44152 44153 44154 44155 44156 44157 44158 44159 44160 44161 44162 44163 44164 44165 44166 44167 44168 44169 44170 44171 44172 44173 44174 44175 44176 44177 44178 44179 44180 44181 44182 44183 44184 44185 44186 44187 44188 44189 44190 44191 44192 44193 44194 44195 44196 44197 44198 44199 44200 44201 44202 44203 44204 44205 44206 44207 44208 44209 44210 44211 44212 44213 44214 44215 44216 44217 44218 44219 44220 44221 44222 44223 44224 44225 44226 44227 44228 44229 44230 44231 44232 44233 44234 44235 44236 44237 44238 44239 44240 44241 44242 44243 44244 44245 44246 44247 44248 44249 44250 44251 44252 44253 44254 44255 44256 44257 44258 44259 44260 44261 44262 44263 44264 44265 44266 44267 44268 44269 44270 44271 44272 44273 44274 44275 44276 44277 44278 44279 44280 44281 44282 44283 44284 44285 44286 44287 44288 44289 44290 44291 44292 44293 44294 44295 44296 44297 44298 44299 44300 44301 44302 44303 44304 44305 44306 44307 44308 44309 44310 44311 44312 44313 44314 44315 44316 44317 44318 44319 44320 44321 44322 44323 44324 44325 44326 44327 44328 44329 44330 44331 44332 44333 44334 44335 44336 44337 44338 44339 44340 44341 44342 44343 44344 44345 44346 44347 44348 44349 44350 44351 44352 44353 44354 44355 44356 44357 44358 44359 44360 44361 44362 44363 44364 44365 44366 44367 44368 44369 44370 44371 44372 44373 44374 44375 44376 44377 44378 44379 44380 44381 44382 44383 44384 44385 44386 44387 44388 44389 44390 44391 44392 44393 44394 44395 44396 44397 44398 44399 44400 44401 44402 44403 44404 44405 44406 44407 44408 44409 44410 44411 44412 44413 44414 44415 44416 44417 44418 44419 44420 44421 44422 44423 44424 44425 44426 44427 44428 44429 44430 44431 44432 44433 44434 44435 44436 44437 44438 44439 44440 44441 44442 44443 44444 44445 44446 44447 44448 44449 44450 44451 44452 44453 44454 44455 44456 44457 44458 44459 44460 44461 44462 44463 44464 44465 44466 44467 44468 44469 44470 44471 44472 44473 44474 44475 44476 44477 44478 44479 44480 44481 44482 44483 44484 44485 44486 44487 44488 44489 44490 44491 44492 44493 44494 44495 44496 44497 44498 44499 44500 44501 44502 44503 44504 44505 44506 44507 44508 44509 44510 44511 44512 44513 44514 44515 44516 44517 44518 44519 44520 44521 44522 44523 44524 44525 44526 44527 44528 44529 44530 44531 44532 44533 44534 44535 44536 44537 44538 44539 44540 44541 44542 44543 44544 44545 44546 44547 44548 44549 44550 44551 44552 44553 44554 44555 44556 44557 44558 44559 44560 44561 44562 44563 44564 44565 44566 44567 44568 44569 44570 44571 44572 44573 44574 44575 44576 44577 44578 44579 44580 44581 44582 44583 44584 44585 44586 44587 44588 44589 44590 44591 44592 44593 44594 44595 44596 44597 44598 44599 44600 44601 44602 44603 44604 44605 44606 44607 44608 44609 44610 44611 44612 44613 44614 44615 44616 44617 44618 44619 44620 44621 44622 44623 44624 44625 44626 44627 44628 44629 44630 44631 44632 44633 44634 44635 44636 44637 44638 44639 44640 44641 44642 44643 44644 44645 44646 44647 44648 44649 44650 44651 44652 44653 44654 44655 44656 44657 44658 44659 44660 44661 44662 44663 44664 44665 44666 44667 44668 44669 44670 44671 44672 44673 44674 44675 44676 44677 44678 44679 44680 44681 44682 44683 44684 44685 44686 44687 44688 44689 44690 44691 44692 44693 44694 44695 44696 44697 44698 44699 44700 44701 44702 44703 44704 44705 44706 44707 44708 44709 44710 44711 44712 44713 44714 44715 44716 44717 44718 44719 44720 44721 44722 44723 44724 44725 44726 44727 44728 44729 44730 44731 44732 44733 44734 44735 44736 44737 44738 44739 44740 44741 44742 44743 44744 44745 44746 44747 44748 44749 44750 44751 44752 44753 44754 44755 44756 44757 44758 44759 44760 44761 44762 44763 44764 44765 44766 44767 44768 44769 44770 44771 44772 44773 44774 44775 44776 44777 44778 44779 44780 44781 44782 44783 44784 44785 44786 44787 44788 44789 44790 44791 44792 44793 44794 44795 44796 44797 44798 44799 44800 44801 44802 44803 44804 44805 44806 44807 44808 44809 44810 44811 44812 44813 44814 44815 44816 44817 44818 44819 44820 44821 44822 44823 44824 44825 44826 44827 44828 44829 44830 44831 44832 44833 44834 44835 44836 44837 44838 44839 44840 44841 44842 44843 44844 44845 44846 44847 44848 44849 44850 44851 44852 44853 44854 44855 44856 44857 44858 44859 44860 44861 44862 44863 44864 44865 44866 44867 44868 44869 44870 44871 44872 44873 44874 44875 44876 44877 44878 44879 44880 44881 44882 44883 44884 44885 44886 44887 44888 44889 44890 44891 44892 44893 44894 44895 44896 44897 44898 44899 44900 44901 44902 44903 44904 44905 44906 44907 44908 44909 44910 44911 44912 44913 44914 44915 44916 44917 44918 44919 44920 44921 44922 44923 44924 44925 44926 44927 44928 44929 44930 44931 44932 44933 44934 44935 44936 44937 44938 44939 44940 44941 44942 44943 44944 44945 44946 44947 44948 44949 44950 44951 44952 44953 44954 44955 44956 44957 44958 44959 44960 44961 44962 44963 44964 44965 44966 44967 44968 44969 44970 44971 44972 44973 44974 44975 44976 44977 44978 44979 44980 44981 44982 44983 44984 44985 44986 44987 44988 44989 44990 44991 44992 44993 44994 44995 44996 44997 44998 44999 45000 45001 45002 45003 45004 45005 45006 45007 45008 45009 45010 45011 45012 45013 45014 45015 45016 45017 45018 45019 45020 45021 45022 45023 45024 45025 45026 45027 45028 45029 45030 45031 45032 45033 45034 45035 45036 45037 45038 45039 45040 45041 45042 45043 45044 45045 45046 45047 45048 45049 45050 45051 45052 45053 45054 45055 45056 45057 45058 45059 45060 45061 45062 45063 45064 45065 45066 45067 45068 45069 45070 45071 45072 45073 45074 45075 45076 45077 45078 45079 45080 45081 45082 45083 45084 45085 45086 45087 45088 45089 45090 45091 45092 45093 45094 45095 45096 45097 45098 45099 45100 45101 45102 45103 45104 45105 45106 45107 45108 45109 45110 45111 45112 45113 45114 45115 45116 45117 45118 45119 45120 45121 45122 45123 45124 45125 45126 45127 45128 45129 45130 45131 45132 45133 45134 45135 45136 45137 45138 45139 45140 45141 45142 45143 45144 45145 45146 45147 45148 45149 45150 45151 45152 45153 45154 45155 45156 45157 45158 45159 45160 45161 45162 45163 45164 45165 45166 45167 45168 45169 45170 45171 45172 45173 45174 45175 45176 45177 45178 45179 45180 45181 45182 45183 45184 45185 45186 45187 45188 45189 45190 45191 45192 45193 45194 45195 45196 45197 45198 45199 45200 45201 45202 45203 45204 45205 45206 45207 45208 45209 45210 45211 45212 45213 45214 45215 45216 45217 45218 45219 45220 45221 45222 45223 45224 45225 45226 45227 45228 45229 45230 45231 45232 45233 45234 45235 45236 45237 45238 45239 45240 45241 45242 45243 45244 45245 45246 45247 45248 45249 45250 45251 45252 45253 45254 45255 45256 45257 45258 45259 45260 45261 45262 45263 45264 45265 45266 45267 45268 45269 45270 45271 45272 45273 45274 45275 45276 45277 45278 45279 45280 45281 45282 45283 45284 45285 45286 45287 45288 45289 45290 45291 45292 45293 45294 45295 45296 45297 45298 45299 45300 45301 45302 45303 45304 45305 45306 45307 45308 45309 45310 45311 45312 45313 45314 45315 45316 45317 45318 45319 45320 45321 45322 45323 45324 45325 45326 45327 45328 45329 45330 45331 45332 45333 45334 45335 45336 45337 45338 45339 45340 45341 45342 45343 45344 45345 45346 45347 45348 45349 45350 45351 45352 45353 45354 45355 45356 45357 45358 45359 45360 45361 45362 45363 45364 45365 45366 45367 45368 45369 45370 45371 45372 45373 45374 45375 45376 45377 45378 45379 45380 45381 45382 45383 45384 45385 45386 45387 45388 45389 45390 45391 45392 45393 45394 45395 45396 45397 45398 45399 45400 45401 45402 45403 45404 45405 45406 45407 45408 45409 45410 45411 45412 45413 45414 45415 45416 45417 45418 45419 45420 45421 45422 45423 45424 45425 45426 45427 45428 45429 45430 45431 45432 45433 45434 45435 45436 45437 45438 45439 45440 45441 45442 45443 45444 45445 45446 45447 45448 45449 45450 45451 45452 45453 45454 45455 45456 45457 45458 45459 45460 45461 45462 45463 45464 45465 45466 45467 45468 45469 45470 45471 45472 45473 45474 45475 45476 45477 45478 45479 45480 45481 45482 45483 45484 45485 45486 45487 45488 45489 45490 45491 45492 45493 45494 45495 45496 45497 45498 45499 45500 45501 45502 45503 45504 45505 45506 45507 45508 45509 45510 45511 45512 45513 45514 45515 45516 45517 45518 45519 45520 45521 45522 45523 45524 45525 45526 45527 45528 45529 45530 45531 45532 45533 45534 45535 45536 45537 45538 45539 45540 45541 45542 45543 45544 45545 45546 45547 45548 45549 45550 45551 45552 45553 45554 45555 45556 45557 45558 45559 45560 45561 45562 45563 45564 45565 45566 45567 45568 45569 45570 45571 45572 45573 45574 45575 45576 45577 45578 45579 45580 45581 45582 45583 45584 45585 45586 45587 45588 45589 45590 45591 45592 45593 45594 45595 45596 45597 45598 45599 45600 45601 45602 45603 45604 45605 45606 45607 45608 45609 45610 45611 45612 45613 45614 45615 45616 45617 45618 45619 45620 45621 45622 45623 45624 45625 45626 45627 45628 45629 45630 45631 45632 45633 45634 45635 45636 45637 45638 45639 45640 45641 45642 45643 45644 45645 45646 45647 45648 45649 45650 45651 45652 45653 45654 45655 45656 45657 45658 45659 45660 45661 45662 45663 45664 45665 45666 45667 45668 45669 45670 45671 45672 45673 45674 45675 45676 45677 45678 45679 45680 45681 45682 45683 45684 45685 45686 45687 45688 45689 45690 45691 45692 45693 45694 45695 45696 45697 45698 45699 45700 45701 45702 45703 45704 45705 45706 45707 45708 45709 45710 45711 45712 45713 45714 45715 45716 45717 45718 45719 45720 45721 45722 45723 45724 45725 45726 45727 45728 45729 45730 45731 45732 45733 45734 45735 45736 45737 45738 45739 45740 45741 45742 45743 45744 45745 45746 45747 45748 45749 45750 45751 45752 45753 45754 45755 45756 45757 45758 45759 45760 45761 45762 45763 45764 45765 45766 45767 45768 45769 45770 45771 45772 45773 45774 45775 45776 45777 45778 45779 45780 45781 45782 45783 45784 45785 45786 45787 45788 45789 45790 45791 45792 45793 45794 45795 45796 45797 45798 45799 45800 45801 45802 45803 45804 45805 45806 45807 45808 45809 45810 45811 45812 45813 45814 45815 45816 45817 45818 45819 45820 45821 45822 45823 45824 45825 45826 45827 45828 45829 45830 45831 45832 45833 45834 45835 45836 45837 45838 45839 45840 45841 45842 45843 45844 45845 45846 45847 45848 45849 45850 45851 45852 45853 45854 45855 45856 45857 45858 45859 45860 45861 45862 45863 45864 45865 45866 45867 45868 45869 45870 45871 45872 45873 45874 45875 45876 45877 45878 45879 45880 45881 45882 45883 45884 45885 45886 45887 45888 45889 45890 45891 45892 45893 45894 45895 45896 45897 45898 45899 45900 45901 45902 45903 45904 45905 45906 45907 45908 45909 45910 45911 45912 45913 45914 45915 45916 45917 45918 45919 45920 45921 45922 45923 45924 45925 45926 45927 45928 45929 45930 45931 45932 45933 45934 45935 45936 45937 45938 45939 45940 45941 45942 45943 45944 45945 45946 45947 45948 45949 45950 45951 45952 45953 45954 45955 45956 45957 45958 45959 45960 45961 45962 45963 45964 45965 45966 45967 45968 45969 45970 45971 45972 45973 45974 45975 45976 45977 45978 45979 45980 45981 45982 45983 45984 45985 45986 45987 45988 45989 45990 45991 45992 45993 45994 45995 45996 45997 45998 45999 46000 46001 46002 46003 46004 46005 46006 46007 46008 46009 46010 46011 46012 46013 46014 46015 46016 46017 46018 46019 46020 46021 46022 46023 46024 46025 46026 46027 46028 46029 46030 46031 46032 46033 46034 46035 46036 46037 46038 46039 46040 46041 46042 46043 46044 46045 46046 46047 46048 46049 46050 46051 46052 46053 46054 46055 46056 46057 46058 46059 46060 46061 46062 46063 46064 46065 46066 46067 46068 46069 46070 46071 46072 46073 46074 46075 46076 46077 46078 46079 46080 46081 46082 46083 46084 46085 46086 46087 46088 46089 46090 46091 46092 46093 46094 46095 46096 46097 46098 46099 46100 46101 46102 46103 46104 46105 46106 46107 46108 46109 46110 46111 46112 46113 46114 46115 46116 46117 46118 46119 46120 46121 46122 46123 46124 46125 46126 46127 46128 46129 46130 46131 46132 46133 46134 46135 46136 46137 46138 46139 46140 46141 46142 46143 46144 46145 46146 46147 46148 46149 46150 46151 46152 46153 46154 46155 46156 46157 46158 46159 46160 46161 46162 46163 46164 46165 46166 46167 46168 46169 46170 46171 46172 46173 46174 46175 46176 46177 46178 46179 46180 46181 46182 46183 46184 46185 46186 46187 46188 46189 46190 46191 46192 46193 46194 46195 46196 46197 46198 46199 46200 46201 46202 46203 46204 46205 46206 46207 46208 46209 46210 46211 46212 46213 46214 46215 46216 46217 46218 46219 46220 46221 46222 46223 46224 46225 46226 46227 46228 46229 46230 46231 46232 46233 46234 46235 46236 46237 46238 46239 46240 46241 46242 46243 46244 46245 46246 46247 46248 46249 46250 46251 46252 46253 46254 46255 46256 46257 46258 46259 46260 46261 46262 46263 46264 46265 46266 46267 46268 46269 46270 46271 46272 46273 46274 46275 46276 46277 46278 46279 46280 46281 46282 46283 46284 46285 46286 46287 46288 46289 46290 46291 46292 46293 46294 46295 46296 46297 46298 46299 46300 46301 46302 46303 46304 46305 46306 46307 46308 46309 46310 46311 46312 46313 46314 46315 46316 46317 46318 46319 46320 46321 46322 46323 46324 46325 46326 46327 46328 46329 46330 46331 46332 46333 46334 46335 46336 46337 46338 46339 46340 46341 46342 46343 46344 46345 46346 46347 46348 46349 46350 46351 46352 46353 46354 46355 46356 46357 46358 46359 46360 46361 46362 46363 46364 46365 46366 46367 46368 46369 46370 46371 46372 46373 46374 46375 46376 46377 46378 46379 46380 46381 46382 46383 46384 46385 46386 46387 46388 46389 46390 46391 46392 46393 46394 46395 46396 46397 46398 46399 46400 46401 46402 46403 46404 46405 46406 46407 46408 46409 46410 46411 46412 46413 46414 46415 46416 46417 46418 46419 46420 46421 46422 46423 46424 46425 46426 46427 46428 46429 46430 46431 46432 46433 46434 46435 46436 46437 46438 46439 46440 46441 46442 46443 46444 46445 46446 46447 46448 46449 46450 46451 46452 46453 46454 46455 46456 46457 46458 46459 46460 46461 46462 46463 46464 46465 46466 46467 46468 46469 46470 46471 46472 46473 46474 46475 46476 46477 46478 46479 46480 46481 46482 46483 46484 46485 46486 46487 46488 46489 46490 46491 46492 46493 46494 46495 46496 46497 46498 46499 46500 46501 46502 46503 46504 46505 46506 46507 46508 46509 46510 46511 46512 46513 46514 46515 46516 46517 46518 46519 46520 46521 46522 46523 46524 46525 46526 46527 46528 46529 46530 46531 46532 46533 46534 46535 46536 46537 46538 46539 46540 46541 46542 46543 46544 46545 46546 46547 46548 46549 46550 46551 46552 46553 46554 46555 46556 46557 46558 46559 46560 46561 46562 46563 46564 46565 46566 46567 46568 46569 46570 46571 46572 46573 46574 46575 46576 46577 46578 46579 46580 46581 46582 46583 46584 46585 46586 46587 46588 46589 46590 46591 46592 46593 46594 46595 46596 46597 46598 46599 46600 46601 46602 46603 46604 46605 46606 46607 46608 46609 46610 46611 46612 46613 46614 46615 46616 46617 46618 46619 46620 46621 46622 46623 46624 46625 46626 46627 46628 46629 46630 46631 46632 46633 46634 46635 46636 46637 46638 46639 46640 46641 46642 46643 46644 46645 46646 46647 46648 46649 46650 46651 46652 46653 46654 46655 46656 46657 46658 46659 46660 46661 46662 46663 46664 46665 46666 46667 46668 46669 46670 46671 46672 46673 46674 46675 46676 46677 46678 46679 46680 46681 46682 46683 46684 46685 46686 46687 46688 46689 46690 46691 46692 46693 46694 46695 46696 46697 46698 46699 46700 46701 46702 46703 46704 46705 46706 46707 46708 46709 46710 46711 46712 46713 46714 46715 46716 46717 46718 46719 46720 46721 46722 46723 46724 46725 46726 46727 46728 46729 46730 46731 46732 46733 46734 46735 46736 46737 46738 46739 46740 46741 46742 46743 46744 46745 46746 46747 46748 46749 46750 46751 46752 46753 46754 46755 46756 46757 46758 46759 46760 46761 46762 46763 46764 46765 46766 46767 46768 46769 46770 46771 46772 46773 46774 46775 46776 46777 46778 46779 46780 46781 46782 46783 46784 46785 46786 46787 46788 46789 46790 46791 46792 46793 46794 46795 46796 46797 46798 46799 46800 46801 46802 46803 46804 46805 46806 46807 46808 46809 46810 46811 46812 46813 46814 46815 46816 46817 46818 46819 46820 46821 46822 46823 46824 46825 46826 46827 46828 46829 46830 46831 46832 46833 46834 46835 46836 46837 46838 46839 46840 46841 46842 46843 46844 46845 46846 46847 46848 46849 46850 46851 46852 46853 46854 46855 46856 46857 46858 46859 46860 46861 46862 46863 46864 46865 46866 46867 46868 46869 46870 46871 46872 46873 46874 46875 46876 46877 46878 46879 46880 46881 46882 46883 46884 46885 46886 46887 46888 46889 46890 46891 46892 46893 46894 46895 46896 46897 46898 46899 46900 46901 46902 46903 46904 46905 46906 46907 46908 46909 46910 46911 46912 46913 46914 46915 46916 46917 46918 46919 46920 46921 46922 46923 46924 46925 46926 46927 46928 46929 46930 46931 46932 46933 46934 46935 46936 46937 46938 46939 46940 46941 46942 46943 46944 46945 46946 46947 46948 46949 46950 46951 46952 46953 46954 46955 46956 46957 46958 46959 46960 46961 46962 46963 46964 46965 46966 46967 46968 46969 46970 46971 46972 46973 46974 46975 46976 46977 46978 46979 46980 46981 46982 46983 46984 46985 46986 46987 46988 46989 46990 46991 46992 46993 46994 46995 46996 46997 46998 46999 47000 47001 47002 47003 47004 47005 47006 47007 47008 47009 47010 47011 47012 47013 47014 47015 47016 47017 47018 47019 47020 47021 47022 47023 47024 47025 47026 47027 47028 47029 47030 47031 47032 47033 47034 47035 47036 47037 47038 47039 47040 47041 47042 47043 47044 47045 47046 47047 47048 47049 47050 47051 47052 47053 47054 47055 47056 47057 47058 47059 47060 47061 47062 47063 47064 47065 47066 47067 47068 47069 47070 47071 47072 47073 47074 47075 47076 47077 47078 47079 47080 47081 47082 47083 47084 47085 47086 47087 47088 47089 47090 47091 47092 47093 47094 47095 47096 47097 47098 47099 47100 47101 47102 47103 47104 47105 47106 47107 47108 47109 47110 47111 47112 47113 47114 47115 47116 47117 47118 47119 47120 47121 47122 47123 47124 47125 47126 47127 47128 47129 47130 47131 47132 47133 47134 47135 47136 47137 47138 47139 47140 47141 47142 47143 47144 47145 47146 47147 47148 47149 47150 47151 47152 47153 47154 47155 47156 47157 47158 47159 47160 47161 47162 47163 47164 47165 47166 47167 47168 47169 47170 47171 47172 47173 47174 47175 47176 47177 47178 47179 47180 47181 47182 47183 47184 47185 47186 47187 47188 47189 47190 47191 47192 47193 47194 47195 47196 47197 47198 47199 47200 47201 47202 47203 47204 47205 47206 47207 47208 47209 47210 47211 47212 47213 47214 47215 47216 47217 47218 47219 47220 47221 47222 47223 47224 47225 47226 47227 47228 47229 47230 47231 47232 47233 47234 47235 47236 47237 47238 47239 47240 47241 47242 47243 47244 47245 47246 47247 47248 47249 47250 47251 47252 47253 47254 47255 47256 47257 47258 47259 47260 47261 47262 47263 47264 47265 47266 47267 47268 47269 47270 47271 47272 47273 47274 47275 47276 47277 47278 47279 47280 47281 47282 47283 47284 47285 47286 47287 47288 47289 47290 47291 47292 47293 47294 47295 47296 47297 47298 47299 47300 47301 47302 47303 47304 47305 47306 47307 47308 47309 47310 47311 47312 47313 47314 47315 47316 47317 47318 47319 47320 47321 47322 47323 47324 47325 47326 47327 47328 47329 47330 47331 47332 47333 47334 47335 47336 47337 47338 47339 47340 47341 47342 47343 47344 47345 47346 47347 47348 47349 47350 47351 47352 47353 47354 47355 47356 47357 47358 47359 47360 47361 47362 47363 47364 47365 47366 47367 47368 47369 47370 47371 47372 47373 47374 47375 47376 47377 47378 47379 47380 47381 47382 47383 47384 47385 47386 47387 47388 47389 47390 47391 47392 47393 47394 47395 47396 47397 47398 47399 47400 47401 47402 47403 47404 47405 47406 47407 47408 47409 47410 47411 47412 47413 47414 47415 47416 47417 47418 47419 47420 47421 47422 47423 47424 47425 47426 47427 47428 47429 47430 47431 47432 47433 47434 47435 47436 47437 47438 47439 47440 47441 47442 47443 47444 47445 47446 47447 47448 47449 47450 47451 47452 47453 47454 47455 47456 47457 47458 47459 47460 47461 47462 47463 47464 47465 47466 47467 47468 47469 47470 47471 47472 47473 47474 47475 47476 47477 47478 47479 47480 47481 47482 47483 47484 47485 47486 47487 47488 47489 47490 47491 47492 47493 47494 47495 47496 47497 47498 47499 47500 47501 47502 47503 47504 47505 47506 47507 47508 47509 47510 47511 47512 47513 47514 47515 47516 47517 47518 47519 47520 47521 47522 47523 47524 47525 47526 47527 47528 47529 47530 47531 47532 47533 47534 47535 47536 47537 47538 47539 47540 47541 47542 47543 47544 47545 47546 47547 47548 47549 47550 47551 47552 47553 47554 47555 47556 47557 47558 47559 47560 47561 47562 47563 47564 47565 47566 47567 47568 47569 47570 47571 47572 47573 47574 47575 47576 47577 47578 47579 47580 47581 47582 47583 47584 47585 47586 47587 47588 47589 47590 47591 47592 47593 47594 47595 47596 47597 47598 47599 47600 47601 47602 47603 47604 47605 47606 47607 47608 47609 47610 47611 47612 47613 47614 47615 47616 47617 47618 47619 47620 47621 47622 47623 47624 47625 47626 47627 47628 47629 47630 47631 47632 47633 47634 47635 47636 47637 47638 47639 47640 47641 47642 47643 47644 47645 47646 47647 47648 47649 47650 47651 47652 47653 47654 47655 47656 47657 47658 47659 47660 47661 47662 47663 47664 47665 47666 47667 47668 47669 47670 47671 47672 47673 47674 47675 47676 47677 47678 47679 47680 47681 47682 47683 47684 47685 47686 47687 47688 47689 47690 47691 47692 47693 47694 47695 47696 47697 47698 47699 47700 47701 47702 47703 47704 47705 47706 47707 47708 47709 47710 47711 47712 47713 47714 47715 47716 47717 47718 47719 47720 47721 47722 47723 47724 47725 47726 47727 47728 47729 47730 47731 47732 47733 47734 47735 47736 47737 47738 47739 47740 47741 47742 47743 47744 47745 47746 47747 47748 47749 47750 47751 47752 47753 47754 47755 47756 47757 47758 47759 47760 47761 47762 47763 47764 47765 47766 47767 47768 47769 47770 47771 47772 47773 47774 47775 47776 47777 47778 47779 47780 47781 47782 47783 47784 47785 47786 47787 47788 47789 47790 47791 47792 47793 47794 47795 47796 47797 47798 47799 47800 47801 47802 47803 47804 47805 47806 47807 47808 47809 47810 47811 47812 47813 47814 47815 47816 47817 47818 47819 47820 47821 47822 47823 47824 47825 47826 47827 47828 47829 47830 47831 47832 47833 47834 47835 47836 47837 47838 47839 47840 47841 47842 47843 47844 47845 47846 47847 47848 47849 47850 47851 47852 47853 47854 47855 47856 47857 47858 47859 47860 47861 47862 47863 47864 47865 47866 47867 47868 47869 47870 47871 47872 47873 47874 47875 47876 47877 47878 47879 47880 47881 47882 47883 47884 47885 47886 47887 47888 47889 47890 47891 47892 47893 47894 47895 47896 47897 47898 47899 47900 47901 47902 47903 47904 47905 47906 47907 47908 47909 47910 47911 47912 47913 47914 47915 47916 47917 47918 47919 47920 47921 47922 47923 47924 47925 47926 47927 47928 47929 47930 47931 47932 47933 47934 47935 47936 47937 47938 47939 47940 47941 47942 47943 47944 47945 47946 47947 47948 47949 47950 47951 47952 47953 47954 47955 47956 47957 47958 47959 47960 47961 47962 47963 47964 47965 47966 47967 47968 47969 47970 47971 47972 47973 47974 47975 47976 47977 47978 47979 47980 47981 47982 47983 47984 47985 47986 47987 47988 47989 47990 47991 47992 47993 47994 47995 47996 47997 47998 47999 48000 48001 48002 48003 48004 48005 48006 48007 48008 48009 48010 48011 48012 48013 48014 48015 48016 48017 48018 48019 48020 48021 48022 48023 48024 48025 48026 48027 48028 48029 48030 48031 48032 48033 48034 48035 48036 48037 48038 48039 48040 48041 48042 48043 48044 48045 48046 48047 48048 48049 48050 48051 48052 48053 48054 48055 48056 48057 48058 48059 48060 48061 48062 48063 48064 48065 48066 48067 48068 48069 48070 48071 48072 48073 48074 48075 48076 48077 48078 48079 48080 48081 48082 48083 48084 48085 48086 48087 48088 48089 48090 48091 48092 48093 48094 48095 48096 48097 48098 48099 48100 48101 48102 48103 48104 48105 48106 48107 48108 48109 48110 48111 48112 48113 48114 48115 48116 48117 48118 48119 48120 48121 48122 48123 48124 48125 48126 48127 48128 48129 48130 48131 48132 48133 48134 48135 48136 48137 48138 48139 48140 48141 48142 48143 48144 48145 48146 48147 48148 48149 48150 48151 48152 48153 48154 48155 48156 48157 48158 48159 48160 48161 48162 48163 48164 48165 48166 48167 48168 48169 48170 48171 48172 48173 48174 48175 48176 48177 48178 48179 48180 48181 48182 48183 48184 48185 48186 48187 48188 48189 48190 48191 48192 48193 48194 48195 48196 48197 48198 48199 48200 48201 48202 48203 48204 48205 48206 48207 48208 48209 48210 48211 48212 48213 48214 48215 48216 48217 48218 48219 48220 48221 48222 48223 48224 48225 48226 48227 48228 48229 48230 48231 48232 48233 48234 48235 48236 48237 48238 48239 48240 48241 48242 48243 48244 48245 48246 48247 48248 48249 48250 48251 48252 48253 48254 48255 48256 48257 48258 48259 48260 48261 48262 48263 48264 48265 48266 48267 48268 48269 48270 48271 48272 48273 48274 48275 48276 48277 48278 48279 48280 48281 48282 48283 48284 48285 48286 48287 48288 48289 48290 48291 48292 48293 48294 48295 48296 48297 48298 48299 48300 48301 48302 48303 48304 48305 48306 48307 48308 48309 48310 48311 48312 48313 48314 48315 48316 48317 48318 48319 48320 48321 48322 48323 48324 48325 48326 48327 48328 48329 48330 48331 48332 48333 48334 48335 48336 48337 48338 48339 48340 48341 48342 48343 48344 48345 48346 48347 48348 48349 48350 48351 48352 48353 48354 48355 48356 48357 48358 48359 48360 48361 48362 48363 48364 48365 48366 48367 48368 48369 48370 48371 48372 48373 48374 48375 48376 48377 48378 48379 48380 48381 48382 48383 48384 48385 48386 48387 48388 48389 48390 48391 48392 48393 48394 48395 48396 48397 48398 48399 48400 48401 48402 48403 48404 48405 48406 48407 48408 48409 48410 48411 48412 48413 48414 48415 48416 48417 48418 48419 48420 48421 48422 48423 48424 48425 48426 48427 48428 48429 48430 48431 48432 48433 48434 48435 48436 48437 48438 48439 48440 48441 48442 48443 48444 48445 48446 48447 48448 48449 48450 48451 48452 48453 48454 48455 48456 48457 48458 48459 48460 48461 48462 48463 48464 48465 48466 48467 48468 48469 48470 48471 48472 48473 48474 48475 48476 48477 48478 48479 48480 48481 48482 48483 48484 48485 48486 48487 48488 48489 48490 48491 48492 48493 48494 48495 48496 48497 48498 48499 48500 48501 48502 48503 48504 48505 48506 48507 48508 48509 48510 48511 48512 48513 48514 48515 48516 48517 48518 48519 48520 48521 48522 48523 48524 48525 48526 48527 48528 48529 48530 48531 48532 48533 48534 48535 48536 48537 48538 48539 48540 48541 48542 48543 48544 48545 48546 48547 48548 48549 48550 48551 48552 48553 48554 48555 48556 48557 48558 48559 48560 48561 48562 48563 48564 48565 48566 48567 48568 48569 48570 48571 48572 48573 48574 48575 48576 48577 48578 48579 48580 48581 48582 48583 48584 48585 48586 48587 48588 48589 48590 48591 48592 48593 48594 48595 48596 48597 48598 48599 48600 48601 48602 48603 48604 48605 48606 48607 48608 48609 48610 48611 48612 48613 48614 48615 48616 48617 48618 48619 48620 48621 48622 48623 48624 48625 48626 48627 48628 48629 48630 48631 48632 48633 48634 48635 48636 48637 48638 48639 48640 48641 48642 48643 48644 48645 48646 48647 48648 48649 48650 48651 48652 48653 48654 48655 48656 48657 48658 48659 48660 48661 48662 48663 48664 48665 48666 48667 48668 48669 48670 48671 48672 48673 48674 48675 48676 48677 48678 48679 48680 48681 48682 48683 48684 48685 48686 48687 48688 48689 48690 48691 48692 48693 48694 48695 48696 48697 48698 48699 48700 48701 48702 48703 48704 48705 48706 48707 48708 48709 48710 48711 48712 48713 48714 48715 48716 48717 48718 48719 48720 48721 48722 48723 48724 48725
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.2, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual is last updated 9 February 2026 for version
3.8.12 of GnuTLS.
Copyright © 2001-2026 Free Software Foundation, Inc.\\
Copyright © 2001-2026 Nikos Mavrogiannopoulos
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License". -->
<title>GnuTLS 3.8.12</title>
<meta name="description" content="GnuTLS 3.8.12">
<meta name="keywords" content="GnuTLS 3.8.12">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="#Top" rel="start" title="Top">
<link href="#Function-and-Data-Index" rel="index" title="Function and Data Index">
<link href="#SEC_Contents" rel="contents" title="Table of Contents">
<link href="#Preface" rel="next" title="Preface">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
a.summary-letter-printindex {text-decoration: none}
div.center {text-align:center}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
pre.display-preformatted {font-family: inherit}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
td.printindex-index-entry {vertical-align: top}
td.printindex-index-section {vertical-align: top; padding-left: 1em}
th.entries-header-printindex {text-align:left}
th.sections-header-printindex {text-align:left; padding-left: 1em}
ul.mark-bullet {list-style-type: disc}
ul.toc-numbered-mark {list-style: none}
body {
margin: 2%;
padding: 0 5%;
background: #ffffff;
}
h1,h2,h3,h4,h5 {
font-weight: bold;
padding: 5px 5px 5px 5px;
background-color: #c2e0ff;
color: #336699;
}
h1 {
padding: 2em 2em 2em 5%;
color: white;
background: #336699;
text-align: center;
letter-spacing: 3px;
}
h2 { text-decoration: underline; }
pre {
margin: 0 5%;
padding: 0.5em;
}
pre.example,pre.verbatim {
padding-bottom: 1em;
border: solid #c2e0ff;
background: #f0faff;
border-width: 1px 1px 1px 5px;
margin: 1em auto;
width: 90%;
}
div.node {
margin: 0 -5% 0 -2%;
padding: 0.5em 0.5em;
margin-top: 0.5em;
margin-bottom: 0.5em;
font-weight: bold;
}
dd, li {
padding-top: 0.1em;
padding-bottom: 0.1em;
}
div.float {
margin-bottom: 0.5em;
text-align: center;
}
table {
text-align: left;
margin-left:auto;
margin-right:auto;
border-spacing: 7px;
width: 50%;
}
th {
padding: 0;
color: #336699;
background-color: #c2e0ff;
border: solid #000000;
border-width: 0px;
margin: 1em auto;
text-align: center;
margin-left:auto;
margin-right:auto;
}
td {
padding: 0;
border: solid #000000;
background-color: #f0faff;
border-width: 0px;
margin: 1em auto;
text-align: left;
margin-left:auto;
margin-right:auto;
padding-left: 1em;
}
dl {
text-align: left;
margin-left:auto;
margin-right:auto;
width: 50%;
padding-left: 1em;
border: solid #c2e0ff;
background: #f0faff;
border-width: 5px 1px 1px 1px;
margin: 1em auto;
}
-->
</style>
</head>
<body lang="en">
<div class="top-level-extent" id="Top">
<div class="nav-panel">
<p>
Next: <a href="#Preface" accesskey="n" rel="next">Preface</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h1 class="top" id="GnuTLS"><span>GnuTLS<a class="copiable-link" href="#GnuTLS"> ¶</a></span></h1>
<p>This manual is last updated 9 February 2026 for version
3.8.12 of GnuTLS.
</p>
<p>Copyright © 2001-2026 Free Software Foundation, Inc.\\
Copyright © 2001-2026 Nikos Mavrogiannopoulos
</p>
<blockquote class="quotation">
<p>Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled “GNU Free
Documentation License”.
</p></blockquote>
<div class="region-contents" id="SEC_Contents">
<h2 class="contents-heading">Table of Contents</h2>
<div class="contents">
<ul class="toc-numbered-mark">
<li><a id="toc-Preface" href="#Preface">1 Preface</a></li>
<li><a id="toc-Introduction-to-GnuTLS" href="#Introduction-to-GnuTLS">2 Introduction to GnuTLS</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Downloading-and-installing" href="#Downloading-and-installing">2.1 Downloading and installing</a></li>
<li><a id="toc-Installing-for-a-software-distribution" href="#Installing-for-a-software-distribution">2.2 Installing for a software distribution</a></li>
<li><a id="toc-Overview" href="#Document-overview">2.3 Overview</a></li>
</ul></li>
<li><a id="toc-Introduction-to-TLS-and-DTLS" href="#Introduction-to-TLS">3 Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a>
<ul class="toc-numbered-mark">
<li><a id="toc-TLS-Layers" href="#TLS-layers">3.1 TLS Layers</a></li>
<li><a id="toc-The-Transport-Layer" href="#The-transport-layer">3.2 The Transport Layer</a></li>
<li><a id="toc-The-TLS-record-protocol" href="#The-TLS-record-protocol">3.3 The TLS record protocol</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Encryption-algorithms-used-in-the-record-layer" href="#Encryption-algorithms-used-in-the-record-layer">3.3.1 Encryption algorithms used in the record layer</a></li>
<li><a id="toc-Compression-algorithms-and-the-record-layer" href="#Compression-algorithms-and-the-record-layer">3.3.2 Compression algorithms and the record layer</a></li>
<li><a id="toc-On-record-padding" href="#On-Record-Padding">3.3.3 On record padding</a></li>
</ul></li>
<li><a id="toc-The-TLS-alert-protocol" href="#The-TLS-Alert-Protocol">3.4 The TLS alert protocol</a></li>
<li><a id="toc-The-TLS-handshake-protocol" href="#The-TLS-Handshake-Protocol">3.5 The TLS handshake protocol</a>
<ul class="toc-numbered-mark">
<li><a id="toc-TLS-ciphersuites" href="#TLS-Cipher-Suites">3.5.1 TLS ciphersuites</a></li>
<li><a id="toc-Authentication" href="#Authentication">3.5.2 Authentication</a></li>
<li><a id="toc-Client-authentication" href="#Client-Authentication">3.5.3 Client authentication</a></li>
<li><a id="toc-Resuming-sessions" href="#Resuming-Sessions">3.5.4 Resuming sessions</a></li>
</ul></li>
<li><a id="toc-TLS-extensions" href="#TLS-Extensions">3.6 TLS extensions</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Maximum-fragment-length-negotiation" href="#Maximum-fragment-length-negotiation">3.6.1 Maximum fragment length negotiation</a></li>
<li><a id="toc-Server-name-indication" href="#Server-name-indication">3.6.2 Server name indication</a></li>
<li><a id="toc-Session-tickets" href="#Session-tickets">3.6.3 Session tickets</a></li>
<li><a id="toc-HeartBeat" href="#HeartBeat">3.6.4 HeartBeat</a></li>
<li><a id="toc-Safe-renegotiation" href="#Safe-renegotiation">3.6.5 Safe renegotiation</a></li>
<li><a id="toc-OCSP-status-request" href="#OCSP-status-request">3.6.6 OCSP status request</a></li>
<li><a id="toc-SRTP" href="#SRTP">3.6.7 SRTP</a></li>
<li><a id="toc-False-Start" href="#False-Start">3.6.8 False Start</a></li>
<li><a id="toc-Application-Layer-Protocol-Negotiation-_0028ALPN_0029" href="#Application-Layer-Protocol-Negotiation-_0028ALPN_0029">3.6.9 Application Layer Protocol Negotiation (ALPN)</a></li>
<li><a id="toc-Extensions-and-Supplemental-Data" href="#Extensions-and-Supplemental-Data">3.6.10 Extensions and Supplemental Data</a></li>
</ul></li>
<li><a id="toc-How-to-use-TLS-in-application-protocols" href="#How-to-use-TLS-in-application-protocols">3.7 How to use <abbr class="acronym">TLS</abbr> in application protocols</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Separate-ports" href="#Separate-ports">3.7.1 Separate ports</a></li>
<li><a id="toc-Upward-negotiation" href="#Upward-negotiation">3.7.2 Upward negotiation</a></li>
</ul></li>
<li><a id="toc-On-SSL-2-and-older-protocols" href="#On-SSL-2-and-older-protocols">3.8 On SSL 2 and older protocols</a></li>
</ul></li>
<li><a id="toc-Authentication-methods" href="#Authentication-methods">4 Authentication methods</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Certificate-authentication" href="#Certificate-authentication">4.1 Certificate authentication</a>
<ul class="toc-numbered-mark">
<li><a id="toc-X_002e509-certificates" href="#X_002e509-certificates">4.1.1 <abbr class="acronym">X.509</abbr> certificates</a>
<ul class="toc-numbered-mark">
<li><a id="toc-X_002e509-certificate-structure" href="#X_002e509-certificate-structure">4.1.1.1 <abbr class="acronym">X.509</abbr> certificate structure</a></li>
<li><a id="toc-Importing-an-X_002e509-certificate" href="#Importing-an-X_002e509-certificate">4.1.1.2 Importing an X.509 certificate</a></li>
<li><a id="toc-X_002e509-certificate-names" href="#X_002e509-certificate-names">4.1.1.3 X.509 certificate names</a></li>
<li><a id="toc-X_002e509-distinguished-names" href="#X_002e509-distinguished-names">4.1.1.4 X.509 distinguished names</a></li>
<li><a id="toc-X_002e509-extensions" href="#X_002e509-extensions">4.1.1.5 X.509 extensions</a></li>
<li><a id="toc-Accessing-public-and-private-keys" href="#X_002e509-public-and-private-keys">4.1.1.6 Accessing public and private keys</a></li>
<li><a id="toc-Verifying-X_002e509-certificate-paths" href="#Verifying-X_002e509-certificate-paths">4.1.1.7 Verifying <abbr class="acronym">X.509</abbr> certificate paths</a></li>
<li><a id="toc-Verifying-a-certificate-in-the-context-of-TLS-session" href="#Verifying-a-certificate-in-the-context-of-TLS-session">4.1.1.8 Verifying a certificate in the context of TLS session</a></li>
<li><a id="toc-Verifying-a-certificate-using-PKCS-_002311" href="#Verification-using-PKCS11">4.1.1.9 Verifying a certificate using PKCS #11</a></li>
</ul></li>
<li><a id="toc-OpenPGP-certificates" href="#OpenPGP-certificates">4.1.2 <abbr class="acronym">OpenPGP</abbr> certificates</a></li>
<li><a id="toc-Raw-public_002dkeys" href="#Raw-public_002dkeys">4.1.3 Raw public-keys</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Importing-raw-public_002dkeys" href="#Importing-raw-public_002dkeys">4.1.3.1 Importing raw public-keys</a></li>
</ul></li>
<li><a id="toc-Advanced-certificate-verification" href="#Advanced-certificate-verification">4.1.4 Advanced certificate verification</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Verifying-a-certificate-using-trust-on-first-use-authentication" href="#Verifying-a-certificate-using-trust-on-first-use-authentication">4.1.4.1 Verifying a certificate using trust on first use authentication</a></li>
<li><a id="toc-Verifying-a-certificate-using-DANE-_0028DNSSEC_0029" href="#Verifying-a-certificate-using-DANE">4.1.4.2 Verifying a certificate using DANE (DNSSEC)</a></li>
</ul></li>
<li><a id="toc-Digital-signatures" href="#Digital-signatures">4.1.5 Digital signatures</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Trading-security-for-interoperability" href="#Trading-security-for-interoperability">4.1.5.1 Trading security for interoperability</a></li>
</ul></li>
</ul></li>
<li><a id="toc-More-on-certificate-authentication" href="#More-on-certificate-authentication">4.2 More on certificate authentication</a>
<ul class="toc-numbered-mark">
<li><a id="toc-PKCS-_002310-certificate-requests" href="#PKCS-10-certificate-requests">4.2.1 <abbr class="acronym">PKCS</abbr> #10 certificate requests</a></li>
<li><a id="toc-PKIX-certificate-revocation-lists" href="#PKIX-certificate-revocation-lists">4.2.2 PKIX certificate revocation lists</a></li>
<li><a id="toc-OCSP-certificate-status-checking" href="#OCSP-certificate-status-checking">4.2.3 <abbr class="acronym">OCSP</abbr> certificate status checking</a></li>
<li><a id="toc-OCSP-stapling" href="#OCSP-stapling">4.2.4 OCSP stapling</a></li>
<li><a id="toc-Managing-encrypted-keys" href="#Managing-encrypted-keys">4.2.5 Managing encrypted keys</a></li>
<li><a id="toc-Invoking-certtool" href="#certtool-Invocation">4.2.6 Invoking certtool</a></li>
<li><a id="toc-Invoking-ocsptool" href="#ocsptool-Invocation">4.2.7 Invoking ocsptool</a></li>
<li><a id="toc-Invoking-danetool" href="#danetool-Invocation">4.2.8 Invoking danetool</a></li>
</ul></li>
<li><a id="toc-Shared_002dkey-and-anonymous-authentication" href="#Shared_002dkey-and-anonymous-authentication">4.3 Shared-key and anonymous authentication</a>
<ul class="toc-numbered-mark">
<li><a id="toc-PSK-authentication" href="#PSK-authentication">4.3.1 PSK authentication</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Authentication-using-PSK" href="#Authentication-using-PSK">4.3.1.1 Authentication using <abbr class="acronym">PSK</abbr></a></li>
<li><a id="toc-Invoking-psktool" href="#psktool-Invocation">4.3.1.2 Invoking psktool</a></li>
</ul></li>
<li><a id="toc-SRP-authentication" href="#SRP-authentication">4.3.2 SRP authentication</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Authentication-using-SRP" href="#Authentication-using-SRP">4.3.2.1 Authentication using <abbr class="acronym">SRP</abbr></a></li>
<li><a id="toc-Invoking-srptool" href="#srptool-Invocation">4.3.2.2 Invoking srptool</a></li>
</ul></li>
<li><a id="toc-Anonymous-authentication" href="#Anonymous-authentication">4.3.3 Anonymous authentication</a></li>
</ul></li>
<li><a id="toc-Selecting-an-appropriate-authentication-method" href="#Selecting-an-appropriate-authentication-method">4.4 Selecting an appropriate authentication method</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Two-peers-with-an-out_002dof_002dband-channel" href="#Two-peers-with-an-out_002dof_002dband-channel">4.4.1 Two peers with an out-of-band channel</a></li>
<li><a id="toc-Two-peers-without-an-out_002dof_002dband-channel" href="#Two-peers-without-an-out_002dof_002dband-channel">4.4.2 Two peers without an out-of-band channel</a></li>
<li><a id="toc-Two-peers-and-a-trusted-third-party" href="#Two-peers-and-a-trusted-third-party">4.4.3 Two peers and a trusted third party</a></li>
</ul></li>
</ul></li>
<li><a id="toc-Abstract-key-types-and-Hardware-security-modules" href="#Hardware-security-modules-and-abstract-key-types">5 Abstract key types and Hardware security modules</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Abstract-key-types" href="#Abstract-key-types">5.1 Abstract key types</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Public-keys" href="#Abstract-public-keys">5.1.1 Public keys</a></li>
<li><a id="toc-Private-keys" href="#Abstract-private-keys">5.1.2 Private keys</a></li>
<li><a id="toc-Operations" href="#Operations">5.1.3 Operations</a></li>
</ul></li>
<li><a id="toc-System-and-application_002dspecific-keys" href="#Application_002dspecific-keys">5.2 System and application-specific keys</a>
<ul class="toc-numbered-mark">
<li><a id="toc-System_002dspecific-keys" href="#System_002dspecific-keys">5.2.1 System-specific keys</a></li>
<li><a id="toc-Application_002dspecific-keys" href="#Application_002dspecific-keys-1">5.2.2 Application-specific keys</a></li>
</ul></li>
<li><a id="toc-Smart-cards-and-HSMs" href="#Smart-cards-and-HSMs">5.3 Smart cards and HSMs</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Initialization" href="#PKCS11-Initialization">5.3.1 Initialization</a></li>
<li><a id="toc-Manual-initialization-of-user_002dspecific-modules" href="#PKCS11-Manual-Initialization">5.3.2 Manual initialization of user-specific modules</a></li>
<li><a id="toc-Accessing-objects-that-require-a-PIN" href="#Accessing-objects-that-require-a-PIN">5.3.3 Accessing objects that require a PIN</a></li>
<li><a id="toc-Reading-objects" href="#Reading-objects">5.3.4 Reading objects</a></li>
<li><a id="toc-Writing-objects" href="#Writing-objects">5.3.5 Writing objects</a></li>
<li><a id="toc-Low-Level-Access" href="#PKCS11-Low-Level-Access">5.3.6 Low Level Access</a></li>
<li><a id="toc-Using-a-PKCS-_002311-token-with-TLS" href="#Using-a-PKCS11-token-with-TLS">5.3.7 Using a <abbr class="acronym">PKCS</abbr> #11 token with TLS</a></li>
<li><a id="toc-Verifying-certificates-over-PKCS-_002311" href="#Verifying-certificates-over-PKCS11">5.3.8 Verifying certificates over <abbr class="acronym">PKCS</abbr> #11</a></li>
<li><a id="toc-Invoking-p11tool" href="#p11tool-Invocation">5.3.9 Invoking p11tool</a></li>
</ul></li>
<li><a id="toc-Trusted-Platform-Module-_0028TPM_0029" href="#Trusted-Platform-Module">5.4 Trusted Platform Module (TPM)</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Keys-in-TPM" href="#Keys-in-TPM">5.4.1 Keys in TPM</a></li>
<li><a id="toc-Key-generation" href="#Key-generation">5.4.2 Key generation</a></li>
<li><a id="toc-Using-keys" href="#Using-keys">5.4.3 Using keys</a></li>
<li><a id="toc-Invoking-tpmtool" href="#tpmtool-Invocation">5.4.4 Invoking tpmtool</a></li>
</ul></li>
</ul></li>
<li><a id="toc-How-to-use-GnuTLS-in-applications" href="#How-to-use-GnuTLS-in-applications">6 How to use <abbr class="acronym">GnuTLS</abbr> in applications</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Introduction" href="#Introduction-to-the-library">6.1 Introduction</a>
<ul class="toc-numbered-mark">
<li><a id="toc-General-idea" href="#General-idea">6.1.1 General idea</a></li>
<li><a id="toc-Error-handling" href="#Error-handling">6.1.2 Error handling</a></li>
<li><a id="toc-Common-types" href="#Common-types">6.1.3 Common types</a></li>
<li><a id="toc-Debugging-and-auditing" href="#Debugging-and-auditing">6.1.4 Debugging and auditing</a></li>
<li><a id="toc-Thread-safety" href="#Thread-safety">6.1.5 Thread safety</a></li>
<li><a id="toc-Running-in-a-sandbox" href="#Running-in-a-sandbox">6.1.6 Running in a sandbox</a></li>
<li><a id="toc-Sessions-and-fork" href="#Sessions-and-fork">6.1.7 Sessions and fork</a></li>
<li><a id="toc-Callback-functions" href="#Callback-functions">6.1.8 Callback functions</a></li>
</ul></li>
<li><a id="toc-Preparation" href="#Preparation">6.2 Preparation</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Headers" href="#Headers">6.2.1 Headers</a></li>
<li><a id="toc-Initialization-1" href="#Initialization">6.2.2 Initialization</a></li>
<li><a id="toc-Version-check" href="#Version-check">6.2.3 Version check</a></li>
<li><a id="toc-Building-the-source" href="#Building-the-source">6.2.4 Building the source</a></li>
</ul></li>
<li><a id="toc-Session-initialization" href="#Session-initialization">6.3 Session initialization</a></li>
<li><a id="toc-Associating-the-credentials" href="#Associating-the-credentials">6.4 Associating the credentials</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Certificates" href="#Certificate-credentials">6.4.1 Certificates</a></li>
<li><a id="toc-Raw-public_002dkeys-1" href="#Raw-public_002dkey-credentials">6.4.2 Raw public-keys</a></li>
<li><a id="toc-SRP" href="#SRP-credentials">6.4.3 SRP</a></li>
<li><a id="toc-PSK" href="#PSK-credentials">6.4.4 PSK</a></li>
<li><a id="toc-Anonymous" href="#Anonymous-credentials">6.4.5 Anonymous</a></li>
</ul></li>
<li><a id="toc-Setting-up-the-transport-layer" href="#Setting-up-the-transport-layer">6.5 Setting up the transport layer</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Asynchronous-operation" href="#Asynchronous-operation">6.5.1 Asynchronous operation</a>
<ul class="toc-numbered-mark">
<li><a id="toc-TLS-protocol" href="#TLS-protocol">6.5.1.1 TLS protocol</a></li>
<li><a id="toc-Datagram-TLS-protocol" href="#Datagram-TLS-protocol">6.5.1.2 Datagram TLS protocol</a></li>
</ul></li>
<li><a id="toc-Reducing-round_002dtrips" href="#Reducing-round_002dtrips">6.5.2 Reducing round-trips</a></li>
<li><a id="toc-Zero_002droundtrip-mode" href="#Zero_002droundtrip-mode">6.5.3 Zero-roundtrip mode</a></li>
<li><a id="toc-Anti_002dreplay-protection" href="#Anti_002dreplay-protection">6.5.4 Anti-replay protection</a></li>
<li><a id="toc-DTLS-sessions" href="#DTLS-sessions">6.5.5 DTLS sessions</a></li>
<li><a id="toc-DTLS-and-SCTP" href="#DTLS-and-SCTP">6.5.6 DTLS and SCTP</a></li>
</ul></li>
<li><a id="toc-TLS-handshake" href="#TLS-handshake">6.6 TLS handshake</a></li>
<li><a id="toc-Data-transfer-and-termination" href="#Data-transfer-and-termination">6.7 Data transfer and termination</a></li>
<li><a id="toc-Buffered-data-transfer" href="#Buffered-data-transfer">6.8 Buffered data transfer</a></li>
<li><a id="toc-Handling-alerts" href="#Handling-alerts">6.9 Handling alerts</a></li>
<li><a id="toc-Priority-strings" href="#Priority-Strings">6.10 Priority strings</a></li>
<li><a id="toc-Selecting-cryptographic-key-sizes" href="#Selecting-cryptographic-key-sizes">6.11 Selecting cryptographic key sizes</a></li>
<li><a id="toc-Advanced-topics" href="#Advanced-topics">6.12 Advanced topics</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Virtual-hosts-and-credentials" href="#Virtual-hosts-and-credentials">6.12.1 Virtual hosts and credentials</a></li>
<li><a id="toc-Session-resumption" href="#Session-resumption">6.12.2 Session resumption</a></li>
<li><a id="toc-Certificate-verification" href="#Certificate-verification">6.12.3 Certificate verification</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Trust-on-first-use" href="#Trust-on-first-use">6.12.3.1 Trust on first use</a></li>
<li><a id="toc-DANE-verification" href="#DANE-verification">6.12.3.2 DANE verification</a></li>
</ul></li>
<li><a id="toc-TLS-1_002e2-re_002dauthentication" href="#TLS-1_002e2-re_002dauthentication">6.12.4 TLS 1.2 re-authentication</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Client-side" href="#Client-side">6.12.4.1 Client side</a></li>
<li><a id="toc-Server-side" href="#Server-side">6.12.4.2 Server side</a></li>
</ul></li>
<li><a id="toc-TLS-1_002e3-re_002dauthentication-and-re_002dkey" href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey">6.12.5 TLS 1.3 re-authentication and re-key</a></li>
<li><a id="toc-Parameter-generation" href="#Parameter-generation">6.12.6 Parameter generation</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Legacy-parameter-generation" href="#Legacy-parameter-generation">6.12.6.1 Legacy parameter generation</a></li>
</ul></li>
<li><a id="toc-Deriving-keys-for-other-applications_002fprotocols" href="#Deriving-keys-for-other-applications_002fprotocols">6.12.7 Deriving keys for other applications/protocols</a></li>
<li><a id="toc-Channel-bindings" href="#Channel-Bindings">6.12.8 Channel bindings</a></li>
<li><a id="toc-Interoperability" href="#Interoperability">6.12.9 Interoperability</a></li>
<li><a id="toc-Compatibility-with-the-OpenSSL-library" href="#Compatibility-with-the-OpenSSL-library">6.12.10 Compatibility with the OpenSSL library</a></li>
</ul></li>
</ul></li>
<li><a id="toc-GnuTLS-application-examples" href="#GnuTLS-application-examples">7 GnuTLS application examples</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Client-examples" href="#Client-examples">7.1 Client examples</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Client-example-with-X_002e509-certificate-support" href="#Client-example-with-X_002e509-certificate-support">7.1.1 Client example with <abbr class="acronym">X.509</abbr> certificate support</a></li>
<li><a id="toc-Datagram-TLS-client-example" href="#Datagram-TLS-client-example">7.1.2 Datagram <abbr class="acronym">TLS</abbr> client example</a></li>
<li><a id="toc-Using-a-smart-card-with-TLS" href="#Client-using-a-smart-card-with-TLS">7.1.3 Using a smart card with TLS</a></li>
<li><a id="toc-Client-with-resume-capability-example" href="#Client-with-Resume-capability-example">7.1.4 Client with resume capability example</a></li>
<li><a id="toc-Client-example-with-SSH_002dstyle-certificate-verification" href="#Client-example-with-SSH_002dstyle-certificate-verification">7.1.5 Client example with SSH-style certificate verification</a></li>
</ul></li>
<li><a id="toc-Server-examples" href="#Server-examples">7.2 Server examples</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Echo-server-with-X_002e509-authentication" href="#Echo-server-with-X_002e509-authentication">7.2.1 Echo server with <abbr class="acronym">X.509</abbr> authentication</a></li>
<li><a id="toc-DTLS-echo-server-with-X_002e509-authentication" href="#DTLS-echo-server-with-X_002e509-authentication">7.2.2 DTLS echo server with <abbr class="acronym">X.509</abbr> authentication</a></li>
</ul></li>
<li><a id="toc-More-advanced-client-and-servers" href="#More-advanced-client-and-servers">7.3 More advanced client and servers</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Client-example-with-anonymous-authentication" href="#Client-example-with-anonymous-authentication">7.3.1 Client example with anonymous authentication</a></li>
<li><a id="toc-Using-a-callback-to-select-the-certificate-to-use" href="#Using-a-callback-to-select-the-certificate-to-use">7.3.2 Using a callback to select the certificate to use</a></li>
<li><a id="toc-Obtaining-session-information" href="#Obtaining-session-information">7.3.3 Obtaining session information</a></li>
<li><a id="toc-Advanced-certificate-verification-1" href="#Advanced-certificate-verification-example">7.3.4 Advanced certificate verification</a></li>
<li><a id="toc-Client-example-with-PSK-authentication" href="#Client-example-with-PSK-authentication">7.3.5 Client example with <abbr class="acronym">PSK</abbr> authentication</a></li>
<li><a id="toc-Client-example-with-SRP-authentication" href="#Client-example-with-SRP-authentication">7.3.6 Client example with <abbr class="acronym">SRP</abbr> authentication</a></li>
<li><a id="toc-Legacy-client-example-with-X_002e509-certificate-support" href="#Legacy-client-example-with-X_002e509-certificate-support">7.3.7 Legacy client example with <abbr class="acronym">X.509</abbr> certificate support</a></li>
<li><a id="toc-Client-example-using-the-C_002b_002b-API" href="#Client-example-in-C_002b_002b">7.3.8 Client example using the C++ API</a></li>
<li><a id="toc-Echo-server-with-PSK-authentication" href="#Echo-server-with-PSK-authentication">7.3.9 Echo server with <abbr class="acronym">PSK</abbr> authentication</a></li>
<li><a id="toc-Echo-server-with-SRP-authentication" href="#Echo-server-with-SRP-authentication">7.3.10 Echo server with <abbr class="acronym">SRP</abbr> authentication</a></li>
<li><a id="toc-Echo-server-with-anonymous-authentication" href="#Echo-server-with-anonymous-authentication">7.3.11 Echo server with anonymous authentication</a></li>
<li><a id="toc-Helper-functions-for-TCP-connections" href="#Helper-functions-for-TCP-connections">7.3.12 Helper functions for TCP connections</a></li>
<li><a id="toc-Helper-functions-for-UDP-connections" href="#Helper-functions-for-UDP-connections">7.3.13 Helper functions for UDP connections</a></li>
</ul></li>
<li><a id="toc-OCSP-example" href="#OCSP-example">7.4 OCSP example</a></li>
<li><a id="toc-Miscellaneous-examples" href="#Miscellaneous-examples">7.5 Miscellaneous examples</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Checking-for-an-alert" href="#Checking-for-an-alert">7.5.1 Checking for an alert</a></li>
<li><a id="toc-X_002e509-certificate-parsing-example" href="#X_002e509-certificate-parsing-example">7.5.2 <abbr class="acronym">X.509</abbr> certificate parsing example</a></li>
<li><a id="toc-Listing-the-ciphersuites-in-a-priority-string" href="#Listing-the-ciphersuites-in-a-priority-string">7.5.3 Listing the ciphersuites in a priority string</a></li>
<li><a id="toc-PKCS-_002312-structure-generation-example" href="#PKCS12-structure-generation-example">7.5.4 PKCS #12 structure generation example</a></li>
</ul></li>
</ul></li>
<li><a id="toc-System_002dwide-configuration-of-the-library" href="#System_002dwide-configuration-of-the-library">8 System-wide configuration of the library</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Application_002dspecific-priority-strings" href="#Application_002dspecific-priority-strings">8.1 Application-specific priority strings</a></li>
<li><a id="toc-Disabling-algorithms-and-protocols" href="#Disabling-algorithms-and-protocols">8.2 Disabling algorithms and protocols</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Examples" href="#Examples">8.2.1 Examples</a></li>
</ul></li>
<li><a id="toc-Querying-for-disabled-algorithms-and-protocols" href="#Querying-for-disabled-algorithms-and-protocols">8.3 Querying for disabled algorithms and protocols</a></li>
<li><a id="toc-Overriding-the-parameter-verification-profile" href="#Overriding-the-parameter-verification-profile">8.4 Overriding the parameter verification profile</a></li>
<li><a id="toc-Overriding-the-default-priority-string" href="#Overriding-the-default-priority-string">8.5 Overriding the default priority string</a></li>
<li><a id="toc-Enabling-TLS-certificate-compression" href="#Enabling-TLS-certificate-compression">8.6 Enabling TLS certificate compression</a></li>
<li><a id="toc-Enabling_002fDisabling-system_002facceleration-protocols" href="#Enabling_002fDisabling-system_002facceleration-protocols">8.7 Enabling/Disabling system/acceleration protocols</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Enabling-kTLS" href="#Enabling-kTLS">8.7.1 Enabling kTLS</a></li>
</ul></li>
<li><a id="toc-Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5" href="#Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5">8.8 Enabling/Disabling RSAES-PKCS1-v1_5</a></li>
<li><a id="toc-Using-PKCS_002311-module-as-cryptographic-backend" href="#Using-PKCS_002311-module-as-cryptographic-backend">8.9 Using PKCS#11 module as cryptographic backend</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Examples-1" href="#Examples-1">8.9.1 Examples</a></li>
</ul></li>
</ul></li>
<li><a id="toc-Using-GnuTLS-as-a-cryptographic-library" href="#Using-GnuTLS-as-a-cryptographic-library">9 Using GnuTLS as a cryptographic library</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Symmetric-algorithms" href="#Symmetric-algorithms">9.1 Symmetric algorithms</a></li>
<li><a id="toc-Public-key-algorithms" href="#Public-key-algorithms">9.2 Public key algorithms</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Key-generation-1" href="#Key-generation-2">9.2.1 Key generation</a></li>
</ul></li>
<li><a id="toc-Cryptographic-Message-Syntax-_002f-PKCS7" href="#Cryptographic-Message-Syntax-_002f-PKCS7">9.3 Cryptographic Message Syntax / PKCS7</a></li>
<li><a id="toc-Hash-and-MAC-functions" href="#Hash-and-MAC-functions">9.4 Hash and MAC functions</a></li>
<li><a id="toc-Random-number-generation" href="#Random-number-generation">9.5 Random number generation</a></li>
<li><a id="toc-Overriding-algorithms" href="#Overriding-algorithms">9.6 Overriding algorithms</a></li>
</ul></li>
<li><a id="toc-Other-included-programs" href="#Other-included-programs">10 Other included programs</a></li>
<li><a id="toc-Internal-Architecture-of-GnuTLS" href="#Internal-architecture-of-GnuTLS">11 Internal Architecture of GnuTLS</a>
<ul class="toc-numbered-mark">
<li><a id="toc-The-TLS-Protocol" href="#The-TLS-Protocol">11.1 The TLS Protocol</a></li>
<li><a id="toc-TLS-Handshake-Protocol" href="#TLS-Handshake-Protocol">11.2 TLS Handshake Protocol</a></li>
<li><a id="toc-TLS-Authentication-Methods" href="#TLS-Authentication-Methods">11.3 TLS Authentication Methods</a></li>
<li><a id="toc-TLS-Extension-Handling" href="#TLS-Hello-Extension-Handling">11.4 TLS Extension Handling</a></li>
<li><a id="toc-Cryptographic-Backend" href="#Cryptographic-Backend">11.5 Cryptographic Backend</a></li>
<li><a id="toc-Random-Number-Generators" href="#Random-Number-Generators_002dinternals">11.6 Random Number Generators</a></li>
<li><a id="toc-FIPS140_002d2-mode" href="#FIPS140_002d2-mode">11.7 FIPS140-2 mode</a></li>
</ul></li>
<li><a id="toc-Upgrading-from-previous-versions" href="#Upgrading-from-previous-versions">Appendix A Upgrading from previous versions</a></li>
<li><a id="toc-Support" href="#Support">Appendix B Support</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Getting-Help" href="#Getting-help">B.1 Getting Help</a></li>
<li><a id="toc-Commercial-Support" href="#Commercial-Support">B.2 Commercial Support</a></li>
<li><a id="toc-Bug-Reports" href="#Bug-Reports">B.3 Bug Reports</a></li>
<li><a id="toc-Contributing" href="#Contributing">B.4 Contributing</a></li>
<li><a id="toc-Certification" href="#Certification">B.5 Certification</a></li>
</ul></li>
<li><a id="toc-Error-Codes-and-Descriptions" href="#Error-codes">Appendix C Error Codes and Descriptions</a></li>
<li><a id="toc-Supported-Ciphersuites" href="#Supported-ciphersuites">Appendix D Supported Ciphersuites</a></li>
<li><a id="toc-API-reference" href="#API-reference">Appendix E API reference</a>
<ul class="toc-numbered-mark">
<li><a id="toc-Core-TLS-API" href="#Core-TLS-API">E.1 Core TLS API</a></li>
<li><a id="toc-Datagram-TLS-API" href="#Datagram-TLS-API">E.2 Datagram TLS API</a></li>
<li><a id="toc-X_002e509-certificate-API" href="#X509-certificate-API">E.3 <abbr class="acronym">X.509</abbr> certificate API</a></li>
<li><a id="toc-PKCS-7-API" href="#PKCS-7-API">E.4 <abbr class="acronym">PKCS</abbr> 7 API</a></li>
<li><a id="toc-OCSP-API" href="#OCSP-API">E.5 <abbr class="acronym">OCSP</abbr> API</a></li>
<li><a id="toc-PKCS-12-API" href="#PKCS-12-API">E.6 PKCS 12 API</a></li>
<li><a id="toc-Hardware-token-via-PKCS-11-API" href="#PKCS-11-API">E.7 Hardware token via PKCS 11 API</a></li>
<li><a id="toc-TPM-API" href="#TPM-API">E.8 TPM API</a></li>
<li><a id="toc-Abstract-key-API" href="#Abstract-key-API">E.9 Abstract key API</a></li>
<li><a id="toc-Socket-specific-API" href="#Socket-specific-API">E.10 Socket specific API</a></li>
<li><a id="toc-DANE-API" href="#DANE-API">E.11 DANE API</a></li>
<li><a id="toc-Cryptographic-API" href="#Cryptographic-API">E.12 Cryptographic API</a></li>
<li><a id="toc-Compatibility-API" href="#Compatibility-API">E.13 Compatibility API</a></li>
</ul></li>
<li><a id="toc-Copying-Information" href="#Copying-Information">Appendix F Copying Information</a></li>
<li><a id="toc-Additional-Features" href="#Additional-Features">Appendix G Additional Features</a>
<ul class="toc-numbered-mark">
<li><a id="toc-kTLS-_0028Kernel-TLS_0029" href="#kTLS-_0028Kernel-TLS_0029">G.1 kTLS (Kernel TLS)</a></li>
</ul></li>
<li><a id="toc-Bibliography" href="#Bibliography">Bibliography</a></li>
<li><a id="toc-Function-and-Data-Index" href="#Function-and-Data-Index" rel="index">Function and Data Index</a></li>
<li><a id="toc-Concept-Index" href="#Concept-Index" rel="index">Concept Index</a></li>
</ul>
</div>
</div>
<hr>
<div class="chapter-level-extent" id="Preface">
<div class="nav-panel">
<p>
Next: <a href="#Introduction-to-GnuTLS" accesskey="n" rel="next">Introduction to GnuTLS</a>, Previous: <a href="#Top" accesskey="p" rel="prev">GnuTLS</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Preface-1"><span>1 Preface<a class="copiable-link" href="#Preface-1"> ¶</a></span></h2>
<p>This document demonstrates and explains the <abbr class="acronym">GnuTLS</abbr>
library API. A brief introduction to the protocols and the technology
involved is also included so that an application programmer can
better understand the <abbr class="acronym">GnuTLS</abbr> purpose and actual offerings.
Even if <abbr class="acronym">GnuTLS</abbr> is a typical library software, it operates
over several security and cryptographic protocols which require the
programmer to make careful and correct usage of them. Otherwise it
is likely to only obtain a false sense of security.
The term of security is very broad even if restricted to computer
software, and cannot be confined to a single cryptographic
library. For that reason, do not consider any program secure just
because it uses <abbr class="acronym">GnuTLS</abbr>; there are several ways to compromise
a program or a communication line and <abbr class="acronym">GnuTLS</abbr> only helps with
some of them.
</p>
<p>Although this document tries to be self contained, basic network
programming and public key infrastructure (PKI) knowledge is assumed
in most of it. A good introduction to networking can be found
in [<a class="ref" href="#STEVENS">STEVENS</a>], to public key infrastructure in [<a class="ref" href="#GUTPKI">GUTPKI</a>]
and to security engineering in [<a class="ref" href="#ANDERSON">ANDERSON</a>].
</p>
<p>Updated versions of the <abbr class="acronym">GnuTLS</abbr> software and this document
will be available from <a class="url" href="https://www.gnutls.org/">https://www.gnutls.org/</a>.
</p>
<hr>
</div>
<div class="chapter-level-extent" id="Introduction-to-GnuTLS">
<div class="nav-panel">
<p>
Next: <a href="#Introduction-to-TLS" accesskey="n" rel="next">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a>, Previous: <a href="#Preface" accesskey="p" rel="prev">Preface</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Introduction-to-GnuTLS-1"><span>2 Introduction to GnuTLS<a class="copiable-link" href="#Introduction-to-GnuTLS-1"> ¶</a></span></h2>
<p>In brief <abbr class="acronym">GnuTLS</abbr> can be described as a library which offers an API
to access secure communication protocols. These protocols provide
privacy over insecure lines, and were designed to prevent
eavesdropping, tampering, or message forgery.
</p>
<p>Technically <abbr class="acronym">GnuTLS</abbr> is a portable ANSI C based library which
implements the protocols ranging from SSL 3.0 to TLS 1.3 (see <a class="ref" href="#Introduction-to-TLS">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a>,
for a detailed description of the protocols), accompanied
with the required framework for authentication and public key
infrastructure. Important features of the <abbr class="acronym">GnuTLS</abbr> library
include:
</p>
<ul class="itemize mark-bullet">
<li>Support for TLS 1.3, TLS 1.2, TLS 1.1, TLS 1.0 and optionally SSL 3.0 protocols.
</li><li>Support for Datagram TLS 1.0 and 1.2.
</li><li>Support for handling and verification of <abbr class="acronym">X.509</abbr> certificates.
</li><li>Support for password authentication using <abbr class="acronym">TLS-SRP</abbr>.
</li><li>Support for keyed authentication using <abbr class="acronym">TLS-PSK</abbr>.
</li><li>Support for TPM, <abbr class="acronym">PKCS</abbr> #11 tokens and smart-cards.
</li></ul>
<p>The <abbr class="acronym">GnuTLS</abbr> library consists of three independent parts, namely the “TLS
protocol part”, the “Certificate part”, and the “Cryptographic
back-end” part. The “TLS protocol part” is the actual protocol
implementation, and is entirely implemented within the
<abbr class="acronym">GnuTLS</abbr> library. The “Certificate part” consists of the
certificate parsing, and verification functions and it uses
functionality from the
libtasn1 library.
The “Cryptographic back-end” is provided by the nettle
and gmplib libraries.
</p>
<ul class="mini-toc">
<li><a href="#Downloading-and-installing" accesskey="1">Downloading and installing</a></li>
<li><a href="#Installing-for-a-software-distribution" accesskey="2">Installing for a software distribution</a></li>
<li><a href="#Document-overview" accesskey="3">Overview</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Downloading-and-installing">
<div class="nav-panel">
<p>
Next: <a href="#Installing-for-a-software-distribution" accesskey="n" rel="next">Installing for a software distribution</a>, Up: <a href="#Introduction-to-GnuTLS" accesskey="u" rel="up">Introduction to GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Downloading-and-installing-1"><span>2.1 Downloading and installing<a class="copiable-link" href="#Downloading-and-installing-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-installation"></a>
<a class="index-entry-id" id="index-download"></a>
<p>GnuTLS is available for download at:
<a class="url" href="https://www.gnutls.org/download.html">https://www.gnutls.org/download.html</a>
</p>
<p>GnuTLS uses a development cycle where even minor version numbers
indicate a stable release and a odd minor version number indicate a
development release. For example, GnuTLS 1.6.3 denote a stable
release since 6 is even, and GnuTLS 1.7.11 denote a development
release since 7 is odd.
</p>
<p>GnuTLS depends on <code class="code">nettle</code> and <code class="code">gmplib</code>, and you will need to install it
before installing GnuTLS. The <code class="code">nettle</code> library is available from
<a class="url" href="https://www.lysator.liu.se/~nisse/nettle/">https://www.lysator.liu.se/~nisse/nettle/</a>, while <code class="code">gmplib</code> is available
from <a class="url" href="https://www.gmplib.org/">https://www.gmplib.org/</a>.
Don’t forget to verify the cryptographic signature after downloading
source code packages.
</p>
<p>The package is then extracted, configured and built like many other
packages that use Autoconf. For detailed information on configuring
and building it, refer to the <samp class="file">INSTALL</samp> file that is part of the
distribution archive. Typically you invoke <code class="code">./configure</code> and
then <code class="code">make check install</code>. There are a number of compile-time
parameters, as discussed below.
</p>
<p>Several parts of GnuTLS require ASN.1 functionality, which is provided by
a library called libtasn1. A copy of libtasn1 is included in GnuTLS. If you
want to install it separately (e.g., to make it possibly to use
libtasn1 in other programs), you can get it from
<a class="url" href="https://www.gnu.org/software/libtasn1/">https://www.gnu.org/software/libtasn1/</a>.
</p>
<p>The compression library, <code class="code">libz</code>, the PKCS #11 helper library <code class="code">p11-kit</code>,
the TPM library <code class="code">trousers</code>, as well as the IDN library <code class="code">libidn</code><a class="footnote" id="DOCF1" href="#FOOT1"><sup>1</sup></a> are
optional dependencies. Check the README file in the distribution on how
to obtain these libraries.
</p>
<p>A few <code class="code">configure</code> options may be relevant, summarized below.
They disable or enable particular features,
to create a smaller library with only the required features.
Note however, that although a smaller library is generated, the
included programs are not guaranteed to compile if some of these
options are given.
</p>
<pre class="verbatim">--disable-srp-authentication
--disable-psk-authentication
--disable-anon-authentication
--disable-dhe
--disable-ecdhe
--disable-openssl-compatibility
--disable-dtls-srtp-support
--disable-alpn-support
--disable-heartbeat-support
--disable-libdane
--without-p11-kit
--without-tpm
--without-zlib
</pre>
<p>For the complete list, refer to the output from <code class="code">configure --help</code>.
</p>
<hr>
</div>
<div class="section-level-extent" id="Installing-for-a-software-distribution">
<div class="nav-panel">
<p>
Next: <a href="#Document-overview" accesskey="n" rel="next">Overview</a>, Previous: <a href="#Downloading-and-installing" accesskey="p" rel="prev">Downloading and installing</a>, Up: <a href="#Introduction-to-GnuTLS" accesskey="u" rel="up">Introduction to GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Installing-for-a-software-distribution-1"><span>2.2 Installing for a software distribution<a class="copiable-link" href="#Installing-for-a-software-distribution-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-installation-1"></a>
<p>When installing for a software distribution, it is often desirable to preconfigure
GnuTLS with the system-wide paths and files. There two important configuration
options, one sets the trust store in system, which are the CA certificates
to be used by programs by default (if they don’t override it), and the other sets
to DNSSEC root key file used by unbound for DNSSEC verification.
</p>
<p>For the latter the following configuration option is available, and if not specified
GnuTLS will try to auto-detect the location of that file.
</p><pre class="verbatim">--with-unbound-root-key-file
</pre>
<p>To set the trust store the following options are available.
</p><pre class="verbatim">--with-default-trust-store-file
--with-default-trust-store-dir
--with-default-trust-store-pkcs11
</pre><p>The first option is used to set a PEM file which contains a list of trusted certificates,
while the second will read all certificates in the given path. The recommended option is
the last, which allows to use a PKCS #11 trust policy module. That module not only
provides the trusted certificates, but allows the categorization of them using purpose,
e.g., CAs can be restricted for e-mail usage only, or administrative restrictions of CAs, for
examples by restricting a CA to only issue certificates for a given DNS domain using NameConstraints.
A publicly available PKCS #11 trust module is p11-kit’s trust module<a class="footnote" id="DOCF2" href="#FOOT2"><sup>2</sup></a>.
</p>
<hr>
</div>
<div class="section-level-extent" id="Document-overview">
<div class="nav-panel">
<p>
Previous: <a href="#Installing-for-a-software-distribution" accesskey="p" rel="prev">Installing for a software distribution</a>, Up: <a href="#Introduction-to-GnuTLS" accesskey="u" rel="up">Introduction to GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Overview"><span>2.3 Overview<a class="copiable-link" href="#Overview"> ¶</a></span></h3>
<p>In this document we present an overview of the supported security protocols in <a class="ref" href="#Introduction-to-TLS">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a>, and
continue by providing more information on the certificate authentication in <a class="ref" href="#Certificate-authentication">Certificate authentication</a>,
and shared-key as well anonymous authentication in <a class="ref" href="#Shared_002dkey-and-anonymous-authentication">Shared-key and anonymous authentication</a>. We
elaborate on certificate authentication by demonstrating advanced usage of the API in <a class="ref" href="#More-on-certificate-authentication">More on certificate authentication</a>.
The core of the TLS library is presented in <a class="ref" href="#How-to-use-GnuTLS-in-applications">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> and example
applications are listed in <a class="ref" href="#GnuTLS-application-examples">GnuTLS application examples</a>.
In <a class="ref" href="#Other-included-programs">Other included programs</a> the usage of few included programs that
may assist debugging is presented. The last chapter is <a class="ref" href="#Internal-architecture-of-GnuTLS">Internal Architecture of GnuTLS</a> that
provides a short introduction to GnuTLS’ internal architecture.
</p>
<hr>
</div>
</div>
<div class="chapter-level-extent" id="Introduction-to-TLS">
<div class="nav-panel">
<p>
Next: <a href="#Authentication-methods" accesskey="n" rel="next">Authentication methods</a>, Previous: <a href="#Introduction-to-GnuTLS" accesskey="p" rel="prev">Introduction to GnuTLS</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Introduction-to-TLS-and-DTLS"><span>3 Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr><a class="copiable-link" href="#Introduction-to-TLS-and-DTLS"> ¶</a></span></h2>
<p><abbr class="acronym">TLS</abbr> stands for “Transport Layer Security” and is the
successor of SSL, the Secure Sockets Layer protocol [<a class="ref" href="#SSL3">SSL3</a>]
designed by Netscape. <abbr class="acronym">TLS</abbr> is an Internet protocol, defined
by <abbr class="acronym">IETF</abbr><a class="footnote" id="DOCF3" href="#FOOT3"><sup>3</sup></a>, described in [<a class="ref" href="#RFC5246">RFC5246</a>].
The protocol provides
confidentiality, and authentication layers over any reliable transport
layer. The description, above, refers to <abbr class="acronym">TLS</abbr> 1.0 but applies
to all other TLS versions as the differences between the protocols are not major.
</p>
<p>The <abbr class="acronym">DTLS</abbr> protocol, or “Datagram <abbr class="acronym">TLS</abbr>” [<a class="ref" href="#RFC4347">RFC4347</a>] is a
protocol with identical goals as <abbr class="acronym">TLS</abbr>, but can operate
under unreliable transport layers such as <abbr class="acronym">UDP</abbr>. The
discussions below apply to this protocol as well, except when
noted otherwise.
</p>
<ul class="mini-toc">
<li><a href="#TLS-layers" accesskey="1">TLS Layers</a></li>
<li><a href="#The-transport-layer" accesskey="2">The Transport Layer</a></li>
<li><a href="#The-TLS-record-protocol" accesskey="3">The TLS record protocol</a></li>
<li><a href="#The-TLS-Alert-Protocol" accesskey="4">The TLS alert protocol</a></li>
<li><a href="#The-TLS-Handshake-Protocol" accesskey="5">The TLS handshake protocol</a></li>
<li><a href="#TLS-Extensions" accesskey="6">TLS extensions</a></li>
<li><a href="#How-to-use-TLS-in-application-protocols" accesskey="7">How to use <abbr class="acronym">TLS</abbr> in application protocols</a></li>
<li><a href="#On-SSL-2-and-older-protocols" accesskey="8">On SSL 2 and older protocols</a></li>
</ul>
<hr>
<div class="section-level-extent" id="TLS-layers">
<div class="nav-panel">
<p>
Next: <a href="#The-transport-layer" accesskey="n" rel="next">The Transport Layer</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="TLS-Layers"><span>3.1 TLS Layers<a class="copiable-link" href="#TLS-Layers"> ¶</a></span></h3>
<a class="index-entry-id" id="index-TLS-layers"></a>
<p><abbr class="acronym">TLS</abbr> is a layered protocol, and consists of the record
protocol, the handshake protocol and the alert protocol. The record
protocol is to serve all other protocols and is above the transport
layer. The record protocol offers symmetric encryption, and data
authenticity<a class="footnote" id="DOCF4" href="#FOOT4"><sup>4</sup></a>.
The alert protocol offers some signaling to the other protocols. It
can help informing the peer for the cause of failures and other error
conditions. See <a class="xref" href="#The-Alert-Protocol">The Alert Protocol</a>, for more information. The
alert protocol is above the record protocol.
</p>
<p>The handshake protocol is responsible for the security parameters’
negotiation, the initial key exchange and authentication.
See <a class="xref" href="#The-Handshake-Protocol">The Handshake Protocol</a>, for more information about the handshake
protocol. The protocol layering in TLS is shown in <a class="ref" href="#fig_002dtls_002dlayers">Figure 3.1</a>.
</p>
<div class="float" id="fig_002dtls_002dlayers">
<img class="image" src="gnutls-layers.png" alt="gnutls-layers">
<div class="caption"><p><strong class="strong">Figure 3.1: </strong>The TLS protocol layers.</p></div></div>
<hr>
</div>
<div class="section-level-extent" id="The-transport-layer">
<div class="nav-panel">
<p>
Next: <a href="#The-TLS-record-protocol" accesskey="n" rel="next">The TLS record protocol</a>, Previous: <a href="#TLS-layers" accesskey="p" rel="prev">TLS Layers</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="The-Transport-Layer"><span>3.2 The Transport Layer<a class="copiable-link" href="#The-Transport-Layer"> ¶</a></span></h3>
<a class="index-entry-id" id="index-transport-protocol"></a>
<a class="index-entry-id" id="index-transport-layer"></a>
<p><abbr class="acronym">TLS</abbr> is not limited to any transport layer and can be used
above any transport layer, as long as it is a reliable one. <abbr class="acronym">DTLS</abbr>
can be used over reliable and unreliable transport layers.
<abbr class="acronym">GnuTLS</abbr> supports TCP and UDP layers transparently using
the Berkeley sockets API. However, any transport layer can be used
by providing callbacks for <abbr class="acronym">GnuTLS</abbr> to access the transport layer
(for details see <a class="ref" href="#Setting-up-the-transport-layer">Setting up the transport layer</a>).
</p>
<hr>
</div>
<div class="section-level-extent" id="The-TLS-record-protocol">
<div class="nav-panel">
<p>
Next: <a href="#The-TLS-Alert-Protocol" accesskey="n" rel="next">The TLS alert protocol</a>, Previous: <a href="#The-transport-layer" accesskey="p" rel="prev">The Transport Layer</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="The-TLS-record-protocol-1"><span>3.3 The TLS record protocol<a class="copiable-link" href="#The-TLS-record-protocol-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-record-protocol"></a>
<p>The record protocol is the secure communications provider. Its purpose
is to encrypt, and authenticate packets.
The record layer functions can be called at any time after
the handshake process is finished, when there is need to receive
or send data. In <abbr class="acronym">DTLS</abbr> however, due to re-transmission
timers used in the handshake out-of-order handshake data might
be received for some time (maximum 60 seconds) after the handshake
process is finished.
</p>
<p>The functions to access the record protocol are limited to send
and receive functions, which might, given
the importance of this protocol in <abbr class="acronym">TLS</abbr>, seem awkward. This is because
the record protocol’s parameters are all set by the handshake protocol.
The record protocol initially starts with NULL parameters, which means
no encryption, and no MAC is used. Encryption and authentication begin
just after the handshake protocol has finished.
</p>
<ul class="mini-toc">
<li><a href="#Encryption-algorithms-used-in-the-record-layer" accesskey="1">Encryption algorithms used in the record layer</a></li>
<li><a href="#Compression-algorithms-and-the-record-layer" accesskey="2">Compression algorithms and the record layer</a></li>
<li><a href="#On-Record-Padding" accesskey="3">On record padding</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Encryption-algorithms-used-in-the-record-layer">
<div class="nav-panel">
<p>
Next: <a href="#Compression-algorithms-and-the-record-layer" accesskey="n" rel="next">Compression algorithms and the record layer</a>, Up: <a href="#The-TLS-record-protocol" accesskey="u" rel="up">The TLS record protocol</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Encryption-algorithms-used-in-the-record-layer-1"><span>3.3.1 Encryption algorithms used in the record layer<a class="copiable-link" href="#Encryption-algorithms-used-in-the-record-layer-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-symmetric-encryption-algorithms"></a>
<p>Confidentiality in the record layer is achieved by using symmetric
ciphers like <code class="code">AES</code> or <code class="code">CHACHA20</code>. Ciphers are encryption algorithms
that use a single, secret, key to encrypt and decrypt data. Early
versions of TLS separated between block and stream ciphers and had
message authentication plugged in to them by the protocol, though later
versions switched to using authenticated-encryption (AEAD) ciphers. The AEAD
ciphers are defined to combine encryption and authentication, and as such
they are not only more efficient, as the primitives used are designed to
interoperate nicely, but they are also known to interoperate in a secure
way.
</p>
<p>The supported in <abbr class="acronym">GnuTLS</abbr> ciphers and MAC algorithms are shown in <a class="ref" href="#tab_003aciphers">Table 3.1</a> and
<a class="ref" href="#tab_003amacs">Table 3.2</a>.
</p>
<div class="float" id="tab_003aciphers">
<table class="multitable">
<thead><tr><th width="20%">Algorithm</th><th width="10%">Type</th><th width="15%">Applicable Protocols</th><th width="55%">Description</th></tr></thead>
<tbody><tr><td width="20%">AES-128-GCM, AES-256-GCM</td><td width="10%">AEAD</td><td width="15%">TLS 1.2, TLS 1.3</td><td width="55%">This is the AES algorithm in the authenticated encryption GCM mode.
This mode combines message authentication and encryption and can
be extremely fast on CPUs that support hardware acceleration.</td></tr>
<tr><td width="20%">AES-128-CCM, AES-256-CCM</td><td width="10%">AEAD</td><td width="15%">TLS 1.2, TLS 1.3</td><td width="55%">This is the AES algorithm in the authenticated encryption CCM mode.
This mode combines message authentication and encryption and is
often used by systems without AES or GCM acceleration support.</td></tr>
<tr><td width="20%">CHACHA20-POLY1305</td><td width="10%">AEAD</td><td width="15%">TLS 1.2, TLS 1.3</td><td width="55%">CHACHA20-POLY1305 is an authenticated encryption algorithm based on CHACHA20 cipher and
POLY1305 MAC. CHACHA20 is a refinement of SALSA20 algorithm, an approved cipher by
the European ESTREAM project. POLY1305 is Wegman-Carter, one-time authenticator. The
combination provides a fast stream cipher suitable for systems where a hardware AES
accelerator is not available.</td></tr>
<tr><td width="20%">AES-128-CCM-8, AES-256-CCM-8</td><td width="10%">AEAD</td><td width="15%">TLS 1.2, TLS 1.3</td><td width="55%">This is the AES algorithm in the authenticated encryption CCM mode
with a truncated to 64-bit authentication tag. This mode is for
communication with restricted systems.</td></tr>
<tr><td width="20%">CAMELLIA-128-GCM, CAMELLIA-256-GCM</td><td width="10%">AEAD</td><td width="15%">TLS 1.2</td><td width="55%">This is the CAMELLIA algorithm in the authenticated encryption GCM mode.</td></tr>
<tr><td width="20%">AES-128-CBC, AES-256-CBC</td><td width="10%">Legacy (block)</td><td width="15%">TLS 1.0, TLS 1.1, TLS 1.2</td><td width="55%">AES or RIJNDAEL is the block cipher algorithm that replaces the old
DES algorithm. It has 128 bits block size and is used in CBC mode.</td></tr>
<tr><td width="20%">CAMELLIA-128-CBC, CAMELLIA-256-CBC</td><td width="10%">Legacy (block)</td><td width="15%">TLS 1.0, TLS 1.1, TLS 1.2</td><td width="55%">This is an 128-bit block cipher developed by Mitsubishi and NTT. It
is one of the approved ciphers of the European NESSIE and Japanese
CRYPTREC projects.</td></tr>
<tr><td width="20%">3DES-CBC</td><td width="10%">Legacy (block)</td><td width="15%">TLS 1.0, TLS 1.1, TLS 1.2</td><td width="55%">This is the DES block cipher algorithm used with triple
encryption (EDE). Has 64 bits block size and is used in CBC mode.</td></tr>
<tr><td width="20%">ARCFOUR-128</td><td width="10%">Legacy (stream)</td><td width="15%">TLS 1.0, TLS 1.1, TLS 1.2</td><td width="55%">ARCFOUR-128 is a compatible algorithm with RSA’s RC4 algorithm, which is considered to be a trade
secret. It is a considered to be broken, and is only used for compatibility
purposed. For this reason it is not enabled by default.</td></tr>
<tr><td width="20%">GOST28147-TC26Z-CNT</td><td width="10%">Legacy (stream)</td><td width="15%">TLS 1.2</td><td width="55%">This is a 64-bit block cipher GOST 28147-89 with TC26Z S-Box working in CNT
mode. It is one of the approved ciphers in Russia. It is not enabled by default.</td></tr>
<tr><td width="20%">NULL</td><td width="10%">Legacy (stream)</td><td width="15%">TLS 1.0, TLS 1.1, TLS 1.2</td><td width="55%">NULL is the empty/identity cipher which doesn’t encrypt any data. It can be
combined with data authentication under TLS 1.2 or earlier, but is only used
transiently under TLS 1.3 until encryption starts. This cipher cannot be negotiated
by default (need to be explicitly enabled) under TLS 1.2, and cannot be
negotiated at all under TLS 1.3. When enabled, TLS 1.3 (or later) support will be
implicitly disabled.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 3.1: </strong>Supported ciphers in TLS.</p></div></div>
<div class="float" id="tab_003amacs">
<table class="multitable">
<thead><tr><th width="20%">Algorithm</th><th width="70%">Description</th></tr></thead>
<tbody><tr><td width="20%">MAC-MD5</td><td width="70%">This is an HMAC based on MD5 a cryptographic hash algorithm designed
by Ron Rivest. Outputs 128 bits of data.</td></tr>
<tr><td width="20%">MAC-SHA1</td><td width="70%">An HMAC based on the SHA1 cryptographic hash algorithm
designed by NSA. Outputs 160 bits of data.</td></tr>
<tr><td width="20%">MAC-SHA256</td><td width="70%">An HMAC based on SHA2-256. Outputs 256 bits of data.</td></tr>
<tr><td width="20%">MAC-SHA384</td><td width="70%">An HMAC based on SHA2-384. Outputs 384 bits of data.</td></tr>
<tr><td width="20%">GOST28147-TC26Z-IMIT</td><td width="70%">This is a 64-bit block cipher GOST 28147-89 with TC26Z S-Box working in special
MAC mode called Imitovstavks. It is one of the approved MAC algorithms in
Russia. Outputs 32 bits of data. It is not enabled by default.</td></tr>
<tr><td width="20%">MAC-AEAD</td><td width="70%">This indicates that an authenticated encryption algorithm, such as
GCM, is in use.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 3.2: </strong>Supported MAC algorithms in TLS.</p></div></div>
<hr>
</div>
<div class="subsection-level-extent" id="Compression-algorithms-and-the-record-layer">
<div class="nav-panel">
<p>
Next: <a href="#On-Record-Padding" accesskey="n" rel="next">On record padding</a>, Previous: <a href="#Encryption-algorithms-used-in-the-record-layer" accesskey="p" rel="prev">Encryption algorithms used in the record layer</a>, Up: <a href="#The-TLS-record-protocol" accesskey="u" rel="up">The TLS record protocol</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Compression-algorithms-and-the-record-layer-1"><span>3.3.2 Compression algorithms and the record layer<a class="copiable-link" href="#Compression-algorithms-and-the-record-layer-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-compression-algorithms"></a>
<p>In early versions of TLS the record layer supported compression. However,
that proved to be problematic in many ways, and enabled several attacks
based on traffic analysis on the transported data. For that newer versions of the protocol no longer
offer compression, and <abbr class="acronym">GnuTLS</abbr> since 3.6.0 no longer implements any
support for compression.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="On-Record-Padding">
<div class="nav-panel">
<p>
Previous: <a href="#Compression-algorithms-and-the-record-layer" accesskey="p" rel="prev">Compression algorithms and the record layer</a>, Up: <a href="#The-TLS-record-protocol" accesskey="u" rel="up">The TLS record protocol</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="On-record-padding"><span>3.3.3 On record padding<a class="copiable-link" href="#On-record-padding"> ¶</a></span></h4>
<a class="index-entry-id" id="index-record-padding"></a>
<a class="index-entry-id" id="index-bad_005frecord_005fmac"></a>
<p>The TLS 1.3 protocol allows for extra padding of records to prevent
statistical analysis based on the length of exchanged messages.
GnuTLS takes advantage of this feature, by allowing the user
to specify the amount of padding for a particular message. The simplest
interface is provided by <a class="ref" href="#gnutls_005frecord_005fsend2">gnutls_record_send2</a>, and is made
available when under TLS1.3; alternatively <a class="ref" href="#gnutls_005frecord_005fcan_005fuse_005flength_005fhiding">gnutls_record_can_use_length_hiding</a>
can be queried.
</p>
<p>Note that this interface is not sufficient to completely hide the length of the
data. The application code may reveal the data transferred by leaking its
data processing time, or by leaking the TLS1.3 record processing time by
GnuTLS. That is because under TLS1.3 the padding removal time depends on the
padding data for an efficient implementation. To make that processing
constant time the <a class="ref" href="#gnutls_005finit">gnutls_init</a> function must be called with
the flag <code class="code">GNUTLS_SAFE_PADDING_CHECK</code>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fsend2"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_send2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>, size_t <var class="var">pad</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fsend2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: contains the data to send
</p>
<p><var class="var">data_size</var>: is the length of the data
</p>
<p><var class="var">pad</var>: padding to be added to the record
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function is identical to <code class="code">gnutls_record_send()</code> except that it
takes an extra argument to specify padding to be added the record.
To determine the maximum size of padding, use
<code class="code">gnutls_record_get_max_size()</code> and <code class="code">gnutls_record_overhead_size()</code> .
</p>
<p>Note that in order for GnuTLS to provide constant time processing
of padding and data in TLS1.3, the flag <code class="code">GNUTLS_SAFE_PADDING_CHECK</code>
must be used in <code class="code">gnutls_init()</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of bytes sent, or a negative error code. The
number of bytes sent might be less than <code class="code">data_size</code> . The maximum
number of bytes this function can send in a single call depends
on the negotiated maximum record size.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<p>Older GnuTLS versions provided an API suitable for cases where the sender
sends data that are always within a given range. That API is still
available, and consists of the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005frecord_005fcan_005fuse_005flength_005fhiding">gnutls_record_can_use_length_hiding</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
<dt><code class="code"><var class="var">ssize_t</var> <a class="ref" href="#gnutls_005frecord_005fsend_005frange">gnutls_record_send_range</a> (gnutls_session_t <var class="var">session</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>, const gnutls_range_st * <var class="var">range</var>)</code></dt>
</dl>
<hr>
</div>
</div>
<div class="section-level-extent" id="The-TLS-Alert-Protocol">
<div class="nav-panel">
<p>
Next: <a href="#The-TLS-Handshake-Protocol" accesskey="n" rel="next">The TLS handshake protocol</a>, Previous: <a href="#The-TLS-record-protocol" accesskey="p" rel="prev">The TLS record protocol</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="The-TLS-alert-protocol"><span>3.4 The TLS alert protocol<a class="copiable-link" href="#The-TLS-alert-protocol"> ¶</a></span></h3>
<a class="anchor" id="The-Alert-Protocol"></a><a class="index-entry-id" id="index-alert-protocol"></a>
<p>The alert protocol is there to allow signals to be sent between peers.
These signals are mostly used to inform the peer about the cause of a
protocol failure. Some of these signals are used internally by the
protocol and the application protocol does not have to cope with them
(e.g. <code class="code">GNUTLS_A_CLOSE_NOTIFY</code>), and others refer to the
application protocol solely (e.g. <code class="code">GNUTLS_A_USER_CANCELLED</code>). An
alert signal includes a level indication which may be either fatal or
warning (under TLS1.3 all alerts are fatal). Fatal alerts always terminate
the current connection, and prevent future re-negotiations using the current
session ID. All supported alert messages are summarized in the table below.
</p>
<p>The alert messages are protected by the record protocol, thus the
information that is included does not leak. You must take extreme care
for the alert information not to leak to a possible attacker, via
public log files etc.
</p>
<table class="multitable">
<tr><td><a class="anchor" id="tab_003aalerts"></a></td></tr>
<thead><tr><th width="55%">Alert</th><th width="10%">ID</th><th width="30%">Description</th></tr></thead>
<tbody><tr><td width="55%">GNUTLS_A_CLOSE_NOTIFY</td><td width="10%">0</td><td width="30%">Close notify</td></tr>
<tr><td width="55%">GNUTLS_A_UNEXPECTED_MESSAGE</td><td width="10%">10</td><td width="30%">Unexpected message</td></tr>
<tr><td width="55%">GNUTLS_A_BAD_RECORD_MAC</td><td width="10%">20</td><td width="30%">Bad record MAC</td></tr>
<tr><td width="55%">GNUTLS_A_DECRYPTION_FAILED</td><td width="10%">21</td><td width="30%">Decryption failed</td></tr>
<tr><td width="55%">GNUTLS_A_RECORD_OVERFLOW</td><td width="10%">22</td><td width="30%">Record overflow</td></tr>
<tr><td width="55%">GNUTLS_A_DECOMPRESSION_FAILURE</td><td width="10%">30</td><td width="30%">Decompression failed</td></tr>
<tr><td width="55%">GNUTLS_A_HANDSHAKE_FAILURE</td><td width="10%">40</td><td width="30%">Handshake failed</td></tr>
<tr><td width="55%">GNUTLS_A_SSL3_NO_CERTIFICATE</td><td width="10%">41</td><td width="30%">No certificate (SSL 3.0)</td></tr>
<tr><td width="55%">GNUTLS_A_BAD_CERTIFICATE</td><td width="10%">42</td><td width="30%">Certificate is bad</td></tr>
<tr><td width="55%">GNUTLS_A_UNSUPPORTED_CERTIFICATE</td><td width="10%">43</td><td width="30%">Certificate is not supported</td></tr>
<tr><td width="55%">GNUTLS_A_CERTIFICATE_REVOKED</td><td width="10%">44</td><td width="30%">Certificate was revoked</td></tr>
<tr><td width="55%">GNUTLS_A_CERTIFICATE_EXPIRED</td><td width="10%">45</td><td width="30%">Certificate is expired</td></tr>
<tr><td width="55%">GNUTLS_A_CERTIFICATE_UNKNOWN</td><td width="10%">46</td><td width="30%">Unknown certificate</td></tr>
<tr><td width="55%">GNUTLS_A_ILLEGAL_PARAMETER</td><td width="10%">47</td><td width="30%">Illegal parameter</td></tr>
<tr><td width="55%">GNUTLS_A_UNKNOWN_CA</td><td width="10%">48</td><td width="30%">CA is unknown</td></tr>
<tr><td width="55%">GNUTLS_A_ACCESS_DENIED</td><td width="10%">49</td><td width="30%">Access was denied</td></tr>
<tr><td width="55%">GNUTLS_A_DECODE_ERROR</td><td width="10%">50</td><td width="30%">Decode error</td></tr>
<tr><td width="55%">GNUTLS_A_DECRYPT_ERROR</td><td width="10%">51</td><td width="30%">Decrypt error</td></tr>
<tr><td width="55%">GNUTLS_A_EXPORT_RESTRICTION</td><td width="10%">60</td><td width="30%">Export restriction</td></tr>
<tr><td width="55%">GNUTLS_A_PROTOCOL_VERSION</td><td width="10%">70</td><td width="30%">Error in protocol version</td></tr>
<tr><td width="55%">GNUTLS_A_INSUFFICIENT_SECURITY</td><td width="10%">71</td><td width="30%">Insufficient security</td></tr>
<tr><td width="55%">GNUTLS_A_INTERNAL_ERROR</td><td width="10%">80</td><td width="30%">Internal error</td></tr>
<tr><td width="55%">GNUTLS_A_INAPPROPRIATE_FALLBACK</td><td width="10%">86</td><td width="30%">Inappropriate fallback</td></tr>
<tr><td width="55%">GNUTLS_A_USER_CANCELED</td><td width="10%">90</td><td width="30%">User canceled</td></tr>
<tr><td width="55%">GNUTLS_A_NO_RENEGOTIATION</td><td width="10%">100</td><td width="30%">No renegotiation is allowed</td></tr>
<tr><td width="55%">GNUTLS_A_MISSING_EXTENSION</td><td width="10%">109</td><td width="30%">An extension was expected but was not seen</td></tr>
<tr><td width="55%">GNUTLS_A_UNSUPPORTED_EXTENSION</td><td width="10%">110</td><td width="30%">An unsupported extension was sent</td></tr>
<tr><td width="55%">GNUTLS_A_CERTIFICATE_UNOBTAINABLE</td><td width="10%">111</td><td width="30%">Could not retrieve the specified certificate</td></tr>
<tr><td width="55%">GNUTLS_A_UNRECOGNIZED_NAME</td><td width="10%">112</td><td width="30%">The server name sent was not recognized</td></tr>
<tr><td width="55%">GNUTLS_A_UNKNOWN_PSK_IDENTITY</td><td width="10%">115</td><td width="30%">The SRP/PSK username is missing or not known</td></tr>
<tr><td width="55%">GNUTLS_A_CERTIFICATE_REQUIRED</td><td width="10%">116</td><td width="30%">Certificate is required</td></tr>
<tr><td width="55%">GNUTLS_A_NO_APPLICATION_PROTOCOL</td><td width="10%">120</td><td width="30%">No supported application protocol could be negotiated</td></tr>
</tbody>
</table>
<hr>
</div>
<div class="section-level-extent" id="The-TLS-Handshake-Protocol">
<div class="nav-panel">
<p>
Next: <a href="#TLS-Extensions" accesskey="n" rel="next">TLS extensions</a>, Previous: <a href="#The-TLS-Alert-Protocol" accesskey="p" rel="prev">The TLS alert protocol</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="The-TLS-handshake-protocol"><span>3.5 The TLS handshake protocol<a class="copiable-link" href="#The-TLS-handshake-protocol"> ¶</a></span></h3>
<a class="anchor" id="The-Handshake-Protocol"></a><a class="index-entry-id" id="index-handshake-protocol"></a>
<p>The handshake protocol is responsible for the ciphersuite negotiation,
the initial key exchange, and the authentication of the two peers.
This is fully controlled by the application layer, thus your program
has to set up the required parameters. The main handshake function
is <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a>. In the next paragraphs we elaborate on
the handshake protocol, i.e., the ciphersuite negotiation.
</p>
<ul class="mini-toc">
<li><a href="#TLS-Cipher-Suites" accesskey="1">TLS ciphersuites</a></li>
<li><a href="#Authentication" accesskey="2">Authentication</a></li>
<li><a href="#Client-Authentication" accesskey="3">Client authentication</a></li>
<li><a href="#Resuming-Sessions" accesskey="4">Resuming sessions</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="TLS-Cipher-Suites">
<div class="nav-panel">
<p>
Next: <a href="#Authentication" accesskey="n" rel="next">Authentication</a>, Up: <a href="#The-TLS-Handshake-Protocol" accesskey="u" rel="up">The TLS handshake protocol</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="TLS-ciphersuites"><span>3.5.1 TLS ciphersuites<a class="copiable-link" href="#TLS-ciphersuites"> ¶</a></span></h4>
<p>The TLS cipher suites have slightly different meaning under different
protocols. Under <abbr class="acronym">TLS 1.3</abbr>, a cipher suite indicates the symmetric
encryption algorithm in use, as well as the pseudo-random function (PRF)
used in the TLS session.
</p>
<p>Under TLS 1.2 or early the handshake protocol negotiates cipher suites of
a special form illustrated by the <code class="code">TLS_DHE_RSA_WITH_3DES_CBC_SHA</code> cipher suite name.
A typical cipher suite contains these parameters:
</p>
<ul class="itemize mark-bullet">
<li>The key exchange algorithm.
<code class="code">DHE_RSA</code> in the example.
</li><li>The Symmetric encryption algorithm and mode
<code class="code">3DES_CBC</code> in this example.
</li><li>The MAC<a class="footnote" id="DOCF5" href="#FOOT5"><sup>5</sup></a> algorithm used for authentication.
<code class="code">MAC_SHA</code> is used in the above example.
</li></ul>
<p>The cipher suite negotiated in the handshake protocol will affect the
record protocol, by enabling encryption and data authentication. Note
that you should not over rely on <abbr class="acronym">TLS</abbr> to negotiate the
strongest available cipher suite. Do not enable ciphers and algorithms
that you consider weak.
</p>
<p>All the supported ciphersuites are listed in <a class="ref" href="#ciphersuites">ciphersuites</a>.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Authentication">
<div class="nav-panel">
<p>
Next: <a href="#Client-Authentication" accesskey="n" rel="next">Client authentication</a>, Previous: <a href="#TLS-Cipher-Suites" accesskey="p" rel="prev">TLS ciphersuites</a>, Up: <a href="#The-TLS-Handshake-Protocol" accesskey="u" rel="up">The TLS handshake protocol</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Authentication-1"><span>3.5.2 Authentication<a class="copiable-link" href="#Authentication-1"> ¶</a></span></h4>
<p>The key exchange algorithms of the <abbr class="acronym">TLS</abbr> protocol offer
authentication, which is a prerequisite for a secure connection.
The available authentication methods in <abbr class="acronym">GnuTLS</abbr>, under
TLS 1.3 or earlier versions, follow.
</p>
<ul class="itemize mark-bullet">
<li>Certificate authentication: Authenticated key exchange using public key infrastructure and X.509 certificates.
</li><li><abbr class="acronym">PSK</abbr> authentication: Authenticated key exchange using a pre-shared key.
</li></ul>
<p>Under TLS 1.2 or earlier versions, the following authentication methods
are also available.
</p>
<ul class="itemize mark-bullet">
<li><abbr class="acronym">SRP</abbr> authentication: Authenticated key exchange using a password.
</li><li>Anonymous authentication: Key exchange without peer authentication.
</li></ul>
<hr>
</div>
<div class="subsection-level-extent" id="Client-Authentication">
<div class="nav-panel">
<p>
Next: <a href="#Resuming-Sessions" accesskey="n" rel="next">Resuming sessions</a>, Previous: <a href="#Authentication" accesskey="p" rel="prev">Authentication</a>, Up: <a href="#The-TLS-Handshake-Protocol" accesskey="u" rel="up">The TLS handshake protocol</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-authentication"><span>3.5.3 Client authentication<a class="copiable-link" href="#Client-authentication"> ¶</a></span></h4>
<a class="index-entry-id" id="index-client-certificate-authentication"></a>
<p>In the case of ciphersuites that use certificate authentication, the
authentication of the client is optional in <abbr class="acronym">TLS</abbr>. A server
may request a certificate from the client using the
<a class="ref" href="#gnutls_005fcertificate_005fserver_005fset_005frequest">gnutls_certificate_server_set_request</a> function. We elaborate
in <a class="ref" href="#Certificate-credentials">Certificates</a>.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Resuming-Sessions">
<div class="nav-panel">
<p>
Previous: <a href="#Client-Authentication" accesskey="p" rel="prev">Client authentication</a>, Up: <a href="#The-TLS-Handshake-Protocol" accesskey="u" rel="up">The TLS handshake protocol</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Resuming-sessions"><span>3.5.4 Resuming sessions<a class="copiable-link" href="#Resuming-sessions"> ¶</a></span></h4>
<a class="anchor" id="resume"></a><a class="index-entry-id" id="index-resuming-sessions"></a>
<a class="index-entry-id" id="index-session-resumption"></a>
<p>The TLS handshake process performs expensive calculations
and a busy server might easily be put under load. To
reduce the load, session resumption may be used. This
is a feature of the <abbr class="acronym">TLS</abbr> protocol which allows a
client to connect to a server after a successful handshake, without
the expensive calculations. This is achieved by re-using the previously
established keys, meaning the server needs to store the state of established
connections (unless session tickets are used – <a class="ref" href="#Session-tickets">Session tickets</a>).
</p>
<p>Session resumption is an integral part of <abbr class="acronym">GnuTLS</abbr>, and
<a class="ref" href="#Session-resumption">Session resumption</a>, <a class="ref" href="#ex_002dresume_002dclient">ex-resume-client</a> illustrate typical
uses of it.
</p>
<hr>
</div>
</div>
<div class="section-level-extent" id="TLS-Extensions">
<div class="nav-panel">
<p>
Next: <a href="#How-to-use-TLS-in-application-protocols" accesskey="n" rel="next">How to use <abbr class="acronym">TLS</abbr> in application protocols</a>, Previous: <a href="#The-TLS-Handshake-Protocol" accesskey="p" rel="prev">The TLS handshake protocol</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="TLS-extensions"><span>3.6 TLS extensions<a class="copiable-link" href="#TLS-extensions"> ¶</a></span></h3>
<a class="index-entry-id" id="index-TLS-extensions"></a>
<p>A number of extensions to the <abbr class="acronym">TLS</abbr> protocol have been
proposed mainly in [<a class="ref" href="#TLSEXT">TLSEXT</a>]. The extensions supported
in <abbr class="acronym">GnuTLS</abbr> are discussed in the subsections that follow.
</p>
<ul class="mini-toc">
<li><a href="#Maximum-fragment-length-negotiation" accesskey="1">Maximum fragment length negotiation</a></li>
<li><a href="#Server-name-indication" accesskey="2">Server name indication</a></li>
<li><a href="#Session-tickets" accesskey="3">Session tickets</a></li>
<li><a href="#HeartBeat" accesskey="4">HeartBeat</a></li>
<li><a href="#Safe-renegotiation" accesskey="5">Safe renegotiation</a></li>
<li><a href="#OCSP-status-request" accesskey="6">OCSP status request</a></li>
<li><a href="#SRTP" accesskey="7">SRTP</a></li>
<li><a href="#False-Start" accesskey="8">False Start</a></li>
<li><a href="#Application-Layer-Protocol-Negotiation-_0028ALPN_0029" accesskey="9">Application Layer Protocol Negotiation (ALPN)</a></li>
<li><a href="#Extensions-and-Supplemental-Data">Extensions and Supplemental Data</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Maximum-fragment-length-negotiation">
<div class="nav-panel">
<p>
Next: <a href="#Server-name-indication" accesskey="n" rel="next">Server name indication</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Maximum-fragment-length-negotiation-1"><span>3.6.1 Maximum fragment length negotiation<a class="copiable-link" href="#Maximum-fragment-length-negotiation-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-TLS-extensions-1"></a>
<a class="index-entry-id" id="index-maximum-fragment-length"></a>
<p>This extension allows a <abbr class="acronym">TLS</abbr> implementation to negotiate a
smaller value for record packet maximum length. This extension may be
useful to clients with constrained capabilities. The functions shown
below can be used to control this extension.
</p>
<dl class="table">
<dt><code class="code"><var class="var">size_t</var> <a class="ref" href="#gnutls_005frecord_005fget_005fmax_005fsize">gnutls_record_get_max_size</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
<dt><code class="code"><var class="var">ssize_t</var> <a class="ref" href="#gnutls_005frecord_005fset_005fmax_005fsize">gnutls_record_set_max_size</a> (gnutls_session_t <var class="var">session</var>, size_t <var class="var">size</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Server-name-indication">
<div class="nav-panel">
<p>
Next: <a href="#Session-tickets" accesskey="n" rel="next">Session tickets</a>, Previous: <a href="#Maximum-fragment-length-negotiation" accesskey="p" rel="prev">Maximum fragment length negotiation</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Server-name-indication-1"><span>3.6.2 Server name indication<a class="copiable-link" href="#Server-name-indication-1"> ¶</a></span></h4>
<a class="anchor" id="serverind"></a><a class="index-entry-id" id="index-TLS-extensions-2"></a>
<a class="index-entry-id" id="index-server-name-indication"></a>
<p>A common problem in <abbr class="acronym">HTTPS</abbr> servers is the fact that the
<abbr class="acronym">TLS</abbr> protocol is not aware of the hostname that a client
connects to, when the handshake procedure begins. For that reason the
<abbr class="acronym">TLS</abbr> server has no way to know which certificate to send.
</p>
<p>This extension solves that problem within the <abbr class="acronym">TLS</abbr> protocol,
and allows a client to send the HTTP hostname before the handshake
begins within the first handshake packet. The functions
<a class="ref" href="#gnutls_005fserver_005fname_005fset">gnutls_server_name_set</a> and <a class="ref" href="#gnutls_005fserver_005fname_005fget">gnutls_server_name_get</a> can be
used to enable this extension, or to retrieve the name sent by a
client.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fserver_005fname_005fset">gnutls_server_name_set</a> (gnutls_session_t <var class="var">session</var>, gnutls_server_name_type_t <var class="var">type</var>, const void * <var class="var">name</var>, size_t <var class="var">name_length</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fserver_005fname_005fget">gnutls_server_name_get</a> (gnutls_session_t <var class="var">session</var>, void * <var class="var">data</var>, size_t * <var class="var">data_length</var>, unsigned int * <var class="var">type</var>, unsigned int <var class="var">indx</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Session-tickets">
<div class="nav-panel">
<p>
Next: <a href="#HeartBeat" accesskey="n" rel="next">HeartBeat</a>, Previous: <a href="#Server-name-indication" accesskey="p" rel="prev">Server name indication</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Session-tickets-1"><span>3.6.3 Session tickets<a class="copiable-link" href="#Session-tickets-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-TLS-extensions-3"></a>
<a class="index-entry-id" id="index-session-tickets"></a>
<a class="index-entry-id" id="index-tickets"></a>
<p>To resume a TLS session, the server normally stores session parameters. This
complicates deployment, and can be avoided by delegating the storage
to the client. Because session parameters are sensitive they are encrypted
and authenticated with a key only known to the server and then sent to the
client. The Session Tickets extension is described in RFC 5077 [<a class="ref" href="#TLSTKT">TLSTKT</a>].
</p>
<p>A disadvantage of session tickets is that they eliminate the effects of
forward secrecy when a server uses the same key for long time. That is,
the secrecy of all sessions on a server using tickets depends on the ticket
key being kept secret. For that reason server keys should be rotated and discarded
regularly.
</p>
<p>Since version 3.1.3 GnuTLS clients transparently support session tickets,
unless forward secrecy is explicitly requested (with the PFS priority string).
</p>
<p>Under TLS 1.3 session tickets are mandatory for session resumption, and they
do not share the forward secrecy concerns as with TLS 1.2 or earlier.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="HeartBeat">
<div class="nav-panel">
<p>
Next: <a href="#Safe-renegotiation" accesskey="n" rel="next">Safe renegotiation</a>, Previous: <a href="#Session-tickets" accesskey="p" rel="prev">Session tickets</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="HeartBeat-1"><span>3.6.4 HeartBeat<a class="copiable-link" href="#HeartBeat-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-TLS-extensions-4"></a>
<a class="index-entry-id" id="index-heartbeat"></a>
<p>This is a TLS extension that allows to ping and receive confirmation from the peer,
and is described in [<a class="ref" href="#RFC6520">RFC6520</a>]. The extension is disabled by default and
<a class="ref" href="#gnutls_005fheartbeat_005fenable">gnutls_heartbeat_enable</a> can be used to enable it. A policy
may be negotiated to only allow sending heartbeat messages or sending and receiving.
The current session policy can be checked with <a class="ref" href="#gnutls_005fheartbeat_005fallowed">gnutls_heartbeat_allowed</a>.
The requests coming from the peer result to <code class="code">GNUTLS_E_HEARTBEAT_PING_RECEIVED</code>
being returned from the receive function. Ping requests to peer can be send via
<a class="ref" href="#gnutls_005fheartbeat_005fping">gnutls_heartbeat_ping</a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005fheartbeat_005fallowed">gnutls_heartbeat_allowed</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">type</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fheartbeat_005fenable">gnutls_heartbeat_enable</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">type</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fheartbeat_005fping">gnutls_heartbeat_ping</a> (gnutls_session_t <var class="var">session</var>, size_t <var class="var">data_size</var>, unsigned int <var class="var">max_tries</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fheartbeat_005fpong">gnutls_heartbeat_pong</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fheartbeat_005fset_005ftimeouts">gnutls_heartbeat_set_timeouts</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">retrans_timeout</var>, unsigned int <var class="var">total_timeout</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned int</var> <a class="ref" href="#gnutls_005fheartbeat_005fget_005ftimeout">gnutls_heartbeat_get_timeout</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Safe-renegotiation">
<div class="nav-panel">
<p>
Next: <a href="#OCSP-status-request" accesskey="n" rel="next">OCSP status request</a>, Previous: <a href="#HeartBeat" accesskey="p" rel="prev">HeartBeat</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Safe-renegotiation-1"><span>3.6.5 Safe renegotiation<a class="copiable-link" href="#Safe-renegotiation-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-renegotiation"></a>
<a class="index-entry-id" id="index-safe-renegotiation"></a>
<p>TLS gives the option to two communicating parties to renegotiate
and update their security parameters. One useful example of this feature
was for a client to initially connect using anonymous negotiation to a
server, and the renegotiate using some authenticated ciphersuite. This occurred
to avoid having the client sending its credentials in the clear.
</p>
<p>However this renegotiation, as initially designed would not ensure that
the party one is renegotiating is the same as the one in the initial negotiation.
For example one server could forward all renegotiation traffic to an other
server who will see this traffic as an initial negotiation attempt.
</p>
<p>This might be seen as a valid design decision, but it seems it was
not widely known or understood, thus today some application protocols use the TLS
renegotiation feature in a manner that enables a malicious server to insert
content of his choice in the beginning of a TLS session.
</p>
<p>The most prominent vulnerability was with HTTPS. There servers request
a renegotiation to enforce an anonymous user to use a certificate in order
to access certain parts of a web site. The
attack works by having the attacker simulate a client and connect to a
server, with server-only authentication, and send some data intended
to cause harm. The server will then require renegotiation from him
in order to perform the request.
When the proper client attempts to contact the server,
the attacker hijacks that connection and forwards traffic to
the initial server that requested renegotiation. The
attacker will not be able to read the data exchanged between the
client and the server. However, the server will (incorrectly) assume
that the initial request sent by the attacker was sent by the now authenticated
client. The result is a prefix plain-text injection attack.
</p>
<p>The above is just one example. Other vulnerabilities exists that do
not rely on the TLS renegotiation to change the client’s authenticated
status (either TLS or application layer).
</p>
<p>While fixing these application protocols and implementations would be
one natural reaction, an extension to TLS has been designed that
cryptographically binds together any renegotiated handshakes with the
initial negotiation. When the extension is used, the attack is
detected and the session can be terminated. The extension is
specified in [<a class="ref" href="#RFC5746">RFC5746</a>].
</p>
<p>GnuTLS supports the safe renegotiation extension. The default
behavior is as follows. Clients will attempt to negotiate the safe
renegotiation extension when talking to servers. Servers will accept
the extension when presented by clients. Clients and servers will
permit an initial handshake to complete even when the other side does
not support the safe renegotiation extension. Clients and servers
will refuse renegotiation attempts when the extension has not been
negotiated.
</p>
<p>Note that permitting clients to connect to servers when the safe
renegotiation extension is not enabled, is open up for attacks.
Changing this default behavior would prevent interoperability against
the majority of deployed servers out there. We will reconsider this
default behavior in the future when more servers have been upgraded.
Note that it is easy to configure clients to always require the safe
renegotiation extension from servers.
</p>
<p>To modify the default behavior, we have introduced some new priority
strings (see <a class="ref" href="#Priority-Strings">Priority strings</a>).
The <code class="code">%UNSAFE_RENEGOTIATION</code> priority string permits
(re-)handshakes even when the safe renegotiation extension was not
negotiated. The default behavior is <code class="code">%PARTIAL_RENEGOTIATION</code> that will
prevent renegotiation with clients and servers not supporting the
extension. This is secure for servers but leaves clients vulnerable
to some attacks, but this is a trade-off between security and compatibility
with old servers. The <code class="code">%SAFE_RENEGOTIATION</code> priority string makes
clients and servers require the extension for every handshake. The latter
is the most secure option for clients, at the cost of not being able
to connect to legacy servers. Servers will also deny clients that
do not support the extension from connecting.
</p>
<p>It is possible to disable use of the extension completely, in both
clients and servers, by using the <code class="code">%DISABLE_SAFE_RENEGOTIATION</code>
priority string however we strongly recommend you to only do this for
debugging and test purposes.
</p>
<p>The default values if the flags above are not specified are:
</p><dl class="table">
<dt><code class="code">Server:</code></dt>
<dd><p>%PARTIAL_RENEGOTIATION
</p>
</dd>
<dt><code class="code">Client:</code></dt>
<dd><p>%PARTIAL_RENEGOTIATION
</p>
</dd>
</dl>
<p>For applications we have introduced a new API related to safe
renegotiation. The <a class="ref" href="#gnutls_005fsafe_005frenegotiation_005fstatus">gnutls_safe_renegotiation_status</a> function is
used to check if the extension has been negotiated on a session, and
can be used both by clients and servers.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="OCSP-status-request">
<div class="nav-panel">
<p>
Next: <a href="#SRTP" accesskey="n" rel="next">SRTP</a>, Previous: <a href="#Safe-renegotiation" accesskey="p" rel="prev">Safe renegotiation</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="OCSP-status-request-1"><span>3.6.6 OCSP status request<a class="copiable-link" href="#OCSP-status-request-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-OCSP-status-request"></a>
<a class="index-entry-id" id="index-Certificate-status-request"></a>
<p>The Online Certificate Status Protocol (OCSP) is a protocol that allows the
client to verify the server certificate for revocation without messing with
certificate revocation lists. Its drawback is that it requires the client
to connect to the server’s CA OCSP server and request the status of the
certificate. This extension however, enables a TLS server to include
its CA OCSP server response in the handshake. That is an HTTPS server
may periodically run <code class="code">ocsptool</code> (see <a class="ref" href="#ocsptool-Invocation">Invoking ocsptool</a>) to obtain
its certificate revocation status and serve it to the clients. That
way a client avoids an additional connection to the OCSP server.
</p>
<p>See <a class="ref" href="#OCSP-stapling">OCSP stapling</a> for further information.
</p>
<p>Since version 3.1.3 GnuTLS clients transparently support the certificate status
request.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="SRTP">
<div class="nav-panel">
<p>
Next: <a href="#False-Start" accesskey="n" rel="next">False Start</a>, Previous: <a href="#OCSP-status-request" accesskey="p" rel="prev">OCSP status request</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="SRTP-1"><span>3.6.7 SRTP<a class="copiable-link" href="#SRTP-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-SRTP"></a>
<a class="index-entry-id" id="index-Secure-RTP"></a>
<p>The TLS protocol was extended in [<a class="ref" href="#RFC5764">RFC5764</a>] to provide keying material to the
Secure RTP (SRTP) protocol. The SRTP protocol provides an encapsulation of encrypted
data that is optimized for voice data. With the SRTP TLS extension two peers can
negotiate keys using TLS or DTLS and obtain keying material for use with SRTP. The
available SRTP profiles are listed below.
</p>
<div class="float" id="gnutls_005fsrtp_005fprofile_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_SRTP_AES128_CM_HMAC_SHA1_80</code></dt>
<dd><p>128 bit AES with a 80 bit HMAC-SHA1
</p></dd>
<dt><code class="code">GNUTLS_SRTP_AES128_CM_HMAC_SHA1_32</code></dt>
<dd><p>128 bit AES with a 32 bit HMAC-SHA1
</p></dd>
<dt><code class="code">GNUTLS_SRTP_NULL_HMAC_SHA1_80</code></dt>
<dd><p>NULL cipher with a 80 bit HMAC-SHA1
</p></dd>
<dt><code class="code">GNUTLS_SRTP_NULL_HMAC_SHA1_32</code></dt>
<dd><p>NULL cipher with a 32 bit HMAC-SHA1
</p></dd>
<dt><code class="code">GNUTLS_SRTP_AEAD_AES_128_GCM</code></dt>
<dd><p>128 bit AES with GCM
</p></dd>
<dt><code class="code">GNUTLS_SRTP_AEAD_AES_256_GCM</code></dt>
<dd><p>256 bit AES with GCM
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 3.2: </strong>Supported SRTP profiles</p></div></div>
<p>To enable use the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrtp_005fset_005fprofile">gnutls_srtp_set_profile</a> (gnutls_session_t <var class="var">session</var>, gnutls_srtp_profile_t <var class="var">profile</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrtp_005fset_005fprofile_005fdirect">gnutls_srtp_set_profile_direct</a> (gnutls_session_t <var class="var">session</var>, const char * <var class="var">profiles</var>, const char ** <var class="var">err_pos</var>)</code></dt>
</dl>
<p>To obtain the negotiated keys use the function below.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fget_005fkeys"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_get_keys</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">key_material</var>, unsigned int <var class="var">key_material_size</var>, gnutls_datum_t * <var class="var">client_key</var>, gnutls_datum_t * <var class="var">client_salt</var>, gnutls_datum_t * <var class="var">server_key</var>, gnutls_datum_t * <var class="var">server_salt</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fget_005fkeys"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">key_material</var>: Space to hold the generated key material
</p>
<p><var class="var">key_material_size</var>: The maximum size of the key material
</p>
<p><var class="var">client_key</var>: The master client write key, pointing inside the key material
</p>
<p><var class="var">client_salt</var>: The master client write salt, pointing inside the key material
</p>
<p><var class="var">server_key</var>: The master server write key, pointing inside the key material
</p>
<p><var class="var">server_salt</var>: The master server write salt, pointing inside the key material
</p>
<p>This is a helper function to generate the keying material for SRTP.
It requires the space of the key material to be pre-allocated (should be at least
2x the maximum key size and salt size). The <code class="code">client_key</code> , <code class="code">client_salt</code> , <code class="code">server_key</code> and <code class="code">server_salt</code> are convenience datums that point inside the key material. They may
be <code class="code">NULL</code> .
</p>
<p><strong class="strong">Returns:</strong> On success the size of the key material is returned,
otherwise, <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the buffer given is not
sufficient, or a negative error code.
</p>
<p>Since 3.1.4
</p></dd></dl>
<p>Other helper functions are listed below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrtp_005fget_005fselected_005fprofile">gnutls_srtp_get_selected_profile</a> (gnutls_session_t <var class="var">session</var>, gnutls_srtp_profile_t * <var class="var">profile</var>)</code></dt>
<dt><code class="code"><var class="var">const char *</var> <a class="ref" href="#gnutls_005fsrtp_005fget_005fprofile_005fname">gnutls_srtp_get_profile_name</a> (gnutls_srtp_profile_t <var class="var">profile</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrtp_005fget_005fprofile_005fid">gnutls_srtp_get_profile_id</a> (const char * <var class="var">name</var>, gnutls_srtp_profile_t * <var class="var">profile</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="False-Start">
<div class="nav-panel">
<p>
Next: <a href="#Application-Layer-Protocol-Negotiation-_0028ALPN_0029" accesskey="n" rel="next">Application Layer Protocol Negotiation (ALPN)</a>, Previous: <a href="#SRTP" accesskey="p" rel="prev">SRTP</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="False-Start-1"><span>3.6.8 False Start<a class="copiable-link" href="#False-Start-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-False-Start"></a>
<a class="index-entry-id" id="index-TLS-False-Start"></a>
<p>The TLS protocol was extended in [<a class="ref" href="#RFC7918">RFC7918</a>] to allow the client
to send data to server in a single round trip. This change however operates on the borderline
of the TLS protocol security guarantees and should be used for the cases where the reduced
latency outperforms the risk of an adversary intercepting the transferred data. In GnuTLS
applications can use the <abbr class="acronym">GNUTLS_ENABLE_FALSE_START</abbr> as option to <a class="ref" href="#gnutls_005finit">gnutls_init</a>
to request an early return of the <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> function. After that early
return the application is expected to transfer any data to be piggybacked on the last handshake
message.
</p>
<p>After handshake’s early termination, the application is expected to transmit
data using <a class="ref" href="#gnutls_005frecord_005fsend">gnutls_record_send</a>, and call <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a> on
any received data as soon, to ensure that handshake completes timely. That is, especially
relevant for applications which set an explicit time limit for the handshake process
via <a class="ref" href="#gnutls_005fhandshake_005fset_005ftimeout">gnutls_handshake_set_timeout</a>.
</p>
<p>Note however, that the API ensures that the early return will not happen
if the false start requirements are not satisfied. That is, on ciphersuites which are not
enabled for false start or on insufficient key sizes, the handshake
process will complete properly (i.e., no early return). To verify that false start was used you
may use <a class="ref" href="#gnutls_005fsession_005fget_005fflags">gnutls_session_get_flags</a> and check for the <abbr class="acronym">GNUTLS_SFLAGS_FALSE_START</abbr>
flag. For GnuTLS the false start is enabled for the following
key exchange methods (see [<a class="ref" href="#RFC7918">RFC7918</a>] for rationale)
</p><ul class="itemize mark-bullet">
<li>DHE
</li><li>ECDHE
</li></ul>
<p>but only when the negotiated parameters exceed <code class="code">GNUTLS_SEC_PARAM_HIGH</code>
–see <a class="ref" href="#tab_003akey_002dsizes">Table 6.7</a>, and when under (D)TLS 1.2 or later.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Application-Layer-Protocol-Negotiation-_0028ALPN_0029">
<div class="nav-panel">
<p>
Next: <a href="#Extensions-and-Supplemental-Data" accesskey="n" rel="next">Extensions and Supplemental Data</a>, Previous: <a href="#False-Start" accesskey="p" rel="prev">False Start</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Application-Layer-Protocol-Negotiation-_0028ALPN_0029-1"><span>3.6.9 Application Layer Protocol Negotiation (ALPN)<a class="copiable-link" href="#Application-Layer-Protocol-Negotiation-_0028ALPN_0029-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-ALPN"></a>
<a class="index-entry-id" id="index-Application-Layer-Protocol-Negotiation"></a>
<p>The TLS protocol was extended in <code class="code">RFC7301</code>
to provide the application layer a method of
negotiating the application protocol version. This allows for negotiation
of the application protocol during the TLS handshake, thus reducing
round-trips. The application protocol is described by an opaque
string. To enable, use the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005falpn_005fset_005fprotocols">gnutls_alpn_set_protocols</a> (gnutls_session_t <var class="var">session</var>, const gnutls_datum_t * <var class="var">protocols</var>, unsigned <var class="var">protocols_size</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005falpn_005fget_005fselected_005fprotocol">gnutls_alpn_get_selected_protocol</a> (gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">protocol</var>)</code></dt>
</dl>
<p>Note that these functions are intended to be used with protocols that are
registered in the Application Layer Protocol Negotiation IANA registry. While
you can use them for other protocols (at the risk of collisions), it is preferable
to register them.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Extensions-and-Supplemental-Data">
<div class="nav-panel">
<p>
Previous: <a href="#Application-Layer-Protocol-Negotiation-_0028ALPN_0029" accesskey="p" rel="prev">Application Layer Protocol Negotiation (ALPN)</a>, Up: <a href="#TLS-Extensions" accesskey="u" rel="up">TLS extensions</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Extensions-and-Supplemental-Data-1"><span>3.6.10 Extensions and Supplemental Data<a class="copiable-link" href="#Extensions-and-Supplemental-Data-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-Supplemental-data"></a>
<p>It is possible to transfer supplemental data during the TLS handshake, following
[<a class="ref" href="#RFC4680">RFC4680</a>]. This is for "custom" protocol modifications for applications which
may want to transfer additional data (e.g. additional authentication messages). Such
an exchange requires a custom extension to be registered.
The provided API for this functionality is low-level and described in <a class="ref" href="#TLS-Hello-Extension-Handling">TLS Extension Handling</a>.
</p>
<hr>
</div>
</div>
<div class="section-level-extent" id="How-to-use-TLS-in-application-protocols">
<div class="nav-panel">
<p>
Next: <a href="#On-SSL-2-and-older-protocols" accesskey="n" rel="next">On SSL 2 and older protocols</a>, Previous: <a href="#TLS-Extensions" accesskey="p" rel="prev">TLS extensions</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="How-to-use-TLS-in-application-protocols-1"><span>3.7 How to use <abbr class="acronym">TLS</abbr> in application protocols<a class="copiable-link" href="#How-to-use-TLS-in-application-protocols-1"> ¶</a></span></h3>
<p>This chapter is intended to provide some hints on how to use
<abbr class="acronym">TLS</abbr> over simple custom made application protocols. The
discussion below mainly refers to the <abbr class="acronym">TCP/IP</abbr> transport layer
but may be extended to other ones too.
</p>
<ul class="mini-toc">
<li><a href="#Separate-ports" accesskey="1">Separate ports</a></li>
<li><a href="#Upward-negotiation" accesskey="2">Upward negotiation</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Separate-ports">
<div class="nav-panel">
<p>
Next: <a href="#Upward-negotiation" accesskey="n" rel="next">Upward negotiation</a>, Up: <a href="#How-to-use-TLS-in-application-protocols" accesskey="u" rel="up">How to use <abbr class="acronym">TLS</abbr> in application protocols</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Separate-ports-1"><span>3.7.1 Separate ports<a class="copiable-link" href="#Separate-ports-1"> ¶</a></span></h4>
<p>Traditionally <abbr class="acronym">SSL</abbr> was used in application protocols by
assigning a new port number for the secure services. By doing this two
separate ports were assigned, one for the non-secure sessions, and one
for the secure sessions. This method ensures that if a user requests a
secure session then the client will attempt to connect to the secure port
and fail otherwise. The only possible attack with this method is to perform
a denial of service attack. The most famous example of this method is
“HTTP over TLS” or <abbr class="acronym">HTTPS</abbr> protocol [<a class="ref" href="#RFC2818">RFC2818</a>].
</p>
<p>Despite its wide use, this method has several issues. This
approach starts the <abbr class="acronym">TLS</abbr> Handshake procedure just after the
client connects on the —so called— secure port. That way the
<abbr class="acronym">TLS</abbr> protocol does not know anything about the client, and
popular methods like the host advertising in HTTP do not
work<a class="footnote" id="DOCF6" href="#FOOT6"><sup>6</sup></a>. There is no way for the client to say “I
connected to YYY server” before the Handshake starts, so the server
cannot possibly know which certificate to use.
</p>
<p>Other than that it requires two separate ports to run a single
service, which is unnecessary complication. Due to the fact that there
is a limitation on the available privileged ports, this approach was
soon deprecated in favor of upward negotiation.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Upward-negotiation">
<div class="nav-panel">
<p>
Previous: <a href="#Separate-ports" accesskey="p" rel="prev">Separate ports</a>, Up: <a href="#How-to-use-TLS-in-application-protocols" accesskey="u" rel="up">How to use <abbr class="acronym">TLS</abbr> in application protocols</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Upward-negotiation-1"><span>3.7.2 Upward negotiation<a class="copiable-link" href="#Upward-negotiation-1"> ¶</a></span></h4>
<p>Other application protocols<a class="footnote" id="DOCF7" href="#FOOT7"><sup>7</sup></a> use a
different approach to enable the secure layer. They use something
often called as the “TLS upgrade” method. This method is quite tricky but it
is more flexible. The idea is to extend the application protocol to
have a “STARTTLS” request, whose purpose it to start the TLS
protocols just after the client requests it. This approach
does not require any extra port to be reserved.
There is even an extension to HTTP protocol to support
this method [<a class="ref" href="#RFC2817">RFC2817</a>].
</p>
<p>The tricky part, in this method, is that the “STARTTLS” request is
sent in the clear, thus is vulnerable to modifications. A typical
attack is to modify the messages in a way that the client is fooled
and thinks that the server does not have the “STARTTLS” capability.
See a typical conversation of a hypothetical protocol:
</p>
<blockquote class="quotation">
<p>(client connects to the server)
</p>
<p>CLIENT: HELLO I’M MR. XXX
</p>
<p>SERVER: NICE TO MEET YOU XXX
</p>
<p>CLIENT: PLEASE START TLS
</p>
<p>SERVER: OK
</p>
<p>*** TLS STARTS
</p>
<p>CLIENT: HERE ARE SOME CONFIDENTIAL DATA
</p></blockquote>
<p>And an example of a conversation where someone is acting
in between:
</p>
<blockquote class="quotation">
<p>(client connects to the server)
</p>
<p>CLIENT: HELLO I’M MR. XXX
</p>
<p>SERVER: NICE TO MEET YOU XXX
</p>
<p>CLIENT: PLEASE START TLS
</p>
<p>(here someone inserts this message)
</p>
<p>SERVER: SORRY I DON’T HAVE THIS CAPABILITY
</p>
<p>CLIENT: HERE ARE SOME CONFIDENTIAL DATA
</p></blockquote>
<p>As you can see above the client was fooled, and was naïve enough to
send the confidential data in the clear, despite the server telling the
client that it does not support “STARTTLS”.
</p>
<p>How do we avoid the above attack? As you may have already noticed this
situation is easy to avoid. The client has to ask the user before it
connects whether the user requests <abbr class="acronym">TLS</abbr> or not. If the user
answered that he certainly wants the secure layer the last
conversation should be:
</p>
<blockquote class="quotation">
<p>(client connects to the server)
</p>
<p>CLIENT: HELLO I’M MR. XXX
</p>
<p>SERVER: NICE TO MEET YOU XXX
</p>
<p>CLIENT: PLEASE START TLS
</p>
<p>(here someone inserts this message)
</p>
<p>SERVER: SORRY I DON’T HAVE THIS CAPABILITY
</p>
<p>CLIENT: BYE
</p>
<p>(the client notifies the user that the secure connection was not possible)
</p></blockquote>
<p>This method, if implemented properly, is far better than the
traditional method, and the security properties remain the same, since
only denial of service is possible. The benefit is that the server may
request additional data before the <abbr class="acronym">TLS</abbr> Handshake protocol
starts, in order to send the correct certificate, use the correct
password file, or anything else!
</p>
<hr>
</div>
</div>
<div class="section-level-extent" id="On-SSL-2-and-older-protocols">
<div class="nav-panel">
<p>
Previous: <a href="#How-to-use-TLS-in-application-protocols" accesskey="p" rel="prev">How to use <abbr class="acronym">TLS</abbr> in application protocols</a>, Up: <a href="#Introduction-to-TLS" accesskey="u" rel="up">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="On-SSL-2-and-older-protocols-1"><span>3.8 On SSL 2 and older protocols<a class="copiable-link" href="#On-SSL-2-and-older-protocols-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-SSL-2"></a>
<p>One of the initial decisions in the <abbr class="acronym">GnuTLS</abbr> development was
to implement the known security protocols for the transport layer.
Initially <abbr class="acronym">TLS</abbr> 1.0 was implemented since it was the latest at
that time, and was considered to be the most advanced in security
properties. Later the <abbr class="acronym">SSL</abbr> 3.0 protocol was implemented
since it is still the only protocol supported by several servers and
there are no serious security vulnerabilities known.
</p>
<p>One question that may arise is why we didn’t implement <abbr class="acronym">SSL</abbr>
2.0 in the library. There are several reasons, most important being
that it has serious security flaws, unacceptable for a modern security
library. Other than that, this protocol is barely used by anyone
these days since it has been deprecated since 1996. The security
problems in <abbr class="acronym">SSL</abbr> 2.0 include:
</p>
<ul class="itemize mark-bullet">
<li>Message integrity compromised.
The <abbr class="acronym">SSLv2</abbr> message authentication uses the MD5 function, and
is insecure.
</li><li>Man-in-the-middle attack.
There is no protection of the handshake in <abbr class="acronym">SSLv2</abbr>, which
permits a man-in-the-middle attack.
</li><li>Truncation attack.
<abbr class="acronym">SSLv2</abbr> relies on TCP FIN to close the session, so the
attacker can forge a TCP FIN, and the peer cannot tell if it was a
legitimate end of data or not.
</li><li>Weak message integrity for export ciphers.
The cryptographic keys in <abbr class="acronym">SSLv2</abbr> are used for both message
authentication and encryption, so if weak encryption schemes are
negotiated (say 40-bit keys) the message authentication code uses the
same weak key, which isn’t necessary.
</li></ul>
<a class="index-entry-id" id="index-PCT"></a>
<p>Other protocols such as Microsoft’s <abbr class="acronym">PCT</abbr> 1 and <abbr class="acronym">PCT</abbr>
2 were not implemented because they were also abandoned and deprecated
by <abbr class="acronym">SSL</abbr> 3.0 and later <abbr class="acronym">TLS</abbr> 1.0.
</p>
<hr>
</div>
</div>
<div class="chapter-level-extent" id="Authentication-methods">
<div class="nav-panel">
<p>
Next: <a href="#Hardware-security-modules-and-abstract-key-types" accesskey="n" rel="next">Abstract key types and Hardware security modules</a>, Previous: <a href="#Introduction-to-TLS" accesskey="p" rel="prev">Introduction to <abbr class="acronym">TLS</abbr> and <abbr class="acronym">DTLS</abbr></a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Authentication-methods-1"><span>4 Authentication methods<a class="copiable-link" href="#Authentication-methods-1"> ¶</a></span></h2>
<a class="index-entry-id" id="index-authentication-methods"></a>
<p>The initial key exchange of the TLS protocol performs authentication
of the peers. In typical scenarios the server is authenticated to
the client, and optionally the client to the server.
</p>
<p>While many associate TLS with X.509 certificates and public key
authentication, the protocol supports various authentication methods,
including pre-shared keys, and passwords. In this chapter a description
of the existing authentication methods is provided, as well as some
guidance on which use-cases each method can be used at.
</p>
<ul class="mini-toc">
<li><a href="#Certificate-authentication" accesskey="1">Certificate authentication</a></li>
<li><a href="#More-on-certificate-authentication" accesskey="2">More on certificate authentication</a></li>
<li><a href="#Shared_002dkey-and-anonymous-authentication" accesskey="3">Shared-key and anonymous authentication</a></li>
<li><a href="#Selecting-an-appropriate-authentication-method" accesskey="4">Selecting an appropriate authentication method</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Certificate-authentication">
<div class="nav-panel">
<p>
Next: <a href="#More-on-certificate-authentication" accesskey="n" rel="next">More on certificate authentication</a>, Up: <a href="#Authentication-methods" accesskey="u" rel="up">Authentication methods</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Certificate-authentication-1"><span>4.1 Certificate authentication<a class="copiable-link" href="#Certificate-authentication-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-certificate-authentication"></a>
<p>The most known authentication method of <abbr class="acronym">TLS</abbr> are certificates.
The PKIX [<a class="ref" href="#PKIX">PKIX</a>] public key infrastructure is daily used by anyone
using a browser today. <abbr class="acronym">GnuTLS</abbr> provides a simple API to
verify the <abbr class="acronym">X.509</abbr> certificates as in [<a class="ref" href="#PKIX">PKIX</a>].
</p>
<p>The key exchange algorithms supported by certificate authentication are
shown in <a class="ref" href="#tab_003akey_002dexchange">Table 4.1</a>.
</p>
<div class="float" id="tab_003akey_002dexchange">
<table class="multitable">
<thead><tr><th width="20%">Key exchange</th><th width="70%">Description</th></tr></thead>
<tbody><tr><td width="20%">RSA</td><td width="70%">The RSA algorithm is used to encrypt a key and send it to the peer.
The certificate must allow the key to be used for encryption.</td></tr>
<tr><td width="20%">DHE_RSA</td><td width="70%">The RSA algorithm is used to sign ephemeral Diffie-Hellman parameters
which are sent to the peer. The key in the certificate must allow the
key to be used for signing. Note that key exchange algorithms which
use ephemeral Diffie-Hellman parameters, offer perfect forward
secrecy. That means that even if the private key used for signing is
compromised, it cannot be used to reveal past session data.</td></tr>
<tr><td width="20%">ECDHE_RSA</td><td width="70%">The RSA algorithm is used to sign ephemeral elliptic curve Diffie-Hellman
parameters which are sent to the peer. The key in the certificate must allow
the key to be used for signing. It also offers perfect forward
secrecy. That means that even if the private key used for signing is
compromised, it cannot be used to reveal past session data.</td></tr>
<tr><td width="20%">DHE_DSS</td><td width="70%">The DSA algorithm is used to sign ephemeral Diffie-Hellman parameters
which are sent to the peer. The certificate must contain DSA
parameters to use this key exchange algorithm. DSA is the algorithm
of the Digital Signature Standard (DSS).</td></tr>
<tr><td width="20%">ECDHE_ECDSA</td><td width="70%">The Elliptic curve DSA algorithm is used to sign ephemeral elliptic
curve Diffie-Hellman parameters which are sent to the peer. The
certificate must contain ECDSA parameters (i.e., EC and marked for signing)
to use this key exchange algorithm.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 4.1: </strong>Supported key exchange algorithms.</p></div></div>
<ul class="mini-toc">
<li><a href="#X_002e509-certificates" accesskey="1"><abbr class="acronym">X.509</abbr> certificates</a></li>
<li><a href="#OpenPGP-certificates" accesskey="2"><abbr class="acronym">OpenPGP</abbr> certificates</a></li>
<li><a href="#Raw-public_002dkeys" accesskey="3">Raw public-keys</a></li>
<li><a href="#Advanced-certificate-verification" accesskey="4">Advanced certificate verification</a></li>
<li><a href="#Digital-signatures" accesskey="5">Digital signatures</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="X_002e509-certificates">
<div class="nav-panel">
<p>
Next: <a href="#OpenPGP-certificates" accesskey="n" rel="next"><abbr class="acronym">OpenPGP</abbr> certificates</a>, Up: <a href="#Certificate-authentication" accesskey="u" rel="up">Certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="X_002e509-certificates-1"><span>4.1.1 <abbr class="acronym">X.509</abbr> certificates<a class="copiable-link" href="#X_002e509-certificates-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-X_002e509-certificates"></a>
<p>The <abbr class="acronym">X.509</abbr> protocols rely on a hierarchical trust model. In
this trust model Certification Authorities (CAs) are used to certify
entities. Usually more than one certification authorities exist, and
certification authorities may certify other authorities to issue
certificates as well, following a hierarchical model.
</p>
<div class="float" id="fig_002dx509">
<img class="image" src="gnutls-x509.png" alt="gnutls-x509">
<div class="caption"><p><strong class="strong">Figure 4.1: </strong>An example of the X.509 hierarchical trust model.</p></div></div>
<p>One needs to trust one or more CAs for his secure communications. In
that case only the certificates issued by the trusted authorities are
acceptable. The framework is illustrated on <a class="ref" href="#fig_002dx509">Figure 4.1</a>.
</p>
<ul class="mini-toc">
<li><a href="#X_002e509-certificate-structure" accesskey="1"><abbr class="acronym">X.509</abbr> certificate structure</a></li>
<li><a href="#Importing-an-X_002e509-certificate" accesskey="2">Importing an X.509 certificate</a></li>
<li><a href="#X_002e509-certificate-names" accesskey="3">X.509 certificate names</a></li>
<li><a href="#X_002e509-distinguished-names" accesskey="4">X.509 distinguished names</a></li>
<li><a href="#X_002e509-extensions" accesskey="5">X.509 extensions</a></li>
<li><a href="#X_002e509-public-and-private-keys" accesskey="6">Accessing public and private keys</a></li>
<li><a href="#Verifying-X_002e509-certificate-paths" accesskey="7">Verifying <abbr class="acronym">X.509</abbr> certificate paths</a></li>
<li><a href="#Verifying-a-certificate-in-the-context-of-TLS-session" accesskey="8">Verifying a certificate in the context of TLS session</a></li>
<li><a href="#Verification-using-PKCS11" accesskey="9">Verifying a certificate using PKCS #11</a></li>
</ul>
<hr>
<div class="subsubsection-level-extent" id="X_002e509-certificate-structure">
<div class="nav-panel">
<p>
Next: <a href="#Importing-an-X_002e509-certificate" accesskey="n" rel="next">Importing an X.509 certificate</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="X_002e509-certificate-structure-1"><span>4.1.1.1 <abbr class="acronym">X.509</abbr> certificate structure<a class="copiable-link" href="#X_002e509-certificate-structure-1"> ¶</a></span></h4>
<p>An <abbr class="acronym">X.509</abbr> certificate usually contains information about the
certificate holder, the signer, a unique serial number, expiration
dates and some other fields [<a class="ref" href="#PKIX">PKIX</a>] as shown in <a class="ref" href="#tab_003ax509">Table 4.2</a>.
</p>
<div class="float" id="tab_003ax509">
<table class="multitable">
<thead><tr><th width="20%">Field</th><th width="70%">Description</th></tr></thead>
<tbody><tr><td width="20%">version</td><td width="70%">The field that indicates the version of the certificate.</td></tr>
<tr><td width="20%">serialNumber</td><td width="70%">This field holds a unique serial number per certificate.</td></tr>
<tr><td width="20%">signature</td><td width="70%">The issuing authority’s signature.</td></tr>
<tr><td width="20%">issuer</td><td width="70%">Holds the issuer’s distinguished name.</td></tr>
<tr><td width="20%">validity</td><td width="70%">The activation and expiration dates.</td></tr>
<tr><td width="20%">subject</td><td width="70%">The subject’s distinguished name of the certificate.</td></tr>
<tr><td width="20%">extensions</td><td width="70%">The extensions are fields only present in version 3 certificates.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 4.2: </strong>X.509 certificate fields.</p></div></div>
<p>The certificate’s <em class="emph">subject or issuer name</em> is not just a single
string. It is a Distinguished name and in the <abbr class="acronym">ASN.1</abbr>
notation is a sequence of several object identifiers with their corresponding
values. Some of available OIDs to be used in an <abbr class="acronym">X.509</abbr>
distinguished name are defined in <samp class="file">gnutls/x509.h</samp>.
</p>
<p>The <em class="emph">Version</em> field in a certificate has values either 1 or 3 for
version 3 certificates. Version 1 certificates do not support the
extensions field so it is not possible to distinguish a CA from a
person, thus their usage should be avoided.
</p>
<p>The <em class="emph">validity</em> dates are there to indicate the date that the
specific certificate was activated and the date the certificate’s key
would be considered invalid.
</p>
<p>In <abbr class="acronym">GnuTLS</abbr> the <abbr class="acronym">X.509</abbr> certificate structures are
handled using the <code class="code">gnutls_x509_crt_t</code> type and the corresponding
private keys with the <code class="code">gnutls_x509_privkey_t</code> type. All the
available functions for <abbr class="acronym">X.509</abbr> certificate handling have
their prototypes in <samp class="file">gnutls/x509.h</samp>. An example program to
demonstrate the <abbr class="acronym">X.509</abbr> parsing capabilities can be found in
<a class="ref" href="#ex_002dx509_002dinfo">ex-x509-info</a>.
</p>
<hr>
</div>
<div class="subsubsection-level-extent" id="Importing-an-X_002e509-certificate">
<div class="nav-panel">
<p>
Next: <a href="#X_002e509-certificate-names" accesskey="n" rel="next">X.509 certificate names</a>, Previous: <a href="#X_002e509-certificate-structure" accesskey="p" rel="prev"><abbr class="acronym">X.509</abbr> certificate structure</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Importing-an-X_002e509-certificate-1"><span>4.1.1.2 Importing an X.509 certificate<a class="copiable-link" href="#Importing-an-X_002e509-certificate-1"> ¶</a></span></h4>
<p>The certificate structure should be initialized using <a class="ref" href="#gnutls_005fx509_005fcrt_005finit">gnutls_x509_crt_init</a>, and
a certificate structure can be imported using <a class="ref" href="#gnutls_005fx509_005fcrt_005fimport">gnutls_x509_crt_import</a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005finit">gnutls_x509_crt_init</a> (gnutls_x509_crt_t * <var class="var">cert</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fimport">gnutls_x509_crt_import</a> (gnutls_x509_crt_t <var class="var">cert</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fdeinit">gnutls_x509_crt_deinit</a> (gnutls_x509_crt_t <var class="var">cert</var>)</code></dt>
</dl>
<p>In several functions an array of certificates is required. To assist in initialization
and import the following two functions are provided.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005flist_005fimport">gnutls_x509_crt_list_import</a> (gnutls_x509_crt_t * <var class="var">certs</var>, unsigned int * <var class="var">cert_max</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005flist_005fimport2">gnutls_x509_crt_list_import2</a> (gnutls_x509_crt_t ** <var class="var">certs</var>, unsigned int * <var class="var">size</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<p>In all cases after use a certificate must be deinitialized using <a class="ref" href="#gnutls_005fx509_005fcrt_005fdeinit">gnutls_x509_crt_deinit</a>.
Note that although the functions above apply to <code class="code">gnutls_x509_crt_t</code> structure, similar functions
exist for the CRL structure <code class="code">gnutls_x509_crl_t</code>.
</p>
<hr>
</div>
<div class="subsubsection-level-extent" id="X_002e509-certificate-names">
<div class="nav-panel">
<p>
Next: <a href="#X_002e509-distinguished-names" accesskey="n" rel="next">X.509 distinguished names</a>, Previous: <a href="#Importing-an-X_002e509-certificate" accesskey="p" rel="prev">Importing an X.509 certificate</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="X_002e509-certificate-names-1"><span>4.1.1.3 X.509 certificate names<a class="copiable-link" href="#X_002e509-certificate-names-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-X_002e509-certificate-name"></a>
<p>X.509 certificates allow for multiple names and types of names to be specified.
CA certificates often rely on X.509 distinguished names (see <a class="ref" href="#X_002e509-distinguished-names">X.509 distinguished names</a>)
for unique identification, while end-user and server certificates rely on the
’subject alternative names’. The subject alternative names provide a typed name, e.g.,
a DNS name, or an email address, which identifies the owner of the certificate.
The following functions provide access to that names.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname2">gnutls_x509_crt_get_subject_alt_name2</a> (gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">san</var>, size_t * <var class="var">san_size</var>, unsigned int * <var class="var">san_type</var>, unsigned int * <var class="var">critical</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fname">gnutls_x509_crt_set_subject_alt_name</a> (gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsubject_005falt_005fnames_005finit">gnutls_subject_alt_names_init</a> (gnutls_subject_alt_names_t * <var class="var">sans</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsubject_005falt_005fnames_005fget">gnutls_subject_alt_names_get</a> (gnutls_subject_alt_names_t <var class="var">sans</var>, unsigned int <var class="var">seq</var>, unsigned int * <var class="var">san_type</var>, gnutls_datum_t * <var class="var">san</var>, gnutls_datum_t * <var class="var">othername_oid</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsubject_005falt_005fnames_005fset">gnutls_subject_alt_names_set</a> (gnutls_subject_alt_names_t <var class="var">sans</var>, unsigned int <var class="var">san_type</var>, const gnutls_datum_t * <var class="var">san</var>, const char * <var class="var">othername_oid</var>)</code></dt>
</dl>
<p>Note however, that server certificates often used the Common Name (CN), part of the
certificate DistinguishedName to place a single DNS address. That practice is discouraged
(see [<a class="ref" href="#RFC6125">RFC6125</a>]), because only a single address can be specified, and the CN field is
free-form making matching ambiguous.
</p>
<hr>
</div>
<div class="subsubsection-level-extent" id="X_002e509-distinguished-names">
<div class="nav-panel">
<p>
Next: <a href="#X_002e509-extensions" accesskey="n" rel="next">X.509 extensions</a>, Previous: <a href="#X_002e509-certificate-names" accesskey="p" rel="prev">X.509 certificate names</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="X_002e509-distinguished-names-1"><span>4.1.1.4 X.509 distinguished names<a class="copiable-link" href="#X_002e509-distinguished-names-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-X_002e509-distinguished-name"></a>
<p>The “subject” of an X.509 certificate is not described by
a single name, but rather with a distinguished name. This in
X.509 terminology is a list of strings each associated an object
identifier. To make things simple GnuTLS provides <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fdn2">gnutls_x509_crt_get_dn2</a>
which follows the rules in [<a class="ref" href="#RFC4514">RFC4514</a>] and returns a single
string. Access to each string by individual object identifiers
can be accessed using <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid">gnutls_x509_crt_get_dn_by_oid</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fdn2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_dn2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fdn2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p>This function will allocate buffer and copy the name of the Certificate.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crt_get_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fdn">gnutls_x509_crt_get_dn</a> (gnutls_x509_crt_t <var class="var">cert</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid">gnutls_x509_crt_get_dn_by_oid</a> (gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, unsigned int <var class="var">raw_flag</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fdn_005foid">gnutls_x509_crt_get_dn_oid</a> (gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code></dt>
</dl>
<p>Similar functions exist to access the distinguished name
of the issuer of the certificate.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn">gnutls_x509_crt_get_issuer_dn</a> (gnutls_x509_crt_t <var class="var">cert</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn2">gnutls_x509_crt_get_issuer_dn2</a> (gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005fby_005foid">gnutls_x509_crt_get_issuer_dn_by_oid</a> (gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, unsigned int <var class="var">raw_flag</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005foid">gnutls_x509_crt_get_issuer_dn_oid</a> (gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fissuer">gnutls_x509_crt_get_issuer</a> (gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_dn_t * <var class="var">dn</var>)</code></dt>
</dl>
<p>The more powerful <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fsubject">gnutls_x509_crt_get_subject</a> and
<a class="ref" href="#gnutls_005fx509_005fdn_005fget_005frdn_005fava">gnutls_x509_dn_get_rdn_ava</a> provide efficient but low-level access
to the contents of the distinguished name structure.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fsubject">gnutls_x509_crt_get_subject</a> (gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_dn_t * <var class="var">dn</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fissuer">gnutls_x509_crt_get_issuer</a> (gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_dn_t * <var class="var">dn</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fget_005frdn_005fava"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_get_rdn_ava</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, int <var class="var">irdn</var>, int <var class="var">iava</var>, gnutls_x509_ava_st * <var class="var">ava</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fget_005frdn_005fava"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: a pointer to DN
</p>
<p><var class="var">irdn</var>: index of RDN
</p>
<p><var class="var">iava</var>: index of AVA.
</p>
<p><var class="var">ava</var>: Pointer to structure which will hold output information.
</p>
<p>Get pointers to data within the DN. The format of the <code class="code">ava</code> structure
is shown below.
</p>
<p>struct gnutls_x509_ava_st {
gnutls_datum_t oid;
gnutls_datum_t value;
unsigned long value_tag;
};
</p>
<p>The X.509 distinguished name is a sequence of sequences of strings
and this is what the <code class="code">irdn</code> and <code class="code">iava</code> indexes model.
</p>
<p>Note that <code class="code">ava</code> will contain pointers into the <code class="code">dn</code> structure which
in turns points to the original certificate. Thus you should not
modify any data or deallocate any of those.
</p>
<p>This is a low-level function that requires the caller to do the
value conversions when necessary (e.g. from UCS-2).
</p>
<p><strong class="strong">Returns:</strong> Returns 0 on success, or an error code.
</p></dd></dl>
<hr>
</div>
<div class="subsubsection-level-extent" id="X_002e509-extensions">
<div class="nav-panel">
<p>
Next: <a href="#X_002e509-public-and-private-keys" accesskey="n" rel="next">Accessing public and private keys</a>, Previous: <a href="#X_002e509-distinguished-names" accesskey="p" rel="prev">X.509 distinguished names</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="X_002e509-extensions-1"><span>4.1.1.5 X.509 extensions<a class="copiable-link" href="#X_002e509-extensions-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-X_002e509-extensions"></a>
<p>X.509 version 3 certificates include a list of extensions that can
be used to obtain additional information on the subject or the issuer
of the certificate. Those may be e-mail addresses, flags that indicate whether the
belongs to a CA etc. All the supported <abbr class="acronym">X.509</abbr> version 3
extensions are shown in <a class="ref" href="#tab_003ax509_002dext">Table 4.3</a>.
</p>
<p>The certificate extensions access is split into two parts. The first
requires to retrieve the extension, and the second is the parsing part.
</p>
<p>To enumerate and retrieve the DER-encoded extension data available in a certificate the following
two functions are available.
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005finfo">gnutls_x509_crt_get_extension_info</a> (gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>, unsigned int * <var class="var">critical</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005fdata2">gnutls_x509_crt_get_extension_data2</a> (gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid2">gnutls_x509_crt_get_extension_by_oid2</a> (gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">output</var>, unsigned int * <var class="var">critical</var>)</code></dt>
</dl>
<p>After a supported DER-encoded extension is retrieved it can be parsed using the APIs in <code class="code">x509-ext.h</code>.
Complex extensions may require initializing an intermediate structure that holds the
parsed extension data. Examples of simple parsing functions are shown below.
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fext_005fimport_005fbasic_005fconstraints">gnutls_x509_ext_import_basic_constraints</a> (const gnutls_datum_t * <var class="var">ext</var>, unsigned int * <var class="var">ca</var>, int * <var class="var">pathlen</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fext_005fexport_005fbasic_005fconstraints">gnutls_x509_ext_export_basic_constraints</a> (unsigned int <var class="var">ca</var>, int <var class="var">pathlen</var>, gnutls_datum_t * <var class="var">ext</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fext_005fimport_005fkey_005fusage">gnutls_x509_ext_import_key_usage</a> (const gnutls_datum_t * <var class="var">ext</var>, unsigned int * <var class="var">key_usage</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fext_005fexport_005fkey_005fusage">gnutls_x509_ext_export_key_usage</a> (unsigned int <var class="var">usage</var>, gnutls_datum_t * <var class="var">ext</var>)</code></dt>
</dl>
<p>More complex extensions, such as Name Constraints, require an intermediate structure, in that
case <code class="code">gnutls_x509_name_constraints_t</code> to be initialized in order to store the parsed
extension data.
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fext_005fimport_005fname_005fconstraints">gnutls_x509_ext_import_name_constraints</a> (const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fext_005fexport_005fname_005fconstraints">gnutls_x509_ext_export_name_constraints</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_datum_t * <var class="var">ext</var>)</code></dt>
</dl>
<p>After the name constraints are extracted in the structure, the following functions
can be used to access them.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005fget_005fpermitted">gnutls_x509_name_constraints_get_permitted</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned <var class="var">idx</var>, unsigned * <var class="var">type</var>, gnutls_datum_t * <var class="var">name</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005fget_005fexcluded">gnutls_x509_name_constraints_get_excluded</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned <var class="var">idx</var>, unsigned * <var class="var">type</var>, gnutls_datum_t * <var class="var">name</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005fadd_005fpermitted">gnutls_x509_name_constraints_add_permitted</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">name</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005fadd_005fexcluded">gnutls_x509_name_constraints_add_excluded</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">name</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005fcheck">gnutls_x509_name_constraints_check</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">name</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005fcheck_005fcrt">gnutls_x509_name_constraints_check_crt</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, gnutls_x509_crt_t <var class="var">cert</var>)</code></dt>
</dl>
<p>Other utility functions are listed below.
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005finit">gnutls_x509_name_constraints_init</a> (gnutls_x509_name_constraints_t * <var class="var">nc</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fx509_005fname_005fconstraints_005fdeinit">gnutls_x509_name_constraints_deinit</a> (gnutls_x509_name_constraints_t <var class="var">nc</var>)</code></dt>
</dl>
<p>Similar functions exist for all of the other supported extensions, listed in <a class="ref" href="#tab_003ax509_002dext">Table 4.3</a>.
</p>
<div class="float" id="tab_003ax509_002dext">
<table class="multitable">
<thead><tr><th width="30%">Extension</th><th width="20%">OID</th><th width="40%">Description</th></tr></thead>
<tbody><tr><td width="30%">Subject key id</td><td width="20%">2.5.29.14</td><td width="40%">An identifier of the key of the subject.</td></tr>
<tr><td width="30%">Key usage</td><td width="20%">2.5.29.15</td><td width="40%">Constraints the key’s usage of the certificate.</td></tr>
<tr><td width="30%">Private key usage period</td><td width="20%">2.5.29.16</td><td width="40%">Constraints the validity time of the private key.</td></tr>
<tr><td width="30%">Subject alternative name</td><td width="20%">2.5.29.17</td><td width="40%">Alternative names to subject’s distinguished name.</td></tr>
<tr><td width="30%">Issuer alternative name</td><td width="20%">2.5.29.18</td><td width="40%">Alternative names to the issuer’s distinguished name.</td></tr>
<tr><td width="30%">Basic constraints</td><td width="20%">2.5.29.19</td><td width="40%">Indicates whether this is a CA certificate or not, and specify the
maximum path lengths of certificate chains.</td></tr>
<tr><td width="30%">Name constraints</td><td width="20%">2.5.29.30</td><td width="40%">A field in CA certificates that restricts the scope of the name of
issued certificates.</td></tr>
<tr><td width="30%">CRL distribution points</td><td width="20%">2.5.29.31</td><td width="40%">This extension is set by the CA, in order to inform about the
location of issued Certificate Revocation Lists.</td></tr>
<tr><td width="30%">Certificate policy</td><td width="20%">2.5.29.32</td><td width="40%">This extension is set to indicate the certificate policy as object
identifier and may contain a descriptive string or URL.</td></tr>
<tr><td width="30%">Extended key usage</td><td width="20%">2.5.29.54</td><td width="40%">Inhibit any policy extension. Constraints the any policy OID
(<code class="code">GNUTLS_X509_OID_POLICY_ANY</code>) use in the policy extension.</td></tr>
<tr><td width="30%">Authority key identifier</td><td width="20%">2.5.29.35</td><td width="40%">An identifier of the key of the issuer of the certificate. That is
used to distinguish between different keys of the same issuer.</td></tr>
<tr><td width="30%">Extended key usage</td><td width="20%">2.5.29.37</td><td width="40%">Constraints the purpose of the certificate.</td></tr>
<tr><td width="30%">Authority information access</td><td width="20%">1.3.6.1.5.5.7.1.1</td><td width="40%">Information on services by the issuer of the certificate.</td></tr>
<tr><td width="30%">Proxy Certification Information</td><td width="20%">1.3.6.1.5.5.7.1.14</td><td width="40%">Proxy Certificates includes this extension that contains the OID of
the proxy policy language used, and can specify limits on the maximum
lengths of proxy chains. Proxy Certificates are specified in
[<a class="ref" href="#RFC3820">RFC3820</a>].</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 4.3: </strong>Supported X.509 certificate extensions.</p></div></div>
<p>Note, that there are also direct APIs to access extensions that may
be simpler to use for non-complex extensions. They are available
in <code class="code">x509.h</code> and some examples are listed below.
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fbasic_005fconstraints">gnutls_x509_crt_get_basic_constraints</a> (gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">critical</var>, unsigned int * <var class="var">ca</var>, int * <var class="var">pathlen</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fset_005fbasic_005fconstraints">gnutls_x509_crt_set_basic_constraints</a> (gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">ca</var>, int <var class="var">pathLenConstraint</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fkey_005fusage">gnutls_x509_crt_get_key_usage</a> (gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">key_usage</var>, unsigned int * <var class="var">critical</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fset_005fkey_005fusage">gnutls_x509_crt_set_key_usage</a> (gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">usage</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsubsection-level-extent" id="X_002e509-public-and-private-keys">
<div class="nav-panel">
<p>
Next: <a href="#Verifying-X_002e509-certificate-paths" accesskey="n" rel="next">Verifying <abbr class="acronym">X.509</abbr> certificate paths</a>, Previous: <a href="#X_002e509-extensions" accesskey="p" rel="prev">X.509 extensions</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Accessing-public-and-private-keys"><span>4.1.1.6 Accessing public and private keys<a class="copiable-link" href="#Accessing-public-and-private-keys"> ¶</a></span></h4>
<p>Each X.509 certificate contains a public key that corresponds to a private key. To
get a unique identifier of the public key the <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fkey_005fid">gnutls_x509_crt_get_key_id</a>
function is provided. To export the public key or its parameters you may need
to convert the X.509 structure to a <code class="code">gnutls_pubkey_t</code>. See
<a class="ref" href="#Abstract-public-keys">Public keys</a> for more information.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">flags</var>: should be one of the flags from <code class="code">gnutls_keyid_flags_t</code>
</p>
<p><var class="var">output_data</var>: will contain the key ID
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will return a unique ID that depends on the public
key parameters. This ID can be used in checking whether a
certificate corresponds to the given private key.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned. The output will normally be a SHA-1 hash output,
which is 20 bytes.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>
<p>The private key parameters may be directly accessed by using one of the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm2">gnutls_x509_privkey_get_pk_algorithm2</a> (gnutls_x509_privkey_t <var class="var">key</var>, unsigned int * <var class="var">bits</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw2">gnutls_x509_privkey_export_rsa_raw2</a> (gnutls_x509_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, gnutls_datum_t * <var class="var">d</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">u</var>, gnutls_datum_t * <var class="var">e1</var>, gnutls_datum_t * <var class="var">e2</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fexport_005fecc_005fraw">gnutls_x509_privkey_export_ecc_raw</a> (gnutls_x509_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">k</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fexport_005fdsa_005fraw">gnutls_x509_privkey_export_dsa_raw</a> (gnutls_x509_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">x</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fget_005fkey_005fid">gnutls_x509_privkey_get_key_id</a> (gnutls_x509_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsubsection-level-extent" id="Verifying-X_002e509-certificate-paths">
<div class="nav-panel">
<p>
Next: <a href="#Verifying-a-certificate-in-the-context-of-TLS-session" accesskey="n" rel="next">Verifying a certificate in the context of TLS session</a>, Previous: <a href="#X_002e509-public-and-private-keys" accesskey="p" rel="prev">Accessing public and private keys</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Verifying-X_002e509-certificate-paths-1"><span>4.1.1.7 Verifying <abbr class="acronym">X.509</abbr> certificate paths<a class="copiable-link" href="#Verifying-X_002e509-certificate-paths-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-verifying-certificate-paths"></a>
<p>Verifying certificate paths is important in <abbr class="acronym">X.509</abbr>
authentication. For this purpose the following functions are
provided.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcas"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_cas</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_x509_crt_t * <var class="var">clist</var>, unsigned <var class="var">clist_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcas"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">clist</var>: A list of CAs
</p>
<p><var class="var">clist_size</var>: The length of the CA list
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p>This function will add the given certificate authorities
to the trusted list. The CAs in <code class="code">clist</code> must not be deinitialized
during the lifetime of <code class="code">list</code> .
</p>
<p>If the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code> is specified, then
this function will ensure that no duplicates will be
present in the final trust list.
</p>
<p>If the flag <code class="code">GNUTLS_TL_NO_DUPLICATE_KEY</code> is specified, then
this function will ensure that no certificates with the
same key are present in the final trust list.
</p>
<p>If either <code class="code">GNUTLS_TL_NO_DUPLICATE_KEY</code> or <code class="code">GNUTLS_TL_NO_DUPLICATES</code>
are given, <code class="code">gnutls_x509_trust_list_deinit()</code> must be called with parameter
<code class="code">all</code> being 1.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned; that includes
duplicate entries.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_named_crt</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">name</var>, size_t <var class="var">name_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert</var>: A certificate
</p>
<p><var class="var">name</var>: An identifier for the certificate
</p>
<p><var class="var">name_size</var>: The size of the identifier
</p>
<p><var class="var">flags</var>: should be 0.
</p>
<p>This function will add the given certificate to the trusted
list and associate it with a name. The certificate will not be
be used for verification with <code class="code">gnutls_x509_trust_list_verify_crt()</code>
but with <code class="code">gnutls_x509_trust_list_verify_named_crt()</code> or
<code class="code">gnutls_x509_trust_list_verify_crt2()</code> - the latter only since
GnuTLS 3.4.0 and if a hostname is provided.
</p>
<p>In principle this function can be used to set individual "server"
certificates that are trusted by the user for that specific server
but for no other purposes.
</p>
<p>The certificate <code class="code">cert</code> must not be deinitialized during the lifetime
of the <code class="code">list</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_crls</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_x509_crl_t * <var class="var">crl_list</var>, unsigned <var class="var">crl_size</var>, unsigned int <var class="var">flags</var>, unsigned int <var class="var">verification_flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">crl_list</var>: A list of CRLs
</p>
<p><var class="var">crl_size</var>: The length of the CRL list
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p><var class="var">verification_flags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function will add the given certificate revocation lists
to the trusted list. The CRLs in <code class="code">crl_list</code> must not be deinitialized
during the lifetime of <code class="code">list</code> .
</p>
<p>This function must be called after <code class="code">gnutls_x509_trust_list_add_cas()</code>
to allow verifying the CRLs for validity. If the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code>
is given, then the final CRL list will not contain duplicate entries.
</p>
<p>If the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code> is given, <code class="code">gnutls_x509_trust_list_deinit()</code> must be
called with parameter <code class="code">all</code> being 1.
</p>
<p>If flag <code class="code">GNUTLS_TL_VERIFY_CRL</code> is given the CRLs will be verified before being added,
and if verification fails, they will be skipped.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned; that includes
duplicate entries.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_verify_crt</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t * <var class="var">cert_list</var>, unsigned int <var class="var">cert_list_size</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">voutput</var>, gnutls_verify_output_function <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert_list</var>: is the certificate list to be verified
</p>
<p><var class="var">cert_list_size</var>: is the certificate list size
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">voutput</var>: will hold the certificate verification output.
</p>
<p><var class="var">func</var>: If non-null will be called on each chain element verification with the output.
</p>
<p>This function will try to verify the given certificate and return
its status. The <code class="code">voutput</code> parameter will hold an OR’ed sequence of
<code class="code">gnutls_certificate_status_t</code> flags.
</p>
<p>The details of the verification are the same as in <code class="code">gnutls_x509_trust_list_verify_crt2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_verify_crt2</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t * <var class="var">cert_list</var>, unsigned int <var class="var">cert_list_size</var>, gnutls_typed_vdata_st * <var class="var">data</var>, unsigned int <var class="var">elements</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">voutput</var>, gnutls_verify_output_function <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert_list</var>: is the certificate list to be verified
</p>
<p><var class="var">cert_list_size</var>: is the certificate list size
</p>
<p><var class="var">data</var>: an array of typed data
</p>
<p><var class="var">elements</var>: the number of data elements
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">voutput</var>: will hold the certificate verification output.
</p>
<p><var class="var">func</var>: If non-null will be called on each chain element verification with the output.
</p>
<p>This function will attempt to verify the given certificate chain and return
its status. The <code class="code">voutput</code> parameter will hold an OR’ed sequence of
<code class="code">gnutls_certificate_status_t</code> flags.
</p>
<p>When a certificate chain of <code class="code">cert_list_size</code> with more than one certificates is
provided, the verification status will apply to the first certificate in the chain
that failed verification. The verification process starts from the end of the chain
(from CA to end certificate). The first certificate in the chain must be the end-certificate
while the rest of the members may be sorted or not.
</p>
<p>Additionally a certificate verification profile can be specified
from the ones in <code class="code">gnutls_certificate_verification_profiles_t</code> by
ORing the result of <code class="code">GNUTLS_PROFILE_TO_VFLAGS()</code> to the verification
flags.
</p>
<p>Additional verification parameters are possible via the <code class="code">data</code> types; the
acceptable types are <code class="code">GNUTLS_DT_DNS_HOSTNAME</code> , <code class="code">GNUTLS_DT_IP_ADDRESS</code> and <code class="code">GNUTLS_DT_KEY_PURPOSE_OID</code> .
The former accepts as data a null-terminated hostname, and the latter a null-terminated
object identifier (e.g., <code class="code">GNUTLS_KP_TLS_WWW_SERVER</code> ).
If a DNS hostname is provided then this function will compare
the hostname in the end certificate against the given. If names do not match the
<code class="code">GNUTLS_CERT_UNEXPECTED_OWNER</code> status flag will be set. In addition it
will consider certificates provided with <code class="code">gnutls_x509_trust_list_add_named_crt()</code> .
</p>
<p>If a key purpose OID is provided and the end-certificate contains the extended key
usage PKIX extension, it will be required to match the provided OID
or be marked for any purpose, otherwise verification will fail with
<code class="code">GNUTLS_CERT_PURPOSE_MISMATCH</code> status.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. Note that verification failure will not result to an
error code, only <code class="code">voutput</code> will be updated.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_verify_named_crt</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">name</var>, size_t <var class="var">name_size</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">voutput</var>, gnutls_verify_output_function <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert</var>: is the certificate to be verified
</p>
<p><var class="var">name</var>: is the certificate’s name
</p>
<p><var class="var">name_size</var>: is the certificate’s name size
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">voutput</var>: will hold the certificate verification output.
</p>
<p><var class="var">func</var>: If non-null will be called on each chain element verification with the output.
</p>
<p>This function will try to find a certificate that is associated with the provided
name –see <code class="code">gnutls_x509_trust_list_add_named_crt()</code> . If a match is found the
certificate is considered valid. In addition to that this function will also
check CRLs. The <code class="code">voutput</code> parameter will hold an OR’ed sequence of
<code class="code">gnutls_certificate_status_t</code> flags.
</p>
<p>Additionally a certificate verification profile can be specified
from the ones in <code class="code">gnutls_certificate_verification_profiles_t</code> by
ORing the result of <code class="code">GNUTLS_PROFILE_TO_VFLAGS()</code> to the verification
flags.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_trust_file</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const char * <var class="var">ca_file</var>, const char * <var class="var">crl_file</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, unsigned int <var class="var">tl_flags</var>, unsigned int <var class="var">tl_vflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">ca_file</var>: A file containing a list of CAs (optional)
</p>
<p><var class="var">crl_file</var>: A file containing a list of CRLs (optional)
</p>
<p><var class="var">type</var>: The format of the certificates
</p>
<p><var class="var">tl_flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p><var class="var">tl_vflags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function will add the given certificate authorities
to the trusted list. PKCS <code class="code">11</code> URLs are also accepted, instead
of files, by this function. A PKCS <code class="code">11</code> URL implies a trust
database (a specially marked module in p11-kit); the URL "pkcs11:"
implies all trust databases in the system. Only a single URL specifying
trust databases can be set; they cannot be stacked with multiple calls.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_trust_mem</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_datum_t * <var class="var">cas</var>, const gnutls_datum_t * <var class="var">crls</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, unsigned int <var class="var">tl_flags</var>, unsigned int <var class="var">tl_vflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cas</var>: A buffer containing a list of CAs (optional)
</p>
<p><var class="var">crls</var>: A buffer containing a list of CRLs (optional)
</p>
<p><var class="var">type</var>: The format of the certificates
</p>
<p><var class="var">tl_flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p><var class="var">tl_vflags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function will add the given certificate authorities
to the trusted list.
</p>
<p>If this function is used <code class="code">gnutls_x509_trust_list_deinit()</code> must be called
with parameter <code class="code">all</code> being 1.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_system_trust</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, unsigned int <var class="var">tl_flags</var>, unsigned int <var class="var">tl_vflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The structure of the list
</p>
<p><var class="var">tl_flags</var>: GNUTLS_TL_*
</p>
<p><var class="var">tl_vflags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function adds the system’s default trusted certificate
authorities to the trusted list. Note that on unsupported systems
this function returns <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p>This function implies the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of added elements or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<p>The verification function will verify a given certificate chain against a list of certificate
authorities and certificate revocation lists, and output
a bit-wise OR of elements of the <code class="code">gnutls_certificate_status_t</code>
enumeration shown in <a class="ref" href="#gnutls_005fcertificate_005fstatus_005ft">Figure 4.2</a>. The <code class="code">GNUTLS_CERT_INVALID</code> flag
is always set on a verification error and more detailed flags will also be set when appropriate.
</p>
<div class="float" id="gnutls_005fcertificate_005fstatus_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_CERT_INVALID</code></dt>
<dd><p>The certificate is not signed by one of the
known authorities or the signature is invalid (deprecated by the flags
<code class="code">GNUTLS_CERT_SIGNATURE_FAILURE</code> and <code class="code">GNUTLS_CERT_SIGNER_NOT_FOUND</code> ).
</p></dd>
<dt><code class="code">GNUTLS_CERT_REVOKED</code></dt>
<dd><p>Certificate is revoked by its authority. In X.509 this will be
set only if CRLs are checked.
</p></dd>
<dt><code class="code">GNUTLS_CERT_SIGNER_NOT_FOUND</code></dt>
<dd><p>The certificate’s issuer is not known.
This is the case if the issuer is not included in the trusted certificate list.
</p></dd>
<dt><code class="code">GNUTLS_CERT_SIGNER_NOT_CA</code></dt>
<dd><p>The certificate’s signer was not a CA. This
may happen if this was a version 1 certificate, which is common with
some CAs, or a version 3 certificate without the basic constrains extension.
</p></dd>
<dt><code class="code">GNUTLS_CERT_INSECURE_ALGORITHM</code></dt>
<dd><p>The certificate was signed using an insecure
algorithm such as MD2 or MD5. These algorithms have been broken and
should not be trusted.
</p></dd>
<dt><code class="code">GNUTLS_CERT_NOT_ACTIVATED</code></dt>
<dd><p>The certificate is not yet activated.
</p></dd>
<dt><code class="code">GNUTLS_CERT_EXPIRED</code></dt>
<dd><p>The certificate has expired.
</p></dd>
<dt><code class="code">GNUTLS_CERT_SIGNATURE_FAILURE</code></dt>
<dd><p>The signature verification failed.
</p></dd>
<dt><code class="code">GNUTLS_CERT_REVOCATION_DATA_SUPERSEDED</code></dt>
<dd><p>The revocation data are old and have been superseded.
</p></dd>
<dt><code class="code">GNUTLS_CERT_UNEXPECTED_OWNER</code></dt>
<dd><p>The owner is not the expected one.
</p></dd>
<dt><code class="code">GNUTLS_CERT_REVOCATION_DATA_ISSUED_IN_FUTURE</code></dt>
<dd><p>The revocation data have a future issue date.
</p></dd>
<dt><code class="code">GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE</code></dt>
<dd><p>The certificate’s signer constraints were
violated.
</p></dd>
<dt><code class="code">GNUTLS_CERT_MISMATCH</code></dt>
<dd><p>The certificate presented isn’t the expected one (TOFU)
</p></dd>
<dt><code class="code">GNUTLS_CERT_PURPOSE_MISMATCH</code></dt>
<dd><p>The certificate or an intermediate does not match the intended purpose (extended key usage).
</p></dd>
<dt><code class="code">GNUTLS_CERT_MISSING_OCSP_STATUS</code></dt>
<dd><p>The certificate requires the server to send the certificate status, but no status was received.
</p></dd>
<dt><code class="code">GNUTLS_CERT_INVALID_OCSP_STATUS</code></dt>
<dd><p>The received OCSP status response is invalid.
</p></dd>
<dt><code class="code">GNUTLS_CERT_UNKNOWN_CRIT_EXTENSIONS</code></dt>
<dd><p>The certificate has extensions marked as critical which are not supported.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 4.2: </strong>The <code class="code">gnutls_certificate_status_t</code> enumeration.</p></div></div>
<p>An example of certificate verification is shown in <a class="ref" href="#ex_002dverify2">ex-verify2</a>.
It is also possible to have a set of certificates that
are trusted for a particular server but not to authorize other certificates.
This purpose is served by the functions <a class="ref" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt">gnutls_x509_trust_list_add_named_crt</a> and <a class="ref" href="#gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt">gnutls_x509_trust_list_verify_named_crt</a>.
</p>
<hr>
</div>
<div class="subsubsection-level-extent" id="Verifying-a-certificate-in-the-context-of-TLS-session">
<div class="nav-panel">
<p>
Next: <a href="#Verification-using-PKCS11" accesskey="n" rel="next">Verifying a certificate using PKCS #11</a>, Previous: <a href="#Verifying-X_002e509-certificate-paths" accesskey="p" rel="prev">Verifying <abbr class="acronym">X.509</abbr> certificate paths</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Verifying-a-certificate-in-the-context-of-TLS-session-1"><span>4.1.1.8 Verifying a certificate in the context of TLS session<a class="copiable-link" href="#Verifying-a-certificate-in-the-context-of-TLS-session-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-verifying-certificate-paths-1"></a>
<a class="index-entry-id" id="index-gnutls_005fcertificate_005fverify_005fflags"></a>
<p>When operating in the context of a TLS session, the trusted certificate
authority list may also be set using:
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile">gnutls_certificate_set_x509_trust_file</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">cafile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir">gnutls_certificate_set_x509_trust_dir</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">ca_dir</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fcrl_005ffile">gnutls_certificate_set_x509_crl_file</a> (gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">crlfile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust">gnutls_certificate_set_x509_system_trust</a> (gnutls_certificate_credentials_t <var class="var">cred</var>)</code></dt>
</dl>
<p>These functions allow the specification of the trusted certificate authorities, either
via a file, a directory or use the system-specified certificate authorities.
Unless the authorities are application specific, it is generally recommended
to use the system trust storage (see <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust">gnutls_certificate_set_x509_system_trust</a>).
</p>
<p>Unlike the previous section it is not required to setup a trusted list, and there
are two approaches to verify the peer’s certificate and identity.
The recommended in GnuTLS 3.5.0 and later is via the <a class="ref" href="#gnutls_005fsession_005fset_005fverify_005fcert">gnutls_session_set_verify_cert</a>,
but for older GnuTLS versions you may use an explicit callback set via
<a class="ref" href="#gnutls_005fcertificate_005fset_005fverify_005ffunction">gnutls_certificate_set_verify_function</a> and then utilize
<a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers3">gnutls_certificate_verify_peers3</a> for verification.
The reported verification status is identical to the verification functions described
in the previous section.
</p>
<p>Note that in certain cases it is required to check the marked purpose of
the end certificate (e.g. <code class="code">GNUTLS_KP_TLS_WWW_SERVER</code>); in these cases
the more advanced <a class="ref" href="#gnutls_005fsession_005fset_005fverify_005fcert2">gnutls_session_set_verify_cert2</a> and
<a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers">gnutls_certificate_verify_peers</a> should be used instead.
</p>
<p>There is also the possibility to pass some input to the verification
functions in the form of flags. For <a class="ref" href="#gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2">gnutls_x509_trust_list_verify_crt2</a> the
flags are passed directly, but for
<a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers3">gnutls_certificate_verify_peers3</a>, the flags are set using
<a class="ref" href="#gnutls_005fcertificate_005fset_005fverify_005fflags">gnutls_certificate_set_verify_flags</a>. All the available
flags are part of the enumeration
<code class="code">gnutls_certificate_verify_flags</code> shown in <a class="ref" href="#gnutls_005fcertificate_005fverify_005fflags">Figure 4.3</a>.
</p>
<div class="float" id="gnutls_005fcertificate_005fverify_005fflags">
<dl class="table">
<dt><code class="code">GNUTLS_VERIFY_DISABLE_CA_SIGN</code></dt>
<dd><p>If set a signer does not have to be
a certificate authority. This flag should normally be disabled,
unless you know what this means.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES</code></dt>
<dd><p>When verifying a hostname
prevent textual IP addresses from matching IP addresses in the
certificate. Treat the input only as a DNS name.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DO_NOT_ALLOW_SAME</code></dt>
<dd><p>If a certificate is not signed by
anyone trusted but exists in the trusted CA list do not treat it
as trusted.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT</code></dt>
<dd><p>Allow CA certificates that
have version 1 (both root and intermediate). This might be
dangerous since those haven’t the basicConstraints
extension.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2</code></dt>
<dd><p>Allow certificates to be signed
using the broken MD2 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5</code></dt>
<dd><p>Allow certificates to be signed
using the broken MD5 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DISABLE_TIME_CHECKS</code></dt>
<dd><p>Disable checking of activation
and expiration validity periods of certificate chains. Don’t set
this unless you understand the security implications.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS</code></dt>
<dd><p>If set a signer in the trusted
list is never checked for expiration or activation.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT</code></dt>
<dd><p>Do not allow trusted CA
certificates that have version 1. This option is to be used
to deprecate all certificates of version 1.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DISABLE_CRL_CHECKS</code></dt>
<dd><p>Disable checking for validity
using certificate revocation lists or the available OCSP data.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_ALLOW_UNSORTED_CHAIN</code></dt>
<dd><p>A certificate chain is tolerated
if unsorted (the case with many TLS servers out there). This is the
default since GnuTLS 3.1.4.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DO_NOT_ALLOW_UNSORTED_CHAIN</code></dt>
<dd><p>Do not tolerate an unsorted
certificate chain.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_DO_NOT_ALLOW_WILDCARDS</code></dt>
<dd><p>When including a hostname
check in the verification, do not consider any wildcards.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_USE_TLS1_RSA</code></dt>
<dd><p>This indicates that a (raw) RSA signature is provided
as in the TLS 1.0 protocol. Not all functions accept this flag.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_IGNORE_UNKNOWN_CRIT_EXTENSIONS</code></dt>
<dd><p>This signals the verification
process, not to fail on unknown critical extensions.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1</code></dt>
<dd><p>Allow certificates to be signed
using the broken SHA1 hash algorithm.
</p></dd>
<dt><code class="code">GNUTLS_VERIFY_RSA_PSS_FIXED_SALT_LENGTH</code></dt>
<dd><p>Disallow RSA-PSS signatures made
with mismatching salt length with digest length, as mandated in RFC 8446
4.2.3.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 4.3: </strong>The <code class="code">gnutls_certificate_verify_flags</code> enumeration.</p></div></div>
<hr>
</div>
<div class="subsubsection-level-extent" id="Verification-using-PKCS11">
<div class="nav-panel">
<p>
Previous: <a href="#Verifying-a-certificate-in-the-context-of-TLS-session" accesskey="p" rel="prev">Verifying a certificate in the context of TLS session</a>, Up: <a href="#X_002e509-certificates" accesskey="u" rel="up"><abbr class="acronym">X.509</abbr> certificates</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Verifying-a-certificate-using-PKCS-_002311"><span>4.1.1.9 Verifying a certificate using PKCS #11<a class="copiable-link" href="#Verifying-a-certificate-using-PKCS-_002311"> ¶</a></span></h4>
<a class="index-entry-id" id="index-verifying-certificate-with-pkcs11"></a>
<p>Some systems provide a system wide trusted certificate storage accessible using
the PKCS #11 API. That is, the trusted certificates are queried and accessed using the
PKCS #11 API, and trusted certificate properties, such as purpose, are marked using
attached extensions. One example is the p11-kit trust module<a class="footnote" id="DOCF8" href="#FOOT8"><sup>8</sup></a>.
</p>
<p>These special PKCS #11 modules can be used for GnuTLS certificate verification if marked as trust
policy modules, i.e., with <code class="code">trust-policy: yes</code> in the p11-kit module file.
The way to use them is by specifying to the file verification function (e.g., <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile">gnutls_certificate_set_x509_trust_file</a>),
a pkcs11 URL, or simply <code class="code">pkcs11:</code> to use all the marked with trust policy modules.
</p>
<p>The trust modules of p11-kit assign a purpose to trusted authorities using the extended
key usage object identifiers. The common purposes are shown in <a class="ref" href="#tab_003apurposes">Table 4.4</a>. Note
that typically according to [<a class="ref" href="#RFC5280">RFC5280</a>] the extended key usage object identifiers apply to end certificates. Their
application to CA certificates is an extension used by the trust modules.
</p>
<div class="float" id="tab_003apurposes">
<table class="multitable">
<thead><tr><th width="20%">Purpose</th><th width="20%">OID</th><th width="60%">Description</th></tr></thead>
<tbody><tr><td width="20%">GNUTLS_KP_TLS_WWW_SERVER</td><td width="20%">1.3.6.1.5.5.7.3.1</td><td width="60%">The certificate is to be used for TLS WWW authentication. When in a CA certificate, it
indicates that the CA is allowed to sign certificates for TLS WWW authentication.</td></tr>
<tr><td width="20%">GNUTLS_KP_TLS_WWW_CLIENT</td><td width="20%">1.3.6.1.5.5.7.3.2</td><td width="60%">The certificate is to be used for TLS WWW client authentication. When in a CA certificate, it
indicates that the CA is allowed to sign certificates for TLS WWW client authentication.</td></tr>
<tr><td width="20%">GNUTLS_KP_CODE_SIGNING</td><td width="20%">1.3.6.1.5.5.7.3.3</td><td width="60%">The certificate is to be used for code signing. When in a CA certificate, it
indicates that the CA is allowed to sign certificates for code signing.</td></tr>
<tr><td width="20%">GNUTLS_KP_EMAIL_PROTECTION</td><td width="20%">1.3.6.1.5.5.7.3.4</td><td width="60%">The certificate is to be used for email protection. When in a CA certificate, it
indicates that the CA is allowed to sign certificates for email users.</td></tr>
<tr><td width="20%">GNUTLS_KP_OCSP_SIGNING</td><td width="20%">1.3.6.1.5.5.7.3.9</td><td width="60%">The certificate is to be used for signing OCSP responses. When in a CA certificate, it
indicates that the CA is allowed to sign certificates which sign OCSP responses.</td></tr>
<tr><td width="20%">GNUTLS_KP_ANY</td><td width="20%">2.5.29.37.0</td><td width="60%">The certificate is to be used for any purpose. When in a CA certificate, it
indicates that the CA is allowed to sign any kind of certificates.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 4.4: </strong>Key purpose object identifiers.</p></div></div>
<p>With such modules, it is recommended to use the verification functions <a class="ref" href="#gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2">gnutls_x509_trust_list_verify_crt2</a>,
or <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers">gnutls_certificate_verify_peers</a>, which allow to explicitly specify the key purpose. The
other verification functions which do not allow setting a purpose, would operate as if
<code class="code">GNUTLS_KP_TLS_WWW_SERVER</code> was requested from the trusted authorities.
</p>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="OpenPGP-certificates">
<div class="nav-panel">
<p>
Next: <a href="#Raw-public_002dkeys" accesskey="n" rel="next">Raw public-keys</a>, Previous: <a href="#X_002e509-certificates" accesskey="p" rel="prev"><abbr class="acronym">X.509</abbr> certificates</a>, Up: <a href="#Certificate-authentication" accesskey="u" rel="up">Certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="OpenPGP-certificates-1"><span>4.1.2 <abbr class="acronym">OpenPGP</abbr> certificates<a class="copiable-link" href="#OpenPGP-certificates-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-OpenPGP-certificates"></a>
<p>Previous versions of GnuTLS supported limited <abbr class="acronym">OpenPGP</abbr> key
authentication. That functionality has been deprecated and is no longer
made available. The reason is that, supporting alternative authentication
methods, when X.509 and PKIX were new on the Internet and not well established, seemed like a
good idea, in today’s Internet X.509 is unquestionably the main
container for certificates. As such supporting more options with no clear
use-cases, is a distraction that consumes considerable resources for
improving and testing the library. For that we have decided to drop
this functionality completely in 3.6.0.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Raw-public_002dkeys">
<div class="nav-panel">
<p>
Next: <a href="#Advanced-certificate-verification" accesskey="n" rel="next">Advanced certificate verification</a>, Previous: <a href="#OpenPGP-certificates" accesskey="p" rel="prev"><abbr class="acronym">OpenPGP</abbr> certificates</a>, Up: <a href="#Certificate-authentication" accesskey="u" rel="up">Certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Raw-public_002dkeys-1"><span>4.1.3 Raw public-keys<a class="copiable-link" href="#Raw-public_002dkeys-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-Raw-public_002dkeys"></a>
<p>There are situations in which a rather large certificate / certificate chain is undesirable or impractical.
An example could be a resource constrained sensor network in which you do want to use authentication of and
encryption between your devices but where your devices lack loads of memory or processing power. Furthermore,
there are situations in which you don’t want to or can’t rely on a PKIX. TLS is, next to a PKIX environment,
also commonly used with self-signed certificates in smaller deployments where the self-signed certificates
are distributed to all involved protocol endpoints out-of-band. This practice does, however, still require
the overhead of the certificate generation even though none of the information found in the certificate is
actually used.
</p>
<p>With raw public-keys, only a subset of the information found in typical certificates is utilized: namely,
the SubjectPublicKeyInfo structure (in ASN.1 format) of a PKIX certificate that carries the parameters
necessary to describe the public-key. Other parameters found in PKIX certificates are omitted. By omitting
various certificate-related structures, the resulting raw public-key is kept fairly small in comparison to
the original certificate, and the code to process the keys can be simpler.
</p>
<p>It should be noted however, that the authenticity of these raw keys must be verified by an out-of-band mechanism
or something like <abbr class="acronym">TOFU</abbr>.
</p>
<ul class="mini-toc">
<li><a href="#Importing-raw-public_002dkeys" accesskey="1">Importing raw public-keys</a></li>
</ul>
<hr>
<div class="subsubsection-level-extent" id="Importing-raw-public_002dkeys">
<div class="nav-panel">
<p>
Up: <a href="#Raw-public_002dkeys" accesskey="u" rel="up">Raw public-keys</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Importing-raw-public_002dkeys-1"><span>4.1.3.1 Importing raw public-keys<a class="copiable-link" href="#Importing-raw-public_002dkeys-1"> ¶</a></span></h4>
<p>Raw public-keys and their private counterparts can best be handled by using the abstract types
<code class="code">gnutls_pubkey_t</code> and <code class="code">gnutls_privkey_t</code> respectively. To learn how to use these
see <a class="ref" href="#Abstract-key-types">Abstract key types</a>.
</p>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="Advanced-certificate-verification">
<div class="nav-panel">
<p>
Next: <a href="#Digital-signatures" accesskey="n" rel="next">Digital signatures</a>, Previous: <a href="#Raw-public_002dkeys" accesskey="p" rel="prev">Raw public-keys</a>, Up: <a href="#Certificate-authentication" accesskey="u" rel="up">Certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Advanced-certificate-verification-1"><span>4.1.4 Advanced certificate verification<a class="copiable-link" href="#Advanced-certificate-verification-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-Certificate-verification"></a>
<p>The verification of X.509 certificates in the HTTPS and other Internet protocols is typically
done by loading a trusted list of commercial Certificate Authorities
(see <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust">gnutls_certificate_set_x509_system_trust</a>), and using them as trusted anchors.
However, there are several examples (eg. the Diginotar incident) where one of these
authorities was compromised. This risk can be mitigated by using in addition to CA certificate verification,
other verification methods. In this section we list the available in GnuTLS methods.
</p>
<ul class="mini-toc">
<li><a href="#Verifying-a-certificate-using-trust-on-first-use-authentication" accesskey="1">Verifying a certificate using trust on first use authentication</a></li>
<li><a href="#Verifying-a-certificate-using-DANE" accesskey="2">Verifying a certificate using DANE (DNSSEC)</a></li>
</ul>
<hr>
<div class="subsubsection-level-extent" id="Verifying-a-certificate-using-trust-on-first-use-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Verifying-a-certificate-using-DANE" accesskey="n" rel="next">Verifying a certificate using DANE (DNSSEC)</a>, Up: <a href="#Advanced-certificate-verification" accesskey="u" rel="up">Advanced certificate verification</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Verifying-a-certificate-using-trust-on-first-use-authentication-1"><span>4.1.4.1 Verifying a certificate using trust on first use authentication<a class="copiable-link" href="#Verifying-a-certificate-using-trust-on-first-use-authentication-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-verifying-certificate-paths-2"></a>
<a class="index-entry-id" id="index-SSH_002dstyle-authentication"></a>
<a class="index-entry-id" id="index-Trust-on-first-use"></a>
<a class="index-entry-id" id="index-Key-pinning"></a>
<p>It is possible to use a trust on first use (TOFU) authentication
method in GnuTLS. That is the concept used by the SSH programs, where the
public key of the peer is not verified, or verified in an out-of-bound way,
but subsequent connections to the same peer require the public key to
remain the same. Such a system in combination with the typical CA
verification of a certificate, and OCSP revocation checks,
can help to provide multiple factor verification, where a single point of
failure is not enough to compromise the system. For example a server compromise
may be detected using OCSP, and a CA compromise can be detected using
the trust on first use method.
Such a hybrid system with X.509 and trust on first use authentication is
shown in <a class="ref" href="#Client-example-with-SSH_002dstyle-certificate-verification">Client example with SSH-style certificate verification</a>.
</p>
<p>See <a class="ref" href="#Certificate-verification">Certificate verification</a> on how to use the available functionality.
</p>
<hr>
</div>
<div class="subsubsection-level-extent" id="Verifying-a-certificate-using-DANE">
<div class="nav-panel">
<p>
Previous: <a href="#Verifying-a-certificate-using-trust-on-first-use-authentication" accesskey="p" rel="prev">Verifying a certificate using trust on first use authentication</a>, Up: <a href="#Advanced-certificate-verification" accesskey="u" rel="up">Advanced certificate verification</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Verifying-a-certificate-using-DANE-_0028DNSSEC_0029"><span>4.1.4.2 Verifying a certificate using DANE (DNSSEC)<a class="copiable-link" href="#Verifying-a-certificate-using-DANE-_0028DNSSEC_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-verifying-certificate-paths-3"></a>
<a class="index-entry-id" id="index-DANE"></a>
<a class="index-entry-id" id="index-DNSSEC"></a>
<p>The DANE protocol is a protocol that can be used to verify TLS certificates
using the DNS (or better DNSSEC) protocols. The DNS security extensions (DNSSEC)
provide an alternative public key infrastructure to the commercial CAs that
are typically used to sign TLS certificates. The DANE protocol takes advantage
of the DNSSEC infrastructure to verify TLS certificates. This can be
in addition to the verification by CA infrastructure or
may even replace it where DNSSEC is fully deployed. Note however, that DNSSEC deployment is
fairly new and it would be better to use it as an additional verification
method rather than the only one.
</p>
<p>The DANE functionality is provided by the <code class="code">libgnutls-dane</code> library that is shipped
with GnuTLS and the function prototypes are in <code class="code">gnutls/dane.h</code>.
See <a class="ref" href="#Certificate-verification">Certificate verification</a> for information on how to use the library.
</p>
<p>Note however, that the DANE RFC mandates the verification methods
one should use in addition to the validation via DNSSEC TLSA entries.
GnuTLS doesn’t follow that RFC requirement, and the term DANE verification
in this manual refers to the TLSA entry verification. In GnuTLS any
other verification methods can be used (e.g., PKIX or TOFU) on top of
DANE.
</p>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="Digital-signatures">
<div class="nav-panel">
<p>
Previous: <a href="#Advanced-certificate-verification" accesskey="p" rel="prev">Advanced certificate verification</a>, Up: <a href="#Certificate-authentication" accesskey="u" rel="up">Certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Digital-signatures-1"><span>4.1.5 Digital signatures<a class="copiable-link" href="#Digital-signatures-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-digital-signatures"></a>
<p>In this section we will provide some information about digital
signatures, how they work, and give the rationale for disabling some
of the algorithms used.
</p>
<p>Digital signatures work by using somebody’s secret key to sign some
arbitrary data. Then anybody else could use the public key of that
person to verify the signature. Since the data may be arbitrary it is
not suitable input to a cryptographic digital signature algorithm. For
this reason and also for performance cryptographic hash algorithms are
used to preprocess the input to the signature algorithm. This works as
long as it is difficult enough to generate two different messages with
the same hash algorithm output. In that case the same signature could
be used as a proof for both messages. Nobody wants to sign an innocent
message of donating 1 euro to Greenpeace and find out that they
donated 1.000.000 euros to Bad Inc.
</p>
<p>For a hash algorithm to be called cryptographic the following three
requirements must hold:
</p>
<ol class="enumerate">
<li> Preimage resistance.
That means the algorithm must be one way and given the output of the
hash function <em class="math">H(x)</em>, it is impossible to calculate <em class="math">x</em>.
</li><li> 2nd preimage resistance.
That means that given a pair <em class="math">x,y</em> with <em class="math">y=H(x)</em> it is
impossible to calculate an <em class="math">x'</em> such that <em class="math">y=H(x')</em>.
</li><li> Collision resistance.
That means that it is impossible to calculate random <em class="math">x</em> and
<em class="math">x'</em> such <em class="math">H(x')=H(x)</em>.
</li></ol>
<p>The last two requirements in the list are the most important in
digital signatures. These protect against somebody who would like to
generate two messages with the same hash output. When an algorithm is
considered broken usually it means that the Collision resistance of
the algorithm is less than brute force. Using the birthday paradox the
brute force attack takes
<em class="math">2^{((hash size) / 2)}</em>
operations. Today colliding certificates using the MD5 hash algorithm
have been generated as shown in [<a class="ref" href="#WEGER">WEGER</a>].
</p>
<p>There has been cryptographic results for the SHA-1 hash algorithms as
well, although they are not yet critical. Before 2004, MD5 had a
presumed collision strength of <em class="math">2^{64}</em>, but it has been showed
to have a collision strength well under <em class="math">2^{50}</em>. As of November
2005, it is believed that SHA-1’s collision strength is around
<em class="math">2^{63}</em>. We consider this sufficiently hard so that we still
support SHA-1. We anticipate that SHA-256/386/512 will be used in
publicly-distributed certificates in the future. When <em class="math">2^{63}</em>
can be considered too weak compared to the computer power available
sometime in the future, SHA-1 will be disabled as well. The collision
attacks on SHA-1 may also get better, given the new interest in tools
for creating them.
</p>
<ul class="mini-toc">
<li><a href="#Trading-security-for-interoperability" accesskey="1">Trading security for interoperability</a></li>
</ul>
<div class="subsubsection-level-extent" id="Trading-security-for-interoperability">
<h4 class="subsubsection"><span>4.1.5.1 Trading security for interoperability<a class="copiable-link" href="#Trading-security-for-interoperability"> ¶</a></span></h4>
<p>If you connect to a server and use GnuTLS’ functions to verify the
certificate chain, and get a <code class="code">GNUTLS_CERT_INSECURE_ALGORITHM</code>
validation error (see <a class="ref" href="#Verifying-X_002e509-certificate-paths">Verifying <abbr class="acronym">X.509</abbr> certificate paths</a>), it means
that somewhere in the certificate chain there is a certificate signed
using <code class="code">RSA-MD2</code> or <code class="code">RSA-MD5</code>. These two digital signature
algorithms are considered broken, so GnuTLS fails verifying
the certificate. In some situations, it may be useful to be
able to verify the certificate chain anyway, assuming an attacker did
not utilize the fact that these signatures algorithms are broken.
This section will give help on how to achieve that.
</p>
<p>It is important to know that you do not have to enable any of
the flags discussed here to be able to use trusted root CA
certificates self-signed using <code class="code">RSA-MD2</code> or <code class="code">RSA-MD5</code>. The
certificates in the trusted list are considered trusted irrespective
of the signature.
</p>
<p>If you are using <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers3">gnutls_certificate_verify_peers3</a> to verify the
certificate chain, you can call
<a class="ref" href="#gnutls_005fcertificate_005fset_005fverify_005fflags">gnutls_certificate_set_verify_flags</a> with the flags:
</p><ul class="itemize mark-bullet">
<li><code class="code">GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2</code>
</li><li><code class="code">GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5</code>
</li><li><code class="code">GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1</code>
</li><li><code class="code">GNUTLS_VERIFY_ALLOW_BROKEN</code>
</li></ul>
<p>as in the following example:
</p>
<div class="example">
<pre class="example-preformatted"> gnutls_certificate_set_verify_flags (x509cred,
GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5);
</pre></div>
<p>This will signal the verifier algorithm to enable <code class="code">RSA-MD5</code> when
verifying the certificates.
</p>
<p>If you are using <a class="ref" href="#gnutls_005fx509_005fcrt_005fverify">gnutls_x509_crt_verify</a> or
<a class="ref" href="#gnutls_005fx509_005fcrt_005flist_005fverify">gnutls_x509_crt_list_verify</a>, you can pass the
<code class="code">GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5</code> parameter directly in the
<code class="code">flags</code> parameter.
</p>
<p>If you are using these flags, it may also be a good idea to warn the
user when verification failure occur for this reason. The simplest is
to not use the flags by default, and only fall back to using them
after warning the user. If you wish to inspect the certificate chain
yourself, you can use <a class="ref" href="#gnutls_005fcertificate_005fget_005fpeers">gnutls_certificate_get_peers</a> to extract
the raw server’s certificate chain, <a class="ref" href="#gnutls_005fx509_005fcrt_005flist_005fimport">gnutls_x509_crt_list_import</a> to parse each of the certificates, and
then <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm">gnutls_x509_crt_get_signature_algorithm</a> to find out the
signing algorithm used for each certificate. If any of the
intermediary certificates are using <code class="code">GNUTLS_SIGN_RSA_MD2</code> or
<code class="code">GNUTLS_SIGN_RSA_MD5</code>, you could present a warning.
</p>
<hr>
</div>
</div>
</div>
<div class="section-level-extent" id="More-on-certificate-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Shared_002dkey-and-anonymous-authentication" accesskey="n" rel="next">Shared-key and anonymous authentication</a>, Previous: <a href="#Certificate-authentication" accesskey="p" rel="prev">Certificate authentication</a>, Up: <a href="#Authentication-methods" accesskey="u" rel="up">Authentication methods</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="More-on-certificate-authentication-1"><span>4.2 More on certificate authentication<a class="copiable-link" href="#More-on-certificate-authentication-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-certificate-authentication-1"></a>
<p>Certificates are not the only structures involved in a public key
infrastructure. Several other structures that are used for certificate
requests, encrypted private keys, revocation lists, GnuTLS abstract key
structures, etc., are discussed in this chapter.
</p>
<ul class="mini-toc">
<li><a href="#PKCS-10-certificate-requests" accesskey="1"><abbr class="acronym">PKCS</abbr> #10 certificate requests</a></li>
<li><a href="#PKIX-certificate-revocation-lists" accesskey="2">PKIX certificate revocation lists</a></li>
<li><a href="#OCSP-certificate-status-checking" accesskey="3"><abbr class="acronym">OCSP</abbr> certificate status checking</a></li>
<li><a href="#OCSP-stapling" accesskey="4">OCSP stapling</a></li>
<li><a href="#Managing-encrypted-keys" accesskey="5">Managing encrypted keys</a></li>
<li><a href="#certtool-Invocation" accesskey="6">Invoking certtool</a></li>
<li><a href="#ocsptool-Invocation" accesskey="7">Invoking ocsptool</a></li>
<li><a href="#danetool-Invocation" accesskey="8">Invoking danetool</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="PKCS-10-certificate-requests">
<div class="nav-panel">
<p>
Next: <a href="#PKIX-certificate-revocation-lists" accesskey="n" rel="next">PKIX certificate revocation lists</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="PKCS-_002310-certificate-requests"><span>4.2.1 <abbr class="acronym">PKCS</abbr> #10 certificate requests<a class="copiable-link" href="#PKCS-_002310-certificate-requests"> ¶</a></span></h4>
<a class="index-entry-id" id="index-certificate-requests"></a>
<a class="index-entry-id" id="index-PKCS-_002310"></a>
<p>A certificate request is a structure, which contain information about
an applicant of a certificate service. It typically contains a public
key, a distinguished name and secondary data such as a challenge
password. <abbr class="acronym">GnuTLS</abbr> supports the requests defined in
<abbr class="acronym">PKCS</abbr> #10 [<a class="ref" href="#RFC2986">RFC2986</a>]. Other formats of certificate requests
are not currently supported by GnuTLS.
</p>
<p>A certificate request can be generated by
associating it with a private key, setting the
subject’s information and finally self signing it.
The last step ensures that the requester is in
possession of the private key.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrq_005fset_005fversion">gnutls_x509_crq_set_version</a> (gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">version</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrq_005fset_005fdn">gnutls_x509_crq_set_dn</a> (gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">dn</var>, const char ** <var class="var">err</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrq_005fset_005fdn_005fby_005foid">gnutls_x509_crq_set_dn_by_oid</a> (gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, unsigned int <var class="var">raw_flag</var>, const void * <var class="var">data</var>, unsigned int <var class="var">sizeof_data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrq_005fset_005fkey_005fusage">gnutls_x509_crq_set_key_usage</a> (gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">usage</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrq_005fset_005fkey_005fpurpose_005foid">gnutls_x509_crq_set_key_purpose_oid</a> (gnutls_x509_crq_t <var class="var">crq</var>, const void * <var class="var">oid</var>, unsigned int <var class="var">critical</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrq_005fset_005fbasic_005fconstraints">gnutls_x509_crq_set_basic_constraints</a> (gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">ca</var>, int <var class="var">pathLenConstraint</var>)</code></dt>
</dl>
<p>The <a class="ref" href="#gnutls_005fx509_005fcrq_005fset_005fkey">gnutls_x509_crq_set_key</a> and <a class="ref" href="#gnutls_005fx509_005fcrq_005fsign2">gnutls_x509_crq_sign2</a>
functions associate the request with a private key and sign it. If a
request is to be signed with a key residing in a PKCS #11 token it is recommended to use
the signing functions shown in <a class="ref" href="#Abstract-key-types">Abstract key types</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_key</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a private key
</p>
<p>This function will set the public parameters from the given private
key to the request.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fsign2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_sign2</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fsign2"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a private key
</p>
<p><var class="var">dig</var>: The message digest to use, i.e., <code class="code">GNUTLS_DIG_SHA256</code>
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the certificate request with a private key.
This must be the same key as the one used in
<code class="code">gnutls_x509_crt_set_key()</code> since a certificate request is self
signed.
</p>
<p>This must be the last step in a certificate request generation
since all the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed request will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
<code class="code">GNUTLS_E_ASN1_VALUE_NOT_FOUND</code> is returned if you didn’t set all
information in the certificate request (e.g., the version using
<code class="code">gnutls_x509_crq_set_version()</code> ).
</p></dd></dl>
<p>The following example is about generating a certificate request, and a
private key. A certificate request can be later be processed by a CA
which should return a signed certificate.
</p>
<a class="anchor" id="ex_002dcrq"></a><pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <gnutls/abstract.h>
#include <time.h>
/* This example will generate a private key and a certificate
* request.
*/
int main(void)
{
gnutls_x509_crq_t crq;
gnutls_x509_privkey_t key;
unsigned char buffer[10 * 1024];
size_t buffer_size = sizeof(buffer);
unsigned int bits;
gnutls_global_init();
/* Initialize an empty certificate request, and
* an empty private key.
*/
gnutls_x509_crq_init(&crq);
gnutls_x509_privkey_init(&key);
/* Generate an RSA key of moderate security.
*/
bits = gnutls_sec_param_to_pk_bits(GNUTLS_PK_RSA,
GNUTLS_SEC_PARAM_MEDIUM);
gnutls_x509_privkey_generate(key, GNUTLS_PK_RSA, bits, 0);
/* Add stuff to the distinguished name
*/
gnutls_x509_crq_set_dn_by_oid(crq, GNUTLS_OID_X520_COUNTRY_NAME, 0,
"GR", 2);
gnutls_x509_crq_set_dn_by_oid(crq, GNUTLS_OID_X520_COMMON_NAME, 0,
"Nikos", strlen("Nikos"));
/* Set the request version.
*/
gnutls_x509_crq_set_version(crq, 1);
/* Set a challenge password.
*/
gnutls_x509_crq_set_challenge_password(crq,
"something to remember here");
/* Associate the request with the private key
*/
gnutls_x509_crq_set_key(crq, key);
/* Self sign the certificate request.
*/
gnutls_x509_crq_sign2(crq, key, GNUTLS_DIG_SHA1, 0);
/* Export the PEM encoded certificate request, and
* display it.
*/
gnutls_x509_crq_export(crq, GNUTLS_X509_FMT_PEM, buffer, &buffer_size);
printf("Certificate Request: \n%s", buffer);
/* Export the PEM encoded private key, and
* display it.
*/
buffer_size = sizeof(buffer);
gnutls_x509_privkey_export(key, GNUTLS_X509_FMT_PEM, buffer,
&buffer_size);
printf("\n\nPrivate key: \n%s", buffer);
gnutls_x509_crq_deinit(crq);
gnutls_x509_privkey_deinit(key);
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="PKIX-certificate-revocation-lists">
<div class="nav-panel">
<p>
Next: <a href="#OCSP-certificate-status-checking" accesskey="n" rel="next"><abbr class="acronym">OCSP</abbr> certificate status checking</a>, Previous: <a href="#PKCS-10-certificate-requests" accesskey="p" rel="prev"><abbr class="acronym">PKCS</abbr> #10 certificate requests</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="PKIX-certificate-revocation-lists-1"><span>4.2.2 PKIX certificate revocation lists<a class="copiable-link" href="#PKIX-certificate-revocation-lists-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-certificate-revocation-lists"></a>
<a class="index-entry-id" id="index-CRL"></a>
<p>A certificate revocation list (CRL) is a structure issued by an authority
periodically containing a list of revoked certificates serial numbers.
The CRL structure is signed with the issuing authorities’ keys. A typical
CRL contains the fields as shown in <a class="ref" href="#tab_003acrl">Table 4.5</a>.
Certificate revocation lists are used to complement the expiration date of a certificate,
in order to account for other reasons of revocation, such as compromised keys, etc.
</p>
<p>Each CRL is valid for limited amount of
time and is required to provide, except for the current issuing time, also
the issuing time of the next update.
</p>
<div class="float" id="tab_003acrl">
<table class="multitable">
<thead><tr><th width="20%">Field</th><th width="70%">Description</th></tr></thead>
<tbody><tr><td width="20%">version</td><td width="70%">The field that indicates the version of the CRL structure.</td></tr>
<tr><td width="20%">signature</td><td width="70%">A signature by the issuing authority.</td></tr>
<tr><td width="20%">issuer</td><td width="70%">Holds the issuer’s distinguished name.</td></tr>
<tr><td width="20%">thisUpdate</td><td width="70%">The issuing time of the revocation list.</td></tr>
<tr><td width="20%">nextUpdate</td><td width="70%">The issuing time of the revocation list that will update that one.</td></tr>
<tr><td width="20%">revokedCertificates</td><td width="70%">List of revoked certificates serial numbers.</td></tr>
<tr><td width="20%">extensions</td><td width="70%">Optional CRL structure extensions.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 4.5: </strong>Certificate revocation list fields.</p></div></div>
<p>The basic CRL structure functions follow.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005finit">gnutls_x509_crl_init</a> (gnutls_x509_crl_t * <var class="var">crl</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fimport">gnutls_x509_crl_import</a> (gnutls_x509_crl_t <var class="var">crl</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fexport">gnutls_x509_crl_export</a> (gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fexport">gnutls_x509_crl_export</a> (gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code></dt>
</dl>
<h4 class="subsubheading" id="Reading-a-CRL"><span>Reading a CRL<a class="copiable-link" href="#Reading-a-CRL"> ¶</a></span></h4>
<p>The most important function that extracts the certificate revocation
information from a CRL is <a class="ref" href="#gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial">gnutls_x509_crl_get_crt_serial</a>. Other
functions that return other fields of the CRL structure are also provided.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_crt_serial</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned <var class="var">indx</var>, unsigned char * <var class="var">serial</var>, size_t * <var class="var">serial_size</var>, time_t * <var class="var">t</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">indx</var>: the index of the certificate to extract (starting from 0)
</p>
<p><var class="var">serial</var>: where the serial number will be copied
</p>
<p><var class="var">serial_size</var>: initially holds the size of serial
</p>
<p><var class="var">t</var>: if non null, will hold the time this certificate was revoked
</p>
<p>This function will retrieve the serial number of the specified, by
the index, revoked certificate.
</p>
<p>Note that this function will have performance issues in large sequences
of revoked certificates. In that case use <code class="code">gnutls_x509_crl_iter_crt_serial()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fget_005fversion">gnutls_x509_crl_get_version</a> (gnutls_x509_crl_t <var class="var">crl</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn">gnutls_x509_crl_get_issuer_dn</a> (gnutls_x509_crl_t <var class="var">crl</var>, char * <var class="var">buf</var>, size_t * <var class="var">sizeof_buf</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn2">gnutls_x509_crl_get_issuer_dn2</a> (gnutls_x509_crl_t <var class="var">crl</var>, gnutls_datum_t * <var class="var">dn</var>)</code></dt>
<dt><code class="code"><var class="var">time_t</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fget_005fthis_005fupdate">gnutls_x509_crl_get_this_update</a> (gnutls_x509_crl_t <var class="var">crl</var>)</code></dt>
<dt><code class="code"><var class="var">time_t</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fget_005fnext_005fupdate">gnutls_x509_crl_get_next_update</a> (gnutls_x509_crl_t <var class="var">crl</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fget_005fcrt_005fcount">gnutls_x509_crl_get_crt_count</a> (gnutls_x509_crl_t <var class="var">crl</var>)</code></dt>
</dl>
<h4 class="subsubheading" id="Generation-of-a-CRL"><span>Generation of a CRL<a class="copiable-link" href="#Generation-of-a-CRL"> ¶</a></span></h4>
<p>The following functions can be used to generate a CRL.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fset_005fversion">gnutls_x509_crl_set_version</a> (gnutls_x509_crl_t <var class="var">crl</var>, unsigned int <var class="var">version</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fset_005fcrt_005fserial">gnutls_x509_crl_set_crt_serial</a> (gnutls_x509_crl_t <var class="var">crl</var>, const void * <var class="var">serial</var>, size_t <var class="var">serial_size</var>, time_t <var class="var">revocation_time</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fset_005fcrt">gnutls_x509_crl_set_crt</a> (gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">crt</var>, time_t <var class="var">revocation_time</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fset_005fnext_005fupdate">gnutls_x509_crl_set_next_update</a> (gnutls_x509_crl_t <var class="var">crl</var>, time_t <var class="var">exp_time</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fset_005fthis_005fupdate">gnutls_x509_crl_set_this_update</a> (gnutls_x509_crl_t <var class="var">crl</var>, time_t <var class="var">act_time</var>)</code></dt>
</dl>
<p>The <a class="ref" href="#gnutls_005fx509_005fcrl_005fsign2">gnutls_x509_crl_sign2</a> and <a class="ref" href="#gnutls_005fx509_005fcrl_005fprivkey_005fsign">gnutls_x509_crl_privkey_sign</a>
functions sign the revocation list with a private key. The latter function
can be used to sign with a key residing in a PKCS #11 token.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fsign2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_sign2</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_x509_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fsign2"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p><var class="var">dig</var>: The message digest to use. GNUTLS_DIG_SHA256 is the safe choice unless you know what you’re doing.
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the CRL with the issuer’s private key, and
will copy the issuer’s information into the CRL.
</p>
<p>This must be the last step in a certificate CRL since all
the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed CRL will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fprivkey_005fsign"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_privkey_sign</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fprivkey_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p><var class="var">dig</var>: The message digest to use. GNUTLS_DIG_SHA256 is the safe choice unless you know what you’re doing.
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the CRL with the issuer’s private key, and
will copy the issuer’s information into the CRL.
</p>
<p>This must be the last step in a certificate CRL since all
the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed CRL will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p>Since 2.12.0
</p></dd></dl>
<p>Few extensions on the CRL structure are supported, including the
CRL number extension and the authority key identifier.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fset_005fnumber">gnutls_x509_crl_set_number</a> (gnutls_x509_crl_t <var class="var">crl</var>, const void * <var class="var">nr</var>, size_t <var class="var">nr_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fset_005fauthority_005fkey_005fid">gnutls_x509_crl_set_authority_key_id</a> (gnutls_x509_crl_t <var class="var">crl</var>, const void * <var class="var">id</var>, size_t <var class="var">id_size</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="OCSP-certificate-status-checking">
<div class="nav-panel">
<p>
Next: <a href="#OCSP-stapling" accesskey="n" rel="next">OCSP stapling</a>, Previous: <a href="#PKIX-certificate-revocation-lists" accesskey="p" rel="prev">PKIX certificate revocation lists</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="OCSP-certificate-status-checking-1"><span>4.2.3 <abbr class="acronym">OCSP</abbr> certificate status checking<a class="copiable-link" href="#OCSP-certificate-status-checking-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-certificate-status"></a>
<a class="index-entry-id" id="index-Online-Certificate-Status-Protocol"></a>
<a class="index-entry-id" id="index-OCSP"></a>
<p>Certificates may be revoked before their expiration time has been
reached. There are several reasons for revoking certificates, but a
typical situation is when the private key associated with a
certificate has been compromised. Traditionally, Certificate
Revocation Lists (CRLs) have been used by application to implement
revocation checking, however, several problems with CRLs have been
identified [<a class="ref" href="#RIVESTCRL">RIVESTCRL</a>].
</p>
<p>The Online Certificate Status Protocol, or <abbr class="acronym">OCSP</abbr> [<a class="ref" href="#RFC2560">RFC2560</a>],
is a widely implemented protocol which performs certificate revocation status
checking. An application that wish to verify the
identity of a peer will verify the certificate against a set of
trusted certificates and then check whether the certificate is listed
in a CRL and/or perform an OCSP check for the certificate.
</p>
<p>Applications are typically expected to contact the OCSP server in order to
request the certificate validity status. The OCSP server replies with an OCSP
response. This section describes this online communication (which can be avoided
when using OCSP stapled responses, for that, see <a class="ref" href="#OCSP-stapling">OCSP stapling</a>).
</p>
<p>Before performing the OCSP query, the application will need to figure
out the address of the OCSP server. The OCSP server address can be
provided by the local user in manual configuration or may be stored
in the certificate that is being checked. When stored in a certificate
the OCSP server is in the extension field called the Authority Information
Access (AIA). The following function
extracts this information from a certificate.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fauthority_005finfo_005faccess">gnutls_x509_crt_get_authority_info_access</a> (gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">seq</var>, int <var class="var">what</var>, gnutls_datum_t * <var class="var">data</var>, unsigned int * <var class="var">critical</var>)</code></dt>
</dl>
<p>There are several functions in GnuTLS for creating and manipulating
OCSP requests and responses. The general idea is that a client
application creates an OCSP request object, stores some information
about the certificate to check in the request, and then exports the
request in DER format. The request will then need to be sent to the
OCSP responder, which needs to be done by the application (GnuTLS does
not send and receive OCSP packets). Normally an OCSP response is
received that the application will need to import into an OCSP
response object. The digital signature in the OCSP response needs to
be verified against a set of trust anchors before the information in
the response can be trusted.
</p>
<p>The ASN.1 structure of OCSP requests are briefly as follows. It is
useful to review the structures to get an understanding of which
fields are modified by GnuTLS functions.
</p>
<div class="example">
<pre class="example-preformatted">OCSPRequest ::= SEQUENCE {
tbsRequest TBSRequest,
optionalSignature [0] EXPLICIT Signature OPTIONAL }
TBSRequest ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
requestorName [1] EXPLICIT GeneralName OPTIONAL,
requestList SEQUENCE OF Request,
requestExtensions [2] EXPLICIT Extensions OPTIONAL }
Request ::= SEQUENCE {
reqCert CertID,
singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
CertID ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
issuerNameHash OCTET STRING, -- Hash of Issuer's DN
issuerKeyHash OCTET STRING, -- Hash of Issuers public key
serialNumber CertificateSerialNumber }
</pre></div>
<p>The basic functions to initialize, import, export and deallocate OCSP
requests are the following.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005finit">gnutls_ocsp_req_init</a> (gnutls_ocsp_req_t * <var class="var">req</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005focsp_005freq_005fdeinit">gnutls_ocsp_req_deinit</a> (gnutls_ocsp_req_t <var class="var">req</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fimport">gnutls_ocsp_req_import</a> (gnutls_ocsp_req_t <var class="var">req</var>, const gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fexport">gnutls_ocsp_req_export</a> (gnutls_ocsp_req_const_t <var class="var">req</var>, gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fprint">gnutls_ocsp_req_print</a> (gnutls_ocsp_req_const_t <var class="var">req</var>, gnutls_ocsp_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code></dt>
</dl>
<p>To generate an OCSP request the issuer name hash, issuer key hash, and
the checked certificate’s serial number are required. There are two
interfaces available for setting those in an OCSP request.
The is a low-level function when you have the
issuer name hash, issuer key hash, and certificate serial number in
binary form. The second is more useful if you have the
certificate (and its issuer) in a <code class="code">gnutls_x509_crt_t</code> type.
There is also a function to extract this information from existing an OCSP
request.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fadd_005fcert_005fid">gnutls_ocsp_req_add_cert_id</a> (gnutls_ocsp_req_t <var class="var">req</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, const gnutls_datum_t * <var class="var">issuer_name_hash</var>, const gnutls_datum_t * <var class="var">issuer_key_hash</var>, const gnutls_datum_t * <var class="var">serial_number</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fadd_005fcert">gnutls_ocsp_req_add_cert</a> (gnutls_ocsp_req_t <var class="var">req</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_x509_crt_t <var class="var">cert</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fget_005fcert_005fid">gnutls_ocsp_req_get_cert_id</a> (gnutls_ocsp_req_const_t <var class="var">req</var>, unsigned <var class="var">indx</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_datum_t * <var class="var">issuer_name_hash</var>, gnutls_datum_t * <var class="var">issuer_key_hash</var>, gnutls_datum_t * <var class="var">serial_number</var>)</code></dt>
</dl>
<p>Each OCSP request may contain a number of extensions. Extensions are
identified by an Object Identifier (OID) and an opaque data buffer
whose syntax and semantics is implied by the OID. You can extract or
set those extensions using the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fget_005fextension">gnutls_ocsp_req_get_extension</a> (gnutls_ocsp_req_const_t <var class="var">req</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">oid</var>, unsigned int * <var class="var">critical</var>, gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fset_005fextension">gnutls_ocsp_req_set_extension</a> (gnutls_ocsp_req_t <var class="var">req</var>, const char * <var class="var">oid</var>, unsigned int <var class="var">critical</var>, const gnutls_datum_t * <var class="var">data</var>)</code></dt>
</dl>
<p>A common OCSP Request extension is the nonce extension (OID
1.3.6.1.5.5.7.48.1.2), which is used to avoid replay attacks of
earlier recorded OCSP responses. The nonce extension carries a value
that is intended to be sufficiently random and unique so that an
attacker will not be able to give a stale response for the same nonce.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fget_005fnonce">gnutls_ocsp_req_get_nonce</a> (gnutls_ocsp_req_const_t <var class="var">req</var>, unsigned int * <var class="var">critical</var>, gnutls_datum_t * <var class="var">nonce</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005fset_005fnonce">gnutls_ocsp_req_set_nonce</a> (gnutls_ocsp_req_t <var class="var">req</var>, unsigned int <var class="var">critical</var>, const gnutls_datum_t * <var class="var">nonce</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005freq_005frandomize_005fnonce">gnutls_ocsp_req_randomize_nonce</a> (gnutls_ocsp_req_t <var class="var">req</var>)</code></dt>
</dl>
<p>The OCSP response structures is a complex structure. A simplified overview
of it is in <a class="ref" href="#tab_003aocsp_002dresponse">Table 4.6</a>. Note that a response may contain
information on multiple certificates.
</p>
<div class="float" id="tab_003aocsp_002dresponse">
<table class="multitable">
<thead><tr><th width="20%">Field</th><th width="70%">Description</th></tr></thead>
<tbody><tr><td width="20%">version</td><td width="70%">The OCSP response version number (typically 1).</td></tr>
<tr><td width="20%">responder ID</td><td width="70%">An identifier of the responder (DN name or a hash of its key).</td></tr>
<tr><td width="20%">issue time</td><td width="70%">The time the response was generated.</td></tr>
<tr><td width="20%">thisUpdate</td><td width="70%">The issuing time of the revocation information.</td></tr>
<tr><td width="20%">nextUpdate</td><td width="70%">The issuing time of the revocation information that will update that one.</td></tr>
<tr><td width="20%"></td><td width="70%">Revoked certificates</td></tr>
<tr><td width="20%">certificate status</td><td width="70%">The status of the certificate.</td></tr>
<tr><td width="20%">certificate serial</td><td width="70%">The certificate’s serial number.</td></tr>
<tr><td width="20%">revocationTime</td><td width="70%">The time the certificate was revoked.</td></tr>
<tr><td width="20%">revocationReason</td><td width="70%">The reason the certificate was revoked.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 4.6: </strong>The most important OCSP response fields.</p></div></div>
<p>We provide basic functions for initialization, importing, exporting
and deallocating OCSP responses.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fresp_005finit">gnutls_ocsp_resp_init</a> (gnutls_ocsp_resp_t * <var class="var">resp</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005focsp_005fresp_005fdeinit">gnutls_ocsp_resp_deinit</a> (gnutls_ocsp_resp_t <var class="var">resp</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fresp_005fimport">gnutls_ocsp_resp_import</a> (gnutls_ocsp_resp_t <var class="var">resp</var>, const gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fresp_005fexport">gnutls_ocsp_resp_export</a> (gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fresp_005fprint">gnutls_ocsp_resp_print</a> (gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_ocsp_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code></dt>
</dl>
<p>The utility function that extracts the revocation as well as other information
from a response is shown below.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fsingle"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_single</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, unsigned <var class="var">indx</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_datum_t * <var class="var">issuer_name_hash</var>, gnutls_datum_t * <var class="var">issuer_key_hash</var>, gnutls_datum_t * <var class="var">serial_number</var>, unsigned int * <var class="var">cert_status</var>, time_t * <var class="var">this_update</var>, time_t * <var class="var">next_update</var>, time_t * <var class="var">revocation_time</var>, unsigned int * <var class="var">revocation_reason</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fsingle"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">indx</var>: Specifies response number to get. Use (0) to get the first one.
</p>
<p><var class="var">digest</var>: output variable with <code class="code">gnutls_digest_algorithm_t</code> hash algorithm
</p>
<p><var class="var">issuer_name_hash</var>: output buffer with hash of issuer’s DN
</p>
<p><var class="var">issuer_key_hash</var>: output buffer with hash of issuer’s public key
</p>
<p><var class="var">serial_number</var>: output buffer with serial number of certificate to check
</p>
<p><var class="var">cert_status</var>: a certificate status, a <code class="code">gnutls_ocsp_cert_status_t</code> enum.
</p>
<p><var class="var">this_update</var>: time at which the status is known to be correct.
</p>
<p><var class="var">next_update</var>: when newer information will be available, or (time_t)-1 if unspecified
</p>
<p><var class="var">revocation_time</var>: when <code class="code">cert_status</code> is <code class="code">GNUTLS_OCSP_CERT_REVOKED</code> , holds time of revocation.
</p>
<p><var class="var">revocation_reason</var>: revocation reason, a <code class="code">gnutls_x509_crl_reason_t</code> enum.
</p>
<p>This function will return the certificate information of the
<code class="code">indx</code> ’ed response in the Basic OCSP Response <code class="code">resp</code> . The
information returned corresponds to the OCSP SingleResponse structure
except the final singleExtensions.
</p>
<p>Each of the pointers to output variables may be NULL to indicate
that the caller is not interested in that value.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned. If you have reached the last
CertID available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p></dd></dl>
<p>The possible revocation reasons available in an OCSP response are shown
below.
</p>
<div class="float" id="gnutls_005fx509_005fcrl_005freason_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_X509_CRLREASON_UNSPECIFIED</code></dt>
<dd><p>Unspecified reason.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_KEYCOMPROMISE</code></dt>
<dd><p>Private key compromised.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_CACOMPROMISE</code></dt>
<dd><p>CA compromised.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_AFFILIATIONCHANGED</code></dt>
<dd><p>Affiliation has changed.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_SUPERSEDED</code></dt>
<dd><p>Certificate superseded.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_CESSATIONOFOPERATION</code></dt>
<dd><p>Operation has ceased.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_CERTIFICATEHOLD</code></dt>
<dd><p>Certificate is on hold.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_REMOVEFROMCRL</code></dt>
<dd><p>Will be removed from delta CRL.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_PRIVILEGEWITHDRAWN</code></dt>
<dd><p>Privilege withdrawn.
</p></dd>
<dt><code class="code">GNUTLS_X509_CRLREASON_AACOMPROMISE</code></dt>
<dd><p>AA compromised.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 4.4: </strong>The revocation reasons</p></div></div>
<p>Note, that the OCSP response needs to be verified against some set of trust
anchors before it can be relied upon. It is also important to check
whether the received OCSP response corresponds to the certificate being checked.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fresp_005fverify">gnutls_ocsp_resp_verify</a> (gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_x509_trust_list_t <var class="var">trustlist</var>, unsigned int * <var class="var">verify</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fresp_005fverify_005fdirect">gnutls_ocsp_resp_verify_direct</a> (gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_x509_crt_t <var class="var">issuer</var>, unsigned int * <var class="var">verify</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fresp_005fcheck_005fcrt">gnutls_ocsp_resp_check_crt</a> (gnutls_ocsp_resp_const_t <var class="var">resp</var>, unsigned int <var class="var">indx</var>, gnutls_x509_crt_t <var class="var">crt</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="OCSP-stapling">
<div class="nav-panel">
<p>
Next: <a href="#Managing-encrypted-keys" accesskey="n" rel="next">Managing encrypted keys</a>, Previous: <a href="#OCSP-certificate-status-checking" accesskey="p" rel="prev"><abbr class="acronym">OCSP</abbr> certificate status checking</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="OCSP-stapling-1"><span>4.2.4 OCSP stapling<a class="copiable-link" href="#OCSP-stapling-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-certificate-status-1"></a>
<a class="index-entry-id" id="index-Online-Certificate-Status-Protocol-1"></a>
<a class="index-entry-id" id="index-OCSP-stapling"></a>
<p>To avoid applications contacting the OCSP server directly, TLS servers
can provide a "stapled" OCSP response in the TLS handshake. That way
the client application needs to do nothing more. GnuTLS will automatically
consider the stapled OCSP response during the TLS certificate verification
(see <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers2">gnutls_certificate_verify_peers2</a>). To disable the automatic
OCSP verification the flag <code class="code">GNUTLS_VERIFY_DISABLE_CRL_CHECKS</code> should be
specified to <a class="ref" href="#gnutls_005fcertificate_005fset_005fverify_005fflags">gnutls_certificate_set_verify_flags</a>.
</p>
<p>Since GnuTLS 3.5.1 the client certificate verification will consider the [<a class="ref" href="#RFC7633">RFC7633</a>]
OCSP-Must-staple certificate extension, and will consider it while checking for stapled
OCSP responses. If the extension is present and no OCSP staple is found, the certificate
verification will fail and the status code <code class="code">GNUTLS_CERT_MISSING_OCSP_STATUS</code> will
returned from the verification function.
</p>
<p>Under TLS 1.2 only one stapled response can be sent by a server, the OCSP
response associated with the end-certificate. Under TLS 1.3 a server can
send multiple OCSP responses, typically one for each certificate in the
certificate chain. The following functions can be used by a client
application to retrieve the OCSP responses as sent by the server.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fstatus_005frequest_005fget">gnutls_ocsp_status_request_get</a> (gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">response</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005focsp_005fstatus_005frequest_005fget2">gnutls_ocsp_status_request_get2</a> (gnutls_session_t <var class="var">session</var>, unsigned <var class="var">idx</var>, gnutls_datum_t * <var class="var">response</var>)</code></dt>
</dl>
<p>GnuTLS servers can provide OCSP responses to their clients using the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction3">gnutls_certificate_set_retrieve_function3</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function3 * <var class="var">func</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2">gnutls_certificate_set_ocsp_status_request_file2</a> (gnutls_certificate_credentials_t <var class="var">sc</var>, const char * <var class="var">response_file</var>, unsigned <var class="var">idx</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005focsp_005fstatus_005frequest_005fis_005fchecked">gnutls_ocsp_status_request_is_checked</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<p>A server is expected to provide the relevant certificate’s OCSP responses using
<a class="ref" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2">gnutls_certificate_set_ocsp_status_request_file2</a>, and ensure a
periodic reload/renew of the credentials. An estimation of the OCSP responses
expiration can be obtained using the <a class="ref" href="#gnutls_005fcertificate_005fget_005focsp_005fexpiration">gnutls_certificate_get_ocsp_expiration</a> function.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005focsp_005fexpiration"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_certificate_get_ocsp_expiration</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, unsigned <var class="var">idx</var>, int <var class="var">oidx</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005focsp_005fexpiration"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a credentials structure.
</p>
<p><var class="var">idx</var>: is a certificate chain index as returned by <code class="code">gnutls_certificate_set_key()</code> and friends
</p>
<p><var class="var">oidx</var>: is an OCSP response index
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function returns the validity of the loaded OCSP responses,
to provide information on when to reload/refresh them.
</p>
<p>Note that the credentials structure should be read-only when in
use, thus when reloading, either the credentials structure must not
be in use by any sessions, or a new credentials structure should be
allocated for new sessions.
</p>
<p>When <code class="code">oidx</code> is (-1) then the minimum refresh time for all responses
is returned. Otherwise the index specifies the response corresponding
to the <code class="code">odix</code> certificate in the certificate chain.
</p>
<p><strong class="strong">Returns:</strong> On success, the expiration time of the OCSP response. Otherwise
(time_t)(-1) on error, or (time_t)-2 on out of bounds.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<p>Prior to GnuTLS 3.6.4, the functions
<a class="ref" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction2">gnutls_certificate_set_ocsp_status_request_function2</a>
<a class="ref" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile">gnutls_certificate_set_ocsp_status_request_file</a> were provided
to set OCSP responses. These functions are still functional, but cannot be used
to set multiple OCSP responses as allowed by TLS1.3.
</p>
<p>The responses can be updated periodically using the ’ocsptool’ command
(see also <a class="ref" href="#ocsptool-Invocation">Invoking ocsptool</a>).
</p>
<div class="example">
<pre class="example-preformatted">ocsptool --ask --load-cert server_cert.pem --load-issuer the_issuer.pem
--load-signer the_issuer.pem --outfile ocsp.resp
</pre></div>
<p>In order to allow multiple OCSP responses to be concatenated, GnuTLS
supports PEM-encoded OCSP responses. These can be generated using
’ocsptool’ with the ’–no-outder’ parameter.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Managing-encrypted-keys">
<div class="nav-panel">
<p>
Next: <a href="#certtool-Invocation" accesskey="n" rel="next">Invoking certtool</a>, Previous: <a href="#OCSP-stapling" accesskey="p" rel="prev">OCSP stapling</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Managing-encrypted-keys-1"><span>4.2.5 Managing encrypted keys<a class="copiable-link" href="#Managing-encrypted-keys-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-Encrypted-keys"></a>
<p>Transferring or storing private keys in plain may not be a
good idea, since any compromise is irreparable.
Storing the keys in hardware security modules (see <a class="ref" href="#Smart-cards-and-HSMs">Smart cards and HSMs</a>)
could solve the storage problem but it is not always practical
or efficient enough. This section describes ways to store and
transfer encrypted private keys.
</p>
<p>There are methods for key encryption, namely the
PKCS #8, PKCS #12 and OpenSSL’s custom encrypted private key formats.
The PKCS #8 and the OpenSSL’s method allow encryption of the private key,
while the PKCS #12 method allows, in addition, the bundling of accompanying
data into the structure. That is typically the corresponding certificate, as
well as a trusted CA certificate.
</p>
<h4 class="subsubheading" id="High-level-functionality"><span>High level functionality<a class="copiable-link" href="#High-level-functionality"> ¶</a></span></h4>
<p>Generic and higher level private key import functions are available, that
import plain or encrypted keys and will auto-detect the encrypted key format.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fx509_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_x509_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fx509_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">data</var>: The private key data to be imported
</p>
<p><var class="var">format</var>: The format of the private key
</p>
<p><var class="var">password</var>: A password (optional)
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>The supported formats are basic unencrypted key, PKCS8, PKCS12,
TSS2, and the openssl format.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import2</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">data</var>: The DER or PEM encoded key.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p><var class="var">password</var>: A password (optional)
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p>This function will import the given DER or PEM encoded key, to
the native <code class="code">gnutls_x509_privkey_t</code> format, irrespective of the
input format. The input format is auto-detected.
</p>
<p>The supported formats are basic unencrypted key, PKCS8, PKCS12,
and the openssl format.
</p>
<p>If the provided key is encrypted but no password was given, then
<code class="code">GNUTLS_E_DECRYPTION_FAILED</code> is returned. Since GnuTLS 3.4.0 this
function will utilize the PIN callbacks if any.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<p>Any keys imported using those functions can be imported to a certificate
credentials structure using <a class="ref" href="#gnutls_005fcertificate_005fset_005fkey">gnutls_certificate_set_key</a>, or alternatively
they can be directly imported using <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2">gnutls_certificate_set_x509_key_file2</a>.
</p>
<h4 class="subsubheading" id="PKCS-_00238-structures"><span><abbr class="acronym">PKCS</abbr> #8 structures<a class="copiable-link" href="#PKCS-_00238-structures"> ¶</a></span></h4>
<a class="index-entry-id" id="index-PKCS-_00238"></a>
<p>PKCS #8 keys can be imported and exported as normal private keys using
the functions below. An addition to the normal import functions, are
a password and a flags argument. The flags can be any element of the <code class="code">gnutls_pkcs_encrypt_flags_t</code>
enumeration. Note however, that GnuTLS only supports the PKCS #5 PBES2
encryption scheme. Keys encrypted with the obsolete PBES1 scheme cannot
be decrypted.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fimport_005fpkcs8">gnutls_x509_privkey_import_pkcs8</a> (gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fexport_005fpkcs8">gnutls_x509_privkey_export_pkcs8</a> (gnutls_x509_privkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fprivkey_005fexport2_005fpkcs8">gnutls_x509_privkey_export2_pkcs8</a> (gnutls_x509_privkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>, gnutls_datum_t * <var class="var">out</var>)</code></dt>
</dl>
<div class="float" id="gnutls_005fpkcs_005fencrypt_005fflags_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_PKCS_PLAIN</code></dt>
<dd><p>Unencrypted private key.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PKCS12_3DES</code></dt>
<dd><p>PKCS-12 3DES.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PKCS12_ARCFOUR</code></dt>
<dd><p>PKCS-12 ARCFOUR.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PKCS12_RC2_40</code></dt>
<dd><p>PKCS-12 RC2-40.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_3DES</code></dt>
<dd><p>PBES2 3DES.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_AES_128</code></dt>
<dd><p>PBES2 AES-128.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_AES_192</code></dt>
<dd><p>PBES2 AES-192.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_AES_256</code></dt>
<dd><p>PBES2 AES-256.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_NULL_PASSWORD</code></dt>
<dd><p>Some schemas distinguish between an empty and a NULL password.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_DES</code></dt>
<dd><p>PBES2 single DES.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES1_DES_MD5</code></dt>
<dd><p>PBES1 with single DES; for compatibility with openssl only.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_GOST_TC26Z</code></dt>
<dd><p>PBES2 GOST 28147-89 CFB with TC26-Z S-box.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_GOST_CPA</code></dt>
<dd><p>PBES2 GOST 28147-89 CFB with CryptoPro-A S-box.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_GOST_CPB</code></dt>
<dd><p>PBES2 GOST 28147-89 CFB with CryptoPro-B S-box.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_GOST_CPC</code></dt>
<dd><p>PBES2 GOST 28147-89 CFB with CryptoPro-C S-box.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES2_GOST_CPD</code></dt>
<dd><p>PBES2 GOST 28147-89 CFB with CryptoPro-D S-box.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_PBES1_DES_SHA1</code></dt>
<dd><p>PBES1 with single DES; for compatibility purposes only.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_MLDSA_SEED</code></dt>
<dd><p>Emit seed as an ML-DSA private key.
</p></dd>
<dt><code class="code">GNUTLS_PKCS_MLDSA_EXPANDED</code></dt>
<dd><p>Emit an expanded ML-DSA private key.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 4.5: </strong>Encryption flags</p></div></div>
<h4 class="subsubheading" id="PKCS-_002312-structures"><span><abbr class="acronym">PKCS</abbr> #12 structures<a class="copiable-link" href="#PKCS-_002312-structures"> ¶</a></span></h4>
<a class="index-entry-id" id="index-PKCS-_002312"></a>
<p>A <abbr class="acronym">PKCS</abbr> #12 structure [<a class="ref" href="#PKCS12">PKCS12</a>] usually contains a user’s
private keys and certificates. It is commonly used in browsers to
export and import the user’s identities. A file containing such a key can
be directly imported to a certificate credentials structure by using
<a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile">gnutls_certificate_set_x509_simple_pkcs12_file</a>.
</p>
<p>In <abbr class="acronym">GnuTLS</abbr> the <abbr class="acronym">PKCS</abbr> #12 structures are handled
using the <code class="code">gnutls_pkcs12_t</code> type. This is an abstract type that
may hold several <code class="code">gnutls_pkcs12_bag_t</code> types. The bag types are
the holders of the actual data, which may be certificates, private
keys or encrypted data. A bag of type encrypted should be decrypted
in order for its data to be accessed.
</p>
<p>To reduce the complexity in parsing the structures the simple
helper function <a class="ref" href="#gnutls_005fpkcs12_005fsimple_005fparse">gnutls_pkcs12_simple_parse</a> is provided. For more
advanced uses, manual parsing of the structure is required using the
functions below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fget_005fbag">gnutls_pkcs12_get_bag</a> (gnutls_pkcs12_t <var class="var">pkcs12</var>, int <var class="var">indx</var>, gnutls_pkcs12_bag_t <var class="var">bag</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fverify_005fmac">gnutls_pkcs12_verify_mac</a> (gnutls_pkcs12_t <var class="var">pkcs12</var>, const char * <var class="var">pass</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fdecrypt">gnutls_pkcs12_bag_decrypt</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, const char * <var class="var">pass</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fget_005fcount">gnutls_pkcs12_bag_get_count</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fsimple_005fparse"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_simple_parse</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">p12</var>, const char * <var class="var">password</var>, gnutls_x509_privkey_t * <var class="var">key</var>, gnutls_x509_crt_t ** <var class="var">chain</var>, unsigned int * <var class="var">chain_len</var>, gnutls_x509_crt_t ** <var class="var">extra_certs</var>, unsigned int * <var class="var">extra_certs_len</var>, gnutls_x509_crl_t * <var class="var">crl</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fsimple_005fparse"> ¶</a></span></dt>
<dd><p><var class="var">p12</var>: A pkcs12 type
</p>
<p><var class="var">password</var>: optional password used to decrypt the structure, bags and keys.
</p>
<p><var class="var">key</var>: a structure to store the parsed private key.
</p>
<p><var class="var">chain</var>: the corresponding to key certificate chain (may be <code class="code">NULL</code> )
</p>
<p><var class="var">chain_len</var>: will be updated with the number of additional (may be <code class="code">NULL</code> )
</p>
<p><var class="var">extra_certs</var>: optional pointer to receive an array of additional
certificates found in the PKCS12 structure (may be <code class="code">NULL</code> ).
</p>
<p><var class="var">extra_certs_len</var>: will be updated with the number of additional
certs (may be <code class="code">NULL</code> ).
</p>
<p><var class="var">crl</var>: an optional structure to store the parsed CRL (may be <code class="code">NULL</code> ).
</p>
<p><var class="var">flags</var>: should be zero or one of GNUTLS_PKCS12_SP_*
</p>
<p>This function parses a PKCS12 structure in <code class="code">pkcs12</code> and extracts the
private key, the corresponding certificate chain, any additional
certificates and a CRL. The structures in <code class="code">key</code> , <code class="code">chain</code> <code class="code">crl</code> , and <code class="code">extra_certs</code> must not be initialized.
</p>
<p>The <code class="code">extra_certs</code> and <code class="code">extra_certs_len</code> parameters are optional
and both may be set to <code class="code">NULL</code> . If either is non-<code class="code">NULL</code> , then both must
be set. The value for <code class="code">extra_certs</code> is allocated
using <code class="code">gnutls_malloc()</code> .
</p>
<p>Encrypted PKCS12 bags and PKCS8 private keys are supported, but
only with password based security and the same password for all
operations.
</p>
<p>Note that a PKCS12 structure may contain many keys and/or certificates,
and there is no way to identify which key/certificate pair you want.
For this reason this function is useful for PKCS12 files that contain
only one key/certificate pair and/or one CRL.
</p>
<p>If the provided structure has encrypted fields but no password
is provided then this function returns <code class="code">GNUTLS_E_DECRYPTION_FAILED</code> .
</p>
<p>Note that normally the chain constructed does not include self signed
certificates, to comply with TLS’ requirements. If, however, the flag
<code class="code">GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</code> is specified then
self signed certificates will be included in the chain.
</p>
<p>Prior to using this function the PKCS <code class="code">12</code> structure integrity must
be verified using <code class="code">gnutls_pkcs12_verify_mac()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fget_005fdata">gnutls_pkcs12_bag_get_data</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fget_005fkey_005fid">gnutls_pkcs12_bag_get_key_id</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">id</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fget_005ffriendly_005fname">gnutls_pkcs12_bag_get_friendly_name</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, char ** <var class="var">name</var>)</code></dt>
</dl>
<p>The functions below are used to generate a PKCS #12 structure. An example
of their usage is shown at <a class="ref" href="#PKCS12-structure-generation-example">PKCS #12 structure generation example</a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fset_005fbag">gnutls_pkcs12_set_bag</a> (gnutls_pkcs12_t <var class="var">pkcs12</var>, gnutls_pkcs12_bag_t <var class="var">bag</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fencrypt">gnutls_pkcs12_bag_encrypt</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fgenerate_005fmac">gnutls_pkcs12_generate_mac</a> (gnutls_pkcs12_t <var class="var">pkcs12</var>, const char * <var class="var">pass</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fset_005fdata">gnutls_pkcs12_bag_set_data</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, gnutls_pkcs12_bag_type_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fset_005fcrl">gnutls_pkcs12_bag_set_crl</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, gnutls_x509_crl_t <var class="var">crl</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fset_005fcrt">gnutls_pkcs12_bag_set_crt</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, gnutls_x509_crt_t <var class="var">crt</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fset_005fkey_005fid">gnutls_pkcs12_bag_set_key_id</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, const gnutls_datum_t * <var class="var">id</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs12_005fbag_005fset_005ffriendly_005fname">gnutls_pkcs12_bag_set_friendly_name</a> (gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, const char * <var class="var">name</var>)</code></dt>
</dl>
<h4 class="subsubheading" id="OpenSSL-encrypted-keys"><span>OpenSSL encrypted keys<a class="copiable-link" href="#OpenSSL-encrypted-keys"> ¶</a></span></h4>
<a class="index-entry-id" id="index-OpenSSL-encrypted-keys"></a>
<p>Unfortunately the structures discussed in the previous sections are
not the only structures that may hold an encrypted private key. For example
the OpenSSL library offers a custom key encryption method. Those structures
are also supported in GnuTLS with <a class="ref" href="#gnutls_005fx509_005fprivkey_005fimport_005fopenssl">gnutls_x509_privkey_import_openssl</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005fopenssl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_openssl</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, const char * <var class="var">password</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005fopenssl"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">data</var>: The DER or PEM encoded key.
</p>
<p><var class="var">password</var>: the password to decrypt the key (if it is encrypted).
</p>
<p>This function will convert the given PEM encrypted to
the native gnutls_x509_privkey_t format. The
output will be stored in <code class="code">key</code> .
</p>
<p>The <code class="code">password</code> should be in ASCII. If the password is not provided
or wrong then <code class="code">GNUTLS_E_DECRYPTION_FAILED</code> will be returned.
</p>
<p>If the Certificate is PEM encoded it should have a header of
"PRIVATE KEY" and the "DEK-Info" header.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="certtool-Invocation">
<div class="nav-panel">
<p>
Next: <a href="#ocsptool-Invocation" accesskey="n" rel="next">Invoking ocsptool</a>, Previous: <a href="#Managing-encrypted-keys" accesskey="p" rel="prev">Managing encrypted keys</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Invoking-certtool"><span>4.2.6 Invoking certtool<a class="copiable-link" href="#Invoking-certtool"> ¶</a></span></h4>
<a class="index-entry-id" id="index-certtool"></a>
<p>Tool to parse and generate X.509 certificates, requests and private keys.
It can be used interactively or non interactively by
specifying the template command line option.
</p>
<p>The tool accepts files or supported URIs via the –infile option. In case PIN
is required for URI access you can provide it using the environment variables GNUTLS_PIN
and GNUTLS_SO_PIN.
</p>
<a class="anchor" id="certtool-usage"></a><h4 class="subsubheading" id="certtool-help_002fusage-_0028_002d_003f_0029"><span>certtool help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#certtool-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-certtool-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">certtool - GnuTLS certificate tool
Usage: certtool [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
-V, --verbose More verbose output
--infile=file Input file
- file must pre-exist
--outfile=str Output file
--attime=str Perform validation at the timestamp instead of the system time
Certificate related options:
-i, --certificate-info Print information on the given certificate
--pubkey-info Print information on a public key
-s, --generate-self-signed Generate a self-signed certificate
-c, --generate-certificate Generate a signed certificate
--generate-proxy Generates a proxy certificate
-u, --update-certificate Update a signed certificate
--fingerprint Print the fingerprint of the given certificate
--key-id Print the key ID of the given certificate
--v1 Generate an X.509 version 1 certificate (with no extensions)
--sign-params=str Sign a certificate with a specific signature algorithm
Certificate request related options:
--crq-info Print information on the given certificate request
-q, --generate-request Generate a PKCS #10 certificate request
- prohibits the option 'infile'
--no-crq-extensions Do not use extensions in certificate requests
PKCS#12 file related options:
--p12-info Print information on a PKCS #12 structure
--p12-name=str The PKCS #12 friendly name to use
--to-p12 Generate a PKCS #12 structure
--pbmac1 Use PBMAC1 in a PKCS #12 structure
Private key related options:
-k, --key-info Print information on a private key
--p8-info Print information on a PKCS #8 structure
--to-rsa Convert an RSA-PSS key to raw RSA format
-p, --generate-privkey Generate a private key
--key-type=str Specify the key type to use on key generation
--key-format=str Specify the key format to use on key generation
--bits=num Specify the number of bits for key generation
--curve=str Specify the curve used for EC key generation
--sec-param=str Specify the security level [low, legacy, medium, high, ultra]
--to-p8 Convert a given key to a PKCS #8 structure
-8, --pkcs8 Use PKCS #8 format for private keys
--provable Generate a private key or parameters from a seed using a provable method
--verify-provable-privkey Verify a private key generated from a seed using a provable method
--seed=str When generating a private key use the given hex-encoded seed
CRL related options:
-l, --crl-info Print information on the given CRL structure
--generate-crl Generate a CRL
--verify-crl Verify a Certificate Revocation List using a trusted list
- requires the option 'load-ca-certificate'
Certificate verification related options:
-e, --verify-chain Verify a PEM encoded certificate chain
--verify Verify a PEM encoded certificate (chain) against a trusted set
--verify-hostname=str Specify a hostname to be used for certificate chain verification
--verify-email=str Specify a email to be used for certificate chain verification
- prohibits the option 'verify-hostname'
--verify-purpose=str Specify a purpose OID to be used for certificate chain verification
--verify-allow-broken Allow broken algorithms, such as MD5 for verification
--verify-profile=str Specify a security level profile to be used for verification
PKCS#7 structure options:
--p7-generate Generate a PKCS #7 structure
--p7-sign Signs using a PKCS #7 structure
--p7-detached-sign Signs using a detached PKCS #7 structure
--p7-include-cert The signer's certificate will be included in the cert list
- enabled by default
- disabled as '--no-p7-include-cert'
--p7-time Will include a timestamp in the PKCS #7 structure
--p7-show-data Will show the embedded data in the PKCS #7 structure
--p7-info Print information on a PKCS #7 structure
--p7-verify Verify the provided PKCS #7 structure
--smime-to-p7 Convert S/MIME to PKCS #7 structure
Other options:
--get-dh-params List the included PKCS #3 encoded Diffie-Hellman parameters
--dh-info Print information PKCS #3 encoded Diffie-Hellman parameters
--load-privkey=str Loads a private key file
--load-pubkey=str Loads a public key file
--load-request=str Loads a certificate request file
--load-certificate=str Loads a certificate file
--load-ca-privkey=str Loads the certificate authority's private key file
--load-ca-certificate=str Loads the certificate authority's certificate file
--load-crl=str Loads the provided CRL
--load-data=str Loads auxiliary data
--password=str Password to use
--null-password Enforce a NULL password
--empty-password Enforce an empty password
--hex-numbers Print big number in an easier format to parse
--cprint In certain operations it prints the information in C-friendly format
--hash=str Hash algorithm to use for signing
--salt-size=num Specify the RSA-PSS key default salt size
--label=str Specify the RSA-OAEP label, encoded in hexadecimal
--inder Use DER format for input certificates, private keys, and DH parameters
--inraw an alias for the 'inder' option
--outder Use DER format for output certificates, private keys, and DH parameters
--outraw an alias for the 'outder' option
--template=str Template file to use for non-interactive operation
--stdout-info Print information to stdout instead of stderr
--ask-pass Enable interaction for entering password when in batch mode
--pkcs-cipher=str Cipher to use for PKCS #8 and #12 operations
--provider=str Specify the PKCS #11 provider library
--text Output textual information before PEM-encoded certificates, private keys, etc
- enabled by default
- disabled as '--no-text'
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Tool to parse and generate X.509 certificates, requests and private keys.
It can be used interactively or non interactively by
specifying the template command line option.
The tool accepts files or supported URIs via the --infile option. In case PIN
is required for URI access you can provide it using the environment variables GNUTLS_PIN
and GNUTLS_SO_PIN.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subsubheading" id="debug-option-_0028_002dd_0029_002e-3"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-3"> ¶</a></span></h4>
<a class="anchor" id="certtool-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subsubheading" id="attime-option_002e-3"><span>attime option.<a class="copiable-link" href="#attime-option_002e-3"> ¶</a></span></h4>
<a class="anchor" id="certtool-attime"></a>
<p>This is the “perform validation at the timestamp instead of the system time” option.
This option takes a ArgumentType.STRING argument <samp class="file">timestamp</samp>.
timestamp is an instance in time encoded as Unix time or in a human
readable timestring such as "29 Feb 2004", "2004-02-29".
Full documentation available at
<https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html>
or locally via info ’(coreutils) date invocation’.
<a class="anchor" id="certtool-cert_002doptions"></a></p><h4 class="subsubheading" id="cert_002doptions-options"><span>cert-options options<a class="copiable-link" href="#cert_002doptions-options"> ¶</a></span></h4>
<p>Certificate related options.
</p><h4 class="subsubheading" id="pubkey_002dinfo-option_002e"><span>pubkey-info option.<a class="copiable-link" href="#pubkey_002dinfo-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-pubkey_002dinfo"></a>
<p>This is the “print information on a public key” option.
The option combined with –load-request, –load-pubkey, –load-privkey and –load-certificate will extract the public key of the object in question.
</p><h4 class="subsubheading" id="fingerprint-option_002e"><span>fingerprint option.<a class="copiable-link" href="#fingerprint-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-fingerprint"></a>
<p>This is the “print the fingerprint of the given certificate” option.
This is a simple hash of the DER encoding of the certificate. It can be combined with the –hash parameter. However, it is recommended for identification to use the key-id which depends only on the certificate’s key.
</p><h4 class="subsubheading" id="key_002did-option_002e"><span>key-id option.<a class="copiable-link" href="#key_002did-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-key_002did"></a>
<p>This is the “print the key id of the given certificate” option.
This is a hash of the public key of the given certificate. It identifies the key uniquely, remains the same on a certificate renewal and depends only on signed fields of the certificate.
</p><h4 class="subsubheading" id="certificate_002dpubkey-option_002e"><span>certificate-pubkey option.<a class="copiable-link" href="#certificate_002dpubkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-certificate_002dpubkey"></a>
<p>This is the “print certificate’s public key” option.
This option is deprecated as a duplicate of –pubkey-info
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="sign_002dparams-option_002e"><span>sign-params option.<a class="copiable-link" href="#sign_002dparams-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-sign_002dparams"></a>
<p>This is the “sign a certificate with a specific signature algorithm” option.
This option takes a ArgumentType.STRING argument.
This option can be combined with –generate-certificate, to sign the certificate with
a specific signature algorithm variant. The only option supported is ’RSA-PSS’, and should be
specified when the signer does not have a certificate which is marked for RSA-PSS use only.
<a class="anchor" id="certtool-crq_002doptions"></a></p><h4 class="subsubheading" id="crq_002doptions-options"><span>crq-options options<a class="copiable-link" href="#crq_002doptions-options"> ¶</a></span></h4>
<p>Certificate request related options.
</p><h4 class="subsubheading" id="generate_002drequest-option-_0028_002dq_0029_002e"><span>generate-request option (-q).<a class="copiable-link" href="#generate_002drequest-option-_0028_002dq_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-generate_002drequest"></a>
<p>This is the “generate a pkcs #10 certificate request” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
infile.
</li></ul>
<p>Will generate a PKCS #10 certificate request. To specify a private key use –load-privkey.
<a class="anchor" id="certtool-pkcs12_002doptions"></a></p><h4 class="subsubheading" id="pkcs12_002doptions-options"><span>pkcs12-options options<a class="copiable-link" href="#pkcs12_002doptions-options"> ¶</a></span></h4>
<p>PKCS#12 file related options.
</p><h4 class="subsubheading" id="p12_002dinfo-option_002e"><span>p12-info option.<a class="copiable-link" href="#p12_002dinfo-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p12_002dinfo"></a>
<p>This is the “print information on a pkcs #12 structure” option.
This option will dump the contents and print the metadata of the provided PKCS #12 structure.
</p><h4 class="subsubheading" id="p12_002dname-option_002e"><span>p12-name option.<a class="copiable-link" href="#p12_002dname-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p12_002dname"></a>
<p>This is the “the pkcs #12 friendly name to use” option.
This option takes a ArgumentType.STRING argument.
The name to be used for the primary certificate and private key in a PKCS #12 file.
</p><h4 class="subsubheading" id="to_002dp12-option_002e"><span>to-p12 option.<a class="copiable-link" href="#to_002dp12-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-to_002dp12"></a>
<p>This is the “generate a pkcs #12 structure” option.
It requires a certificate, a private key and possibly a CA certificate to be specified.
<a class="anchor" id="certtool-key_002doptions"></a></p><h4 class="subsubheading" id="key_002doptions-options"><span>key-options options<a class="copiable-link" href="#key_002doptions-options"> ¶</a></span></h4>
<p>Private key related options.
</p><h4 class="subsubheading" id="p8_002dinfo-option_002e"><span>p8-info option.<a class="copiable-link" href="#p8_002dinfo-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p8_002dinfo"></a>
<p>This is the “print information on a pkcs #8 structure” option.
This option will print information about encrypted PKCS #8 structures. That option does not require the decryption of the structure.
</p><h4 class="subsubheading" id="to_002drsa-option_002e"><span>to-rsa option.<a class="copiable-link" href="#to_002drsa-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-to_002drsa"></a>
<p>This is the “convert an rsa-pss key to raw rsa format” option.
It requires an RSA-PSS key as input and will output a raw RSA
key. This command is necessary for compatibility with applications that
cannot read RSA-PSS keys.
</p><h4 class="subsubheading" id="generate_002dprivkey-option-_0028_002dp_0029_002e"><span>generate-privkey option (-p).<a class="copiable-link" href="#generate_002dprivkey-option-_0028_002dp_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-generate_002dprivkey"></a>
<p>This is the “generate a private key” option.
When generating RSA-PSS or RSA-OAEP private keys, the –hash option will
restrict the allowed hash for the key; For RSA-PSS keys the –salt-size
option is also acceptable.
</p><h4 class="subsubheading" id="key_002dtype-option_002e"><span>key-type option.<a class="copiable-link" href="#key_002dtype-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-key_002dtype"></a>
<p>This is the “specify the key type to use on key generation” option.
This option takes a ArgumentType.STRING argument.
This option can be combined with –generate-privkey, to specify
the key type to be generated. Valid options are, ’rsa’, ’rsa-pss’, ’rsa-oaep’, ’dsa’, ’ecdsa’, ’ed25519, ’ed448’, ’x25519’, and ’x448’.’.
When combined with certificate generation it can be used to specify an
RSA-PSS certificate when an RSA key is given.
</p><h4 class="subsubheading" id="key_002dformat-option_002e"><span>key-format option.<a class="copiable-link" href="#key_002dformat-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-key_002dformat"></a>
<p>This is the “specify the key format to use on key generation” option.
This option takes a ArgumentType.STRING argument.
This option can be combined with –generate-privkey, to specify
the key format to be generated, when the key type is ML-DSA. Valid options are, ’seed’, ’expanded’, and ’both’.
</p><h4 class="subsubheading" id="curve-option_002e"><span>curve option.<a class="copiable-link" href="#curve-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-curve"></a>
<p>This is the “specify the curve used for ec key generation” option.
This option takes a ArgumentType.STRING argument.
Supported values are secp192r1, secp224r1, secp256r1, secp384r1 and secp521r1.
</p><h4 class="subsubheading" id="sec_002dparam-option_002e"><span>sec-param option.<a class="copiable-link" href="#sec_002dparam-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-sec_002dparam"></a>
<p>This is the “specify the security level [low, legacy, medium, high, ultra]” option.
This option takes a ArgumentType.STRING argument <samp class="file">Security parameter</samp>.
This is alternative to the bits option.
</p><h4 class="subsubheading" id="to_002dp8-option_002e"><span>to-p8 option.<a class="copiable-link" href="#to_002dp8-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-to_002dp8"></a>
<p>This is the “convert a given key to a pkcs #8 structure” option.
This needs to be combined with –load-privkey.
</p><h4 class="subsubheading" id="provable-option_002e"><span>provable option.<a class="copiable-link" href="#provable-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-provable"></a>
<p>This is the “generate a private key or parameters from a seed using a provable method” option.
This will use the FIPS PUB186-4 algorithms (i.e., Shawe-Taylor) for provable key generation.
When specified the private keys or parameters will be generated from a seed, and can be
later validated with –verify-provable-privkey to be correctly generated from the seed. You may
specify –seed or allow GnuTLS to generate one (recommended). This option can be combined with
–generate-privkey or –generate-dh-params.
</p>
<p>That option applies to RSA and DSA keys. On the DSA keys the PQG parameters
are generated using the seed, and on RSA the two primes.
</p><h4 class="subsubheading" id="verify_002dprovable_002dprivkey-option_002e"><span>verify-provable-privkey option.<a class="copiable-link" href="#verify_002dprovable_002dprivkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002dprovable_002dprivkey"></a>
<p>This is the “verify a private key generated from a seed using a provable method” option.
This will use the FIPS-186-4 algorithms for provable key generation. You may specify –seed or use the seed stored in the private key structure.
</p><h4 class="subsubheading" id="seed-option_002e"><span>seed option.<a class="copiable-link" href="#seed-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-seed"></a>
<p>This is the “when generating a private key use the given hex-encoded seed” option.
This option takes a ArgumentType.STRING argument.
The seed acts as a security parameter for the private key, and
thus a seed size which corresponds to the security level of the private key
should be provided (e.g., 256-bits seed).
<a class="anchor" id="certtool-crl_002doptions"></a></p><h4 class="subsubheading" id="crl_002doptions-options"><span>crl-options options<a class="copiable-link" href="#crl_002doptions-options"> ¶</a></span></h4>
<p>CRL related options.
</p><h4 class="subsubheading" id="generate_002dcrl-option_002e"><span>generate-crl option.<a class="copiable-link" href="#generate_002dcrl-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-generate_002dcrl"></a>
<p>This is the “generate a crl” option.
This option generates a Certificate Revocation List. When combined with –load-crl it would use the loaded CRL as base for the generated (i.e., all revoked certificates in the base will be copied to the new CRL).
To add new certificates to the CRL use –load-certificate.
</p><h4 class="subsubheading" id="verify_002dcrl-option_002e"><span>verify-crl option.<a class="copiable-link" href="#verify_002dcrl-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002dcrl"></a>
<p>This is the “verify a certificate revocation list using a trusted list” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must appear in combination with the following options:
load-ca-certificate.
</li></ul>
<p>The trusted certificate list must be loaded with –load-ca-certificate.
<a class="anchor" id="certtool-cert_002dverify_002doptions"></a></p><h4 class="subsubheading" id="cert_002dverify_002doptions-options"><span>cert-verify-options options<a class="copiable-link" href="#cert_002dverify_002doptions-options"> ¶</a></span></h4>
<p>Certificate verification related options.
</p><h4 class="subsubheading" id="verify_002dchain-option-_0028_002de_0029_002e"><span>verify-chain option (-e).<a class="copiable-link" href="#verify_002dchain-option-_0028_002de_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002dchain"></a>
<p>This is the “verify a pem encoded certificate chain” option.
Verifies the validity of a certificate chain. That is, an ordered set of
certificates where each one is the issuer of the previous, and the first is
the end-certificate to be validated. In a proper chain the last certificate
is a self signed one. It can be combined with –verify-purpose or –verify-hostname.
</p><h4 class="subsubheading" id="verify-option_002e"><span>verify option.<a class="copiable-link" href="#verify-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify"></a>
<p>This is the “verify a pem encoded certificate (chain) against a trusted set” option.
The trusted certificate list can be loaded with –load-ca-certificate. If no
certificate list is provided, then the system’s trusted certificate list is used. Note that
during verification multiple paths may be explored. On a successful verification
the successful path will be the last one. It can be combined with –verify-purpose or –verify-hostname.
</p><h4 class="subsubheading" id="verify_002dhostname-option_002e-1"><span>verify-hostname option.<a class="copiable-link" href="#verify_002dhostname-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002dhostname"></a>
<p>This is the “specify a hostname to be used for certificate chain verification” option.
This option takes a ArgumentType.STRING argument.
This is to be combined with one of the verify certificate options.
</p><h4 class="subsubheading" id="verify_002demail-option_002e"><span>verify-email option.<a class="copiable-link" href="#verify_002demail-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002demail"></a>
<p>This is the “specify a email to be used for certificate chain verification” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
verify-hostname.
</li></ul>
<p>This is to be combined with one of the verify certificate options.
</p><h4 class="subsubheading" id="verify_002dpurpose-option_002e"><span>verify-purpose option.<a class="copiable-link" href="#verify_002dpurpose-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002dpurpose"></a>
<p>This is the “specify a purpose oid to be used for certificate chain verification” option.
This option takes a ArgumentType.STRING argument.
This object identifier restricts the purpose of the certificates to be verified. Example purposes are 1.3.6.1.5.5.7.3.1 (TLS WWW), 1.3.6.1.5.5.7.3.4 (EMAIL) etc. Note that a CA certificate without a purpose set (extended key usage) is valid for any purpose.
</p><h4 class="subsubheading" id="verify_002dallow_002dbroken-option_002e"><span>verify-allow-broken option.<a class="copiable-link" href="#verify_002dallow_002dbroken-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002dallow_002dbroken"></a>
<p>This is the “allow broken algorithms, such as md5 for verification” option.
This can be combined with –p7-verify, –verify or –verify-chain.
</p><h4 class="subsubheading" id="verify_002dprofile-option_002e"><span>verify-profile option.<a class="copiable-link" href="#verify_002dprofile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-verify_002dprofile"></a>
<p>This is the “specify a security level profile to be used for verification” option.
This option takes a ArgumentType.STRING argument.
This option can be used to specify a certificate verification profile. Certificate
verification profiles correspond to the security level. This should be one of
’none’, ’very weak’, ’low’, ’legacy’, ’medium’, ’high’, ’ultra’,
’future’. Note that by default no profile is applied, unless one is set
as minimum in the gnutls configuration file.
<a class="anchor" id="certtool-pkcs7_002doptions"></a></p><h4 class="subsubheading" id="pkcs7_002doptions-options"><span>pkcs7-options options<a class="copiable-link" href="#pkcs7_002doptions-options"> ¶</a></span></h4>
<p>PKCS#7 structure options.
</p><h4 class="subsubheading" id="p7_002dgenerate-option_002e"><span>p7-generate option.<a class="copiable-link" href="#p7_002dgenerate-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p7_002dgenerate"></a>
<p>This is the “generate a pkcs #7 structure” option.
This option generates a PKCS #7 certificate container structure. To add certificates in the structure use –load-certificate and –load-crl.
</p><h4 class="subsubheading" id="p7_002dsign-option_002e"><span>p7-sign option.<a class="copiable-link" href="#p7_002dsign-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p7_002dsign"></a>
<p>This is the “signs using a pkcs #7 structure” option.
This option generates a PKCS #7 structure containing a signature for the provided data from infile. The data are stored within the structure. The signer certificate has to be specified using –load-certificate and –load-privkey. The input to –load-certificate can be a list of certificates. In case of a list, the first certificate is used for signing and the other certificates are included in the structure.
</p><h4 class="subsubheading" id="p7_002ddetached_002dsign-option_002e"><span>p7-detached-sign option.<a class="copiable-link" href="#p7_002ddetached_002dsign-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p7_002ddetached_002dsign"></a>
<p>This is the “signs using a detached pkcs #7 structure” option.
This option generates a PKCS #7 structure containing a signature for the provided data from infile. The signer certificate has to be specified using –load-certificate and –load-privkey. The input to –load-certificate can be a list of certificates. In case of a list, the first certificate is used for signing and the other certificates are included in the structure.
</p><h4 class="subsubheading" id="p7_002dinclude_002dcert-option_002e"><span>p7-include-cert option.<a class="copiable-link" href="#p7_002dinclude_002dcert-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p7_002dinclude_002dcert"></a>
<p>This is the “the signer’s certificate will be included in the cert list” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>can be disabled with –no-p7-include-cert.
</li><li>It is enabled by default.
</li></ul>
<p>This options works with –p7-sign or –p7-detached-sign and will include or exclude the signer’s certificate into the generated signature.
</p><h4 class="subsubheading" id="p7_002dtime-option_002e"><span>p7-time option.<a class="copiable-link" href="#p7_002dtime-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p7_002dtime"></a>
<p>This is the “will include a timestamp in the pkcs #7 structure” option.
This option will include a timestamp in the generated signature
</p><h4 class="subsubheading" id="p7_002dshow_002ddata-option_002e"><span>p7-show-data option.<a class="copiable-link" href="#p7_002dshow_002ddata-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p7_002dshow_002ddata"></a>
<p>This is the “will show the embedded data in the pkcs #7 structure” option.
This option can be combined with –p7-verify or –p7-info and will display the embedded signed data in the PKCS #7 structure.
</p><h4 class="subsubheading" id="p7_002dverify-option_002e"><span>p7-verify option.<a class="copiable-link" href="#p7_002dverify-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-p7_002dverify"></a>
<p>This is the “verify the provided pkcs #7 structure” option.
This option verifies the signed PKCS #7 structure. The certificate list to use for verification can be specified with –load-ca-certificate. When no certificate list is provided, then the system’s certificate list is used. Alternatively a direct signer can be provided using –load-certificate. A key purpose can be enforced with the –verify-purpose option, and the –load-data option will utilize detached data.
<a class="anchor" id="certtool-other_002doptions"></a></p><h4 class="subsubheading" id="other_002doptions-options"><span>other-options options<a class="copiable-link" href="#other_002doptions-options"> ¶</a></span></h4>
<p>Other options.
</p><h4 class="subsubheading" id="generate_002ddh_002dparams-option_002e"><span>generate-dh-params option.<a class="copiable-link" href="#generate_002ddh_002dparams-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-generate_002ddh_002dparams"></a>
<p>This is the “generate pkcs #3 encoded diffie-hellman parameters” option.
The will generate random parameters to be used with
Diffie-Hellman key exchange. The output parameters will be in PKCS #3
format. Note that it is recommended to use the –get-dh-params option
instead.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="get_002ddh_002dparams-option_002e"><span>get-dh-params option.<a class="copiable-link" href="#get_002ddh_002dparams-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-get_002ddh_002dparams"></a>
<p>This is the “list the included pkcs #3 encoded diffie-hellman parameters” option.
Returns stored DH parameters in GnuTLS. Those parameters returned
are defined in RFC7919, and can be considered standard parameters for a TLS
key exchange. This option is provided for old applications which require
DH parameters to be specified; modern GnuTLS applications should not require
them.
</p><h4 class="subsubheading" id="load_002dprivkey-option_002e"><span>load-privkey option.<a class="copiable-link" href="#load_002dprivkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002dprivkey"></a>
<p>This is the “loads a private key file” option.
This option takes a ArgumentType.STRING argument.
This can be either a file or a PKCS #11 URL
</p><h4 class="subsubheading" id="load_002dpubkey-option_002e"><span>load-pubkey option.<a class="copiable-link" href="#load_002dpubkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002dpubkey"></a>
<p>This is the “loads a public key file” option.
This option takes a ArgumentType.STRING argument.
This can be either a file or a PKCS #11 URL
</p><h4 class="subsubheading" id="load_002drequest-option_002e"><span>load-request option.<a class="copiable-link" href="#load_002drequest-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002drequest"></a>
<p>This is the “loads a certificate request file” option.
This option takes a ArgumentType.STRING argument.
This option can be used with a file
</p><h4 class="subsubheading" id="load_002dcertificate-option_002e"><span>load-certificate option.<a class="copiable-link" href="#load_002dcertificate-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002dcertificate"></a>
<p>This is the “loads a certificate file” option.
This option takes a ArgumentType.STRING argument.
This option can be used with a file
</p><h4 class="subsubheading" id="load_002dca_002dprivkey-option_002e"><span>load-ca-privkey option.<a class="copiable-link" href="#load_002dca_002dprivkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002dca_002dprivkey"></a>
<p>This is the “loads the certificate authority’s private key file” option.
This option takes a ArgumentType.STRING argument.
This can be either a file or a PKCS #11 URL
</p><h4 class="subsubheading" id="load_002dca_002dcertificate-option_002e"><span>load-ca-certificate option.<a class="copiable-link" href="#load_002dca_002dcertificate-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002dca_002dcertificate"></a>
<p>This is the “loads the certificate authority’s certificate file” option.
This option takes a ArgumentType.STRING argument.
This can be either a file or a PKCS #11 URL
</p><h4 class="subsubheading" id="load_002dcrl-option_002e"><span>load-crl option.<a class="copiable-link" href="#load_002dcrl-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002dcrl"></a>
<p>This is the “loads the provided crl” option.
This option takes a ArgumentType.STRING argument.
This option can be used with a file
</p><h4 class="subsubheading" id="load_002ddata-option_002e"><span>load-data option.<a class="copiable-link" href="#load_002ddata-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-load_002ddata"></a>
<p>This is the “loads auxiliary data” option.
This option takes a ArgumentType.STRING argument.
This option can be used with a file
</p><h4 class="subsubheading" id="password-option_002e"><span>password option.<a class="copiable-link" href="#password-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-password"></a>
<p>This is the “password to use” option.
This option takes a ArgumentType.STRING argument.
You can use this option to specify the password in the command line instead of reading it from the tty. Note, that the command line arguments are available for view in others in the system. Specifying password as ” is the same as specifying no password.
</p><h4 class="subsubheading" id="null_002dpassword-option_002e"><span>null-password option.<a class="copiable-link" href="#null_002dpassword-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-null_002dpassword"></a>
<p>This is the “enforce a null password” option.
This option enforces a NULL password. This is different than the empty or no password in schemas like PKCS #8.
</p><h4 class="subsubheading" id="empty_002dpassword-option_002e"><span>empty-password option.<a class="copiable-link" href="#empty_002dpassword-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-empty_002dpassword"></a>
<p>This is the “enforce an empty password” option.
This option enforces an empty password. This is different than the NULL or no password in schemas like PKCS #8.
</p><h4 class="subsubheading" id="cprint-option_002e"><span>cprint option.<a class="copiable-link" href="#cprint-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-cprint"></a>
<p>This is the “in certain operations it prints the information in c-friendly format” option.
In certain operations it prints the information in C-friendly format, suitable for including into C programs.
</p><h4 class="subsubheading" id="rsa-option_002e"><span>rsa option.<a class="copiable-link" href="#rsa-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-rsa"></a>
<p>This is the “generate rsa key” option.
When combined with –generate-privkey generates an RSA private key.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="dsa-option_002e"><span>dsa option.<a class="copiable-link" href="#dsa-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-dsa"></a>
<p>This is the “generate dsa key” option.
When combined with –generate-privkey generates a DSA private key.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="ecc-option_002e"><span>ecc option.<a class="copiable-link" href="#ecc-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-ecc"></a>
<p>This is the “generate ecc (ecdsa) key” option.
When combined with –generate-privkey generates an elliptic curve private key to be used with ECDSA.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="ecdsa-option_002e"><span>ecdsa option.<a class="copiable-link" href="#ecdsa-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-ecdsa"></a>
<p>This is an alias for the <code class="code">ecc</code> option,
see <a class="pxref" href="#certtool-ecc">the ecc option documentation</a>.
</p>
<h4 class="subsubheading" id="hash-option_002e"><span>hash option.<a class="copiable-link" href="#hash-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-hash"></a>
<p>This is the “hash algorithm to use for signing” option.
This option takes a ArgumentType.STRING argument.
Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512, SHA3-224, SHA3-256, SHA3-384, SHA3-512.
</p><h4 class="subsubheading" id="salt_002dsize-option_002e"><span>salt-size option.<a class="copiable-link" href="#salt_002dsize-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-salt_002dsize"></a>
<p>This is the “specify the rsa-pss key default salt size” option.
This option takes a ArgumentType.NUMBER argument.
Typical keys shouldn’t set or restrict this option.
</p><h4 class="subsubheading" id="label-option_002e"><span>label option.<a class="copiable-link" href="#label-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-label"></a>
<p>This is the “specify the rsa-oaep label, encoded in hexadecimal” option.
This option takes a ArgumentType.STRING argument.
Typical keys shouldn’t set or restrict this option.
</p><h4 class="subsubheading" id="inder-option_002e"><span>inder option.<a class="copiable-link" href="#inder-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-inder"></a>
<p>This is the “use der format for input certificates, private keys, and dh parameters ” option.
The input files will be assumed to be in DER or RAW format.
Unlike options that in PEM input would allow multiple input data (e.g. multiple
certificates), when reading in DER format a single data structure is read.
</p><h4 class="subsubheading" id="inraw-option_002e"><span>inraw option.<a class="copiable-link" href="#inraw-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-inraw"></a>
<p>This is an alias for the <code class="code">inder</code> option,
see <a class="pxref" href="#certtool-inder">the inder option documentation</a>.
</p>
<h4 class="subsubheading" id="outder-option_002e"><span>outder option.<a class="copiable-link" href="#outder-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-outder"></a>
<p>This is the “use der format for output certificates, private keys, and dh parameters” option.
The output will be in DER or RAW format.
</p><h4 class="subsubheading" id="outraw-option_002e"><span>outraw option.<a class="copiable-link" href="#outraw-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-outraw"></a>
<p>This is an alias for the <code class="code">outder</code> option,
see <a class="pxref" href="#certtool-outder">the outder option documentation</a>.
</p>
<h4 class="subsubheading" id="ask_002dpass-option_002e"><span>ask-pass option.<a class="copiable-link" href="#ask_002dpass-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-ask_002dpass"></a>
<p>This is the “enable interaction for entering password when in batch mode” option.
This option will enable interaction to enter password when in batch mode. That is useful when the template option has been specified.
</p><h4 class="subsubheading" id="pkcs_002dcipher-option_002e"><span>pkcs-cipher option.<a class="copiable-link" href="#pkcs_002dcipher-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-pkcs_002dcipher"></a>
<p>This is the “cipher to use for pkcs #8 and #12 operations” option.
This option takes a ArgumentType.STRING argument <samp class="file">Cipher</samp>.
Cipher may be one of 3des, 3des-pkcs12, aes-128, aes-192, aes-256, rc2-40, arcfour.
</p><h4 class="subsubheading" id="provider-option_002e-2"><span>provider option.<a class="copiable-link" href="#provider-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="certtool-provider"></a>
<p>This is the “specify the pkcs #11 provider library” option.
This option takes a ArgumentType.STRING argument.
This will override the default options in /etc/gnutls/pkcs11.conf
</p><h4 class="subsubheading" id="text-option_002e"><span>text option.<a class="copiable-link" href="#text-option_002e"> ¶</a></span></h4>
<a class="anchor" id="certtool-text"></a>
<p>This is the “output textual information before pem-encoded certificates, private keys, etc” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>can be disabled with –no-text.
</li><li>It is enabled by default.
</li></ul>
<p>Output textual information before PEM-encoded data
</p><h4 class="subsubheading" id="version-option-_0028_002dv_0029_002e-3"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-3"> ¶</a></span></h4>
<a class="anchor" id="certtool-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subsubheading" id="help-option-_0028_002dh_0029_002e-3"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-3"> ¶</a></span></h4>
<a class="anchor" id="certtool-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subsubheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-3"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-3"> ¶</a></span></h4>
<a class="anchor" id="certtool-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="certtool-exit-status"></a></p><h4 class="subsubheading" id="certtool-exit-status-1"><span>certtool exit status<a class="copiable-link" href="#certtool-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="certtool-See-Also"></a><h4 class="subsubheading" id="certtool-See-Also-1"><span>certtool See Also<a class="copiable-link" href="#certtool-See-Also-1"> ¶</a></span></h4>
<p>p11tool (1), psktool (1), srptool (1)
<a class="anchor" id="certtool-Examples"></a></p><h4 class="subsubheading" id="certtool-Examples-1"><span>certtool Examples<a class="copiable-link" href="#certtool-Examples-1"> ¶</a></span></h4>
<h4 class="subsubheading" id="Generating-private-keys"><span>Generating private keys<a class="copiable-link" href="#Generating-private-keys"> ¶</a></span></h4>
<p>To create an RSA private key, run:
</p><div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey --outfile key.pem --rsa
</pre></div>
<p>To create a DSA or elliptic curves (ECDSA) private key use the
above command combined with ’dsa’ or ’ecc’ options.
</p>
<h4 class="subsubheading" id="Generating-certificate-requests"><span>Generating certificate requests<a class="copiable-link" href="#Generating-certificate-requests"> ¶</a></span></h4>
<p>To create a certificate request (needed when the certificate is issued by
another party), run:
</p><div class="example">
<pre class="example-preformatted">certtool --generate-request --load-privkey key.pem \
--outfile request.pem
</pre></div>
<p>If the private key is stored in a smart card you can generate
a request by specifying the private key object URL.
</p><div class="example">
<pre class="example-preformatted">$ ./certtool --generate-request --load-privkey "pkcs11:..." \
--load-pubkey "pkcs11:..." --outfile request.pem
</pre></div>
<h4 class="subsubheading" id="Generating-a-self_002dsigned-certificate"><span>Generating a self-signed certificate<a class="copiable-link" href="#Generating-a-self_002dsigned-certificate"> ¶</a></span></h4>
<p>To create a self signed certificate, use the command:
</p><div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey --outfile ca-key.pem
$ certtool --generate-self-signed --load-privkey ca-key.pem \
--outfile ca-cert.pem
</pre></div>
<p>Note that a self-signed certificate usually belongs to a certificate
authority, that signs other certificates.
</p>
<h4 class="subsubheading" id="Generating-a-certificate"><span>Generating a certificate<a class="copiable-link" href="#Generating-a-certificate"> ¶</a></span></h4>
<p>To generate a certificate using the previous request, use the command:
</p><div class="example">
<pre class="example-preformatted">$ certtool --generate-certificate --load-request request.pem \
--outfile cert.pem --load-ca-certificate ca-cert.pem \
--load-ca-privkey ca-key.pem
</pre></div>
<p>To generate a certificate using the private key only, use the command:
</p><div class="example">
<pre class="example-preformatted">$ certtool --generate-certificate --load-privkey key.pem \
--outfile cert.pem --load-ca-certificate ca-cert.pem \
--load-ca-privkey ca-key.pem
</pre></div>
<h4 class="subsubheading" id="Certificate-information"><span>Certificate information<a class="copiable-link" href="#Certificate-information"> ¶</a></span></h4>
<p>To view the certificate information, use:
</p><div class="example">
<pre class="example-preformatted">$ certtool --certificate-info --infile cert.pem
</pre></div>
<h4 class="subsubheading" id="Changing-the-certificate-format"><span>Changing the certificate format<a class="copiable-link" href="#Changing-the-certificate-format"> ¶</a></span></h4>
<p>To convert the certificate from PEM to DER format, use:
</p><div class="example">
<pre class="example-preformatted">$ certtool --certificate-info --infile cert.pem --outder --outfile cert.der
</pre></div>
<h4 class="subsubheading" id="PKCS-_002312-structure-generation"><span>PKCS #12 structure generation<a class="copiable-link" href="#PKCS-_002312-structure-generation"> ¶</a></span></h4>
<p>To generate a PKCS #12 structure using the previous key and certificate,
use the command:
</p><div class="example">
<pre class="example-preformatted">$ certtool --load-certificate cert.pem --load-privkey key.pem \
--to-p12 --outder --outfile key.p12
</pre></div>
<p>Some tools (reportedly web browsers) have problems with that file
because it does not contain the CA certificate for the certificate.
To work around that problem in the tool, you can use the
–load-ca-certificate parameter as follows:
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --load-ca-certificate ca.pem \
--load-certificate cert.pem --load-privkey key.pem \
--to-p12 --outder --outfile key.p12
</pre></div>
<h4 class="subsubheading" id="Obtaining-Diffie_002dHellman-parameters"><span>Obtaining Diffie-Hellman parameters<a class="copiable-link" href="#Obtaining-Diffie_002dHellman-parameters"> ¶</a></span></h4>
<p>To obtain the RFC7919 parameters for Diffie-Hellman key exchange, use the command:
</p><div class="example">
<pre class="example-preformatted">$ certtool --get-dh-params --outfile dh.pem --sec-param medium
</pre></div>
<h4 class="subsubheading" id="Verifying-a-certificate"><span>Verifying a certificate<a class="copiable-link" href="#Verifying-a-certificate"> ¶</a></span></h4>
<p>To verify a certificate in a file against the system’s CA trust store
use the following command:
</p><div class="example">
<pre class="example-preformatted">$ certtool --verify --infile cert.pem
</pre></div>
<p>It is also possible to simulate hostname verification with the following
options:
</p><div class="example">
<pre class="example-preformatted">$ certtool --verify --verify-hostname www.example.com --infile cert.pem
</pre></div>
<h4 class="subsubheading" id="Proxy-certificate-generation"><span>Proxy certificate generation<a class="copiable-link" href="#Proxy-certificate-generation"> ¶</a></span></h4>
<p>Proxy certificate can be used to delegate your credential to a
temporary, typically short-lived, certificate. To create one from the
previously created certificate, first create a temporary key and then
generate a proxy certificate for it, using the commands:
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey > proxy-key.pem
$ certtool --generate-proxy --load-ca-privkey key.pem \
--load-privkey proxy-key.pem --load-certificate cert.pem \
--outfile proxy-cert.pem
</pre></div>
<h4 class="subsubheading" id="Certificate-revocation-list-generation"><span>Certificate revocation list generation<a class="copiable-link" href="#Certificate-revocation-list-generation"> ¶</a></span></h4>
<p>To create an empty Certificate Revocation List (CRL) do:
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-crl --load-ca-privkey x509-ca-key.pem \
--load-ca-certificate x509-ca.pem
</pre></div>
<p>To create a CRL that contains some revoked certificates, place the
certificates in a file and use <code class="code">--load-certificate</code> as follows:
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-crl --load-ca-privkey x509-ca-key.pem \
--load-ca-certificate x509-ca.pem --load-certificate revoked-certs.pem
</pre></div>
<p>To verify a Certificate Revocation List (CRL) do:
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --verify-crl --load-ca-certificate x509-ca.pem < crl.pem
</pre></div>
<a class="anchor" id="certtool-Files"></a><h4 class="subsubheading" id="certtool-Files-1"><span>certtool Files<a class="copiable-link" href="#certtool-Files-1"> ¶</a></span></h4>
<h4 class="subsubheading" id="Certtool_0027s-template-file-format"><span>Certtool’s template file format<a class="copiable-link" href="#Certtool_0027s-template-file-format"> ¶</a></span></h4>
<p>A template file can be used to avoid the interactive questions of
certtool. Initially create a file named ’cert.cfg’ that contains the information
about the certificate. The template can be used as below:
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-certificate --load-privkey key.pem \
--template cert.cfg --outfile cert.pem \
--load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
</pre></div>
<p>An example certtool template file that can be used to generate a certificate
request or a self signed certificate follows.
</p>
<div class="example">
<pre class="example-preformatted"># X.509 Certificate options
#
# DN options
# The organization of the subject.
organization = "Koko inc."
# The organizational unit of the subject.
unit = "sleeping dept."
# The locality of the subject.
# locality =
# The state of the certificate owner.
state = "Attiki"
# The country of the subject. Two letter code.
country = GR
# The common name of the certificate owner.
cn = "Cindy Lauper"
# A user id of the certificate owner.
#uid = "clauper"
# Set domain components
#dc = "name"
#dc = "domain"
# If the supported DN OIDs are not adequate you can set
# any OID here.
# For example set the X.520 Title and the X.520 Pseudonym
# by using OID and string pairs.
#dn_oid = "2.5.4.12 Dr."
#dn_oid = "2.5.4.65 jackal"
# This is deprecated and should not be used in new
# certificates.
# pkcs9_email = "none@none.org"
# An alternative way to set the certificate's distinguished name directly
# is with the "dn" option. The attribute names allowed are:
# C (country), street, O (organization), OU (unit), title, CN (common name),
# L (locality), ST (state), placeOfBirth, gender, countryOfCitizenship,
# countryOfResidence, serialNumber, telephoneNumber, surName, initials,
# generationQualifier, givenName, pseudonym, dnQualifier, postalCode, name,
# businessCategory, DC, UID, jurisdictionOfIncorporationLocalityName,
# jurisdictionOfIncorporationStateOrProvinceName,
# jurisdictionOfIncorporationCountryName, XmppAddr, and numeric OIDs.
#dn = "cn = Nikos,st = New\, Something,C=GR,surName=Mavrogiannopoulos,2.5.4.9=Arkadias"
# The serial number of the certificate
# The value is in decimal (i.e. 1963) or hex (i.e. 0x07ab).
# Comment the field for a random serial number.
serial = 007
# In how many days, counting from today, this certificate will expire.
# Use -1 if there is no expiration date.
expiration_days = 700
# Alternatively you may set concrete dates and time. The GNU date string
# formats are accepted. See:
# https://www.gnu.org/software/tar/manual/html_node/Date-input-formats.html
#activation_date = "2004-02-29 16:21:42"
#expiration_date = "2025-02-29 16:24:41"
# X.509 v3 extensions
# A dnsname in case of a WWW server.
#dns_name = "www.none.org"
#dns_name = "www.morethanone.org"
# An othername defined by an OID and a hex encoded string
#other_name = "1.3.6.1.5.2.2 302ca00d1b0b56414e5245494e2e4f5247a11b3019a006020400000002a10f300d1b047269636b1b0561646d696e"
#other_name_utf8 = "1.2.4.5.6 A UTF8 string"
#other_name_octet = "1.2.4.5.6 A string that will be encoded as ASN.1 octet string"
# Allows writing an XmppAddr Identifier
#xmpp_name = juliet@im.example.com
# Names used in PKINIT
#krb5_principal = user@REALM.COM
#krb5_principal = HTTP/user@REALM.COM
# A subject alternative name URI
#uri = "https://www.example.com"
# An IP address in case of a server.
#ip_address = "192.168.1.1"
# An email in case of a person
email = "none@none.org"
# TLS feature (rfc7633) extension. That can is used to indicate mandatory TLS
# extension features to be provided by the server. In practice this is used
# to require the Status Request (extid: 5) extension from the server. That is,
# to require the server holding this certificate to provide a stapled OCSP response.
# You can have multiple lines for multiple TLS features.
# To ask for OCSP status request use:
#tls_feature = 5
# Challenge password used in certificate requests
challenge_password = 123456
# Password when encrypting a private key
#password = secret
# An URL that has CRLs (certificate revocation lists)
# available. Needed in CA certificates.
#crl_dist_points = "https://www.getcrl.crl/getcrl/"
# Whether this is a CA certificate or not
#ca
# Subject Unique ID (in hex)
#subject_unique_id = 00153224
# Issuer Unique ID (in hex)
#issuer_unique_id = 00153225
#### Key usage
# The following key usage flags are used by CAs and end certificates
# Whether this certificate will be used to sign data (needed
# in TLS DHE ciphersuites). This is the digitalSignature flag
# in RFC5280 terminology.
signing_key
# Whether this certificate will be used to encrypt data (needed
# in TLS RSA ciphersuites). Note that it is preferred to use different
# keys for encryption and signing. This is the keyEncipherment flag
# in RFC5280 terminology.
encryption_key
# Whether this key will be used to sign other certificates. The
# keyCertSign flag in RFC5280 terminology.
#cert_signing_key
# Whether this key will be used to sign CRLs. The
# cRLSign flag in RFC5280 terminology.
#crl_signing_key
# The keyAgreement flag of RFC5280. Its purpose is loosely
# defined. Not use it unless required by a protocol.
#key_agreement
# The dataEncipherment flag of RFC5280. Its purpose is loosely
# defined. Not use it unless required by a protocol.
#data_encipherment
# The nonRepudiation flag of RFC5280. Its purpose is loosely
# defined. Not use it unless required by a protocol.
#non_repudiation
#### Extended key usage (key purposes)
# The following extensions are used in an end certificate
# to clarify its purpose. Some CAs also use it to indicate
# the types of certificates they are purposed to sign.
# Whether this certificate will be used for a TLS client;
# this sets the id-kp-clientAuth (1.3.6.1.5.5.7.3.2) of
# extended key usage.
#tls_www_client
# Whether this certificate will be used for a TLS server;
# this sets the id-kp-serverAuth (1.3.6.1.5.5.7.3.1) of
# extended key usage.
#tls_www_server
# Whether this key will be used to sign code. This sets the
# id-kp-codeSigning (1.3.6.1.5.5.7.3.3) of extended key usage
# extension.
#code_signing_key
# Whether this key will be used to sign OCSP data. This sets the
# id-kp-OCSPSigning (1.3.6.1.5.5.7.3.9) of extended key usage extension.
#ocsp_signing_key
# Whether this key will be used for time stamping. This sets the
# id-kp-timeStamping (1.3.6.1.5.5.7.3.8) of extended key usage extension.
#time_stamping_key
# Whether this key will be used for email protection. This sets the
# id-kp-emailProtection (1.3.6.1.5.5.7.3.4) of extended key usage extension.
#email_protection_key
# Whether this key will be used for IPsec IKE operations (1.3.6.1.5.5.7.3.17).
#ipsec_ike_key
## adding custom key purpose OIDs
# for microsoft smart card logon
# key_purpose_oid = 1.3.6.1.4.1.311.20.2.2
# for email protection
# key_purpose_oid = 1.3.6.1.5.5.7.3.4
# for any purpose (must not be used in intermediate CA certificates)
# key_purpose_oid = 2.5.29.37.0
### end of key purpose OIDs
### Adding arbitrary extensions
# This requires to provide the extension OIDs, as well as the extension data in
# hex format. The following two options are available since GnuTLS 3.5.3.
#add_extension = "1.2.3.4 0x0AAB01ACFE"
# As above but encode the data as an octet string
#add_extension = "1.2.3.4 octet_string(0x0AAB01ACFE)"
# For portability critical extensions shouldn't be set to certificates.
#add_critical_extension = "5.6.7.8 0x1AAB01ACFE"
# When generating a certificate from a certificate
# request, then honor the extensions stored in the request
# and store them in the real certificate.
#honor_crq_extensions
# Alternatively only specific extensions can be copied.
#honor_crq_ext = 2.5.29.17
#honor_crq_ext = 2.5.29.15
# Path length constraint. Sets the maximum number of
# certificates that can be used to certify this certificate.
# (i.e. the certificate chain length)
#path_len = -1
#path_len = 2
# OCSP URI
# ocsp_uri = https://my.ocsp.server/ocsp
# CA issuers URI
# ca_issuers_uri = https://my.ca.issuer
# Certificate policies
#policy1 = 1.3.6.1.4.1.5484.1.10.99.1.0
#policy1_txt = "This is a long policy to summarize"
#policy1_url = https://www.example.com/a-policy-to-read
#policy2 = 1.3.6.1.4.1.5484.1.10.99.1.1
#policy2_txt = "This is a short policy"
#policy2_url = https://www.example.com/another-policy-to-read
# The number of additional certificates that may appear in a
# path before the anyPolicy is no longer acceptable.
#inhibit_anypolicy_skip_certs 1
# Name constraints
# DNS
#nc_permit_dns = example.com
#nc_exclude_dns = test.example.com
# EMAIL
#nc_permit_email = "nmav@ex.net"
# Exclude subdomains of example.com
#nc_exclude_email = .example.com
# Exclude all e-mail addresses of example.com
#nc_exclude_email = example.com
# IP
#nc_permit_ip = 192.168.0.0/16
#nc_exclude_ip = 192.168.5.0/24
#nc_permit_ip = fc0a:eef2:e7e7:a56e::/64
# Options for proxy certificates
#proxy_policy_language = 1.3.6.1.5.5.7.21.1
# Options for generating a CRL
# The number of days the next CRL update will be due.
# next CRL update will be in 43 days
#crl_next_update = 43
# this is the 5th CRL by this CA
# The value is in decimal (i.e. 1963) or hex (i.e. 0x07ab).
# Comment the field for a time-based number.
# Time-based CRL numbers generated in GnuTLS 3.6.3 and later
# are significantly larger than those generated in previous
# versions. Since CRL numbers need to be monotonic, you need
# to specify the CRL number here manually if you intend to
# downgrade to an earlier version than 3.6.3 after publishing
# the CRL as it is not possible to specify CRL numbers greater
# than 2**63-2 using hex notation in those versions.
#crl_number = 5
# Specify the update dates more precisely.
#crl_this_update_date = "2004-02-29 16:21:42"
#crl_next_update_date = "2025-02-29 16:24:41"
# The date that the certificates will be made seen as
# being revoked.
#crl_revocation_date = "2025-02-29 16:24:41"
</pre></div>
<hr>
</div>
<div class="subsection-level-extent" id="ocsptool-Invocation">
<div class="nav-panel">
<p>
Next: <a href="#danetool-Invocation" accesskey="n" rel="next">Invoking danetool</a>, Previous: <a href="#certtool-Invocation" accesskey="p" rel="prev">Invoking certtool</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Invoking-ocsptool"><span>4.2.7 Invoking ocsptool<a class="copiable-link" href="#Invoking-ocsptool"> ¶</a></span></h4>
<a class="index-entry-id" id="index-ocsptool"></a>
<h4 class="subheading" id="On-verification"><span>On verification<a class="copiable-link" href="#On-verification"> ¶</a></span></h4>
<p>Responses are typically signed/issued by designated certificates or
certificate authorities and thus this tool requires on verification
the certificate of the issuer or the full certificate chain in order to
determine the appropriate signing authority. The specified certificate
of the issuer is assumed trusted.
</p>
<a class="anchor" id="ocsptool-usage"></a><h4 class="subsubheading" id="ocsptool-help_002fusage-_0028_002d_003f_0029"><span>ocsptool help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#ocsptool-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-ocsptool-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">ocsptool - GnuTLS OCSP tool
Usage: ocsptool [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
-V, --verbose More verbose output
--infile=file Input file
- file must pre-exist
--outfile=str Output file
--ask[=str] Ask an OCSP/HTTP server on a certificate validity
-e, --verify-response Verify response
-i, --request-info Print information on a OCSP request
-j, --response-info Print information on a OCSP response
-q, --generate-request Generates an OCSP request
--nonce Use (or not) a nonce to OCSP request
--load-chain=file Reads a set of certificates forming a chain from file
- file must pre-exist
--load-issuer=file Reads issuer's certificate from file
- file must pre-exist
--load-cert=file Reads the certificate to check from file
- file must pre-exist
--load-trust=file Read OCSP trust anchors from file
- prohibits the option 'load-signer'
- file must pre-exist
--load-signer=file Reads the OCSP response signer from file
- prohibits the option 'load-trust'
- file must pre-exist
--inder Use DER format for input certificates and private keys
--outder Use DER format for output of responses (this is the default)
--outpem Use PEM format for output of responses
-Q, --load-request=file Reads the DER encoded OCSP request from file
- file must pre-exist
-S, --load-response=file Reads the DER encoded OCSP response from file
- file must pre-exist
--ignore-errors Ignore any verification errors
--verify-allow-broken Allow broken algorithms, such as MD5 for verification
--attime=str Perform validation at the timestamp instead of the system time
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
ocsptool is a program that can parse and print information about
OCSP requests/responses, generate requests and verify responses. Unlike
other GnuTLS applications it outputs DER encoded structures by default
unless the '--outpem' option is specified.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subsubheading" id="debug-option-_0028_002dd_0029_002e-4"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-4"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subsubheading" id="ask-option_002e"><span>ask option.<a class="copiable-link" href="#ask-option_002e"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-ask"></a>
<p>This is the “ask an ocsp/http server on a certificate validity” option.
This option takes a ArgumentType.STRING argument <samp class="file">server name|url</samp>.
Connects to the specified HTTP OCSP server and queries on the validity of the loaded certificate.
Its argument can be a URL or a plain server name. It can be combined with –load-chain, where it checks
all certificates in the provided chain, or with –load-cert and
–load-issuer options. The latter checks the provided certificate
against its specified issuer certificate.
</p><h4 class="subsubheading" id="verify_002dresponse-option-_0028_002de_0029_002e"><span>verify-response option (-e).<a class="copiable-link" href="#verify_002dresponse-option-_0028_002de_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-verify_002dresponse"></a>
<p>This is the “verify response” option.
Verifies the provided OCSP response against the system trust
anchors (unless –load-trust is provided). It requires the –load-signer
or –load-chain options to obtain the signer of the OCSP response.
</p><h4 class="subsubheading" id="request_002dinfo-option-_0028_002di_0029_002e"><span>request-info option (-i).<a class="copiable-link" href="#request_002dinfo-option-_0028_002di_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-request_002dinfo"></a>
<p>This is the “print information on a ocsp request” option.
Display detailed information on the provided OCSP request.
</p><h4 class="subsubheading" id="response_002dinfo-option-_0028_002dj_0029_002e"><span>response-info option (-j).<a class="copiable-link" href="#response_002dinfo-option-_0028_002dj_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-response_002dinfo"></a>
<p>This is the “print information on a ocsp response” option.
Display detailed information on the provided OCSP response.
</p><h4 class="subsubheading" id="load_002dtrust-option_002e"><span>load-trust option.<a class="copiable-link" href="#load_002dtrust-option_002e"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-load_002dtrust"></a>
<p>This is the “read ocsp trust anchors from file” option.
This option takes a ArgumentType.FILE argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
load-signer.
</li></ul>
<p>When verifying an OCSP response read the trust anchors from the
provided file. When this is not provided, the system’s trust anchors will be
used.
</p><h4 class="subsubheading" id="outder-option_002e-1"><span>outder option.<a class="copiable-link" href="#outder-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-outder"></a>
<p>This is the “use der format for output of responses (this is the default)” option.
The output will be in DER encoded format. Unlike other GnuTLS tools, this is the default for this tool
</p><h4 class="subsubheading" id="outpem-option_002e"><span>outpem option.<a class="copiable-link" href="#outpem-option_002e"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-outpem"></a>
<p>This is the “use pem format for output of responses” option.
The output will be in PEM format.
</p><h4 class="subsubheading" id="verify_002dallow_002dbroken-option_002e-1"><span>verify-allow-broken option.<a class="copiable-link" href="#verify_002dallow_002dbroken-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-verify_002dallow_002dbroken"></a>
<p>This is the “allow broken algorithms, such as md5 for verification” option.
This can be combined with –verify-response.
</p><h4 class="subsubheading" id="attime-option_002e-4"><span>attime option.<a class="copiable-link" href="#attime-option_002e-4"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-attime"></a>
<p>This is the “perform validation at the timestamp instead of the system time” option.
This option takes a ArgumentType.STRING argument <samp class="file">timestamp</samp>.
timestamp is an instance in time encoded as Unix time or in a human
readable timestring such as "29 Feb 2004", "2004-02-29".
Full documentation available at
<https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html>
or locally via info ’(coreutils) date invocation’.
</p><h4 class="subsubheading" id="version-option-_0028_002dv_0029_002e-4"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-4"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subsubheading" id="help-option-_0028_002dh_0029_002e-4"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-4"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subsubheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-4"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-4"> ¶</a></span></h4>
<a class="anchor" id="ocsptool-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="ocsptool-exit-status"></a></p><h4 class="subsubheading" id="ocsptool-exit-status-1"><span>ocsptool exit status<a class="copiable-link" href="#ocsptool-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="ocsptool-See-Also"></a><h4 class="subsubheading" id="ocsptool-See-Also-1"><span>ocsptool See Also<a class="copiable-link" href="#ocsptool-See-Also-1"> ¶</a></span></h4>
<p>certtool (1)
<a class="anchor" id="ocsptool-Examples"></a></p><h4 class="subsubheading" id="ocsptool-Examples-1"><span>ocsptool Examples<a class="copiable-link" href="#ocsptool-Examples-1"> ¶</a></span></h4>
<h4 class="subsubheading" id="Print-information-about-an-OCSP-request"><span>Print information about an OCSP request<a class="copiable-link" href="#Print-information-about-an-OCSP-request"> ¶</a></span></h4>
<p>To parse an OCSP request and print information about the content, the
<code class="code">-i</code> or <code class="code">--request-info</code> parameter may be used as follows.
The <code class="code">-Q</code> parameter specify the name of the file containing the
OCSP request, and it should contain the OCSP request in binary DER
format.
</p>
<div class="example">
<pre class="example-preformatted">$ ocsptool -i -Q ocsp-request.der
</pre></div>
<p>The input file may also be sent to standard input like this:
</p>
<div class="example">
<pre class="example-preformatted">$ cat ocsp-request.der | ocsptool --request-info
</pre></div>
<h4 class="subsubheading" id="Print-information-about-an-OCSP-response"><span>Print information about an OCSP response<a class="copiable-link" href="#Print-information-about-an-OCSP-response"> ¶</a></span></h4>
<p>Similar to parsing OCSP requests, OCSP responses can be parsed using
the <code class="code">-j</code> or <code class="code">--response-info</code> as follows.
</p>
<div class="example">
<pre class="example-preformatted">$ ocsptool -j -Q ocsp-response.der
$ cat ocsp-response.der | ocsptool --response-info
</pre></div>
<h4 class="subsubheading" id="Generate-an-OCSP-request"><span>Generate an OCSP request<a class="copiable-link" href="#Generate-an-OCSP-request"> ¶</a></span></h4>
<p>The <code class="code">-q</code> or <code class="code">--generate-request</code> parameters are used to
generate an OCSP request. By default the OCSP request is written to
standard output in binary DER format, but can be stored in a file
using <code class="code">--outfile</code>. To generate an OCSP request the issuer of the
certificate to check needs to be specified with <code class="code">--load-issuer</code>
and the certificate to check with <code class="code">--load-cert</code>. By default PEM
format is used for these files, although <code class="code">--inder</code> can be used to
specify that the input files are in DER format.
</p>
<div class="example">
<pre class="example-preformatted">$ ocsptool -q --load-issuer issuer.pem --load-cert client.pem \
--outfile ocsp-request.der
</pre></div>
<p>When generating OCSP requests, the tool will add an OCSP extension
containing a nonce. This behaviour can be disabled by specifying
<code class="code">--no-nonce</code>.
</p>
<h4 class="subsubheading" id="Verify-signature-in-OCSP-response"><span>Verify signature in OCSP response<a class="copiable-link" href="#Verify-signature-in-OCSP-response"> ¶</a></span></h4>
<p>To verify the signature in an OCSP response the <code class="code">-e</code> or
<code class="code">--verify-response</code> parameter is used. The tool will read an
OCSP response in DER format from standard input, or from the file
specified by <code class="code">--load-response</code>. The OCSP response is verified
against a set of trust anchors, which are specified using
<code class="code">--load-trust</code>. The trust anchors are concatenated certificates
in PEM format. The certificate that signed the OCSP response needs to
be in the set of trust anchors, or the issuer of the signer
certificate needs to be in the set of trust anchors and the OCSP
Extended Key Usage bit has to be asserted in the signer certificate.
</p>
<div class="example">
<pre class="example-preformatted">$ ocsptool -e --load-trust issuer.pem \
--load-response ocsp-response.der
</pre></div>
<p>The tool will print status of verification.
</p>
<h4 class="subsubheading" id="Verify-signature-in-OCSP-response-against-given-certificate"><span>Verify signature in OCSP response against given certificate<a class="copiable-link" href="#Verify-signature-in-OCSP-response-against-given-certificate"> ¶</a></span></h4>
<p>It is possible to override the normal trust logic if you know that a
certain certificate is supposed to have signed the OCSP response, and
you want to use it to check the signature. This is achieved using
<code class="code">--load-signer</code> instead of <code class="code">--load-trust</code>. This will load
one certificate and it will be used to verify the signature in the
OCSP response. It will not check the Extended Key Usage bit.
</p>
<div class="example">
<pre class="example-preformatted">$ ocsptool -e --load-signer ocsp-signer.pem \
--load-response ocsp-response.der
</pre></div>
<p>This approach is normally only relevant in two situations. The first
is when the OCSP response does not contain a copy of the signer
certificate, so the <code class="code">--load-trust</code> code would fail. The second
is if you want to avoid the indirect mode where the OCSP response
signer certificate is signed by a trust anchor.
</p>
<h4 class="subsubheading" id="Real_002dworld-example"><span>Real-world example<a class="copiable-link" href="#Real_002dworld-example"> ¶</a></span></h4>
<p>Here is an example of how to generate an OCSP request for a
certificate and to verify the response. For illustration we’ll use
the <code class="code">blog.josefsson.org</code> host, which (as of writing) uses a
certificate from CACert. First we’ll use <code class="code">gnutls-cli</code> to get a
copy of the server certificate chain. The server is not required to
send this information, but this particular one is configured to do so.
</p>
<div class="example">
<pre class="example-preformatted">$ echo | gnutls-cli -p 443 blog.josefsson.org --save-cert chain.pem
</pre></div>
<p>The saved certificates normally contain a pointer to where the OCSP
responder is located, in the Authority Information Access Information
extension. For example, from <code class="code">certtool -i < chain.pem</code> there is
this information:
</p>
<div class="example">
<pre class="example-preformatted"> Authority Information Access Information (not critical):
Access Method: 1.3.6.1.5.5.7.48.1 (id-ad-ocsp)
Access Location URI: https://ocsp.CAcert.org/
</pre></div>
<p>This means that ocsptool can discover the servers to contact over HTTP.
We can now request information on the chain certificates.
</p>
<div class="example">
<pre class="example-preformatted">$ ocsptool --ask --load-chain chain.pem
</pre></div>
<p>The request is sent via HTTP to the OCSP server address found in
the certificates. It is possible to override the address of the
OCSP server as well as ask information on a particular certificate
using –load-cert and –load-issuer.
</p>
<div class="example">
<pre class="example-preformatted">$ ocsptool --ask https://ocsp.CAcert.org/ --load-chain chain.pem
</pre></div>
<hr>
</div>
<div class="subsection-level-extent" id="danetool-Invocation">
<div class="nav-panel">
<p>
Previous: <a href="#ocsptool-Invocation" accesskey="p" rel="prev">Invoking ocsptool</a>, Up: <a href="#More-on-certificate-authentication" accesskey="u" rel="up">More on certificate authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Invoking-danetool"><span>4.2.8 Invoking danetool<a class="copiable-link" href="#Invoking-danetool"> ¶</a></span></h4>
<a class="index-entry-id" id="index-danetool"></a>
<p>Tool to generate and check DNS resource records for the DANE protocol.
</p>
<a class="anchor" id="danetool-usage"></a><h4 class="subsubheading" id="danetool-help_002fusage-_0028_002d_003f_0029"><span>danetool help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#danetool-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-danetool-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">danetool - GnuTLS DANE tool
Usage: danetool [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
-V, --verbose More verbose output
--outfile=str Output file
--load-pubkey=str Loads a public key file
--load-certificate=str Loads a certificate file
--dlv=str Sets a DLV file
--hash=str Hash algorithm to use for signing
--check=str Check a host's DANE TLSA entry
--check-ee Check only the end-entity's certificate
--check-ca Check only the CA's certificate
--tlsa-rr Print the DANE RR data on a certificate or public key
- requires the option 'host'
--host=str Specify the hostname to be used in the DANE RR
--proto=str The protocol set for DANE data (tcp, udp etc.)
--port=str The port or service to connect to, for DANE data
--app-proto an alias for the 'starttls-proto' option
--starttls-proto=str The application protocol to be used to obtain the server's certificate (https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres)
--ca Whether the provided certificate or public key is a Certificate Authority
--x509 Use the hash of the X.509 certificate, rather than the public key
--local an alias for the 'domain' option
--domain The provided certificate or public key is issued by the local domain
- enabled by default
- disabled as '--no-domain'
--local-dns Use the local DNS server for DNSSEC resolving
--insecure Do not verify any DNSSEC signature
--inder Use DER format for input certificates and private keys
--inraw an alias for the 'inder' option
--print-raw Print the received DANE data in raw format
--quiet Suppress several informational messages
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Tool to generate and check DNS resource records for the DANE protocol.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subsubheading" id="debug-option-_0028_002dd_0029_002e-5"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-5"> ¶</a></span></h4>
<a class="anchor" id="danetool-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subsubheading" id="load_002dpubkey-option_002e-1"><span>load-pubkey option.<a class="copiable-link" href="#load_002dpubkey-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="danetool-load_002dpubkey"></a>
<p>This is the “loads a public key file” option.
This option takes a ArgumentType.STRING argument.
This can be either a file or a PKCS #11 URL
</p><h4 class="subsubheading" id="load_002dcertificate-option_002e-1"><span>load-certificate option.<a class="copiable-link" href="#load_002dcertificate-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="danetool-load_002dcertificate"></a>
<p>This is the “loads a certificate file” option.
This option takes a ArgumentType.STRING argument.
This can be either a file or a PKCS #11 URL
</p><h4 class="subsubheading" id="dlv-option_002e"><span>dlv option.<a class="copiable-link" href="#dlv-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-dlv"></a>
<p>This is the “sets a dlv file” option.
This option takes a ArgumentType.STRING argument.
This sets a DLV file to be used for DNSSEC verification.
</p><h4 class="subsubheading" id="hash-option_002e-1"><span>hash option.<a class="copiable-link" href="#hash-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="danetool-hash"></a>
<p>This is the “hash algorithm to use for signing” option.
This option takes a ArgumentType.STRING argument.
Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512.
</p><h4 class="subsubheading" id="check-option_002e"><span>check option.<a class="copiable-link" href="#check-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-check"></a>
<p>This is the “check a host’s dane tlsa entry” option.
This option takes a ArgumentType.STRING argument.
Obtains the DANE TLSA entry from the given hostname and prints information. Note that the actual certificate of the host can be provided using –load-certificate, otherwise danetool will connect to the server to obtain it. The exit code on verification success will be zero.
</p><h4 class="subsubheading" id="check_002dee-option_002e"><span>check-ee option.<a class="copiable-link" href="#check_002dee-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-check_002dee"></a>
<p>This is the “check only the end-entity’s certificate” option.
Checks the end-entity’s certificate only. Trust anchors or CAs are not considered.
</p><h4 class="subsubheading" id="check_002dca-option_002e"><span>check-ca option.<a class="copiable-link" href="#check_002dca-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-check_002dca"></a>
<p>This is the “check only the ca’s certificate” option.
Checks the trust anchor’s and CA’s certificate only. End-entities are not considered.
</p><h4 class="subsubheading" id="tlsa_002drr-option_002e"><span>tlsa-rr option.<a class="copiable-link" href="#tlsa_002drr-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-tlsa_002drr"></a>
<p>This is the “print the dane rr data on a certificate or public key” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must appear in combination with the following options:
host.
</li></ul>
<p>This command prints the DANE RR data needed to enable DANE on a DNS server.
</p><h4 class="subsubheading" id="host-option_002e"><span>host option.<a class="copiable-link" href="#host-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-host"></a>
<p>This is the “specify the hostname to be used in the dane rr” option.
This option takes a ArgumentType.STRING argument <samp class="file">Hostname</samp>.
This command sets the hostname for the DANE RR.
</p><h4 class="subsubheading" id="proto-option_002e"><span>proto option.<a class="copiable-link" href="#proto-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-proto"></a>
<p>This is the “the protocol set for dane data (tcp, udp etc.)” option.
This option takes a ArgumentType.STRING argument <samp class="file">Protocol</samp>.
This command specifies the protocol for the service set in the DANE data.
</p><h4 class="subsubheading" id="app_002dproto-option_002e-2"><span>app-proto option.<a class="copiable-link" href="#app_002dproto-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="danetool-app_002dproto"></a>
<p>This is an alias for the <code class="code">starttls-proto</code> option,
see <a class="pxref" href="#danetool-starttls_002dproto">the starttls-proto option documentation</a>.
</p>
<h4 class="subsubheading" id="starttls_002dproto-option_002e-2"><span>starttls-proto option.<a class="copiable-link" href="#starttls_002dproto-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="danetool-starttls_002dproto"></a>
<p>This is the “the application protocol to be used to obtain the server’s certificate (https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres)” option.
This option takes a ArgumentType.STRING argument.
When the server’s certificate isn’t provided danetool will connect to the server to obtain the certificate. In that case it is required to know the protocol to talk with the server prior to initiating the TLS handshake.
</p><h4 class="subsubheading" id="ca-option_002e"><span>ca option.<a class="copiable-link" href="#ca-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-ca"></a>
<p>This is the “whether the provided certificate or public key is a certificate authority” option.
Marks the DANE RR as a CA certificate if specified.
</p><h4 class="subsubheading" id="x509-option_002e"><span>x509 option.<a class="copiable-link" href="#x509-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-x509"></a>
<p>This is the “use the hash of the x.509 certificate, rather than the public key” option.
This option forces the generated record to contain the hash of the full X.509 certificate. By default only the hash of the public key is used.
</p><h4 class="subsubheading" id="local-option_002e"><span>local option.<a class="copiable-link" href="#local-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-local"></a>
<p>This is an alias for the <code class="code">domain</code> option,
see <a class="pxref" href="#danetool-domain">the domain option documentation</a>.
</p>
<h4 class="subsubheading" id="domain-option_002e"><span>domain option.<a class="copiable-link" href="#domain-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-domain"></a>
<p>This is the “the provided certificate or public key is issued by the local domain” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>can be disabled with –no-domain.
</li><li>It is enabled by default.
</li></ul>
<p>DANE distinguishes certificates and public keys offered via the DNSSEC to trusted and local entities. This flag indicates that this is a domain-issued certificate, meaning that there could be no CA involved.
</p><h4 class="subsubheading" id="local_002ddns-option_002e-1"><span>local-dns option.<a class="copiable-link" href="#local_002ddns-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="danetool-local_002ddns"></a>
<p>This is the “use the local dns server for dnssec resolving” option.
This option will use the local DNS server for DNSSEC.
This is disabled by default due to many servers not allowing DNSSEC.
</p><h4 class="subsubheading" id="insecure-option_002e"><span>insecure option.<a class="copiable-link" href="#insecure-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-insecure"></a>
<p>This is the “do not verify any dnssec signature” option.
Ignores any DNSSEC signature verification results.
</p><h4 class="subsubheading" id="inder-option_002e-1"><span>inder option.<a class="copiable-link" href="#inder-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="danetool-inder"></a>
<p>This is the “use der format for input certificates and private keys” option.
The input files will be assumed to be in DER or RAW format.
Unlike options that in PEM input would allow multiple input data (e.g. multiple
certificates), when reading in DER format a single data structure is read.
</p><h4 class="subsubheading" id="inraw-option_002e-1"><span>inraw option.<a class="copiable-link" href="#inraw-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="danetool-inraw"></a>
<p>This is an alias for the <code class="code">inder</code> option,
see <a class="pxref" href="#danetool-inder">the inder option documentation</a>.
</p>
<h4 class="subsubheading" id="print_002draw-option_002e"><span>print-raw option.<a class="copiable-link" href="#print_002draw-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-print_002draw"></a>
<p>This is the “print the received dane data in raw format” option.
This option will print the received DANE data.
</p><h4 class="subsubheading" id="quiet-option_002e"><span>quiet option.<a class="copiable-link" href="#quiet-option_002e"> ¶</a></span></h4>
<a class="anchor" id="danetool-quiet"></a>
<p>This is the “suppress several informational messages” option.
In that case on the exit code can be used as an indication of verification success
</p><h4 class="subsubheading" id="version-option-_0028_002dv_0029_002e-5"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-5"> ¶</a></span></h4>
<a class="anchor" id="danetool-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subsubheading" id="help-option-_0028_002dh_0029_002e-5"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-5"> ¶</a></span></h4>
<a class="anchor" id="danetool-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subsubheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-5"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-5"> ¶</a></span></h4>
<a class="anchor" id="danetool-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="danetool-exit-status"></a></p><h4 class="subsubheading" id="danetool-exit-status-1"><span>danetool exit status<a class="copiable-link" href="#danetool-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="danetool-See-Also"></a><h4 class="subsubheading" id="danetool-See-Also-1"><span>danetool See Also<a class="copiable-link" href="#danetool-See-Also-1"> ¶</a></span></h4>
<p>certtool (1)
<a class="anchor" id="danetool-Examples"></a></p><h4 class="subsubheading" id="danetool-Examples-1"><span>danetool Examples<a class="copiable-link" href="#danetool-Examples-1"> ¶</a></span></h4>
<h4 class="subsubheading" id="DANE-TLSA-RR-generation"><span>DANE TLSA RR generation<a class="copiable-link" href="#DANE-TLSA-RR-generation"> ¶</a></span></h4>
<p>To create a DANE TLSA resource record for a certificate (or public key)
that was issued locally and may or may not be signed by a CA use the following command.
</p><div class="example">
<pre class="example-preformatted">$ danetool --tlsa-rr --host www.example.com --load-certificate cert.pem
</pre></div>
<p>To create a DANE TLSA resource record for a CA signed certificate, which will
be marked as such use the following command.
</p><div class="example">
<pre class="example-preformatted">$ danetool --tlsa-rr --host www.example.com --load-certificate cert.pem \
--no-domain
</pre></div>
<p>The former is useful to add in your DNS entry even if your certificate is signed
by a CA. That way even users who do not trust your CA will be able to verify your
certificate using DANE.
</p>
<p>In order to create a record for the CA signer of your certificate use the following.
</p><div class="example">
<pre class="example-preformatted">$ danetool --tlsa-rr --host www.example.com --load-certificate cert.pem \
--ca --no-domain
</pre></div>
<p>To read a server’s DANE TLSA entry, use:
</p><div class="example">
<pre class="example-preformatted">$ danetool --check www.example.com --proto tcp --port 443
</pre></div>
<p>To verify an HTTPS server’s DANE TLSA entry, use:
</p><div class="example">
<pre class="example-preformatted">$ danetool --check www.example.com --proto tcp --port 443 --load-certificate chain.pem
</pre></div>
<p>To verify an SMTP server’s DANE TLSA entry, use:
</p><div class="example">
<pre class="example-preformatted">$ danetool --check www.example.com --proto tcp --starttls-proto=smtp --load-certificate chain.pem
</pre></div>
<hr>
</div>
</div>
<div class="section-level-extent" id="Shared_002dkey-and-anonymous-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Selecting-an-appropriate-authentication-method" accesskey="n" rel="next">Selecting an appropriate authentication method</a>, Previous: <a href="#More-on-certificate-authentication" accesskey="p" rel="prev">More on certificate authentication</a>, Up: <a href="#Authentication-methods" accesskey="u" rel="up">Authentication methods</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Shared_002dkey-and-anonymous-authentication-1"><span>4.3 Shared-key and anonymous authentication<a class="copiable-link" href="#Shared_002dkey-and-anonymous-authentication-1"> ¶</a></span></h3>
<p>In addition to certificate authentication, the TLS protocol may be
used with password, shared-key and anonymous authentication methods.
The rest of this chapter discusses details of these methods.
</p>
<ul class="mini-toc">
<li><a href="#PSK-authentication" accesskey="1">PSK authentication</a></li>
<li><a href="#SRP-authentication" accesskey="2">SRP authentication</a></li>
<li><a href="#Anonymous-authentication" accesskey="3">Anonymous authentication</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="PSK-authentication">
<div class="nav-panel">
<p>
Next: <a href="#SRP-authentication" accesskey="n" rel="next">SRP authentication</a>, Up: <a href="#Shared_002dkey-and-anonymous-authentication" accesskey="u" rel="up">Shared-key and anonymous authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="PSK-authentication-1"><span>4.3.1 PSK authentication<a class="copiable-link" href="#PSK-authentication-1"> ¶</a></span></h4>
<ul class="mini-toc">
<li><a href="#Authentication-using-PSK" accesskey="1">Authentication using <abbr class="acronym">PSK</abbr></a></li>
<li><a href="#psktool-Invocation" accesskey="2">Invoking psktool</a></li>
</ul>
<hr>
<div class="subsubsection-level-extent" id="Authentication-using-PSK">
<div class="nav-panel">
<p>
Next: <a href="#psktool-Invocation" accesskey="n" rel="next">Invoking psktool</a>, Up: <a href="#PSK-authentication" accesskey="u" rel="up">PSK authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Authentication-using-PSK-1"><span>4.3.1.1 Authentication using <abbr class="acronym">PSK</abbr><a class="copiable-link" href="#Authentication-using-PSK-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-PSK-authentication"></a>
<p>Authentication using Pre-shared keys is a method to authenticate using
usernames and binary keys. This protocol avoids making use of public
key infrastructure and expensive calculations, thus it is suitable for
constraint clients. It is available under all TLS protocol versions.
</p>
<p>The implementation in <abbr class="acronym">GnuTLS</abbr> is based on [<a class="ref" href="#TLSPSK">TLSPSK</a>].
The supported <abbr class="acronym">PSK</abbr> key exchange methods are:
</p>
<dl class="table">
<dt><code class="code">PSK:</code></dt>
<dd><p>Authentication using the <abbr class="acronym">PSK</abbr> protocol (no forward secrecy).
</p>
</dd>
<dt><code class="code">DHE-PSK:</code></dt>
<dd><p>Authentication using the <abbr class="acronym">PSK</abbr> protocol and Diffie-Hellman key
exchange. This method offers perfect forward secrecy.
</p>
</dd>
<dt><code class="code">ECDHE-PSK:</code></dt>
<dd><p>Authentication using the <abbr class="acronym">PSK</abbr> protocol and Elliptic curve Diffie-Hellman key
exchange. This method offers perfect forward secrecy.
</p>
</dd>
<dt><code class="code">RSA-PSK:</code></dt>
<dd><p>Authentication using the <abbr class="acronym">PSK</abbr> protocol for the client and an RSA certificate
for the server. This is not available under TLS 1.3.
</p>
</dd>
</dl>
<p>Helper functions to generate and maintain <abbr class="acronym">PSK</abbr> keys are also included
in <abbr class="acronym">GnuTLS</abbr>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fkey_005fgenerate">gnutls_key_generate</a> (gnutls_datum_t * <var class="var">key</var>, unsigned int <var class="var">key_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhex_005fencode">gnutls_hex_encode</a> (const gnutls_datum_t * <var class="var">data</var>, char * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhex_005fdecode">gnutls_hex_decode</a> (const gnutls_datum_t * <var class="var">hex_data</var>, void * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsubsection-level-extent" id="psktool-Invocation">
<div class="nav-panel">
<p>
Previous: <a href="#Authentication-using-PSK" accesskey="p" rel="prev">Authentication using <abbr class="acronym">PSK</abbr></a>, Up: <a href="#PSK-authentication" accesskey="u" rel="up">PSK authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Invoking-psktool"><span>4.3.1.2 Invoking psktool<a class="copiable-link" href="#Invoking-psktool"> ¶</a></span></h4>
<a class="index-entry-id" id="index-psktool"></a>
<p>Program that generates random keys for use with TLS-PSK. The
keys are stored in hexadecimal format in a key file.
</p>
<a class="anchor" id="psktool-usage"></a><h4 class="subsubheading" id="psktool-help_002fusage-_0028_002d_003f_0029"><span>psktool help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#psktool-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-psktool-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">psktool - GnuTLS PSK tool
Usage: psktool [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
-s, --keysize=num Specify the key size in bytes (default is 32-bytes or 256-bits)
- it must be in the range:
0 to 512
-u, --username=str Specify the username to use
-p, --pskfile=str Specify a pre-shared key file
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Program that generates random keys for use with TLS-PSK. The
keys are stored in hexadecimal format in a key file.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subsubheading" id="debug-option-_0028_002dd_0029_002e-6"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-6"> ¶</a></span></h4>
<a class="anchor" id="psktool-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subsubheading" id="pskfile-option-_0028_002dp_0029_002e"><span>pskfile option (-p).<a class="copiable-link" href="#pskfile-option-_0028_002dp_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="psktool-pskfile"></a>
<p>This is the “specify a pre-shared key file” option.
This option takes a ArgumentType.STRING argument.
This option will specify the pre-shared key file to store the generated keys.
</p><h4 class="subsubheading" id="passwd-option_002e"><span>passwd option.<a class="copiable-link" href="#passwd-option_002e"> ¶</a></span></h4>
<a class="anchor" id="psktool-passwd"></a>
<p>This is an alias for the <code class="code">pskfile</code> option,
see <a class="pxref" href="#psktool-pskfile">the pskfile option documentation</a>.
</p>
<h4 class="subsubheading" id="version-option-_0028_002dv_0029_002e-6"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-6"> ¶</a></span></h4>
<a class="anchor" id="psktool-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subsubheading" id="help-option-_0028_002dh_0029_002e-6"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-6"> ¶</a></span></h4>
<a class="anchor" id="psktool-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subsubheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-6"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-6"> ¶</a></span></h4>
<a class="anchor" id="psktool-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="psktool-exit-status"></a></p><h4 class="subsubheading" id="psktool-exit-status-1"><span>psktool exit status<a class="copiable-link" href="#psktool-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="psktool-See-Also"></a><h4 class="subsubheading" id="psktool-See-Also-1"><span>psktool See Also<a class="copiable-link" href="#psktool-See-Also-1"> ¶</a></span></h4>
<p>gnutls-cli-debug (1), gnutls-serv (1), srptool (1), certtool (1)
<a class="anchor" id="psktool-Examples"></a></p><h4 class="subsubheading" id="psktool-Examples-1"><span>psktool Examples<a class="copiable-link" href="#psktool-Examples-1"> ¶</a></span></h4>
<p>To add a user ’psk_identity’ in <samp class="file">keys.psk</samp> for use with GnuTLS run:
</p><div class="example">
<pre class="example-preformatted">$ ./psktool -u psk_identity -p keys.psk
Generating a random key for user 'psk_identity'
Key stored to keys.psk
$ cat keys.psk
psk_identity:88f3824b3e5659f52d00e959bacab954b6540344
$
</pre></div>
<p>This command will create <samp class="file">keys.psk</samp> if it does not exist
and will add user ’psk_identity’.
</p>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="SRP-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Anonymous-authentication" accesskey="n" rel="next">Anonymous authentication</a>, Previous: <a href="#PSK-authentication" accesskey="p" rel="prev">PSK authentication</a>, Up: <a href="#Shared_002dkey-and-anonymous-authentication" accesskey="u" rel="up">Shared-key and anonymous authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="SRP-authentication-1"><span>4.3.2 SRP authentication<a class="copiable-link" href="#SRP-authentication-1"> ¶</a></span></h4>
<ul class="mini-toc">
<li><a href="#Authentication-using-SRP" accesskey="1">Authentication using <abbr class="acronym">SRP</abbr></a></li>
<li><a href="#srptool-Invocation" accesskey="2">Invoking srptool</a></li>
</ul>
<hr>
<div class="subsubsection-level-extent" id="Authentication-using-SRP">
<div class="nav-panel">
<p>
Next: <a href="#srptool-Invocation" accesskey="n" rel="next">Invoking srptool</a>, Up: <a href="#SRP-authentication" accesskey="u" rel="up">SRP authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Authentication-using-SRP-1"><span>4.3.2.1 Authentication using <abbr class="acronym">SRP</abbr><a class="copiable-link" href="#Authentication-using-SRP-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-SRP-authentication"></a>
<p><abbr class="acronym">GnuTLS</abbr> supports authentication via the Secure Remote Password
or <abbr class="acronym">SRP</abbr> protocol (see [<a class="ref" href="#RFC2945">TOMSRP</a>] for a description).
The <abbr class="acronym">SRP</abbr> key exchange is an extension to the
<abbr class="acronym">TLS</abbr> protocol, and it provides an authenticated with a
password key exchange. The peers can be identified using a single password,
or there can be combinations where the client is authenticated using <abbr class="acronym">SRP</abbr>
and the server using a certificate. It is only available under TLS 1.2 or earlier
versions.
</p>
<p>The advantage of <abbr class="acronym">SRP</abbr> authentication, over other proposed
secure password authentication schemes, is that <abbr class="acronym">SRP</abbr> is not
susceptible to off-line dictionary attacks.
Moreover, SRP does not require the server to hold the user’s password.
This kind of protection is similar to the one used traditionally in the <abbr class="acronym">UNIX</abbr>
<samp class="file">/etc/passwd</samp> file, where the contents of this file did not cause
harm to the system security if they were revealed. The <abbr class="acronym">SRP</abbr>
needs instead of the plain password something called a verifier, which
is calculated using the user’s password, and if stolen cannot be used
to impersonate the user.
</p>
<p>Typical conventions in SRP are a password file, called <samp class="file">tpasswd</samp> that
holds the SRP verifiers (encoded passwords) and another file, <samp class="file">tpasswd.conf</samp>,
which holds the allowed SRP parameters. The included in GnuTLS helper
follow those conventions. The srptool program, discussed in the next section
is a tool to manipulate the SRP parameters.
</p>
<p>The implementation in <abbr class="acronym">GnuTLS</abbr> is based on [<a class="ref" href="#TLSSRP">TLSSRP</a>]. The
supported key exchange methods are shown below. Enabling any of these
key exchange methods in a session disables support for TLS1.3.
</p>
<dl class="table">
<dt><code class="code">SRP:</code></dt>
<dd><p>Authentication using the <abbr class="acronym">SRP</abbr> protocol.
</p>
</dd>
<dt><code class="code">SRP_DSS:</code></dt>
<dd><p>Client authentication using the <abbr class="acronym">SRP</abbr> protocol. Server is
authenticated using a certificate with DSA parameters.
</p>
</dd>
<dt><code class="code">SRP_RSA:</code></dt>
<dd><p>Client authentication using the <abbr class="acronym">SRP</abbr> protocol. Server is
authenticated using a certificate with RSA parameters.
</p>
</dd>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fverifier"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_verifier</strong> <code class="def-code-arguments">(const char * <var class="var">username</var>, const char * <var class="var">password</var>, const gnutls_datum_t * <var class="var">salt</var>, const gnutls_datum_t * <var class="var">generator</var>, const gnutls_datum_t * <var class="var">prime</var>, gnutls_datum_t * <var class="var">res</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fverifier"> ¶</a></span></dt>
<dd><p><var class="var">username</var>: is the user’s name
</p>
<p><var class="var">password</var>: is the user’s password
</p>
<p><var class="var">salt</var>: should be some randomly generated bytes
</p>
<p><var class="var">generator</var>: is the generator of the group
</p>
<p><var class="var">prime</var>: is the group’s prime
</p>
<p><var class="var">res</var>: where the verifier will be stored.
</p>
<p>This function will create an SRP verifier, as specified in
RFC2945. The <code class="code">prime</code> and <code class="code">generator</code> should be one of the static
parameters defined in gnutls/gnutls.h or may be generated.
</p>
<p>The verifier will be allocated with <code class="code">gnutls_malloc</code> () and will be stored in
<code class="code">res</code> using binary format.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrp_005fbase64_005fencode2">gnutls_srp_base64_encode2</a> (const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">result</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrp_005fbase64_005fdecode2">gnutls_srp_base64_decode2</a> (const gnutls_datum_t * <var class="var">b64_data</var>, gnutls_datum_t * <var class="var">result</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsubsection-level-extent" id="srptool-Invocation">
<div class="nav-panel">
<p>
Previous: <a href="#Authentication-using-SRP" accesskey="p" rel="prev">Authentication using <abbr class="acronym">SRP</abbr></a>, Up: <a href="#SRP-authentication" accesskey="u" rel="up">SRP authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsubsection" id="Invoking-srptool"><span>4.3.2.2 Invoking srptool<a class="copiable-link" href="#Invoking-srptool"> ¶</a></span></h4>
<a class="index-entry-id" id="index-srptool"></a>
<p>Simple program that emulates the programs in the Stanford SRP (Secure
Remote Password) libraries using GnuTLS. It is intended for use in places
where you don’t expect SRP authentication to be the used for system users.
</p>
<p>In brief, to use SRP you need to create two files. These are the password
file that holds the users and the verifiers associated with them and the
configuration file to hold the group parameters (called tpasswd.conf).
</p>
<a class="anchor" id="srptool-usage"></a><h4 class="subsubheading" id="srptool-help_002fusage-_0028_002d_003f_0029"><span>srptool help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#srptool-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-srptool-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">srptool - GnuTLS SRP tool
Usage: srptool [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
-i, --index=num specify the index of the group parameters in tpasswd.conf to use
-u, --username=str specify a username
-p, --passwd=str specify a password file
-s, --salt=num specify salt size
--verify just verify the password
-v, --passwd-conf=str specify a password conf file
--create-conf=str Generate a password configuration file
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Simple program that emulates the programs in the Stanford SRP (Secure
Remote Password) libraries using GnuTLS. It is intended for use in places
where you don't expect SRP authentication to be the used for system users.
In brief, to use SRP you need to create two files. These are the password
file that holds the users and the verifiers associated with them and the
configuration file to hold the group parameters (called tpasswd.conf).
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subsubheading" id="debug-option-_0028_002dd_0029_002e-7"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-7"> ¶</a></span></h4>
<a class="anchor" id="srptool-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subsubheading" id="verify-option_002e-1"><span>verify option.<a class="copiable-link" href="#verify-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="srptool-verify"></a>
<p>This is the “just verify the password” option.
Verifies the password provided against the password file.
</p><h4 class="subsubheading" id="passwd_002dconf-option-_0028_002dv_0029_002e"><span>passwd-conf option (-v).<a class="copiable-link" href="#passwd_002dconf-option-_0028_002dv_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="srptool-passwd_002dconf"></a>
<p>This is the “specify a password conf file” option.
This option takes a ArgumentType.STRING argument.
Specify a filename or a PKCS #11 URL to read the CAs from.
</p><h4 class="subsubheading" id="create_002dconf-option_002e"><span>create-conf option.<a class="copiable-link" href="#create_002dconf-option_002e"> ¶</a></span></h4>
<a class="anchor" id="srptool-create_002dconf"></a>
<p>This is the “generate a password configuration file” option.
This option takes a ArgumentType.STRING argument.
This generates a password configuration file (tpasswd.conf)
containing the required for TLS parameters.
</p><h4 class="subsubheading" id="version-option-_0028_002dv_0029_002e-7"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-7"> ¶</a></span></h4>
<a class="anchor" id="srptool-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subsubheading" id="help-option-_0028_002dh_0029_002e-7"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-7"> ¶</a></span></h4>
<a class="anchor" id="srptool-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subsubheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-7"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-7"> ¶</a></span></h4>
<a class="anchor" id="srptool-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="srptool-exit-status"></a></p><h4 class="subsubheading" id="srptool-exit-status-1"><span>srptool exit status<a class="copiable-link" href="#srptool-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="srptool-See-Also"></a><h4 class="subsubheading" id="srptool-See-Also-1"><span>srptool See Also<a class="copiable-link" href="#srptool-See-Also-1"> ¶</a></span></h4>
<p>gnutls-cli-debug (1), gnutls-serv (1), srptool (1), psktool (1), certtool (1)
<a class="anchor" id="srptool-Examples"></a></p><h4 class="subsubheading" id="srptool-Examples-1"><span>srptool Examples<a class="copiable-link" href="#srptool-Examples-1"> ¶</a></span></h4>
<p>To create <samp class="file">tpasswd.conf</samp> which holds the g and n values for SRP protocol
(generator and a large prime), run:
</p><div class="example">
<pre class="example-preformatted">$ srptool --create-conf /etc/tpasswd.conf
</pre></div>
<p>This command will create <samp class="file">/etc/tpasswd</samp> and will add user ’test’ (you
will also be prompted for a password). Verifiers are stored by default
in the way libsrp expects.
</p><div class="example">
<pre class="example-preformatted">$ srptool --passwd /etc/tpasswd --passwd-conf /etc/tpasswd.conf -u test
</pre></div>
<p>This command will check against a password. If the password matches
the one in <samp class="file">/etc/tpasswd</samp> you will get an ok.
</p><div class="example">
<pre class="example-preformatted">$ srptool --passwd /etc/tpasswd --passwd\-conf /etc/tpasswd.conf --verify -u test
</pre></div>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="Anonymous-authentication">
<div class="nav-panel">
<p>
Previous: <a href="#SRP-authentication" accesskey="p" rel="prev">SRP authentication</a>, Up: <a href="#Shared_002dkey-and-anonymous-authentication" accesskey="u" rel="up">Shared-key and anonymous authentication</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Anonymous-authentication-1"><span>4.3.3 Anonymous authentication<a class="copiable-link" href="#Anonymous-authentication-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-anonymous-authentication"></a>
<p>The anonymous key exchange offers encryption without any
indication of the peer’s identity. This kind of authentication
is vulnerable to a man in the middle attack, but can be
used even if there is no prior communication or shared trusted parties
with the peer. It is useful to establish a session over which certificate
authentication will occur in order to hide the identities of the participants
from passive eavesdroppers. It is only available under TLS 1.2 or earlier
versions.
</p>
<p>Unless in the above case, it is not recommended to use anonymous authentication.
In the cases where there is no prior communication with the peers,
an alternative with better properties, such as key continuity, is trust on first use
(see <a class="ref" href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a>).
</p>
<p>The available key exchange algorithms for anonymous authentication are
shown below, but note that few public servers support them, and they
have to be explicitly enabled. These ciphersuites are negotiated only under
TLS 1.2.
</p>
<dl class="table">
<dt><code class="code">ANON_DH:</code></dt>
<dd><p>This algorithm exchanges Diffie-Hellman parameters.
</p>
</dd>
<dt><code class="code">ANON_ECDH:</code></dt>
<dd><p>This algorithm exchanges elliptic curve Diffie-Hellman parameters. It is more
efficient than ANON_DH on equivalent security levels.
</p>
</dd>
</dl>
<hr>
</div>
</div>
<div class="section-level-extent" id="Selecting-an-appropriate-authentication-method">
<div class="nav-panel">
<p>
Previous: <a href="#Shared_002dkey-and-anonymous-authentication" accesskey="p" rel="prev">Shared-key and anonymous authentication</a>, Up: <a href="#Authentication-methods" accesskey="u" rel="up">Authentication methods</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Selecting-an-appropriate-authentication-method-1"><span>4.4 Selecting an appropriate authentication method<a class="copiable-link" href="#Selecting-an-appropriate-authentication-method-1"> ¶</a></span></h3>
<p>This section provides some guidance on how to use the available authentication
methods in <abbr class="acronym">GnuTLS</abbr> in various scenarios.
</p>
<ul class="mini-toc">
<li><a href="#Two-peers-with-an-out_002dof_002dband-channel" accesskey="1">Two peers with an out-of-band channel</a></li>
<li><a href="#Two-peers-without-an-out_002dof_002dband-channel" accesskey="2">Two peers without an out-of-band channel</a></li>
<li><a href="#Two-peers-and-a-trusted-third-party" accesskey="3">Two peers and a trusted third party</a></li>
</ul>
<div class="subsection-level-extent" id="Two-peers-with-an-out_002dof_002dband-channel">
<h4 class="subsection"><span>4.4.1 Two peers with an out-of-band channel<a class="copiable-link" href="#Two-peers-with-an-out_002dof_002dband-channel"> ¶</a></span></h4>
<p>Let’s consider two peers who need to communicate over an untrusted channel
(the Internet), but have an out-of-band channel available. The latter
channel is considered safe from eavesdropping and message modification and thus
can be used for an initial bootstrapping of the protocol. The options
available are:
</p><ul class="itemize mark-bullet">
<li>Pre-shared keys (see <a class="ref" href="#PSK-authentication">PSK authentication</a>). The server and a
client communicate a shared randomly generated key over the trusted
channel and use it to negotiate further sessions over the untrusted channel.
</li><li>Passwords (see <a class="ref" href="#SRP-authentication">SRP authentication</a>). The client communicates
to the server its username and password of choice and uses it to
negotiate further sessions over the untrusted channel.
</li><li>Public keys (see <a class="ref" href="#Certificate-authentication">Certificate authentication</a>). The client
and the server exchange their public keys (or fingerprints of them)
over the trusted channel.
On future sessions over the untrusted channel they verify the key
being the same (similar to <a class="ref" href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a>).
</li></ul>
<p>Provided that the out-of-band channel is trusted all of the above provide
a similar level of protection. An out-of-band channel may be the initial
bootstrapping of a user’s PC in a corporate environment, in-person
communication, communication over an alternative network (e.g. the phone
network), etc.
</p>
</div>
<div class="subsection-level-extent" id="Two-peers-without-an-out_002dof_002dband-channel">
<h4 class="subsection"><span>4.4.2 Two peers without an out-of-band channel<a class="copiable-link" href="#Two-peers-without-an-out_002dof_002dband-channel"> ¶</a></span></h4>
<p>When an out-of-band channel is not available a peer cannot be reliably
authenticated. What can be done, however, is to allow some form of
registration of users connecting for the first time and ensure that their
keys remain the same after that initial connection. This is termed
key continuity or trust on first use (TOFU).
</p>
<p>The available option is to use public key authentication (see <a class="ref" href="#Certificate-authentication">Certificate authentication</a>).
The client and the server store each other’s public keys (or fingerprints of them)
and associate them with their identity.
On future sessions over the untrusted channel they verify the keys
being the same (see <a class="ref" href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a>).
</p>
<p>To mitigate the uncertainty of the information exchanged in the first
connection other channels over the Internet may be used, e.g., <abbr class="acronym">DNSSEC</abbr>
(see <a class="ref" href="#Verifying-a-certificate-using-DANE">Verifying a certificate using DANE (DNSSEC)</a>).
</p>
</div>
<div class="subsection-level-extent" id="Two-peers-and-a-trusted-third-party">
<h4 class="subsection"><span>4.4.3 Two peers and a trusted third party<a class="copiable-link" href="#Two-peers-and-a-trusted-third-party"> ¶</a></span></h4>
<p>When a trusted third party is available (or a certificate authority)
the most suitable option is to use
certificate authentication (see <a class="ref" href="#Certificate-authentication">Certificate authentication</a>).
The client and the server obtain certificates that associate their identity
and public keys using a digital signature by the trusted party and use
them to on the subsequent communications with each other.
Each party verifies the peer’s certificate using the trusted third party’s
signature. The parameters of the third party’s signature are present
in its certificate which must be available to all communicating parties.
</p>
<p>While the above is the typical authentication method for servers in the
Internet by using the commercial CAs, the users that act as clients in the
protocol rarely possess such certificates. In that case a hybrid method
can be used where the server is authenticated by the client using the
commercial CAs and the client is authenticated based on some information
the client provided over the initial server-authenticated channel. The
available options are:
</p><ul class="itemize mark-bullet">
<li>Passwords (see <a class="ref" href="#SRP-authentication">SRP authentication</a>). The client communicates
to the server its username and password of choice on the initial
server-authenticated connection and uses it to negotiate further sessions.
This is possible because the SRP protocol allows for the server to be
authenticated using a certificate and the client using the
password.
</li><li>Public keys (see <a class="ref" href="#Certificate-authentication">Certificate authentication</a>). The client
sends its public key to the server (or a fingerprint of it) over the
initial server-authenticated connection.
On future sessions the client verifies the server using the third party
certificate and the server verifies that the client’s public key remained
the same (see <a class="ref" href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a>).
</li></ul>
<hr>
</div>
</div>
</div>
<div class="chapter-level-extent" id="Hardware-security-modules-and-abstract-key-types">
<div class="nav-panel">
<p>
Next: <a href="#How-to-use-GnuTLS-in-applications" accesskey="n" rel="next">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a>, Previous: <a href="#Authentication-methods" accesskey="p" rel="prev">Authentication methods</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Abstract-key-types-and-Hardware-security-modules"><span>5 Abstract key types and Hardware security modules<a class="copiable-link" href="#Abstract-key-types-and-Hardware-security-modules"> ¶</a></span></h2>
<p>In several cases storing the long term cryptographic keys in a hard disk or
even in memory poses a significant risk. Once the system they are stored
is compromised the keys must be replaced as the secrecy of future sessions
is no longer guaranteed. Moreover, past sessions that were not protected by a
perfect forward secrecy offering ciphersuite are also to be assumed compromised.
</p>
<p>If such threats need to be addressed, then it may be wise storing the keys in a security
module such as a smart card, an HSM or the TPM chip. Those modules ensure the
protection of the cryptographic keys by only allowing operations on them and
preventing their extraction. The purpose of the abstract key API is to provide
an API that will allow the handle of keys in memory and files, as well as keys
stored in such modules.
</p>
<p>In GnuTLS the approach is to handle all keys transparently by the high level API, e.g.,
the API that loads a key or certificate from a file.
The high-level API will accept URIs in addition to files that specify keys on an HSM or in TPM,
and a callback function will be used to obtain any required keys. The URI format is defined in
[<a class="ref" href="#PKCS11URI">PKCS11URI</a>].
</p>
<p>More information on the API is provided in the next sections. Examples of a URI of a certificate
stored in an HSM, as well as a key stored in the TPM chip are shown below. To discover the URIs
of the objects the <code class="code">p11tool</code> (see <a class="ref" href="#p11tool-Invocation">Invoking p11tool</a>).
</p><div class="example">
<pre class="example-preformatted">pkcs11:token=Nikos;serial=307521161601031;model=PKCS%2315; \
manufacturer=EnterSafe;object=test1;type=cert
</pre></div>
<ul class="mini-toc">
<li><a href="#Abstract-key-types" accesskey="1">Abstract key types</a></li>
<li><a href="#Application_002dspecific-keys" accesskey="2">System and application-specific keys</a></li>
<li><a href="#Smart-cards-and-HSMs" accesskey="3">Smart cards and HSMs</a></li>
<li><a href="#Trusted-Platform-Module" accesskey="4">Trusted Platform Module (TPM)</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Abstract-key-types">
<div class="nav-panel">
<p>
Next: <a href="#Application_002dspecific-keys" accesskey="n" rel="next">System and application-specific keys</a>, Up: <a href="#Hardware-security-modules-and-abstract-key-types" accesskey="u" rel="up">Abstract key types and Hardware security modules</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Abstract-key-types-1"><span>5.1 Abstract key types<a class="copiable-link" href="#Abstract-key-types-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-abstract-types"></a>
<p>Since there are many forms of a public or private keys supported by <abbr class="acronym">GnuTLS</abbr> such as
<abbr class="acronym">X.509</abbr>, <abbr class="acronym">PKCS</abbr> #11 or TPM it is desirable to allow common operations
on them. For these reasons the abstract <code class="code">gnutls_privkey_t</code> and <code class="code">gnutls_pubkey_t</code> were
introduced in <code class="code">gnutls/abstract.h</code> header. Those types are initialized using a specific type of
key and then can be used to perform operations in an abstract way. For example in order
to sign an X.509 certificate with a key that resides in a token the following steps can be
used.
</p>
<div class="example">
<pre class="example-preformatted">#include <gnutls/abstract.h>
void sign_cert( gnutls_x509_crt_t to_be_signed)
{
gnutls_x509_crt_t ca_cert;
gnutls_privkey_t abs_key;
/* initialize the abstract key */
gnutls_privkey_init(&abs_key);
/* keys stored in tokens are identified by URLs */
gnutls_privkey_import_url(abs_key, key_url);
gnutls_x509_crt_init(&ca_cert);
gnutls_x509_crt_import_url(&ca_cert, cert_url);
/* sign the certificate to be signed */
gnutls_x509_crt_privkey_sign(to_be_signed, ca_cert, abs_key,
GNUTLS_DIG_SHA256, 0);
}
</pre></div>
<ul class="mini-toc">
<li><a href="#Abstract-public-keys" accesskey="1">Public keys</a></li>
<li><a href="#Abstract-private-keys" accesskey="2">Private keys</a></li>
<li><a href="#Operations" accesskey="3">Operations</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Abstract-public-keys">
<div class="nav-panel">
<p>
Next: <a href="#Abstract-private-keys" accesskey="n" rel="next">Private keys</a>, Up: <a href="#Abstract-key-types" accesskey="u" rel="up">Abstract key types</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Public-keys"><span>5.1.1 Public keys<a class="copiable-link" href="#Public-keys"> ¶</a></span></h4>
<p>An abstract <code class="code">gnutls_pubkey_t</code> can be initialized and freed by
using the functions below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005finit">gnutls_pubkey_init</a> (gnutls_pubkey_t * <var class="var">key</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpubkey_005fdeinit">gnutls_pubkey_deinit</a> (gnutls_pubkey_t <var class="var">key</var>)</code></dt>
</dl>
<p>After initialization its values can be imported from
an existing structure like <code class="code">gnutls_x509_crt_t</code>,
or through an ASN.1 encoding of the X.509 <code class="code">SubjectPublicKeyInfo</code>
sequence.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005fx509">gnutls_pubkey_import_x509</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005fpkcs11">gnutls_pubkey_import_pkcs11</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_pkcs11_obj_t <var class="var">obj</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005furl">gnutls_pubkey_import_url</a> (gnutls_pubkey_t <var class="var">key</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005fprivkey">gnutls_pubkey_import_privkey</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_privkey_t <var class="var">pkey</var>, unsigned int <var class="var">usage</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport">gnutls_pubkey_import</a> (gnutls_pubkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fexport">gnutls_pubkey_export</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a certificate PEM or DER encoded
</p>
<p>This function will export the public key to DER or PEM format.
The contents of the exported data is the SubjectPublicKeyInfo
X.509 structure.
</p>
<p>The output buffer will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<p>Other helper functions that allow directly importing from raw X.509 structures are shown below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005fx509_005fraw">gnutls_pubkey_import_x509_raw</a> (gnutls_pubkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<p>An important function is <a class="ref" href="#gnutls_005fpubkey_005fimport_005furl">gnutls_pubkey_import_url</a> which will import
public keys from URLs that identify objects stored in tokens (see <a class="ref" href="#Smart-cards-and-HSMs">Smart cards and HSMs</a> and <a class="ref" href="#Trusted-Platform-Module">Trusted Platform Module (TPM)</a>).
A function to check for a supported by GnuTLS URL is <a class="ref" href="#gnutls_005furl_005fis_005fsupported">gnutls_url_is_supported</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005furl_005fis_005fsupported"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_url_is_supported</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>)</code><a class="copiable-link" href="#index-gnutls_005furl_005fis_005fsupported"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: A URI to be tested
</p>
<p>Check whether the provided <code class="code">url</code> is supported. Depending on the system libraries
GnuTLS may support pkcs11, tpmkey or other URLs.
</p>
<p><strong class="strong">Returns:</strong> return non-zero if the given URL is supported, and zero if
it is not known.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<p>Additional functions are available that will return
information over a public key, such as a unique key ID, as well as a function
that given a public key fingerprint would provide a memorable sketch.
</p>
<p>Note that <a class="ref" href="#gnutls_005fpubkey_005fget_005fkey_005fid">gnutls_pubkey_get_key_id</a> calculates a SHA1 digest of the
public key as a DER-formatted, subjectPublicKeyInfo object. Other implementations
use different approaches, e.g., some use the “common method” described in
section 4.2.1.2 of [<a class="ref" href="#RFC5280">RFC5280</a>] which calculates a digest on a part of the
subjectPublicKeyInfo object.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fget_005fpk_005falgorithm">gnutls_pubkey_get_pk_algorithm</a> (gnutls_pubkey_t <var class="var">key</var>, unsigned int * <var class="var">bits</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm">gnutls_pubkey_get_preferred_hash_algorithm</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_digest_algorithm_t * <var class="var">hash</var>, unsigned int * <var class="var">mand</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fget_005fkey_005fid">gnutls_pubkey_get_key_id</a> (gnutls_pubkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005frandom_005fart">gnutls_random_art</a> (gnutls_random_art_t <var class="var">type</var>, const char * <var class="var">key_type</var>, unsigned int <var class="var">key_size</var>, void * <var class="var">fpr</var>, size_t <var class="var">fpr_size</var>, gnutls_datum_t * <var class="var">art</var>)</code></dt>
</dl>
<p>To export the key-specific parameters, or obtain a unique key ID the following functions are provided.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fexport_005frsa_005fraw2">gnutls_pubkey_export_rsa_raw2</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, unsigned <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fexport_005fdsa_005fraw2">gnutls_pubkey_export_dsa_raw2</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>, unsigned <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fexport_005fecc_005fraw2">gnutls_pubkey_export_ecc_raw2</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fexport_005fecc_005fx962">gnutls_pubkey_export_ecc_x962</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">parameters</var>, gnutls_datum_t * <var class="var">ecpoint</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Abstract-private-keys">
<div class="nav-panel">
<p>
Next: <a href="#Operations" accesskey="n" rel="next">Operations</a>, Previous: <a href="#Abstract-public-keys" accesskey="p" rel="prev">Public keys</a>, Up: <a href="#Abstract-key-types" accesskey="u" rel="up">Abstract key types</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Private-keys"><span>5.1.2 Private keys<a class="copiable-link" href="#Private-keys"> ¶</a></span></h4>
<p>An abstract <code class="code">gnutls_privkey_t</code> can be initialized and freed by
using the functions below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005finit">gnutls_privkey_init</a> (gnutls_privkey_t * <var class="var">key</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fprivkey_005fdeinit">gnutls_privkey_deinit</a> (gnutls_privkey_t <var class="var">key</var>)</code></dt>
</dl>
<p>After initialization its values can be imported from
an existing structure like <code class="code">gnutls_x509_privkey_t</code>,
but unlike public keys it cannot be exported. That is
to allow abstraction over keys stored in hardware that
makes available only operations.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fimport_005fx509">gnutls_privkey_import_x509</a> (gnutls_privkey_t <var class="var">pkey</var>, gnutls_x509_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fimport_005fpkcs11">gnutls_privkey_import_pkcs11</a> (gnutls_privkey_t <var class="var">pkey</var>, gnutls_pkcs11_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<p>Other helper functions that allow directly importing from raw X.509
structures are shown below. Again, as with public keys, private keys
can be imported from a hardware module using URLs.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_url</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_privkey_t</code>
</p>
<p><var class="var">url</var>: A PKCS 11 url
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import a PKCS11 or TPM URL as a
private key. The supported URL types can be checked
using <code class="code">gnutls_url_is_supported()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fimport_005fx509_005fraw">gnutls_privkey_import_x509_raw</a> (gnutls_privkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fget_005fpk_005falgorithm">gnutls_privkey_get_pk_algorithm</a> (gnutls_privkey_t <var class="var">key</var>, unsigned int * <var class="var">bits</var>)</code></dt>
<dt><code class="code"><var class="var">gnutls_privkey_type_t</var> <a class="ref" href="#gnutls_005fprivkey_005fget_005ftype">gnutls_privkey_get_type</a> (gnutls_privkey_t <var class="var">key</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fstatus">gnutls_privkey_status</a> (gnutls_privkey_t <var class="var">key</var>)</code></dt>
</dl>
<p>In order to support cryptographic operations using
an external API, the following function is provided.
This allows for a simple extensibility API without
resorting to <abbr class="acronym">PKCS</abbr> #11.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fext4"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_ext4</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, void * <var class="var">userdata</var>, gnutls_privkey_sign_data_func <var class="var">sign_data_fn</var>, gnutls_privkey_sign_hash_func <var class="var">sign_hash_fn</var>, gnutls_privkey_decrypt_func <var class="var">decrypt_fn</var>, gnutls_privkey_deinit_func <var class="var">deinit_fn</var>, gnutls_privkey_info_func <var class="var">info_fn</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fext4"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">userdata</var>: private data to be provided to the callbacks
</p>
<p><var class="var">sign_data_fn</var>: callback for signature operations (may be <code class="code">NULL</code> )
</p>
<p><var class="var">sign_hash_fn</var>: callback for signature operations (may be <code class="code">NULL</code> )
</p>
<p><var class="var">decrypt_fn</var>: callback for decryption operations (may be <code class="code">NULL</code> )
</p>
<p><var class="var">deinit_fn</var>: a deinitialization function
</p>
<p><var class="var">info_fn</var>: returns info about the public key algorithm (should not be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function will associate the given callbacks with the
<code class="code">gnutls_privkey_t</code> type. At least one of the callbacks
must be non-null. If a deinitialization function is provided
then flags is assumed to contain <code class="code">GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE</code> .
</p>
<p>Note that in contrast with the signing function of
<code class="code">gnutls_privkey_import_ext3()</code> , the signing functions provided to this
function take explicitly the signature algorithm as parameter and
different functions are provided to sign the data and hashes.
</p>
<p>The <code class="code">sign_hash_fn</code> is to be called to sign pre-hashed data. The input
to the callback is the output of the hash (such as SHA256) corresponding
to the signature algorithm. For RSA PKCS<code class="code">1</code> signatures, the signature
algorithm can be set to <code class="code">GNUTLS_SIGN_RSA_RAW</code> , and in that case the data
should be handled as if they were an RSA PKCS<code class="code">1</code> DigestInfo structure.
</p>
<p>The <code class="code">sign_data_fn</code> is to be called to sign data. The input data will be
he data to be signed (and hashed), with the provided signature
algorithm. This function is to be used for signature algorithms like
Ed25519 which cannot take pre-hashed data as input.
</p>
<p>When both <code class="code">sign_data_fn</code> and <code class="code">sign_hash_fn</code> functions are provided they
must be able to operate on all the supported signature algorithms,
unless prohibited by the type of the algorithm (e.g., as with Ed25519).
</p>
<p>The <code class="code">info_fn</code> must provide information on the signature algorithms supported by
this private key, and should support the flags <code class="code">GNUTLS_PRIVKEY_INFO_PK_ALGO</code> ,
<code class="code">GNUTLS_PRIVKEY_INFO_HAVE_SIGN_ALGO</code> and <code class="code">GNUTLS_PRIVKEY_INFO_PK_ALGO_BITS</code> .
It must return -1 on unknown flags.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<p>On the private keys where exporting of parameters is possible (i.e.,
software keys), the following functions are also available.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fexport_005frsa_005fraw2">gnutls_privkey_export_rsa_raw2</a> (gnutls_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, gnutls_datum_t * <var class="var">d</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">u</var>, gnutls_datum_t * <var class="var">e1</var>, gnutls_datum_t * <var class="var">e2</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fexport_005fdsa_005fraw2">gnutls_privkey_export_dsa_raw2</a> (gnutls_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">x</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fexport_005fecc_005fraw2">gnutls_privkey_export_ecc_raw2</a> (gnutls_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">k</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Operations">
<div class="nav-panel">
<p>
Previous: <a href="#Abstract-private-keys" accesskey="p" rel="prev">Private keys</a>, Up: <a href="#Abstract-key-types" accesskey="u" rel="up">Abstract key types</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Operations-1"><span>5.1.3 Operations<a class="copiable-link" href="#Operations-1"> ¶</a></span></h4>
<p>The abstract key types can be used to access signing and
signature verification operations with the underlying keys.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fverify_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_verify_data2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pubkey</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, const gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fverify_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">pubkey</var>: Holds the public key
</p>
<p><var class="var">algo</var>: The signature algorithm used
</p>
<p><var class="var">flags</var>: Zero or an OR list of <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p><var class="var">data</var>: holds the signed data
</p>
<p><var class="var">signature</var>: contains the signature
</p>
<p>This function will verify the given signed data, using the
parameters from the certificate.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code>
is returned, and zero or positive code on success. For known to be insecure
signatures this function will return <code class="code">GNUTLS_E_INSUFFICIENT_SECURITY</code> unless
the flag <code class="code">GNUTLS_VERIFY_ALLOW_BROKEN</code> is specified.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fverify_005fhash2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_verify_hash2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">hash</var>, const gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fverify_005fhash2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">algo</var>: The signature algorithm used
</p>
<p><var class="var">flags</var>: Zero or an OR list of <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p><var class="var">hash</var>: holds the hash digest to be verified
</p>
<p><var class="var">signature</var>: contains the signature
</p>
<p>This function will verify the given signed digest, using the
parameters from the public key. Note that unlike <code class="code">gnutls_privkey_sign_hash()</code> ,
this function accepts a signature algorithm instead of a digest algorithm.
You can use <code class="code">gnutls_pk_to_sign()</code> to get the appropriate value.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code>
is returned, and zero or positive code on success. For known to be insecure
signatures this function will return <code class="code">GNUTLS_E_INSUFFICIENT_SECURITY</code> unless
the flag <code class="code">GNUTLS_VERIFY_ALLOW_BROKEN</code> is specified.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fencrypt_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_encrypt_data</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">plaintext</var>, gnutls_datum_t * <var class="var">ciphertext</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fencrypt_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">flags</var>: should be 0 for now
</p>
<p><var class="var">plaintext</var>: The data to be encrypted
</p>
<p><var class="var">ciphertext</var>: contains the encrypted data
</p>
<p>This function will encrypt the given data, using the public
key. On success the <code class="code">ciphertext</code> will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fsign_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_sign_data</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">signer</var>, gnutls_digest_algorithm_t <var class="var">hash</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fsign_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">signer</var>: Holds the key
</p>
<p><var class="var">hash</var>: should be a digest algorithm
</p>
<p><var class="var">flags</var>: Zero or one of <code class="code">gnutls_privkey_flags_t</code>
</p>
<p><var class="var">data</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain the signature allocated with <code class="code">gnutls_malloc()</code>
</p>
<p>This function will sign the given data using a signature algorithm
supported by the private key. Signature algorithms are always used
together with a hash functions. Different hash functions may be
used for the RSA algorithm, but only the SHA family for the DSA keys.
</p>
<p>You may use <code class="code">gnutls_pubkey_get_preferred_hash_algorithm()</code> to determine
the hash algorithm.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fsign_005fhash"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_sign_hash</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">signer</var>, gnutls_digest_algorithm_t <var class="var">hash_algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">hash_data</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fsign_005fhash"> ¶</a></span></dt>
<dd><p><var class="var">signer</var>: Holds the signer’s key
</p>
<p><var class="var">hash_algo</var>: The hash algorithm used
</p>
<p><var class="var">flags</var>: Zero or one of <code class="code">gnutls_privkey_flags_t</code>
</p>
<p><var class="var">hash_data</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain newly allocated signature
</p>
<p>This function will sign the given hashed data using a signature algorithm
supported by the private key. Signature algorithms are always used
together with a hash functions. Different hash functions may be
used for the RSA algorithm, but only SHA-XXX for the DSA keys.
</p>
<p>You may use <code class="code">gnutls_pubkey_get_preferred_hash_algorithm()</code> to determine
the hash algorithm.
</p>
<p>The flags may be <code class="code">GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA</code> or <code class="code">GNUTLS_PRIVKEY_SIGN_FLAG_RSA_PSS</code> .
In the former case this function will ignore <code class="code">hash_algo</code> and perform a raw PKCS1 signature,
and in the latter an RSA-PSS signature will be generated.
</p>
<p>Note that, not all algorithm support signing already hashed data. When
signing with Ed25519, <code class="code">gnutls_privkey_sign_data()</code> should be used.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fdecrypt_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_decrypt_data</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">ciphertext</var>, gnutls_datum_t * <var class="var">plaintext</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fdecrypt_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p><var class="var">ciphertext</var>: holds the data to be decrypted
</p>
<p><var class="var">plaintext</var>: will contain the decrypted data, allocated with <code class="code">gnutls_malloc()</code>
</p>
<p>This function will decrypt the given data using the algorithm
supported by the private key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<p>Signing existing structures, such as certificates, CRLs,
or certificate requests, as well as associating public
keys with structures is also possible using the
key abstractions.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fpubkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_pubkey</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_pubkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fpubkey"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a public key
</p>
<p>This function will set the public parameters from the given public
key to the request. The <code class="code">key</code> can be deallocated after that.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fpubkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_pubkey</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_pubkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fpubkey"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">key</var>: holds a public key
</p>
<p>This function will set the public parameters from the given public
key to the certificate. The <code class="code">key</code> can be deallocated after that.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fprivkey_005fsign">gnutls_x509_crt_privkey_sign</a> (gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrl_005fprivkey_005fsign">gnutls_x509_crl_privkey_sign</a> (gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrq_005fprivkey_005fsign">gnutls_x509_crq_privkey_sign</a> (gnutls_x509_crq_t <var class="var">crq</var>, gnutls_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<hr>
</div>
</div>
<div class="section-level-extent" id="Application_002dspecific-keys">
<div class="nav-panel">
<p>
Next: <a href="#Smart-cards-and-HSMs" accesskey="n" rel="next">Smart cards and HSMs</a>, Previous: <a href="#Abstract-key-types" accesskey="p" rel="prev">Abstract key types</a>, Up: <a href="#Hardware-security-modules-and-abstract-key-types" accesskey="u" rel="up">Abstract key types and Hardware security modules</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="System-and-application_002dspecific-keys"><span>5.2 System and application-specific keys<a class="copiable-link" href="#System-and-application_002dspecific-keys"> ¶</a></span></h3>
<a class="index-entry-id" id="index-Application_002dspecific-keys"></a>
<a class="index-entry-id" id="index-System_002dspecific-keys"></a>
<ul class="mini-toc">
<li><a href="#System_002dspecific-keys" accesskey="1">System-specific keys</a></li>
<li><a href="#Application_002dspecific-keys-1" accesskey="2">Application-specific keys</a></li>
</ul>
<div class="subsection-level-extent" id="System_002dspecific-keys">
<h4 class="subsection"><span>5.2.1 System-specific keys<a class="copiable-link" href="#System_002dspecific-keys"> ¶</a></span></h4>
<p>In several systems there are keystores which allow to read, store and use certificates
and private keys. For these systems GnuTLS provides the system-key API in <code class="code">gnutls/system-keys.h</code>.
That API provides the ability to iterate through all stored keys, add and delete keys as well
as use these keys using a URL which starts with "system:". The format of the URLs is system-specific.
The <code class="code">systemkey</code> tool is also provided to assist in listing keys and debugging.
</p>
<p>The systems supported via this API are the following.
</p><ul class="itemize mark-bullet">
<li>Windows Cryptography API (CNG)
</li></ul>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsystem_005fkey_005fiter_005fget_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_system_key_iter_get_info</strong> <code class="def-code-arguments">(gnutls_system_key_iter_t * <var class="var">iter</var>, unsigned <var class="var">cert_type</var>, char ** <var class="var">cert_url</var>, char ** <var class="var">key_url</var>, char ** <var class="var">label</var>, gnutls_datum_t * <var class="var">der</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsystem_005fkey_005fiter_005fget_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">iter</var>: an iterator of the system keys (must be set to <code class="code">NULL</code> initially)
</p>
<p><var class="var">cert_type</var>: A value of gnutls_certificate_type_t which indicates the type of certificate to look for
</p>
<p><var class="var">cert_url</var>: The certificate URL of the pair (may be <code class="code">NULL</code> )
</p>
<p><var class="var">key_url</var>: The key URL of the pair (may be <code class="code">NULL</code> )
</p>
<p><var class="var">label</var>: The friendly name (if any) of the pair (may be <code class="code">NULL</code> )
</p>
<p><var class="var">der</var>: if non-NULL the DER data of the certificate
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will return on each call a certificate
and key pair URLs, as well as a label associated with them,
and the DER-encoded certificate. When the iteration is complete it will
return <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> .
</p>
<p>Typically <code class="code">cert_type</code> should be <code class="code">GNUTLS_CRT_X509</code> .
</p>
<p>All values set are allocated and must be cleared using <code class="code">gnutls_free()</code> ,
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fsystem_005fkey_005fiter_005fdeinit">gnutls_system_key_iter_deinit</a> (gnutls_system_key_iter_t <var class="var">iter</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsystem_005fkey_005fadd_005fx509">gnutls_system_key_add_x509</a> (gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_privkey_t <var class="var">privkey</var>, const char * <var class="var">label</var>, char ** <var class="var">cert_url</var>, char ** <var class="var">key_url</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsystem_005fkey_005fdelete">gnutls_system_key_delete</a> (const char * <var class="var">cert_url</var>, const char * <var class="var">key_url</var>)</code></dt>
</dl>
</div>
<div class="subsection-level-extent" id="Application_002dspecific-keys-1">
<h4 class="subsection"><span>5.2.2 Application-specific keys<a class="copiable-link" href="#Application_002dspecific-keys-1"> ¶</a></span></h4>
<p>For systems where GnuTLS doesn’t provide a system specific store,
it may often be desirable to define a custom class of keys
that are identified via URLs and available to GnuTLS calls such as <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2">gnutls_certificate_set_x509_key_file2</a>.
Such keys can be registered using the API in <code class="code">gnutls/urls.h</code>. The function
which registers such keys is <a class="ref" href="#gnutls_005fregister_005fcustom_005furl">gnutls_register_custom_url</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fregister_005fcustom_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_register_custom_url</strong> <code class="def-code-arguments">(const gnutls_custom_url_st * <var class="var">st</var>)</code><a class="copiable-link" href="#index-gnutls_005fregister_005fcustom_005furl"> ¶</a></span></dt>
<dd><p><var class="var">st</var>: A <code class="code">gnutls_custom_url_st</code> structure
</p>
<p>Register a custom URL. This will affect the following functions:
<code class="code">gnutls_url_is_supported()</code> , <code class="code">gnutls_privkey_import_url()</code> ,
gnutls_pubkey_import_url, <code class="code">gnutls_x509_crt_import_url()</code>
and all functions that depend on
them, e.g., <code class="code">gnutls_certificate_set_x509_key_file2()</code> .
</p>
<p>The provided structure and callback functions must be valid throughout
the lifetime of the process. The registration of an existing URL type
will fail with <code class="code">GNUTLS_E_INVALID_REQUEST</code> . Since GnuTLS 3.5.0 this function
can be used to override the builtin URLs.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> returns zero if the given structure was imported or a negative value otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<p>The input to this function are three callback functions as well as
the prefix of the URL, (e.g., "mypkcs11:") and the length of the prefix.
The types of the callbacks are shown below, and are expected to
use the exported gnutls functions to import the keys and certificates.
E.g., a typical <code class="code">import_key</code> callback should use <a class="ref" href="#gnutls_005fprivkey_005fimport_005fext4">gnutls_privkey_import_ext4</a>.
</p>
<div class="example">
<pre class="example-preformatted">typedef int (*gnutls_privkey_import_url_func)(gnutls_privkey_t pkey,
const char *url,
unsigned flags);
typedef int (*gnutls_x509_crt_import_url_func)(gnutls_x509_crt_t pkey,
const char *url,
unsigned flags);
/* The following callbacks are optional */
/* This is to enable gnutls_pubkey_import_url() */
typedef int (*gnutls_pubkey_import_url_func)(gnutls_pubkey_t pkey,
const char *url, unsigned flags);
/* This is to allow constructing a certificate chain. It will be provided
* the initial certificate URL and the certificate to find its issuer, and must
* return zero and the DER encoding of the issuer's certificate. If not available,
* it should return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE. */
typedef int (*gnutls_get_raw_issuer_func)(const char *url, gnutls_x509_crt_t crt,
gnutls_datum_t *issuer_der, unsigned flags);
typedef struct custom_url_st {
const char *name;
unsigned name_size;
gnutls_privkey_import_url_func import_key;
gnutls_x509_crt_import_url_func import_crt;
gnutls_pubkey_import_url_func import_pubkey;
gnutls_get_raw_issuer_func get_issuer;
} gnutls_custom_url_st;
</pre></div>
<hr>
</div>
</div>
<div class="section-level-extent" id="Smart-cards-and-HSMs">
<div class="nav-panel">
<p>
Next: <a href="#Trusted-Platform-Module" accesskey="n" rel="next">Trusted Platform Module (TPM)</a>, Previous: <a href="#Application_002dspecific-keys" accesskey="p" rel="prev">System and application-specific keys</a>, Up: <a href="#Hardware-security-modules-and-abstract-key-types" accesskey="u" rel="up">Abstract key types and Hardware security modules</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Smart-cards-and-HSMs-1"><span>5.3 Smart cards and HSMs<a class="copiable-link" href="#Smart-cards-and-HSMs-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-PKCS-_002311-tokens"></a>
<a class="index-entry-id" id="index-hardware-tokens"></a>
<a class="index-entry-id" id="index-hardware-security-modules"></a>
<a class="index-entry-id" id="index-smart-cards"></a>
<p>In this section we present the smart-card and hardware security module (HSM) support
in <abbr class="acronym">GnuTLS</abbr> using <abbr class="acronym">PKCS</abbr> #11 [<a class="ref" href="#PKCS11">PKCS11</a>]. Hardware security
modules and smart cards provide a way to store private keys and perform
operations on them without exposing them. This decouples cryptographic
keys from the applications that use them and provide an additional
security layer against cryptographic key extraction.
Since this can also be achieved in software components such as in Gnome keyring,
we will use the term security module to describe any cryptographic key
separation subsystem.
</p>
<p><abbr class="acronym">PKCS</abbr> #11 is plugin API allowing applications to access cryptographic
operations on a security module, as well as to objects residing on it. PKCS
#11 modules exist for hardware tokens such as smart cards<a class="footnote" id="DOCF9" href="#FOOT9"><sup>9</sup></a>,
cryptographic tokens, as well as for software modules like <abbr class="acronym">Gnome Keyring</abbr>.
The objects residing on a security module may be certificates, public keys,
private keys or secret keys. Of those certificates and public/private key
pairs can be used with <abbr class="acronym">GnuTLS</abbr>. PKCS #11’s main advantage is that
it allows operations on private key objects such as decryption
and signing without exposing the key. In GnuTLS the PKCS #11 functionality is
available in <code class="code">gnutls/pkcs11.h</code>.
</p>
<div class="float" id="fig_002dpkcs11_002dvision">
<img class="image" src="pkcs11-vision.png" alt="pkcs11-vision">
<div class="caption"><p><strong class="strong">Figure 5.1: </strong>PKCS #11 module usage.</p></div></div>
<ul class="mini-toc">
<li><a href="#PKCS11-Initialization" accesskey="1">Initialization</a></li>
<li><a href="#PKCS11-Manual-Initialization" accesskey="2">Manual initialization of user-specific modules</a></li>
<li><a href="#Accessing-objects-that-require-a-PIN" accesskey="3">Accessing objects that require a PIN</a></li>
<li><a href="#Reading-objects" accesskey="4">Reading objects</a></li>
<li><a href="#Writing-objects" accesskey="5">Writing objects</a></li>
<li><a href="#PKCS11-Low-Level-Access" accesskey="6">Low Level Access</a></li>
<li><a href="#Using-a-PKCS11-token-with-TLS" accesskey="7">Using a <abbr class="acronym">PKCS</abbr> #11 token with TLS</a></li>
<li><a href="#Verifying-certificates-over-PKCS11" accesskey="8">Verifying certificates over <abbr class="acronym">PKCS</abbr> #11</a></li>
<li><a href="#p11tool-Invocation" accesskey="9">Invoking p11tool</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="PKCS11-Initialization">
<div class="nav-panel">
<p>
Next: <a href="#PKCS11-Manual-Initialization" accesskey="n" rel="next">Manual initialization of user-specific modules</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Initialization-1"><span>5.3.1 Initialization<a class="copiable-link" href="#Initialization-1"> ¶</a></span></h4>
<p>To allow all <abbr class="acronym">GnuTLS</abbr> applications to transparently access smart cards
and tokens, <abbr class="acronym">PKCS</abbr> #11 is automatically initialized during the first
call of a <abbr class="acronym">PKCS</abbr> #11 related function, in a thread safe way.
The default initialization process, utilizes p11-kit configuration, and loads any
appropriate <abbr class="acronym">PKCS</abbr> #11 modules. The p11-kit configuration
files<a class="footnote" id="DOCF10" href="#FOOT10"><sup>10</sup></a> are typically stored in <code class="code">/etc/pkcs11/modules/</code>.
For example a file that will instruct GnuTLS to load the <abbr class="acronym">OpenSC</abbr> module,
could be named <code class="code">/etc/pkcs11/modules/opensc.module</code> and contain the following:
</p>
<div class="example">
<pre class="example-preformatted">module: /usr/lib/opensc-pkcs11.so
</pre></div>
<p>If you use these configuration files, then there is no need for other initialization in
<abbr class="acronym">GnuTLS</abbr>, except for the PIN and token callbacks (see next section).
In several cases, however, it is desirable to limit badly behaving modules
(e.g., modules that add an unacceptable delay on initialization)
to single applications. That can be done using the “enable-in:” option
followed by the base name of applications that this module should be used.
</p>
<p>It is also possible to manually initialize or even disable the PKCS #11 subsystem if the
default settings are not desirable or not available (see <a class="ref" href="#PKCS11-Manual-Initialization">Manual initialization of user-specific modules</a>
for more information).
</p>
<p>Note that, PKCS #11 modules behave in a peculiar way after a fork; they
require a reinitialization of all the used PKCS #11 resources.
While GnuTLS automates that process, there are corner cases where
it is not possible to handle it correctly in an automated way<a class="footnote" id="DOCF11" href="#FOOT11"><sup>11</sup></a>. For that, it is
recommended not to mix fork() and PKCS #11 module usage. It is recommended
to initialize and use any PKCS #11 resources in a single process.
</p>
<p>Older versions of <abbr class="acronym">GnuTLS</abbr> required to call <a class="ref" href="#gnutls_005fpkcs11_005freinit">gnutls_pkcs11_reinit</a>
after a fork() call; since 3.3.0 this is no longer required.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="PKCS11-Manual-Initialization">
<div class="nav-panel">
<p>
Next: <a href="#Accessing-objects-that-require-a-PIN" accesskey="n" rel="next">Accessing objects that require a PIN</a>, Previous: <a href="#PKCS11-Initialization" accesskey="p" rel="prev">Initialization</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Manual-initialization-of-user_002dspecific-modules"><span>5.3.2 Manual initialization of user-specific modules<a class="copiable-link" href="#Manual-initialization-of-user_002dspecific-modules"> ¶</a></span></h4>
<p>In systems where one cannot rely on a globally available p11-kit configuration
to be available, it is still possible to utilize PKCS #11 objects. That
can be done by loading directly the PKCS #11 shared module in the
application using <a class="ref" href="#gnutls_005fpkcs11_005fadd_005fprovider">gnutls_pkcs11_add_provider</a>, after having
called <a class="ref" href="#gnutls_005fpkcs11_005finit">gnutls_pkcs11_init</a> specifying the <code class="code">GNUTLS_PKCS11_FLAG_MANUAL</code>
flag.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fadd_005fprovider"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_add_provider</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>, const char * <var class="var">params</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fadd_005fprovider"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: The filename of the module
</p>
<p><var class="var">params</var>: should be NULL or a known string (see description)
</p>
<p>This function will load and add a PKCS 11 module to the module
list used in gnutls. After this function is called the module will
be used for PKCS 11 operations.
</p>
<p>When loading a module to be used for certificate verification,
use the string ’trusted’ as <code class="code">params</code> .
</p>
<p>Note that this function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<p>In that case, the application will only have access to the modules explicitly
loaded. If the <code class="code">GNUTLS_PKCS11_FLAG_MANUAL</code> flag is specified and no calls
to <a class="ref" href="#gnutls_005fpkcs11_005fadd_005fprovider">gnutls_pkcs11_add_provider</a> are made, then the PKCS #11 functionality
is effectively disabled.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_init</strong> <code class="def-code-arguments">(unsigned int <var class="var">flags</var>, const char * <var class="var">deprecated_config_file</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005finit"> ¶</a></span></dt>
<dd><p><var class="var">flags</var>: An ORed sequence of <code class="code">GNUTLS_PKCS11_FLAG_</code> *
</p>
<p><var class="var">deprecated_config_file</var>: either NULL or the location of a deprecated
configuration file
</p>
<p>This function will initialize the PKCS 11 subsystem in gnutls. It will
read configuration files if <code class="code">GNUTLS_PKCS11_FLAG_AUTO</code> is used or allow
you to independently load PKCS 11 modules using <code class="code">gnutls_pkcs11_add_provider()</code>
if <code class="code">GNUTLS_PKCS11_FLAG_MANUAL</code> is specified.
</p>
<p>You don’t need to call this function since GnuTLS 3.3.0 because it is being called
during the first request PKCS 11 operation. That call will assume the <code class="code">GNUTLS_PKCS11_FLAG_AUTO</code>
flag. If another flags are required then it must be called independently
prior to any PKCS 11 operation.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="Accessing-objects-that-require-a-PIN">
<div class="nav-panel">
<p>
Next: <a href="#Reading-objects" accesskey="n" rel="next">Reading objects</a>, Previous: <a href="#PKCS11-Manual-Initialization" accesskey="p" rel="prev">Manual initialization of user-specific modules</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Accessing-objects-that-require-a-PIN-1"><span>5.3.3 Accessing objects that require a PIN<a class="copiable-link" href="#Accessing-objects-that-require-a-PIN-1"> ¶</a></span></h4>
<p>Objects stored in token such as a private keys are typically protected
from access by a PIN or password. This PIN may be required to either read
the object (if allowed) or to perform operations with it. To allow obtaining
the PIN when accessing a protected object, as well as probe
the user to insert the token the following functions allow to set a callback.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpkcs11_005fset_005ftoken_005ffunction">gnutls_pkcs11_set_token_function</a> (gnutls_pkcs11_token_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpkcs11_005fset_005fpin_005ffunction">gnutls_pkcs11_set_pin_function</a> (gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005fadd_005fprovider">gnutls_pkcs11_add_provider</a> (const char * <var class="var">name</var>, const char * <var class="var">params</var>)</code></dt>
<dt><code class="code"><var class="var">gnutls_pin_callback_t</var> <a class="ref" href="#gnutls_005fpkcs11_005fget_005fpin_005ffunction">gnutls_pkcs11_get_pin_function</a> (void ** <var class="var">userdata</var>)</code></dt>
</dl>
<p>The callback is of type <code class="code">gnutls_pin_callback_t</code> and will have as
input the provided userdata, the PIN attempt number, a URL describing the
token, a label describing the object and flags. The PIN must be at most
of <code class="code">pin_max</code> size and must be copied to pin variable. The function must
return 0 on success or a negative error code otherwise.
</p>
<pre class="verbatim">typedef int (*gnutls_pin_callback_t) (void *userdata, int attempt,
const char *token_url,
const char *token_label,
unsigned int flags,
char *pin, size_t pin_max);
</pre>
<p>The flags are of <code class="code">gnutls_pin_flag_t</code> type and are explained below.
</p>
<div class="float" id="gnutls_005fpin_005fflag_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_PIN_USER</code></dt>
<dd><p>The PIN for the user.
</p></dd>
<dt><code class="code">GNUTLS_PIN_SO</code></dt>
<dd><p>The PIN for the security officer (admin).
</p></dd>
<dt><code class="code">GNUTLS_PIN_FINAL_TRY</code></dt>
<dd><p>This is the final try before blocking.
</p></dd>
<dt><code class="code">GNUTLS_PIN_COUNT_LOW</code></dt>
<dd><p>Few tries remain before token blocks.
</p></dd>
<dt><code class="code">GNUTLS_PIN_CONTEXT_SPECIFIC</code></dt>
<dd><p>The PIN is for a specific action and key like signing.
</p></dd>
<dt><code class="code">GNUTLS_PIN_WRONG</code></dt>
<dd><p>Last given PIN was not correct.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 5.2: </strong>The <code class="code">gnutls_pin_flag_t</code> enumeration.</p></div></div>
<p>Note that due to limitations of <abbr class="acronym">PKCS</abbr> #11 there are issues when multiple libraries
are sharing a module. To avoid this problem GnuTLS uses <abbr class="acronym">p11-kit</abbr>
that provides a middleware to control access to resources over the
multiple users.
</p>
<p>To avoid conflicts with multiple registered callbacks for PIN functions,
<a class="ref" href="#gnutls_005fpkcs11_005fget_005fpin_005ffunction">gnutls_pkcs11_get_pin_function</a> may be used to check for any previously
set functions. In addition context specific PIN functions are allowed, e.g., by
using functions below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fpin_005ffunction">gnutls_certificate_set_pin_function</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpubkey_005fset_005fpin_005ffunction">gnutls_pubkey_set_pin_function</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fprivkey_005fset_005fpin_005ffunction">gnutls_privkey_set_pin_function</a> (gnutls_privkey_t <var class="var">key</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpkcs11_005fobj_005fset_005fpin_005ffunction">gnutls_pkcs11_obj_set_pin_function</a> (gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fset_005fpin_005ffunction">gnutls_x509_crt_set_pin_function</a> (gnutls_x509_crt_t <var class="var">crt</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Reading-objects">
<div class="nav-panel">
<p>
Next: <a href="#Writing-objects" accesskey="n" rel="next">Writing objects</a>, Previous: <a href="#Accessing-objects-that-require-a-PIN" accesskey="p" rel="prev">Accessing objects that require a PIN</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Reading-objects-1"><span>5.3.4 Reading objects<a class="copiable-link" href="#Reading-objects-1"> ¶</a></span></h4>
<p>All <abbr class="acronym">PKCS</abbr> #11 objects are referenced by <abbr class="acronym">GnuTLS</abbr> functions by
URLs as described in [<a class="ref" href="#PKCS11URI">PKCS11URI</a>].
This allows for a consistent naming of objects across systems and applications
in the same system. For example a public
key on a smart card may be referenced as:
</p>
<div class="example">
<pre class="example-preformatted">pkcs11:token=Nikos;serial=307521161601031;model=PKCS%2315; \
manufacturer=EnterSafe;object=test1;type=public;\
id=32f153f3e37990b08624141077ca5dec2d15faed
</pre></div>
<p>while the smart card itself can be referenced as:
</p><div class="example">
<pre class="example-preformatted">pkcs11:token=Nikos;serial=307521161601031;model=PKCS%2315;manufacturer=EnterSafe
</pre></div>
<p>Objects stored in a <abbr class="acronym">PKCS</abbr> #11 token can typically be extracted
if they are not marked as sensitive. Usually only private keys are marked as
sensitive and cannot be extracted, while certificates and other data can
be retrieved. The functions that can be used to enumerate and access objects
are shown below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl4">gnutls_pkcs11_obj_list_import_url4</a> (gnutls_pkcs11_obj_t ** <var class="var">p_list</var>, unsigned int * <var class="var">n_list</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005fobj_005fimport_005furl">gnutls_pkcs11_obj_import_url</a> (gnutls_pkcs11_obj_t <var class="var">obj</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005fobj_005fexport_005furl">gnutls_pkcs11_obj_export_url</a> (gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_pkcs11_url_type_t <var class="var">detailed</var>, char ** <var class="var">url</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fget_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_get_info</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_pkcs11_obj_info_t <var class="var">itype</var>, void * <var class="var">output</var>, size_t * <var class="var">output_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fget_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: should contain a <code class="code">gnutls_pkcs11_obj_t</code> type
</p>
<p><var class="var">itype</var>: Denotes the type of information requested
</p>
<p><var class="var">output</var>: where output will be stored
</p>
<p><var class="var">output_size</var>: contains the maximum size of the output buffer and will be
overwritten with the actual size.
</p>
<p>This function will return information about the PKCS11 certificate
such as the label, id as well as token information where the key is
stored.
</p>
<p>When output is text, a null terminated string is written to <code class="code">output</code> and its
string length is written to <code class="code">output_size</code> (without null terminator). If the
buffer is too small, <code class="code">output_size</code> will contain the expected buffer size
(with null terminator for text) and return <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> .
</p>
<p>In versions previously to 3.6.0 this function included the null terminator
to <code class="code">output_size</code> . After 3.6.0 the output size doesn’t include the terminator character.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fimport_005fpkcs11">gnutls_x509_crt_import_pkcs11</a> (gnutls_x509_crt_t <var class="var">crt</var>, gnutls_pkcs11_obj_t <var class="var">pkcs11_crt</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005fimport_005furl">gnutls_x509_crt_import_url</a> (gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fx509_005fcrt_005flist_005fimport_005fpkcs11">gnutls_x509_crt_list_import_pkcs11</a> (gnutls_x509_crt_t * <var class="var">certs</var>, unsigned int <var class="var">cert_max</var>, gnutls_pkcs11_obj_t *const <var class="var">objs</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<p>Properties of the physical token can also be accessed and altered with <abbr class="acronym">GnuTLS</abbr>.
For example data in a token can be erased (initialized), PIN can be altered, etc.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005ftoken_005finit">gnutls_pkcs11_token_init</a> (const char * <var class="var">token_url</var>, const char * <var class="var">so_pin</var>, const char * <var class="var">label</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005ftoken_005fget_005furl">gnutls_pkcs11_token_get_url</a> (unsigned int <var class="var">seq</var>, gnutls_pkcs11_url_type_t <var class="var">detailed</var>, char ** <var class="var">url</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005ftoken_005fget_005finfo">gnutls_pkcs11_token_get_info</a> (const char * <var class="var">url</var>, gnutls_pkcs11_token_info_t <var class="var">ttype</var>, void * <var class="var">output</var>, size_t * <var class="var">output_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005ftoken_005fget_005fflags">gnutls_pkcs11_token_get_flags</a> (const char * <var class="var">url</var>, unsigned int * <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs11_005ftoken_005fset_005fpin">gnutls_pkcs11_token_set_pin</a> (const char * <var class="var">token_url</var>, const char * <var class="var">oldpin</var>, const char * <var class="var">newpin</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<p>The following examples demonstrate the usage of the API. The first example
will list all available PKCS #11 tokens in a system and the latter will
list all certificates in a token that have a corresponding private key.
</p>
<div class="example">
<pre class="example-preformatted">int i;
char* url;
gnutls_global_init();
for (i=0;;i++)
{
ret = gnutls_pkcs11_token_get_url(i, &url);
if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
break;
if (ret < 0)
exit(1);
fprintf(stdout, "Token[%d]: URL: %s\n", i, url);
gnutls_free(url);
}
gnutls_global_deinit();
</pre></div>
<pre class="verbatim">/* This example code is placed in the public domain. */
#include <config.h>
#include <gnutls/gnutls.h>
#include <gnutls/pkcs11.h>
#include <stdio.h>
#include <stdlib.h>
#define URL "pkcs11:URL"
int main(int argc, char **argv)
{
gnutls_pkcs11_obj_t *obj_list;
gnutls_x509_crt_t xcrt;
unsigned int obj_list_size = 0;
gnutls_datum_t cinfo;
int ret;
unsigned int i;
ret = gnutls_pkcs11_obj_list_import_url4(
&obj_list, &obj_list_size, URL,
GNUTLS_PKCS11_OBJ_FLAG_CRT |
GNUTLS_PKCS11_OBJ_FLAG_WITH_PRIVKEY);
if (ret < 0)
return -1;
/* now all certificates are in obj_list */
for (i = 0; i < obj_list_size; i++) {
gnutls_x509_crt_init(&xcrt);
gnutls_x509_crt_import_pkcs11(xcrt, obj_list[i]);
gnutls_x509_crt_print(xcrt, GNUTLS_CRT_PRINT_FULL, &cinfo);
fprintf(stdout, "cert[%d]:\n %s\n\n", i, cinfo.data);
gnutls_free(cinfo.data);
gnutls_x509_crt_deinit(xcrt);
}
for (i = 0; i < obj_list_size; i++)
gnutls_pkcs11_obj_deinit(obj_list[i]);
gnutls_free(obj_list);
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Writing-objects">
<div class="nav-panel">
<p>
Next: <a href="#PKCS11-Low-Level-Access" accesskey="n" rel="next">Low Level Access</a>, Previous: <a href="#Reading-objects" accesskey="p" rel="prev">Reading objects</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Writing-objects-1"><span>5.3.5 Writing objects<a class="copiable-link" href="#Writing-objects-1"> ¶</a></span></h4>
<p>With <abbr class="acronym">GnuTLS</abbr> you can copy existing private keys and certificates
to a token. Note that when copying private keys it is recommended to mark
them as sensitive using the <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE</code>
to prevent its extraction. An object can be marked as private using the flag
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE</code>, to require PIN to be
entered before accessing the object (for operations or otherwise).
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_x509_privkey2</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_x509_privkey_t <var class="var">key</var>, const char * <var class="var">label</var>, const gnutls_datum_t * <var class="var">cid</var>, unsigned int <var class="var">key_usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">key</var>: A private key
</p>
<p><var class="var">label</var>: A name to be used for the stored data
</p>
<p><var class="var">cid</var>: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
</p>
<p><var class="var">key_usage</var>: One of GNUTLS_KEY_*
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will copy a private key into a PKCS <code class="code">11</code> token specified by
a URL.
</p>
<p>Since 3.6.3 the objects are marked as sensitive by default unless
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_SENSITIVE</code> is specified.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_x509_crt2</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">label</var>, const gnutls_datum_t * <var class="var">cid</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">crt</var>: The certificate to copy
</p>
<p><var class="var">label</var>: The name to be used for the stored data
</p>
<p><var class="var">cid</var>: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_FLAG_*
</p>
<p>This function will copy a certificate into a PKCS <code class="code">11</code> token specified by
a URL. Valid flags to mark the certificate: <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_CA</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_ALWAYS_AUTH</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fdelete_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_delete_url</strong> <code class="def-code-arguments">(const char * <var class="var">object_url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fdelete_005furl"> ¶</a></span></dt>
<dd><p><var class="var">object_url</var>: The URL of the object to delete.
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will delete objects matching the given URL.
Note that not all tokens support the delete operation.
</p>
<p><strong class="strong">Returns:</strong> On success, the number of objects deleted is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="PKCS11-Low-Level-Access">
<div class="nav-panel">
<p>
Next: <a href="#Using-a-PKCS11-token-with-TLS" accesskey="n" rel="next">Using a <abbr class="acronym">PKCS</abbr> #11 token with TLS</a>, Previous: <a href="#Writing-objects" accesskey="p" rel="prev">Writing objects</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Low-Level-Access"><span>5.3.6 Low Level Access<a class="copiable-link" href="#Low-Level-Access"> ¶</a></span></h4>
<p>When it is needed to use PKCS#11 functionality which is not wrapped by
GnuTLS, it is possible to extract the PKCS#11 session, object or token pointers.
That allows an application to still access the low-level functionality,
while at the same time take advantage of the URI addressing scheme supported
by GnuTLS.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fget_005fptr"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_get_ptr</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, void ** <var class="var">ptr</var>, unsigned long * <var class="var">slot_id</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: should contain a PKCS<code class="code">11</code> URL identifying a token
</p>
<p><var class="var">ptr</var>: will contain the CK_FUNCTION_LIST_PTR pointer
</p>
<p><var class="var">slot_id</var>: will contain the slot_id (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will return the function pointer of the specified
token by the URL. The returned pointers are valid until
gnutls is deinitialized, c.f. <code class="code">_global_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fget_005fptr"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_get_ptr</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, void ** <var class="var">ptr</var>, void ** <var class="var">session</var>, void ** <var class="var">ohandle</var>, unsigned long * <var class="var">slot_id</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fget_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: should contain a <code class="code">gnutls_pkcs11_obj_t</code> type
</p>
<p><var class="var">ptr</var>: will contain the CK_FUNCTION_LIST_PTR pointer (may be <code class="code">NULL</code> )
</p>
<p><var class="var">session</var>: will contain the CK_SESSION_HANDLE of the object
</p>
<p><var class="var">ohandle</var>: will contain the CK_OBJECT_HANDLE of the object
</p>
<p><var class="var">slot_id</var>: the identifier of the slot (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: Or sequence of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>Obtains the PKCS<code class="code">11</code> session handles of an object. <code class="code">session</code> and <code class="code">ohandle</code> must be deinitialized by the caller. The returned pointers are
independent of the <code class="code">obj</code> lifetime.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="Using-a-PKCS11-token-with-TLS">
<div class="nav-panel">
<p>
Next: <a href="#Verifying-certificates-over-PKCS11" accesskey="n" rel="next">Verifying certificates over <abbr class="acronym">PKCS</abbr> #11</a>, Previous: <a href="#PKCS11-Low-Level-Access" accesskey="p" rel="prev">Low Level Access</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Using-a-PKCS-_002311-token-with-TLS"><span>5.3.7 Using a <abbr class="acronym">PKCS</abbr> #11 token with TLS<a class="copiable-link" href="#Using-a-PKCS-_002311-token-with-TLS"> ¶</a></span></h4>
<p>It is possible to use a <abbr class="acronym">PKCS</abbr> #11 token to a TLS
session, as shown in <a class="ref" href="#ex_002dpkcs11_002dclient">ex-pkcs11-client</a>. In addition
the following functions can be used to load PKCS #11 key and
certificates by specifying a PKCS #11 URL instead of a filename.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile">gnutls_certificate_set_x509_trust_file</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">cafile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2">gnutls_certificate_set_x509_key_file2</a> (gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">certfile</var>, const char * <var class="var">keyfile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Verifying-certificates-over-PKCS11">
<div class="nav-panel">
<p>
Next: <a href="#p11tool-Invocation" accesskey="n" rel="next">Invoking p11tool</a>, Previous: <a href="#Using-a-PKCS11-token-with-TLS" accesskey="p" rel="prev">Using a <abbr class="acronym">PKCS</abbr> #11 token with TLS</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Verifying-certificates-over-PKCS-_002311"><span>5.3.8 Verifying certificates over <abbr class="acronym">PKCS</abbr> #11<a class="copiable-link" href="#Verifying-certificates-over-PKCS-_002311"> ¶</a></span></h4>
<p>The <abbr class="acronym">PKCS</abbr> #11 API can be used to allow all applications in the
same operating system to access shared cryptographic keys and certificates in a
uniform way, as in <a class="ref" href="#fig_002dpkcs11_002dvision">Figure 5.1</a>. That way applications could load their
trusted certificate list, as well as user certificates from a common PKCS #11 module.
Such a provider is the p11-kit trust storage module<a class="footnote" id="DOCF12" href="#FOOT12"><sup>12</sup></a>
and it provides access to the trusted Root CA certificates in a system. That
provides a more dynamic list of Root CA certificates, as opposed to a static
list in a file or directory.
</p>
<p>That store, allows for distrusting of CAs or certificates, as well as
categorization of the Root CAs (Web verification, Code signing, etc.), in
addition to restricting their purpose via stapled extensions<a class="footnote" id="DOCF13" href="#FOOT13"><sup>13</sup></a>.
GnuTLS will utilize the p11-kit trust module as the default trust store
if configured to; i.e., if ’–with-default-trust-store-pkcs11=pkcs11:’ is given to
the configure script.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="p11tool-Invocation">
<div class="nav-panel">
<p>
Previous: <a href="#Verifying-certificates-over-PKCS11" accesskey="p" rel="prev">Verifying certificates over <abbr class="acronym">PKCS</abbr> #11</a>, Up: <a href="#Smart-cards-and-HSMs" accesskey="u" rel="up">Smart cards and HSMs</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Invoking-p11tool"><span>5.3.9 Invoking p11tool<a class="copiable-link" href="#Invoking-p11tool"> ¶</a></span></h4>
<a class="index-entry-id" id="index-p11tool"></a>
<p>Program that allows operations on PKCS #11 smart cards
and security modules.
</p>
<p>To use PKCS #11 tokens with GnuTLS the p11-kit configuration files need to be setup.
That is create a .module file in /etc/pkcs11/modules with the contents ’module: /path/to/pkcs11.so’.
Alternatively the configuration file /etc/gnutls/pkcs11.conf has to exist and contain a number
of lines of the form ’load=/usr/lib/opensc-pkcs11.so’.
</p>
<p>You can provide the PIN to be used for the PKCS #11 operations with the environment variables
GNUTLS_PIN and GNUTLS_SO_PIN.
</p>
<a class="anchor" id="p11tool-usage"></a><h4 class="subsubheading" id="p11tool-help_002fusage-_0028_002d_003f_0029"><span>p11tool help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#p11tool-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-p11tool-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">p11tool - GnuTLS PKCS #11 tool
Usage: p11tool [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [url]
None:
Tokens:
--list-tokens List all available tokens
--list-token-urls List the URLs available tokens
--list-mechanisms List all available mechanisms in a token
--initialize Initializes a PKCS #11 token
--initialize-pin Initializes/Resets a PKCS #11 token user PIN
--initialize-so-pin Initializes/Resets a PKCS #11 token security officer PIN
--set-pin=str Specify the PIN to use on token operations
--set-so-pin=str Specify the Security Officer's PIN to use on token initialization
Object listing:
--list-all List all available objects in a token
--list-all-certs List all available certificates in a token
--list-certs List all certificates that have an associated private key
--list-all-privkeys List all available private keys in a token
--list-privkeys an alias for the 'list-all-privkeys' option
--list-keys an alias for the 'list-all-privkeys' option
--list-all-trusted List all available certificates marked as trusted
--export Export the object specified by the URL
- prohibits these options:
export-stapled
export-chain
export-pubkey
--export-stapled Export the certificate object specified by the URL
- prohibits these options:
export
export-chain
export-pubkey
--export-chain Export the certificate specified by the URL and its chain of trust
- prohibits these options:
export-stapled
export
export-pubkey
--export-pubkey Export the public key for a private key
- prohibits these options:
export-stapled
export
export-chain
--info List information on an available object in a token
--trusted an alias for the 'mark-trusted' option
--distrusted an alias for the 'mark-distrusted' option
Key generation:
--generate-privkey=str Generate private-public key pair of given type
--bits=num Specify the number of bits for the key generate
--curve=str Specify the curve used for EC key generation
--sec-param=str Specify the security level
Writing objects:
--set-id=str Set the CKA_ID (in hex) for the specified by the URL object
- prohibits the option 'write'
--set-label=str Set the CKA_LABEL for the specified by the URL object
- prohibits these options:
write
set-id
--write Writes the loaded objects to a PKCS #11 token
--delete Deletes the objects matching the given PKCS #11 URL
--label=str Sets a label for the write operation
--id=str Sets an ID for the write operation
--mark-wrap Marks the generated key to be a wrapping key
--mark-trusted Marks the object to be written as trusted
- prohibits the option 'mark-distrusted'
--mark-distrusted When retrieving objects, it requires the objects to be distrusted
- prohibits the option 'mark-trusted'
--mark-decrypt Marks the object to be written for decryption
--mark-sign Marks the object to be written for signature generation
--mark-ca Marks the object to be written as a CA
--mark-private Marks the object to be written as private
--ca an alias for the 'mark-ca' option
--private an alias for the 'mark-private' option
--mark-always-authenticate Marks the object to be written as always authenticate
--secret-key=str Provide a hex encoded secret key
--load-privkey=file Private key file to use
- file must pre-exist
--load-pubkey=file Public key file to use
- file must pre-exist
--load-certificate=file Certificate file to use
- file must pre-exist
Other options:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
--outfile=str Output file
--login Force (user) login to token
--so-login Force security officer login to token
--admin-login an alias for the 'so-login' option
--test-sign Tests the signature operation of the provided object
--sign-params=str Sign with a specific signature algorithm
--hash=str Hash algorithm to use for signing
--generate-random=num Generate random data
-8, --pkcs8 Use PKCS #8 format for private keys
--inder Use DER/RAW format for input
--inraw an alias for the 'inder' option
--outder Use DER format for output certificates, private keys, and DH parameters
--outraw an alias for the 'outder' option
--provider=file Specify the PKCS #11 provider library
--detailed-url Print detailed URLs
--only-urls Print a compact listing using only the URLs
--batch Disable all interaction with the tool
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Operands and options may be intermixed. They will be reordered.
Program that allows operations on PKCS #11 smart cards
and security modules.
To use PKCS #11 tokens with GnuTLS the p11-kit configuration files need to be setup.
That is create a .module file in /etc/pkcs11/modules with the contents 'module: /path/to/pkcs11.so'.
Alternatively the configuration file /etc/gnutls/pkcs11.conf has to exist and contain a number
of lines of the form 'load=/usr/lib/opensc-pkcs11.so'.
You can provide the PIN to be used for the PKCS #11 operations with the environment variables
GNUTLS_PIN and GNUTLS_SO_PIN.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<a class="anchor" id="p11tool-token_002drelated_002doptions"></a><h4 class="subsubheading" id="token_002drelated_002doptions-options"><span>token-related-options options<a class="copiable-link" href="#token_002drelated_002doptions-options"> ¶</a></span></h4>
<p>Tokens.
</p><h4 class="subsubheading" id="list_002dtoken_002durls-option_002e"><span>list-token-urls option.<a class="copiable-link" href="#list_002dtoken_002durls-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-list_002dtoken_002durls"></a>
<p>This is the “list the urls available tokens” option.
This is a more compact version of –list-tokens.
</p><h4 class="subsubheading" id="initialize_002dso_002dpin-option_002e"><span>initialize-so-pin option.<a class="copiable-link" href="#initialize_002dso_002dpin-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-initialize_002dso_002dpin"></a>
<p>This is the “initializes/resets a pkcs #11 token security officer pin” option.
This initializes the security officer’s PIN. When used non-interactively use the GNUTLS_NEW_SO_PIN
environment variables to initialize SO’s PIN.
</p><h4 class="subsubheading" id="set_002dpin-option_002e"><span>set-pin option.<a class="copiable-link" href="#set_002dpin-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-set_002dpin"></a>
<p>This is the “specify the pin to use on token operations” option.
This option takes a ArgumentType.STRING argument.
Alternatively the GNUTLS_PIN environment variable may be used.
</p><h4 class="subsubheading" id="set_002dso_002dpin-option_002e"><span>set-so-pin option.<a class="copiable-link" href="#set_002dso_002dpin-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-set_002dso_002dpin"></a>
<p>This is the “specify the security officer’s pin to use on token initialization” option.
This option takes a ArgumentType.STRING argument.
Alternatively the GNUTLS_SO_PIN environment variable may be used.
<a class="anchor" id="p11tool-object_002dlist_002drelated_002doptions"></a></p><h4 class="subsubheading" id="object_002dlist_002drelated_002doptions-options"><span>object-list-related-options options<a class="copiable-link" href="#object_002dlist_002drelated_002doptions-options"> ¶</a></span></h4>
<p>Object listing.
</p><h4 class="subsubheading" id="list_002dall-option_002e"><span>list-all option.<a class="copiable-link" href="#list_002dall-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-list_002dall"></a>
<p>This is the “list all available objects in a token” option.
All objects available in the token will be listed. That includes
objects which are potentially unaccessible using this tool.
</p><h4 class="subsubheading" id="list_002dall_002dcerts-option_002e"><span>list-all-certs option.<a class="copiable-link" href="#list_002dall_002dcerts-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-list_002dall_002dcerts"></a>
<p>This is the “list all available certificates in a token” option.
That option will also provide more information on the
certificates, for example, expand the attached extensions in a trust
token (like p11-kit-trust).
</p><h4 class="subsubheading" id="list_002dcerts-option_002e"><span>list-certs option.<a class="copiable-link" href="#list_002dcerts-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-list_002dcerts"></a>
<p>This is the “list all certificates that have an associated private key” option.
That option will only display certificates which have a private
key associated with them (share the same ID).
</p><h4 class="subsubheading" id="list_002dall_002dprivkeys-option_002e"><span>list-all-privkeys option.<a class="copiable-link" href="#list_002dall_002dprivkeys-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-list_002dall_002dprivkeys"></a>
<p>This is the “list all available private keys in a token” option.
Lists all the private keys in a token that match the specified URL.
</p><h4 class="subsubheading" id="list_002dprivkeys-option_002e"><span>list-privkeys option.<a class="copiable-link" href="#list_002dprivkeys-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-list_002dprivkeys"></a>
<p>This is an alias for the <code class="code">list-all-privkeys</code> option,
see <a class="pxref" href="#p11tool-list_002dall_002dprivkeys">the list-all-privkeys option documentation</a>.
</p>
<h4 class="subsubheading" id="list_002dkeys-option_002e"><span>list-keys option.<a class="copiable-link" href="#list_002dkeys-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-list_002dkeys"></a>
<p>This is an alias for the <code class="code">list-all-privkeys</code> option,
see <a class="pxref" href="#p11tool-list_002dall_002dprivkeys">the list-all-privkeys option documentation</a>.
</p>
<h4 class="subsubheading" id="export_002dstapled-option_002e"><span>export-stapled option.<a class="copiable-link" href="#export_002dstapled-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-export_002dstapled"></a>
<p>This is the “export the certificate object specified by the url” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
export, export-chain, export-pubkey.
</li></ul>
<p>Exports the certificate specified by the URL while including any attached extensions to it.
Since attached extensions are a p11-kit extension, this option is only
available on p11-kit registered trust modules.
</p><h4 class="subsubheading" id="export_002dchain-option_002e"><span>export-chain option.<a class="copiable-link" href="#export_002dchain-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-export_002dchain"></a>
<p>This is the “export the certificate specified by the url and its chain of trust” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
export-stapled, export, export-pubkey.
</li></ul>
<p>Exports the certificate specified by the URL and generates its chain of trust based on the stored certificates in the module.
</p><h4 class="subsubheading" id="export_002dpubkey-option_002e"><span>export-pubkey option.<a class="copiable-link" href="#export_002dpubkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-export_002dpubkey"></a>
<p>This is the “export the public key for a private key” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
export-stapled, export, export-chain.
</li></ul>
<p>Exports the public key for the specified private key
</p><h4 class="subsubheading" id="trusted-option_002e"><span>trusted option.<a class="copiable-link" href="#trusted-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-trusted"></a>
<p>This is an alias for the <code class="code">mark-trusted</code> option,
see <a class="pxref" href="#p11tool-mark_002dtrusted">the mark-trusted option documentation</a>.
</p>
<h4 class="subsubheading" id="distrusted-option_002e"><span>distrusted option.<a class="copiable-link" href="#distrusted-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-distrusted"></a>
<p>This is an alias for the <code class="code">mark-distrusted</code> option,
see <a class="pxref" href="#p11tool-mark_002ddistrusted">the mark-distrusted option documentation</a>.
</p>
<a class="anchor" id="p11tool-keygen_002drelated_002doptions"></a><h4 class="subsubheading" id="keygen_002drelated_002doptions-options"><span>keygen-related-options options<a class="copiable-link" href="#keygen_002drelated_002doptions-options"> ¶</a></span></h4>
<p>Key generation.
</p><h4 class="subsubheading" id="generate_002dprivkey-option_002e"><span>generate-privkey option.<a class="copiable-link" href="#generate_002dprivkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-generate_002dprivkey"></a>
<p>This is the “generate private-public key pair of given type” option.
This option takes a ArgumentType.STRING argument.
Generates a private-public key pair in the specified token.
Acceptable types are RSA, ECDSA, Ed25519, and DSA. Should be combined with –sec-param or –bits.
</p><h4 class="subsubheading" id="generate_002drsa-option_002e"><span>generate-rsa option.<a class="copiable-link" href="#generate_002drsa-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-generate_002drsa"></a>
<p>This is the “generate an rsa private-public key pair” option.
Generates an RSA private-public key pair on the specified token.
Should be combined with –sec-param or –bits.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="generate_002ddsa-option_002e"><span>generate-dsa option.<a class="copiable-link" href="#generate_002ddsa-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-generate_002ddsa"></a>
<p>This is the “generate a dsa private-public key pair” option.
Generates a DSA private-public key pair on the specified token.
Should be combined with –sec-param or –bits.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="generate_002decc-option_002e"><span>generate-ecc option.<a class="copiable-link" href="#generate_002decc-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-generate_002decc"></a>
<p>This is the “generate an ecdsa private-public key pair” option.
Generates an ECDSA private-public key pair on the specified token.
Should be combined with –curve, –sec-param or –bits.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="bits-option_002e"><span>bits option.<a class="copiable-link" href="#bits-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-bits"></a>
<p>This is the “specify the number of bits for the key generate” option.
This option takes a ArgumentType.NUMBER argument.
For applications which have no key-size restrictions the
–sec-param option is recommended, as the sec-param levels will adapt
to the acceptable security levels with the new versions of gnutls.
</p><h4 class="subsubheading" id="curve-option_002e-1"><span>curve option.<a class="copiable-link" href="#curve-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="p11tool-curve"></a>
<p>This is the “specify the curve used for ec key generation” option.
This option takes a ArgumentType.STRING argument.
Supported values are secp192r1, secp224r1, secp256r1, secp384r1 and secp521r1.
</p><h4 class="subsubheading" id="sec_002dparam-option_002e-1"><span>sec-param option.<a class="copiable-link" href="#sec_002dparam-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="p11tool-sec_002dparam"></a>
<p>This is the “specify the security level” option.
This option takes a ArgumentType.STRING argument <samp class="file">Security parameter</samp>.
This is alternative to the bits option. Available options are [low, legacy, medium, high, ultra].
<a class="anchor" id="p11tool-write_002dobject_002drelated_002doptions"></a></p><h4 class="subsubheading" id="write_002dobject_002drelated_002doptions-options"><span>write-object-related-options options<a class="copiable-link" href="#write_002dobject_002drelated_002doptions-options"> ¶</a></span></h4>
<p>Writing objects.
</p><h4 class="subsubheading" id="set_002did-option_002e"><span>set-id option.<a class="copiable-link" href="#set_002did-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-set_002did"></a>
<p>This is the “set the cka_id (in hex) for the specified by the url object” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
write.
</li></ul>
<p>Modifies or sets the CKA_ID in the specified by the URL object. The ID should be specified in hexadecimal format without a ’0x’ prefix.
</p><h4 class="subsubheading" id="set_002dlabel-option_002e"><span>set-label option.<a class="copiable-link" href="#set_002dlabel-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-set_002dlabel"></a>
<p>This is the “set the cka_label for the specified by the url object” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
write, set-id.
</li></ul>
<p>Modifies or sets the CKA_LABEL in the specified by the URL object
</p><h4 class="subsubheading" id="write-option_002e"><span>write option.<a class="copiable-link" href="#write-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-write"></a>
<p>This is the “writes the loaded objects to a pkcs #11 token” option.
It can be used to write private, public keys, certificates or secret keys to a token. Must be combined with one of –load-privkey, –load-pubkey, –load-certificate option.
</p>
<p>When writing a certificate object, its CKA_ID is set to the same CKA_ID of the corresponding public key, if it exists on the token; otherwise it will be derived from the X.509 Subject Key Identifier of the certificate. If this behavior is undesired, write the public key to the token beforehand.
</p><h4 class="subsubheading" id="id-option_002e"><span>id option.<a class="copiable-link" href="#id-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-id"></a>
<p>This is the “sets an id for the write operation” option.
This option takes a ArgumentType.STRING argument.
Sets the CKA_ID to be set by the write operation. The ID should be specified in hexadecimal format without a ’0x’ prefix.
</p><h4 class="subsubheading" id="mark_002dwrap-option_002e"><span>mark-wrap option.<a class="copiable-link" href="#mark_002dwrap-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002dwrap"></a>
<p>This is the “marks the generated key to be a wrapping key” option.
Marks the generated key with the CKA_WRAP flag.
</p><h4 class="subsubheading" id="mark_002dtrusted-option_002e"><span>mark-trusted option.<a class="copiable-link" href="#mark_002dtrusted-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002dtrusted"></a>
<p>This is the “marks the object to be written as trusted” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
mark-distrusted.
</li><li>can be disabled with –no-mark-trusted.
</li></ul>
<p>Marks the object to be generated/written with the CKA_TRUST flag.
</p><h4 class="subsubheading" id="mark_002ddistrusted-option_002e"><span>mark-distrusted option.<a class="copiable-link" href="#mark_002ddistrusted-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002ddistrusted"></a>
<p>This is the “when retrieving objects, it requires the objects to be distrusted” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
mark-trusted.
</li></ul>
<p>Ensures that the objects retrieved have the CKA_X_TRUST flag.
This is p11-kit trust module extension, thus this flag is only valid with
p11-kit registered trust modules.
</p><h4 class="subsubheading" id="mark_002ddecrypt-option_002e"><span>mark-decrypt option.<a class="copiable-link" href="#mark_002ddecrypt-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002ddecrypt"></a>
<p>This is the “marks the object to be written for decryption” option.
Marks the object to be generated/written with the CKA_DECRYPT flag set to true.
</p><h4 class="subsubheading" id="mark_002dsign-option_002e"><span>mark-sign option.<a class="copiable-link" href="#mark_002dsign-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002dsign"></a>
<p>This is the “marks the object to be written for signature generation” option.
Marks the object to be generated/written with the CKA_SIGN flag set to true.
</p><h4 class="subsubheading" id="mark_002dca-option_002e"><span>mark-ca option.<a class="copiable-link" href="#mark_002dca-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002dca"></a>
<p>This is the “marks the object to be written as a ca” option.
Marks the object to be generated/written with the CKA_CERTIFICATE_CATEGORY as CA.
</p><h4 class="subsubheading" id="mark_002dprivate-option_002e"><span>mark-private option.<a class="copiable-link" href="#mark_002dprivate-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002dprivate"></a>
<p>This is the “marks the object to be written as private” option.
Marks the object to be generated/written with the CKA_PRIVATE flag. The written object will require a PIN to be used.
</p><h4 class="subsubheading" id="ca-option_002e-1"><span>ca option.<a class="copiable-link" href="#ca-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="p11tool-ca"></a>
<p>This is an alias for the <code class="code">mark-ca</code> option,
see <a class="pxref" href="#p11tool-mark_002dca">the mark-ca option documentation</a>.
</p>
<h4 class="subsubheading" id="private-option_002e"><span>private option.<a class="copiable-link" href="#private-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-private"></a>
<p>This is an alias for the <code class="code">mark-private</code> option,
see <a class="pxref" href="#p11tool-mark_002dprivate">the mark-private option documentation</a>.
</p>
<h4 class="subsubheading" id="mark_002dalways_002dauthenticate-option_002e"><span>mark-always-authenticate option.<a class="copiable-link" href="#mark_002dalways_002dauthenticate-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-mark_002dalways_002dauthenticate"></a>
<p>This is the “marks the object to be written as always authenticate” option.
Marks the object to be generated/written with the CKA_ALWAYS_AUTHENTICATE flag. The written object will Mark the object as requiring authentication (pin entry) before every operation.
</p><h4 class="subsubheading" id="secret_002dkey-option_002e"><span>secret-key option.<a class="copiable-link" href="#secret_002dkey-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-secret_002dkey"></a>
<p>This is the “provide a hex encoded secret key” option.
This option takes a ArgumentType.STRING argument.
This secret key will be written to the module if –write is specified.
<a class="anchor" id="p11tool-other_002doptions"></a></p><h4 class="subsubheading" id="other_002doptions-options-1"><span>other-options options<a class="copiable-link" href="#other_002doptions-options-1"> ¶</a></span></h4>
<p>Other options.
</p><h4 class="subsubheading" id="debug-option-_0028_002dd_0029_002e-8"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-8"> ¶</a></span></h4>
<a class="anchor" id="p11tool-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subsubheading" id="so_002dlogin-option_002e"><span>so-login option.<a class="copiable-link" href="#so_002dlogin-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-so_002dlogin"></a>
<p>This is the “force security officer login to token” option.
Forces login to the token as security officer (admin).
</p><h4 class="subsubheading" id="admin_002dlogin-option_002e"><span>admin-login option.<a class="copiable-link" href="#admin_002dlogin-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-admin_002dlogin"></a>
<p>This is an alias for the <code class="code">so-login</code> option,
see <a class="pxref" href="#p11tool-so_002dlogin">the so-login option documentation</a>.
</p>
<h4 class="subsubheading" id="test_002dsign-option_002e"><span>test-sign option.<a class="copiable-link" href="#test_002dsign-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-test_002dsign"></a>
<p>This is the “tests the signature operation of the provided object” option.
It can be used to test the correct operation of the signature operation.
If both a private and a public key are available this operation will sign and verify
the signed data.
</p><h4 class="subsubheading" id="sign_002dparams-option_002e-1"><span>sign-params option.<a class="copiable-link" href="#sign_002dparams-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="p11tool-sign_002dparams"></a>
<p>This is the “sign with a specific signature algorithm” option.
This option takes a ArgumentType.STRING argument.
This option can be combined with –test-sign, to sign with
a specific signature algorithm variant. The only option supported is ’RSA-PSS’, and should be
specified in order to use RSA-PSS signature on RSA keys.
</p><h4 class="subsubheading" id="hash-option_002e-2"><span>hash option.<a class="copiable-link" href="#hash-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="p11tool-hash"></a>
<p>This is the “hash algorithm to use for signing” option.
This option takes a ArgumentType.STRING argument.
This option can be combined with test-sign. Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512, SHA3-224, SHA3-256, SHA3-384, SHA3-512.
</p><h4 class="subsubheading" id="generate_002drandom-option_002e"><span>generate-random option.<a class="copiable-link" href="#generate_002drandom-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-generate_002drandom"></a>
<p>This is the “generate random data” option.
This option takes a ArgumentType.NUMBER argument.
Asks the token to generate a number of bytes of random bytes.
</p><h4 class="subsubheading" id="inder-option_002e-2"><span>inder option.<a class="copiable-link" href="#inder-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="p11tool-inder"></a>
<p>This is the “use der/raw format for input” option.
Use DER/RAW format for input certificates and private keys.
</p><h4 class="subsubheading" id="inraw-option_002e-2"><span>inraw option.<a class="copiable-link" href="#inraw-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="p11tool-inraw"></a>
<p>This is an alias for the <code class="code">inder</code> option,
see <a class="pxref" href="#p11tool-inder">the inder option documentation</a>.
</p>
<h4 class="subsubheading" id="outder-option_002e-2"><span>outder option.<a class="copiable-link" href="#outder-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="p11tool-outder"></a>
<p>This is the “use der format for output certificates, private keys, and dh parameters” option.
The output will be in DER or RAW format.
</p><h4 class="subsubheading" id="outraw-option_002e-1"><span>outraw option.<a class="copiable-link" href="#outraw-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="p11tool-outraw"></a>
<p>This is an alias for the <code class="code">outder</code> option,
see <a class="pxref" href="#p11tool-outder">the outder option documentation</a>.
</p>
<h4 class="subsubheading" id="provider-option_002e-3"><span>provider option.<a class="copiable-link" href="#provider-option_002e-3"> ¶</a></span></h4>
<a class="anchor" id="p11tool-provider"></a>
<p>This is the “specify the pkcs #11 provider library” option.
This option takes a ArgumentType.FILE argument.
This will override the default options in /etc/gnutls/pkcs11.conf
</p><h4 class="subsubheading" id="provider_002dopts-option_002e"><span>provider-opts option.<a class="copiable-link" href="#provider_002dopts-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-provider_002dopts"></a>
<p>This is the “specify parameters for the pkcs #11 provider library” option.
This option takes a ArgumentType.STRING argument.
This is a PKCS#11 internal option used by few modules.
Mainly for testing PKCS#11 modules.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subsubheading" id="batch-option_002e"><span>batch option.<a class="copiable-link" href="#batch-option_002e"> ¶</a></span></h4>
<a class="anchor" id="p11tool-batch"></a>
<p>This is the “disable all interaction with the tool” option.
In batch mode there will be no prompts, all parameters need to be specified on command line.
</p><h4 class="subsubheading" id="version-option-_0028_002dv_0029_002e-8"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-8"> ¶</a></span></h4>
<a class="anchor" id="p11tool-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subsubheading" id="help-option-_0028_002dh_0029_002e-8"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-8"> ¶</a></span></h4>
<a class="anchor" id="p11tool-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subsubheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-8"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-8"> ¶</a></span></h4>
<a class="anchor" id="p11tool-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="p11tool-exit-status"></a></p><h4 class="subsubheading" id="p11tool-exit-status-1"><span>p11tool exit status<a class="copiable-link" href="#p11tool-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="p11tool-See-Also"></a><h4 class="subsubheading" id="p11tool-See-Also-1"><span>p11tool See Also<a class="copiable-link" href="#p11tool-See-Also-1"> ¶</a></span></h4>
<p>certtool (1)
<a class="anchor" id="p11tool-Examples"></a></p><h4 class="subsubheading" id="p11tool-Examples-1"><span>p11tool Examples<a class="copiable-link" href="#p11tool-Examples-1"> ¶</a></span></h4>
<p>To view all tokens in your system use:
</p><div class="example">
<pre class="example-preformatted">$ p11tool --list-tokens
</pre></div>
<p>To view all objects in a token use:
</p><div class="example">
<pre class="example-preformatted">$ p11tool --login --list-all "pkcs11:TOKEN-URL"
</pre></div>
<p>To store a private key and a certificate in a token run:
</p><div class="example">
<pre class="example-preformatted">$ p11tool --login --write "pkcs11:URL" --load-privkey key.pem \
--label "Mykey"
$ p11tool --login --write "pkcs11:URL" --load-certificate cert.pem \
--label "Mykey"
</pre></div>
<p>Note that some tokens require the same label to be used for the certificate
and its corresponding private key.
</p>
<p>To generate an RSA private key inside the token use:
</p><div class="example">
<pre class="example-preformatted">$ p11tool --login --generate-privkey rsa --bits 1024 --label "MyNewKey" \
--outfile MyNewKey.pub "pkcs11:TOKEN-URL"
</pre></div>
<p>The bits parameter in the above example is explicitly set because some
tokens only support limited choices in the bit length. The output file is the
corresponding public key. This key can be used to general a certificate
request with certtool.
</p><div class="example">
<pre class="example-preformatted">certtool --generate-request --load-privkey "pkcs11:KEY-URL" \
--load-pubkey MyNewKey.pub --outfile request.pem
</pre></div>
<hr>
</div>
</div>
<div class="section-level-extent" id="Trusted-Platform-Module">
<div class="nav-panel">
<p>
Previous: <a href="#Smart-cards-and-HSMs" accesskey="p" rel="prev">Smart cards and HSMs</a>, Up: <a href="#Hardware-security-modules-and-abstract-key-types" accesskey="u" rel="up">Abstract key types and Hardware security modules</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Trusted-Platform-Module-_0028TPM_0029"><span>5.4 Trusted Platform Module (TPM)<a class="copiable-link" href="#Trusted-Platform-Module-_0028TPM_0029"> ¶</a></span></h3>
<a class="index-entry-id" id="index-trusted-platform-module"></a>
<a class="index-entry-id" id="index-TPM"></a>
<p>In this section we present the Trusted Platform Module (TPM) support
in <abbr class="acronym">GnuTLS</abbr>. Note that we recommend against using TPM with this
API because it is restricted to TPM 1.2. We recommend instead
to use PKCS#11 wrappers for TPM such as CHAPS<a class="footnote" id="DOCF14" href="#FOOT14"><sup>14</sup></a> or opencryptoki<a class="footnote" id="DOCF15" href="#FOOT15"><sup>15</sup></a>.
These will allow using the standard smart card and HSM functionality (see <a class="ref" href="#Smart-cards-and-HSMs">Smart cards and HSMs</a>) for TPM keys.
</p>
<p>There was a big hype when the TPM chip was introduced into
computers. Briefly it is a co-processor in your PC that allows it to perform
calculations independently of the main processor. This has good and bad
side-effects. In this section we focus on the good ones; these are the fact that
you can use the TPM chip to perform cryptographic operations on keys stored in it, without
accessing them. That is very similar to the operation of a <abbr class="acronym">PKCS</abbr> #11 smart card.
The chip allows for storage and usage of RSA keys, but has quite some
operational differences from <abbr class="acronym">PKCS</abbr> #11 module, and thus require different handling.
The basic TPM operations supported and used by GnuTLS, are key generation and signing.
That support is currently limited to TPM 1.2.
</p>
<p>The next sections assume that the TPM chip in the system is already initialized and
in a operational state. If not, ensure that the TPM chip is enabled by your BIOS,
that the <code class="code">tcsd</code> daemon is running, and that TPM ownership is set
(by running <code class="code">tpm_takeownership</code>).
</p>
<p>In GnuTLS the TPM functionality is available in <code class="code">gnutls/tpm.h</code>.
</p>
<ul class="mini-toc">
<li><a href="#Keys-in-TPM" accesskey="1">Keys in TPM</a></li>
<li><a href="#Key-generation" accesskey="2">Key generation</a></li>
<li><a href="#Using-keys" accesskey="3">Using keys</a></li>
<li><a href="#tpmtool-Invocation" accesskey="4">Invoking tpmtool</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Keys-in-TPM">
<div class="nav-panel">
<p>
Next: <a href="#Key-generation" accesskey="n" rel="next">Key generation</a>, Up: <a href="#Trusted-Platform-Module" accesskey="u" rel="up">Trusted Platform Module (TPM)</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Keys-in-TPM-1"><span>5.4.1 Keys in TPM<a class="copiable-link" href="#Keys-in-TPM-1"> ¶</a></span></h4>
<p>The RSA keys in the TPM module may either be stored in a flash memory
within TPM or stored in a file in disk. In the former case the key can
provide operations as with <abbr class="acronym">PKCS</abbr> #11 and is identified by
a URL. The URL is described in [<a class="ref" href="#TPMURI">TPMURI</a>] and is of the following form.
</p><pre class="verbatim">tpmkey:uuid=42309df8-d101-11e1-a89a-97bb33c23ad1;storage=user
</pre>
<p>It consists from a unique identifier of the key as well as the part of the
flash memory the key is stored at. The two options for the storage field are
‘user’ and ‘system’. The user keys are typically only available to the generating
user and the system keys to all users. The stored in TPM keys are called
registered keys.
</p>
<p>The keys that are stored in the disk are exported from the TPM but in an
encrypted form. To access them two passwords are required. The first is the TPM
Storage Root Key (SRK), and the other is a key-specific password. Also those keys are
identified by a URL of the form:
</p><pre class="verbatim">tpmkey:file=/path/to/file
</pre>
<p>When objects require a PIN to be accessed the same callbacks as with PKCS #11
objects are expected (see <a class="ref" href="#Accessing-objects-that-require-a-PIN">Accessing objects that require a PIN</a>). Note
that the PIN function may be called multiple times to unlock the SRK and
the specific key in use. The label in the key function will then be set to
‘SRK’ when unlocking the SRK key, or to ‘TPM’ when unlocking any other key.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Key-generation">
<div class="nav-panel">
<p>
Next: <a href="#Using-keys" accesskey="n" rel="next">Using keys</a>, Previous: <a href="#Keys-in-TPM" accesskey="p" rel="prev">Keys in TPM</a>, Up: <a href="#Trusted-Platform-Module" accesskey="u" rel="up">Trusted Platform Module (TPM)</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Key-generation-1"><span>5.4.2 Key generation<a class="copiable-link" href="#Key-generation-1"> ¶</a></span></h4>
<p>All keys used by the TPM must be generated by the TPM. This can be
done using <a class="ref" href="#gnutls_005ftpm_005fprivkey_005fgenerate">gnutls_tpm_privkey_generate</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fprivkey_005fgenerate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tpm_privkey_generate</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">pk</var>, unsigned int <var class="var">bits</var>, const char * <var class="var">srk_password</var>, const char * <var class="var">key_password</var>, gnutls_tpmkey_fmt_t <var class="var">format</var>, gnutls_x509_crt_fmt_t <var class="var">pub_format</var>, gnutls_datum_t * <var class="var">privkey</var>, gnutls_datum_t * <var class="var">pubkey</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fprivkey_005fgenerate"> ¶</a></span></dt>
<dd><p><var class="var">pk</var>: the public key algorithm
</p>
<p><var class="var">bits</var>: the security bits
</p>
<p><var class="var">srk_password</var>: a password to protect the exported key (optional)
</p>
<p><var class="var">key_password</var>: the password for the TPM (optional)
</p>
<p><var class="var">format</var>: the format of the private key
</p>
<p><var class="var">pub_format</var>: the format of the public key
</p>
<p><var class="var">privkey</var>: the generated key
</p>
<p><var class="var">pubkey</var>: the corresponding public key (may be null)
</p>
<p><var class="var">flags</var>: should be a list of GNUTLS_TPM_* flags
</p>
<p>This function will generate a private key in the TPM
chip. The private key will be generated within the chip
and will be exported in a wrapped with TPM’s master key
form. Furthermore the wrapped key can be protected with
the provided <code class="code">password</code> .
</p>
<p>Note that bits in TPM is quantized value. If the input value
is not one of the allowed values, then it will be quantized to
one of 512, 1024, 2048, 4096, 8192 and 16384.
</p>
<p>Allowed flags are:
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ftpm_005fget_005fregistered">gnutls_tpm_get_registered</a> (gnutls_tpm_key_list_t * <var class="var">list</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftpm_005fkey_005flist_005fdeinit">gnutls_tpm_key_list_deinit</a> (gnutls_tpm_key_list_t <var class="var">list</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ftpm_005fkey_005flist_005fget_005furl">gnutls_tpm_key_list_get_url</a> (gnutls_tpm_key_list_t <var class="var">list</var>, unsigned int <var class="var">idx</var>, char ** <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fprivkey_005fdelete"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tpm_privkey_delete</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, const char * <var class="var">srk_password</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fprivkey_005fdelete"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: the URL describing the key
</p>
<p><var class="var">srk_password</var>: a password for the SRK key
</p>
<p>This function will unregister the private key from the TPM
chip.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="Using-keys">
<div class="nav-panel">
<p>
Next: <a href="#tpmtool-Invocation" accesskey="n" rel="next">Invoking tpmtool</a>, Previous: <a href="#Key-generation" accesskey="p" rel="prev">Key generation</a>, Up: <a href="#Trusted-Platform-Module" accesskey="u" rel="up">Trusted Platform Module (TPM)</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Using-keys-1"><span>5.4.3 Using keys<a class="copiable-link" href="#Using-keys-1"> ¶</a></span></h4>
<h4 class="subsubheading" id="Importing-keys"><span>Importing keys<a class="copiable-link" href="#Importing-keys"> ¶</a></span></h4>
<p>The TPM keys can be used directly by the abstract key types and do not require
any special structures. Moreover functions like <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2">gnutls_certificate_set_x509_key_file2</a>
can access TPM URLs.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fimport_005ftpm_005fraw">gnutls_privkey_import_tpm_raw</a> (gnutls_privkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">fdata</var>, gnutls_tpmkey_fmt_t <var class="var">format</var>, const char * <var class="var">srk_password</var>, const char * <var class="var">key_password</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005ftpm_005fraw">gnutls_pubkey_import_tpm_raw</a> (gnutls_pubkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">fdata</var>, gnutls_tpmkey_fmt_t <var class="var">format</var>, const char * <var class="var">srk_password</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005ftpm_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_tpm_url</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, const char * <var class="var">url</var>, const char * <var class="var">srk_password</var>, const char * <var class="var">key_password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005ftpm_005furl"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">url</var>: The URL of the TPM key to be imported
</p>
<p><var class="var">srk_password</var>: The password for the SRK key (optional)
</p>
<p><var class="var">key_password</var>: A password for the key (optional)
</p>
<p><var class="var">flags</var>: One of the GNUTLS_PRIVKEY_* flags
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>Note that unless <code class="code">GNUTLS_PRIVKEY_DISABLE_CALLBACKS</code>
is specified, if incorrect (or NULL) passwords are given
the PKCS11 callback functions will be used to obtain the
correct passwords. Otherwise if the SRK password is wrong
<code class="code">GNUTLS_E_TPM_SRK_PASSWORD_ERROR</code> is returned and if the key password
is wrong or not provided then <code class="code">GNUTLS_E_TPM_KEY_PASSWORD_ERROR</code>
is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005ftpm_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_tpm_url</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pkey</var>, const char * <var class="var">url</var>, const char * <var class="var">srk_password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005ftpm_005furl"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The public key
</p>
<p><var class="var">url</var>: The URL of the TPM key to be imported
</p>
<p><var class="var">srk_password</var>: The password for the SRK key (optional)
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>Note that unless <code class="code">GNUTLS_PUBKEY_DISABLE_CALLBACKS</code>
is specified, if incorrect (or NULL) passwords are given
the PKCS11 callback functions will be used to obtain the
correct passwords. Otherwise if the SRK password is wrong
<code class="code">GNUTLS_E_TPM_SRK_PASSWORD_ERROR</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subsubheading" id="Listing-and-deleting-keys"><span>Listing and deleting keys<a class="copiable-link" href="#Listing-and-deleting-keys"> ¶</a></span></h4>
<p>The registered keys (that are stored in the TPM) can be listed using one of
the following functions. Those keys are unfortunately only identified by
their UUID and have no label or other human friendly identifier.
Keys can be deleted from permanent storage using <a class="ref" href="#gnutls_005ftpm_005fprivkey_005fdelete">gnutls_tpm_privkey_delete</a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ftpm_005fget_005fregistered">gnutls_tpm_get_registered</a> (gnutls_tpm_key_list_t * <var class="var">list</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftpm_005fkey_005flist_005fdeinit">gnutls_tpm_key_list_deinit</a> (gnutls_tpm_key_list_t <var class="var">list</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ftpm_005fkey_005flist_005fget_005furl">gnutls_tpm_key_list_get_url</a> (gnutls_tpm_key_list_t <var class="var">list</var>, unsigned int <var class="var">idx</var>, char ** <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fprivkey_005fdelete-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tpm_privkey_delete</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, const char * <var class="var">srk_password</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fprivkey_005fdelete-1"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: the URL describing the key
</p>
<p><var class="var">srk_password</var>: a password for the SRK key
</p>
<p>This function will unregister the private key from the TPM
chip.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="tpmtool-Invocation">
<div class="nav-panel">
<p>
Previous: <a href="#Using-keys" accesskey="p" rel="prev">Using keys</a>, Up: <a href="#Trusted-Platform-Module" accesskey="u" rel="up">Trusted Platform Module (TPM)</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Invoking-tpmtool"><span>5.4.4 Invoking tpmtool<a class="copiable-link" href="#Invoking-tpmtool"> ¶</a></span></h4>
<a class="index-entry-id" id="index-tpmtool"></a>
<p>Program that allows handling cryptographic data from the TPM chip.
</p>
<a class="anchor" id="tpmtool-usage"></a><h4 class="subsubheading" id="tpmtool-help_002fusage-_0028_002d_003f_0029"><span>tpmtool help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#tpmtool-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-tpmtool-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">tpmtool - GnuTLS TPM tool
Usage: tpmtool [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
--infile=file Input file
- file must pre-exist
--outfile=str Output file
--generate-rsa Generate an RSA private-public key pair
--register Any generated key will be registered in the TPM
- requires the option 'generate-rsa'
--signing Any generated key will be a signing key
- prohibits the option 'legacy'
- requires the option 'generate-rsa'
--legacy Any generated key will be a legacy key
- prohibits the option 'signing'
- requires the option 'generate-rsa'
--user Any registered key will be a user key
- prohibits the option 'system'
- requires the option 'register'
--system Any registered key will be a system key
- prohibits the option 'user'
- requires the option 'register'
--pubkey=str Prints the public key of the provided key
--list Lists all stored keys in the TPM
--delete=str Delete the key identified by the given URL (UUID)
--test-sign=str Tests the signature operation of the provided object
--sec-param=str Specify the security level [low, legacy, medium, high, ultra]
--bits=num Specify the number of bits for key generate
--inder Use the DER format for keys
--outder Use DER format for output keys
--srk-well-known SRK has well known password (20 bytes of zeros)
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Program that allows handling cryptographic data from the TPM chip.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subsubheading" id="debug-option-_0028_002dd_0029_002e-9"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-9"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subsubheading" id="generate_002drsa-option_002e-1"><span>generate-rsa option.<a class="copiable-link" href="#generate_002drsa-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-generate_002drsa"></a>
<p>This is the “generate an rsa private-public key pair” option.
Generates an RSA private-public key pair in the TPM chip.
The key may be stored in file system and protected by a PIN, or stored (registered)
in the TPM chip flash.
</p><h4 class="subsubheading" id="user-option_002e"><span>user option.<a class="copiable-link" href="#user-option_002e"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-user"></a>
<p>This is the “any registered key will be a user key” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
system.
</li><li>must appear in combination with the following options:
register.
</li></ul>
<p>The generated key will be stored in a user specific persistent storage.
</p><h4 class="subsubheading" id="system-option_002e"><span>system option.<a class="copiable-link" href="#system-option_002e"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-system"></a>
<p>This is the “any registered key will be a system key” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
user.
</li><li>must appear in combination with the following options:
register.
</li></ul>
<p>The generated key will be stored in system persistent storage.
</p><h4 class="subsubheading" id="test_002dsign-option_002e-1"><span>test-sign option.<a class="copiable-link" href="#test_002dsign-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-test_002dsign"></a>
<p>This is the “tests the signature operation of the provided object” option.
This option takes a ArgumentType.STRING argument <samp class="file">url</samp>.
It can be used to test the correct operation of the signature operation.
This operation will sign and verify the signed data.
</p><h4 class="subsubheading" id="sec_002dparam-option_002e-2"><span>sec-param option.<a class="copiable-link" href="#sec_002dparam-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-sec_002dparam"></a>
<p>This is the “specify the security level [low, legacy, medium, high, ultra]” option.
This option takes a ArgumentType.STRING argument <samp class="file">Security parameter</samp>.
This is alternative to the bits option. Note however that the
values allowed by the TPM chip are quantized and given values may be rounded up.
</p><h4 class="subsubheading" id="inder-option_002e-3"><span>inder option.<a class="copiable-link" href="#inder-option_002e-3"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-inder"></a>
<p>This is the “use the der format for keys” option.
The input files will be assumed to be in the portable
DER format of TPM. The default format is a custom format used by various
TPM tools
</p><h4 class="subsubheading" id="outder-option_002e-3"><span>outder option.<a class="copiable-link" href="#outder-option_002e-3"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-outder"></a>
<p>This is the “use der format for output keys” option.
The output will be in the TPM portable DER format.
</p><h4 class="subsubheading" id="version-option-_0028_002dv_0029_002e-9"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-9"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subsubheading" id="help-option-_0028_002dh_0029_002e-9"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-9"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subsubheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-9"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-9"> ¶</a></span></h4>
<a class="anchor" id="tpmtool-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="tpmtool-exit-status"></a></p><h4 class="subsubheading" id="tpmtool-exit-status-1"><span>tpmtool exit status<a class="copiable-link" href="#tpmtool-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="tpmtool-See-Also"></a><h4 class="subsubheading" id="tpmtool-See-Also-1"><span>tpmtool See Also<a class="copiable-link" href="#tpmtool-See-Also-1"> ¶</a></span></h4>
<p>p11tool (1), certtool (1)
<a class="anchor" id="tpmtool-Examples"></a></p><h4 class="subsubheading" id="tpmtool-Examples-1"><span>tpmtool Examples<a class="copiable-link" href="#tpmtool-Examples-1"> ¶</a></span></h4>
<p>To generate a key that is to be stored in file system use:
</p><div class="example">
<pre class="example-preformatted">$ tpmtool --generate-rsa --bits 2048 --outfile tpmkey.pem
</pre></div>
<p>To generate a key that is to be stored in TPM’s flash use:
</p><div class="example">
<pre class="example-preformatted">$ tpmtool --generate-rsa --bits 2048 --register --user
</pre></div>
<p>To get the public key of a TPM key use:
</p><div class="example">
<pre class="example-preformatted">$ tpmtool --pubkey tpmkey:uuid=58ad734b-bde6-45c7-89d8-756a55ad1891;storage=user \
--outfile pubkey.pem
</pre></div>
<p>or if the key is stored in the file system:
</p><div class="example">
<pre class="example-preformatted">$ tpmtool --pubkey tpmkey:file=tmpkey.pem --outfile pubkey.pem
</pre></div>
<p>To list all keys stored in TPM use:
</p><div class="example">
<pre class="example-preformatted">$ tpmtool --list
</pre></div>
<hr>
</div>
</div>
</div>
<div class="chapter-level-extent" id="How-to-use-GnuTLS-in-applications">
<div class="nav-panel">
<p>
Next: <a href="#GnuTLS-application-examples" accesskey="n" rel="next">GnuTLS application examples</a>, Previous: <a href="#Hardware-security-modules-and-abstract-key-types" accesskey="p" rel="prev">Abstract key types and Hardware security modules</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="How-to-use-GnuTLS-in-applications-1"><span>6 How to use <abbr class="acronym">GnuTLS</abbr> in applications<a class="copiable-link" href="#How-to-use-GnuTLS-in-applications-1"> ¶</a></span></h2>
<ul class="mini-toc">
<li><a href="#Introduction-to-the-library" accesskey="1">Introduction</a></li>
<li><a href="#Preparation" accesskey="2">Preparation</a></li>
<li><a href="#Session-initialization" accesskey="3">Session initialization</a></li>
<li><a href="#Associating-the-credentials" accesskey="4">Associating the credentials</a></li>
<li><a href="#Setting-up-the-transport-layer" accesskey="5">Setting up the transport layer</a></li>
<li><a href="#TLS-handshake" accesskey="6">TLS handshake</a></li>
<li><a href="#Data-transfer-and-termination" accesskey="7">Data transfer and termination</a></li>
<li><a href="#Buffered-data-transfer" accesskey="8">Buffered data transfer</a></li>
<li><a href="#Handling-alerts" accesskey="9">Handling alerts</a></li>
<li><a href="#Priority-Strings">Priority strings</a></li>
<li><a href="#Selecting-cryptographic-key-sizes">Selecting cryptographic key sizes</a></li>
<li><a href="#Advanced-topics">Advanced topics</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Introduction-to-the-library">
<div class="nav-panel">
<p>
Next: <a href="#Preparation" accesskey="n" rel="next">Preparation</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Introduction"><span>6.1 Introduction<a class="copiable-link" href="#Introduction"> ¶</a></span></h3>
<p>This chapter tries to explain the basic functionality of the current GnuTLS
library. Note that there may be additional functionality not discussed here
but included in the library. Checking the header files in <samp class="file">/usr/include/gnutls/</samp>
and the manpages is recommended.
</p>
<ul class="mini-toc">
<li><a href="#General-idea" accesskey="1">General idea</a></li>
<li><a href="#Error-handling" accesskey="2">Error handling</a></li>
<li><a href="#Common-types" accesskey="3">Common types</a></li>
<li><a href="#Debugging-and-auditing" accesskey="4">Debugging and auditing</a></li>
<li><a href="#Thread-safety" accesskey="5">Thread safety</a></li>
<li><a href="#Running-in-a-sandbox" accesskey="6">Running in a sandbox</a></li>
<li><a href="#Sessions-and-fork" accesskey="7">Sessions and fork</a></li>
<li><a href="#Callback-functions" accesskey="8">Callback functions</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="General-idea">
<div class="nav-panel">
<p>
Next: <a href="#Error-handling" accesskey="n" rel="next">Error handling</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="General-idea-1"><span>6.1.1 General idea<a class="copiable-link" href="#General-idea-1"> ¶</a></span></h4>
<p>A brief description of how <abbr class="acronym">GnuTLS</abbr> sessions operate is shown
at <a class="ref" href="#fig_002dgnutls_002ddesign">Figure 6.1</a>. This section will become more clear when it
is completely read.
As shown in the figure, there is a read-only global state that is
initialized once by the global initialization function. This global
structure, among others, contains the memory allocation functions
used, structures needed for the <abbr class="acronym">ASN.1</abbr> parser and depending
on the system’s CPU, pointers to hardware accelerated encryption functions. This
structure is never modified by any <abbr class="acronym">GnuTLS</abbr> function, except
for the deinitialization function which frees all allocated memory
and must be called after the program has permanently
finished using <abbr class="acronym">GnuTLS</abbr>.
</p>
<div class="float" id="fig_002dgnutls_002ddesign">
<img class="image" src="gnutls-internals.png" alt="gnutls-internals">
<div class="caption"><p><strong class="strong">Figure 6.1: </strong>High level design of GnuTLS.</p></div></div>
<p>The credentials structures are used by the authentication methods, such
as certificate authentication. They store certificates, privates keys,
and other information that is needed to prove the identity to the peer,
and/or verify the identity of the peer. The information stored in
the credentials structures is initialized once and then can be
shared by many <abbr class="acronym">TLS</abbr> sessions.
</p>
<p>A <abbr class="acronym">GnuTLS</abbr> session contains all the required state and
information to handle one secure connection. The session communicates with the
peers using the provided functions of the transport layer.
Every session has a unique session ID shared with the peer.
</p>
<p>Since TLS sessions can be resumed, servers need a
database back-end to hold the session’s parameters. Every
<abbr class="acronym">GnuTLS</abbr> session after a successful handshake calls the
appropriate back-end function (see <a class="ref" href="#resume">resume</a>)
to store the newly negotiated session. The session
database is examined by the server just after having received the
client hello<a class="footnote" id="DOCF16" href="#FOOT16"><sup>16</sup></a>,
and if the session ID sent by the client, matches a stored session,
the stored session will be retrieved, and the new session will be a
resumed one, and will share the same session ID with the previous one.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Error-handling">
<div class="nav-panel">
<p>
Next: <a href="#Common-types" accesskey="n" rel="next">Common types</a>, Previous: <a href="#General-idea" accesskey="p" rel="prev">General idea</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Error-handling-1"><span>6.1.2 Error handling<a class="copiable-link" href="#Error-handling-1"> ¶</a></span></h4>
<p>There two types of <abbr class="acronym">GnuTLS</abbr> functions. The first type returns
a boolean value, true (non-zero) or false (zero) value; these functions
are defined to return an unsigned integer type. The other type returns a
signed integer type with zero (or a positive number) indicating
success and a negative value indicating failure. For the latter
type it is recommended to check for errors as following.
</p><div class="example">
<pre class="example-preformatted"> ret = gnutls_function();
if (ret < 0) {
return -1;
}
</pre></div>
<p>The above example checks for a failure condition rather than
for explicit success (e.g., equality to zero). That has the advantage
that future extensions of the API can be extended to provide
additional information via positive returned values (see for example
<a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile">gnutls_certificate_set_x509_key_file</a>).
</p>
<p>In <abbr class="acronym">GnuTLS</abbr>, many objects are represented as opaque types that
are initialized by passing an address to storage of that type to a
pointer parameter of a function name <code class="code">gnutls_<var class="var">obj</var>_init</code>, and
which have a counterpart function <code class="code">gnutls_<var class="var">obj</var>_deinit</code>. It
is safe, but not mandatory, to pre-initialize the opaque storage to
contain all zeroes (such as by using <code class="code">calloc()</code> or
<code class="code">memset()</code>). If the initializer succeeds, the storage must be
passed to the counterpart deinitializer when the object is no longer
in use to avoid memory leaks. As of version 3.8.0, if the initializer
function fails, it is safe, but not mandatory, to call the counterpart
deinitializer, regardless of whether the storage was pre-initialized.
However, this was not guaranteed in earlier versions; for maximum
portability to older library versions, callers should either
pre-initialize the storage to zero before initialization or refrain
from calling the deinitializer if the initializer fails.
</p>
<p>For certain operations such as TLS handshake and TLS packet receive
there is the notion of fatal and non-fatal error codes.
Fatal errors terminate the TLS session immediately and further sends
and receives will be disallowed. Such an example is
<code class="code">GNUTLS_E_DECRYPTION_FAILED</code>. Non-fatal errors may warn about
something, i.e., a warning alert was received, or indicate the some
action has to be taken. This is the case with the error code
<code class="code">GNUTLS_E_REHANDSHAKE</code> returned by <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a>.
This error code indicates that the server requests a re-handshake. The
client may ignore this request, or may reply with an alert. You can
test if an error code is a fatal one by using the
<a class="ref" href="#gnutls_005ferror_005fis_005ffatal">gnutls_error_is_fatal</a>.
All errors can be converted to a descriptive string using <a class="ref" href="#gnutls_005fstrerror">gnutls_strerror</a>.
</p>
<p>If any non fatal errors, that require an action, are to be returned by
a function, these error codes will be documented in the function’s
reference. For example the error codes <code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code> and <code class="code">GNUTLS_E_FATAL_ALERT_RECEIVED</code>
that may returned when receiving data, should be handled by notifying the
user of the alert (as explained in <a class="ref" href="#Handling-alerts">Handling alerts</a>).
See <a class="ref" href="#Error-codes">Error Codes and Descriptions</a>, for a description of the available error codes.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Common-types">
<div class="nav-panel">
<p>
Next: <a href="#Debugging-and-auditing" accesskey="n" rel="next">Debugging and auditing</a>, Previous: <a href="#Error-handling" accesskey="p" rel="prev">Error handling</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Common-types-1"><span>6.1.3 Common types<a class="copiable-link" href="#Common-types-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-gnutls_005fdatum_005ft"></a>
<a class="index-entry-id" id="index-giovec_005ft"></a>
<p>All strings that are to provided as input to <abbr class="acronym">GnuTLS</abbr> functions
should be in UTF-8 unless otherwise specified. Output strings are also
in UTF-8 format unless otherwise specified. When functions take as input
passwords, they will normalize them using [<a class="ref" href="#RFC7613">RFC7613</a>] rules (since
GnuTLS 3.5.7).
</p>
<p>When data of a fixed size are provided to <abbr class="acronym">GnuTLS</abbr> functions then
the helper structure <code class="code">gnutls_datum_t</code> is often used. Its definition is
shown below.
</p><pre class="verbatim"> typedef struct
{
unsigned char *data;
unsigned int size;
} gnutls_datum_t;
</pre>
<p>In functions where this structure is a returned type, if the function succeeds,
it is expected from the caller to use <code class="code">gnutls_free()</code> to deinitialize the
data element after use, unless otherwise specified. If the function fails, the
contents of the <code class="code">gnutls_datum_t</code> should be considered undefined and must
not be deinitialized.
</p>
<p>Other functions that require data for scattered read use a structure similar
to <code class="code">struct iovec</code> typically used by <code class="code">readv</code>. It is shown
below.
</p><pre class="verbatim"> typedef struct
{
void *iov_base; /* Starting address */
size_t iov_len; /* Number of bytes to transfer */
} giovec_t;
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Debugging-and-auditing">
<div class="nav-panel">
<p>
Next: <a href="#Thread-safety" accesskey="n" rel="next">Thread safety</a>, Previous: <a href="#Common-types" accesskey="p" rel="prev">Common types</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Debugging-and-auditing-1"><span>6.1.4 Debugging and auditing<a class="copiable-link" href="#Debugging-and-auditing-1"> ¶</a></span></h4>
<p>In many cases things may not go as expected and further information,
to assist debugging, from <abbr class="acronym">GnuTLS</abbr> is desired.
Those are the cases where the <a class="ref" href="#gnutls_005fglobal_005fset_005flog_005flevel">gnutls_global_set_log_level</a> and
<a class="ref" href="#gnutls_005fglobal_005fset_005flog_005ffunction">gnutls_global_set_log_function</a> are to be used. Those will print
verbose information on the <abbr class="acronym">GnuTLS</abbr> functions internal flow.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fglobal_005fset_005flog_005flevel">gnutls_global_set_log_level</a> (int <var class="var">level</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fglobal_005fset_005flog_005ffunction">gnutls_global_set_log_function</a> (gnutls_log_func <var class="var">log_func</var>)</code></dt>
</dl>
<p>Alternatively the environment variable <code class="code">GNUTLS_DEBUG_LEVEL</code> can be
set to a logging level and GnuTLS will output debugging output to standard
error. Other available environment variables are shown in <a class="ref" href="#tab_003aenvironment">Table 6.1</a>.
</p>
<div class="float" id="tab_003aenvironment">
<table class="multitable">
<thead><tr><th width="30%">Variable</th><th width="70%">Purpose</th></tr></thead>
<tbody><tr><td width="30%"><code class="code">GNUTLS_DEBUG_LEVEL</code></td><td width="70%">When set to a numeric value, it sets the default debugging level for GnuTLS applications.</td></tr>
<tr><td width="30%"><code class="code">SSLKEYLOGFILE</code></td><td width="70%">When set to a filename, GnuTLS will append to it the session keys in the NSS Key Log
format. That format can be read by wireshark and will allow decryption of the session for debugging.</td></tr>
<tr><td width="30%"><code class="code">GNUTLS_CPUID_OVERRIDE</code></td><td width="70%">That environment variable can be used to
explicitly enable/disable the use of certain CPU capabilities. Note that CPU
detection cannot be overridden, i.e., VIA options cannot be enabled on an Intel
CPU. The currently available options are:
<ul class="itemize mark-bullet">
<li>0x1: Disable all run-time detected optimizations
</li><li>0x2: Enable AES-NI
</li><li>0x4: Enable SSSE3
</li><li>0x8: Enable PCLMUL
</li><li>0x10: Enable AVX
</li><li>0x20: Enable SHA_NI
</li><li>0x100000: Enable VIA padlock
</li><li>0x200000: Enable VIA PHE
</li><li>0x400000: Enable VIA PHE SHA512
</li></ul></td></tr>
<tr><td width="30%"><code class="code">GNUTLS_FORCE_FIPS_MODE</code></td><td width="70%">In setups where GnuTLS is compiled with support for FIPS140-2 (see <a class="ref" href="#FIPS140_002d2-mode">FIPS140-2 mode</a>)
if set to one it will force the FIPS mode enablement.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 6.1: </strong>Environment variables used by the library.</p></div></div>
<p>When debugging is not required, important issues, such as detected
attacks on the protocol still need to be logged. This is provided
by the logging function set by
<a class="ref" href="#gnutls_005fglobal_005fset_005faudit_005flog_005ffunction">gnutls_global_set_audit_log_function</a>. The provided function
will receive an message and the corresponding
TLS session. The session information might be used to derive IP addresses
or other information about the peer involved.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fset_005faudit_005flog_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_set_audit_log_function</strong> <code class="def-code-arguments">(gnutls_audit_log_func <var class="var">log_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fset_005faudit_005flog_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">log_func</var>: it is the audit log function
</p>
<p>This is the function to set the audit logging function. This
is a function to report important issues, such as possible
attacks in the protocol. This is different from <code class="code">gnutls_global_set_log_function()</code>
because it will report also session-specific events. The session
parameter will be null if there is no corresponding TLS session.
</p>
<p><code class="code">gnutls_audit_log_func</code> is of the form,
void (*gnutls_audit_log_func)( gnutls_session_t, const char*);
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="Thread-safety">
<div class="nav-panel">
<p>
Next: <a href="#Running-in-a-sandbox" accesskey="n" rel="next">Running in a sandbox</a>, Previous: <a href="#Debugging-and-auditing" accesskey="p" rel="prev">Debugging and auditing</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Thread-safety-1"><span>6.1.5 Thread safety<a class="copiable-link" href="#Thread-safety-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-thread-safety"></a>
<p>The <abbr class="acronym">GnuTLS</abbr> library is thread safe by design, meaning that
objects of the library such as TLS sessions, can be safely divided across
threads as long as a single thread accesses a single object. This is
sufficient to support a server which handles several sessions per thread.
Read-only access to objects, for example the credentials holding structures,
is also thread-safe.
</p>
<p>A <code class="code">gnutls_session_t</code> object could also be shared by two threads, one sending,
the other receiving. However, care must be taken on the following use cases:
</p><ul class="itemize mark-bullet">
<li>The re-handshake process in TLS 1.2 or earlier must be handled only in
a single thread and no other thread may be performing any operation.
</li><li>The flag <code class="code">GNUTLS_AUTO_REAUTH</code> cannot be used safely in this mode of operation.
</li><li>Any other operation which may send or receive data, like key update (c.f.,
<a class="ref" href="#gnutls_005fsession_005fkey_005fupdate">gnutls_session_key_update</a>), must not be performed while threads
are receiving or writing.
</li><li>The termination of a session should be handled, either by a single thread being
active, or by the sender thread using <a class="ref" href="#gnutls_005fbye">gnutls_bye</a> with <code class="code">GNUTLS_SHUT_WR</code>
and the receiving thread waiting for a return value of zero (or timeout on
certain servers which do not respond).
</li><li>The functions <a class="ref" href="#gnutls_005ftransport_005fset_005ferrno">gnutls_transport_set_errno</a> and <a class="ref" href="#gnutls_005frecord_005fget_005fdirection">gnutls_record_get_direction</a>
should not be relied during parallel operation.
</li></ul>
<p>For several aspects of the library (e.g., the random generator, PKCS#11
operations), the library may utilize mutex locks (e.g., pthreads on GNU/Linux and CriticalSection on Windows)
which are transparently setup on library initialization. Prior to version 3.3.0
these were setup by explicitly calling <a class="ref" href="#gnutls_005fglobal_005finit">gnutls_global_init</a>.<a class="footnote" id="DOCF17" href="#FOOT17"><sup>17</sup></a>
</p>
<p>Note that, on Glibc systems, unless the application is explicitly linked
with the libpthread library, no mutex locks are used and setup by GnuTLS. It
will use the Glibc mutex stubs.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Running-in-a-sandbox">
<div class="nav-panel">
<p>
Next: <a href="#Sessions-and-fork" accesskey="n" rel="next">Sessions and fork</a>, Previous: <a href="#Thread-safety" accesskey="p" rel="prev">Thread safety</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Running-in-a-sandbox-1"><span>6.1.6 Running in a sandbox<a class="copiable-link" href="#Running-in-a-sandbox-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-seccomp"></a>
<a class="index-entry-id" id="index-isolated-mode"></a>
<p>Given that TLS protocol handling as well as X.509 certificate
parsing are complicated processes involving several thousands lines of code,
it is often desirable (and recommended) to run the TLS session handling in
a sandbox like seccomp. That has to be allowed by the overall software design,
but if available, it adds an additional layer of protection by
preventing parsing errors from becoming vessels for further security issues such
as code execution.
</p>
<p>GnuTLS requires the following system calls to be available for its proper
operation.
</p>
<ul class="itemize mark-bullet">
<li>nanosleep
</li><li>time
</li><li>gettimeofday
</li><li>clock_gettime
</li><li>getrusage
</li><li>getpid
</li><li>send
</li><li>recv
</li><li>sendmsg
</li><li>read (to read from /dev/urandom)
</li><li>getrandom (this is Linux-kernel specific)
</li><li>poll
</li></ul>
<p>As well as any calls needed for memory allocation to work. Note however, that GnuTLS
depends on libc for the system calls, and there is no guarantee that libc will
call the expected system call. For that it is recommended to test your
program in all the targeted platforms when filters like seccomp are in place.
</p>
<p>An example with a seccomp filter from GnuTLS’ test suite is at:
<a class="url" href="https://gitlab.com/gnutls/gnutls/blob/master/tests/seccomp.c">https://gitlab.com/gnutls/gnutls/blob/master/tests/seccomp.c</a>.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Sessions-and-fork">
<div class="nav-panel">
<p>
Next: <a href="#Callback-functions" accesskey="n" rel="next">Callback functions</a>, Previous: <a href="#Running-in-a-sandbox" accesskey="p" rel="prev">Running in a sandbox</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Sessions-and-fork-1"><span>6.1.7 Sessions and fork<a class="copiable-link" href="#Sessions-and-fork-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-fork"></a>
<p>A <code class="code">gnutls_session_t</code> object can be shared by two processes after a fork,
one sending, the other receiving. In that case rehandshakes,
cannot and must not be performed. As with threads, the termination of a session should be
handled by the sender process using <a class="ref" href="#gnutls_005fbye">gnutls_bye</a> with <code class="code">GNUTLS_SHUT_WR</code>
and the receiving process waiting for a return value of zero.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Callback-functions">
<div class="nav-panel">
<p>
Previous: <a href="#Sessions-and-fork" accesskey="p" rel="prev">Sessions and fork</a>, Up: <a href="#Introduction-to-the-library" accesskey="u" rel="up">Introduction</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Callback-functions-1"><span>6.1.8 Callback functions<a class="copiable-link" href="#Callback-functions-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-callback-functions"></a>
<p>There are several cases where <abbr class="acronym">GnuTLS</abbr> may need out of
band input from your program. This is now implemented using some
callback functions, which your program is expected to register.
</p>
<p>An example of this type of functions are the push and pull callbacks
which are used to specify the functions that will retrieve and send
data to the transport layer.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftransport_005fset_005fpush_005ffunction">gnutls_transport_set_push_function</a> (gnutls_session_t <var class="var">session</var>, gnutls_push_func <var class="var">push_func</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftransport_005fset_005fpull_005ffunction">gnutls_transport_set_pull_function</a> (gnutls_session_t <var class="var">session</var>, gnutls_pull_func <var class="var">pull_func</var>)</code></dt>
</dl>
<p>Other callback functions may require more complicated input and data
to be allocated. Such an example is
<a class="ref" href="#gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction">gnutls_srp_set_server_credentials_function</a>.
All callbacks should allocate and free memory using
<code class="code">gnutls_malloc</code> and <code class="code">gnutls_free</code>.
</p>
<hr>
</div>
</div>
<div class="section-level-extent" id="Preparation">
<div class="nav-panel">
<p>
Next: <a href="#Session-initialization" accesskey="n" rel="next">Session initialization</a>, Previous: <a href="#Introduction-to-the-library" accesskey="p" rel="prev">Introduction</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Preparation-1"><span>6.2 Preparation<a class="copiable-link" href="#Preparation-1"> ¶</a></span></h3>
<p>To use <abbr class="acronym">GnuTLS</abbr>, you have to perform some changes to your
sources and your build system. The necessary changes are explained in
the following subsections.
</p>
<ul class="mini-toc">
<li><a href="#Headers" accesskey="1">Headers</a></li>
<li><a href="#Initialization" accesskey="2">Initialization</a></li>
<li><a href="#Version-check" accesskey="3">Version check</a></li>
<li><a href="#Building-the-source" accesskey="4">Building the source</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Headers">
<div class="nav-panel">
<p>
Next: <a href="#Initialization" accesskey="n" rel="next">Initialization</a>, Up: <a href="#Preparation" accesskey="u" rel="up">Preparation</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Headers-1"><span>6.2.1 Headers<a class="copiable-link" href="#Headers-1"> ¶</a></span></h4>
<p>All the data types and functions of the <abbr class="acronym">GnuTLS</abbr> library are
defined in the header file <samp class="file">gnutls/gnutls.h</samp>. This must be
included in all programs that make use of the <abbr class="acronym">GnuTLS</abbr>
library.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Initialization">
<div class="nav-panel">
<p>
Next: <a href="#Version-check" accesskey="n" rel="next">Version check</a>, Previous: <a href="#Headers" accesskey="p" rel="prev">Headers</a>, Up: <a href="#Preparation" accesskey="u" rel="up">Preparation</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Initialization-2"><span>6.2.2 Initialization<a class="copiable-link" href="#Initialization-2"> ¶</a></span></h4>
<p>The GnuTLS library is initialized on load; prior to 3.3.0 was initialized by calling <a class="ref" href="#gnutls_005fglobal_005finit">gnutls_global_init</a><a class="footnote" id="DOCF18" href="#FOOT18"><sup>18</sup></a>. <a class="ref" href="#gnutls_005fglobal_005finit">gnutls_global_init</a> in
versions after 3.3.0 is thread-safe (see <a class="ref" href="#Thread-safety">Thread safety</a>).
</p>
<p>The initialization typically enables CPU-specific acceleration, performs any required
precalculations needed, opens any required system devices (e.g., /dev/urandom on Linux)
and initializes subsystems that could be used later.
</p>
<p>The resources allocated by the initialization process will be released
on library deinitialization.
</p>
<p>Note that on certain systems file descriptors may be kept open by
GnuTLS (e.g. /dev/urandom) on library load. Applications closing all unknown file
descriptors must immediately call <a class="ref" href="#gnutls_005fglobal_005finit">gnutls_global_init</a>, after that, to
ensure they don’t disrupt GnuTLS’ operation.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Version-check">
<div class="nav-panel">
<p>
Next: <a href="#Building-the-source" accesskey="n" rel="next">Building the source</a>, Previous: <a href="#Initialization" accesskey="p" rel="prev">Initialization</a>, Up: <a href="#Preparation" accesskey="u" rel="up">Preparation</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Version-check-1"><span>6.2.3 Version check<a class="copiable-link" href="#Version-check-1"> ¶</a></span></h4>
<p>It is often desirable to check that the version of ‘gnutls’ used is
indeed one which fits all requirements. Even with binary
compatibility new features may have been introduced but due to problem
with the dynamic linker an old version is actually used. So you may
want to check that the version is okay right after program start-up.
See the function <a class="ref" href="#gnutls_005fcheck_005fversion">gnutls_check_version</a>.
</p>
<p>On the other hand, it is often desirable to support more than one
versions of the library. In that case you could utilize compile-time
feature checks using the <code class="code">GNUTLS_VERSION_NUMBER</code> macro.
For example, to conditionally add code for GnuTLS 3.2.1 or later, you may use:
</p><div class="example">
<pre class="example-preformatted">#if GNUTLS_VERSION_NUMBER >= 0x030201
...
#endif
</pre></div>
<hr>
</div>
<div class="subsection-level-extent" id="Building-the-source">
<div class="nav-panel">
<p>
Previous: <a href="#Version-check" accesskey="p" rel="prev">Version check</a>, Up: <a href="#Preparation" accesskey="u" rel="up">Preparation</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Building-the-source-1"><span>6.2.4 Building the source<a class="copiable-link" href="#Building-the-source-1"> ¶</a></span></h4>
<p>If you want to compile a source file including the
<samp class="file">gnutls/gnutls.h</samp> header file, you must make sure that the
compiler can find it in the directory hierarchy. This is accomplished
by adding the path to the directory in which the header file is
located to the compilers include file search path (via the <samp class="option">-I</samp>
option).
</p>
<p>However, the path to the include file is determined at the time the
source is configured. To solve this problem, the library uses the
external package <code class="command">pkg-config</code> that knows the path to the
include file and other configuration options. The options that need
to be added to the compiler invocation at compile time are output by
the <samp class="option">--cflags</samp> option to <code class="command">pkg-config gnutls</code>. The
following example shows how it can be used at the command line:
</p>
<div class="example">
<pre class="example-preformatted">gcc -c foo.c `pkg-config gnutls --cflags`
</pre></div>
<p>Adding the output of ‘<samp class="samp">pkg-config gnutls --cflags</samp>’ to the
compilers command line will ensure that the compiler can find the
<samp class="file">gnutls/gnutls.h</samp> header file.
</p>
<p>A similar problem occurs when linking the program with the library.
Again, the compiler has to find the library files. For this to work,
the path to the library files has to be added to the library search
path (via the <samp class="option">-L</samp> option). For this, the option
<samp class="option">--libs</samp> to <code class="command">pkg-config gnutls</code> can be used. For
convenience, this option also outputs all other options that are
required to link the program with the library (for instance, the
‘<samp class="samp">-ltasn1</samp>’ option). The example shows how to link <samp class="file">foo.o</samp>
with the library to a program <code class="command">foo</code>.
</p>
<div class="example">
<pre class="example-preformatted">gcc -o foo foo.o `pkg-config gnutls --libs`
</pre></div>
<p>Of course you can also combine both examples to a single command by
specifying both options to <code class="command">pkg-config</code>:
</p>
<div class="example">
<pre class="example-preformatted">gcc -o foo foo.c `pkg-config gnutls --cflags --libs`
</pre></div>
<p>When a program uses the GNU autoconf system, then the following
line or similar can be used to detect the presence of GnuTLS.
</p>
<div class="example">
<pre class="example-preformatted">PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 3.3.0])
AC_SUBST([LIBGNUTLS_CFLAGS])
AC_SUBST([LIBGNUTLS_LIBS])
</pre></div>
<hr>
</div>
</div>
<div class="section-level-extent" id="Session-initialization">
<div class="nav-panel">
<p>
Next: <a href="#Associating-the-credentials" accesskey="n" rel="next">Associating the credentials</a>, Previous: <a href="#Preparation" accesskey="p" rel="prev">Preparation</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Session-initialization-1"><span>6.3 Session initialization<a class="copiable-link" href="#Session-initialization-1"> ¶</a></span></h3>
<p>In the previous sections we have discussed the global initialization
required for GnuTLS as well as the initialization required for each
authentication method’s credentials (see <a class="ref" href="#Authentication">Authentication</a>).
In this section we elaborate on the TLS or DTLS session initiation.
Each session is initialized using <a class="ref" href="#gnutls_005finit">gnutls_init</a> which among
others is used to specify the type of the connection (server or client),
and the underlying protocol type, i.e., datagram (UDP) or reliable (TCP).
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_init</strong> <code class="def-code-arguments">(gnutls_session_t * <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005finit"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a pointer to a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">flags</var>: indicate if this session is to be used for server or client.
</p>
<p>This function initializes the provided session. Every session must
be initialized before use, and after successful initialization and
use must be deinitialized by calling <code class="code">gnutls_deinit()</code> .
</p>
<p><code class="code">flags</code> can be any combination of flags from <code class="code">gnutls_init_flags_t</code> .
</p>
<p>Note that since version 3.1.2 this function enables some common
TLS extensions such as session tickets and OCSP certificate status
request in client side by default. To prevent that use the <code class="code">GNUTLS_NO_DEFAULT_EXTENSIONS</code>
flag.
</p>
<p>Note that it is never mandatory to use <code class="code">gnutls_deinit()</code> after this
function fails. Since gnutls 3.8.0, it is safe to unconditionally
use <code class="code">gnutls_deinit()</code> even after failure regardless of whether the
memory was initialized prior to <code class="code">gnutls_init()</code> ; however, clients
wanting to be portable to older versions of the library should
either skip deinitialization on failure, or pre-initialize the
memory passed in to <code class="code">gnutls_init()</code> to all zeroes via <code class="code">memset()</code> or
similar.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<div class="float" id="gnutls_005finit_005fflags_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_SERVER</code></dt>
<dd><p>Connection end is a server.
</p></dd>
<dt><code class="code">GNUTLS_CLIENT</code></dt>
<dd><p>Connection end is a client.
</p></dd>
<dt><code class="code">GNUTLS_DATAGRAM</code></dt>
<dd><p>Connection is datagram oriented (DTLS). Since 3.0.0.
</p></dd>
<dt><code class="code">GNUTLS_NONBLOCK</code></dt>
<dd><p>Connection should not block. Since 3.0.0.
</p></dd>
<dt><code class="code">GNUTLS_NO_DEFAULT_EXTENSIONS</code></dt>
<dd><p>Do not enable any TLS extensions by default such as session tickets and OCSP certificate status request (since 3.1.2). As TLS 1.2 and later require extensions this option is considered obsolete and should not be used.
</p></dd>
<dt><code class="code">GNUTLS_NO_REPLAY_PROTECTION</code></dt>
<dd><p>Disable any replay protection in DTLS. This must only be used if replay protection is achieved using other means. Since 3.2.2.
</p></dd>
<dt><code class="code">GNUTLS_NO_SIGNAL</code></dt>
<dd><p>In systems where SIGPIPE is delivered on send, it will be disabled. That flag has effect in systems which support the MSG_NOSIGNAL sockets flag (since 3.4.2).
</p></dd>
<dt><code class="code">GNUTLS_ALLOW_ID_CHANGE</code></dt>
<dd><p>Allow the peer to replace its certificate, or change its ID during a rehandshake. This change is often used in attacks and thus prohibited by default. Since 3.5.0.
</p></dd>
<dt><code class="code">GNUTLS_ENABLE_FALSE_START</code></dt>
<dd><p>Enable the TLS false start on client side if the negotiated ciphersuites allow it. This will enable sending data prior to the handshake being complete, and may introduce a risk of crypto failure when combined with certain key exchanged; for that GnuTLS may not enable that option in ciphersuites that are known to be not safe for false start. Since 3.5.0.
</p></dd>
<dt><code class="code">GNUTLS_FORCE_CLIENT_CERT</code></dt>
<dd><p>When in client side and only a single cert is specified, send that certificate irrespective of the issuers expected by the server. Since 3.5.0.
</p></dd>
<dt><code class="code">GNUTLS_NO_TICKETS</code></dt>
<dd><p>Flag to indicate that the session should not use resumption with session tickets.
</p></dd>
<dt><code class="code">GNUTLS_KEY_SHARE_TOP</code></dt>
<dd><p>Generate key share for the first group which is enabled.
For example x25519. This option is the most performant for client (less CPU spent
generating keys), but if the server doesn’t support the advertised option it may
result to more roundtrips needed to discover the server’s choice.
</p></dd>
<dt><code class="code">GNUTLS_KEY_SHARE_TOP2</code></dt>
<dd><p>Generate key shares for the top-2 different groups which are enabled.
For example (ECDH + x25519). This is the default.
</p></dd>
<dt><code class="code">GNUTLS_KEY_SHARE_TOP3</code></dt>
<dd><p>Generate key shares for the top-3 different groups which are enabled.
That is, as each group is associated with a key type (EC, finite field, x25519), generate
three keys using <code class="code">GNUTLS_PK_DH</code> , <code class="code">GNUTLS_PK_EC</code> , <code class="code">GNUTLS_PK_ECDH_X25519</code> if all of them are enabled.
</p></dd>
<dt><code class="code">GNUTLS_POST_HANDSHAKE_AUTH</code></dt>
<dd><p>Enable post handshake authentication for server and client. When set and
a server requests authentication after handshake <code class="code">GNUTLS_E_REAUTH_REQUEST</code> will be returned
by <code class="code">gnutls_record_recv()</code> . A client should then call <code class="code">gnutls_reauth()</code> to re-authenticate.
</p></dd>
<dt><code class="code">GNUTLS_NO_AUTO_REKEY</code></dt>
<dd><p>Disable auto-rekeying under TLS1.3. If this option is not specified
gnutls will force a rekey after 2^24 records have been sent.
</p></dd>
<dt><code class="code">GNUTLS_SAFE_PADDING_CHECK</code></dt>
<dd><p>Flag to indicate that the TLS 1.3 padding check will be done in a
safe way which doesn’t leak the pad size based on GnuTLS processing time. This is of use to
applications which hide the length of transferred data via the TLS1.3 padding mechanism and
are already taking steps to hide the data processing time. This comes at a performance
penalty.
</p></dd>
<dt><code class="code">GNUTLS_ENABLE_EARLY_START</code></dt>
<dd><p>Under TLS1.3 allow the server to return earlier than the full handshake
finish; similarly to false start the handshake will be completed once data are received by the
client, while the server is able to transmit sooner. This is not enabled by default as it could
break certain existing server assumptions and use-cases. Since 3.6.4.
</p></dd>
<dt><code class="code">GNUTLS_ENABLE_RAWPK</code></dt>
<dd><p>Allows raw public-keys to be negotiated during the handshake. Since 3.6.6.
</p></dd>
<dt><code class="code">GNUTLS_AUTO_REAUTH</code></dt>
<dd><p>Enable transparent re-authentication in client side when the server
requests to. That is, reauthentication is handled within <code class="code">gnutls_record_recv()</code> , and
the <code class="code">GNUTLS_E_REHANDSHAKE</code> or <code class="code">GNUTLS_E_REAUTH_REQUEST</code> are not returned. This must be
enabled with <code class="code">GNUTLS_POST_HANDSHAKE_AUTH</code> for TLS1.3. Enabling this flag requires to restore
interrupted calls to <code class="code">gnutls_record_recv()</code> based on the output of <code class="code">gnutls_record_get_direction()</code> ,
since <code class="code">gnutls_record_recv()</code> could be interrupted when sending when this flag is enabled.
Note this flag may not be used if you are using the same session for sending and receiving
in different threads.
</p></dd>
<dt><code class="code">GNUTLS_ENABLE_EARLY_DATA</code></dt>
<dd><p>Under TLS1.3 allow the server to receive early data sent as part of the initial ClientHello (0-RTT).
This can also be used to explicitly indicate that the client will send early data.
This is not enabled by default as early data has weaker security properties than other data. Since 3.6.5.
</p></dd>
<dt><code class="code">GNUTLS_NO_AUTO_SEND_TICKET</code></dt>
<dd><p>Under TLS1.3 disable auto-sending of
session tickets during the handshake.
</p></dd>
<dt><code class="code">GNUTLS_NO_END_OF_EARLY_DATA</code></dt>
<dd><p>Under TLS1.3 suppress sending EndOfEarlyData message. Since 3.7.2.
</p></dd>
<dt><code class="code">GNUTLS_NO_TICKETS_TLS12</code></dt>
<dd><p>Flag to indicate that the session should not use resumption with session tickets. This flag only has effect if TLS 1.2 is used.
</p></dd>
<dt><code class="code">GNUTLS_NO_STATUS_REQUEST</code></dt>
<dd><p>Prevents client from including the "status_request" TLS extension
in the client hello, thus disabling the receival of certificate status information. Since 3.8.0.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 6.2: </strong>The <code class="code">gnutls_init_flags_t</code> enumeration.</p></div></div>
<p>After the session initialization details on the allowed ciphersuites
and protocol versions should be set using the priority functions
such as <a class="ref" href="#gnutls_005fpriority_005fset">gnutls_priority_set</a> and <a class="ref" href="#gnutls_005fpriority_005fset_005fdirect">gnutls_priority_set_direct</a>.
We elaborate on them in <a class="ref" href="#Priority-Strings">Priority strings</a>.
The credentials used for the key exchange method, such as certificates
or usernames and passwords should also be associated with the session
current session using <a class="ref" href="#gnutls_005fcredentials_005fset">gnutls_credentials_set</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcredentials_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_credentials_set</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_credentials_type_t <var class="var">type</var>, void * <var class="var">cred</var>)</code><a class="copiable-link" href="#index-gnutls_005fcredentials_005fset"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">type</var>: is the type of the credentials
</p>
<p><var class="var">cred</var>: the credentials to set
</p>
<p>Sets the needed credentials for the specified type. E.g. username,
password - or public and private keys etc. The <code class="code">cred</code> parameter is
a structure that depends on the specified <code class="code">type</code> and on the current
session (client or server). Only a single <code class="code">cred</code> may be set for
each different <code class="code">type</code> , subsequent calls with the same <code class="code">type</code> will
replace the previously set credentials.
</p>
<p>In order to minimize memory usage, and share credentials between
several threads gnutls keeps a pointer to <code class="code">cred</code> , and not the whole
cred structure. Thus you will have to keep the structure allocated
until you call <code class="code">gnutls_deinit()</code> , or a future call of
<code class="code">gnutls_credentials_set()</code> with the same <code class="code">type</code> replaces the <code class="code">cred</code> structure.
</p>
<p>For <code class="code">GNUTLS_CRD_ANON</code> , <code class="code">cred</code> should be
<code class="code">gnutls_anon_client_credentials_t</code> in case of a client. In case of
a server it should be <code class="code">gnutls_anon_server_credentials_t</code> .
</p>
<p>For <code class="code">GNUTLS_CRD_SRP</code> , <code class="code">cred</code> should be <code class="code">gnutls_srp_client_credentials_t</code>
in case of a client, and <code class="code">gnutls_srp_server_credentials_t</code> , in case
of a server.
</p>
<p>For <code class="code">GNUTLS_CRD_CERTIFICATE</code> , <code class="code">cred</code> should be
<code class="code">gnutls_certificate_credentials_t</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Associating-the-credentials">
<div class="nav-panel">
<p>
Next: <a href="#Setting-up-the-transport-layer" accesskey="n" rel="next">Setting up the transport layer</a>, Previous: <a href="#Session-initialization" accesskey="p" rel="prev">Session initialization</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Associating-the-credentials-1"><span>6.4 Associating the credentials<a class="copiable-link" href="#Associating-the-credentials-1"> ¶</a></span></h3>
<p>Each authentication method is associated with a key exchange method, and a credentials type.
The contents of the credentials is method-dependent, e.g. certificates
for certificate authentication and should be initialized and associated
with a session (see <a class="ref" href="#gnutls_005fcredentials_005fset">gnutls_credentials_set</a>). A mapping of the key exchange methods
with the credential types is shown in <a class="ref" href="#tab_003akey_002dexchange_002dcred">Table 6.2</a>.
</p>
<div class="float" id="tab_003akey_002dexchange_002dcred">
<table class="multitable">
<thead><tr><th width="25%">Authentication method</th><th width="25%">Key exchange</th><th width="20%">Client credentials</th><th width="20%">Server credentials</th></tr></thead>
<tbody><tr><td width="25%">Certificate and Raw public-key</td><td width="25%"><code class="code">KX_RSA</code>,
<code class="code">KX_DHE_RSA</code>,
<code class="code">KX_DHE_DSS</code>,
<code class="code">KX_ECDHE_RSA</code>,
<code class="code">KX_ECDHE_ECDSA</code></td><td width="20%"><code class="code">CRD_CERTIFICATE</code></td><td width="20%"><code class="code">CRD_CERTIFICATE</code></td></tr>
<tr><td width="25%">Password and certificate</td><td width="25%"><code class="code">KX_SRP_RSA</code>, <code class="code">KX_SRP_DSS</code></td><td width="20%"><code class="code">CRD_SRP</code></td><td width="20%"><code class="code">CRD_CERTIFICATE</code>, <code class="code">CRD_SRP</code></td></tr>
<tr><td width="25%">Password</td><td width="25%"><code class="code">KX_SRP</code></td><td width="20%"><code class="code">CRD_SRP</code></td><td width="20%"><code class="code">CRD_SRP</code></td></tr>
<tr><td width="25%">Anonymous</td><td width="25%"><code class="code">KX_ANON_DH</code>,
<code class="code">KX_ANON_ECDH</code></td><td width="20%"><code class="code">CRD_ANON</code></td><td width="20%"><code class="code">CRD_ANON</code></td></tr>
<tr><td width="25%">Pre-shared key</td><td width="25%"><code class="code">KX_PSK</code>,
<code class="code">KX_DHE_PSK</code>, <code class="code">KX_ECDHE_PSK</code></td><td width="20%"><code class="code">CRD_PSK</code></td><td width="20%"><code class="code">CRD_PSK</code></td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 6.2: </strong>Key exchange algorithms and the corresponding credential types.</p></div></div>
<ul class="mini-toc">
<li><a href="#Certificate-credentials" accesskey="1">Certificates</a></li>
<li><a href="#Raw-public_002dkey-credentials" accesskey="2">Raw public-keys</a></li>
<li><a href="#SRP-credentials" accesskey="3">SRP</a></li>
<li><a href="#PSK-credentials" accesskey="4">PSK</a></li>
<li><a href="#Anonymous-credentials" accesskey="5">Anonymous</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Certificate-credentials">
<div class="nav-panel">
<p>
Next: <a href="#Raw-public_002dkey-credentials" accesskey="n" rel="next">Raw public-keys</a>, Up: <a href="#Associating-the-credentials" accesskey="u" rel="up">Associating the credentials</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Certificates"><span>6.4.1 Certificates<a class="copiable-link" href="#Certificates"> ¶</a></span></h4>
<h4 class="subsubheading" id="Server-certificate-authentication"><span>Server certificate authentication<a class="copiable-link" href="#Server-certificate-authentication"> ¶</a></span></h4>
<p>When using certificates the server is required to have at least one
certificate and private key pair. Clients may not hold such
a pair, but a server could require it. In this section we discuss
general issues applying to both client and server certificates. The next
section will elaborate on issues arising from client authentication only.
</p>
<p>In order to use certificate credentials one must first initialize a credentials
structure of type <code class="code">gnutls_certificate_credentials_t</code>. After use this structure must
be freed. This can be done with the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fallocate_005fcredentials">gnutls_certificate_allocate_credentials</a> (gnutls_certificate_credentials_t * <var class="var">res</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005ffree_005fcredentials">gnutls_certificate_free_credentials</a> (gnutls_certificate_credentials_t <var class="var">sc</var>)</code></dt>
</dl>
<p>After the credentials structures are initialized, the certificate
and key pair must be loaded. This occurs before any <abbr class="acronym">TLS</abbr>
session is initialized, and the same structures are reused for multiple sessions.
Depending on the certificate type different loading functions
are available, as shown below.
For <abbr class="acronym">X.509</abbr> certificates, the functions will
accept and use a certificate chain that leads to a trusted
authority. The certificate chain must be ordered in such way that every
certificate certifies the one before it. The trusted authority’s
certificate need not to be included since the peer should possess it
already.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2">gnutls_certificate_set_x509_key_file2</a> (gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">certfile</var>, const char * <var class="var">keyfile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem2">gnutls_certificate_set_x509_key_mem2</a> (gnutls_certificate_credentials_t <var class="var">res</var>, const gnutls_datum_t * <var class="var">cert</var>, const gnutls_datum_t * <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey">gnutls_certificate_set_x509_key</a> (gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_x509_crt_t * <var class="var">cert_list</var>, int <var class="var">cert_list_size</var>, gnutls_x509_privkey_t <var class="var">key</var>)</code></dt>
</dl>
<p>It is recommended to use the higher level functions such as <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2">gnutls_certificate_set_x509_key_file2</a>
which accept not only file names but URLs that specify objects stored in token,
or system certificates and keys (see <a class="ref" href="#Application_002dspecific-keys">System and application-specific keys</a>). For these cases, another important
function is <a class="ref" href="#gnutls_005fcertificate_005fset_005fpin_005ffunction">gnutls_certificate_set_pin_function</a>, that
allows setting a callback function to retrieve a PIN if the input keys are
protected by PIN.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_pin_function</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">fn</var>: A PIN callback
</p>
<p><var class="var">userdata</var>: Data to be passed in the callback
</p>
<p>This function will set a callback function to be used when
required to access a protected object. This function overrides any other
global PIN functions.
</p>
<p>Note that this function must be called right after initialization
to have effect.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<p>If the imported keys and certificates need to be accessed before any TLS session
is established, it is convenient to use <a class="ref" href="#gnutls_005fcertificate_005fset_005fkey">gnutls_certificate_set_key</a>
in combination with <a class="ref" href="#gnutls_005fpcert_005fimport_005fx509_005fraw">gnutls_pcert_import_x509_raw</a> and <a class="ref" href="#gnutls_005fprivkey_005fimport_005fx509_005fraw">gnutls_privkey_import_x509_raw</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_key</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const char ** <var class="var">names</var>, int <var class="var">names_size</var>, gnutls_pcert_st * <var class="var">pcert_list</var>, int <var class="var">pcert_list_size</var>, gnutls_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">names</var>: is an array of DNS names belonging to the public-key (NULL if none)
</p>
<p><var class="var">names_size</var>: holds the size of the names list
</p>
<p><var class="var">pcert_list</var>: contains a certificate list (chain) or raw public-key
</p>
<p><var class="var">pcert_list_size</var>: holds the size of the certificate list
</p>
<p><var class="var">key</var>: is a <code class="code">gnutls_privkey_t</code> key corresponding to the first public-key in pcert_list
</p>
<p>This function sets a public/private key pair in the
gnutls_certificate_credentials_t type. The given public key may be encapsulated
in a certificate or can be given as a raw key. This function may be
called more than once, in case multiple key pairs exist for
the server. For clients that want to send more than their own end-
entity certificate (e.g., also an intermediate CA cert), the full
certificate chain must be provided in <code class="code">pcert_list</code> .
</p>
<p>Note that the <code class="code">key</code> will become part of the credentials structure and must
not be deallocated. It will be automatically deallocated when the <code class="code">res</code> structure
is deinitialized.
</p>
<p>If this function fails, the <code class="code">res</code> structure is at an undefined state and it must
not be reused to load other keys or certificates.
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used for other functions to refer to the added key-pair.
</p>
<p>Since GnuTLS 3.6.6 this function also handles raw public keys.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<p>If multiple certificates are used with the functions above each
client’s request will be served with the certificate that matches the
requested name (see <a class="ref" href="#Server-name-indication">Server name indication</a>).
</p>
<p>As an alternative to loading from files or buffers, a callback may be used for the
server or the client to specify the certificate and the key at the handshake time.
In that case a certificate should be selected according the peer’s signature
algorithm preferences. To get those preferences use
<a class="ref" href="#gnutls_005fsign_005falgorithm_005fget_005frequested">gnutls_sign_algorithm_get_requested</a>. Both functions are shown below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction">gnutls_certificate_set_retrieve_function</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function * <var class="var">func</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction2">gnutls_certificate_set_retrieve_function2</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function2 * <var class="var">func</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction3">gnutls_certificate_set_retrieve_function3</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function3 * <var class="var">func</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsign_005falgorithm_005fget_005frequested">gnutls_sign_algorithm_get_requested</a> (gnutls_session_t <var class="var">session</var>, size_t <var class="var">indx</var>, gnutls_sign_algorithm_t * <var class="var">algo</var>)</code></dt>
</dl>
<p>The functions above do not handle the requested server name automatically.
A server would need to check the name requested by the client
using <a class="ref" href="#gnutls_005fserver_005fname_005fget">gnutls_server_name_get</a>, and serve the appropriate
certificate. Note that some of these functions require the <code class="code">gnutls_pcert_st</code> structure to be
filled in. Helper functions to fill in the structure are listed below.
</p>
<pre class="verbatim">typedef struct gnutls_pcert_st
{
gnutls_pubkey_t pubkey;
gnutls_datum_t cert;
gnutls_certificate_type_t type;
} gnutls_pcert_st;
</pre>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpcert_005fimport_005fx509">gnutls_pcert_import_x509</a> (gnutls_pcert_st * <var class="var">pcert</var>, gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpcert_005fimport_005fx509_005fraw">gnutls_pcert_import_x509_raw</a> (gnutls_pcert_st * <var class="var">pcert</var>, const gnutls_datum_t * <var class="var">cert</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpcert_005fdeinit">gnutls_pcert_deinit</a> (gnutls_pcert_st * <var class="var">pcert</var>)</code></dt>
</dl>
<p>In a handshake, the negotiated cipher suite depends on the
certificate’s parameters, so some key exchange methods might not be
available with all certificates. <abbr class="acronym">GnuTLS</abbr> will disable
ciphersuites that are not compatible with the key, or the enabled
authentication methods. For example keys marked as sign-only, will
not be able to access the plain RSA ciphersuites, that require
decryption. It is not recommended to use RSA keys for both
signing and encryption. If possible use a different key for the
<code class="code">DHE-RSA</code> which uses signing and <code class="code">RSA</code> that requires decryption.
All the key exchange methods shown in <a class="ref" href="#tab_003akey_002dexchange">Table 4.1</a> are
available in certificate authentication.
</p>
<h4 class="subsubheading" id="Client-certificate-authentication"><span>Client certificate authentication<a class="copiable-link" href="#Client-certificate-authentication"> ¶</a></span></h4>
<p>If a certificate is to be requested from the client during the handshake, the server
will send a certificate request message. This behavior is controlled by <a class="ref" href="#gnutls_005fcertificate_005fserver_005fset_005frequest">gnutls_certificate_server_set_request</a>.
The request contains a list of the by the server accepted certificate signers. This list
is constructed using the trusted certificate authorities of the server.
In cases where the server supports a large number of certificate authorities
it makes sense not to advertise all of the names to save bandwidth. That can
be controlled using the function <a class="ref" href="#gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence">gnutls_certificate_send_x509_rdn_sequence</a>.
This however will have the side-effect of not restricting the client to certificates
signed by server’s acceptable signers.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fserver_005fset_005frequest"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_server_set_request</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_certificate_request_t <var class="var">req</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fserver_005fset_005frequest"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">req</var>: is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE, GNUTLS_CERT_IGNORE
</p>
<p>This function specifies if we (in case of a server) are going to
send a certificate request message to the client. If <code class="code">req</code> is
GNUTLS_CERT_REQUIRE then the server will return the <code class="code">GNUTLS_E_NO_CERTIFICATE_FOUND</code>
error if the peer does not provide a certificate. If you do not call this
function then the client will not be asked to send a certificate. Invoking
the function with <code class="code">req</code> GNUTLS_CERT_IGNORE has the same effect.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_send_x509_rdn_sequence</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">status</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">status</var>: is 0 or 1
</p>
<p>If status is non zero, this function will order gnutls not to send
the rdnSequence in the certificate request message. That is the
server will not advertise its trusted CAs to the peer. If status
is zero then the default behaviour will take effect, which is to
advertise the server’s trusted CAs.
</p>
<p>This function has no effect in clients, and in authentication
methods other than certificate with X.509 certificates.
</p></dd></dl>
<p>On the client side, it needs to set its certificates on the credentials
structure, similarly to server side from a file, or via a callback. Once the
certificates are available in the credentials structure, the client will
send them if during the handshake the server requests a certificate signed
by the issuer of its CA.
</p>
<p>In the case a single certificate is available and the server does not
specify a signer’s list, then that certificate is always sent. It is,
however possible, to send a certificate even when the advertised CA
list by the server contains CAs other than its signer. That can be achieved
using the <code class="code">GNUTLS_FORCE_CLIENT_CERT</code> flag in <a class="ref" href="#gnutls_005finit">gnutls_init</a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile">gnutls_certificate_set_x509_key_file</a> (gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">certfile</var>, const char * <var class="var">keyfile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile">gnutls_certificate_set_x509_simple_pkcs12_file</a> (gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">pkcs12file</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">password</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction2">gnutls_certificate_set_retrieve_function2</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function2 * <var class="var">func</var>)</code></dt>
</dl>
<h4 class="subsubheading" id="Client-or-server-certificate-verification"><span>Client or server certificate verification<a class="copiable-link" href="#Client-or-server-certificate-verification"> ¶</a></span></h4>
<p>Certificate verification is possible by loading the trusted
authorities into the credentials structure by using
the following functions, applicable to X.509 certificates.
In modern systems it is recommended to utilize <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust">gnutls_certificate_set_x509_system_trust</a>
which will load the trusted authorities from the system store.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_system_trust</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>This function adds the system’s default trusted CAs in order to
verify client or server certificates.
</p>
<p>In the case the system is currently unsupported <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code>
is returned.
</p>
<p><strong class="strong">Returns:</strong> the number of certificates processed or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 3.0.20
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile">gnutls_certificate_set_x509_trust_file</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">cafile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir">gnutls_certificate_set_x509_trust_dir</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">ca_dir</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code></dt>
</dl>
<p>The peer’s certificate will be automatically verified if
<a class="ref" href="#gnutls_005fsession_005fset_005fverify_005fcert">gnutls_session_set_verify_cert</a> is called prior to handshake.
</p>
<p>Alternatively, one must set a callback function during the handshake
using <a class="ref" href="#gnutls_005fcertificate_005fset_005fverify_005ffunction">gnutls_certificate_set_verify_function</a>, which
will verify the peer’s certificate once received. The verification
should happen using <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers3">gnutls_certificate_verify_peers3</a> within
the callback. It will verify the certificate’s signature and the owner
of the certificate. That will provide a brief verification output. If a
detailed output is required one should call <a class="ref" href="#gnutls_005fcertificate_005fget_005fpeers">gnutls_certificate_get_peers</a>
to obtain the raw certificate of the peer and verify it using the
functions discussed in <a class="ref" href="#X_002e509-certificates"><abbr class="acronym">X.509</abbr> certificates</a>.
</p>
<p>In both the automatic and the manual cases, the verification status returned
can be printed using <a class="ref" href="#gnutls_005fcertificate_005fverification_005fstatus_005fprint">gnutls_certificate_verification_status_print</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fverify_005fcert"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_set_verify_cert</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fverify_005fcert"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">hostname</var>: is the expected name of the peer; may be <code class="code">NULL</code>
</p>
<p><var class="var">flags</var>: flags for certificate verification – <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p>This function instructs GnuTLS to verify the peer’s certificate
using the provided hostname. If the verification fails the handshake
will also fail with <code class="code">GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR</code> . In that
case the verification result can be obtained using <code class="code">gnutls_session_get_verify_cert_status()</code> .
</p>
<p>The <code class="code">hostname</code> pointer provided must remain valid for the lifetime
of the session. More precisely it should be available during any subsequent
handshakes. If no hostname is provided, no hostname verification
will be performed. For a more advanced verification function check
<code class="code">gnutls_session_set_verify_cert2()</code> .
</p>
<p>If <code class="code">flags</code> is provided which contain a profile, this function should be
called after any session priority setting functions.
</p>
<p>The <code class="code">gnutls_session_set_verify_cert()</code> function is intended to be used by TLS
clients to verify the server’s certificate.
</p>
<p><strong class="strong">Since:</strong> 3.4.6
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers3">gnutls_certificate_verify_peers3</a> (gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, unsigned int * <var class="var">status</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fverify_005ffunction">gnutls_certificate_set_verify_function</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_verify_function * <var class="var">func</var>)</code></dt>
</dl>
<p>Note that when using raw public-keys verification will not work because there is no corresponding
certificate body belonging to the raw key that can be verified. In that case the <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers">gnutls_certificate_verify_peers</a>
family of functions will return a GNUTLS_E_INVALID_REQUEST error code. For authenticating raw public-keys
one must use an out-of-band mechanism, e.g. by comparing hashes or using trust on first use
(see <a class="ref" href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a>).
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Raw-public_002dkey-credentials">
<div class="nav-panel">
<p>
Next: <a href="#SRP-credentials" accesskey="n" rel="next">SRP</a>, Previous: <a href="#Certificate-credentials" accesskey="p" rel="prev">Certificates</a>, Up: <a href="#Associating-the-credentials" accesskey="u" rel="up">Associating the credentials</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Raw-public_002dkeys-2"><span>6.4.2 Raw public-keys<a class="copiable-link" href="#Raw-public_002dkeys-2"> ¶</a></span></h4>
<p>As of version 3.6.6 GnuTLS supports <a class="ref" href="#Raw-public_002dkeys">Raw public-keys</a>. With raw public-keys only the
public-key part (that is normally embedded in a certificate) is transmitted to the peer.
In order to load a raw public-key and its corresponding private key in a credentials
structure one can use the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fkey">gnutls_certificate_set_key</a> (gnutls_certificate_credentials_t <var class="var">res</var>, const char ** <var class="var">names</var>, int <var class="var">names_size</var>, gnutls_pcert_st * <var class="var">pcert_list</var>, int <var class="var">pcert_list_size</var>, gnutls_privkey_t <var class="var">key</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005frawpk_005fkey_005fmem">gnutls_certificate_set_rawpk_key_mem</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, const gnutls_datum_t * <var class="var">spki</var>, const gnutls_datum_t * <var class="var">pkey</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">key_usage</var>, const char ** <var class="var">names</var>, unsigned int <var class="var">names_length</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005frawpk_005fkey_005ffile">gnutls_certificate_set_rawpk_key_file</a> (gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">rawpkfile</var>, const char * <var class="var">privkeyfile</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">key_usage</var>, const char ** <var class="var">names</var>, unsigned int <var class="var">names_length</var>, unsigned int <var class="var">privkey_flags</var>, unsigned int <var class="var">pkcs11_flags</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="SRP-credentials">
<div class="nav-panel">
<p>
Next: <a href="#PSK-credentials" accesskey="n" rel="next">PSK</a>, Previous: <a href="#Raw-public_002dkey-credentials" accesskey="p" rel="prev">Raw public-keys</a>, Up: <a href="#Associating-the-credentials" accesskey="u" rel="up">Associating the credentials</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="SRP"><span>6.4.3 SRP<a class="copiable-link" href="#SRP"> ¶</a></span></h4>
<p>The initialization functions in SRP credentials differ between
client and server.
Clients supporting <abbr class="acronym">SRP</abbr> should set the username and password
prior to connection, to the credentials structure.
Alternatively <a class="ref" href="#gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction">gnutls_srp_set_client_credentials_function</a>
may be used instead, to specify a callback function that should return the
SRP username and password.
The callback is called once during the <abbr class="acronym">TLS</abbr> handshake.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrp_005fallocate_005fserver_005fcredentials">gnutls_srp_allocate_server_credentials</a> (gnutls_srp_server_credentials_t * <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrp_005fallocate_005fclient_005fcredentials">gnutls_srp_allocate_client_credentials</a> (gnutls_srp_client_credentials_t * <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fsrp_005ffree_005fserver_005fcredentials">gnutls_srp_free_server_credentials</a> (gnutls_srp_server_credentials_t <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fsrp_005ffree_005fclient_005fcredentials">gnutls_srp_free_client_credentials</a> (gnutls_srp_client_credentials_t <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsrp_005fset_005fclient_005fcredentials">gnutls_srp_set_client_credentials</a> (gnutls_srp_client_credentials_t <var class="var">res</var>, const char * <var class="var">username</var>, const char * <var class="var">password</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_set_client_credentials_function</strong> <code class="def-code-arguments">(gnutls_srp_client_credentials_t <var class="var">cred</var>, gnutls_srp_client_credentials_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the
username and password for client SRP authentication. The
callback’s function form is:
</p>
<p>int (*callback)(gnutls_session_t, char** username, char**password);
</p>
<p>The <code class="code">username</code> and <code class="code">password</code> must be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p>The <code class="code">username</code> should be an ASCII string or UTF-8
string. In case of a UTF-8 string it is recommended to be following
the PRECIS framework for usernames (rfc8265). The password can
be in ASCII format, or normalized using <code class="code">gnutls_utf8_password_normalize()</code> .
</p>
<p>The callback function will be called once per handshake before the
initial hello message is sent.
</p>
<p>The callback should not return a negative error code the second
time called, since the handshake procedure will be aborted.
</p>
<p>The callback function should return 0 on success.
-1 indicates an error.
</p></dd></dl>
<p>In server side the default behavior of <abbr class="acronym">GnuTLS</abbr> is to read
the usernames and <abbr class="acronym">SRP</abbr> verifiers from password files. These
password file format is compatible the with the <em class="emph">Stanford srp libraries</em>
format. If a different password file format is to be used, then
<a class="ref" href="#gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction">gnutls_srp_set_server_credentials_function</a> should be called,
to set an appropriate callback.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_set_server_credentials_file</strong> <code class="def-code-arguments">(gnutls_srp_server_credentials_t <var class="var">res</var>, const char * <var class="var">password_file</var>, const char * <var class="var">password_conf_file</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p><var class="var">password_file</var>: is the SRP password file (tpasswd)
</p>
<p><var class="var">password_conf_file</var>: is the SRP password conf file (tpasswd.conf)
</p>
<p>This function sets the password files, in a
<code class="code">gnutls_srp_server_credentials_t</code> type. Those password files
hold usernames and verifiers and will be used for SRP
authentication.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_set_server_credentials_function</strong> <code class="def-code-arguments">(gnutls_srp_server_credentials_t <var class="var">cred</var>, gnutls_srp_server_credentials_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the user’s
SRP credentials. The callback’s function form is:
</p>
<p>int (*callback)(gnutls_session_t, const char* username,
gnutls_datum_t *salt, gnutls_datum_t *verifier, gnutls_datum_t *generator,
gnutls_datum_t *prime);
</p>
<p><code class="code">username</code> contains the actual username.
The <code class="code">salt</code> , <code class="code">verifier</code> , <code class="code">generator</code> and <code class="code">prime</code> must be filled
in using the <code class="code">gnutls_malloc()</code> . For convenience <code class="code">prime</code> and <code class="code">generator</code> may also be one of the static parameters defined in gnutls.h.
</p>
<p>Initially, the data field is NULL in every <code class="code">gnutls_datum_t</code>
structure that the callback has to fill in. When the
callback is done GnuTLS deallocates all of those buffers
which are non-NULL, regardless of the return value.
</p>
<p>In order to prevent attackers from guessing valid usernames,
if a user does not exist, g and n values should be filled in
using a random user’s parameters. In that case the callback must
return the special value (1).
See <code class="code">gnutls_srp_set_server_fake_salt_seed</code> too.
If this is not required for your application, return a negative
number from the callback to abort the handshake.
</p>
<p>The callback function will only be called once per handshake.
The callback function should return 0 on success, while
-1 indicates an error.
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="PSK-credentials">
<div class="nav-panel">
<p>
Next: <a href="#Anonymous-credentials" accesskey="n" rel="next">Anonymous</a>, Previous: <a href="#SRP-credentials" accesskey="p" rel="prev">SRP</a>, Up: <a href="#Associating-the-credentials" accesskey="u" rel="up">Associating the credentials</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="PSK"><span>6.4.4 PSK<a class="copiable-link" href="#PSK"> ¶</a></span></h4>
<p>The initialization functions in PSK credentials differ between
client and server.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpsk_005fallocate_005fserver_005fcredentials">gnutls_psk_allocate_server_credentials</a> (gnutls_psk_server_credentials_t * <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpsk_005fallocate_005fclient_005fcredentials">gnutls_psk_allocate_client_credentials</a> (gnutls_psk_client_credentials_t * <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpsk_005ffree_005fserver_005fcredentials">gnutls_psk_free_server_credentials</a> (gnutls_psk_server_credentials_t <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpsk_005ffree_005fclient_005fcredentials">gnutls_psk_free_client_credentials</a> (gnutls_psk_client_credentials_t <var class="var">sc</var>)</code></dt>
</dl>
<p>Clients supporting <abbr class="acronym">PSK</abbr> should supply the username and key
before a TLS session is established. Alternatively
<a class="ref" href="#gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction">gnutls_psk_set_client_credentials_function</a> can be used to
specify a callback function. This has the
advantage that the callback will be called only if <abbr class="acronym">PSK</abbr> has
been negotiated.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpsk_005fset_005fclient_005fcredentials">gnutls_psk_set_client_credentials</a> (gnutls_psk_client_credentials_t <var class="var">res</var>, const char * <var class="var">username</var>, const gnutls_datum_t * <var class="var">key</var>, gnutls_psk_key_flags <var class="var">flags</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_client_credentials_function</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t <var class="var">cred</var>, gnutls_psk_client_credentials_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the username and
password for client PSK authentication.
The callback’s function form is:
int (*callback)(gnutls_session_t, char** username,
gnutls_datum_t* key);
</p>
<p>The <code class="code">username</code> and <code class="code">key</code> ->data must be allocated using <code class="code">gnutls_malloc()</code> .
The <code class="code">username</code> should be an ASCII string or UTF-8
string. In case of a UTF-8 string it is recommended to be following
the PRECIS framework for usernames (rfc8265).
</p>
<p>The callback function will be called once per handshake.
</p>
<p>The callback function should return 0 on success.
-1 indicates an error.
</p></dd></dl>
<p>In server side the default behavior of <abbr class="acronym">GnuTLS</abbr> is to read
the usernames and <abbr class="acronym">PSK</abbr> keys from a password file. The
password file should contain usernames and keys in hexadecimal
format. The name of the password file can be stored to the credentials
structure by calling <a class="ref" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile">gnutls_psk_set_server_credentials_file</a>. If
a different password file format is to be used, then
a callback should be set instead by <a class="ref" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction">gnutls_psk_set_server_credentials_function</a>.
</p>
<p>The server can help the client chose a suitable username and password,
by sending a hint. Note that there is no common profile for the PSK hint and applications
are discouraged to use it.
A server, may specify the hint by calling
<a class="ref" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint">gnutls_psk_set_server_credentials_hint</a>. The client can retrieve
the hint, for example in the callback function, using
<a class="ref" href="#gnutls_005fpsk_005fclient_005fget_005fhint">gnutls_psk_client_get_hint</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_set_server_credentials_file</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">res</var>, const char * <var class="var">password_file</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">password_file</var>: is the PSK password file (passwd.psk)
</p>
<p>This function sets the password file, in a
<code class="code">gnutls_psk_server_credentials_t</code> type. This password file
holds usernames and keys and will be used for PSK authentication.
</p>
<p>Each entry in the file consists of a username, followed by a colon
(’:’) and a hex-encoded key. If the username contains a colon or
any other special character, it can be hex-encoded preceded by a
’#’.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction">gnutls_psk_set_server_credentials_function</a> (gnutls_psk_server_credentials_t <var class="var">cred</var>, gnutls_psk_server_credentials_function * <var class="var">func</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint">gnutls_psk_set_server_credentials_hint</a> (gnutls_psk_server_credentials_t <var class="var">res</var>, const char * <var class="var">hint</var>)</code></dt>
<dt><code class="code"><var class="var">const char *</var> <a class="ref" href="#gnutls_005fpsk_005fclient_005fget_005fhint">gnutls_psk_client_get_hint</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="Anonymous-credentials">
<div class="nav-panel">
<p>
Previous: <a href="#PSK-credentials" accesskey="p" rel="prev">PSK</a>, Up: <a href="#Associating-the-credentials" accesskey="u" rel="up">Associating the credentials</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Anonymous"><span>6.4.5 Anonymous<a class="copiable-link" href="#Anonymous"> ¶</a></span></h4>
<p>The key exchange methods for anonymous authentication
since GnuTLS 3.6.0 will utilize the RFC7919 parameters, unless
explicit parameters have been provided and associated with an
anonymous credentials structure. Check <a class="ref" href="#Parameter-generation">Parameter generation</a> for more information.
The initialization functions for the credentials are shown below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fanon_005fallocate_005fserver_005fcredentials">gnutls_anon_allocate_server_credentials</a> (gnutls_anon_server_credentials_t * <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fanon_005fallocate_005fclient_005fcredentials">gnutls_anon_allocate_client_credentials</a> (gnutls_anon_client_credentials_t * <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fanon_005ffree_005fserver_005fcredentials">gnutls_anon_free_server_credentials</a> (gnutls_anon_server_credentials_t <var class="var">sc</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fanon_005ffree_005fclient_005fcredentials">gnutls_anon_free_client_credentials</a> (gnutls_anon_client_credentials_t <var class="var">sc</var>)</code></dt>
</dl>
<hr>
</div>
</div>
<div class="section-level-extent" id="Setting-up-the-transport-layer">
<div class="nav-panel">
<p>
Next: <a href="#TLS-handshake" accesskey="n" rel="next">TLS handshake</a>, Previous: <a href="#Associating-the-credentials" accesskey="p" rel="prev">Associating the credentials</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Setting-up-the-transport-layer-1"><span>6.5 Setting up the transport layer<a class="copiable-link" href="#Setting-up-the-transport-layer-1"> ¶</a></span></h3>
<p>The next step is to setup the underlying transport layer details. The
Berkeley sockets are implicitly used by GnuTLS, thus a
call to <a class="ref" href="#gnutls_005ftransport_005fset_005fint">gnutls_transport_set_int</a> would be sufficient to
specify the socket descriptor.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftransport_005fset_005fint">gnutls_transport_set_int</a> (gnutls_session_t <var class="var">session</var>, int <var class="var">fd</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftransport_005fset_005fint2">gnutls_transport_set_int2</a> (gnutls_session_t <var class="var">session</var>, int <var class="var">recv_fd</var>, int <var class="var">send_fd</var>)</code></dt>
</dl>
<p>If however another transport layer than TCP is selected, then
a pointer should be used instead to express the parameter to be
passed to custom functions. In that case the following functions should
be used instead.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftransport_005fset_005fptr">gnutls_transport_set_ptr</a> (gnutls_session_t <var class="var">session</var>, gnutls_transport_ptr_t <var class="var">ptr</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftransport_005fset_005fptr2">gnutls_transport_set_ptr2</a> (gnutls_session_t <var class="var">session</var>, gnutls_transport_ptr_t <var class="var">recv_ptr</var>, gnutls_transport_ptr_t <var class="var">send_ptr</var>)</code></dt>
</dl>
<p>Moreover all of the following push and pull callbacks should be set.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fpush_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_push_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_push_func <var class="var">push_func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fpush_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">push_func</var>: a callback function similar to <code class="code">write()</code>
</p>
<p>This is the function where you set a push function for gnutls to
use in order to send data. If you are going to use berkeley style
sockets, you do not need to use this function since the default
send(2) will probably be ok. Otherwise you should specify this
function for gnutls to be able to send data.
The callback should return a positive number indicating the
bytes sent, and -1 on error.
</p>
<p><code class="code">push_func</code> is of the form,
ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t);
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_vec_push_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_vec_push_func <var class="var">vec_func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">vec_func</var>: a callback function similar to <code class="code">writev()</code>
</p>
<p>Using this function you can override the default writev(2)
function for gnutls to send data. Setting this callback
instead of <code class="code">gnutls_transport_set_push_function()</code> is recommended
since it introduces less overhead in the TLS handshake process.
</p>
<p><code class="code">vec_func</code> is of the form,
ssize_t (*gnutls_vec_push_func) (gnutls_transport_ptr_t, const giovec_t * iov, int iovcnt);
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fpull_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_pull_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_pull_func <var class="var">pull_func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fpull_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">pull_func</var>: a callback function similar to <code class="code">read()</code>
</p>
<p>This is the function where you set a function for gnutls to receive
data. Normally, if you use berkeley style sockets, do not need to
use this function since the default recv(2) will probably be ok.
The callback should return 0 on connection termination, a positive
number indicating the number of bytes received, and -1 on error.
</p>
<p><code class="code">gnutls_pull_func</code> is of the form,
ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t);
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_pull_timeout_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_pull_timeout_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">func</var>: a callback function
</p>
<p>This is the function where you set a function for gnutls to know
whether data are ready to be received. It should wait for data a
given time frame in milliseconds. The callback should return 0 on
timeout, a positive number if data can be received, and -1 on error.
You’ll need to override this function if <code class="code">select()</code> is not suitable
for the provided transport calls.
</p>
<p>As with <code class="code">select()</code> , if the timeout value is zero the callback should return
zero if no data are immediately available. The special value
<code class="code">GNUTLS_INDEFINITE_TIMEOUT</code> indicates that the callback should wait indefinitely
for data.
</p>
<p><code class="code">gnutls_pull_timeout_func</code> is of the form,
int (*gnutls_pull_timeout_func)(gnutls_transport_ptr_t, unsigned int ms);
</p>
<p>This callback is necessary when <code class="code">gnutls_handshake_set_timeout()</code> or
<code class="code">gnutls_record_set_timeout()</code> are set, under TLS1.3 and for enforcing the DTLS
mode timeouts when in blocking mode.
</p>
<p>For compatibility with future GnuTLS versions this callback must be set when
a custom pull function is registered. The callback will not be used when the
session is in TLS mode with non-blocking sockets. That is, when <code class="code">GNUTLS_NONBLOCK</code>
is specified for a TLS session in <code class="code">gnutls_init()</code> .
</p>
<p>The helper function <code class="code">gnutls_system_recv_timeout()</code> is provided to
simplify writing callbacks.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<p>The functions above accept a callback function which
should return the number of bytes written, or -1 on
error and should set <code class="code">errno</code> appropriately.
In some environments, setting <code class="code">errno</code> is unreliable. For example
Windows have several errno variables in different CRTs, or in other
systems it may be a non thread-local variable. If this is a concern to
you, call <a class="ref" href="#gnutls_005ftransport_005fset_005ferrno">gnutls_transport_set_errno</a> with the intended errno
value instead of setting <code class="code">errno</code> directly.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005ferrno"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_errno</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">err</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005ferrno"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">err</var>: error value to store in session-specific errno variable.
</p>
<p>Store <code class="code">err</code> in the session-specific errno variable. Useful values
for <code class="code">err</code> are EINTR, EAGAIN and EMSGSIZE, other values are treated will be
treated as real errors in the push/pull function.
</p>
<p>This function is useful in replacement push and pull functions set by
<code class="code">gnutls_transport_set_push_function()</code> and
<code class="code">gnutls_transport_set_pull_function()</code> under Windows, where the
replacements may not have access to the same <code class="code">errno</code> variable that is used by GnuTLS (e.g., the application is linked to
msvcr71.dll and gnutls is linked to msvcrt.dll).
</p>
<p>This function is unreliable if you are using the same
<code class="code">session</code> in different threads for sending and receiving.
</p></dd></dl>
<p><abbr class="acronym">GnuTLS</abbr> currently only interprets the EINTR, EAGAIN and EMSGSIZE errno
values and returns the corresponding <abbr class="acronym">GnuTLS</abbr> error codes:
</p><ul class="itemize mark-bullet">
<li><code class="code">GNUTLS_E_INTERRUPTED</code>
</li><li><code class="code">GNUTLS_E_AGAIN</code>
</li><li><code class="code">GNUTLS_E_LARGE_PACKET</code>
</li></ul>
<p>The EINTR and EAGAIN values are returned by interrupted system calls,
or when non blocking IO is used. All <abbr class="acronym">GnuTLS</abbr> functions can be
resumed (called again), if any of the above error codes is returned. The
EMSGSIZE value is returned when attempting to send a large datagram.
</p>
<p>In the case of DTLS it is also desirable to override the generic
transport functions with functions that emulate the operation
of <code class="code">recvfrom</code> and <code class="code">sendto</code>. In addition
<abbr class="acronym">DTLS</abbr> requires timers during the receive of a handshake
message, set using the <a class="ref" href="#gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction">gnutls_transport_set_pull_timeout_function</a>
function. To check the retransmission timers the function
<a class="ref" href="#gnutls_005fdtls_005fget_005ftimeout">gnutls_dtls_get_timeout</a> is provided, which returns the time
remaining until the next retransmission, or better the time until
<a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> should be called again.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_pull_timeout_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_pull_timeout_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">func</var>: a callback function
</p>
<p>This is the function where you set a function for gnutls to know
whether data are ready to be received. It should wait for data a
given time frame in milliseconds. The callback should return 0 on
timeout, a positive number if data can be received, and -1 on error.
You’ll need to override this function if <code class="code">select()</code> is not suitable
for the provided transport calls.
</p>
<p>As with <code class="code">select()</code> , if the timeout value is zero the callback should return
zero if no data are immediately available. The special value
<code class="code">GNUTLS_INDEFINITE_TIMEOUT</code> indicates that the callback should wait indefinitely
for data.
</p>
<p><code class="code">gnutls_pull_timeout_func</code> is of the form,
int (*gnutls_pull_timeout_func)(gnutls_transport_ptr_t, unsigned int ms);
</p>
<p>This callback is necessary when <code class="code">gnutls_handshake_set_timeout()</code> or
<code class="code">gnutls_record_set_timeout()</code> are set, under TLS1.3 and for enforcing the DTLS
mode timeouts when in blocking mode.
</p>
<p>For compatibility with future GnuTLS versions this callback must be set when
a custom pull function is registered. The callback will not be used when the
session is in TLS mode with non-blocking sockets. That is, when <code class="code">GNUTLS_NONBLOCK</code>
is specified for a TLS session in <code class="code">gnutls_init()</code> .
</p>
<p>The helper function <code class="code">gnutls_system_recv_timeout()</code> is provided to
simplify writing callbacks.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fget_005ftimeout"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_dtls_get_timeout</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fget_005ftimeout"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return the milliseconds remaining
for a retransmission of the previously sent handshake
message. This function is useful when DTLS is used in
non-blocking mode, to estimate when to call <code class="code">gnutls_handshake()</code>
if no packets have been received.
</p>
<p><strong class="strong">Returns:</strong> the remaining time in milliseconds.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<ul class="mini-toc">
<li><a href="#Asynchronous-operation" accesskey="1">Asynchronous operation</a></li>
<li><a href="#Reducing-round_002dtrips" accesskey="2">Reducing round-trips</a></li>
<li><a href="#Zero_002droundtrip-mode" accesskey="3">Zero-roundtrip mode</a></li>
<li><a href="#Anti_002dreplay-protection" accesskey="4">Anti-replay protection</a></li>
<li><a href="#DTLS-sessions" accesskey="5">DTLS sessions</a></li>
<li><a href="#DTLS-and-SCTP" accesskey="6">DTLS and SCTP</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Asynchronous-operation">
<div class="nav-panel">
<p>
Next: <a href="#Reducing-round_002dtrips" accesskey="n" rel="next">Reducing round-trips</a>, Up: <a href="#Setting-up-the-transport-layer" accesskey="u" rel="up">Setting up the transport layer</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Asynchronous-operation-1"><span>6.5.1 Asynchronous operation<a class="copiable-link" href="#Asynchronous-operation-1"> ¶</a></span></h4>
<p><abbr class="acronym">GnuTLS</abbr> can be used with asynchronous socket or event-driven programming.
The approach is similar to using Berkeley sockets under such an environment.
The blocking, due to network interaction, calls such as
<a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a>, <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a>,
can be set to non-blocking by setting the underlying sockets to non-blocking.
If other push and pull functions are setup, then they should behave the same
way as <code class="code">recv</code> and <code class="code">send</code> when used in a non-blocking
way, i.e., return -1 and set errno to <code class="code">EAGAIN</code>. Since, during a TLS protocol session
<abbr class="acronym">GnuTLS</abbr> does not block except for network interaction, the non blocking
<code class="code">EAGAIN</code> errno will be propagated and <abbr class="acronym">GnuTLS</abbr> functions
will return the <code class="code">GNUTLS_E_AGAIN</code> error code. Such calls can be resumed the
same way as a system call would.
The only exception is <a class="ref" href="#gnutls_005frecord_005fsend">gnutls_record_send</a>,
which if interrupted subsequent calls need not to include the data to be
sent (can be called with NULL argument).
</p>
<p>When using the <code class="code">poll</code> or <code class="code">select</code> system calls though, one should remember
that they only apply to the kernel sockets API. To check for any
available buffered data in a <abbr class="acronym">GnuTLS</abbr> session,
utilize <a class="ref" href="#gnutls_005frecord_005fcheck_005fpending">gnutls_record_check_pending</a>,
either before the <code class="code">poll</code> system call, or after a call to
<a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a>. Data queued by <a class="ref" href="#gnutls_005frecord_005fsend">gnutls_record_send</a>
(when interrupted) can be discarded using <a class="ref" href="#gnutls_005frecord_005fdiscard_005fqueued">gnutls_record_discard_queued</a>.
</p>
<p>An example of GnuTLS’ usage with asynchronous operation can be found
in <code class="code">doc/examples/tlsproxy</code>.
</p>
<p>The following paragraphs describe the detailed requirements for non-blocking
operation when using the TLS or DTLS protocols.
</p>
<ul class="mini-toc">
<li><a href="#TLS-protocol" accesskey="1">TLS protocol</a></li>
<li><a href="#Datagram-TLS-protocol" accesskey="2">Datagram TLS protocol</a></li>
</ul>
<div class="subsubsection-level-extent" id="TLS-protocol">
<h4 class="subsubsection"><span>6.5.1.1 TLS protocol<a class="copiable-link" href="#TLS-protocol"> ¶</a></span></h4>
<p>There are no special requirements for the TLS protocol operation in non-blocking
mode if a non-blocking socket is used.
</p>
<p>It is recommended, however, for future compatibility, when in non-blocking mode, to
call the <a class="ref" href="#gnutls_005finit">gnutls_init</a> function with the
<code class="code">GNUTLS_NONBLOCK</code> flag set (see <a class="ref" href="#Session-initialization">Session initialization</a>).
</p>
</div>
<div class="subsubsection-level-extent" id="Datagram-TLS-protocol">
<h4 class="subsubsection"><span>6.5.1.2 Datagram TLS protocol<a class="copiable-link" href="#Datagram-TLS-protocol"> ¶</a></span></h4>
<p>When in non-blocking mode the function, the <a class="ref" href="#gnutls_005finit">gnutls_init</a> function
must be called with the <code class="code">GNUTLS_NONBLOCK</code> flag set (see <a class="ref" href="#Session-initialization">Session initialization</a>).
</p>
<p>In contrast with the TLS protocol, the pull timeout function is required,
but will only be called with a timeout of zero. In that case it should indicate
whether there are data to be received or not. When not using the default pull function,
then <a class="ref" href="#gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction">gnutls_transport_set_pull_timeout_function</a> should be called.
</p>
<p>Although in the TLS protocol implementation each call to receive or send
function implies to restoring the same function that was interrupted, in
the DTLS protocol this requirement isn’t true.
There are cases where a retransmission is required, which are indicated by
a received message and thus <a class="ref" href="#gnutls_005frecord_005fget_005fdirection">gnutls_record_get_direction</a> must be called
to decide which direction to check prior to restoring a function call.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fget_005fdirection"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_record_get_direction</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fget_005fdirection"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function is useful to determine whether a GnuTLS function was interrupted
while sending or receiving, so that <code class="code">select()</code> or <code class="code">poll()</code> may be called appropriately.
</p>
<p>It provides information about the internals of the record
protocol and is only useful if a prior gnutls function call,
e.g. <code class="code">gnutls_handshake()</code> , was interrupted and returned
<code class="code">GNUTLS_E_INTERRUPTED</code> or <code class="code">GNUTLS_E_AGAIN</code> . After such an interrupt
applications may call <code class="code">select()</code> or <code class="code">poll()</code> before restoring the
interrupted GnuTLS function.
</p>
<p>This function’s output is unreliable if you are using the same
<code class="code">session</code> in different threads for sending and receiving.
</p>
<p><strong class="strong">Returns:</strong> 0 if interrupted while trying to read data, or 1 while trying to write data.
</p></dd></dl>
<p>When calling <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> through a multi-plexer,
to be able to handle properly the DTLS handshake retransmission timers,
the function <a class="ref" href="#gnutls_005fdtls_005fget_005ftimeout">gnutls_dtls_get_timeout</a>
should be used to estimate when to call <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> if
no data have been received.
</p>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="Reducing-round_002dtrips">
<div class="nav-panel">
<p>
Next: <a href="#Zero_002droundtrip-mode" accesskey="n" rel="next">Zero-roundtrip mode</a>, Previous: <a href="#Asynchronous-operation" accesskey="p" rel="prev">Asynchronous operation</a>, Up: <a href="#Setting-up-the-transport-layer" accesskey="u" rel="up">Setting up the transport layer</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Reducing-round_002dtrips-1"><span>6.5.2 Reducing round-trips<a class="copiable-link" href="#Reducing-round_002dtrips-1"> ¶</a></span></h4>
<p>The full TLS 1.2 handshake requires 2 round-trips to complete, and when
combined with TCP’s SYN and SYN-ACK negotiation it extends to 3 full
round-trips. While, TLS 1.3 reduces that to two round-trips when under TCP,
it still adds considerable latency, making the protocol unsuitable for
certain applications.
</p>
<p>To optimize the handshake latency, in client side, it is possible to take
advantage of the TCP fast open [<a class="ref" href="#RFC7413">RFC7413</a>] mechanism on operating
systems that support it. That can be done either by manually crafting the push and pull
callbacks, or by utilizing <a class="ref" href="#gnutls_005ftransport_005fset_005ffastopen">gnutls_transport_set_fastopen</a>. In that
case the initial TCP handshake is eliminated, reducing the TLS 1.2 handshake round-trip
to 2, and the TLS 1.3 handshake to a single round-trip.
Note, that when this function is used, any connection failures will be reported during the
<a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> function call with error code <code class="code">GNUTLS_E_PUSH_ERROR</code>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005ffastopen"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_fastopen</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">fd</var>, struct sockaddr * <var class="var">connect_addr</var>, socklen_t <var class="var">connect_addrlen</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005ffastopen"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">fd</var>: is the session’s socket descriptor
</p>
<p><var class="var">connect_addr</var>: is the address we want to connect to
</p>
<p><var class="var">connect_addrlen</var>: is the length of <code class="code">connect_addr</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>Enables TCP Fast Open (TFO) for the specified TLS client session.
That means that TCP connection establishment and the transmission
of the first TLS client hello packet are combined. The
peer’s address must be specified in <code class="code">connect_addr</code> and <code class="code">connect_addrlen</code> ,
and the socket specified by <code class="code">fd</code> should not be connected.
</p>
<p>TFO only works for TCP sockets of type AF_INET and AF_INET6.
If the OS doesn’t support TCP fast open this function will result
to gnutls using <code class="code">connect()</code> transparently during the first write.
</p>
<p><strong class="strong">Note:</strong> This function overrides all the transport callback functions.
If this is undesirable, TCP Fast Open must be implemented on the user
callback functions without calling this function. When using
this function, transport callbacks must not be set, and
<code class="code">gnutls_transport_set_ptr()</code> or <code class="code">gnutls_transport_set_int()</code>
must not be called.
</p>
<p>On GNU/Linux TFO has to be enabled at the system layer, that is
in /proc/sys/net/ipv4/tcp_fastopen, bit 0 has to be set.
</p>
<p>This function has no effect on server sessions.
</p>
<p><strong class="strong">Since:</strong> 3.5.3
</p></dd></dl>
<p>When restricted to TLS 1.2, and non-resumed sessions, it is possible to further
reduce the round-trips to a single one by taking advantage of the <a class="ref" href="#False-Start">False Start</a>
TLS extension. This can be enabled by setting the <abbr class="acronym">GNUTLS_ENABLE_FALSE_START</abbr>
flag on <a class="ref" href="#gnutls_005finit">gnutls_init</a>.
</p>
<p>Under TLS 1.3, the server side can start transmitting before the handshake
is complete (i.e., while the client Finished message is still in flight),
when no client certificate authentication is requested. This, unlike false
start, is part of protocol design with no known security implications.
It can be enabled by setting the <abbr class="acronym">GNUTLS_ENABLE_EARLY_START</abbr> on
<a class="ref" href="#gnutls_005finit">gnutls_init</a>, and the <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> function will
return early, allowing the server to send data earlier.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Zero_002droundtrip-mode">
<div class="nav-panel">
<p>
Next: <a href="#Anti_002dreplay-protection" accesskey="n" rel="next">Anti-replay protection</a>, Previous: <a href="#Reducing-round_002dtrips" accesskey="p" rel="prev">Reducing round-trips</a>, Up: <a href="#Setting-up-the-transport-layer" accesskey="u" rel="up">Setting up the transport layer</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Zero_002droundtrip-mode-1"><span>6.5.3 Zero-roundtrip mode<a class="copiable-link" href="#Zero_002droundtrip-mode-1"> ¶</a></span></h4>
<p>Under TLS 1.3, when the client has already connected to the server and
is resuming a session, it can start transmitting application data during
handshake. This is called zero round-trip time (0-RTT) mode, and the
application data sent in this mode is called early data. The client can
send early data with <a class="ref" href="#gnutls_005frecord_005fsend_005fearly_005fdata">gnutls_record_send_early_data</a>. The
client should call this function before calling
<a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> and after calling
<a class="ref" href="#gnutls_005fsession_005fset_005fdata">gnutls_session_set_data</a>.
</p>
<p>Note, however, that early data has weaker security properties than
normal application data sent after handshake, such as lack of forward
secrecy, no guarantees of non-replay between connections. Thus it is
disabled on the server side by default. To enable it, the server
needs to:
</p><ol class="enumerate">
<li> Set <abbr class="acronym">GNUTLS_ENABLE_EARLY_DATA</abbr> on <a class="ref" href="#gnutls_005finit">gnutls_init</a>. Note that this option only has effect on server.
</li><li> Enable anti-replay measure. See <a class="ref" href="#Anti_002dreplay-protection">Anti-replay protection</a> for the details.
</li></ol>
<p>The server caches the received early data until it is read. To set the
maximum amount of data to be stored in the cache, use
<a class="ref" href="#gnutls_005frecord_005fset_005fmax_005fearly_005fdata_005fsize">gnutls_record_set_max_early_data_size</a>. After receiving the
EndOfEarlyData handshake message, the server can start retrieving the
received data with <a class="ref" href="#gnutls_005frecord_005frecv_005fearly_005fdata">gnutls_record_recv_early_data</a>. You can
call the function either after the handshake is complete, or through a
handshake hook (<a class="ref" href="#gnutls_005fhandshake_005fset_005fhook_005ffunction">gnutls_handshake_set_hook_function</a>).
</p>
<p>When sending early data, the client should respect the maximum amount
of early data, which may have been previously advertised by the
server. It can be checked using
<a class="ref" href="#gnutls_005frecord_005fget_005fmax_005fearly_005fdata_005fsize">gnutls_record_get_max_early_data_size</a>, right after calling
<a class="ref" href="#gnutls_005fsession_005fset_005fdata">gnutls_session_set_data</a>.
</p>
<p>After sending early data, to check whether the sent early data was
accepted by the server, use <a class="ref" href="#gnutls_005fsession_005fget_005fflags">gnutls_session_get_flags</a> and
compare the result with <abbr class="acronym">GNUTLS_SFLAGS_EARLY_DATA</abbr>.
Similarly, on the server side, the same function and flag can be used
to check whether it has actually accepted early data.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Anti_002dreplay-protection">
<div class="nav-panel">
<p>
Next: <a href="#DTLS-sessions" accesskey="n" rel="next">DTLS sessions</a>, Previous: <a href="#Zero_002droundtrip-mode" accesskey="p" rel="prev">Zero-roundtrip mode</a>, Up: <a href="#Setting-up-the-transport-layer" accesskey="u" rel="up">Setting up the transport layer</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Anti_002dreplay-protection-1"><span>6.5.4 Anti-replay protection<a class="copiable-link" href="#Anti_002dreplay-protection-1"> ¶</a></span></h4>
<p>When 0-RTT mode is used, the server must protect itself from replay
attacks, where adversary client reuses duplicate session ticket to send
early data, before the server authenticates the client.
</p>
<p>GnuTLS provides a simple mechanism against replay attacks, following the
method called ClientHello recording. When a session ticket is accepted,
the server checks if the ClientHello message has been already seen. If
there is a duplicate, the server rejects early data.
</p>
<p>The problem of this approach is that the number of recorded messages
grows indefinitely. To prevent that, the server can limit the recording
to a certain time window, which can be configured with
<a class="ref" href="#gnutls_005fanti_005freplay_005fset_005fwindow">gnutls_anti_replay_set_window</a>.
</p>
<p>The anti-replay mechanism shall be globally initialized with
<a class="ref" href="#gnutls_005fanti_005freplay_005finit">gnutls_anti_replay_init</a>, and then attached to a session using
<a class="ref" href="#gnutls_005fanti_005freplay_005fenable">gnutls_anti_replay_enable</a>. It can be deinitialized with
<a class="ref" href="#gnutls_005fanti_005freplay_005fdeinit">gnutls_anti_replay_deinit</a>.
</p>
<p>The server must also set up a database back-end to store ClientHello
messages. That can be achieved using
<a class="ref" href="#gnutls_005fanti_005freplay_005fset_005fadd_005ffunction">gnutls_anti_replay_set_add_function</a> and
<a class="ref" href="#gnutls_005fanti_005freplay_005fset_005fptr">gnutls_anti_replay_set_ptr</a>.
</p>
<p>Note that, if the back-end stores arbitrary number of ClientHello, it
needs to periodically clean up the stored entries based on the time
window set with <a class="ref" href="#gnutls_005fanti_005freplay_005fset_005fwindow">gnutls_anti_replay_set_window</a>. The cleanup
can be implemented by iterating through the database entries and calling
<a class="ref" href="#gnutls_005fdb_005fcheck_005fentry_005fexpire_005ftime">gnutls_db_check_entry_expire_time</a>. This is similar to session
database cleanup used by TLS1.2 sessions.
</p>
<p>The full set up of the server using early data would be like the
following example:
</p><div class="example">
<pre class="example-preformatted">#define MAX_EARLY_DATA_SIZE 16384
static int
db_add_func(void *dbf, gnutls_datum_t key, gnutls_datum_t data)
{
/* Return GNUTLS_E_DB_ENTRY_EXISTS, if KEY is found in the database.
* Otherwise, store it and return 0.
*/
}
static int
handshake_hook_func(gnutls_session_t session, unsigned int htype,
unsigned when, unsigned int incoming, const gnutls_datum_t *msg)
{
int ret;
char buf[MAX_EARLY_DATA_SIZE];
assert(htype == GNUTLS_HANDSHAKE_END_OF_EARLY_DATA);
assert(when == GNUTLS_HOOK_POST);
if (gnutls_session_get_flags(session) & GNUTLS_SFLAGS_EARLY_DATA) {
ret = gnutls_record_recv_early_data(session, buf, sizeof(buf));
assert(ret >= 0);
}
return ret;
}
int main(void)
{
...
/* Initialize anti-replay measure, which can be shared
* among multiple sessions.
*/
gnutls_anti_replay_init(&anti_replay);
/* Set the database back-end function for the anti-replay data. */
gnutls_anti_replay_set_add_function(anti_replay, db_add_func);
gnutls_anti_replay_set_ptr(anti_replay, NULL);
...
gnutls_init(&server, GNUTLS_SERVER | GNUTLS_ENABLE_EARLY_DATA);
gnutls_record_set_max_early_data_size(server, MAX_EARLY_DATA_SIZE);
...
/* Set the anti-replay measure to the session.
*/
gnutls_anti_replay_enable(server, anti_replay);
...
/* Retrieve early data in a handshake hook;
* you can also do that after handshake.
*/
gnutls_handshake_set_hook_function(server, GNUTLS_HANDSHAKE_END_OF_EARLY_DATA,
GNUTLS_HOOK_POST, handshake_hook_func);
...
}
</pre></div>
<hr>
</div>
<div class="subsection-level-extent" id="DTLS-sessions">
<div class="nav-panel">
<p>
Next: <a href="#DTLS-and-SCTP" accesskey="n" rel="next">DTLS and SCTP</a>, Previous: <a href="#Anti_002dreplay-protection" accesskey="p" rel="prev">Anti-replay protection</a>, Up: <a href="#Setting-up-the-transport-layer" accesskey="u" rel="up">Setting up the transport layer</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="DTLS-sessions-1"><span>6.5.5 DTLS sessions<a class="copiable-link" href="#DTLS-sessions-1"> ¶</a></span></h4>
<p>Because datagram TLS can operate over connections where the client
cannot be reliably verified, functionality in the form of cookies, is available to prevent
denial of service attacks to servers. <abbr class="acronym">GnuTLS</abbr> requires a server
to generate a secret key that is used to sign a cookie<a class="footnote" id="DOCF19" href="#FOOT19"><sup>19</sup></a>.
That cookie is sent to the client using <a class="ref" href="#gnutls_005fdtls_005fcookie_005fsend">gnutls_dtls_cookie_send</a>, and
the client must reply using the correct cookie. The server side
should verify the initial message sent by client using <a class="ref" href="#gnutls_005fdtls_005fcookie_005fverify">gnutls_dtls_cookie_verify</a>.
If successful the session should be initialized and associated with
the cookie using <a class="ref" href="#gnutls_005fdtls_005fprestate_005fset">gnutls_dtls_prestate_set</a>, before proceeding to
the handshake.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fkey_005fgenerate">gnutls_key_generate</a> (gnutls_datum_t * <var class="var">key</var>, unsigned int <var class="var">key_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fdtls_005fcookie_005fsend">gnutls_dtls_cookie_send</a> (gnutls_datum_t * <var class="var">key</var>, void * <var class="var">client_data</var>, size_t <var class="var">client_data_size</var>, gnutls_dtls_prestate_st * <var class="var">prestate</var>, gnutls_transport_ptr_t <var class="var">ptr</var>, gnutls_push_func <var class="var">push_func</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fdtls_005fcookie_005fverify">gnutls_dtls_cookie_verify</a> (gnutls_datum_t * <var class="var">key</var>, void * <var class="var">client_data</var>, size_t <var class="var">client_data_size</var>, void * <var class="var">_msg</var>, size_t <var class="var">msg_size</var>, gnutls_dtls_prestate_st * <var class="var">prestate</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fdtls_005fprestate_005fset">gnutls_dtls_prestate_set</a> (gnutls_session_t <var class="var">session</var>, gnutls_dtls_prestate_st * <var class="var">prestate</var>)</code></dt>
</dl>
<p>Note that the above apply to server side only and they are not mandatory to be
used. Not using them, however, allows denial of service attacks.
The client side cookie handling is part of <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a>.
</p>
<p>Datagrams are typically restricted by a maximum transfer unit (MTU). For that
both client and server side should set the correct maximum transfer unit for
the layer underneath <abbr class="acronym">GnuTLS</abbr>. This will allow proper fragmentation
of DTLS messages and prevent messages from being silently discarded by the
transport layer. The “correct” maximum transfer unit can be obtained through
a path MTU discovery mechanism [<a class="ref" href="#RFC4821">RFC4821</a>].
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fdtls_005fset_005fmtu">gnutls_dtls_set_mtu</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">mtu</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned int</var> <a class="ref" href="#gnutls_005fdtls_005fget_005fmtu">gnutls_dtls_get_mtu</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned int</var> <a class="ref" href="#gnutls_005fdtls_005fget_005fdata_005fmtu">gnutls_dtls_get_data_mtu</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
</dl>
<hr>
</div>
<div class="subsection-level-extent" id="DTLS-and-SCTP">
<div class="nav-panel">
<p>
Previous: <a href="#DTLS-sessions" accesskey="p" rel="prev">DTLS sessions</a>, Up: <a href="#Setting-up-the-transport-layer" accesskey="u" rel="up">Setting up the transport layer</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="DTLS-and-SCTP-1"><span>6.5.6 DTLS and SCTP<a class="copiable-link" href="#DTLS-and-SCTP-1"> ¶</a></span></h4>
<p>Although DTLS can run under any reliable or unreliable layer, there are
special requirements for SCTP according to [<a class="ref" href="#RFC6083">RFC6083</a>]. We summarize the
most important below, however for a full treatment we refer to [<a class="ref" href="#RFC6083">RFC6083</a>].
</p>
<ul class="itemize mark-bullet">
<li>The MTU set via <a class="ref" href="#gnutls_005fdtls_005fset_005fmtu">gnutls_dtls_set_mtu</a> must be 2^14.
</li><li>Replay detection must be disabled; use the flag <code class="code">GNUTLS_NO_REPLAY_PROTECTION</code> with <a class="ref" href="#gnutls_005finit">gnutls_init</a>.
</li><li>Retransmission of messages must be disabled; use <a class="ref" href="#gnutls_005fdtls_005fset_005ftimeouts">gnutls_dtls_set_timeouts</a>
with a retransmission timeout larger than the total.
</li><li>Handshake, Alert and ChangeCipherSpec messages must be sent over stream 0 with unlimited reliability
and with the ordered delivery feature.
</li><li>During a rehandshake, the caching of messages with unknown epoch is
not handled by GnuTLS; this must be implemented in a special pull function.
</li></ul>
<hr>
</div>
</div>
<div class="section-level-extent" id="TLS-handshake">
<div class="nav-panel">
<p>
Next: <a href="#Data-transfer-and-termination" accesskey="n" rel="next">Data transfer and termination</a>, Previous: <a href="#Setting-up-the-transport-layer" accesskey="p" rel="prev">Setting up the transport layer</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="TLS-handshake-1"><span>6.6 TLS handshake<a class="copiable-link" href="#TLS-handshake-1"> ¶</a></span></h3>
<p>Once a session has been initialized and a network
connection has been set up, TLS and DTLS protocols
perform a handshake. The handshake is the actual key
exchange.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_handshake</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function performs the handshake of the TLS/SSL protocol, and
initializes the TLS session parameters.
</p>
<p>The non-fatal errors expected by this function are:
<code class="code">GNUTLS_E_INTERRUPTED</code> , <code class="code">GNUTLS_E_AGAIN</code> ,
<code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code> . When this function is called
for re-handshake under TLS 1.2 or earlier, the non-fatal error code
<code class="code">GNUTLS_E_GOT_APPLICATION_DATA</code> may also be returned.
</p>
<p>The former two interrupt the handshake procedure due to the transport
layer being interrupted, and the latter because of a "warning" alert that
was sent by the peer (it is always a good idea to check any
received alerts). On these non-fatal errors call this function again,
until it returns 0; cf. <code class="code">gnutls_record_get_direction()</code> and
<code class="code">gnutls_error_is_fatal()</code> . In DTLS sessions the non-fatal error
<code class="code">GNUTLS_E_LARGE_PACKET</code> is also possible, and indicates that
the MTU should be adjusted.
</p>
<p>When this function is called by a server after a rehandshake request
under TLS 1.2 or earlier the <code class="code">GNUTLS_E_GOT_APPLICATION_DATA</code> error code indicates
that some data were pending prior to peer initiating the handshake.
Under TLS 1.3 this function when called after a successful handshake, is a no-op
and always succeeds in server side; in client side this function is
equivalent to <code class="code">gnutls_session_key_update()</code> with <code class="code">GNUTLS_KU_PEER</code> flag.
</p>
<p>This function handles both full and abbreviated TLS handshakes (resumption).
For abbreviated handshakes, in client side, the <code class="code">gnutls_session_set_data()</code>
should be called prior to this function to set parameters from a previous session.
In server side, resumption is handled by either setting a DB back-end, or setting
up keys for session tickets.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on a successful handshake, otherwise a negative error code.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005ftimeout"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_timeout</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">ms</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005ftimeout"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">ms</var>: is a timeout value in milliseconds
</p>
<p>This function sets the timeout for the TLS handshake process
to the provided value. Use an <code class="code">ms</code> value of zero to disable
timeout, or <code class="code">GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT</code> for a reasonable
default value. For the DTLS protocol, the more detailed
<code class="code">gnutls_dtls_set_timeouts()</code> is provided.
</p>
<p>This function requires to set a pull timeout callback. See
<code class="code">gnutls_transport_set_pull_timeout_function()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<p>In GnuTLS 3.5.0 and later it is recommended to use <a class="ref" href="#gnutls_005fsession_005fset_005fverify_005fcert">gnutls_session_set_verify_cert</a>
for the handshake process to ensure the verification of the peer’s identity.
That will verify the peer’s certificate, against the trusted CA store while
accounting for stapled OCSP responses during the handshake; any error will
be returned as a handshake error.
</p>
<p>In older GnuTLS versions it is required to verify the peer’s certificate
during the handshake by setting a callback with <a class="ref" href="#gnutls_005fcertificate_005fset_005fverify_005ffunction">gnutls_certificate_set_verify_function</a>,
and then using <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers3">gnutls_certificate_verify_peers3</a> from it. See <a class="ref" href="#Certificate-authentication">Certificate authentication</a>
for more information.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fsession_005fset_005fverify_005fcert">gnutls_session_set_verify_cert</a> (gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, unsigned <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers3">gnutls_certificate_verify_peers3</a> (gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, unsigned int * <var class="var">status</var>)</code></dt>
</dl>
<hr>
</div>
<div class="section-level-extent" id="Data-transfer-and-termination">
<div class="nav-panel">
<p>
Next: <a href="#Buffered-data-transfer" accesskey="n" rel="next">Buffered data transfer</a>, Previous: <a href="#TLS-handshake" accesskey="p" rel="prev">TLS handshake</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Data-transfer-and-termination-1"><span>6.7 Data transfer and termination<a class="copiable-link" href="#Data-transfer-and-termination-1"> ¶</a></span></h3>
<p>Once the handshake is complete and peer’s identity
has been verified data can be exchanged. The available
functions resemble the POSIX <code class="code">recv</code> and <code class="code">send</code>
functions. It is suggested to use <a class="ref" href="#gnutls_005ferror_005fis_005ffatal">gnutls_error_is_fatal</a>
to check whether the error codes returned by these functions are
fatal for the protocol or can be ignored.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fsend"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_send</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fsend"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: contains the data to send
</p>
<p><var class="var">data_size</var>: is the length of the data
</p>
<p>This function has the similar semantics with <code class="code">send()</code> . The only
difference is that it accepts a GnuTLS session, and uses different
error codes.
Note that if the send buffer is full, <code class="code">send()</code> will block this
function. See the <code class="code">send()</code> documentation for more information.
</p>
<p>You can replace the default push function which is <code class="code">send()</code> , by using
<code class="code">gnutls_transport_set_push_function()</code> .
</p>
<p>If the EINTR is returned by the internal push function
then <code class="code">GNUTLS_E_INTERRUPTED</code> will be returned. If
<code class="code">GNUTLS_E_INTERRUPTED</code> or <code class="code">GNUTLS_E_AGAIN</code> is returned, you must
call this function again with the exact same parameters, or provide a
<code class="code">NULL</code> pointer for <code class="code">data</code> and 0 for <code class="code">data_size</code> , in order to write the
same data as before. If you wish to discard the previous data instead
of retrying, you must call <code class="code">gnutls_record_discard_queued()</code> before
calling this function with different parameters. Note that the latter
works only on special transports (e.g., UDP).
cf. <code class="code">gnutls_record_get_direction()</code> .
</p>
<p>Note that in DTLS this function will return the <code class="code">GNUTLS_E_LARGE_PACKET</code>
error code if the send data exceed the data MTU value - as returned
by <code class="code">gnutls_dtls_get_data_mtu()</code> . The errno value EMSGSIZE
also maps to <code class="code">GNUTLS_E_LARGE_PACKET</code> .
Note that since 3.2.13 this function can be called under cork in DTLS
mode, and will refuse to send data over the MTU size by returning
<code class="code">GNUTLS_E_LARGE_PACKET</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of bytes sent, or a negative error code. The
number of bytes sent might be less than <code class="code">data_size</code> . The maximum
number of bytes this function can send in a single call depends
on the negotiated maximum record size.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005frecv"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_recv</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005frecv"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: the buffer that the data will be read into
</p>
<p><var class="var">data_size</var>: the number of requested bytes
</p>
<p>This function has the similar semantics with <code class="code">recv()</code> . The only
difference is that it accepts a GnuTLS session, and uses different
error codes.
In the special case that the peer requests a renegotiation, the
caller will receive an error code of <code class="code">GNUTLS_E_REHANDSHAKE</code> . In case
of a client, this message may be simply ignored, replied with an alert
<code class="code">GNUTLS_A_NO_RENEGOTIATION</code> , or replied with a new handshake,
depending on the client’s will. A server receiving this error code
can only initiate a new handshake or terminate the session.
</p>
<p>If <code class="code">EINTR</code> is returned by the internal pull function (the default
is <code class="code">recv()</code> ) then <code class="code">GNUTLS_E_INTERRUPTED</code> will be returned. If
<code class="code">GNUTLS_E_INTERRUPTED</code> or <code class="code">GNUTLS_E_AGAIN</code> is returned, you must
call this function again to get the data. See also
<code class="code">gnutls_record_get_direction()</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of bytes received and zero on EOF (for stream
connections). A negative error code is returned in case of an error.
The number of bytes received might be less than the requested <code class="code">data_size</code> .
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ferror_005fis_005ffatal"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_error_is_fatal</strong> <code class="def-code-arguments">(int <var class="var">error</var>)</code><a class="copiable-link" href="#index-gnutls_005ferror_005fis_005ffatal"> ¶</a></span></dt>
<dd><p><var class="var">error</var>: is a GnuTLS error code, a negative error code
</p>
<p>If a GnuTLS function returns a negative error code you may feed that
value to this function to see if the error condition is fatal to
a TLS session (i.e., must be terminated).
</p>
<p>Note that you may also want to check the error code manually, since some
non-fatal errors to the protocol (such as a warning alert or
a rehandshake request) may be fatal for your program.
</p>
<p>This function is only useful if you are dealing with errors from
functions that relate to a TLS session (e.g., record layer or handshake
layer handling functions).
</p>
<p><strong class="strong">Returns:</strong> Non-zero value on fatal errors or zero on non-fatal.
</p></dd></dl>
<p>Although, in the TLS protocol the receive function can be called
at any time, when DTLS is used the GnuTLS receive functions must be
called once a message is available for reading, even if no data are
expected. This is because in DTLS various (internal) actions
may be required due to retransmission timers. Moreover,
an extended receive function is shown below, which allows the extraction
of the message’s sequence number. Due to the unreliable nature of the
protocol, this field allows distinguishing out-of-order messages.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005frecv_005fseq"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_recv_seq</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">data</var>, size_t <var class="var">data_size</var>, unsigned char * <var class="var">seq</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005frecv_005fseq"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: the buffer that the data will be read into
</p>
<p><var class="var">data_size</var>: the number of requested bytes
</p>
<p><var class="var">seq</var>: is the packet’s 64-bit sequence number. Should have space for 8 bytes.
</p>
<p>This function is the same as <code class="code">gnutls_record_recv()</code> , except that
it returns in addition to data, the sequence number of the data.
This is useful in DTLS where record packets might be received
out-of-order. The returned 8-byte sequence number is an
integer in big-endian format and should be
treated as a unique message identification.
</p>
<p><strong class="strong">Returns:</strong> The number of bytes received and zero on EOF. A negative
error code is returned in case of an error. The number of bytes
received might be less than <code class="code">data_size</code> .
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<p>The <a class="ref" href="#gnutls_005frecord_005fcheck_005fpending">gnutls_record_check_pending</a> helper function is available to
allow checking whether data are available to be read in a <abbr class="acronym">GnuTLS</abbr> session
buffers. Note that this function complements but does not replace <code class="code">poll</code>,
i.e., <a class="ref" href="#gnutls_005frecord_005fcheck_005fpending">gnutls_record_check_pending</a> reports no data to be read, <code class="code">poll</code>
should be called to check for data in the network buffers.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fcheck_005fpending"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_check_pending</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fcheck_005fpending"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function checks if there are unread data
in the gnutls buffers. If the return value is
non-zero the next call to <code class="code">gnutls_record_recv()</code>
is guaranteed not to block.
</p>
<p><strong class="strong">Returns:</strong> Returns the size of the data or zero.
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005frecord_005fget_005fdirection">gnutls_record_get_direction</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
</dl>
<p>Once a TLS or DTLS session is no longer needed, it is
recommended to use <a class="ref" href="#gnutls_005fbye">gnutls_bye</a> to terminate the
session. That way the peer is notified securely about the
intention of termination, which allows distinguishing it
from a malicious connection termination.
A session can be deinitialized with the <a class="ref" href="#gnutls_005fdeinit">gnutls_deinit</a> function.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fbye"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_bye</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_close_request_t <var class="var">how</var>)</code><a class="copiable-link" href="#index-gnutls_005fbye"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">how</var>: is an integer
</p>
<p>Terminates the current TLS/SSL connection. The connection should
have been initiated using <code class="code">gnutls_handshake()</code> . <code class="code">how</code> should be one
of <code class="code">GNUTLS_SHUT_RDWR</code> , <code class="code">GNUTLS_SHUT_WR</code> .
</p>
<p>In case of <code class="code">GNUTLS_SHUT_RDWR</code> the TLS session gets
terminated and further receives and sends will be disallowed. If
the return value is zero you may continue using the underlying
transport layer. <code class="code">GNUTLS_SHUT_RDWR</code> sends an alert containing a close
request and waits for the peer to reply with the same message.
</p>
<p>In case of <code class="code">GNUTLS_SHUT_WR</code> the TLS session gets terminated
and further sends will be disallowed. In order to reuse the
connection you should wait for an EOF from the peer.
<code class="code">GNUTLS_SHUT_WR</code> sends an alert containing a close request.
</p>
<p>Note that not all implementations will properly terminate a TLS
connection. Some of them, usually for performance reasons, will
terminate only the underlying transport layer, and thus not
distinguishing between a malicious party prematurely terminating
the connection and normal termination.
</p>
<p>This function may also return <code class="code">GNUTLS_E_AGAIN</code> or
<code class="code">GNUTLS_E_INTERRUPTED</code> ; cf. <code class="code">gnutls_record_get_direction()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code, see
function documentation for entire semantics.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_deinit</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function clears all buffers associated with the <code class="code">session</code> .
This function will also remove session data from the session
database if the session was terminated abnormally.
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Buffered-data-transfer">
<div class="nav-panel">
<p>
Next: <a href="#Handling-alerts" accesskey="n" rel="next">Handling alerts</a>, Previous: <a href="#Data-transfer-and-termination" accesskey="p" rel="prev">Data transfer and termination</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Buffered-data-transfer-1"><span>6.8 Buffered data transfer<a class="copiable-link" href="#Buffered-data-transfer-1"> ¶</a></span></h3>
<p>Although <a class="ref" href="#gnutls_005frecord_005fsend">gnutls_record_send</a> is sufficient to transmit data
to the peer, when many small chunks of data are to be transmitted
it is inefficient and wastes bandwidth due to the TLS record
overhead. In that case it is preferable to combine the small chunks
before transmission. The following functions provide that functionality.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fcork"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_record_cork</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fcork"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>If called, <code class="code">gnutls_record_send()</code> will no longer send any records.
Any sent records will be cached until <code class="code">gnutls_record_uncork()</code> is called.
</p>
<p>This function is safe to use with DTLS after GnuTLS 3.3.0.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005funcork"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_record_uncork</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005funcork"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">flags</var>: Could be zero or <code class="code">GNUTLS_RECORD_WAIT</code>
</p>
<p>This resets the effect of <code class="code">gnutls_record_cork()</code> , and flushes any pending
data. If the <code class="code">GNUTLS_RECORD_WAIT</code> flag is specified then this
function will block until the data is sent or a fatal error
occurs (i.e., the function will retry on <code class="code">GNUTLS_E_AGAIN</code> and
<code class="code">GNUTLS_E_INTERRUPTED</code> ).
</p>
<p>If the flag <code class="code">GNUTLS_RECORD_WAIT</code> is not specified and the function
is interrupted then the <code class="code">GNUTLS_E_AGAIN</code> or <code class="code">GNUTLS_E_INTERRUPTED</code>
errors will be returned. To obtain the data left in the corked
buffer use <code class="code">gnutls_record_check_corked()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success the number of transmitted data is returned, or
otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Handling-alerts">
<div class="nav-panel">
<p>
Next: <a href="#Priority-Strings" accesskey="n" rel="next">Priority strings</a>, Previous: <a href="#Buffered-data-transfer" accesskey="p" rel="prev">Buffered data transfer</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Handling-alerts-1"><span>6.9 Handling alerts<a class="copiable-link" href="#Handling-alerts-1"> ¶</a></span></h3>
<p>During a TLS connection alert messages may be exchanged by the
two peers. Those messages may be fatal, meaning the connection
must be terminated afterwards, or warning when something needs
to be reported to the peer, but without interrupting the session.
The error codes <code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code>
or <code class="code">GNUTLS_E_FATAL_ALERT_RECEIVED</code> signal those alerts
when received, and may be returned by all GnuTLS functions that receive
data from the peer, being <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> and <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a>.
</p>
<p>If those error codes are received the alert and its level should be logged
or reported to the peer using the functions below.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_alert_description_t</code> <strong class="def-name">gnutls_alert_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return the last alert number received. This
function should be called when <code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code> or
<code class="code">GNUTLS_E_FATAL_ALERT_RECEIVED</code> errors are returned by a gnutls
function. The peer may send alerts if he encounters an error.
If no alert has been received the returned value is undefined.
</p>
<p><strong class="strong">Returns:</strong> the last alert received, a
<code class="code">gnutls_alert_description_t</code> value.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_alert_get_name</strong> <code class="def-code-arguments">(gnutls_alert_description_t <var class="var">alert</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">alert</var>: is an alert number.
</p>
<p>This function will return a string that describes the given alert
number, or <code class="code">NULL</code> . See <code class="code">gnutls_alert_get()</code> .
</p>
<p><strong class="strong">Returns:</strong> string corresponding to <code class="code">gnutls_alert_description_t</code> value.
</p></dd></dl>
<p>The peer may also be warned or notified of a fatal issue
by using one of the functions below. All the available alerts
are listed in <a class="ref" href="#The-Alert-Protocol">The Alert Protocol</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fsend"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_alert_send</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_alert_level_t <var class="var">level</var>, gnutls_alert_description_t <var class="var">desc</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fsend"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">level</var>: is the level of the alert
</p>
<p><var class="var">desc</var>: is the alert description
</p>
<p>This function will send an alert to the peer in order to inform
him of something important (eg. his Certificate could not be verified).
If the alert level is Fatal then the peer is expected to close the
connection, otherwise he may ignore the alert and continue.
</p>
<p>The error code of the underlying record send function will be
returned, so you may also receive <code class="code">GNUTLS_E_INTERRUPTED</code> or
<code class="code">GNUTLS_E_AGAIN</code> as well.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ferror_005fto_005falert"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_error_to_alert</strong> <code class="def-code-arguments">(int <var class="var">err</var>, int * <var class="var">level</var>)</code><a class="copiable-link" href="#index-gnutls_005ferror_005fto_005falert"> ¶</a></span></dt>
<dd><p><var class="var">err</var>: is a negative integer
</p>
<p><var class="var">level</var>: the alert level will be stored there
</p>
<p>Get an alert depending on the error code returned by a gnutls
function. All alerts sent by this function should be considered
fatal. The only exception is when <code class="code">err</code> is <code class="code">GNUTLS_E_REHANDSHAKE</code> ,
where a warning alert should be sent to the peer indicating that no
renegotiation will be performed.
</p>
<p>If there is no mapping to a valid alert the alert to indicate
internal error (<code class="code">GNUTLS_A_INTERNAL_ERROR</code> ) is returned.
</p>
<p><strong class="strong">Returns:</strong> the alert code to use for a particular error code.
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Priority-Strings">
<div class="nav-panel">
<p>
Next: <a href="#Selecting-cryptographic-key-sizes" accesskey="n" rel="next">Selecting cryptographic key sizes</a>, Previous: <a href="#Handling-alerts" accesskey="p" rel="prev">Handling alerts</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Priority-strings"><span>6.10 Priority strings<a class="copiable-link" href="#Priority-strings"> ¶</a></span></h3>
<a class="index-entry-id" id="index-Priority-strings"></a>
<h4 class="subheading" id="How-to-use-Priority-Strings"><span>How to use Priority Strings<a class="copiable-link" href="#How-to-use-Priority-Strings"> ¶</a></span></h4>
<p>The GnuTLS priority strings specify the TLS session’s handshake
algorithms and options in a compact, easy-to-use format. These
strings are intended as a user-specified override of the library defaults.
</p>
<p>That is, we recommend applications using the default settings
(c.f. <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority">gnutls_set_default_priority</a> or
<a class="ref" href="#gnutls_005fset_005fdefault_005fpriority_005fappend">gnutls_set_default_priority_append</a>), and provide the user
with access to priority strings for overriding the default behavior,
on configuration files, or other UI. Following such a principle,
makes the GnuTLS library as the default settings provider. That is
necessary and a good practice, because TLS protocol hardening and
phasing out of legacy algorithms, is easier to coordinate when happens
in a single library.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority">gnutls_set_default_priority</a> (gnutls_session_t <var class="var">session</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority_005fappend">gnutls_set_default_priority_append</a> (gnutls_session_t <var class="var">session</var>, const char * <var class="var">add_prio</var>, const char ** <var class="var">err_pos</var>, unsigned <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpriority_005fset_005fdirect">gnutls_priority_set_direct</a> (gnutls_session_t <var class="var">session</var>, const char * <var class="var">priorities</var>, const char ** <var class="var">err_pos</var>)</code></dt>
</dl>
<p>The priority string translation to the internal GnuTLS form requires
processing and the generated internal form also occupies some memory.
For that, it is recommended to do that processing once in server side,
and share the generated data across sessions. The following functions
allow the generation of a "priority cache" and the sharing of it across
sessions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpriority_005finit2">gnutls_priority_init2</a> (gnutls_priority_t * <var class="var">priority_cache</var>, const char * <var class="var">priorities</var>, const char ** <var class="var">err_pos</var>, unsigned <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpriority_005finit">gnutls_priority_init</a> (gnutls_priority_t * <var class="var">priority_cache</var>, const char * <var class="var">priorities</var>, const char ** <var class="var">err_pos</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpriority_005fset">gnutls_priority_set</a> (gnutls_session_t <var class="var">session</var>, gnutls_priority_t <var class="var">priority</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpriority_005fdeinit">gnutls_priority_deinit</a> (gnutls_priority_t <var class="var">priority_cache</var>)</code></dt>
</dl>
<h4 class="subheading" id="Using-Priority-Strings"><span>Using Priority Strings<a class="copiable-link" href="#Using-Priority-Strings"> ¶</a></span></h4>
<p>A priority string string may contain a single initial keyword such as in
<a class="ref" href="#tab_003aprio_002dkeywords">Table 6.3</a> and may be followed by additional algorithm or
special keywords. Note that their description is intentionally avoiding
specific algorithm details, as the priority strings are not constant between
gnutls versions (they are periodically updated to account for cryptographic
advances while providing compatibility with old clients and servers).
</p>
<div class="float" id="tab_003aprio_002dkeywords">
<table class="multitable">
<thead><tr><th width="20%">Keyword</th><th width="70%">Description</th></tr></thead>
<tbody><tr><td width="20%">@KEYWORD</td><td width="70%">Means that a compile-time specified system configuration file (see <a class="ref" href="#System_002dwide-configuration-of-the-library">System-wide configuration of the library</a>)
will be used to expand the provided keyword. That is used to impose system-specific policies.
It may be followed by additional options that will be appended to the
system string (e.g., "@SYSTEM:+SRP"). The system file should have the
format ’KEYWORD=VALUE’, e.g., ’SYSTEM=NORMAL:+ARCFOUR-128’.
<p>Since version 3.5.1 it is allowed to specify fallback keywords by
separating them with a comma, such as @KEYWORD1,KEYWORD2, and the
first valid keyword will be used.
</p></td></tr>
<tr><td width="20%">PERFORMANCE</td><td width="70%">All the known to be secure ciphersuites are enabled,
limited to 128 bit ciphers and sorted by terms of speed
performance. The message authenticity security level is of 64 bits or more,
and the certificate verification profile is set to GNUTLS_PROFILE_LOW (80-bits).</td></tr>
<tr><td width="20%">NORMAL</td><td width="70%">Means all the known to be secure ciphersuites. The ciphers are sorted by security
margin, although the 256-bit ciphers are included as a fallback only.
The message authenticity security level is of 64 bits or more,
and the certificate verification profile is set to GNUTLS_PROFILE_LOW (80-bits).
<p>This priority string implicitly enables ECDHE and DHE. The ECDHE ciphersuites
are placed first in the priority order, but due to compatibility
issues with the DHE ciphersuites they are placed last in the priority order,
after the plain RSA ciphersuites.
</p></td></tr>
<tr><td width="20%">LEGACY</td><td width="70%">This sets the NORMAL settings that were used for GnuTLS 3.2.x or earlier. There is
no verification profile set, and the allowed DH primes are considered
weak today (but are often used by misconfigured servers).</td></tr>
<tr><td width="20%">PFS</td><td width="70%">Means all the known to be secure ciphersuites that support perfect forward
secrecy (ECDHE and DHE). The ciphers are sorted by security
margin, although the 256-bit ciphers are included as a fallback only.
The message authenticity security level is of 80 bits or more,
and the certificate verification profile is set to GNUTLS_PROFILE_LOW (80-bits).
This option is available since 3.2.4 or later.</td></tr>
<tr><td width="20%">SECURE128</td><td width="70%">Means all known to be secure ciphersuites that offer a
security level 128-bit or more.
The message authenticity security level is of 80 bits or more,
and the certificate verification profile is set to GNUTLS_PROFILE_LOW (80-bits).</td></tr>
<tr><td width="20%">SECURE192</td><td width="70%">Means all the known to be secure ciphersuites that offer a
security level 192-bit or more.
The message authenticity security level is of 128 bits or more,
and the certificate verification profile is set to GNUTLS_PROFILE_HIGH (128-bits).</td></tr>
<tr><td width="20%">SECURE256</td><td width="70%">Currently alias for SECURE192. This option, will enable ciphers which use a
256-bit key but, due to limitations of the TLS protocol, the overall security
level will be 192-bits (the security level depends on more factors than cipher key size).</td></tr>
<tr><td width="20%">SUITEB128</td><td width="70%">Means all the NSA Suite B cryptography (RFC5430) ciphersuites
with an 128 bit security level, as well as the enabling of the corresponding
verification profile.</td></tr>
<tr><td width="20%">SUITEB192</td><td width="70%">Means all the NSA Suite B cryptography (RFC5430) ciphersuites
with an 192 bit security level, as well as the enabling of the corresponding
verification profile.</td></tr>
<tr><td width="20%">NONE</td><td width="70%">Means nothing is enabled. This disables even protocol versions.
It should be followed by the algorithms to be enabled. Note that
using this option to build a priority string gives detailed control
into the resulting settings, however with new revisions of the TLS protocol
new priority items are routinely added, and such strings are not
forward compatible with new protocols. As such, we
advice against using that option for applications targeting multiple versions
of the GnuTLS library, and recommend using the defaults (see above) or
adjusting the defaults via <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority_005fappend">gnutls_set_default_priority_append</a>.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 6.3: </strong>Supported initial keywords.</p></div></div>
<p>Unless the initial keyword is "NONE" the defaults (in preference
order) are for TLS protocols TLS 1.2, TLS1.1, TLS1.0;
for certificate types X.509.
In key exchange algorithms when in NORMAL or SECURE levels the
perfect forward secrecy algorithms take precedence of the other
protocols. In all cases all the supported key exchange algorithms
are enabled.
</p>
<p>Note that the SECURE levels distinguish between overall security level and
message authenticity security level. That is because the message
authenticity security level requires the adversary to break
the algorithms at real-time during the protocol run, whilst
the overall security level refers to off-line adversaries
(e.g. adversaries breaking the ciphertext years after it was captured).
</p>
<p>The NONE keyword, if used, must followed by keywords specifying
the algorithms and protocols to be enabled. The other initial keywords
do not require, but may be followed by such keywords. All level keywords
can be combined, and for example a level of "SECURE256:+SECURE128" is
allowed.
</p>
<p>The order with which every algorithm or protocol
is specified is significant. Algorithms specified before others
will take precedence. The supported in the GnuTLS version corresponding
to this document algorithms and protocols are shown in <a class="ref" href="#tab_003aprio_002dalgorithms">Table 6.4</a>;
to list the supported algorithms in your currently using version use
<code class="code">gnutls-cli -l</code>.
</p>
<p>To avoid collisions in order to specify a protocol version
with "VERS-", signature algorithms with "SIGN-" and certificate types with "CTYPE-".
All other algorithms don’t need a prefix. Each specified keyword (except
for <em class="emph">special keywords</em>) can be prefixed with any of the following
characters.
</p>
<dl class="table">
<dt>’!’ or ’-’</dt>
<dd><p>appended with an algorithm will remove this algorithm.
</p></dd>
<dt>"+"</dt>
<dd><p>appended with an algorithm will add this algorithm.
</p></dd>
</dl>
<div class="float" id="tab_003aprio_002dalgorithms">
<table class="multitable">
<thead><tr><th width="20%">Type</th><th width="70%">Keywords</th></tr></thead>
<tbody><tr><td width="20%">Ciphers</td><td width="70%">Examples are AES-128-GCM, AES-256-GCM, AES-256-CBC, GOST28147-TC26Z-CNT; see also
<a class="ref" href="#tab_003aciphers">Table 3.1</a> for more options. Catch all name is CIPHER-ALL which will add
all the algorithms from NORMAL priority. The shortcut for secure GOST
algorithms is CIPHER-GOST-ALL.</td></tr>
<tr><td width="20%">Key exchange</td><td width="70%">RSA, RSA-PSK, RSA-EXPORT, DHE-RSA, DHE-DSS, SRP, SRP-RSA, SRP-DSS,
PSK, DHE-PSK, ECDHE-PSK, ECDHE-RSA, ECDHE-ECDSA, VKO-GOST-12, ANON-ECDH, ANON-DH.
Catch all name is KX-ALL which will add all the algorithms from NORMAL
priority. Under TLS1.3, the DHE-PSK and ECDHE-PSK strings are equivalent
and instruct for a Diffie-Hellman key exchange using the enabled groups. The
shortcut for secure GOST algorithms is KX-GOST-ALL.</td></tr>
<tr><td width="20%">MAC</td><td width="70%">MD5, SHA1, SHA256, SHA384, GOST28147-TC26Z-IMIT, AEAD (used with
GCM ciphers only). All algorithms from NORMAL priority can be accessed with
MAC-ALL. The shortcut for secure GOST algorithms is MAC-GOST-ALL.</td></tr>
<tr><td width="20%">Compression algorithms</td><td width="70%">COMP-NULL, COMP-DEFLATE. Catch all is COMP-ALL.</td></tr>
<tr><td width="20%">TLS versions</td><td width="70%">VERS-TLS1.0, VERS-TLS1.1, VERS-TLS1.2, VERS-TLS1.3,
VERS-DTLS0.9, VERS-DTLS1.0, VERS-DTLS1.2.
Catch all are VERS-ALL, and will enable
all protocols from NORMAL priority. To distinguish between TLS and DTLS
versions you can use VERS-TLS-ALL and VERS-DTLS-ALL.</td></tr>
<tr><td width="20%">Signature algorithms</td><td width="70%">SIGN-RSA-SHA1, SIGN-RSA-SHA224,
SIGN-RSA-SHA256, SIGN-RSA-SHA384, SIGN-RSA-SHA512, SIGN-DSA-SHA1,
SIGN-DSA-SHA224, SIGN-DSA-SHA256, SIGN-RSA-MD5, SIGN-ECDSA-SHA1,
SIGN-ECDSA-SHA224, SIGN-ECDSA-SHA256, SIGN-ECDSA-SHA384, SIGN-ECDSA-SHA512,
SIGN-EdDSA-Ed25519, SIGN-EdDSA-Ed448,
SIGN-RSA-PSS-SHA256, SIGN-RSA-PSS-SHA384, SIGN-RSA-PSS-SHA512,
SIGN-GOSTR341001, SIGN-GOSTR341012-256, SIGN-GOSTR341012-512.
Catch all which enables all algorithms from NORMAL priority is SIGN-ALL.
Shortcut which enables secure GOST algorithms is SIGN-GOST-ALL.
This option is only considered for TLS 1.2 and later.</td></tr>
<tr><td width="20%">Groups</td><td width="70%">GROUP-SECP192R1, GROUP-SECP224R1, GROUP-SECP256R1, GROUP-SECP384R1,
GROUP-SECP521R1, GROUP-X25519, GROUP-X448, GROUP-GC256B, GROUP-GC512A,
GROUP-FFDHE2048, GROUP-FFDHE3072, GROUP-FFDHE4096, GROUP-FFDHE6144, and
GROUP-FFDHE8192.
Groups include both elliptic curve groups, e.g., SECP256R1, as well as
finite field groups such as FFDHE2048. Catch all which enables all groups
from NORMAL priority is GROUP-ALL. The helper keywords GROUP-DH-ALL,
GROUP-GOST-ALL and GROUP-EC-ALL are also available, restricting the groups
to finite fields (DH), GOST curves and generic elliptic curves.</td></tr>
<tr><td width="20%">Elliptic curves (legacy)</td><td width="70%">CURVE-SECP192R1, CURVE-SECP224R1, CURVE-SECP256R1, CURVE-SECP384R1,
CURVE-SECP521R1, CURVE-X25519, and CURVE-X448.
Catch all which enables all curves from NORMAL priority is CURVE-ALL. Note
that the CURVE keyword is kept for backwards compatibility only, for new
applications see the GROUP keyword above.</td></tr>
<tr><td width="20%">Certificate types</td><td width="70%">Certificate types can be given in a symmetric fashion (i.e. the same for
both client and server) or, as of GnuTLS 3.6.4, in an asymmetric fashion
(i.e. different for the client than for the server). Alternative certificate
types must be explicitly enabled via flags in <a class="ref" href="#gnutls_005finit">gnutls_init</a>.
<p>The currently supported types are CTYPE-X509, CTYPE-RAWPK which apply both to
client and server; catch all is CTYPE-ALL. The types CTYPE-CLI-X509, CTYPE-SRV-X509,
CTYPE-CLI-RAWPK, CTYPE-SRV-RAWPK can be used to specialize on client or server;
catch all is CTYPE-CLI-ALL and CTYPE-SRV-ALL. The type ’X509’ is aliased to ’X.509’
for legacy reasons.
</p></td></tr>
<tr><td width="20%">Generic</td><td width="70%">The keyword GOST is a shortcut for secure GOST algorithms (MACs, ciphers,
KXes, groups and signatures). For example the following string will enable all
TLS 1.2 GOST ciphersuites: ’NONE:+VERS-TLS1.2:+GOST’.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 6.4: </strong>The supported algorithm keywords in priority strings.</p></div></div>
<p>Note that the finite field groups (indicated by the FFDHE prefix) and DHE key
exchange methods are generally slower<a class="footnote" id="DOCF20" href="#FOOT20"><sup>20</sup></a> than their elliptic curves counterpart
(ECDHE).
</p>
<p>The available special keywords are shown in <a class="ref" href="#tab_003aprio_002dspecial1">Table 6.5</a>
and <a class="ref" href="#tab_003aprio_002dspecial2">Table 6.6</a>.
</p>
<div class="float" id="tab_003aprio_002dspecial1">
<table class="multitable">
<thead><tr><th width="45%">Keyword</th><th width="45%">Description</th></tr></thead>
<tbody><tr><td width="45%">%COMPAT</td><td width="45%">will enable compatibility mode. It might mean that violations
of the protocols are allowed as long as maximum compatibility with
problematic clients and servers is achieved. More specifically this
string will tolerate packets over the maximum allowed TLS record,
and add a padding to TLS Client Hello packet to prevent it being in the
256-512 range which is known to be causing issues with a commonly used
firewall (see the %DUMBFW option).</td></tr>
<tr><td width="45%">%DUMBFW</td><td width="45%">will add a private extension with bogus data that make the client
hello exceed 512 bytes. This avoids a black hole behavior in some
firewalls. This is the [<a class="ref" href="#RFC7685">RFC7685</a>] client hello padding extension, also enabled
with %COMPAT.</td></tr>
<tr><td width="45%">%NO_EXTENSIONS</td><td width="45%">will prevent the sending of any TLS extensions in client side. Note
that TLS 1.2 requires extensions to be used, as well as safe
renegotiation thus this option must be used with care. When this option
is set no versions later than TLS1.2 can be negotiated.</td></tr>
<tr><td width="45%">%NO_SHUFFLE_EXTENSIONS</td><td width="45%">will prevent randomizing the order of ClientHello extensions. By
default, those extensions are randomized to make fingerprinting harder.</td></tr>
<tr><td width="45%">%NO_STATUS_REQUEST</td><td width="45%">will prevent sending of the TLS status_request extension in client side.</td></tr>
<tr><td width="45%">%NO_TICKETS</td><td width="45%">will prevent the advertizing of the TLS session ticket extension.</td></tr>
<tr><td width="45%">%NO_TICKETS_TLS12</td><td width="45%">will prevent the advertizing of the TLS session ticket extension in TLS 1.2.
This is implied by the PFS keyword.</td></tr>
<tr><td width="45%">%NO_SESSION_HASH</td><td width="45%">will prevent the advertizing the TLS extended master secret (session hash)
extension.</td></tr>
<tr><td width="45%">%FORCE_SESSION_HASH</td><td width="45%">negotiate the TLS extended master secret (session hash) extension.
Specifying both %NO_SESSION_HASH and %FORCE_SESSION_HASH is not
supported, and the behavior is undefined.</td></tr>
<tr><td width="45%">%SERVER_PRECEDENCE</td><td width="45%">The ciphersuite will be selected according to server priorities
and not the client’s.</td></tr>
<tr><td width="45%">%SSL3_RECORD_VERSION</td><td width="45%">will use SSL3.0 record version in client hello.
By default GnuTLS will set the minimum supported version as the
client hello record version (do not confuse that version with the
proposed handshake version at the client hello).</td></tr>
<tr><td width="45%">%LATEST_RECORD_VERSION</td><td width="45%">will use the latest TLS version record version in client hello.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 6.5: </strong>Special priority string keywords.</p></div></div>
<div class="float" id="tab_003aprio_002dspecial2">
<table class="multitable">
<thead><tr><th width="45%">Keyword</th><th width="45%">Description</th></tr></thead>
<tbody><tr><td width="45%">%STATELESS_COMPRESSION</td><td width="45%">ignored; no longer used.</td></tr>
<tr><td width="45%">%DISABLE_WILDCARDS</td><td width="45%">will disable matching wildcards when comparing hostnames
in certificates.</td></tr>
<tr><td width="45%">%NO_ETM</td><td width="45%">will disable the encrypt-then-mac TLS extension (RFC7366). This is
implied by the %COMPAT keyword.</td></tr>
<tr><td width="45%">%FORCE_ETM</td><td width="45%">negotiate CBC ciphersuites only when both sides of the connection support
encrypt-then-mac TLS extension (RFC7366).</td></tr>
<tr><td width="45%">%DISABLE_SAFE_RENEGOTIATION</td><td width="45%">will completely disable safe renegotiation. Do not use unless you
know what you are doing.</td></tr>
<tr><td width="45%">%UNSAFE_RENEGOTIATION</td><td width="45%">will allow handshakes and re-handshakes
without the safe renegotiation extension. Note that for clients
this mode is insecure (you may be under attack), and for servers it
will allow insecure clients to connect (which could be fooled by an
attacker). Do not use unless you know what you are doing and want
maximum compatibility.</td></tr>
<tr><td width="45%">%PARTIAL_RENEGOTIATION</td><td width="45%">will allow initial handshakes to proceed,
but not re-handshakes. This leaves the client vulnerable to attack,
and servers will be compatible with non-upgraded clients for
initial handshakes. This is currently the default for clients and
servers, for compatibility reasons.</td></tr>
<tr><td width="45%">%SAFE_RENEGOTIATION</td><td width="45%">will enforce safe renegotiation. Clients and
servers will refuse to talk to an insecure peer. Currently this
causes interoperability problems, but is required for full protection.</td></tr>
<tr><td width="45%">%FALLBACK_SCSV</td><td width="45%">will enable the use of the fallback signaling cipher suite value in the
client hello. Note that this should be set only by applications that
try to reconnect with a downgraded protocol version. See RFC7507 for
details.</td></tr>
<tr><td width="45%">%DISABLE_TLS13_COMPAT_MODE</td><td width="45%">will disable TLS 1.3 middlebox compatibility mode (RFC8446, Appendix
D.4) for non-compliant middleboxes.</td></tr>
<tr><td width="45%">%VERIFY_ALLOW_BROKEN</td><td width="45%">will allow signatures with known to be broken algorithms (such as MD5 or
SHA1) in certificate chains.</td></tr>
<tr><td width="45%">%VERIFY_ALLOW_SIGN_RSA_MD5</td><td width="45%">will allow RSA-MD5 signatures in certificate chains.</td></tr>
<tr><td width="45%">%VERIFY_ALLOW_SIGN_WITH_SHA1</td><td width="45%">will allow signatures with SHA1 hash algorithm in certificate chains.</td></tr>
<tr><td width="45%">%VERIFY_DISABLE_CRL_CHECKS</td><td width="45%">will disable CRL or OCSP checks in the verification of the certificate chain.</td></tr>
<tr><td width="45%">%VERIFY_ALLOW_X509_V1_CA_CRT</td><td width="45%">will allow V1 CAs in chains.</td></tr>
<tr><td width="45%">%PROFILE_(LOW|LEGACY|MEDIUM|HIGH|ULTRA|FUTURE)</td><td width="45%">require a certificate verification profile the corresponds to the specified
security level, see <a class="ref" href="#tab_003akey_002dsizes">Table 6.7</a> for the mappings to values.</td></tr>
<tr><td width="45%">%PROFILE_(SUITEB128|SUITEB192)</td><td width="45%">require a certificate verification profile the corresponds to SUITEB. Note
that an initial keyword that enables SUITEB automatically sets the profile.</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 6.6: </strong>More priority string keywords.</p></div></div>
<p>Finally the ciphersuites enabled by any priority string can be
listed using the <code class="code">gnutls-cli</code> application (see <a class="ref" href="#gnutls_002dcli-Invocation">gnutls-cli Invocation</a>),
or by using the priority functions as in <a class="ref" href="#Listing-the-ciphersuites-in-a-priority-string">Listing the ciphersuites in a priority string</a>.
</p>
<p>Example priority strings are:
</p><div class="example">
<pre class="example-preformatted">The system imposed security level:
"SYSTEM"
The default priority without the HMAC-MD5:
"NORMAL:-MD5"
Specifying RSA with AES-128-CBC:
"NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+AES-128-CBC:+SIGN-ALL:+COMP-NULL"
Specifying the defaults plus ARCFOUR-128:
"NORMAL:+ARCFOUR-128"
Enabling the 128-bit secure ciphers, while disabling TLS 1.0:
"SECURE128:-VERS-TLS1.0"
Enabling the 128-bit and 192-bit secure ciphers, while disabling all TLS versions
except TLS 1.2:
"SECURE128:+SECURE192:-VERS-ALL:+VERS-TLS1.2"
</pre></div>
<hr>
</div>
<div class="section-level-extent" id="Selecting-cryptographic-key-sizes">
<div class="nav-panel">
<p>
Next: <a href="#Advanced-topics" accesskey="n" rel="next">Advanced topics</a>, Previous: <a href="#Priority-Strings" accesskey="p" rel="prev">Priority strings</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Selecting-cryptographic-key-sizes-1"><span>6.11 Selecting cryptographic key sizes<a class="copiable-link" href="#Selecting-cryptographic-key-sizes-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-key-sizes"></a>
<p>Because many algorithms are involved in TLS, it is not easy to set
a consistent security level. For this reason in <a class="ref" href="#tab_003akey_002dsizes">Table 6.7</a> we
present some correspondence between key sizes of symmetric algorithms
and public key algorithms based on [<a class="ref" href="#ECRYPT">ECRYPT</a>].
Those can be used to generate certificates with
appropriate key sizes as well as select parameters for Diffie-Hellman and SRP
authentication.
</p>
<div class="float" id="tab_003akey_002dsizes">
<table class="multitable">
<thead><tr><th width="10%">Security bits</th><th width="12%">RSA, DH and SRP parameter size</th><th width="10%">ECC key size</th><th width="20%">Security parameter (profile)</th><th width="32%">Description</th></tr></thead>
<tbody><tr><td width="10%"><64</td><td width="12%"><768</td><td width="10%"><128</td><td width="20%"><code class="code">INSECURE</code></td><td width="32%">Considered to be insecure</td></tr>
<tr><td width="10%">64</td><td width="12%">768</td><td width="10%">128</td><td width="20%"><code class="code">VERY WEAK</code></td><td width="32%">Short term protection against individuals</td></tr>
<tr><td width="10%">72</td><td width="12%">1008</td><td width="10%">160</td><td width="20%"><code class="code">WEAK</code></td><td width="32%">Short term protection against small organizations</td></tr>
<tr><td width="10%">80</td><td width="12%">1024</td><td width="10%">160</td><td width="20%"><code class="code">LOW</code></td><td width="32%">Very short term protection against agencies (corresponds to ENISA legacy level)</td></tr>
<tr><td width="10%">96</td><td width="12%">1776</td><td width="10%">192</td><td width="20%"><code class="code">LEGACY</code></td><td width="32%">Legacy standard level</td></tr>
<tr><td width="10%">112</td><td width="12%">2048</td><td width="10%">224</td><td width="20%"><code class="code">MEDIUM</code></td><td width="32%">Medium-term protection</td></tr>
<tr><td width="10%">128</td><td width="12%">3072</td><td width="10%">256</td><td width="20%"><code class="code">HIGH</code></td><td width="32%">Long term protection (corresponds to ENISA future level)</td></tr>
<tr><td width="10%">192</td><td width="12%">8192</td><td width="10%">384</td><td width="20%"><code class="code">ULTRA</code></td><td width="32%">Even longer term protection</td></tr>
<tr><td width="10%">256</td><td width="12%">15424</td><td width="10%">512</td><td width="20%"><code class="code">FUTURE</code></td><td width="32%">Foreseeable future</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table 6.7: </strong>Key sizes and security parameters.</p></div></div>
<p>The first column provides a security parameter in a number of bits. This
gives an indication of the number of combinations to be tried by an adversary
to brute force a key. For example to test all possible keys in a 112 bit security parameter
<em class="math">2^{112}</em> combinations have to be tried. For today’s technology this is infeasible.
The next two columns correlate the security
parameter with actual bit sizes of parameters for DH, RSA, SRP and ECC algorithms.
A mapping to <code class="code">gnutls_sec_param_t</code> value is given for each security parameter, on
the next column, and finally a brief description of the level.
</p>
<p>Note, however, that the values suggested here are nothing more than an
educated guess that is valid today. There are no guarantees that an
algorithm will remain unbreakable or that these values will remain
constant in time. There could be scientific breakthroughs that cannot
be predicted or total failure of the current public key systems by
quantum computers. On the other hand though the cryptosystems used in
TLS are selected in a conservative way and such catastrophic
breakthroughs or failures are believed to be unlikely.
The NIST publication SP 800-57 [<a class="ref" href="#NISTSP80057">NISTSP80057</a>] contains a similar
table.
</p>
<p>When using <abbr class="acronym">GnuTLS</abbr> and a decision on bit sizes for a public
key algorithm is required, use of the following functions is
recommended:
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsec_005fparam_005fto_005fpk_005fbits"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_sec_param_to_pk_bits</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">algo</var>, gnutls_sec_param_t <var class="var">param</var>)</code><a class="copiable-link" href="#index-gnutls_005fsec_005fparam_005fto_005fpk_005fbits"> ¶</a></span></dt>
<dd><p><var class="var">algo</var>: is a public key algorithm
</p>
<p><var class="var">param</var>: is a security parameter
</p>
<p>When generating private and public key pairs a difficult question
is which size of "bits" the modulus will be in RSA and the group size
in DSA. The easy answer is 1024, which is also wrong. This function
will convert a human understandable security parameter to an
appropriate size for the specific algorithm.
</p>
<p><strong class="strong">Returns:</strong> The number of bits, or (0).
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005fbits_005fto_005fsec_005fparam"><span class="category-def">Function: </span><span><code class="def-type">gnutls_sec_param_t</code> <strong class="def-name">gnutls_pk_bits_to_sec_param</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005fbits_005fto_005fsec_005fparam"> ¶</a></span></dt>
<dd><p><var class="var">algo</var>: is a public key algorithm
</p>
<p><var class="var">bits</var>: is the number of bits
</p>
<p>This is the inverse of <code class="code">gnutls_sec_param_to_pk_bits()</code> . Given an algorithm
and the number of bits, it will return the security parameter. This is
a rough indication.
</p>
<p><strong class="strong">Returns:</strong> The security parameter.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<p>Those functions will convert a human understandable security parameter
of <code class="code">gnutls_sec_param_t</code> type, to a number of bits suitable for a public
key algorithm.
</p>
<dl class="table">
<dt><code class="code"><var class="var">const char *</var> <a class="ref" href="#gnutls_005fsec_005fparam_005fget_005fname">gnutls_sec_param_get_name</a> (gnutls_sec_param_t <var class="var">param</var>)</code></dt>
</dl>
<p>The following functions will set the minimum acceptable group size for Diffie-Hellman
and SRP authentication.
</p><dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fdh_005fset_005fprime_005fbits">gnutls_dh_set_prime_bits</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">bits</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fsrp_005fset_005fprime_005fbits">gnutls_srp_set_prime_bits</a> (gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">bits</var>)</code></dt>
</dl>
<hr>
</div>
<div class="section-level-extent" id="Advanced-topics">
<div class="nav-panel">
<p>
Previous: <a href="#Selecting-cryptographic-key-sizes" accesskey="p" rel="prev">Selecting cryptographic key sizes</a>, Up: <a href="#How-to-use-GnuTLS-in-applications" accesskey="u" rel="up">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Advanced-topics-1"><span>6.12 Advanced topics<a class="copiable-link" href="#Advanced-topics-1"> ¶</a></span></h3>
<ul class="mini-toc">
<li><a href="#Virtual-hosts-and-credentials" accesskey="1">Virtual hosts and credentials</a></li>
<li><a href="#Session-resumption" accesskey="2">Session resumption</a></li>
<li><a href="#Certificate-verification" accesskey="3">Certificate verification</a></li>
<li><a href="#TLS-1_002e2-re_002dauthentication" accesskey="4">TLS 1.2 re-authentication</a></li>
<li><a href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey" accesskey="5">TLS 1.3 re-authentication and re-key</a></li>
<li><a href="#Parameter-generation" accesskey="6">Parameter generation</a></li>
<li><a href="#Deriving-keys-for-other-applications_002fprotocols" accesskey="7">Deriving keys for other applications/protocols</a></li>
<li><a href="#Channel-Bindings" accesskey="8">Channel bindings</a></li>
<li><a href="#Interoperability" accesskey="9">Interoperability</a></li>
<li><a href="#Compatibility-with-the-OpenSSL-library">Compatibility with the OpenSSL library</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Virtual-hosts-and-credentials">
<div class="nav-panel">
<p>
Next: <a href="#Session-resumption" accesskey="n" rel="next">Session resumption</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Virtual-hosts-and-credentials-1"><span>6.12.1 Virtual hosts and credentials<a class="copiable-link" href="#Virtual-hosts-and-credentials-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-virtual-hosts"></a>
<a class="index-entry-id" id="index-credentials"></a>
<p>Often when operating with virtual hosts, one may not want to associate
a particular certificate set to the credentials function early, before
the virtual host is known. That can be achieved by calling
<a class="ref" href="#gnutls_005fcredentials_005fset">gnutls_credentials_set</a> within a handshake pre-hook for client
hello. That message contains the peer’s intended hostname, and if read,
and the appropriate credentials are set, gnutls will be able to
continue in the handshake process. A brief usage example is shown
below.
</p>
<div class="example">
<pre class="example-preformatted">static int ext_hook_func(void *ctx, unsigned tls_id,
const unsigned char *data, unsigned size)
{
if (tls_id == 0) { /* server name */
/* figure the advertised name - the following hack
* relies on the fact that this extension only supports
* DNS names, and due to a protocol bug cannot be extended
* to support anything else. */
if (name < 5) return 0;
name = data+5;
name_size = size-5;
}
return 0;
}
static int
handshake_hook_func(gnutls_session_t session, unsigned int htype,
unsigned when, unsigned int incoming, const gnutls_datum_t *msg)
{
int ret;
assert(htype == GNUTLS_HANDSHAKE_CLIENT_HELLO);
assert(when == GNUTLS_HOOK_PRE);
ret = gnutls_ext_raw_parse(NULL, ext_hook_func, msg,
GNUTLS_EXT_RAW_FLAG_TLS_CLIENT_HELLO);
assert(ret >= 0);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cred);
return ret;
}
int main(void)
{
...
gnutls_handshake_set_hook_function(server, GNUTLS_HANDSHAKE_CLIENT_HELLO,
GNUTLS_HOOK_PRE, handshake_hook_func);
...
}
</pre></div>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005fhook_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_hook_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">htype</var>, int <var class="var">when</var>, gnutls_handshake_hook_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005fhook_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">htype</var>: the <code class="code">gnutls_handshake_description_t</code> of the message to hook at
</p>
<p><var class="var">when</var>: <code class="code">GNUTLS_HOOK_</code> * depending on when the hook function should be called
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback to be called after or before the specified
handshake message has been received or generated. This is a
generalization of <code class="code">gnutls_handshake_set_post_client_hello_function()</code> .
</p>
<p>To call the hook function prior to the message being generated or processed
use <code class="code">GNUTLS_HOOK_PRE</code> as <code class="code">when</code> parameter, <code class="code">GNUTLS_HOOK_POST</code> to call
after, and <code class="code">GNUTLS_HOOK_BOTH</code> for both cases.
</p>
<p>This callback must return 0 on success or a gnutls error code to
terminate the handshake.
</p>
<p>To hook at all handshake messages use an <code class="code">htype</code> of <code class="code">GNUTLS_HANDSHAKE_ANY</code> .
</p>
<p><strong class="strong">Warning:</strong> You should not use this function to terminate the
handshake based on client input unless you know what you are
doing. Before the handshake is finished there is no way to know if
there is a man-in-the-middle attack being performed.
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="Session-resumption">
<div class="nav-panel">
<p>
Next: <a href="#Certificate-verification" accesskey="n" rel="next">Certificate verification</a>, Previous: <a href="#Virtual-hosts-and-credentials" accesskey="p" rel="prev">Virtual hosts and credentials</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Session-resumption-1"><span>6.12.2 Session resumption<a class="copiable-link" href="#Session-resumption-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-resuming-sessions-1"></a>
<a class="index-entry-id" id="index-session-resumption-1"></a>
<p>To reduce time and network traffic spent in a handshake the client can
request session resumption from a server that previously shared a
session with the client.
</p>
<p>Under TLS 1.2, in order to support resumption a server can either store
the session security parameters in a local database or use session
tickets (see <a class="ref" href="#Session-tickets">Session tickets</a>) to delegate storage to the client.
</p>
<p>Under TLS 1.3, session resumption is only available through session
tickets, and multiple tickets could be sent from server to client. That
provides the following advantages:
</p><ul class="itemize mark-bullet">
<li>When tickets are not re-used the subsequent client sessions cannot be associated with each other by an eavesdropper
</li><li>On post-handshake authentication the server may send different tickets asynchronously for each identity used by client.
</li></ul>
<h4 class="subsubheading" id="Client-side-1"><span>Client side<a class="copiable-link" href="#Client-side-1"> ¶</a></span></h4>
<p>The client has to retrieve and store the session parameters. Before
establishing a new session to the same server the parameters must be
re-associated with the GnuTLS session using
<a class="ref" href="#gnutls_005fsession_005fset_005fdata">gnutls_session_set_data</a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsession_005fget_005fdata2">gnutls_session_get_data2</a> (gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">data</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsession_005fset_005fdata">gnutls_session_set_data</a> (gnutls_session_t <var class="var">session</var>, const void * <var class="var">session_data</var>, size_t <var class="var">session_data_size</var>)</code></dt>
</dl>
<p>Keep in mind that sessions will be expired after some time, depending
on the server, and a server may choose not to resume a session
even when requested to. The expiration is to prevent temporal session keys
from becoming long-term keys. Also note that as a client you must enable,
using the priority functions, at least the algorithms used in the last session.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fis_005fresumed"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_is_resumed</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fis_005fresumed"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Checks whether session is resumed or not. This is functional
for both server and client side.
</p>
<p><strong class="strong">Returns:</strong> non zero if this session is resumed, or a zero if this is
a new session.
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fid2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_get_id2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">session_id</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fid2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">session_id</var>: will point to the session ID.
</p>
<p>Returns the TLS session identifier. The session ID is selected by the
server, and in older versions of TLS was a unique identifier shared
between client and server which was persistent across resumption.
In the latest version of TLS (1.3) or TLS 1.2 with session tickets, the
notion of session identifiers is undefined and cannot be relied for uniquely
identifying sessions across client and server.
</p>
<p>In client side this function returns the identifier returned by the
server, and cannot be assumed to have any relation to session resumption.
In server side this function is guaranteed to return a persistent
identifier of the session since GnuTLS 3.6.4, which may not necessarily
map into the TLS session ID value. Prior to that version the value
could only be considered a persistent identifier, under TLS1.2 or earlier
and when no session tickets were in use.
</p>
<p>The session identifier value returned is always less than
<code class="code">GNUTLS_MAX_SESSION_ID_SIZE</code> and should be treated as constant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.4
</p></dd></dl>
<h4 class="subsubheading" id="Server-side-1"><span>Server side<a class="copiable-link" href="#Server-side-1"> ¶</a></span></h4>
<p>A server enabling both session tickets and a storage for session data
would use session tickets when clients support it and the storage otherwise.
</p>
<p>A storing server needs to specify callback functions to store, retrieve and delete session data. These can be
registered with the functions below. The stored sessions in the database can be checked using <a class="ref" href="#gnutls_005fdb_005fcheck_005fentry">gnutls_db_check_entry</a>
for expiration.
</p>
<dl class="table">
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fdb_005fset_005fretrieve_005ffunction">gnutls_db_set_retrieve_function</a> (gnutls_session_t <var class="var">session</var>, gnutls_db_retr_func <var class="var">retr_func</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fdb_005fset_005fstore_005ffunction">gnutls_db_set_store_function</a> (gnutls_session_t <var class="var">session</var>, gnutls_db_store_func <var class="var">store_func</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fdb_005fset_005fptr">gnutls_db_set_ptr</a> (gnutls_session_t <var class="var">session</var>, void * <var class="var">ptr</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fdb_005fset_005fremove_005ffunction">gnutls_db_set_remove_function</a> (gnutls_session_t <var class="var">session</var>, gnutls_db_remove_func <var class="var">rem_func</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fdb_005fcheck_005fentry">gnutls_db_check_entry</a> (gnutls_session_t <var class="var">session</var>, gnutls_datum_t <var class="var">session_entry</var>)</code></dt>
</dl>
<p>A server supporting session tickets must generate ticket encryption
and authentication keys using <a class="ref" href="#gnutls_005fsession_005fticket_005fkey_005fgenerate">gnutls_session_ticket_key_generate</a>.
Those keys should be associated with the GnuTLS session using
<a class="ref" href="#gnutls_005fsession_005fticket_005fenable_005fserver">gnutls_session_ticket_enable_server</a>.
</p>
<p>Those will be the initial keys, but GnuTLS will rotate them regularly. The key rotation interval
can be changed with <a class="ref" href="#gnutls_005fdb_005fset_005fcache_005fexpiration">gnutls_db_set_cache_expiration</a> and will be set to
three times the ticket expiration time (ie. three times the value given in that function).
Every such interval, new keys will be generated from those initial keys. This is a necessary mechanism
to prevent the keys from becoming long-term keys
and as such preserve forward-secrecy in the issued session tickets. If no explicit key rotation interval
is provided, GnuTLS will rotate them every 18 hours by default.
</p>
<p>The master key can be shared between processes or between systems. Processes which share the same master key
will generate the same rotated subkeys, assuming they share the same time (irrespective of timezone differences).
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fticket_005fenable_005fserver"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ticket_enable_server</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_datum_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fticket_005fenable_005fserver"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">key</var>: key to encrypt session parameters.
</p>
<p>Request that the server should attempt session resumption using
session tickets, i.e., by delegating storage to the client.
<code class="code">key</code> must be initialized using <code class="code">gnutls_session_ticket_key_generate()</code> .
To avoid leaking that key, use <code class="code">gnutls_memset()</code> prior to
releasing it.
</p>
<p>The default ticket expiration time can be overridden using
<code class="code">gnutls_db_set_cache_expiration()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fticket_005fkey_005fgenerate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ticket_key_generate</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fticket_005fkey_005fgenerate"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: is a pointer to a <code class="code">gnutls_datum_t</code> which will contain a newly
created key.
</p>
<p>Generate a random key to encrypt security parameters within
SessionTicket.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fresumption_005frequested"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_resumption_requested</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fresumption_005frequested"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Check whether the client has asked for session resumption.
This function is valid only on server side.
</p>
<p><strong class="strong">Returns:</strong> non zero if session resumption was asked, or a zero if not.
</p></dd></dl>
<p>The expiration time for session resumption, either in tickets or stored data
is set using <a class="ref" href="#gnutls_005fdb_005fset_005fcache_005fexpiration">gnutls_db_set_cache_expiration</a>. This function also controls
the ticket key rotation period. Currently, the session key rotation interval is set
to 3 times the expiration time set by this function.
</p>
<p>Under TLS 1.3, the server sends by default 2 tickets, and can send
additional session tickets at any time using <a class="ref" href="#gnutls_005fsession_005fticket_005fsend">gnutls_session_ticket_send</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fticket_005fsend"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ticket_send</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">nr</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fticket_005fsend"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">nr</var>: the number of tickets to send
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>Sends a fresh session ticket to the peer. This is relevant only
in server side under TLS1.3. This function may also return <code class="code">GNUTLS_E_AGAIN</code>
or <code class="code">GNUTLS_E_INTERRUPTED</code> and in that case it must be called again.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or a negative error code.
</p></dd></dl>
<hr>
</div>
<div class="subsection-level-extent" id="Certificate-verification">
<div class="nav-panel">
<p>
Next: <a href="#TLS-1_002e2-re_002dauthentication" accesskey="n" rel="next">TLS 1.2 re-authentication</a>, Previous: <a href="#Session-resumption" accesskey="p" rel="prev">Session resumption</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Certificate-verification-1"><span>6.12.3 Certificate verification<a class="copiable-link" href="#Certificate-verification-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-DANE-1"></a>
<a class="index-entry-id" id="index-DNSSEC-1"></a>
<a class="index-entry-id" id="index-SSH_002dstyle-authentication-1"></a>
<a class="index-entry-id" id="index-Trust-on-first-use-1"></a>
<a class="index-entry-id" id="index-Key-pinning-1"></a>
<a class="index-entry-id" id="index-gnutls_005fcertificate_005fverify_005fflags-1"></a>
<p>In this section the functionality for additional certificate verification methods is listed.
These methods are intended to be used in addition to normal PKI verification, in order to reduce
the risk of a compromised CA being undetected.
</p>
<ul class="mini-toc">
<li><a href="#Trust-on-first-use" accesskey="1">Trust on first use</a></li>
<li><a href="#DANE-verification" accesskey="2">DANE verification</a></li>
</ul>
<div class="subsubsection-level-extent" id="Trust-on-first-use">
<h4 class="subsubsection"><span>6.12.3.1 Trust on first use<a class="copiable-link" href="#Trust-on-first-use"> ¶</a></span></h4>
<p>The GnuTLS library includes functionality to use an SSH-like trust on first use authentication.
The available functions to store and verify public keys are listed below.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fverify_005fstored_005fpubkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_verify_stored_pubkey</strong> <code class="def-code-arguments">(const char * <var class="var">db_name</var>, gnutls_tdb_t <var class="var">tdb</var>, const char * <var class="var">host</var>, const char * <var class="var">service</var>, gnutls_certificate_type_t <var class="var">cert_type</var>, const gnutls_datum_t * <var class="var">cert</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fverify_005fstored_005fpubkey"> ¶</a></span></dt>
<dd><p><var class="var">db_name</var>: A file specifying the stored keys (use NULL for the default)
</p>
<p><var class="var">tdb</var>: A storage structure or NULL to use the default
</p>
<p><var class="var">host</var>: The peer’s name
</p>
<p><var class="var">service</var>: non-NULL if this key is specific to a service (e.g. http)
</p>
<p><var class="var">cert_type</var>: The type of the certificate
</p>
<p><var class="var">cert</var>: The raw (der) data of the certificate
</p>
<p><var class="var">flags</var>: should be 0.
</p>
<p>This function will try to verify a raw public-key or a public-key provided via
a raw (DER-encoded) certificate using a list of stored public keys.
The <code class="code">service</code> field if non-NULL should be a port number.
</p>
<p>The <code class="code">db_name</code> variable if non-null specifies a custom backend for
the retrieval of entries. If it is NULL then the
default file backend will be used. In POSIX-like systems the
file backend uses the $HOME/.gnutls/known_hosts file.
</p>
<p>Note that if the custom storage backend is provided the
retrieval function should return <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code>
if the host/service pair is found but key doesn’t match,
<code class="code">GNUTLS_E_NO_CERTIFICATE_FOUND</code> if no such host/service with
the given key is found, and 0 if it was found. The storage
function should return 0 on success.
</p>
<p>As of GnuTLS 3.6.6 this function also verifies raw public keys.
</p>
<p><strong class="strong">Returns:</strong> If no associated public key is found
then <code class="code">GNUTLS_E_NO_CERTIFICATE_FOUND</code> will be returned. If a key
is found but does not match <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code>
is returned. On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
or a negative error value on other errors.
</p>
<p><strong class="strong">Since:</strong> 3.0.13
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fstore_005fpubkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_store_pubkey</strong> <code class="def-code-arguments">(const char * <var class="var">db_name</var>, gnutls_tdb_t <var class="var">tdb</var>, const char * <var class="var">host</var>, const char * <var class="var">service</var>, gnutls_certificate_type_t <var class="var">cert_type</var>, const gnutls_datum_t * <var class="var">cert</var>, time_t <var class="var">expiration</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fstore_005fpubkey"> ¶</a></span></dt>
<dd><p><var class="var">db_name</var>: A file specifying the stored keys (use NULL for the default)
</p>
<p><var class="var">tdb</var>: A storage structure or NULL to use the default
</p>
<p><var class="var">host</var>: The peer’s name
</p>
<p><var class="var">service</var>: non-NULL if this key is specific to a service (e.g. http)
</p>
<p><var class="var">cert_type</var>: The type of the certificate
</p>
<p><var class="var">cert</var>: The data of the certificate
</p>
<p><var class="var">expiration</var>: The expiration time (use 0 to disable expiration)
</p>
<p><var class="var">flags</var>: should be 0.
</p>
<p>This function will store a raw public-key or a public-key provided via
a raw (DER-encoded) certificate to the list of stored public keys. The key
will be considered valid until the provided expiration time.
</p>
<p>The <code class="code">tdb</code> variable if non-null specifies a custom backend for
the storage of entries. If it is NULL then the
default file backend will be used.
</p>
<p>Unless an alternative <code class="code">tdb</code> is provided, the storage format is a textual format
consisting of a line for each host with fields separated by ’|’. The contents of
the fields are a format-identifier which is set to ’g0’, the hostname that the
rest of the data applies to, the numeric port or host name, the expiration
time in seconds since the epoch (0 for no expiration), and a base64
encoding of the raw (DER) public key information (SPKI) of the peer.
</p>
<p>As of GnuTLS 3.6.6 this function also accepts raw public keys.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0.13
</p></dd></dl>
<p>In addition to the above the <a class="ref" href="#gnutls_005fstore_005fcommitment">gnutls_store_commitment</a> can be
used to implement a key-pinning architecture as in [<a class="ref" href="#KEYPIN">KEYPIN</a>].
This provides a way for web server to commit on a public key that is
not yet active.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fstore_005fcommitment"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_store_commitment</strong> <code class="def-code-arguments">(const char * <var class="var">db_name</var>, gnutls_tdb_t <var class="var">tdb</var>, const char * <var class="var">host</var>, const char * <var class="var">service</var>, gnutls_digest_algorithm_t <var class="var">hash_algo</var>, const gnutls_datum_t * <var class="var">hash</var>, time_t <var class="var">expiration</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fstore_005fcommitment"> ¶</a></span></dt>
<dd><p><var class="var">db_name</var>: A file specifying the stored keys (use NULL for the default)
</p>
<p><var class="var">tdb</var>: A storage structure or NULL to use the default
</p>
<p><var class="var">host</var>: The peer’s name
</p>
<p><var class="var">service</var>: non-NULL if this key is specific to a service (e.g. http)
</p>
<p><var class="var">hash_algo</var>: The hash algorithm type
</p>
<p><var class="var">hash</var>: The raw hash
</p>
<p><var class="var">expiration</var>: The expiration time (use 0 to disable expiration)
</p>
<p><var class="var">flags</var>: should be 0 or <code class="code">GNUTLS_SCOMMIT_FLAG_ALLOW_BROKEN</code> .
</p>
<p>This function will store the provided hash commitment to
the list of stored public keys. The key with the given
hash will be considered valid until the provided expiration time.
</p>
<p>The <code class="code">tdb</code> variable if non-null specifies a custom backend for
the storage of entries. If it is NULL then the
default file backend will be used.
</p>
<p>Note that this function is not thread safe with the default backend.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<p>The storage and verification functions may be used with the default
text file based back-end, or another back-end may be specified. That
should contain storage and retrieval functions and specified as below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ftdb_005finit">gnutls_tdb_init</a> (gnutls_tdb_t * <var class="var">tdb</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftdb_005fdeinit">gnutls_tdb_deinit</a> (gnutls_tdb_t <var class="var">tdb</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftdb_005fset_005fverify_005ffunc">gnutls_tdb_set_verify_func</a> (gnutls_tdb_t <var class="var">tdb</var>, gnutls_tdb_verify_func <var class="var">verify</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftdb_005fset_005fstore_005ffunc">gnutls_tdb_set_store_func</a> (gnutls_tdb_t <var class="var">tdb</var>, gnutls_tdb_store_func <var class="var">store</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ftdb_005fset_005fstore_005fcommitment_005ffunc">gnutls_tdb_set_store_commitment_func</a> (gnutls_tdb_t <var class="var">tdb</var>, gnutls_tdb_store_commitment_func <var class="var">cstore</var>)</code></dt>
</dl>
</div>
<div class="subsubsection-level-extent" id="DANE-verification">
<h4 class="subsubsection"><span>6.12.3.2 DANE verification<a class="copiable-link" href="#DANE-verification"> ¶</a></span></h4>
<p>Since the DANE library is not included in GnuTLS it requires programs
to be linked against it. This can be achieved with the following commands.
</p>
<div class="example">
<pre class="example-preformatted">gcc -o foo foo.c `pkg-config gnutls-dane --cflags --libs`
</pre></div>
<p>When a program uses the GNU autoconf system, then the following
line or similar can be used to detect the presence of the library.
</p>
<div class="example">
<pre class="example-preformatted">PKG_CHECK_MODULES([LIBDANE], [gnutls-dane >= 3.0.0])
AC_SUBST([LIBDANE_CFLAGS])
AC_SUBST([LIBDANE_LIBS])
</pre></div>
<p>The high level functionality provided by the DANE library is shown below.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fverify_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_verify_crt</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>, const gnutls_datum_t * <var class="var">chain</var>, unsigned <var class="var">chain_size</var>, gnutls_certificate_type_t <var class="var">chain_type</var>, const char * <var class="var">hostname</var>, const char * <var class="var">proto</var>, unsigned int <var class="var">port</var>, unsigned int <var class="var">sflags</var>, unsigned int <var class="var">vflags</var>, unsigned int * <var class="var">verify</var>)</code><a class="copiable-link" href="#index-dane_005fverify_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: A DANE state structure (may be NULL)
</p>
<p><var class="var">chain</var>: A certificate chain
</p>
<p><var class="var">chain_size</var>: The size of the chain
</p>
<p><var class="var">chain_type</var>: The type of the certificate chain
</p>
<p><var class="var">hostname</var>: The hostname associated with the chain
</p>
<p><var class="var">proto</var>: The protocol of the service connecting (e.g. tcp)
</p>
<p><var class="var">port</var>: The port of the service connecting (e.g. 443)
</p>
<p><var class="var">sflags</var>: Flags for the initialization of <code class="code">s</code> (if NULL)
</p>
<p><var class="var">vflags</var>: Verification flags; an OR’ed list of <code class="code">dane_verify_flags_t</code> .
</p>
<p><var class="var">verify</var>: An OR’ed list of <code class="code">dane_verify_status_t</code> .
</p>
<p>This function will verify the given certificate chain against the
CA constrains and/or the certificate available via DANE.
If no information via DANE can be obtained the flag <code class="code">DANE_VERIFY_NO_DANE_INFO</code>
is set. If a DNSSEC signature is not available for the DANE
record then the verify flag <code class="code">DANE_VERIFY_NO_DNSSEC_DATA</code> is set.
</p>
<p>Due to the many possible options of DANE, there is no single threat
model countered. When notifying the user about DANE verification results
it may be better to mention: DANE verification did not reject the certificate,
rather than mentioning a successful DANE verification.
</p>
<p>Note that this function is designed to be run in addition to
PKIX - certificate chain - verification. To be run independently
the <code class="code">DANE_VFLAG_ONLY_CHECK_EE_USAGE</code> flag should be specified;
then the function will check whether the key of the peer matches the
key advertised in the DANE entry.
</p>
<p><strong class="strong">Returns:</strong> a negative error code on error and <code class="code">DANE_E_SUCCESS</code> (0)
when the DANE entries were successfully parsed, irrespective of
whether they were verified (see <code class="code">verify</code> for that information). If
no usable entries were encountered <code class="code">DANE_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#dane_005fverify_005fsession_005fcrt">dane_verify_session_crt</a> (dane_state_t <var class="var">s</var>, gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, const char * <var class="var">proto</var>, unsigned int <var class="var">port</var>, unsigned int <var class="var">sflags</var>, unsigned int <var class="var">vflags</var>, unsigned int * <var class="var">verify</var>)</code></dt>
<dt><code class="code"><var class="var">const char *</var> <a class="ref" href="#dane_005fstrerror">dane_strerror</a> (int <var class="var">error</var>)</code></dt>
</dl>
<p>Note that the <code class="code">dane_state_t</code> structure that is accepted by both
verification functions is optional. It is required when many queries
are performed to optimize against multiple re-initializations of the
resolving back-end and loading of DNSSEC keys.
</p>
<p>The following flags are returned by the verify functions to
indicate the status of the verification.
</p>
<div class="float" id="dane_005fverify_005fstatus_005ft">
<dl class="table">
<dt><code class="code">DANE_VERIFY_CA_CONSTRAINTS_VIOLATED</code></dt>
<dd><p>The CA constraints were violated.
</p></dd>
<dt><code class="code">DANE_VERIFY_CERT_DIFFERS</code></dt>
<dd><p>The certificate obtained via DNS differs.
</p></dd>
<dt><code class="code">DANE_VERIFY_UNKNOWN_DANE_INFO</code></dt>
<dd><p>No known DANE data was found in the DNS record.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 6.3: </strong>The DANE verification status flags.</p></div></div>
<p>In order to generate a DANE TLSA entry to use in a DNS server
you may use danetool (see <a class="ref" href="#danetool-Invocation">Invoking danetool</a>).
</p>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="TLS-1_002e2-re_002dauthentication">
<div class="nav-panel">
<p>
Next: <a href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey" accesskey="n" rel="next">TLS 1.3 re-authentication and re-key</a>, Previous: <a href="#Certificate-verification" accesskey="p" rel="prev">Certificate verification</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="TLS-1_002e2-re_002dauthentication-1"><span>6.12.4 TLS 1.2 re-authentication<a class="copiable-link" href="#TLS-1_002e2-re_002dauthentication-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-re_002dnegotiation"></a>
<a class="index-entry-id" id="index-re_002dauthentication"></a>
<p>In TLS 1.2 or earlier there is no distinction between re-key, re-authentication, and re-negotiation.
All of these use cases are handled by the TLS’ rehandshake process. For that reason
in GnuTLS rehandshake is not transparent to the application, and the application
must explicitly take control of that process. In addition GnuTLS since version 3.5.0 will not
allow the peer to switch identities during a rehandshake.
The threat addressed by that behavior depends on the application protocol,
but primarily it protects applications from being misled
by a rehandshake which switches the peer’s identity. Applications can
disable this protection by using the <code class="code">GNUTLS_ALLOW_ID_CHANGE</code> flag in
<a class="ref" href="#gnutls_005finit">gnutls_init</a>.
</p>
<p>The following paragraphs explain how to safely use the rehandshake process.
</p>
<ul class="mini-toc">
<li><a href="#Client-side" accesskey="1">Client side</a></li>
<li><a href="#Server-side" accesskey="2">Server side</a></li>
</ul>
<div class="subsubsection-level-extent" id="Client-side">
<h4 class="subsubsection"><span>6.12.4.1 Client side<a class="copiable-link" href="#Client-side"> ¶</a></span></h4>
<p>According to the TLS specification a client may initiate a rehandshake at any
time. That can be achieved by calling <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> and rely on its
return value for the outcome of the handshake (the server may deny a rehandshake).
If a server requests a re-handshake, then a call to <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a> will
return GNUTLS_E_REHANDSHAKE in the client, instructing it to call <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a>.
To deny a rehandshake request by the server it is recommended to send a warning alert
of type GNUTLS_A_NO_RENEGOTIATION.
</p>
<p>Due to limitations of early protocol versions, it is required to check whether
safe renegotiation is in place, i.e., using <a class="ref" href="#gnutls_005fsafe_005frenegotiation_005fstatus">gnutls_safe_renegotiation_status</a>,
which ensures that the server remains the same as the initial.
</p>
<p>To make re-authentication transparent to the application when requested
by the server, use the <code class="code">GNUTLS_AUTO_REAUTH</code> flag on the
<a class="ref" href="#gnutls_005finit">gnutls_init</a> call. In that case the re-authentication will happen
in the call of <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a> that received the
reauthentication request.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsafe_005frenegotiation_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_safe_renegotiation_status</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsafe_005frenegotiation_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Can be used to check whether safe renegotiation is being used
in the current session.
</p>
<p><strong class="strong">Returns:</strong> 0 when safe renegotiation is not used and non (0) when
safe renegotiation is used.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
</div>
<div class="subsubsection-level-extent" id="Server-side">
<h4 class="subsubsection"><span>6.12.4.2 Server side<a class="copiable-link" href="#Server-side"> ¶</a></span></h4>
<p>A server which wants to instruct the client to re-authenticate, should call
<a class="ref" href="#gnutls_005frehandshake">gnutls_rehandshake</a> and wait for the client to re-authenticate.
It is recommended to only request re-handshake when safe renegotiation is
enabled for that session (see <a class="ref" href="#gnutls_005fsafe_005frenegotiation_005fstatus">gnutls_safe_renegotiation_status</a> and
the discussion in <a class="ref" href="#Safe-renegotiation">Safe renegotiation</a>). A server could also encounter
the GNUTLS_E_REHANDSHAKE error code while receiving data. That indicates
a client-initiated re-handshake request. In that case the server could
ignore that request, perform handshake (unsafe when done generally), or
even drop the connection.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frehandshake"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_rehandshake</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frehandshake"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function can only be called in server side, and
instructs a TLS 1.2 or earlier client to renegotiate
parameters (perform a handshake), by sending a
hello request message.
</p>
<p>If this function succeeds, the calling application
should call <code class="code">gnutls_record_recv()</code> until <code class="code">GNUTLS_E_REHANDSHAKE</code>
is returned to clear any pending data. If the <code class="code">GNUTLS_E_REHANDSHAKE</code>
error code is not seen, then the handshake request was
not followed by the peer (the TLS protocol does not require
the client to do, and such compliance should be handled
by the application protocol).
</p>
<p>Once the <code class="code">GNUTLS_E_REHANDSHAKE</code> error code is seen, the
calling application should proceed to calling
<code class="code">gnutls_handshake()</code> to negotiate the new
parameters.
</p>
<p>If the client does not wish to renegotiate parameters he
may reply with an alert message, and in that case the return code seen
by subsequent <code class="code">gnutls_record_recv()</code> will be
<code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code> with the specific alert being
<code class="code">GNUTLS_A_NO_RENEGOTIATION</code> . A client may also choose to ignore
this request.
</p>
<p>Under TLS 1.3 this function is equivalent to <code class="code">gnutls_session_key_update()</code>
with the <code class="code">GNUTLS_KU_PEER</code> flag. In that case subsequent calls to
<code class="code">gnutls_record_recv()</code> will not return <code class="code">GNUTLS_E_REHANDSHAKE</code> , and
calls to <code class="code">gnutls_handshake()</code> in server side are a no-op.
</p>
<p>This function always fails with <code class="code">GNUTLS_E_INVALID_REQUEST</code> when
called in client side.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p></dd></dl>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="TLS-1_002e3-re_002dauthentication-and-re_002dkey">
<div class="nav-panel">
<p>
Next: <a href="#Parameter-generation" accesskey="n" rel="next">Parameter generation</a>, Previous: <a href="#TLS-1_002e2-re_002dauthentication" accesskey="p" rel="prev">TLS 1.2 re-authentication</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="TLS-1_002e3-re_002dauthentication-and-re_002dkey-1"><span>6.12.5 TLS 1.3 re-authentication and re-key<a class="copiable-link" href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-re_002dkey"></a>
<a class="index-entry-id" id="index-re_002dnegotiation-1"></a>
<a class="index-entry-id" id="index-re_002dauthentication-1"></a>
<a class="index-entry-id" id="index-post_002dhandshake-authentication"></a>
<p>The TLS 1.3 protocol distinguishes between re-key and re-authentication.
The re-key process ensures that fresh keys are supplied to the already
negotiated parameters, and on GnuTLS can be initiated using
<a class="ref" href="#gnutls_005fsession_005fkey_005fupdate">gnutls_session_key_update</a>. The re-key process can be one-way
(i.e., the calling party only changes its keys), or two-way where the peer
is requested to change keys as well.
</p>
<p>The re-authentication process, allows the connected client to switch
identity by presenting a new certificate. Unlike TLS 1.2, the server
is not allowed to change identities. That client re-authentication, or
post-handshake authentication can be initiated only by the server using
<a class="ref" href="#gnutls_005freauth">gnutls_reauth</a>, and only if a client has advertised support for it.
Both server and client have to explicitly enable support for post handshake
authentication using the <code class="code">GNUTLS_POST_HANDSHAKE_AUTH</code> flag at <a class="ref" href="#gnutls_005finit">gnutls_init</a>.
</p>
<p>A client receiving a re-authentication request will "see" the error code
<code class="code">GNUTLS_E_REAUTH_REQUEST</code> at <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a>. At this
point, it should also call <a class="ref" href="#gnutls_005freauth">gnutls_reauth</a>.
</p>
<p>To make re-authentication transparent to the application when requested
by the server, use the <code class="code">GNUTLS_AUTO_REAUTH</code> and <code class="code">GNUTLS_POST_HANDSHAKE_AUTH</code>
flags on the <a class="ref" href="#gnutls_005finit">gnutls_init</a> call. In that case the re-authentication will happen
in the call of <a class="ref" href="#gnutls_005frecord_005frecv">gnutls_record_recv</a> that received the
reauthentication request.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Parameter-generation">
<div class="nav-panel">
<p>
Next: <a href="#Deriving-keys-for-other-applications_002fprotocols" accesskey="n" rel="next">Deriving keys for other applications/protocols</a>, Previous: <a href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey" accesskey="p" rel="prev">TLS 1.3 re-authentication and re-key</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Parameter-generation-1"><span>6.12.6 Parameter generation<a class="copiable-link" href="#Parameter-generation-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-parameter-generation"></a>
<a class="index-entry-id" id="index-generating-parameters"></a>
<p>Prior to GnuTLS 3.6.0 for the ephemeral or anonymous Diffie-Hellman (DH) TLS ciphersuites
the application was required to generate or provide
DH parameters. That is no longer necessary as GnuTLS utilizes DH parameters
and negotiation from [<a class="ref" href="#RFC7919">RFC7919</a>].
</p>
<p>Applications can tune the used parameters by explicitly specifying them
in the priority string. In server side applications can set the
minimum acceptable level of DH parameters by calling
<a class="ref" href="#gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams">gnutls_certificate_set_known_dh_params</a>,
<a class="ref" href="#gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams">gnutls_anon_set_server_known_dh_params</a>, or
<a class="ref" href="#gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams">gnutls_psk_set_server_known_dh_params</a>, depending on the type
of the credentials, to set the lower acceptable parameter limits. Typical
applications should rely on the default settings.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams">gnutls_certificate_set_known_dh_params</a> (gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_sec_param_t <var class="var">sec_param</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams">gnutls_anon_set_server_known_dh_params</a> (gnutls_anon_server_credentials_t <var class="var">res</var>, gnutls_sec_param_t <var class="var">sec_param</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams">gnutls_psk_set_server_known_dh_params</a> (gnutls_psk_server_credentials_t <var class="var">res</var>, gnutls_sec_param_t <var class="var">sec_param</var>)</code></dt>
</dl>
<ul class="mini-toc">
<li><a href="#Legacy-parameter-generation" accesskey="1">Legacy parameter generation</a></li>
</ul>
<div class="subsubsection-level-extent" id="Legacy-parameter-generation">
<h4 class="subsubsection"><span>6.12.6.1 Legacy parameter generation<a class="copiable-link" href="#Legacy-parameter-generation"> ¶</a></span></h4>
<p>Note that older than 3.5.6 versions of GnuTLS provided functions
to generate or import arbitrary DH parameters from a file. This
practice is still supported but discouraged in current versions.
There is no known advantage from using random parameters, while there
have been several occasions where applications were utilizing incorrect,
weak or insecure parameters. This is the main reason GnuTLS includes the
well-known parameters of [<a class="ref" href="#RFC7919">RFC7919</a>] and recommends applications
utilizing them.
</p>
<p>In older applications which require to specify explicit DH parameters, we recommend
using <code class="code">certtool</code> (of GnuTLS 3.5.6 or later) with the <code class="code">--get-dh-params</code>
option to obtain the FFDHE parameters discussed above. The output
parameters of the tool are in PKCS#3 format and can be imported by
most existing applications.
</p>
<p>The following functions are still supported but considered obsolete.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fdh_005fparams_005fgenerate2">gnutls_dh_params_generate2</a> (gnutls_dh_params_t <var class="var">dparams</var>, unsigned int <var class="var">bits</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fdh_005fparams_005fimport_005fpkcs3">gnutls_dh_params_import_pkcs3</a> (gnutls_dh_params_t <var class="var">params</var>, const gnutls_datum_t * <var class="var">pkcs3_params</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcertificate_005fset_005fdh_005fparams">gnutls_certificate_set_dh_params</a> (gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_dh_params_t <var class="var">dh_params</var>)</code></dt>
</dl>
<hr>
</div>
</div>
<div class="subsection-level-extent" id="Deriving-keys-for-other-applications_002fprotocols">
<div class="nav-panel">
<p>
Next: <a href="#Channel-Bindings" accesskey="n" rel="next">Channel bindings</a>, Previous: <a href="#Parameter-generation" accesskey="p" rel="prev">Parameter generation</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Deriving-keys-for-other-applications_002fprotocols-1"><span>6.12.7 Deriving keys for other applications/protocols<a class="copiable-link" href="#Deriving-keys-for-other-applications_002fprotocols-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-keying-material-exporters"></a>
<a class="index-entry-id" id="index-exporting-keying-material"></a>
<a class="index-entry-id" id="index-deriving-keys"></a>
<a class="index-entry-id" id="index-key-extraction"></a>
<p>In several cases, after a TLS connection is established, it is desirable
to derive keys to be used in another application or protocol (e.g., in an
other TLS session using pre-shared keys). The following describe GnuTLS’
implementation of RFC5705 to extract keys based on a session’s master secret.
</p>
<p>The API to use is <a class="ref" href="#gnutls_005fprf_005frfc5705">gnutls_prf_rfc5705</a>. The
function needs to be provided with a label,
and additional context data to mix in the <code class="code">context</code> parameter.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprf_005frfc5705"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_prf_rfc5705</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">label_size</var>, const char * <var class="var">label</var>, size_t <var class="var">context_size</var>, const char * <var class="var">context</var>, size_t <var class="var">outsize</var>, char * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fprf_005frfc5705"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">label_size</var>: length of the <code class="code">label</code> variable.
</p>
<p><var class="var">label</var>: label used in PRF computation, typically a short string.
</p>
<p><var class="var">context_size</var>: length of the <code class="code">extra</code> variable.
</p>
<p><var class="var">context</var>: optional extra data to seed the PRF with.
</p>
<p><var class="var">outsize</var>: size of pre-allocated output buffer to hold the output.
</p>
<p><var class="var">out</var>: pre-allocated buffer to hold the generated data.
</p>
<p>Exports keying material from TLS/DTLS session to an application, as
specified in RFC5705.
</p>
<p>In the TLS versions prior to 1.3, it applies the TLS
Pseudo-Random-Function (PRF) on the master secret and the provided
data, seeded with the client and server random fields.
</p>
<p>In TLS 1.3, it applies HKDF on the exporter master secret derived
from the master secret.
</p>
<p>The <code class="code">label</code> variable usually contains a string denoting the purpose
for the generated data.
</p>
<p>The <code class="code">context</code> variable can be used to add more data to the seed, after
the random variables. It can be used to make sure the
generated output is strongly connected to some additional data
(e.g., a string used in user authentication).
</p>
<p>The output is placed in <code class="code">out</code> , which must be pre-allocated.
</p>
<p>Note that, to provide the RFC5705 context, the <code class="code">context</code> variable
must be non-null.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.4
</p></dd></dl>
<p>For example, after establishing a TLS session using
<a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a>, you can obtain 32-bytes to be used as key, using this call:
</p>
<div class="example">
<pre class="example-preformatted">#define MYLABEL "EXPORTER-My-protocol-name"
#define MYCONTEXT "my-protocol's-1st-session"
char out[32];
rc = gnutls_prf_rfc5705 (session, sizeof(MYLABEL)-1, MYLABEL,
sizeof(MYCONTEXT)-1, MYCONTEXT, 32, out);
</pre></div>
<p>The output key depends on TLS’ master secret, and is the same on both client
and server.
</p>
<p>For legacy applications which need to use a more flexible API, there is
<a class="ref" href="#gnutls_005fprf">gnutls_prf</a>, which in addition, allows to switch the mix of the
client and server random nonces, using the <code class="code">server_random_first</code> parameter.
For additional flexibility and low-level access to the TLS1.2 PRF,
there is a low-level TLS PRF interface called <a class="ref" href="#gnutls_005fprf_005fraw">gnutls_prf_raw</a>.
That however is not functional under newer protocol versions.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Channel-Bindings">
<div class="nav-panel">
<p>
Next: <a href="#Interoperability" accesskey="n" rel="next">Interoperability</a>, Previous: <a href="#Deriving-keys-for-other-applications_002fprotocols" accesskey="p" rel="prev">Deriving keys for other applications/protocols</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Channel-bindings"><span>6.12.8 Channel bindings<a class="copiable-link" href="#Channel-bindings"> ¶</a></span></h4>
<a class="index-entry-id" id="index-channel-bindings"></a>
<p>In user authentication protocols (e.g., EAP or SASL mechanisms) it is
useful to have a unique string that identifies the secure channel that
is used, to bind together the user authentication with the secure
channel. This can protect against man-in-the-middle attacks in some
situations. That unique string is called a “channel binding”. For
background and discussion see [<a class="ref" href="#RFC5056">RFC5056</a>].
</p>
<p>In <abbr class="acronym">GnuTLS</abbr> you can extract a channel binding using the
<a class="ref" href="#gnutls_005fsession_005fchannel_005fbinding">gnutls_session_channel_binding</a> function. Currently only the
following types are supported:
</p>
<ul class="itemize mark-bullet">
<li><code class="code">GNUTLS_CB_TLS_UNIQUE</code>: corresponds to the <code class="code">tls-unique</code> channel binding for TLS defined in [<a class="ref" href="#RFC5929">RFC5929</a>]
</li><li><code class="code">GNUTLS_CB_TLS_EXPORTER</code>: corresponds to the <code class="code">tls-exporter</code> channel binding for TLS defined in [<a class="ref" href="#RFC9266">RFC9266</a>]
</li></ul>
<p>The following example describes how to print the channel binding data.
Note that it must be run after a successful TLS handshake.
</p>
<div class="example">
<pre class="example-preformatted">{
gnutls_datum_t cb;
int rc;
rc = gnutls_session_channel_binding (session,
GNUTLS_CB_TLS_UNIQUE,
&cb);
if (rc)
fprintf (stderr, "Channel binding error: %s\n",
gnutls_strerror (rc));
else
{
size_t i;
printf ("- Channel binding 'tls-unique': ");
for (i = 0; i < cb.size; i++)
printf ("%02x", cb.data[i]);
printf ("\n");
}
}
</pre></div>
<hr>
</div>
<div class="subsection-level-extent" id="Interoperability">
<div class="nav-panel">
<p>
Next: <a href="#Compatibility-with-the-OpenSSL-library" accesskey="n" rel="next">Compatibility with the OpenSSL library</a>, Previous: <a href="#Channel-Bindings" accesskey="p" rel="prev">Channel bindings</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Interoperability-1"><span>6.12.9 Interoperability<a class="copiable-link" href="#Interoperability-1"> ¶</a></span></h4>
<p>The <abbr class="acronym">TLS</abbr> protocols support many ciphersuites, extensions and version
numbers. As a result, few implementations are
not able to properly interoperate once faced with extensions or version protocols
they do not support and understand. The <abbr class="acronym">TLS</abbr> protocol allows for a
graceful downgrade to the commonly supported options, but practice shows
it is not always implemented correctly.
</p>
<p>Because there is no way to achieve maximum interoperability with broken peers
without sacrificing security, <abbr class="acronym">GnuTLS</abbr> ignores such peers by default.
This might not be acceptable in cases where maximum compatibility
is required. Thus we allow enabling compatibility with broken peers using
priority strings (see <a class="ref" href="#Priority-Strings">Priority strings</a>). A conservative priority
string that would disable certain <abbr class="acronym">TLS</abbr> protocol
options that are known to cause compatibility problems, is shown below.
</p><pre class="verbatim">NORMAL:%COMPAT
</pre>
<p>For very old broken peers that do not tolerate TLS version numbers over TLS 1.0
another priority string is:
</p><pre class="verbatim">NORMAL:-VERS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:%COMPAT
</pre><p>This priority string will in addition to above, only enable SSL 3.0 and
TLS 1.0 as protocols.
</p>
<hr>
</div>
<div class="subsection-level-extent" id="Compatibility-with-the-OpenSSL-library">
<div class="nav-panel">
<p>
Previous: <a href="#Interoperability" accesskey="p" rel="prev">Interoperability</a>, Up: <a href="#Advanced-topics" accesskey="u" rel="up">Advanced topics</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Compatibility-with-the-OpenSSL-library-1"><span>6.12.10 Compatibility with the OpenSSL library<a class="copiable-link" href="#Compatibility-with-the-OpenSSL-library-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-OpenSSL"></a>
<p>To ease <abbr class="acronym">GnuTLS</abbr>’ integration with existing applications, a
compatibility layer with the OpenSSL library is included
in the <code class="code">gnutls-openssl</code> library. This compatibility layer is not
complete and it is not intended to completely re-implement the OpenSSL
API with <abbr class="acronym">GnuTLS</abbr>. It only provides limited source-level
compatibility.
</p>
<p>The prototypes for the compatibility functions are in the
<samp class="file">gnutls/openssl.h</samp> header file. The limitations
imposed by the compatibility layer include:
</p>
<ul class="itemize mark-bullet">
<li>Error handling is not thread safe.
</li></ul>
<hr>
</div>
</div>
</div>
<div class="chapter-level-extent" id="GnuTLS-application-examples">
<div class="nav-panel">
<p>
Next: <a href="#System_002dwide-configuration-of-the-library" accesskey="n" rel="next">System-wide configuration of the library</a>, Previous: <a href="#How-to-use-GnuTLS-in-applications" accesskey="p" rel="prev">How to use <abbr class="acronym">GnuTLS</abbr> in applications</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="GnuTLS-application-examples-1"><span>7 GnuTLS application examples<a class="copiable-link" href="#GnuTLS-application-examples-1"> ¶</a></span></h2>
<a class="anchor" id="examples"></a><a class="index-entry-id" id="index-example-programs"></a>
<a class="index-entry-id" id="index-examples"></a>
<p>In this chapter several examples of real-world use cases are listed.
The examples are simplified to promote readability and contain little or
no error checking.
</p>
<ul class="mini-toc">
<li><a href="#Client-examples" accesskey="1">Client examples</a></li>
<li><a href="#Server-examples" accesskey="2">Server examples</a></li>
<li><a href="#More-advanced-client-and-servers" accesskey="3">More advanced client and servers</a></li>
<li><a href="#OCSP-example" accesskey="4">OCSP example</a></li>
<li><a href="#Miscellaneous-examples" accesskey="5">Miscellaneous examples</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Client-examples">
<div class="nav-panel">
<p>
Next: <a href="#Server-examples" accesskey="n" rel="next">Server examples</a>, Up: <a href="#GnuTLS-application-examples" accesskey="u" rel="up">GnuTLS application examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Client-examples-1"><span>7.1 Client examples<a class="copiable-link" href="#Client-examples-1"> ¶</a></span></h3>
<p>This section contains examples of <abbr class="acronym">TLS</abbr> and <abbr class="acronym">SSL</abbr>
clients, using <abbr class="acronym">GnuTLS</abbr>. Note that some of the examples require functions
implemented by another example.
</p>
<ul class="mini-toc">
<li><a href="#Client-example-with-X_002e509-certificate-support" accesskey="1">Client example with <abbr class="acronym">X.509</abbr> certificate support</a></li>
<li><a href="#Datagram-TLS-client-example" accesskey="2">Datagram <abbr class="acronym">TLS</abbr> client example</a></li>
<li><a href="#Client-using-a-smart-card-with-TLS" accesskey="3">Using a smart card with TLS</a></li>
<li><a href="#Client-with-Resume-capability-example" accesskey="4">Client with resume capability example</a></li>
<li><a href="#Client-example-with-SSH_002dstyle-certificate-verification" accesskey="5">Client example with SSH-style certificate verification</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Client-example-with-X_002e509-certificate-support">
<div class="nav-panel">
<p>
Next: <a href="#Datagram-TLS-client-example" accesskey="n" rel="next">Datagram <abbr class="acronym">TLS</abbr> client example</a>, Up: <a href="#Client-examples" accesskey="u" rel="up">Client examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-example-with-X_002e509-certificate-support-1"><span>7.1.1 Client example with <abbr class="acronym">X.509</abbr> certificate support<a class="copiable-link" href="#Client-example-with-X_002e509-certificate-support-1"> ¶</a></span></h4>
<a class="anchor" id="ex_002dverify"></a>
<p>Let’s assume now that we want to create a TCP client which
communicates with servers that use <abbr class="acronym">X.509</abbr> certificate authentication.
The following client is a very simple <abbr class="acronym">TLS</abbr> client, which uses
the high level verification functions for certificates, but does not support session
resumption.
</p>
<p>Note that this client utilizes functionality present in the latest GnuTLS
version. For a reasonably portable version see <a class="ref" href="#Legacy-client-example-with-X_002e509-certificate-support">Legacy client example with <abbr class="acronym">X.509</abbr> certificate support</a>.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "examples.h"
/* A very basic TLS client, with X.509 authentication and server certificate
* verification. Note that error recovery is minimal for simplicity.
*/
#define CHECK(x) assert((x) >= 0)
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED); \
assert(rval >= 0)
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
extern int tcp_connect(void);
extern void tcp_close(int sd);
int main(void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1], *desc;
gnutls_datum_t out;
int type;
unsigned status;
gnutls_certificate_credentials_t xcred;
if (gnutls_check_version("3.4.6") == NULL) {
fprintf(stderr,
"GnuTLS 3.4.6 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
CHECK(gnutls_global_init());
/* X509 stuff */
CHECK(gnutls_certificate_allocate_credentials(&xcred));
/* sets the system trusted CAs for Internet PKI */
CHECK(gnutls_certificate_set_x509_system_trust(xcred));
/* If client holds a certificate it can be set using the following:
*
gnutls_certificate_set_x509_key_file (xcred, "cert.pem", "key.pem",
GNUTLS_X509_FMT_PEM);
*/
/* Initialize TLS session */
CHECK(gnutls_init(&session, GNUTLS_CLIENT));
CHECK(gnutls_server_name_set(session, GNUTLS_NAME_DNS,
"www.example.com",
strlen("www.example.com")));
/* It is recommended to use the default priorities */
CHECK(gnutls_set_default_priority(session));
/* put the x509 credentials to the current session
*/
CHECK(gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred));
gnutls_session_set_verify_cert(session, "www.example.com", 0);
/* connect to the peer
*/
sd = tcp_connect();
gnutls_transport_set_int(session, sd);
gnutls_handshake_set_timeout(session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
/* Perform the TLS handshake
*/
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
if (ret == GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR) {
/* check certificate verification status */
type = gnutls_certificate_type_get(session);
status = gnutls_session_get_verify_cert_status(session);
CHECK(gnutls_certificate_verification_status_print(
status, type, &out, 0));
printf("cert verify output: %s\n", out.data);
gnutls_free(out.data);
}
fprintf(stderr, "*** Handshake failed: %s\n",
gnutls_strerror(ret));
goto end;
} else {
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
/* send data */
LOOP_CHECK(ret, gnutls_record_send(session, MSG, strlen(MSG)));
LOOP_CHECK(ret, gnutls_record_recv(session, buffer, MAX_BUF));
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n", gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
goto end;
}
if (ret > 0) {
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
}
CHECK(gnutls_bye(session, GNUTLS_SHUT_RDWR));
end:
tcp_close(sd);
gnutls_deinit(session);
gnutls_certificate_free_credentials(xcred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Datagram-TLS-client-example">
<div class="nav-panel">
<p>
Next: <a href="#Client-using-a-smart-card-with-TLS" accesskey="n" rel="next">Using a smart card with TLS</a>, Previous: <a href="#Client-example-with-X_002e509-certificate-support" accesskey="p" rel="prev">Client example with <abbr class="acronym">X.509</abbr> certificate support</a>, Up: <a href="#Client-examples" accesskey="u" rel="up">Client examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Datagram-TLS-client-example-1"><span>7.1.2 Datagram <abbr class="acronym">TLS</abbr> client example<a class="copiable-link" href="#Datagram-TLS-client-example-1"> ¶</a></span></h4>
<p>This is a client that uses <abbr class="acronym">UDP</abbr> to connect to a
server. This is the <abbr class="acronym">DTLS</abbr> equivalent to the TLS example
with X.509 certificates.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <assert.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#include <gnutls/dtls.h>
/* A very basic Datagram TLS client, over UDP with X.509 authentication.
*/
#define CHECK(x) assert((x) >= 0)
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED); \
assert(rval >= 0)
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
extern int udp_connect(void);
extern void udp_close(int sd);
extern int verify_certificate_callback(gnutls_session_t session);
int main(void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_certificate_credentials_t xcred;
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
CHECK(gnutls_global_init());
/* X509 stuff */
CHECK(gnutls_certificate_allocate_credentials(&xcred));
/* sets the system trusted CAs for Internet PKI */
CHECK(gnutls_certificate_set_x509_system_trust(xcred));
/* Initialize TLS session */
CHECK(gnutls_init(&session, GNUTLS_CLIENT | GNUTLS_DATAGRAM));
/* Use default priorities */
CHECK(gnutls_set_default_priority(session));
/* put the x509 credentials to the current session */
CHECK(gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred));
CHECK(gnutls_server_name_set(session, GNUTLS_NAME_DNS,
"www.example.com",
strlen("www.example.com")));
gnutls_session_set_verify_cert(session, "www.example.com", 0);
/* connect to the peer */
sd = udp_connect();
gnutls_transport_set_int(session, sd);
/* set the connection MTU */
gnutls_dtls_set_mtu(session, 1000);
/* gnutls_dtls_set_timeouts(session, 1000, 60000); */
/* Perform the TLS handshake */
do {
ret = gnutls_handshake(session);
} while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN);
/* Note that DTLS may also receive GNUTLS_E_LARGE_PACKET */
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
char *desc;
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
LOOP_CHECK(ret, gnutls_record_send(session, MSG, strlen(MSG)));
LOOP_CHECK(ret, gnutls_record_recv(session, buffer, MAX_BUF));
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n", gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
goto end;
}
if (ret > 0) {
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
}
/* It is suggested not to use GNUTLS_SHUT_RDWR in DTLS
* connections because the peer's closure message might
* be lost */
CHECK(gnutls_bye(session, GNUTLS_SHUT_WR));
end:
udp_close(sd);
gnutls_deinit(session);
gnutls_certificate_free_credentials(xcred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Client-using-a-smart-card-with-TLS">
<div class="nav-panel">
<p>
Next: <a href="#Client-with-Resume-capability-example" accesskey="n" rel="next">Client with resume capability example</a>, Previous: <a href="#Datagram-TLS-client-example" accesskey="p" rel="prev">Datagram <abbr class="acronym">TLS</abbr> client example</a>, Up: <a href="#Client-examples" accesskey="u" rel="up">Client examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Using-a-smart-card-with-TLS"><span>7.1.3 Using a smart card with TLS<a class="copiable-link" href="#Using-a-smart-card-with-TLS"> ¶</a></span></h4>
<a class="anchor" id="ex_002dpkcs11_002dclient"></a><a class="index-entry-id" id="index-Smart-card-example"></a>
<p>This example will demonstrate how to load keys and certificates
from a smart-card or any other <abbr class="acronym">PKCS</abbr> #11 token, and
use it in a TLS connection. The difference between this and the
<a class="ref" href="#Client-example-with-X_002e509-certificate-support">Client example with <abbr class="acronym">X.509</abbr> certificate support</a> is that the
client keys are provided as PKCS #11 URIs instead of files.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <gnutls/pkcs11.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <getpass.h> /* for getpass() */
/* A TLS client that loads the certificate and key.
*/
#define CHECK(x) assert((x) >= 0)
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
/* The URLs of the objects can be obtained
* using p11tool --list-all --login
*/
#define KEY_URL \
"pkcs11:manufacturer=SomeManufacturer;object=Private%20Key" \
";objecttype=private;id=%db%5b%3e%b5%72%33"
#define CERT_URL \
"pkcs11:manufacturer=SomeManufacturer;object=Certificate;" \
"objecttype=cert;id=db%5b%3e%b5%72%33"
extern int tcp_connect(void);
extern void tcp_close(int sd);
static int pin_callback(void *user, int attempt, const char *token_url,
const char *token_label, unsigned int flags, char *pin,
size_t pin_max)
{
const char *password;
int len;
printf("PIN required for token '%s' with URL '%s'\n", token_label,
token_url);
if (flags & GNUTLS_PIN_FINAL_TRY)
printf("*** This is the final try before locking!\n");
if (flags & GNUTLS_PIN_COUNT_LOW)
printf("*** Only few tries left before locking!\n");
if (flags & GNUTLS_PIN_WRONG)
printf("*** Wrong PIN\n");
password = getpass("Enter pin: ");
/* FIXME: ensure that we are in UTF-8 locale */
if (password == NULL || password[0] == 0) {
fprintf(stderr, "No password given\n");
exit(1);
}
len = MIN(pin_max - 1, strlen(password));
memcpy(pin, password, len);
pin[len] = 0;
return 0;
}
int main(void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_certificate_credentials_t xcred;
/* Allow connections to servers that have OpenPGP keys as well.
*/
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
CHECK(gnutls_global_init());
/* The PKCS11 private key operations may require PIN.
* Register a callback. */
gnutls_pkcs11_set_pin_function(pin_callback, NULL);
/* X509 stuff */
CHECK(gnutls_certificate_allocate_credentials(&xcred));
/* sets the trusted cas file
*/
CHECK(gnutls_certificate_set_x509_trust_file(xcred, CAFILE,
GNUTLS_X509_FMT_PEM));
CHECK(gnutls_certificate_set_x509_key_file(xcred, CERT_URL, KEY_URL,
GNUTLS_X509_FMT_DER));
/* Note that there is no server certificate verification in this example
*/
/* Initialize TLS session
*/
CHECK(gnutls_init(&session, GNUTLS_CLIENT));
/* Use default priorities */
CHECK(gnutls_set_default_priority(session));
/* put the x509 credentials to the current session
*/
CHECK(gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred));
/* connect to the peer
*/
sd = tcp_connect();
gnutls_transport_set_int(session, sd);
/* Perform the TLS handshake
*/
ret = gnutls_handshake(session);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
char *desc;
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
CHECK(gnutls_record_send(session, MSG, strlen(MSG)));
ret = gnutls_record_recv(session, buffer, MAX_BUF);
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
goto end;
}
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
CHECK(gnutls_bye(session, GNUTLS_SHUT_RDWR));
end:
tcp_close(sd);
gnutls_deinit(session);
gnutls_certificate_free_credentials(xcred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Client-with-Resume-capability-example">
<div class="nav-panel">
<p>
Next: <a href="#Client-example-with-SSH_002dstyle-certificate-verification" accesskey="n" rel="next">Client example with SSH-style certificate verification</a>, Previous: <a href="#Client-using-a-smart-card-with-TLS" accesskey="p" rel="prev">Using a smart card with TLS</a>, Up: <a href="#Client-examples" accesskey="u" rel="up">Client examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-with-resume-capability-example"><span>7.1.4 Client with resume capability example<a class="copiable-link" href="#Client-with-resume-capability-example"> ¶</a></span></h4>
<a class="anchor" id="ex_002dresume_002dclient"></a>
<p>This is a modification of the simple client example. Here we
demonstrate the use of session resumption. The client tries to connect
once using <abbr class="acronym">TLS</abbr>, close the connection and then try to
establish a new connection using the previously negotiated data.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <gnutls/gnutls.h>
extern void check_alert(gnutls_session_t session, int ret);
extern int tcp_connect(void);
extern void tcp_close(int sd);
/* A very basic TLS client, with X.509 authentication and server certificate
* verification as well as session resumption.
*
* Note that error recovery is minimal for simplicity.
*/
#define CHECK(x) assert((x) >= 0)
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED); \
assert(rval >= 0)
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
int main(void)
{
int ret;
int sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_certificate_credentials_t xcred;
/* variables used in session resuming
*/
int t;
gnutls_datum_t sdata;
/* for backwards compatibility with gnutls < 3.3.0 */
CHECK(gnutls_global_init());
CHECK(gnutls_certificate_allocate_credentials(&xcred));
CHECK(gnutls_certificate_set_x509_system_trust(xcred));
for (t = 0; t < 2; t++) { /* connect 2 times to the server */
sd = tcp_connect();
CHECK(gnutls_init(&session, GNUTLS_CLIENT));
CHECK(gnutls_server_name_set(session, GNUTLS_NAME_DNS,
"www.example.com",
strlen("www.example.com")));
gnutls_session_set_verify_cert(session, "www.example.com", 0);
CHECK(gnutls_set_default_priority(session));
gnutls_transport_set_int(session, sd);
gnutls_handshake_set_timeout(session,
GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
if (t > 0) {
/* if this is not the first time we connect */
CHECK(gnutls_session_set_data(session, sdata.data,
sdata.size));
gnutls_free(sdata.data);
}
/* Perform the TLS handshake
*/
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
printf("- Handshake was completed\n");
}
if (t == 0) { /* the first time we connect */
/* get the session data */
CHECK(gnutls_session_get_data2(session, &sdata));
} else { /* the second time we connect */
/* check if we actually resumed the previous session */
if (gnutls_session_is_resumed(session) != 0) {
printf("- Previous session was resumed\n");
} else {
fprintf(stderr,
"*** Previous session was NOT resumed\n");
}
}
LOOP_CHECK(ret, gnutls_record_send(session, MSG, strlen(MSG)));
LOOP_CHECK(ret, gnutls_record_recv(session, buffer, MAX_BUF));
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n",
gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n",
gnutls_strerror(ret));
goto end;
}
if (ret > 0) {
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
}
gnutls_bye(session, GNUTLS_SHUT_RDWR);
end:
tcp_close(sd);
gnutls_deinit(session);
} /* for() */
gnutls_certificate_free_credentials(xcred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Client-example-with-SSH_002dstyle-certificate-verification">
<div class="nav-panel">
<p>
Previous: <a href="#Client-with-Resume-capability-example" accesskey="p" rel="prev">Client with resume capability example</a>, Up: <a href="#Client-examples" accesskey="u" rel="up">Client examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-example-with-SSH_002dstyle-certificate-verification-1"><span>7.1.5 Client example with SSH-style certificate verification<a class="copiable-link" href="#Client-example-with-SSH_002dstyle-certificate-verification-1"> ¶</a></span></h4>
<p>This is an alternative verification function that will use the
X.509 certificate authorities for verification, but also assume an
trust on first use (SSH-like) authentication system. That is the user is
prompted on unknown public keys and known public keys are considered
trusted.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <assert.h>
#include "examples.h"
#define CHECK(x) assert((x) >= 0)
/* This function will verify the peer's certificate, check
* if the hostname matches. In addition it will perform an
* SSH-style authentication, where ultimately trusted keys
* are only the keys that have been seen before.
*/
int _ssh_verify_certificate_callback(gnutls_session_t session)
{
unsigned int status;
const gnutls_datum_t *cert_list;
unsigned int cert_list_size;
int ret, type;
gnutls_datum_t out;
const char *hostname;
/* read hostname */
hostname = gnutls_session_get_ptr(session);
/* This verification function uses the trusted CAs in the credentials
* structure. So you must have installed one or more CA certificates.
*/
CHECK(gnutls_certificate_verify_peers3(session, hostname, &status));
type = gnutls_certificate_type_get(session);
CHECK(gnutls_certificate_verification_status_print(status, type, &out,
0));
printf("%s", out.data);
gnutls_free(out.data);
if (status != 0) /* Certificate is not trusted */
return GNUTLS_E_CERTIFICATE_ERROR;
/* Do SSH verification */
cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
if (cert_list == NULL) {
printf("No certificate was found!\n");
return GNUTLS_E_CERTIFICATE_ERROR;
}
/* service may be obtained alternatively using getservbyport() */
ret = gnutls_verify_stored_pubkey(NULL, NULL, hostname, "https", type,
&cert_list[0], 0);
if (ret == GNUTLS_E_NO_CERTIFICATE_FOUND) {
printf("Host %s is not known.", hostname);
if (status == 0)
printf("Its certificate is valid for %s.\n", hostname);
/* the certificate must be printed and user must be asked on
* whether it is trustworthy. --see gnutls_x509_crt_print() */
/* if not trusted */
return GNUTLS_E_CERTIFICATE_ERROR;
} else if (ret == GNUTLS_E_CERTIFICATE_KEY_MISMATCH) {
printf("Warning: host %s is known but has another key associated.",
hostname);
printf("It might be that the server has multiple keys, or you are under attack\n");
if (status == 0)
printf("Its certificate is valid for %s.\n", hostname);
/* the certificate must be printed and user must be asked on
* whether it is trustworthy. --see gnutls_x509_crt_print() */
/* if not trusted */
return GNUTLS_E_CERTIFICATE_ERROR;
} else if (ret < 0) {
printf("gnutls_verify_stored_pubkey: %s\n",
gnutls_strerror(ret));
return ret;
}
/* user trusts the key -> store it */
if (ret != 0) {
CHECK(gnutls_store_pubkey(NULL, NULL, hostname, "https", type,
&cert_list[0], 0, 0));
}
/* notify gnutls to continue handshake normally */
return 0;
}
</pre>
<hr>
</div>
</div>
<div class="section-level-extent" id="Server-examples">
<div class="nav-panel">
<p>
Next: <a href="#More-advanced-client-and-servers" accesskey="n" rel="next">More advanced client and servers</a>, Previous: <a href="#Client-examples" accesskey="p" rel="prev">Client examples</a>, Up: <a href="#GnuTLS-application-examples" accesskey="u" rel="up">GnuTLS application examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Server-examples-1"><span>7.2 Server examples<a class="copiable-link" href="#Server-examples-1"> ¶</a></span></h3>
<p>This section contains examples of <abbr class="acronym">TLS</abbr> and <abbr class="acronym">SSL</abbr>
servers, using <abbr class="acronym">GnuTLS</abbr>.
</p>
<ul class="mini-toc">
<li><a href="#Echo-server-with-X_002e509-authentication" accesskey="1">Echo server with <abbr class="acronym">X.509</abbr> authentication</a></li>
<li><a href="#DTLS-echo-server-with-X_002e509-authentication" accesskey="2">DTLS echo server with <abbr class="acronym">X.509</abbr> authentication</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Echo-server-with-X_002e509-authentication">
<div class="nav-panel">
<p>
Next: <a href="#DTLS-echo-server-with-X_002e509-authentication" accesskey="n" rel="next">DTLS echo server with <abbr class="acronym">X.509</abbr> authentication</a>, Up: <a href="#Server-examples" accesskey="u" rel="up">Server examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Echo-server-with-X_002e509-authentication-1"><span>7.2.1 Echo server with <abbr class="acronym">X.509</abbr> authentication<a class="copiable-link" href="#Echo-server-with-X_002e509-authentication-1"> ¶</a></span></h4>
<p>This example is a very simple echo server which supports
<abbr class="acronym">X.509</abbr> authentication.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#include <assert.h>
#define KEYFILE "key.pem"
#define CERTFILE "cert.pem"
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
#define CRLFILE "crl.pem"
#define CHECK(x) assert((x) >= 0)
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED)
/* The OCSP status file contains up to date information about revocation
* of the server's certificate. That can be periodically be updated
* using:
* $ ocsptool --ask --load-cert your_cert.pem --load-issuer your_issuer.pem
* --load-signer your_issuer.pem --outfile ocsp-status.der
*/
#define OCSP_STATUS_FILE "ocsp-status.der"
/* This is a sample TLS 1.0 echo server, using X.509 authentication and
* OCSP stapling support.
*/
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
int main(void)
{
int listen_sd;
int sd, ret;
gnutls_certificate_credentials_t x509_cred;
gnutls_priority_t priority_cache;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
char buffer[MAX_BUF + 1];
int optval = 1;
/* for backwards compatibility with gnutls < 3.3.0 */
CHECK(gnutls_global_init());
CHECK(gnutls_certificate_allocate_credentials(&x509_cred));
CHECK(gnutls_certificate_set_x509_trust_file(x509_cred, CAFILE,
GNUTLS_X509_FMT_PEM));
CHECK(gnutls_certificate_set_x509_crl_file(x509_cred, CRLFILE,
GNUTLS_X509_FMT_PEM));
/* The following code sets the certificate key pair as well as,
* an OCSP response which corresponds to it. It is possible
* to set multiple key-pairs and multiple OCSP status responses
* (the latter since 3.5.6). See the manual pages of the individual
* functions for more information.
*/
CHECK(gnutls_certificate_set_x509_key_file(x509_cred, CERTFILE, KEYFILE,
GNUTLS_X509_FMT_PEM));
CHECK(gnutls_certificate_set_ocsp_status_request_file(
x509_cred, OCSP_STATUS_FILE, 0));
CHECK(gnutls_priority_init(&priority_cache, NULL, NULL));
/* Instead of the default options as shown above one could specify
* additional options such as server precedence in ciphersuite selection
* as follows:
* gnutls_priority_init2(&priority_cache,
* "%SERVER_PRECEDENCE",
* NULL, GNUTLS_PRIORITY_INIT_DEF_APPEND);
*/
#if GNUTLS_VERSION_NUMBER >= 0x030506
/* only available since GnuTLS 3.5.6, on previous versions see
* gnutls_certificate_set_dh_params(). */
gnutls_certificate_set_known_dh_params(x509_cred,
GNUTLS_SEC_PARAM_MEDIUM);
#endif
/* Socket operations
*/
listen_sd = socket(AF_INET, SOCK_STREAM, 0);
memset(&sa_serv, '\0', sizeof(sa_serv));
sa_serv.sin_family = AF_INET;
sa_serv.sin_addr.s_addr = INADDR_ANY;
sa_serv.sin_port = htons(PORT); /* Server Port number */
setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int));
bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
listen(listen_sd, 1024);
printf("Server ready. Listening to port '%d'.\n\n", PORT);
client_len = sizeof(sa_cli);
for (;;) {
CHECK(gnutls_init(&session, GNUTLS_SERVER));
CHECK(gnutls_priority_set(session, priority_cache));
CHECK(gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,
x509_cred));
/* We don't request any certificate from the client.
* If we did we would need to verify it. One way of
* doing that is shown in the "Verifying a certificate"
* example.
*/
gnutls_certificate_server_set_request(session,
GNUTLS_CERT_IGNORE);
gnutls_handshake_set_timeout(session,
GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
sd = accept(listen_sd, (struct sockaddr *)&sa_cli, &client_len);
printf("- connection from %s, port %d\n",
inet_ntop(AF_INET, &sa_cli.sin_addr, topbuf,
sizeof(topbuf)),
ntohs(sa_cli.sin_port));
gnutls_transport_set_int(session, sd);
LOOP_CHECK(ret, gnutls_handshake(session));
if (ret < 0) {
close(sd);
gnutls_deinit(session);
fprintf(stderr, "*** Handshake has failed (%s)\n\n",
gnutls_strerror(ret));
continue;
}
printf("- Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
for (;;) {
LOOP_CHECK(ret, gnutls_record_recv(session, buffer,
MAX_BUF));
if (ret == 0) {
printf("\n- Peer has closed the GnuTLS connection\n");
break;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n",
gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr,
"\n*** Received corrupted "
"data(%d). Closing the connection.\n\n",
ret);
break;
} else if (ret > 0) {
/* echo data back to the client
*/
CHECK(gnutls_record_send(session, buffer, ret));
}
}
printf("\n");
/* do not wait for the peer to close the connection.
*/
LOOP_CHECK(ret, gnutls_bye(session, GNUTLS_SHUT_WR));
close(sd);
gnutls_deinit(session);
}
close(listen_sd);
gnutls_certificate_free_credentials(x509_cred);
gnutls_priority_deinit(priority_cache);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="DTLS-echo-server-with-X_002e509-authentication">
<div class="nav-panel">
<p>
Previous: <a href="#Echo-server-with-X_002e509-authentication" accesskey="p" rel="prev">Echo server with <abbr class="acronym">X.509</abbr> authentication</a>, Up: <a href="#Server-examples" accesskey="u" rel="up">Server examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="DTLS-echo-server-with-X_002e509-authentication-1"><span>7.2.2 DTLS echo server with <abbr class="acronym">X.509</abbr> authentication<a class="copiable-link" href="#DTLS-echo-server-with-X_002e509-authentication-1"> ¶</a></span></h4>
<p>This example is a very simple echo server using Datagram TLS and
<abbr class="acronym">X.509</abbr> authentication.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/select.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#include <gnutls/dtls.h>
#define KEYFILE "key.pem"
#define CERTFILE "cert.pem"
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
#define CRLFILE "crl.pem"
/* This is a sample DTLS echo server, using X.509 authentication.
* Note that error checking is minimal to simplify the example.
*/
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED)
#define MAX_BUFFER 1024
#define PORT 5557
typedef struct {
gnutls_session_t session;
int fd;
struct sockaddr *cli_addr;
socklen_t cli_addr_size;
} priv_data_st;
static int pull_timeout_func(gnutls_transport_ptr_t ptr, unsigned int ms);
static ssize_t push_func(gnutls_transport_ptr_t p, const void *data,
size_t size);
static ssize_t pull_func(gnutls_transport_ptr_t p, void *data, size_t size);
static const char *human_addr(const struct sockaddr *sa, socklen_t salen,
char *buf, size_t buflen);
static int wait_for_connection(int fd);
/* Use global credentials and parameters to simplify
* the example. */
static gnutls_certificate_credentials_t x509_cred;
static gnutls_priority_t priority_cache;
int main(void)
{
int listen_sd;
int sock, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in cli_addr;
socklen_t cli_addr_size;
gnutls_session_t session;
char buffer[MAX_BUFFER];
priv_data_st priv;
gnutls_datum_t cookie_key;
gnutls_dtls_prestate_st prestate;
int mtu = 1400;
unsigned char sequence[8];
/* this must be called once in the program
*/
gnutls_global_init();
gnutls_certificate_allocate_credentials(&x509_cred);
gnutls_certificate_set_x509_trust_file(x509_cred, CAFILE,
GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_crl_file(x509_cred, CRLFILE,
GNUTLS_X509_FMT_PEM);
ret = gnutls_certificate_set_x509_key_file(x509_cred, CERTFILE, KEYFILE,
GNUTLS_X509_FMT_PEM);
if (ret < 0) {
printf("No certificate or key were found\n");
exit(1);
}
gnutls_certificate_set_known_dh_params(x509_cred,
GNUTLS_SEC_PARAM_MEDIUM);
/* pre-3.6.3 equivalent:
* gnutls_priority_init(&priority_cache,
* "NORMAL:-VERS-TLS-ALL:+VERS-DTLS1.0:%SERVER_PRECEDENCE",
* NULL);
*/
gnutls_priority_init2(&priority_cache, "%SERVER_PRECEDENCE", NULL,
GNUTLS_PRIORITY_INIT_DEF_APPEND);
gnutls_key_generate(&cookie_key, GNUTLS_COOKIE_KEY_SIZE);
/* Socket operations
*/
listen_sd = socket(AF_INET, SOCK_DGRAM, 0);
memset(&sa_serv, '\0', sizeof(sa_serv));
sa_serv.sin_family = AF_INET;
sa_serv.sin_addr.s_addr = INADDR_ANY;
sa_serv.sin_port = htons(PORT);
{ /* DTLS requires the IP don't fragment (DF) bit to be set */
#if defined(IP_DONTFRAG)
int optval = 1;
setsockopt(listen_sd, IPPROTO_IP, IP_DONTFRAG,
(const void *)&optval, sizeof(optval));
#elif defined(IP_MTU_DISCOVER)
int optval = IP_PMTUDISC_DO;
setsockopt(listen_sd, IPPROTO_IP, IP_MTU_DISCOVER,
(const void *)&optval, sizeof(optval));
#endif
}
bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
printf("UDP server ready. Listening to port '%d'.\n\n", PORT);
for (;;) {
printf("Waiting for connection...\n");
sock = wait_for_connection(listen_sd);
if (sock < 0)
continue;
cli_addr_size = sizeof(cli_addr);
ret = recvfrom(sock, buffer, sizeof(buffer), MSG_PEEK,
(struct sockaddr *)&cli_addr, &cli_addr_size);
if (ret > 0) {
memset(&prestate, 0, sizeof(prestate));
ret = gnutls_dtls_cookie_verify(&cookie_key, &cli_addr,
sizeof(cli_addr),
buffer, ret, &prestate);
if (ret < 0) { /* cookie not valid */
priv_data_st s;
memset(&s, 0, sizeof(s));
s.fd = sock;
s.cli_addr = (void *)&cli_addr;
s.cli_addr_size = sizeof(cli_addr);
printf("Sending hello verify request to %s\n",
human_addr((struct sockaddr *)&cli_addr,
sizeof(cli_addr), buffer,
sizeof(buffer)));
gnutls_dtls_cookie_send(
&cookie_key, &cli_addr,
sizeof(cli_addr), &prestate,
(gnutls_transport_ptr_t)&s, push_func);
/* discard peeked data */
recvfrom(sock, buffer, sizeof(buffer), 0,
(struct sockaddr *)&cli_addr,
&cli_addr_size);
usleep(100);
continue;
}
printf("Accepted connection from %s\n",
human_addr((struct sockaddr *)&cli_addr,
sizeof(cli_addr), buffer,
sizeof(buffer)));
} else
continue;
gnutls_init(&session, GNUTLS_SERVER | GNUTLS_DATAGRAM);
gnutls_priority_set(session, priority_cache);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,
x509_cred);
gnutls_dtls_prestate_set(session, &prestate);
gnutls_dtls_set_mtu(session, mtu);
priv.session = session;
priv.fd = sock;
priv.cli_addr = (struct sockaddr *)&cli_addr;
priv.cli_addr_size = sizeof(cli_addr);
gnutls_transport_set_ptr(session, &priv);
gnutls_transport_set_push_function(session, push_func);
gnutls_transport_set_pull_function(session, pull_func);
gnutls_transport_set_pull_timeout_function(session,
pull_timeout_func);
LOOP_CHECK(ret, gnutls_handshake(session));
/* Note that DTLS may also receive GNUTLS_E_LARGE_PACKET.
* In that case the MTU should be adjusted.
*/
if (ret < 0) {
fprintf(stderr, "Error in handshake(): %s\n",
gnutls_strerror(ret));
gnutls_deinit(session);
continue;
}
printf("- Handshake was completed\n");
for (;;) {
LOOP_CHECK(ret, gnutls_record_recv_seq(session, buffer,
MAX_BUFFER,
sequence));
if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n",
gnutls_strerror(ret));
continue;
} else if (ret < 0) {
fprintf(stderr, "Error in recv(): %s\n",
gnutls_strerror(ret));
break;
}
if (ret == 0) {
printf("EOF\n\n");
break;
}
buffer[ret] = 0;
printf("received[%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x]: %s\n",
sequence[0], sequence[1], sequence[2],
sequence[3], sequence[4], sequence[5],
sequence[6], sequence[7], buffer);
/* reply back */
LOOP_CHECK(ret,
gnutls_record_send(session, buffer, ret));
if (ret < 0) {
fprintf(stderr, "Error in send(): %s\n",
gnutls_strerror(ret));
break;
}
}
LOOP_CHECK(ret, gnutls_bye(session, GNUTLS_SHUT_WR));
gnutls_deinit(session);
}
close(listen_sd);
gnutls_certificate_free_credentials(x509_cred);
gnutls_priority_deinit(priority_cache);
gnutls_global_deinit();
return 0;
}
static int wait_for_connection(int fd)
{
fd_set rd, wr;
int n;
FD_ZERO(&rd);
FD_ZERO(&wr);
FD_SET(fd, &rd);
/* waiting part */
n = select(fd + 1, &rd, &wr, NULL, NULL);
if (n == -1 && errno == EINTR)
return -1;
if (n < 0) {
perror("select()");
exit(1);
}
return fd;
}
/* Wait for data to be received within a timeout period in milliseconds
*/
static int pull_timeout_func(gnutls_transport_ptr_t ptr, unsigned int ms)
{
fd_set rfds;
struct timeval tv;
priv_data_st *priv = ptr;
struct sockaddr_in cli_addr;
socklen_t cli_addr_size;
int ret;
char c;
FD_ZERO(&rfds);
FD_SET(priv->fd, &rfds);
tv.tv_sec = ms / 1000;
tv.tv_usec = (ms % 1000) * 1000;
ret = select(priv->fd + 1, &rfds, NULL, NULL, &tv);
if (ret <= 0)
return ret;
/* only report ok if the next message is from the peer we expect
* from
*/
cli_addr_size = sizeof(cli_addr);
ret = recvfrom(priv->fd, &c, 1, MSG_PEEK, (struct sockaddr *)&cli_addr,
&cli_addr_size);
if (ret > 0) {
if (cli_addr_size == priv->cli_addr_size &&
memcmp(&cli_addr, priv->cli_addr, sizeof(cli_addr)) == 0)
return 1;
}
return 0;
}
static ssize_t push_func(gnutls_transport_ptr_t p, const void *data,
size_t size)
{
priv_data_st *priv = p;
return sendto(priv->fd, data, size, 0, priv->cli_addr,
priv->cli_addr_size);
}
static ssize_t pull_func(gnutls_transport_ptr_t p, void *data, size_t size)
{
priv_data_st *priv = p;
struct sockaddr_in cli_addr;
socklen_t cli_addr_size;
char buffer[64];
int ret;
cli_addr_size = sizeof(cli_addr);
ret = recvfrom(priv->fd, data, size, 0, (struct sockaddr *)&cli_addr,
&cli_addr_size);
if (ret == -1)
return ret;
if (cli_addr_size == priv->cli_addr_size &&
memcmp(&cli_addr, priv->cli_addr, sizeof(cli_addr)) == 0)
return ret;
printf("Denied connection from %s\n",
human_addr((struct sockaddr *)&cli_addr, sizeof(cli_addr),
buffer, sizeof(buffer)));
gnutls_transport_set_errno(priv->session, EAGAIN);
return -1;
}
static const char *human_addr(const struct sockaddr *sa, socklen_t salen,
char *buf, size_t buflen)
{
const char *save_buf = buf;
size_t l;
if (!buf || !buflen)
return NULL;
*buf = '\0';
switch (sa->sa_family) {
#if HAVE_IPV6
case AF_INET6:
snprintf(buf, buflen, "IPv6 ");
break;
#endif
case AF_INET:
snprintf(buf, buflen, "IPv4 ");
break;
}
l = strlen(buf);
buf += l;
buflen -= l;
if (getnameinfo(sa, salen, buf, buflen, NULL, 0, NI_NUMERICHOST) != 0)
return NULL;
l = strlen(buf);
buf += l;
buflen -= l;
strncat(buf, " port ", buflen);
l = strlen(buf);
buf += l;
buflen -= l;
if (getnameinfo(sa, salen, NULL, 0, buf, buflen, NI_NUMERICSERV) != 0)
return NULL;
return save_buf;
}
</pre>
<hr>
</div>
</div>
<div class="section-level-extent" id="More-advanced-client-and-servers">
<div class="nav-panel">
<p>
Next: <a href="#OCSP-example" accesskey="n" rel="next">OCSP example</a>, Previous: <a href="#Server-examples" accesskey="p" rel="prev">Server examples</a>, Up: <a href="#GnuTLS-application-examples" accesskey="u" rel="up">GnuTLS application examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="More-advanced-client-and-servers-1"><span>7.3 More advanced client and servers<a class="copiable-link" href="#More-advanced-client-and-servers-1"> ¶</a></span></h3>
<p>This section has various, more advanced topics in client and servers.
</p>
<ul class="mini-toc">
<li><a href="#Client-example-with-anonymous-authentication" accesskey="1">Client example with anonymous authentication</a></li>
<li><a href="#Using-a-callback-to-select-the-certificate-to-use" accesskey="2">Using a callback to select the certificate to use</a></li>
<li><a href="#Obtaining-session-information" accesskey="3">Obtaining session information</a></li>
<li><a href="#Advanced-certificate-verification-example" accesskey="4">Advanced certificate verification</a></li>
<li><a href="#Client-example-with-PSK-authentication" accesskey="5">Client example with <abbr class="acronym">PSK</abbr> authentication</a></li>
<li><a href="#Client-example-with-SRP-authentication" accesskey="6">Client example with <abbr class="acronym">SRP</abbr> authentication</a></li>
<li><a href="#Legacy-client-example-with-X_002e509-certificate-support" accesskey="7">Legacy client example with <abbr class="acronym">X.509</abbr> certificate support</a></li>
<li><a href="#Client-example-in-C_002b_002b" accesskey="8">Client example using the C++ API</a></li>
<li><a href="#Echo-server-with-PSK-authentication" accesskey="9">Echo server with <abbr class="acronym">PSK</abbr> authentication</a></li>
<li><a href="#Echo-server-with-SRP-authentication">Echo server with <abbr class="acronym">SRP</abbr> authentication</a></li>
<li><a href="#Echo-server-with-anonymous-authentication">Echo server with anonymous authentication</a></li>
<li><a href="#Helper-functions-for-TCP-connections">Helper functions for TCP connections</a></li>
<li><a href="#Helper-functions-for-UDP-connections">Helper functions for UDP connections</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Client-example-with-anonymous-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Using-a-callback-to-select-the-certificate-to-use" accesskey="n" rel="next">Using a callback to select the certificate to use</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-example-with-anonymous-authentication-1"><span>7.3.1 Client example with anonymous authentication<a class="copiable-link" href="#Client-example-with-anonymous-authentication-1"> ¶</a></span></h4>
<p>The simplest client using TLS is the one that doesn’t do any
authentication. This means no external certificates or passwords are
needed to set up the connection. As could be expected, the connection
is vulnerable to man-in-the-middle (active or redirection) attacks.
However, the data are integrity protected and encrypted from
passive eavesdroppers.
</p>
<p>Note that due to the vulnerable nature of this method very few public
servers support it.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <assert.h>
#include <gnutls/gnutls.h>
/* A very basic TLS client, with anonymous authentication.
*/
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED); \
assert(rval >= 0)
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
extern int tcp_connect(void);
extern void tcp_close(int sd);
int main(void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_anon_client_credentials_t anoncred;
/* Need to enable anonymous KX specifically. */
gnutls_global_init();
gnutls_anon_allocate_client_credentials(&anoncred);
/* Initialize TLS session
*/
gnutls_init(&session, GNUTLS_CLIENT);
/* Use default priorities */
gnutls_priority_set_direct(session, "PERFORMANCE:+ANON-ECDH:+ANON-DH",
NULL);
/* put the anonymous credentials to the current session
*/
gnutls_credentials_set(session, GNUTLS_CRD_ANON, anoncred);
/* connect to the peer
*/
sd = tcp_connect();
gnutls_transport_set_int(session, sd);
gnutls_handshake_set_timeout(session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
/* Perform the TLS handshake
*/
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
char *desc;
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
LOOP_CHECK(ret, gnutls_record_send(session, MSG, strlen(MSG)));
LOOP_CHECK(ret, gnutls_record_recv(session, buffer, MAX_BUF));
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n", gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
goto end;
}
if (ret > 0) {
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
}
LOOP_CHECK(ret, gnutls_bye(session, GNUTLS_SHUT_RDWR));
end:
tcp_close(sd);
gnutls_deinit(session);
gnutls_anon_free_client_credentials(anoncred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Using-a-callback-to-select-the-certificate-to-use">
<div class="nav-panel">
<p>
Next: <a href="#Obtaining-session-information" accesskey="n" rel="next">Obtaining session information</a>, Previous: <a href="#Client-example-with-anonymous-authentication" accesskey="p" rel="prev">Client example with anonymous authentication</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Using-a-callback-to-select-the-certificate-to-use-1"><span>7.3.2 Using a callback to select the certificate to use<a class="copiable-link" href="#Using-a-callback-to-select-the-certificate-to-use-1"> ¶</a></span></h4>
<p>There are cases where a client holds several certificate and key
pairs, and may not want to load all of them in the credentials
structure. The following example demonstrates the use of the
certificate selection callback.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <assert.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include <gnutls/abstract.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
/* A TLS client that loads the certificate and key.
*/
#define CHECK(x) assert((x) >= 0)
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
#define CERT_FILE "cert.pem"
#define KEY_FILE "key.pem"
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
extern int tcp_connect(void);
extern void tcp_close(int sd);
static int cert_callback(gnutls_session_t session,
const gnutls_datum_t *req_ca_rdn, int nreqs,
const gnutls_pk_algorithm_t *sign_algos,
int sign_algos_length, gnutls_pcert_st **pcert,
unsigned int *pcert_length, gnutls_privkey_t *pkey);
gnutls_pcert_st pcrt;
gnutls_privkey_t key;
/* Load the certificate and the private key.
*/
static void load_keys(void)
{
gnutls_datum_t data;
CHECK(gnutls_load_file(CERT_FILE, &data));
CHECK(gnutls_pcert_import_x509_raw(&pcrt, &data, GNUTLS_X509_FMT_PEM,
0));
gnutls_free(data.data);
CHECK(gnutls_load_file(KEY_FILE, &data));
CHECK(gnutls_privkey_init(&key));
CHECK(gnutls_privkey_import_x509_raw(key, &data, GNUTLS_X509_FMT_PEM,
NULL, 0));
gnutls_free(data.data);
}
int main(void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_certificate_credentials_t xcred;
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
CHECK(gnutls_global_init());
load_keys();
/* X509 stuff */
CHECK(gnutls_certificate_allocate_credentials(&xcred));
/* sets the trusted cas file
*/
CHECK(gnutls_certificate_set_x509_trust_file(xcred, CAFILE,
GNUTLS_X509_FMT_PEM));
gnutls_certificate_set_retrieve_function2(xcred, cert_callback);
/* Initialize TLS session
*/
CHECK(gnutls_init(&session, GNUTLS_CLIENT));
/* Use default priorities */
CHECK(gnutls_set_default_priority(session));
/* put the x509 credentials to the current session
*/
CHECK(gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred));
/* connect to the peer
*/
sd = tcp_connect();
gnutls_transport_set_int(session, sd);
/* Perform the TLS handshake
*/
ret = gnutls_handshake(session);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
char *desc;
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
CHECK(gnutls_record_send(session, MSG, strlen(MSG)));
ret = gnutls_record_recv(session, buffer, MAX_BUF);
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
goto end;
}
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
CHECK(gnutls_bye(session, GNUTLS_SHUT_RDWR));
end:
tcp_close(sd);
gnutls_deinit(session);
gnutls_certificate_free_credentials(xcred);
gnutls_global_deinit();
return 0;
}
/* This callback should be associated with a session by calling
* gnutls_certificate_client_set_retrieve_function( session, cert_callback),
* before a handshake.
*/
static int cert_callback(gnutls_session_t session,
const gnutls_datum_t *req_ca_rdn, int nreqs,
const gnutls_pk_algorithm_t *sign_algos,
int sign_algos_length, gnutls_pcert_st **pcert,
unsigned int *pcert_length, gnutls_privkey_t *pkey)
{
char issuer_dn[256];
int i, ret;
size_t len;
gnutls_certificate_type_t type;
/* Print the server's trusted CAs
*/
if (nreqs > 0)
printf("- Server's trusted authorities:\n");
else
printf("- Server did not send us any trusted authorities names.\n");
/* print the names (if any) */
for (i = 0; i < nreqs; i++) {
len = sizeof(issuer_dn);
ret = gnutls_x509_rdn_get(&req_ca_rdn[i], issuer_dn, &len);
if (ret >= 0) {
printf(" [%d]: ", i);
printf("%s\n", issuer_dn);
}
}
/* Select a certificate and return it.
* The certificate must be of any of the "sign algorithms"
* supported by the server.
*/
type = gnutls_certificate_type_get(session);
if (type == GNUTLS_CRT_X509) {
*pcert_length = 1;
*pcert = &pcrt;
*pkey = key;
} else {
return -1;
}
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Obtaining-session-information">
<div class="nav-panel">
<p>
Next: <a href="#Advanced-certificate-verification-example" accesskey="n" rel="next">Advanced certificate verification</a>, Previous: <a href="#Using-a-callback-to-select-the-certificate-to-use" accesskey="p" rel="prev">Using a callback to select the certificate to use</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Obtaining-session-information-1"><span>7.3.3 Obtaining session information<a class="copiable-link" href="#Obtaining-session-information-1"> ¶</a></span></h4>
<p>Most of the times it is desirable to know the security properties of
the current established session. This includes the underlying ciphers
and the protocols involved. That is the purpose of the following
function. Note that this function will print meaningful values only
if called after a successful <a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a>.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "examples.h"
/* This function will print some details of the
* given session.
*/
int print_info(gnutls_session_t session)
{
gnutls_credentials_type_t cred;
gnutls_kx_algorithm_t kx;
int dhe, ecdh, group;
char *desc;
/* get a description of the session connection, protocol,
* cipher/key exchange */
desc = gnutls_session_get_desc(session);
if (desc != NULL) {
printf("- Session: %s\n", desc);
}
dhe = ecdh = 0;
kx = gnutls_kx_get(session);
/* Check the authentication type used and switch
* to the appropriate.
*/
cred = gnutls_auth_get_type(session);
switch (cred) {
#ifdef ENABLE_SRP
case GNUTLS_CRD_SRP:
printf("- SRP session with username %s\n",
gnutls_srp_server_get_username(session));
break;
#endif
case GNUTLS_CRD_PSK:
/* This returns NULL in server side.
*/
if (gnutls_psk_client_get_hint(session) != NULL)
printf("- PSK authentication. PSK hint '%s'\n",
gnutls_psk_client_get_hint(session));
/* This returns NULL in client side.
*/
if (gnutls_psk_server_get_username(session) != NULL)
printf("- PSK authentication. Connected as '%s'\n",
gnutls_psk_server_get_username(session));
if (kx == GNUTLS_KX_ECDHE_PSK)
ecdh = 1;
else if (kx == GNUTLS_KX_DHE_PSK)
dhe = 1;
break;
case GNUTLS_CRD_ANON: /* anonymous authentication */
printf("- Anonymous authentication.\n");
if (kx == GNUTLS_KX_ANON_ECDH)
ecdh = 1;
else if (kx == GNUTLS_KX_ANON_DH)
dhe = 1;
break;
case GNUTLS_CRD_CERTIFICATE: /* certificate authentication */
/* Check if we have been using ephemeral Diffie-Hellman.
*/
if (kx == GNUTLS_KX_DHE_RSA || kx == GNUTLS_KX_DHE_DSS)
dhe = 1;
else if (kx == GNUTLS_KX_ECDHE_RSA ||
kx == GNUTLS_KX_ECDHE_ECDSA)
ecdh = 1;
/* if the certificate list is available, then
* print some information about it.
*/
print_x509_certificate_info(session);
break;
default:
break;
} /* switch */
/* read the negotiated group - if any */
group = gnutls_group_get(session);
if (group != 0) {
printf("- Negotiated group %s\n", gnutls_group_get_name(group));
} else {
if (ecdh != 0)
printf("- Ephemeral ECDH using curve %s\n",
gnutls_ecc_curve_get_name(
gnutls_ecc_curve_get(session)));
else if (dhe != 0)
printf("- Ephemeral DH using prime of %d bits\n",
gnutls_dh_get_prime_bits(session));
}
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Advanced-certificate-verification-example">
<div class="nav-panel">
<p>
Next: <a href="#Client-example-with-PSK-authentication" accesskey="n" rel="next">Client example with <abbr class="acronym">PSK</abbr> authentication</a>, Previous: <a href="#Obtaining-session-information" accesskey="p" rel="prev">Obtaining session information</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Advanced-certificate-verification-2"><span>7.3.4 Advanced certificate verification<a class="copiable-link" href="#Advanced-certificate-verification-2"> ¶</a></span></h4>
<a class="anchor" id="ex_002dverify2"></a>
<p>An example is listed below which uses the high level verification
functions to verify a given certificate chain against a set of CAs
and CRLs.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "examples.h"
#define CHECK(x) assert((x) >= 0)
/* All the available CRLs
*/
gnutls_x509_crl_t *crl_list;
int crl_list_size;
/* All the available trusted CAs
*/
gnutls_x509_crt_t *ca_list;
int ca_list_size;
static int print_details_func(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer,
gnutls_x509_crl_t crl,
unsigned int verification_output);
/* This function will try to verify the peer's certificate chain, and
* also check if the hostname matches.
*/
void verify_certificate_chain(const char *hostname,
const gnutls_datum_t *cert_chain,
int cert_chain_length)
{
int i;
gnutls_x509_trust_list_t tlist;
gnutls_x509_crt_t *cert;
gnutls_datum_t txt;
unsigned int output;
/* Initialize the trusted certificate list. This should be done
* once on initialization. gnutls_x509_crt_list_import2() and
* gnutls_x509_crl_list_import2() can be used to load them.
*/
CHECK(gnutls_x509_trust_list_init(&tlist, 0));
CHECK(gnutls_x509_trust_list_add_cas(tlist, ca_list, ca_list_size, 0));
CHECK(gnutls_x509_trust_list_add_crls(tlist, crl_list, crl_list_size,
GNUTLS_TL_VERIFY_CRL, 0));
cert = gnutls_calloc(cert_chain_length, sizeof(*cert));
assert(cert != NULL);
/* Import all the certificates in the chain to
* native certificate format.
*/
for (i = 0; i < cert_chain_length; i++) {
CHECK(gnutls_x509_crt_init(&cert[i]));
CHECK(gnutls_x509_crt_import(cert[i], &cert_chain[i],
GNUTLS_X509_FMT_DER));
}
CHECK(gnutls_x509_trust_list_verify_named_crt(
tlist, cert[0], hostname, strlen(hostname),
GNUTLS_VERIFY_DISABLE_CRL_CHECKS, &output, print_details_func));
/* if this certificate is not explicitly trusted verify against CAs
*/
if (output != 0) {
CHECK(gnutls_x509_trust_list_verify_crt(
tlist, cert, cert_chain_length, 0, &output,
print_details_func));
}
if (output & GNUTLS_CERT_INVALID) {
fprintf(stderr, "Not trusted\n");
CHECK(gnutls_certificate_verification_status_print(
output, GNUTLS_CRT_X509, &txt, 0));
fprintf(stderr, "Error: %s\n", txt.data);
gnutls_free(txt.data);
} else
fprintf(stderr, "Trusted\n");
/* Check if the name in the first certificate matches our destination!
*/
if (!gnutls_x509_crt_check_hostname(cert[0], hostname)) {
printf("The certificate's owner does not match hostname '%s'\n",
hostname);
}
for (i = 0; i < cert_chain_length; i++) {
gnutls_x509_crt_deinit(cert[i]);
}
gnutls_free(cert);
gnutls_x509_trust_list_deinit(tlist, 1);
return;
}
static int print_details_func(gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer,
gnutls_x509_crl_t crl,
unsigned int verification_output)
{
char name[512];
char issuer_name[512];
size_t name_size;
size_t issuer_name_size;
issuer_name_size = sizeof(issuer_name);
gnutls_x509_crt_get_issuer_dn(cert, issuer_name, &issuer_name_size);
name_size = sizeof(name);
gnutls_x509_crt_get_dn(cert, name, &name_size);
fprintf(stdout, "\tSubject: %s\n", name);
fprintf(stdout, "\tIssuer: %s\n", issuer_name);
if (issuer != NULL) {
issuer_name_size = sizeof(issuer_name);
gnutls_x509_crt_get_dn(issuer, issuer_name, &issuer_name_size);
fprintf(stdout, "\tVerified against: %s\n", issuer_name);
}
if (crl != NULL) {
issuer_name_size = sizeof(issuer_name);
gnutls_x509_crl_get_issuer_dn(crl, issuer_name,
&issuer_name_size);
fprintf(stdout, "\tVerified against CRL of: %s\n", issuer_name);
}
fprintf(stdout, "\tVerification output: %x\n\n", verification_output);
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Client-example-with-PSK-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Client-example-with-SRP-authentication" accesskey="n" rel="next">Client example with <abbr class="acronym">SRP</abbr> authentication</a>, Previous: <a href="#Advanced-certificate-verification-example" accesskey="p" rel="prev">Advanced certificate verification</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-example-with-PSK-authentication-1"><span>7.3.5 Client example with <abbr class="acronym">PSK</abbr> authentication<a class="copiable-link" href="#Client-example-with-PSK-authentication-1"> ¶</a></span></h4>
<p>The following client is a very simple <abbr class="acronym">PSK</abbr> <abbr class="acronym">TLS</abbr>
client which connects to a server and authenticates using a
<em class="emph">username</em> and a <em class="emph">key</em>.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <assert.h>
#include <gnutls/gnutls.h>
/* A very basic TLS client, with PSK authentication.
*/
#define CHECK(x) assert((x) >= 0)
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED); \
assert(rval >= 0)
#define MAX_BUF 1024
#define MSG "GET / HTTP/1.0\r\n\r\n"
extern int tcp_connect(void);
extern void tcp_close(int sd);
int main(void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
const char *err;
gnutls_psk_client_credentials_t pskcred;
const gnutls_datum_t key = { (void *)"DEADBEEF", 8 };
if (gnutls_check_version("3.6.3") == NULL) {
fprintf(stderr,
"GnuTLS 3.6.3 or later is required for this example\n");
exit(1);
}
CHECK(gnutls_global_init());
CHECK(gnutls_psk_allocate_client_credentials(&pskcred));
CHECK(gnutls_psk_set_client_credentials(pskcred, "test", &key,
GNUTLS_PSK_KEY_HEX));
/* Initialize TLS session
*/
CHECK(gnutls_init(&session, GNUTLS_CLIENT));
ret = gnutls_set_default_priority_append(
session, "-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK", &err, 0);
/* Alternative for pre-3.6.3 versions:
* gnutls_priority_set_direct(session, "NORMAL:+ECDHE-PSK:+DHE-PSK:+PSK", &err)
*/
if (ret < 0) {
if (ret == GNUTLS_E_INVALID_REQUEST) {
fprintf(stderr, "Syntax error at: %s\n", err);
}
exit(1);
}
/* put the x509 credentials to the current session
*/
CHECK(gnutls_credentials_set(session, GNUTLS_CRD_PSK, pskcred));
/* connect to the peer
*/
sd = tcp_connect();
gnutls_transport_set_int(session, sd);
gnutls_handshake_set_timeout(session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
/* Perform the TLS handshake
*/
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
char *desc;
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
LOOP_CHECK(ret, gnutls_record_send(session, MSG, strlen(MSG)));
LOOP_CHECK(ret, gnutls_record_recv(session, buffer, MAX_BUF));
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n", gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
goto end;
}
if (ret > 0) {
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
}
CHECK(gnutls_bye(session, GNUTLS_SHUT_RDWR));
end:
tcp_close(sd);
gnutls_deinit(session);
gnutls_psk_free_client_credentials(pskcred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Client-example-with-SRP-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Legacy-client-example-with-X_002e509-certificate-support" accesskey="n" rel="next">Legacy client example with <abbr class="acronym">X.509</abbr> certificate support</a>, Previous: <a href="#Client-example-with-PSK-authentication" accesskey="p" rel="prev">Client example with <abbr class="acronym">PSK</abbr> authentication</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-example-with-SRP-authentication-1"><span>7.3.6 Client example with <abbr class="acronym">SRP</abbr> authentication<a class="copiable-link" href="#Client-example-with-SRP-authentication-1"> ¶</a></span></h4>
<p>The following client is a very simple <abbr class="acronym">SRP</abbr> <abbr class="acronym">TLS</abbr>
client which connects to a server and authenticates using a
<em class="emph">username</em> and a <em class="emph">password</em>. The server may authenticate
itself using a certificate, and in that case it has to be verified.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
/* Those functions are defined in other examples.
*/
extern void check_alert(gnutls_session_t session, int ret);
extern int tcp_connect(void);
extern void tcp_close(int sd);
#define MAX_BUF 1024
#define USERNAME "user"
#define PASSWORD "pass"
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
#define MSG "GET / HTTP/1.0\r\n\r\n"
int main(void)
{
int ret;
int sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_srp_client_credentials_t srp_cred;
gnutls_certificate_credentials_t cert_cred;
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
gnutls_global_init();
gnutls_srp_allocate_client_credentials(&srp_cred);
gnutls_certificate_allocate_credentials(&cert_cred);
gnutls_certificate_set_x509_trust_file(cert_cred, CAFILE,
GNUTLS_X509_FMT_PEM);
gnutls_srp_set_client_credentials(srp_cred, USERNAME, PASSWORD);
/* connects to server
*/
sd = tcp_connect();
/* Initialize TLS session
*/
gnutls_init(&session, GNUTLS_CLIENT);
/* Set the priorities.
*/
gnutls_priority_set_direct(session, "NORMAL:+SRP:+SRP-RSA:+SRP-DSS",
NULL);
/* put the SRP credentials to the current session
*/
gnutls_credentials_set(session, GNUTLS_CRD_SRP, srp_cred);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cert_cred);
gnutls_transport_set_int(session, sd);
gnutls_handshake_set_timeout(session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
/* Perform the TLS handshake
*/
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
char *desc;
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
gnutls_record_send(session, MSG, strlen(MSG));
ret = gnutls_record_recv(session, buffer, MAX_BUF);
if (gnutls_error_is_fatal(ret) != 0 || ret == 0) {
if (ret == 0) {
printf("- Peer has closed the GnuTLS connection\n");
goto end;
} else {
fprintf(stderr, "*** Error: %s\n",
gnutls_strerror(ret));
goto end;
}
} else
check_alert(session, ret);
if (ret > 0) {
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
}
gnutls_bye(session, GNUTLS_SHUT_RDWR);
end:
tcp_close(sd);
gnutls_deinit(session);
gnutls_srp_free_client_credentials(srp_cred);
gnutls_certificate_free_credentials(cert_cred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Legacy-client-example-with-X_002e509-certificate-support">
<div class="nav-panel">
<p>
Next: <a href="#Client-example-in-C_002b_002b" accesskey="n" rel="next">Client example using the C++ API</a>, Previous: <a href="#Client-example-with-SRP-authentication" accesskey="p" rel="prev">Client example with <abbr class="acronym">SRP</abbr> authentication</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Legacy-client-example-with-X_002e509-certificate-support-1"><span>7.3.7 Legacy client example with <abbr class="acronym">X.509</abbr> certificate support<a class="copiable-link" href="#Legacy-client-example-with-X_002e509-certificate-support-1"> ¶</a></span></h4>
<a class="anchor" id="ex_002dverify_002dlegacy"></a>
<p>For applications that need to maintain compatibility with the GnuTLS 3.1.x
library, this client example is identical to <a class="ref" href="#Client-example-with-X_002e509-certificate-support">Client example with <abbr class="acronym">X.509</abbr> certificate support</a>
but utilizes APIs that were available in GnuTLS 3.1.4.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "examples.h"
/* A very basic TLS client, with X.509 authentication and server certificate
* verification utilizing the GnuTLS 3.1.x API.
* Note that error recovery is minimal for simplicity.
*/
#define CHECK(x) assert((x) >= 0)
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED); \
assert(rval >= 0)
#define MAX_BUF 1024
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
#define MSG "GET / HTTP/1.0\r\n\r\n"
extern int tcp_connect(void);
extern void tcp_close(int sd);
static int _verify_certificate_callback(gnutls_session_t session);
int main(void)
{
int ret, sd, ii;
gnutls_session_t session;
char buffer[MAX_BUF + 1];
gnutls_certificate_credentials_t xcred;
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
CHECK(gnutls_global_init());
/* X509 stuff */
CHECK(gnutls_certificate_allocate_credentials(&xcred));
/* sets the trusted cas file
*/
CHECK(gnutls_certificate_set_x509_trust_file(xcred, CAFILE,
GNUTLS_X509_FMT_PEM));
gnutls_certificate_set_verify_function(xcred,
_verify_certificate_callback);
/* If client holds a certificate it can be set using the following:
*
gnutls_certificate_set_x509_key_file (xcred,
"cert.pem", "key.pem",
GNUTLS_X509_FMT_PEM);
*/
/* Initialize TLS session
*/
CHECK(gnutls_init(&session, GNUTLS_CLIENT));
gnutls_session_set_ptr(session, (void *)"www.example.com");
gnutls_server_name_set(session, GNUTLS_NAME_DNS, "www.example.com",
strlen("www.example.com"));
/* use default priorities */
CHECK(gnutls_set_default_priority(session));
#if 0
/* if more fine-graned control is required */
ret = gnutls_priority_set_direct(session, "NORMAL", &err);
if (ret < 0) {
if (ret == GNUTLS_E_INVALID_REQUEST) {
fprintf(stderr, "Syntax error at: %s\n", err);
}
exit(1);
}
#endif
/* put the x509 credentials to the current session
*/
CHECK(gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred));
/* connect to the peer
*/
sd = tcp_connect();
gnutls_transport_set_int(session, sd);
gnutls_handshake_set_timeout(session, GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
/* Perform the TLS handshake
*/
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
fprintf(stderr, "*** Handshake failed\n");
gnutls_perror(ret);
goto end;
} else {
char *desc;
desc = gnutls_session_get_desc(session);
printf("- Session info: %s\n", desc);
gnutls_free(desc);
}
LOOP_CHECK(ret, gnutls_record_send(session, MSG, strlen(MSG)));
LOOP_CHECK(ret, gnutls_record_recv(session, buffer, MAX_BUF));
if (ret == 0) {
printf("- Peer has closed the TLS connection\n");
goto end;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n", gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret));
goto end;
}
if (ret > 0) {
printf("- Received %d bytes: ", ret);
for (ii = 0; ii < ret; ii++) {
fputc(buffer[ii], stdout);
}
fputs("\n", stdout);
}
CHECK(gnutls_bye(session, GNUTLS_SHUT_RDWR));
end:
tcp_close(sd);
gnutls_deinit(session);
gnutls_certificate_free_credentials(xcred);
gnutls_global_deinit();
return 0;
}
/* This function will verify the peer's certificate, and check
* if the hostname matches, as well as the activation, expiration dates.
*/
static int _verify_certificate_callback(gnutls_session_t session)
{
unsigned int status;
int type;
const char *hostname;
gnutls_datum_t out;
/* read hostname */
hostname = gnutls_session_get_ptr(session);
/* This verification function uses the trusted CAs in the credentials
* structure. So you must have installed one or more CA certificates.
*/
CHECK(gnutls_certificate_verify_peers3(session, hostname, &status));
type = gnutls_certificate_type_get(session);
CHECK(gnutls_certificate_verification_status_print(status, type, &out,
0));
printf("%s", out.data);
gnutls_free(out.data);
if (status != 0) /* Certificate is not trusted */
return GNUTLS_E_CERTIFICATE_ERROR;
/* notify gnutls to continue handshake normally */
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Client-example-in-C_002b_002b">
<div class="nav-panel">
<p>
Next: <a href="#Echo-server-with-PSK-authentication" accesskey="n" rel="next">Echo server with <abbr class="acronym">PSK</abbr> authentication</a>, Previous: <a href="#Legacy-client-example-with-X_002e509-certificate-support" accesskey="p" rel="prev">Legacy client example with <abbr class="acronym">X.509</abbr> certificate support</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Client-example-using-the-C_002b_002b-API"><span>7.3.8 Client example using the C++ API<a class="copiable-link" href="#Client-example-using-the-C_002b_002b-API"> ¶</a></span></h4>
<p>The following client is a simple example of a client client utilizing
the GnuTLS C++ API.
</p>
<pre class="verbatim">#include <config.h>
#include <iostream>
#include <stdexcept>
#include <gnutls/gnutls.h>
#include <gnutls/gnutlsxx.h>
#include <cstring> /* for strlen */
/* A very basic TLS client, with anonymous authentication.
* written by Eduardo Villanueva Che.
*/
#define MAX_BUF 1024
#define SA struct sockaddr
#define CAFILE "ca.pem"
#define MSG "GET / HTTP/1.0\r\n\r\n"
extern "C"
{
int tcp_connect(void);
void tcp_close(int sd);
}
int main(void)
{
int sd = -1;
gnutls_global_init();
try
{
/* Allow connections to servers that have OpenPGP keys as well.
*/
gnutls::client_session session;
/* X509 stuff */
gnutls::certificate_credentials credentials;
/* sets the trusted cas file
*/
credentials.set_x509_trust_file(CAFILE, GNUTLS_X509_FMT_PEM);
/* put the x509 credentials to the current session
*/
session.set_credentials(credentials);
/* Use default priorities */
session.set_priority ("NORMAL", NULL);
/* connect to the peer
*/
sd = tcp_connect();
session.set_transport_ptr((gnutls_transport_ptr_t) (ptrdiff_t)sd);
/* Perform the TLS handshake
*/
int ret = session.handshake();
if (ret < 0)
{
throw std::runtime_error("Handshake failed");
}
else
{
std::cout << "- Handshake was completed" << std::endl;
}
session.send(MSG, strlen(MSG));
char buffer[MAX_BUF + 1];
ret = session.recv(buffer, MAX_BUF);
if (ret == 0)
{
throw std::runtime_error("Peer has closed the TLS connection");
}
else if (ret < 0)
{
throw std::runtime_error(gnutls_strerror(ret));
}
std::cout << "- Received " << ret << " bytes:" << std::endl;
std::cout.write(buffer, ret);
std::cout << std::endl;
session.bye(GNUTLS_SHUT_RDWR);
}
catch (std::exception &ex)
{
std::cerr << "Exception caught: " << ex.what() << std::endl;
}
if (sd != -1)
tcp_close(sd);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Echo-server-with-PSK-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Echo-server-with-SRP-authentication" accesskey="n" rel="next">Echo server with <abbr class="acronym">SRP</abbr> authentication</a>, Previous: <a href="#Client-example-in-C_002b_002b" accesskey="p" rel="prev">Client example using the C++ API</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Echo-server-with-PSK-authentication-1"><span>7.3.9 Echo server with <abbr class="acronym">PSK</abbr> authentication<a class="copiable-link" href="#Echo-server-with-PSK-authentication-1"> ¶</a></span></h4>
<p>This is a server which supports <abbr class="acronym">PSK</abbr> authentication.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#define KEYFILE "key.pem"
#define CERTFILE "cert.pem"
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
#define CRLFILE "crl.pem"
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED)
/* This is a sample TLS echo server, supporting X.509 and PSK
authentication.
*/
#define SOCKET_ERR(err, s) \
if (err == -1) { \
perror(s); \
return (1); \
}
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
static int pskfunc(gnutls_session_t session, const char *username,
gnutls_datum_t *key)
{
printf("psk: username %s\n", username);
key->data = gnutls_malloc(4);
key->data[0] = 0xDE;
key->data[1] = 0xAD;
key->data[2] = 0xBE;
key->data[3] = 0xEF;
key->size = 4;
return 0;
}
int main(void)
{
int err, listen_sd;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
gnutls_certificate_credentials_t x509_cred;
gnutls_psk_server_credentials_t psk_cred;
gnutls_priority_t priority_cache;
char buffer[MAX_BUF + 1];
int optval = 1;
int kx;
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
gnutls_global_init();
gnutls_certificate_allocate_credentials(&x509_cred);
gnutls_certificate_set_x509_trust_file(x509_cred, CAFILE,
GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_crl_file(x509_cred, CRLFILE,
GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_key_file(x509_cred, CERTFILE, KEYFILE,
GNUTLS_X509_FMT_PEM);
gnutls_psk_allocate_server_credentials(&psk_cred);
gnutls_psk_set_server_credentials_function(psk_cred, pskfunc);
/* pre-3.6.3 equivalent:
* gnutls_priority_init(&priority_cache,
* "NORMAL:+PSK:+ECDHE-PSK:+DHE-PSK",
* NULL);
*/
gnutls_priority_init2(&priority_cache, "+ECDHE-PSK:+DHE-PSK:+PSK", NULL,
GNUTLS_PRIORITY_INIT_DEF_APPEND);
gnutls_certificate_set_known_dh_params(x509_cred,
GNUTLS_SEC_PARAM_MEDIUM);
/* Socket operations
*/
listen_sd = socket(AF_INET, SOCK_STREAM, 0);
SOCKET_ERR(listen_sd, "socket");
memset(&sa_serv, '\0', sizeof(sa_serv));
sa_serv.sin_family = AF_INET;
sa_serv.sin_addr.s_addr = INADDR_ANY;
sa_serv.sin_port = htons(PORT); /* Server Port number */
setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int));
err = bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
SOCKET_ERR(err, "bind");
err = listen(listen_sd, 1024);
SOCKET_ERR(err, "listen");
printf("Server ready. Listening to port '%d'.\n\n", PORT);
client_len = sizeof(sa_cli);
for (;;) {
gnutls_init(&session, GNUTLS_SERVER);
gnutls_priority_set(session, priority_cache);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,
x509_cred);
gnutls_credentials_set(session, GNUTLS_CRD_PSK, psk_cred);
/* request client certificate if any.
*/
gnutls_certificate_server_set_request(session,
GNUTLS_CERT_REQUEST);
sd = accept(listen_sd, (struct sockaddr *)&sa_cli, &client_len);
printf("- connection from %s, port %d\n",
inet_ntop(AF_INET, &sa_cli.sin_addr, topbuf,
sizeof(topbuf)),
ntohs(sa_cli.sin_port));
gnutls_transport_set_int(session, sd);
LOOP_CHECK(ret, gnutls_handshake(session));
if (ret < 0) {
close(sd);
gnutls_deinit(session);
fprintf(stderr, "*** Handshake has failed (%s)\n\n",
gnutls_strerror(ret));
continue;
}
printf("- Handshake was completed\n");
kx = gnutls_kx_get(session);
if (kx == GNUTLS_KX_PSK || kx == GNUTLS_KX_DHE_PSK ||
kx == GNUTLS_KX_ECDHE_PSK) {
printf("- User %s was connected\n",
gnutls_psk_server_get_username(session));
}
/* see the Getting peer's information example */
/* print_info(session); */
for (;;) {
LOOP_CHECK(ret, gnutls_record_recv(session, buffer,
MAX_BUF));
if (ret == 0) {
printf("\n- Peer has closed the GnuTLS connection\n");
break;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n",
gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr,
"\n*** Received corrupted "
"data(%d). Closing the connection.\n\n",
ret);
break;
} else if (ret > 0) {
/* echo data back to the client
*/
gnutls_record_send(session, buffer, ret);
}
}
printf("\n");
/* do not wait for the peer to close the connection.
*/
LOOP_CHECK(ret, gnutls_bye(session, GNUTLS_SHUT_WR));
close(sd);
gnutls_deinit(session);
}
close(listen_sd);
gnutls_certificate_free_credentials(x509_cred);
gnutls_psk_free_server_credentials(psk_cred);
gnutls_priority_deinit(priority_cache);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Echo-server-with-SRP-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Echo-server-with-anonymous-authentication" accesskey="n" rel="next">Echo server with anonymous authentication</a>, Previous: <a href="#Echo-server-with-PSK-authentication" accesskey="p" rel="prev">Echo server with <abbr class="acronym">PSK</abbr> authentication</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Echo-server-with-SRP-authentication-1"><span>7.3.10 Echo server with <abbr class="acronym">SRP</abbr> authentication<a class="copiable-link" href="#Echo-server-with-SRP-authentication-1"> ¶</a></span></h4>
<p>This is a server which supports <abbr class="acronym">SRP</abbr> authentication. It is
also possible to combine this functionality with a certificate
server. Here it is separate for simplicity.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#define SRP_PASSWD "tpasswd"
#define SRP_PASSWD_CONF "tpasswd.conf"
#define KEYFILE "key.pem"
#define CERTFILE "cert.pem"
#define CAFILE "/etc/ssl/certs/ca-certificates.crt"
#define LOOP_CHECK(rval, cmd) \
do { \
rval = cmd; \
} while (rval == GNUTLS_E_AGAIN || rval == GNUTLS_E_INTERRUPTED)
/* This is a sample TLS-SRP echo server.
*/
#define SOCKET_ERR(err, s) \
if (err == -1) { \
perror(s); \
return (1); \
}
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
int main(void)
{
int err, listen_sd;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
gnutls_srp_server_credentials_t srp_cred;
gnutls_certificate_credentials_t cert_cred;
char buffer[MAX_BUF + 1];
int optval = 1;
char name[256];
strcpy(name, "Echo Server");
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
gnutls_global_init();
/* SRP_PASSWD a password file (created with the included srptool utility)
*/
gnutls_srp_allocate_server_credentials(&srp_cred);
gnutls_srp_set_server_credentials_file(srp_cred, SRP_PASSWD,
SRP_PASSWD_CONF);
gnutls_certificate_allocate_credentials(&cert_cred);
gnutls_certificate_set_x509_trust_file(cert_cred, CAFILE,
GNUTLS_X509_FMT_PEM);
gnutls_certificate_set_x509_key_file(cert_cred, CERTFILE, KEYFILE,
GNUTLS_X509_FMT_PEM);
/* TCP socket operations
*/
listen_sd = socket(AF_INET, SOCK_STREAM, 0);
SOCKET_ERR(listen_sd, "socket");
memset(&sa_serv, '\0', sizeof(sa_serv));
sa_serv.sin_family = AF_INET;
sa_serv.sin_addr.s_addr = INADDR_ANY;
sa_serv.sin_port = htons(PORT); /* Server Port number */
setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int));
err = bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
SOCKET_ERR(err, "bind");
err = listen(listen_sd, 1024);
SOCKET_ERR(err, "listen");
printf("%s ready. Listening to port '%d'.\n\n", name, PORT);
client_len = sizeof(sa_cli);
for (;;) {
gnutls_init(&session, GNUTLS_SERVER);
gnutls_priority_set_direct(session,
"NORMAL"
":-KX-ALL:+SRP:+SRP-DSS:+SRP-RSA",
NULL);
gnutls_credentials_set(session, GNUTLS_CRD_SRP, srp_cred);
/* for the certificate authenticated ciphersuites.
*/
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,
cert_cred);
/* We don't request any certificate from the client.
* If we did we would need to verify it. One way of
* doing that is shown in the "Verifying a certificate"
* example.
*/
gnutls_certificate_server_set_request(session,
GNUTLS_CERT_IGNORE);
sd = accept(listen_sd, (struct sockaddr *)&sa_cli, &client_len);
printf("- connection from %s, port %d\n",
inet_ntop(AF_INET, &sa_cli.sin_addr, topbuf,
sizeof(topbuf)),
ntohs(sa_cli.sin_port));
gnutls_transport_set_int(session, sd);
LOOP_CHECK(ret, gnutls_handshake(session));
if (ret < 0) {
close(sd);
gnutls_deinit(session);
fprintf(stderr, "*** Handshake has failed (%s)\n\n",
gnutls_strerror(ret));
continue;
}
printf("- Handshake was completed\n");
printf("- User %s was connected\n",
gnutls_srp_server_get_username(session));
/* print_info(session); */
for (;;) {
LOOP_CHECK(ret, gnutls_record_recv(session, buffer,
MAX_BUF));
if (ret == 0) {
printf("\n- Peer has closed the GnuTLS connection\n");
break;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n",
gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr,
"\n*** Received corrupted "
"data(%d). Closing the connection.\n\n",
ret);
break;
} else if (ret > 0) {
/* echo data back to the client
*/
gnutls_record_send(session, buffer, ret);
}
}
printf("\n");
/* do not wait for the peer to close the connection. */
LOOP_CHECK(ret, gnutls_bye(session, GNUTLS_SHUT_WR));
close(sd);
gnutls_deinit(session);
}
close(listen_sd);
gnutls_srp_free_server_credentials(srp_cred);
gnutls_certificate_free_credentials(cert_cred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Echo-server-with-anonymous-authentication">
<div class="nav-panel">
<p>
Next: <a href="#Helper-functions-for-TCP-connections" accesskey="n" rel="next">Helper functions for TCP connections</a>, Previous: <a href="#Echo-server-with-SRP-authentication" accesskey="p" rel="prev">Echo server with <abbr class="acronym">SRP</abbr> authentication</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Echo-server-with-anonymous-authentication-1"><span>7.3.11 Echo server with anonymous authentication<a class="copiable-link" href="#Echo-server-with-anonymous-authentication-1"> ¶</a></span></h4>
<p>This example server supports anonymous authentication, and could be
used to serve the example client for anonymous authentication.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
/* This is a sample TLS 1.0 echo server, for anonymous authentication only.
*/
#define SOCKET_ERR(err, s) \
if (err == -1) { \
perror(s); \
return (1); \
}
#define MAX_BUF 1024
#define PORT 5556 /* listen to 5556 port */
int main(void)
{
int err, listen_sd;
int sd, ret;
struct sockaddr_in sa_serv;
struct sockaddr_in sa_cli;
socklen_t client_len;
char topbuf[512];
gnutls_session_t session;
gnutls_anon_server_credentials_t anoncred;
char buffer[MAX_BUF + 1];
int optval = 1;
if (gnutls_check_version("3.1.4") == NULL) {
fprintf(stderr,
"GnuTLS 3.1.4 or later is required for this example\n");
exit(1);
}
/* for backwards compatibility with gnutls < 3.3.0 */
gnutls_global_init();
gnutls_anon_allocate_server_credentials(&anoncred);
gnutls_anon_set_server_known_dh_params(anoncred,
GNUTLS_SEC_PARAM_MEDIUM);
/* Socket operations
*/
listen_sd = socket(AF_INET, SOCK_STREAM, 0);
SOCKET_ERR(listen_sd, "socket");
memset(&sa_serv, '\0', sizeof(sa_serv));
sa_serv.sin_family = AF_INET;
sa_serv.sin_addr.s_addr = INADDR_ANY;
sa_serv.sin_port = htons(PORT); /* Server Port number */
setsockopt(listen_sd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int));
err = bind(listen_sd, (struct sockaddr *)&sa_serv, sizeof(sa_serv));
SOCKET_ERR(err, "bind");
err = listen(listen_sd, 1024);
SOCKET_ERR(err, "listen");
printf("Server ready. Listening to port '%d'.\n\n", PORT);
client_len = sizeof(sa_cli);
for (;;) {
gnutls_init(&session, GNUTLS_SERVER);
gnutls_priority_set_direct(session,
"NORMAL:+ANON-ECDH:+ANON-DH", NULL);
gnutls_credentials_set(session, GNUTLS_CRD_ANON, anoncred);
sd = accept(listen_sd, (struct sockaddr *)&sa_cli, &client_len);
printf("- connection from %s, port %d\n",
inet_ntop(AF_INET, &sa_cli.sin_addr, topbuf,
sizeof(topbuf)),
ntohs(sa_cli.sin_port));
gnutls_transport_set_int(session, sd);
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);
if (ret < 0) {
close(sd);
gnutls_deinit(session);
fprintf(stderr, "*** Handshake has failed (%s)\n\n",
gnutls_strerror(ret));
continue;
}
printf("- Handshake was completed\n");
/* see the Getting peer's information example */
/* print_info(session); */
for (;;) {
ret = gnutls_record_recv(session, buffer, MAX_BUF);
if (ret == 0) {
printf("\n- Peer has closed the GnuTLS connection\n");
break;
} else if (ret < 0 && gnutls_error_is_fatal(ret) == 0) {
fprintf(stderr, "*** Warning: %s\n",
gnutls_strerror(ret));
} else if (ret < 0) {
fprintf(stderr,
"\n*** Received corrupted "
"data(%d). Closing the connection.\n\n",
ret);
break;
} else if (ret > 0) {
/* echo data back to the client
*/
gnutls_record_send(session, buffer, ret);
}
}
printf("\n");
/* do not wait for the peer to close the connection.
*/
gnutls_bye(session, GNUTLS_SHUT_WR);
close(sd);
gnutls_deinit(session);
}
close(listen_sd);
gnutls_anon_free_server_credentials(anoncred);
gnutls_global_deinit();
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Helper-functions-for-TCP-connections">
<div class="nav-panel">
<p>
Next: <a href="#Helper-functions-for-UDP-connections" accesskey="n" rel="next">Helper functions for UDP connections</a>, Previous: <a href="#Echo-server-with-anonymous-authentication" accesskey="p" rel="prev">Echo server with anonymous authentication</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Helper-functions-for-TCP-connections-1"><span>7.3.12 Helper functions for TCP connections<a class="copiable-link" href="#Helper-functions-for-TCP-connections-1"> ¶</a></span></h4>
<p>Those helper function abstract away TCP connection handling from the
other examples. It is required to build some examples.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
/* tcp.c */
int tcp_connect(void);
void tcp_close(int sd);
/* Connects to the peer and returns a socket
* descriptor.
*/
extern int tcp_connect(void)
{
const char *PORT = "5556";
const char *SERVER = "127.0.0.1";
int err, sd;
struct sockaddr_in sa;
/* connects to server
*/
sd = socket(AF_INET, SOCK_STREAM, 0);
memset(&sa, '\0', sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(atoi(PORT));
inet_pton(AF_INET, SERVER, &sa.sin_addr);
err = connect(sd, (struct sockaddr *)&sa, sizeof(sa));
if (err < 0) {
fprintf(stderr, "Connect error\n");
exit(1);
}
return sd;
}
/* closes the given socket descriptor.
*/
extern void tcp_close(int sd)
{
shutdown(sd, SHUT_RDWR); /* no more receptions */
close(sd);
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Helper-functions-for-UDP-connections">
<div class="nav-panel">
<p>
Previous: <a href="#Helper-functions-for-TCP-connections" accesskey="p" rel="prev">Helper functions for TCP connections</a>, Up: <a href="#More-advanced-client-and-servers" accesskey="u" rel="up">More advanced client and servers</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Helper-functions-for-UDP-connections-1"><span>7.3.13 Helper functions for UDP connections<a class="copiable-link" href="#Helper-functions-for-UDP-connections-1"> ¶</a></span></h4>
<p>The UDP helper functions abstract away UDP connection handling from the
other examples. It is required to build the examples using UDP.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <unistd.h>
/* udp.c */
int udp_connect(void);
void udp_close(int sd);
/* Connects to the peer and returns a socket
* descriptor.
*/
extern int udp_connect(void)
{
const char *PORT = "5557";
const char *SERVER = "127.0.0.1";
int err, sd;
#if defined(IP_DONTFRAG) || defined(IP_MTU_DISCOVER)
int optval;
#endif
struct sockaddr_in sa;
/* connects to server
*/
sd = socket(AF_INET, SOCK_DGRAM, 0);
memset(&sa, '\0', sizeof(sa));
sa.sin_family = AF_INET;
sa.sin_port = htons(atoi(PORT));
inet_pton(AF_INET, SERVER, &sa.sin_addr);
#if defined(IP_DONTFRAG)
optval = 1;
setsockopt(sd, IPPROTO_IP, IP_DONTFRAG, (const void *)&optval,
sizeof(optval));
#elif defined(IP_MTU_DISCOVER)
optval = IP_PMTUDISC_DO;
setsockopt(sd, IPPROTO_IP, IP_MTU_DISCOVER, (const void *)&optval,
sizeof(optval));
#endif
err = connect(sd, (struct sockaddr *)&sa, sizeof(sa));
if (err < 0) {
fprintf(stderr, "Connect error\n");
exit(1);
}
return sd;
}
/* closes the given socket descriptor.
*/
extern void udp_close(int sd)
{
close(sd);
}
</pre>
<hr>
</div>
</div>
<div class="section-level-extent" id="OCSP-example">
<div class="nav-panel">
<p>
Next: <a href="#Miscellaneous-examples" accesskey="n" rel="next">Miscellaneous examples</a>, Previous: <a href="#More-advanced-client-and-servers" accesskey="p" rel="prev">More advanced client and servers</a>, Up: <a href="#GnuTLS-application-examples" accesskey="u" rel="up">GnuTLS application examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="OCSP-example-1"><span>7.4 OCSP example<a class="copiable-link" href="#OCSP-example-1"> ¶</a></span></h3>
<a class="anchor" id="Generate-OCSP-request"></a><h4 class="subheading" id="Generate-OCSP-request-1"><span>Generate <abbr class="acronym">OCSP</abbr> request<a class="copiable-link" href="#Generate-OCSP-request-1"> ¶</a></span></h4>
<p>A small tool to generate OCSP requests.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#include <gnutls/ocsp.h>
#ifndef NO_LIBCURL
#include <curl/curl.h>
#endif
#include "read-file.h"
size_t get_data(void *buffer, size_t size, size_t nmemb, void *userp);
static gnutls_x509_crt_t load_cert(const char *cert_file);
static void _response_info(const gnutls_datum_t *data);
static void _generate_request(gnutls_datum_t *rdata, gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer, gnutls_datum_t *nonce);
static int _verify_response(gnutls_datum_t *data, gnutls_x509_crt_t cert,
gnutls_x509_crt_t signer, gnutls_datum_t *nonce);
/* This program queries an OCSP server.
It expects three files. argv[1] containing the certificate to
be checked, argv[2] holding the issuer for this certificate,
and argv[3] holding a trusted certificate to verify OCSP's response.
argv[4] is optional and should hold the server host name.
For simplicity the libcurl library is used.
*/
int main(int argc, char *argv[])
{
gnutls_datum_t ud, tmp;
int ret;
gnutls_datum_t req;
gnutls_x509_crt_t cert, issuer, signer;
#ifndef NO_LIBCURL
CURL *handle;
struct curl_slist *headers = NULL;
#endif
int v, seq;
const char *cert_file = argv[1];
const char *issuer_file = argv[2];
const char *signer_file = argv[3];
char *hostname = NULL;
unsigned char noncebuf[23];
gnutls_datum_t nonce = { noncebuf, sizeof(noncebuf) };
gnutls_global_init();
if (argc > 4)
hostname = argv[4];
ret = gnutls_rnd(GNUTLS_RND_NONCE, nonce.data, nonce.size);
if (ret < 0)
exit(1);
cert = load_cert(cert_file);
issuer = load_cert(issuer_file);
signer = load_cert(signer_file);
if (hostname == NULL) {
for (seq = 0;; seq++) {
ret = gnutls_x509_crt_get_authority_info_access(
cert, seq, GNUTLS_IA_OCSP_URI, &tmp, NULL);
if (ret == GNUTLS_E_UNKNOWN_ALGORITHM)
continue;
if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
fprintf(stderr,
"No URI was found in the certificate.\n");
exit(1);
}
if (ret < 0) {
fprintf(stderr, "error: %s\n",
gnutls_strerror(ret));
exit(1);
}
printf("CA issuers URI: %.*s\n", tmp.size, tmp.data);
hostname = malloc(tmp.size + 1);
if (!hostname) {
fprintf(stderr,
"error: cannot allocate memory\n");
exit(1);
}
memcpy(hostname, tmp.data, tmp.size);
hostname[tmp.size] = 0;
gnutls_free(tmp.data);
break;
}
}
/* Note that the OCSP servers hostname might be available
* using gnutls_x509_crt_get_authority_info_access() in the issuer's
* certificate */
memset(&ud, 0, sizeof(ud));
fprintf(stderr, "Connecting to %s\n", hostname);
_generate_request(&req, cert, issuer, &nonce);
#ifndef NO_LIBCURL
curl_global_init(CURL_GLOBAL_ALL);
handle = curl_easy_init();
if (handle == NULL)
exit(1);
headers = curl_slist_append(headers,
"Content-Type: application/ocsp-request");
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(handle, CURLOPT_POSTFIELDS, (void *)req.data);
curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE, req.size);
curl_easy_setopt(handle, CURLOPT_URL, hostname);
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, get_data);
curl_easy_setopt(handle, CURLOPT_WRITEDATA, &ud);
ret = curl_easy_perform(handle);
if (ret != 0) {
fprintf(stderr, "curl[%d] error %d\n", __LINE__, ret);
exit(1);
}
curl_easy_cleanup(handle);
#endif
_response_info(&ud);
v = _verify_response(&ud, cert, signer, &nonce);
gnutls_x509_crt_deinit(cert);
gnutls_x509_crt_deinit(issuer);
gnutls_x509_crt_deinit(signer);
gnutls_global_deinit();
return v;
}
static void _response_info(const gnutls_datum_t *data)
{
gnutls_ocsp_resp_t resp;
int ret;
gnutls_datum buf;
ret = gnutls_ocsp_resp_init(&resp);
if (ret < 0)
exit(1);
ret = gnutls_ocsp_resp_import(resp, data);
if (ret < 0)
exit(1);
ret = gnutls_ocsp_resp_print(resp, GNUTLS_OCSP_PRINT_FULL, &buf);
if (ret != 0)
exit(1);
printf("%.*s", buf.size, buf.data);
gnutls_free(buf.data);
gnutls_ocsp_resp_deinit(resp);
}
static gnutls_x509_crt_t load_cert(const char *cert_file)
{
gnutls_x509_crt_t crt;
int ret;
gnutls_datum_t data;
size_t size;
ret = gnutls_x509_crt_init(&crt);
if (ret < 0)
exit(1);
data.data = (void *)read_file(cert_file, RF_BINARY, &size);
data.size = size;
if (!data.data) {
fprintf(stderr, "Cannot open file: %s\n", cert_file);
exit(1);
}
ret = gnutls_x509_crt_import(crt, &data, GNUTLS_X509_FMT_PEM);
free(data.data);
if (ret < 0) {
fprintf(stderr, "Cannot import certificate in %s: %s\n",
cert_file, gnutls_strerror(ret));
exit(1);
}
return crt;
}
static void _generate_request(gnutls_datum_t *rdata, gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer, gnutls_datum_t *nonce)
{
gnutls_ocsp_req_t req;
int ret;
ret = gnutls_ocsp_req_init(&req);
if (ret < 0)
exit(1);
ret = gnutls_ocsp_req_add_cert(req, GNUTLS_DIG_SHA1, issuer, cert);
if (ret < 0)
exit(1);
ret = gnutls_ocsp_req_set_nonce(req, 0, nonce);
if (ret < 0)
exit(1);
ret = gnutls_ocsp_req_export(req, rdata);
if (ret != 0)
exit(1);
gnutls_ocsp_req_deinit(req);
return;
}
static int _verify_response(gnutls_datum_t *data, gnutls_x509_crt_t cert,
gnutls_x509_crt_t signer, gnutls_datum_t *nonce)
{
gnutls_ocsp_resp_t resp;
int ret;
unsigned verify, resp_indx;
gnutls_datum_t rnonce;
ret = gnutls_ocsp_resp_init(&resp);
if (ret < 0)
exit(1);
ret = gnutls_ocsp_resp_import(resp, data);
if (ret < 0)
exit(1);
for (resp_indx = 0;; resp_indx++) {
ret = gnutls_ocsp_resp_check_crt(resp, resp_indx, cert);
if (ret == 0 || ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
break;
}
if (ret < 0)
exit(1);
ret = gnutls_ocsp_resp_get_nonce(resp, NULL, &rnonce);
if (ret < 0)
exit(1);
if (rnonce.size != nonce->size ||
memcmp(nonce->data, rnonce.data, nonce->size) != 0) {
exit(1);
}
ret = gnutls_ocsp_resp_verify_direct(resp, signer, &verify, 0);
if (ret < 0)
exit(1);
printf("Verifying OCSP Response: ");
if (verify == 0)
printf("Verification success!\n");
else
printf("Verification error!\n");
if (verify & GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND)
printf("Signer cert not found\n");
if (verify & GNUTLS_OCSP_VERIFY_SIGNER_KEYUSAGE_ERROR)
printf("Signer cert keyusage error\n");
if (verify & GNUTLS_OCSP_VERIFY_UNTRUSTED_SIGNER)
printf("Signer cert is not trusted\n");
if (verify & GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM)
printf("Insecure algorithm\n");
if (verify & GNUTLS_OCSP_VERIFY_SIGNATURE_FAILURE)
printf("Signature failure\n");
if (verify & GNUTLS_OCSP_VERIFY_CERT_NOT_ACTIVATED)
printf("Signer cert not yet activated\n");
if (verify & GNUTLS_OCSP_VERIFY_CERT_EXPIRED)
printf("Signer cert expired\n");
gnutls_free(rnonce.data);
gnutls_ocsp_resp_deinit(resp);
return verify;
}
size_t get_data(void *buffer, size_t size, size_t nmemb, void *userp)
{
gnutls_datum_t *ud = userp;
size *= nmemb;
ud->data = realloc(ud->data, size + ud->size);
if (ud->data == NULL) {
fprintf(stderr, "Not enough memory for the request\n");
exit(1);
}
memcpy(&ud->data[ud->size], buffer, size);
ud->size += size;
return size;
}
</pre>
<hr>
</div>
<div class="section-level-extent" id="Miscellaneous-examples">
<div class="nav-panel">
<p>
Previous: <a href="#OCSP-example" accesskey="p" rel="prev">OCSP example</a>, Up: <a href="#GnuTLS-application-examples" accesskey="u" rel="up">GnuTLS application examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Miscellaneous-examples-1"><span>7.5 Miscellaneous examples<a class="copiable-link" href="#Miscellaneous-examples-1"> ¶</a></span></h3>
<ul class="mini-toc">
<li><a href="#Checking-for-an-alert" accesskey="1">Checking for an alert</a></li>
<li><a href="#X_002e509-certificate-parsing-example" accesskey="2"><abbr class="acronym">X.509</abbr> certificate parsing example</a></li>
<li><a href="#Listing-the-ciphersuites-in-a-priority-string" accesskey="3">Listing the ciphersuites in a priority string</a></li>
<li><a href="#PKCS12-structure-generation-example" accesskey="4">PKCS #12 structure generation example</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Checking-for-an-alert">
<div class="nav-panel">
<p>
Next: <a href="#X_002e509-certificate-parsing-example" accesskey="n" rel="next"><abbr class="acronym">X.509</abbr> certificate parsing example</a>, Up: <a href="#Miscellaneous-examples" accesskey="u" rel="up">Miscellaneous examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Checking-for-an-alert-1"><span>7.5.1 Checking for an alert<a class="copiable-link" href="#Checking-for-an-alert-1"> ¶</a></span></h4>
<p>This is a function that checks if an alert has been received in the
current session.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <gnutls/gnutls.h>
#include "examples.h"
/* This function will check whether the given return code from
* a gnutls function (recv/send), is an alert, and will print
* that alert.
*/
void check_alert(gnutls_session_t session, int ret)
{
int last_alert;
if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED ||
ret == GNUTLS_E_FATAL_ALERT_RECEIVED) {
last_alert = gnutls_alert_get(session);
/* The check for renegotiation is only useful if we are
* a server, and we had requested a rehandshake.
*/
if (last_alert == GNUTLS_A_NO_RENEGOTIATION &&
ret == GNUTLS_E_WARNING_ALERT_RECEIVED)
printf("* Received NO_RENEGOTIATION alert. "
"Client Does not support renegotiation.\n");
else
printf("* Received alert '%d': %s.\n", last_alert,
gnutls_alert_get_name(last_alert));
}
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="X_002e509-certificate-parsing-example">
<div class="nav-panel">
<p>
Next: <a href="#Listing-the-ciphersuites-in-a-priority-string" accesskey="n" rel="next">Listing the ciphersuites in a priority string</a>, Previous: <a href="#Checking-for-an-alert" accesskey="p" rel="prev">Checking for an alert</a>, Up: <a href="#Miscellaneous-examples" accesskey="u" rel="up">Miscellaneous examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="X_002e509-certificate-parsing-example-1"><span>7.5.2 <abbr class="acronym">X.509</abbr> certificate parsing example<a class="copiable-link" href="#X_002e509-certificate-parsing-example-1"> ¶</a></span></h4>
<a class="anchor" id="ex_002dx509_002dinfo"></a>
<p>To demonstrate the <abbr class="acronym">X.509</abbr> parsing capabilities an example program is
listed below. That program reads the peer’s certificate, and prints
information about it.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#include "examples.h"
static const char *bin2hex(const void *bin, size_t bin_size)
{
static char printable[110];
const unsigned char *_bin = bin;
char *print;
size_t i;
if (bin_size > 50)
bin_size = 50;
print = printable;
for (i = 0; i < bin_size; i++) {
sprintf(print, "%.2x ", _bin[i]);
print += 2;
}
return printable;
}
/* This function will print information about this session's peer
* certificate.
*/
void print_x509_certificate_info(gnutls_session_t session)
{
char serial[40];
char dn[256];
size_t size;
unsigned int algo, bits;
time_t expiration_time, activation_time;
const gnutls_datum_t *cert_list;
unsigned int cert_list_size = 0;
gnutls_x509_crt_t cert;
gnutls_datum_t cinfo;
/* This function only works for X.509 certificates.
*/
if (gnutls_certificate_type_get(session) != GNUTLS_CRT_X509)
return;
cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
printf("Peer provided %d certificates.\n", cert_list_size);
if (cert_list_size > 0) {
int ret;
/* we only print information about the first certificate.
*/
gnutls_x509_crt_init(&cert);
gnutls_x509_crt_import(cert, &cert_list[0],
GNUTLS_X509_FMT_DER);
printf("Certificate info:\n");
/* This is the preferred way of printing short information about
a certificate. */
ret = gnutls_x509_crt_print(cert, GNUTLS_CRT_PRINT_ONELINE,
&cinfo);
if (ret == 0) {
printf("\t%s\n", cinfo.data);
gnutls_free(cinfo.data);
}
/* If you want to extract fields manually for some other reason,
below are popular example calls. */
expiration_time = gnutls_x509_crt_get_expiration_time(cert);
activation_time = gnutls_x509_crt_get_activation_time(cert);
printf("\tCertificate is valid since: %s",
ctime(&activation_time));
printf("\tCertificate expires: %s", ctime(&expiration_time));
/* Print the serial number of the certificate.
*/
size = sizeof(serial);
gnutls_x509_crt_get_serial(cert, serial, &size);
printf("\tCertificate serial number: %s\n",
bin2hex(serial, size));
/* Extract some of the public key algorithm's parameters
*/
algo = gnutls_x509_crt_get_pk_algorithm(cert, &bits);
printf("Certificate public key: %s",
gnutls_pk_algorithm_get_name(algo));
/* Print the version of the X.509
* certificate.
*/
printf("\tCertificate version: #%d\n",
gnutls_x509_crt_get_version(cert));
size = sizeof(dn);
gnutls_x509_crt_get_dn(cert, dn, &size);
printf("\tDN: %s\n", dn);
size = sizeof(dn);
gnutls_x509_crt_get_issuer_dn(cert, dn, &size);
printf("\tIssuer's DN: %s\n", dn);
gnutls_x509_crt_deinit(cert);
}
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="Listing-the-ciphersuites-in-a-priority-string">
<div class="nav-panel">
<p>
Next: <a href="#PKCS12-structure-generation-example" accesskey="n" rel="next">PKCS #12 structure generation example</a>, Previous: <a href="#X_002e509-certificate-parsing-example" accesskey="p" rel="prev"><abbr class="acronym">X.509</abbr> certificate parsing example</a>, Up: <a href="#Miscellaneous-examples" accesskey="u" rel="up">Miscellaneous examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Listing-the-ciphersuites-in-a-priority-string-1"><span>7.5.3 Listing the ciphersuites in a priority string<a class="copiable-link" href="#Listing-the-ciphersuites-in-a-priority-string-1"> ¶</a></span></h4>
<p>This is a small program to list the enabled ciphersuites by a
priority string.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gnutls/gnutls.h>
static void print_cipher_suite_list(const char *priorities)
{
size_t i;
int ret;
unsigned int idx;
const char *name;
const char *err;
unsigned char id[2];
gnutls_protocol_t version;
gnutls_priority_t pcache;
if (priorities != NULL) {
printf("Cipher suites for %s\n", priorities);
ret = gnutls_priority_init(&pcache, priorities, &err);
if (ret < 0) {
fprintf(stderr, "Syntax error at: %s\n", err);
exit(1);
}
for (i = 0;; i++) {
ret = gnutls_priority_get_cipher_suite_index(pcache, i,
&idx);
if (ret == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE)
break;
if (ret == GNUTLS_E_UNKNOWN_CIPHER_SUITE)
continue;
name = gnutls_cipher_suite_info(idx, id, NULL, NULL,
NULL, &version);
if (name != NULL)
printf("%-50s\t0x%02x, 0x%02x\t%s\n", name,
(unsigned char)id[0],
(unsigned char)id[1],
gnutls_protocol_get_name(version));
}
return;
}
}
int main(int argc, char **argv)
{
if (argc > 1)
print_cipher_suite_list(argv[1]);
return 0;
}
</pre>
<hr>
</div>
<div class="subsection-level-extent" id="PKCS12-structure-generation-example">
<div class="nav-panel">
<p>
Previous: <a href="#Listing-the-ciphersuites-in-a-priority-string" accesskey="p" rel="prev">Listing the ciphersuites in a priority string</a>, Up: <a href="#Miscellaneous-examples" accesskey="u" rel="up">Miscellaneous examples</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="PKCS-_002312-structure-generation-example"><span>7.5.4 PKCS #12 structure generation example<a class="copiable-link" href="#PKCS-_002312-structure-generation-example"> ¶</a></span></h4>
<p>This small program demonstrates the usage of the PKCS #12 API, by generating
such a structure.
</p>
<pre class="verbatim">/* This example code is placed in the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <gnutls/gnutls.h>
#include <gnutls/pkcs12.h>
#include "examples.h"
#define OUTFILE "out.p12"
/* This function will write a pkcs12 structure into a file.
* cert: is a DER encoded certificate
* pkcs8_key: is a PKCS #8 encrypted key (note that this must be
* encrypted using a PKCS #12 cipher, or some browsers will crash)
* password: is the password used to encrypt the PKCS #12 packet.
*/
int write_pkcs12(const gnutls_datum_t *cert, const gnutls_datum_t *pkcs8_key,
const char *password)
{
gnutls_pkcs12_t pkcs12;
int ret, bag_index;
gnutls_pkcs12_bag_t bag, key_bag;
char pkcs12_struct[10 * 1024];
size_t pkcs12_struct_size;
FILE *fp;
/* A good idea might be to use gnutls_x509_privkey_get_key_id()
* to obtain a unique ID.
*/
gnutls_datum_t key_id = { (void *)"\x00\x00\x07", 3 };
gnutls_global_init();
/* Firstly we create two helper bags, which hold the certificate,
* and the (encrypted) key.
*/
gnutls_pkcs12_bag_init(&bag);
gnutls_pkcs12_bag_init(&key_bag);
ret = gnutls_pkcs12_bag_set_data(bag, GNUTLS_BAG_CERTIFICATE, cert);
if (ret < 0) {
fprintf(stderr, "ret: %s\n", gnutls_strerror(ret));
return 1;
}
/* ret now holds the bag's index.
*/
bag_index = ret;
/* Associate a friendly name with the given certificate. Used
* by browsers.
*/
gnutls_pkcs12_bag_set_friendly_name(bag, bag_index, "My name");
/* Associate the certificate with the key using a unique key
* ID.
*/
gnutls_pkcs12_bag_set_key_id(bag, bag_index, &key_id);
/* use weak encryption for the certificate.
*/
gnutls_pkcs12_bag_encrypt(bag, password, GNUTLS_PKCS_USE_PKCS12_RC2_40);
/* Now the key.
*/
ret = gnutls_pkcs12_bag_set_data(
key_bag, GNUTLS_BAG_PKCS8_ENCRYPTED_KEY, pkcs8_key);
if (ret < 0) {
fprintf(stderr, "ret: %s\n", gnutls_strerror(ret));
return 1;
}
/* Note that since the PKCS #8 key is already encrypted we don't
* bother encrypting that bag.
*/
bag_index = ret;
gnutls_pkcs12_bag_set_friendly_name(key_bag, bag_index, "My name");
gnutls_pkcs12_bag_set_key_id(key_bag, bag_index, &key_id);
/* The bags were filled. Now create the PKCS #12 structure.
*/
gnutls_pkcs12_init(&pkcs12);
/* Insert the two bags in the PKCS #12 structure.
*/
gnutls_pkcs12_set_bag(pkcs12, bag);
gnutls_pkcs12_set_bag(pkcs12, key_bag);
/* Generate a message authentication code for the PKCS #12
* structure.
*/
gnutls_pkcs12_generate_mac(pkcs12, password);
pkcs12_struct_size = sizeof(pkcs12_struct);
ret = gnutls_pkcs12_export(pkcs12, GNUTLS_X509_FMT_DER, pkcs12_struct,
&pkcs12_struct_size);
if (ret < 0) {
fprintf(stderr, "ret: %s\n", gnutls_strerror(ret));
return 1;
}
fp = fopen(OUTFILE, "w");
if (fp == NULL) {
fprintf(stderr, "cannot open file\n");
return 1;
}
fwrite(pkcs12_struct, 1, pkcs12_struct_size, fp);
fclose(fp);
gnutls_pkcs12_bag_deinit(bag);
gnutls_pkcs12_bag_deinit(key_bag);
gnutls_pkcs12_deinit(pkcs12);
return 0;
}
</pre>
<hr>
</div>
</div>
</div>
<div class="chapter-level-extent" id="System_002dwide-configuration-of-the-library">
<div class="nav-panel">
<p>
Next: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="n" rel="next">Using GnuTLS as a cryptographic library</a>, Previous: <a href="#GnuTLS-application-examples" accesskey="p" rel="prev">GnuTLS application examples</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="System_002dwide-configuration-of-the-library-1"><span>8 System-wide configuration of the library<a class="copiable-link" href="#System_002dwide-configuration-of-the-library-1"> ¶</a></span></h2>
<a class="index-entry-id" id="index-System_002dwide-configuration"></a>
<p><abbr class="acronym">GnuTLS</abbr> 3.6.9 introduced a system-wide configuration of the library
which can be used to disable or mark algorithms and protocols as insecure
system-wide, overriding the library defaults. The format of this
configuration file is of an INI file, with the hash (’#’) allowed for
commenting. It intentionally does not allow switching algorithms or protocols
which were disabled or marked as insecure during compile time to the secure
set. This is to prevent the feature from being used to attack the system.
Unknown options or sections in the configuration file are skipped unless
the environment variable <code class="code">GNUTLS_SYSTEM_PRIORITY_FAIL_ON_INVALID</code> is
set to 1, where it would cause the library to exit on unknown options.
</p>
<p>The location of the default configuration file is <code class="code">/etc/gnutls/config</code>,
but its actual location may be overridden during compile time or at run-time
using the <code class="code">GNUTLS_SYSTEM_PRIORITY_FILE</code> environment variable. The file
used can be queried using <a class="ref" href="#gnutls_005fget_005fsystem_005fconfig_005ffile">gnutls_get_system_config_file</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fget_005fsystem_005fconfig_005ffile"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_get_system_config_file</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fget_005fsystem_005fconfig_005ffile"> ¶</a></span></dt>
<dd>
<p>Returns the filename of the system wide configuration
file to be loaded by the library.
</p>
<p><strong class="strong">Returns:</strong> a constant pointer to the config file path
</p>
<p><strong class="strong">Since:</strong> 3.6.9
</p></dd></dl>
<ul class="mini-toc">
<li><a href="#Application_002dspecific-priority-strings" accesskey="1">Application-specific priority strings</a></li>
<li><a href="#Disabling-algorithms-and-protocols" accesskey="2">Disabling algorithms and protocols</a></li>
<li><a href="#Querying-for-disabled-algorithms-and-protocols" accesskey="3">Querying for disabled algorithms and protocols</a></li>
<li><a href="#Overriding-the-parameter-verification-profile" accesskey="4">Overriding the parameter verification profile</a></li>
<li><a href="#Overriding-the-default-priority-string" accesskey="5">Overriding the default priority string</a></li>
<li><a href="#Enabling-TLS-certificate-compression" accesskey="6">Enabling TLS certificate compression</a></li>
<li><a href="#Enabling_002fDisabling-system_002facceleration-protocols" accesskey="7">Enabling/Disabling system/acceleration protocols</a></li>
<li><a href="#Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5" accesskey="8">Enabling/Disabling RSAES-PKCS1-v1_5</a></li>
<li><a href="#Using-PKCS_002311-module-as-cryptographic-backend" accesskey="9">Using PKCS#11 module as cryptographic backend</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Application_002dspecific-priority-strings">
<div class="nav-panel">
<p>
Next: <a href="#Disabling-algorithms-and-protocols" accesskey="n" rel="next">Disabling algorithms and protocols</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Application_002dspecific-priority-strings-1"><span>8.1 Application-specific priority strings<a class="copiable-link" href="#Application_002dspecific-priority-strings-1"> ¶</a></span></h3>
<p>It is possible to specify custom cipher priority strings, in addition to the
default priority strings (<code class="code">NORMAL</code>, <code class="code">PERFORMANCE</code>, etc.). These can
be used either by individual applications, or even as the default option if
the library is compiled with the configuration option
<code class="code">--with-default-priority-string</code>. In the latter case the defined
priority string will be used for applications using <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority">gnutls_set_default_priority</a>
or <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority_005fappend">gnutls_set_default_priority_append</a>.
</p>
<p>The priority strings can be specified in the global section of the
configuration file, or in the section named <code class="code">[priorities]</code>.
The format is ’<code class="code">KEYWORD = VALUE</code>’, e.g.,
</p>
<p>When used they may be followed by additional options that will be appended to the
system string (e.g., ’<code class="code">@EXAMPLE-PRIORITY:+SRP</code>’). ’<code class="code">EXAMPLE-PRIORITY=NORMAL:+ARCFOUR-128</code>’.
Since version 3.5.1 it is allowed to specify fallback keywords by
separating them with a comma, such as @KEYWORD1,KEYWORD2, and the
first valid keyword will be used.
</p>
<p>The following example configuration defines a priority string called <code class="code">@SYSTEM</code>.
When set, its full settings can be queried using <code class="code">gnutls-cli --priority @SYSTEM --list</code>.
</p>
<div class="example">
<pre class="example-preformatted">[priorities]
SYSTEM = NORMAL:-AES-128-CBC:-AES-256-CBC
</pre></div>
<hr>
</div>
<div class="section-level-extent" id="Disabling-algorithms-and-protocols">
<div class="nav-panel">
<p>
Next: <a href="#Querying-for-disabled-algorithms-and-protocols" accesskey="n" rel="next">Querying for disabled algorithms and protocols</a>, Previous: <a href="#Application_002dspecific-priority-strings" accesskey="p" rel="prev">Application-specific priority strings</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Disabling-algorithms-and-protocols-1"><span>8.2 Disabling algorithms and protocols<a class="copiable-link" href="#Disabling-algorithms-and-protocols-1"> ¶</a></span></h3>
<p>The approach above works well to create consistent system-wide settings
for cooperative GnuTLS applications. When an application however does not
use the <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority">gnutls_set_default_priority</a> or <a class="ref" href="#gnutls_005fset_005fdefault_005fpriority_005fappend">gnutls_set_default_priority_append</a>
functions, the method is not sufficient to prevent applications from using
protocols or algorithms forbidden by a local policy.
The override method described below enables the deprecation of algorithms and
protocols system-wide for all applications.
</p>
<p>The available options must be set in the <code class="code">[overrides]</code> section of the
configuration file and can be
</p><ul class="itemize mark-bullet">
<li><code class="code">insecure-sig-for-cert</code>: to mark the signature algorithm as insecure when used in certificates.
</li><li><code class="code">insecure-sig</code>: to mark the signature algorithm as insecure for any use.
</li><li><code class="code">insecure-hash</code>: to mark the hash algorithm as insecure for digital signature use (provides a more generic way to disable digital signatures for broken hash algorithms).
</li><li><code class="code">disabled-curve</code>: to disable the specified elliptic curve.
</li><li><code class="code">disabled-version</code>: to disable the specified TLS versions.
</li><li><code class="code">tls-disabled-cipher</code>: to disable the specified ciphers for use in the TLS or DTLS protocols.
</li><li><code class="code">tls-disabled-mac</code>: to disable the specified MAC algorithms for use in the TLS or DTLS protocols.
</li><li><code class="code">tls-disabled-group</code>: to disable the specified group for use in the TLS or DTLS protocols.
</li><li><code class="code">tls-disabled-kx</code>: to disable the specified key exchange algorithms for use in the TLS or DTLS protocols (applies to TLS1.2 or earlier).
</li></ul>
<p>Each of the options can be repeated multiple times when multiple values need
to be disabled or enabled.
</p>
<p>The valid values for the options above can be found in the ’Protocols’, ’Digests’
’PK-signatures’, ’Protocols’, ’Ciphers’, and ’MACs’ fields of the output of <code class="code">gnutls-cli --list</code>.
</p>
<p>Sometimes the system administrator wants to enable only specific
algorithms, despite the library defaults. GnuTLS provides an
alternative mode of overriding: allowlisting.
</p>
<p>As shown below in the examples, it is hard to use this mode correctly,
as it requires understanding of how algorithms are used underneath by
the protocols. Allowlisting configuration mode is intended to be used
by the operating system vendors that prefer laying out the library
defaults exhaustively from scratch instead on depending on gnutls
presets, such as <code class="code">NORMAL</code>. Applications are then expected to
optionally disable or enable only a subset algorithms on top of the
vendor-provided configuration.
</p>
<p>In the allowlisting mode, all the algorithms are initially marked as
insecure or disabled, and shall be explicitly turned on by the options
listed below in the <code class="code">[overrides]</code> section. As the allowlisting
mode is mutually exclusive to the blocklisting mode, the options
listed above for the blocklisting mode are forbidden in the
allowlisting mode, and vice versa.
</p>
<ul class="itemize mark-bullet">
<li><code class="code">secure-sig-for-cert</code>: to mark the signature algorithm as secure when used in certificates.
</li><li><code class="code">secure-sig</code>: to mark the signature algorithm as secure for any use.
</li><li><code class="code">secure-hash</code>: to mark the hash algorithm as secure for digital signature use (provides a more generic way to enable digital signatures for broken hash algorithms).
</li><li><code class="code">enabled-curve</code>: to enable the specified elliptic curve.
</li><li><code class="code">enabled-version</code>: to enable the specified TLS versions.
</li><li><code class="code">tls-enabled-cipher</code>: to enable the specified ciphers for use in the TLS or DTLS protocols.
</li><li><code class="code">tls-enabled-mac</code>: to enable the specified MAC algorithms for use in the TLS or DTLS protocols.
</li><li><code class="code">tls-enabled-group</code>: to enable the specified group for use in the TLS or DTLS protocols.
</li><li><code class="code">tls-enabled-kx</code>: to enable the specified key exchange algorithms for use in the TLS or DTLS protocols (applies to TLS1.2 or earlier).
</li></ul>
<p>The allowlisting mode can be enabled by adding <code class="code">override-mode =
allowlist</code> in the <code class="code">[global]</code> section.
</p>
<p>The following functions allow the applications to modify the setting.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fecc_005fcurve_005fset_005fenabled">gnutls_ecc_curve_set_enabled</a> (gnutls_ecc_curve_t <var class="var">curve</var>, unsigned int <var class="var">enabled</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsign_005fset_005fsecure">gnutls_sign_set_secure</a> (gnutls_sign_algorithm_t <var class="var">sign</var>, unsigned int <var class="var">secure</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fsign_005fset_005fsecure_005ffor_005fcerts">gnutls_sign_set_secure_for_certs</a> (gnutls_sign_algorithm_t <var class="var">sign</var>, unsigned int <var class="var">secure</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fdigest_005fset_005fsecure">gnutls_digest_set_secure</a> (gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">secure</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprotocol_005fset_005fenabled">gnutls_protocol_set_enabled</a> (gnutls_protocol_t <var class="var">version</var>, unsigned int <var class="var">enabled</var>)</code></dt>
</dl>
<p>When the allowlisting mode is in effect, a <code class="code">@SYSTEM</code> priority
string is automatically constructed from the options in the
<code class="code">[overrides]</code> section. For this reason, the above functions
should be called before the <code class="code">@SYSTEM</code> priority is used.
</p>
<ul class="mini-toc">
<li><a href="#Examples" accesskey="1">Examples</a></li>
</ul>
<div class="subsection-level-extent" id="Examples">
<h4 class="subsection"><span>8.2.1 Examples<a class="copiable-link" href="#Examples"> ¶</a></span></h4>
<p>The following example marks as insecure all digital signature algorithms
which depend on SHA384, as well as the RSA-SHA1 signature algorithm.
</p>
<div class="example">
<pre class="example-preformatted">[overrides]
insecure-hash = sha384
insecure-sig = rsa-sha1
</pre></div>
<p>The following example marks RSA-SHA256 as insecure for use in certificates
and disables the TLS1.0 and TLS1.1 protocols.
</p>
<div class="example">
<pre class="example-preformatted">[overrides]
insecure-sig-for-cert = rsa-sha256
disabled-version = tls1.0
disabled-version = tls1.1
</pre></div>
<p>The following example disables the <code class="code">AES-128-CBC</code> and <code class="code">AES-256-CBC</code>
ciphers, the <code class="code">HMAC-SHA1</code> MAC algorithm and the <code class="code">GROUP-FFDHE8192</code>
group for TLS and DTLS protocols.
</p>
<div class="example">
<pre class="example-preformatted">[overrides]
tls-disabled-cipher = aes-128-cbc
tls-disabled-cipher = aes-256-cbc
tls-disabled-mac = sha1
tls-disabled-group = group-ffdhe8192
</pre></div>
<p>The following example demonstrates the use of the allowlisting
mode. All the signature algorithms are disabled by default but
<code class="code">RSA-SHA256</code>. Note that the hash algorithm <code class="code">SHA256</code> also
needs to be explicitly enabled.
</p>
<div class="example">
<pre class="example-preformatted">[global]
override-mode = allowlist
[overrides]
secure-hash = sha256
secure-sig = rsa-sha256
</pre></div>
<p>To enable a TLS ciphersuite in the allowlist mode requires a more
verbose configuration, explicitly listing algorithm dependencies. The
following example enables TLS_AES_128_GCM_SHA256, using the SECP256R1
curve for signing and key exchange.
</p>
<div class="example">
<pre class="example-preformatted">[global]
override-mode = allowlist
[overrides]
secure-hash = sha256
enabled-curve = secp256r1
secure-sig = ecdsa-secp256r1-sha256
enabled-version = tls1.3
tls-enabled-cipher = aes-128-gcm
tls-enabled-mac = aead
tls-enabled-group = secp256r1
</pre></div>
<hr>
</div>
</div>
<div class="section-level-extent" id="Querying-for-disabled-algorithms-and-protocols">
<div class="nav-panel">
<p>
Next: <a href="#Overriding-the-parameter-verification-profile" accesskey="n" rel="next">Overriding the parameter verification profile</a>, Previous: <a href="#Disabling-algorithms-and-protocols" accesskey="p" rel="prev">Disabling algorithms and protocols</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Querying-for-disabled-algorithms-and-protocols-1"><span>8.3 Querying for disabled algorithms and protocols<a class="copiable-link" href="#Querying-for-disabled-algorithms-and-protocols-1"> ¶</a></span></h3>
<p>When necessary applications can query whether a particular algorithm
or protocol has been marked as insecure or disabled system-wide.
Digital signatures can be queried using the following algorithms.
</p><dl class="table">
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005fsign_005fis_005fsecure">gnutls_sign_is_secure</a> (gnutls_sign_algorithm_t <var class="var">algorithm</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005fsign_005fis_005fsecure2">gnutls_sign_is_secure2</a> (gnutls_sign_algorithm_t <var class="var">algorithm</var>, unsigned int <var class="var">flags</var>)</code></dt>
</dl>
<p>Any disabled protocol versions or elliptic curves will not show up in the
lists provided by the following functions.
</p>
<dl class="table">
<dt><code class="code"><var class="var">const gnutls_protocol_t *</var> <a class="ref" href="#gnutls_005fprotocol_005flist">gnutls_protocol_list</a> ( <var class="var">void</var>)</code></dt>
<dt><code class="code"><var class="var">const gnutls_group_t *</var> <a class="ref" href="#gnutls_005fgroup_005flist">gnutls_group_list</a> ( <var class="var">void</var>)</code></dt>
<dt><code class="code"><var class="var">const gnutls_ecc_curve_t *</var> <a class="ref" href="#gnutls_005fecc_005fcurve_005flist">gnutls_ecc_curve_list</a> ( <var class="var">void</var>)</code></dt>
</dl>
<p>It is not possible to query for insecure hash algorithms directly
(only indirectly through the signature API).
</p>
<hr>
</div>
<div class="section-level-extent" id="Overriding-the-parameter-verification-profile">
<div class="nav-panel">
<p>
Next: <a href="#Overriding-the-default-priority-string" accesskey="n" rel="next">Overriding the default priority string</a>, Previous: <a href="#Querying-for-disabled-algorithms-and-protocols" accesskey="p" rel="prev">Querying for disabled algorithms and protocols</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Overriding-the-parameter-verification-profile-1"><span>8.4 Overriding the parameter verification profile<a class="copiable-link" href="#Overriding-the-parameter-verification-profile-1"> ¶</a></span></h3>
<p>When verifying a certificate or TLS session parameters, GnuTLS uses a set
of profiles associated with the session to determine whether the parameters
seen in the session are acceptable. For example, whether the RSA public key
size as seen on the wire, or the Diffie-Hellman parameters for the session.
These profiles are normally set using the <code class="code">%PROFILE</code> priority string
(see <a class="ref" href="#Priority-Strings">Priority strings</a> and <a class="ref" href="#Selecting-cryptographic-key-sizes">Selecting cryptographic key sizes</a>).
</p>
<p>It is possible to set the low bar profile that applications cannot override
using the following.
</p>
<div class="example">
<pre class="example-preformatted">[overrides]
# do not allow applications use the LOW or VERY-WEAK profiles.
min-verification-profile = legacy
</pre></div>
<hr>
</div>
<div class="section-level-extent" id="Overriding-the-default-priority-string">
<div class="nav-panel">
<p>
Next: <a href="#Enabling-TLS-certificate-compression" accesskey="n" rel="next">Enabling TLS certificate compression</a>, Previous: <a href="#Overriding-the-parameter-verification-profile" accesskey="p" rel="prev">Overriding the parameter verification profile</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Overriding-the-default-priority-string-1"><span>8.5 Overriding the default priority string<a class="copiable-link" href="#Overriding-the-default-priority-string-1"> ¶</a></span></h3>
<p>GnuTLS uses default priority string which is defined at compiled
time. Usually it is set to <code class="code">NORMAL</code>. This override allows to set
the default priority string to something more appropriate for a given
deployment.
</p>
<p>Below example sets a more specific default priority string.
</p><div class="example">
<pre class="example-preformatted">[overrides]
default-priority-string = SECURE128:-VERS-TLS-ALL:+VERS-TLS1.3
</pre></div>
<hr>
</div>
<div class="section-level-extent" id="Enabling-TLS-certificate-compression">
<div class="nav-panel">
<p>
Next: <a href="#Enabling_002fDisabling-system_002facceleration-protocols" accesskey="n" rel="next">Enabling/Disabling system/acceleration protocols</a>, Previous: <a href="#Overriding-the-default-priority-string" accesskey="p" rel="prev">Overriding the default priority string</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Enabling-TLS-certificate-compression-1"><span>8.6 Enabling TLS certificate compression<a class="copiable-link" href="#Enabling-TLS-certificate-compression-1"> ¶</a></span></h3>
<p>This option can be used to enable certificate compression in TLS 1.3 handshake.
Note that setting certificate compression algorithms does not guarantee that
the certificate will be compressed. Setting certificate compression algorithms
will indicate to the peer which compression methods are supported and the peer
may decide to compress the certificate with one of these methods. Algorithms
that appear earlier in the list will be prefered over those appearing later.
</p>
<p>Below example shows how to enable the TLS certificate compression.
</p><div class="example">
<pre class="example-preformatted">[overrides]
cert-compression-alg = brotli
cert-compression-alg = zstd
cert-compression-alg = zlib
</pre></div>
<hr>
</div>
<div class="section-level-extent" id="Enabling_002fDisabling-system_002facceleration-protocols">
<div class="nav-panel">
<p>
Next: <a href="#Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5" accesskey="n" rel="next">Enabling/Disabling RSAES-PKCS1-v1_5</a>, Previous: <a href="#Enabling-TLS-certificate-compression" accesskey="p" rel="prev">Enabling TLS certificate compression</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Enabling_002fDisabling-system_002facceleration-protocols-1"><span>8.7 Enabling/Disabling system/acceleration protocols<a class="copiable-link" href="#Enabling_002fDisabling-system_002facceleration-protocols-1"> ¶</a></span></h3>
<p>The following options can overwrite default behavior of protocols system-wide.
</p><div class="example">
<pre class="example-preformatted">[global]
ktls = true
</pre></div>
<ul class="mini-toc">
<li><a href="#Enabling-kTLS" accesskey="1">Enabling kTLS</a></li>
</ul>
<hr>
<div class="subsection-level-extent" id="Enabling-kTLS">
<div class="nav-panel">
<p>
Up: <a href="#Enabling_002fDisabling-system_002facceleration-protocols" accesskey="u" rel="up">Enabling/Disabling system/acceleration protocols</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h4 class="subsection" id="Enabling-kTLS-1"><span>8.7.1 Enabling kTLS<a class="copiable-link" href="#Enabling-kTLS-1"> ¶</a></span></h4>
<p>When GnuTLS is build with -–enable-ktls configuration, KTLS is disabled by default.
This can be enabled by setting <code class="code">ktls = true</code> in <code class="code">[global]</code> section.
</p>
<p>kTLS requires that the system support kTLS <a class="ref" href="#kTLS-_0028Kernel-TLS_0029">kTLS (Kernel TLS)</a>.
</p>
<hr>
</div>
</div>
<div class="section-level-extent" id="Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5">
<div class="nav-panel">
<p>
Next: <a href="#Using-PKCS_002311-module-as-cryptographic-backend" accesskey="n" rel="next">Using PKCS#11 module as cryptographic backend</a>, Previous: <a href="#Enabling_002fDisabling-system_002facceleration-protocols" accesskey="p" rel="prev">Enabling/Disabling system/acceleration protocols</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5-1"><span>8.8 Enabling/Disabling RSAES-PKCS1-v1_5<a class="copiable-link" href="#Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5-1"> ¶</a></span></h3>
<p>This option can be used to enable/disable RSA PKCS1 v1.5 encryption and decryption
in GnuTLS. The RSAES-PKCS1-v1_5 is enabled by default.
</p>
<p>Below example shows how to explicitely disable the RSAES-PKCS1-v1_5.
</p><div class="example">
<pre class="example-preformatted">[overrides]
allow-rsa-pkcs1-encrypt = false
</pre></div>
<hr>
</div>
<div class="section-level-extent" id="Using-PKCS_002311-module-as-cryptographic-backend">
<div class="nav-panel">
<p>
Previous: <a href="#Enabling_002fDisabling-RSAES_002dPKCS1_002dv1_005f5" accesskey="p" rel="prev">Enabling/Disabling RSAES-PKCS1-v1_5</a>, Up: <a href="#System_002dwide-configuration-of-the-library" accesskey="u" rel="up">System-wide configuration of the library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Using-PKCS_002311-module-as-cryptographic-backend-1"><span>8.9 Using PKCS#11 module as cryptographic backend<a class="copiable-link" href="#Using-PKCS_002311-module-as-cryptographic-backend-1"> ¶</a></span></h3>
<p>Since version 3.8.10 it is possible to plug a PKCS#11 module into GnuTLS
and override the default cryptographic backend of the library with the
cryptographic functions provided by the module.
</p>
<p>A PKCS#11 module can be configured to serve as cryptographic backend by adding
<code class="code">url</code> and <code class="code">pin</code> in the <code class="code">[provider]</code> section.
</p>
<ul class="itemize mark-bullet">
<li><code class="code">url</code>: URL of the PKCS#11 module.
</li><li><code class="code">pin</code>: PIN for logging into the PKCS#11 token.
</li></ul>
<ul class="mini-toc">
<li><a href="#Examples-1" accesskey="1">Examples</a></li>
</ul>
<div class="subsection-level-extent" id="Examples-1">
<h4 class="subsection"><span>8.9.1 Examples<a class="copiable-link" href="#Examples-1"> ¶</a></span></h4>
<p>The following example shows how to use a PKCS#11 module as cryptographic backend.
Note that the module has to be initialized first.
</p>
<div class="example">
<pre class="example-preformatted">[provider]
url = pkcs11:model=v1;manufacturer=Kryoptic%20Project;token=Kryoptic%20Token
pin = 1234
</pre></div>
<hr>
</div>
</div>
</div>
<div class="chapter-level-extent" id="Using-GnuTLS-as-a-cryptographic-library">
<div class="nav-panel">
<p>
Next: <a href="#Other-included-programs" accesskey="n" rel="next">Other included programs</a>, Previous: <a href="#System_002dwide-configuration-of-the-library" accesskey="p" rel="prev">System-wide configuration of the library</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Using-GnuTLS-as-a-cryptographic-library-1"><span>9 Using GnuTLS as a cryptographic library<a class="copiable-link" href="#Using-GnuTLS-as-a-cryptographic-library-1"> ¶</a></span></h2>
<p><abbr class="acronym">GnuTLS</abbr> is not a low-level cryptographic library, i.e.,
it does not provide access to basic cryptographic primitives. However
it abstracts the internal cryptographic back-end (see <a class="ref" href="#Cryptographic-Backend">Cryptographic Backend</a>),
providing symmetric crypto, hash and HMAC algorithms, as well access
to the random number generation. For a low-level crypto API the usage of nettle
<a class="footnote" id="DOCF21" href="#FOOT21"><sup>21</sup></a> library is recommended.
</p>
<ul class="mini-toc">
<li><a href="#Symmetric-algorithms" accesskey="1">Symmetric algorithms</a></li>
<li><a href="#Public-key-algorithms" accesskey="2">Public key algorithms</a></li>
<li><a href="#Cryptographic-Message-Syntax-_002f-PKCS7" accesskey="3">Cryptographic Message Syntax / PKCS7</a></li>
<li><a href="#Hash-and-MAC-functions" accesskey="4">Hash and MAC functions</a></li>
<li><a href="#Random-number-generation" accesskey="5">Random number generation</a></li>
<li><a href="#Overriding-algorithms" accesskey="6">Overriding algorithms</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Symmetric-algorithms">
<div class="nav-panel">
<p>
Next: <a href="#Public-key-algorithms" accesskey="n" rel="next">Public key algorithms</a>, Up: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="u" rel="up">Using GnuTLS as a cryptographic library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Symmetric-algorithms-1"><span>9.1 Symmetric algorithms<a class="copiable-link" href="#Symmetric-algorithms-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-symmetric-algorithms"></a>
<a class="index-entry-id" id="index-symmetric-cryptography"></a>
<p>The available functions to access symmetric crypto algorithms operations
are listed in the sections below. The supported algorithms are the algorithms required by the TLS protocol.
They are listed in <a class="ref" href="#gnutls_005fcipher_005falgorithm_005ft">Figure 9.1</a>. Note that there two
types of ciphers, the ones providing an authenticated-encryption with
associated data (AEAD), and the legacy ciphers which provide raw access
to the ciphers. We recommend the use of the AEAD ciphers under the AEAD APIs
for new applications as they are designed to minimize the misuse of
cryptographic primitives.
</p>
<div class="float" id="gnutls_005fcipher_005falgorithm_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_CIPHER_UNKNOWN</code></dt>
<dd><p>Value to identify an unknown/unsupported algorithm.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_NULL</code></dt>
<dd><p>The NULL (identity) encryption algorithm.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_ARCFOUR_128</code></dt>
<dd><p>ARCFOUR stream cipher with 128-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_3DES_CBC</code></dt>
<dd><p>3DES in CBC mode.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_CBC</code></dt>
<dd><p>AES in CBC mode with 128-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_CBC</code></dt>
<dd><p>AES in CBC mode with 256-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_ARCFOUR_40</code></dt>
<dd><p>ARCFOUR stream cipher with 40-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CAMELLIA_128_CBC</code></dt>
<dd><p>Camellia in CBC mode with 128-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CAMELLIA_256_CBC</code></dt>
<dd><p>Camellia in CBC mode with 256-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_192_CBC</code></dt>
<dd><p>AES in CBC mode with 192-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_GCM</code></dt>
<dd><p>AES in GCM mode with 128-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_GCM</code></dt>
<dd><p>AES in GCM mode with 256-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CAMELLIA_192_CBC</code></dt>
<dd><p>Camellia in CBC mode with 192-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_SALSA20_256</code></dt>
<dd><p>Salsa20 with 256-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_ESTREAM_SALSA20_256</code></dt>
<dd><p>Estream’s Salsa20 variant with 256-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CAMELLIA_128_GCM</code></dt>
<dd><p>CAMELLIA in GCM mode with 128-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CAMELLIA_256_GCM</code></dt>
<dd><p>CAMELLIA in GCM mode with 256-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_RC2_40_CBC</code></dt>
<dd><p>RC2 in CBC mode with 40-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_DES_CBC</code></dt>
<dd><p>DES in CBC mode (56-bit keys).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_CCM</code></dt>
<dd><p>AES in CCM mode with 128-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_CCM</code></dt>
<dd><p>AES in CCM mode with 256-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_CCM_8</code></dt>
<dd><p>AES in CCM mode with 64-bit tag and 128-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_CCM_8</code></dt>
<dd><p>AES in CCM mode with 64-bit tag and 256-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CHACHA20_POLY1305</code></dt>
<dd><p>The Chacha20 cipher with the Poly1305 authenticator (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_GOST28147_TC26Z_CFB</code></dt>
<dd><p>GOST 28147-89 (Magma) cipher in CFB mode with TC26 Z S-box.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_GOST28147_CPA_CFB</code></dt>
<dd><p>GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro A S-box.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_GOST28147_CPB_CFB</code></dt>
<dd><p>GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro B S-box.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_GOST28147_CPC_CFB</code></dt>
<dd><p>GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro C S-box.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_GOST28147_CPD_CFB</code></dt>
<dd><p>GOST 28147-89 (Magma) cipher in CFB mode with CryptoPro D S-box.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_CFB8</code></dt>
<dd><p>AES in CFB8 mode with 128-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_192_CFB8</code></dt>
<dd><p>AES in CFB8 mode with 192-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_CFB8</code></dt>
<dd><p>AES in CFB8 mode with 256-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_XTS</code></dt>
<dd><p>AES in XTS mode with 128-bit key + 128bit tweak key.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_XTS</code></dt>
<dd><p>AES in XTS mode with 256-bit key + 256bit tweak key.
Note that the XTS ciphers are message oriented.
The whole message needs to be provided with a single call, because
cipher-stealing requires to know where the message actually terminates
in order to be able to compute where the stealing occurs.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_GOST28147_TC26Z_CNT</code></dt>
<dd><p>GOST 28147-89 (Magma) cipher in CNT mode with TC26 Z S-box.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CHACHA20_64</code></dt>
<dd><p>Chacha20 cipher with 64-bit nonces and 64-bit block counters.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CHACHA20_32</code></dt>
<dd><p>Chacha20 cipher with 96-bit nonces and 32-bit block counters.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_SIV</code></dt>
<dd><p>AES in SIV mode with 128-bit key.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_SIV</code></dt>
<dd><p>AES in SIV mode with 256-bit key.
Note that the SIV ciphers can only be used with
the AEAD interface, and the IV plays a role as
the authentication tag while it is prepended to
the cipher text.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_192_GCM</code></dt>
<dd><p>AES in GCM mode with 192-bit keys (AEAD).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_MAGMA_CTR_ACPKM</code></dt>
<dd><p>GOST R 34.12-2015 (Magma) cipher in CTR-ACPKM mode.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_KUZNYECHIK_CTR_ACPKM</code></dt>
<dd><p>GOST R 34.12-2015 (Kuznyechik) cipher in CTR-ACPKM mode.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_SIV_GCM</code></dt>
<dd><p>AES in SIV-GCM mode with 128-bit key.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_SIV_GCM</code></dt>
<dd><p>AES in SIV-GCM mode with 256-bit key.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_128_CFB</code></dt>
<dd><p>AES in CFB mode with 128-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_192_CFB</code></dt>
<dd><p>AES in CFB mode with 192-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES_256_CFB</code></dt>
<dd><p>AES in CFB mode with 256-bit keys.
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_IDEA_PGP_CFB</code></dt>
<dd><p>IDEA in CFB mode (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_3DES_PGP_CFB</code></dt>
<dd><p>3DES in CFB mode (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_CAST5_PGP_CFB</code></dt>
<dd><p>CAST5 in CFB mode (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_BLOWFISH_PGP_CFB</code></dt>
<dd><p>Blowfish in CFB mode (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_SAFER_SK128_PGP_CFB</code></dt>
<dd><p>Safer-SK in CFB mode with 128-bit keys (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES128_PGP_CFB</code></dt>
<dd><p>AES in CFB mode with 128-bit keys (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES192_PGP_CFB</code></dt>
<dd><p>AES in CFB mode with 192-bit keys (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_AES256_PGP_CFB</code></dt>
<dd><p>AES in CFB mode with 256-bit keys (placeholder - unsupported).
</p></dd>
<dt><code class="code">GNUTLS_CIPHER_TWOFISH_PGP_CFB</code></dt>
<dd><p>Twofish in CFB mode (placeholder - unsupported).
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 9.1: </strong>The supported ciphers.</p></div></div>
<h4 class="subheading" id="Authenticated_002dencryption-API"><span>Authenticated-encryption API<a class="copiable-link" href="#Authenticated_002dencryption-API"> ¶</a></span></h4>
<p>The AEAD API provides access to all ciphers supported by GnuTLS which support
authenticated encryption with associated data; these ciphers are marked with
the AEAD keyword on the table above. The AEAD cipher API is
particularly suitable for message or packet-encryption as it provides
authentication and encryption on the same API. See <code class="code">RFC5116</code> for more
information on authenticated encryption.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005faead_005fcipher_005finit">gnutls_aead_cipher_init</a> (gnutls_aead_cipher_hd_t * <var class="var">handle</var>, gnutls_cipher_algorithm_t <var class="var">cipher</var>, const gnutls_datum_t * <var class="var">key</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005faead_005fcipher_005fencrypt">gnutls_aead_cipher_encrypt</a> (gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const void * <var class="var">auth</var>, size_t <var class="var">auth_len</var>, size_t <var class="var">tag_size</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">ctext</var>, size_t * <var class="var">ctext_len</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005faead_005fcipher_005fdecrypt">gnutls_aead_cipher_decrypt</a> (gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const void * <var class="var">auth</var>, size_t <var class="var">auth_len</var>, size_t <var class="var">tag_size</var>, const void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>, void * <var class="var">ptext</var>, size_t * <var class="var">ptext_len</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005faead_005fcipher_005fdeinit">gnutls_aead_cipher_deinit</a> (gnutls_aead_cipher_hd_t <var class="var">handle</var>)</code></dt>
</dl>
<p>Because the encryption function above may be difficult to use with
scattered data, we provide the following API.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fencryptv"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_encryptv</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const giovec_t * <var class="var">auth_iov</var>, int <var class="var">auth_iovcnt</var>, size_t <var class="var">tag_size</var>, const giovec_t * <var class="var">iov</var>, int <var class="var">iovcnt</var>, void * <var class="var">ctext</var>, size_t * <var class="var">ctext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fencryptv"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">nonce</var>: the nonce to set
</p>
<p><var class="var">nonce_len</var>: The length of the nonce
</p>
<p><var class="var">auth_iov</var>: additional data to be authenticated
</p>
<p><var class="var">auth_iovcnt</var>: The number of buffers in <code class="code">auth_iov</code>
</p>
<p><var class="var">tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p><var class="var">iov</var>: the data to be encrypted
</p>
<p><var class="var">iovcnt</var>: The number of buffers in <code class="code">iov</code>
</p>
<p><var class="var">ctext</var>: the encrypted data including authentication tag
</p>
<p><var class="var">ctext_len</var>: the length of encrypted data (initially must hold the maximum available size, including space for tag)
</p>
<p>This function will encrypt the provided data buffers using the algorithm
specified by the context. The output data will contain the
authentication tag.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="Legacy-API"><span>Legacy API<a class="copiable-link" href="#Legacy-API"> ¶</a></span></h4>
<p>The legacy API provides low-level access to all legacy ciphers supported by GnuTLS,
and some of the AEAD ciphers (e.g., AES-GCM and CHACHA20). The restrictions
of the nettle library implementation of the ciphers apply verbatim to this
API<a class="footnote" id="DOCF22" href="#FOOT22"><sup>22</sup></a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcipher_005finit">gnutls_cipher_init</a> (gnutls_cipher_hd_t * <var class="var">handle</var>, gnutls_cipher_algorithm_t <var class="var">cipher</var>, const gnutls_datum_t * <var class="var">key</var>, const gnutls_datum_t * <var class="var">iv</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcipher_005fencrypt2">gnutls_cipher_encrypt2</a> (gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcipher_005fdecrypt2">gnutls_cipher_decrypt2</a> (gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>, void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcipher_005fset_005fiv">gnutls_cipher_set_iv</a> (gnutls_cipher_hd_t <var class="var">handle</var>, void * <var class="var">iv</var>, size_t <var class="var">ivlen</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fcipher_005fdeinit">gnutls_cipher_deinit</a> (gnutls_cipher_hd_t <var class="var">handle</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcipher_005fadd_005fauth">gnutls_cipher_add_auth</a> (gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_size</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fcipher_005ftag">gnutls_cipher_tag</a> (gnutls_cipher_hd_t <var class="var">handle</var>, void * <var class="var">tag</var>, size_t <var class="var">tag_size</var>)</code></dt>
</dl>
<p>While the latter two functions allow the same API can be used with authenticated encryption ciphers,
it is recommended to use the following functions which are solely for AEAD ciphers. The latter
API is designed to be simple to use and also hard to misuse, by handling the tag verification
and addition in transparent way.
</p>
<hr>
</div>
<div class="section-level-extent" id="Public-key-algorithms">
<div class="nav-panel">
<p>
Next: <a href="#Cryptographic-Message-Syntax-_002f-PKCS7" accesskey="n" rel="next">Cryptographic Message Syntax / PKCS7</a>, Previous: <a href="#Symmetric-algorithms" accesskey="p" rel="prev">Symmetric algorithms</a>, Up: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="u" rel="up">Using GnuTLS as a cryptographic library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Public-key-algorithms-1"><span>9.2 Public key algorithms<a class="copiable-link" href="#Public-key-algorithms-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-public-key-algorithms"></a>
<p>Public key cryptography algorithms such as RSA, DSA and ECDSA, are
accessed using the abstract key API in <a class="ref" href="#Abstract-key-types">Abstract key types</a>. This
is a high level API with the advantage of transparently handling keys
stored in memory and keys present in smart cards.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005finit">gnutls_privkey_init</a> (gnutls_privkey_t * <var class="var">key</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fimport_005furl">gnutls_privkey_import_url</a> (gnutls_privkey_t <var class="var">key</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fimport_005fx509_005fraw">gnutls_privkey_import_x509_raw</a> (gnutls_privkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fsign_005fdata">gnutls_privkey_sign_data</a> (gnutls_privkey_t <var class="var">signer</var>, gnutls_digest_algorithm_t <var class="var">hash</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">signature</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fprivkey_005fsign_005fhash">gnutls_privkey_sign_hash</a> (gnutls_privkey_t <var class="var">signer</var>, gnutls_digest_algorithm_t <var class="var">hash_algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">hash_data</var>, gnutls_datum_t * <var class="var">signature</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fprivkey_005fdeinit">gnutls_privkey_deinit</a> (gnutls_privkey_t <var class="var">key</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005finit">gnutls_pubkey_init</a> (gnutls_pubkey_t * <var class="var">key</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005furl">gnutls_pubkey_import_url</a> (gnutls_pubkey_t <var class="var">key</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fimport_005fx509">gnutls_pubkey_import_x509</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fverify_005fdata2">gnutls_pubkey_verify_data2</a> (gnutls_pubkey_t <var class="var">pubkey</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, const gnutls_datum_t * <var class="var">signature</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpubkey_005fverify_005fhash2">gnutls_pubkey_verify_hash2</a> (gnutls_pubkey_t <var class="var">key</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">hash</var>, const gnutls_datum_t * <var class="var">signature</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpubkey_005fdeinit">gnutls_pubkey_deinit</a> (gnutls_pubkey_t <var class="var">key</var>)</code></dt>
</dl>
<p>Keys stored in memory can be imported using functions like
<a class="ref" href="#gnutls_005fprivkey_005fimport_005fx509_005fraw">gnutls_privkey_import_x509_raw</a>, while keys on smart cards or HSMs
should be imported using their PKCS#11 URL with
<a class="ref" href="#gnutls_005fprivkey_005fimport_005furl">gnutls_privkey_import_url</a>.
</p>
<p>If any of the smart card operations require PIN, that should be provided
either by setting the global PIN function
(<a class="ref" href="#gnutls_005fpkcs11_005fset_005fpin_005ffunction">gnutls_pkcs11_set_pin_function</a>), or better with the targeted to
structures functions such as <a class="ref" href="#gnutls_005fprivkey_005fset_005fpin_005ffunction">gnutls_privkey_set_pin_function</a>.
</p>
<ul class="mini-toc">
<li><a href="#Key-generation-2" accesskey="1">Key generation</a></li>
</ul>
<div class="subsection-level-extent" id="Key-generation-2">
<h4 class="subsection"><span>9.2.1 Key generation<a class="copiable-link" href="#Key-generation-2"> ¶</a></span></h4>
<p>All supported key types (including RSA, DSA, ECDSA, Ed25519, Ed448) can be generated
with GnuTLS. They can be generated with the simpler <a class="ref" href="#gnutls_005fprivkey_005fgenerate">gnutls_privkey_generate</a>
or with the more advanced <a class="ref" href="#gnutls_005fprivkey_005fgenerate2">gnutls_privkey_generate2</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fgenerate2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_generate2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_pk_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">bits</var>, unsigned int <var class="var">flags</var>, const gnutls_keygen_data_st * <var class="var">data</var>, unsigned <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fgenerate2"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">algo</var>: is one of the algorithms in <code class="code">gnutls_pk_algorithm_t</code> .
</p>
<p><var class="var">bits</var>: the size of the modulus
</p>
<p><var class="var">flags</var>: Must be zero or flags from <code class="code">gnutls_privkey_flags_t</code> .
</p>
<p><var class="var">data</var>: Allow specifying <code class="code">gnutls_keygen_data_st</code> types such as the seed to be used.
</p>
<p><var class="var">data_size</var>: The number of <code class="code">data</code> available.
</p>
<p>This function will generate a random private key. Note that this
function must be called on an initialized private key.
</p>
<p>The flag <code class="code">GNUTLS_PRIVKEY_FLAG_PROVABLE</code>
instructs the key generation process to use algorithms like Shawe-Taylor
(from FIPS PUB186-4) which generate provable parameters out of a seed
for RSA and DSA keys. On DSA keys the PQG parameters are generated using the
seed, while on RSA the two primes. To specify an explicit seed
(by default a random seed is used), use the <code class="code">data</code> with a <code class="code">GNUTLS_KEYGEN_SEED</code>
type.
</p>
<p>Note that when generating an elliptic curve key, the curve
can be substituted in the place of the bits parameter using the
<code class="code">GNUTLS_CURVE_TO_BITS()</code> macro.
</p>
<p>To export the generated keys in memory or in files it is recommended to use the
PKCS<code class="code">8</code> form as it can handle all key types, and can store additional parameters
such as the seed, in case of provable RSA or DSA keys.
Generated keys can be exported in memory using <code class="code">gnutls_privkey_export_x509()</code> ,
and then with <code class="code">gnutls_x509_privkey_export2_pkcs8()</code> .
</p>
<p>If key generation is part of your application, avoid setting the number
of bits directly, and instead use <code class="code">gnutls_sec_param_to_pk_bits()</code> .
That way the generated keys will adapt to the security levels
of the underlying GnuTLS library.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<hr>
</div>
</div>
<div class="section-level-extent" id="Cryptographic-Message-Syntax-_002f-PKCS7">
<div class="nav-panel">
<p>
Next: <a href="#Hash-and-MAC-functions" accesskey="n" rel="next">Hash and MAC functions</a>, Previous: <a href="#Public-key-algorithms" accesskey="p" rel="prev">Public key algorithms</a>, Up: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="u" rel="up">Using GnuTLS as a cryptographic library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Cryptographic-Message-Syntax-_002f-PKCS7-1"><span>9.3 Cryptographic Message Syntax / PKCS7<a class="copiable-link" href="#Cryptographic-Message-Syntax-_002f-PKCS7-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-public-key-algorithms-1"></a>
<a class="index-entry-id" id="index-cryptographic-message-syntax"></a>
<a class="index-entry-id" id="index-file-signing"></a>
<a class="index-entry-id" id="index-CMS"></a>
<a class="index-entry-id" id="index-PKCS-_00237"></a>
<p>The CMS or PKCS #7 format is a commonly used format for digital signatures.
PKCS #7 is the name of the original standard when published by RSA, though
today the standard is adopted by IETF under the name CMS.
</p>
<p>The standards include multiple ways of signing a digital document, e.g.,
by embedding the data into the signature, or creating detached signatures of the data,
including a timestamp, additional certificates etc. In certain cases the
same format is also used to transport lists of certificates and CRLs.
</p>
<p>It is a relatively popular standard to sign structures, and is being used to
sign in PDF files, as well as for signing kernel modules and other
structures.
</p>
<p>In GnuTLS, the basic functions to initialize, deinitialize, import, export or print information
about a PKCS #7 structure are listed below.
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005finit">gnutls_pkcs7_init</a> (gnutls_pkcs7_t * <var class="var">pkcs7</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fpkcs7_005fdeinit">gnutls_pkcs7_deinit</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fexport2">gnutls_pkcs7_export2</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fimport">gnutls_pkcs7_import</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fprint">gnutls_pkcs7_print</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code></dt>
</dl>
<p>The following functions allow the verification of a structure using either a trust list, or
individual certificates. The <a class="ref" href="#gnutls_005fpkcs7_005fsign">gnutls_pkcs7_sign</a> function is the data signing function.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fverify_005fdirect">gnutls_pkcs7_verify_direct</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_t <var class="var">signer</var>, unsigned <var class="var">idx</var>, const gnutls_datum_t * <var class="var">data</var>, unsigned <var class="var">flags</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fverify">gnutls_pkcs7_verify</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_trust_list_t <var class="var">tl</var>, gnutls_typed_vdata_st * <var class="var">vdata</var>, unsigned int <var class="var">vdata_size</var>, unsigned <var class="var">idx</var>, const gnutls_datum_t * <var class="var">data</var>, unsigned <var class="var">flags</var>)</code></dt>
</dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fsign"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_sign</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_t <var class="var">signer</var>, gnutls_privkey_t <var class="var">signer_key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_pkcs7_attrs_t <var class="var">signed_attrs</var>, gnutls_pkcs7_attrs_t <var class="var">unsigned_attrs</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a <code class="code">gnutls_pkcs7_t</code> type
</p>
<p><var class="var">signer</var>: the certificate to sign the structure
</p>
<p><var class="var">signer_key</var>: the key to sign the structure
</p>
<p><var class="var">data</var>: The data to be signed or <code class="code">NULL</code> if the data are already embedded
</p>
<p><var class="var">signed_attrs</var>: Any additional attributes to be included in the signed ones (or <code class="code">NULL</code> )
</p>
<p><var class="var">unsigned_attrs</var>: Any additional attributes to be included in the unsigned ones (or <code class="code">NULL</code> )
</p>
<p><var class="var">dig</var>: The digest algorithm to use for signing
</p>
<p><var class="var">flags</var>: Should be zero or one of <code class="code">GNUTLS_PKCS7</code> flags
</p>
<p>This function will add a signature in the provided PKCS <code class="code">7</code> structure
for the provided data. Multiple signatures can be made with different
signers.
</p>
<p>The available flags are:
<code class="code">GNUTLS_PKCS7_EMBED_DATA</code> , <code class="code">GNUTLS_PKCS7_INCLUDE_TIME</code> , <code class="code">GNUTLS_PKCS7_INCLUDE_CERT</code> ,
and <code class="code">GNUTLS_PKCS7_WRITE_SPKI</code> . They are explained in the <code class="code">gnutls_pkcs7_sign_flags</code>
definition.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<div class="float" id="gnutls_005fpkcs7_005fsign_005fflags">
<dl class="table">
<dt><code class="code">GNUTLS_PKCS7_EMBED_DATA</code></dt>
<dd><p>The signed data will be embedded in the structure.
</p></dd>
<dt><code class="code">GNUTLS_PKCS7_INCLUDE_TIME</code></dt>
<dd><p>The signing time will be included in the structure.
</p></dd>
<dt><code class="code">GNUTLS_PKCS7_INCLUDE_CERT</code></dt>
<dd><p>The signer’s certificate will be included in the cert list.
</p></dd>
<dt><code class="code">GNUTLS_PKCS7_WRITE_SPKI</code></dt>
<dd><p>Use the signer’s key identifier instead of name.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 9.2: </strong>Flags applicable to gnutls_pkcs7_sign()</p></div></div>
<p>Other helper functions which allow to access the signatures, or certificates attached
in the structure are listed below.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fget_005fsignature_005fcount">gnutls_pkcs7_get_signature_count</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fget_005fsignature_005finfo">gnutls_pkcs7_get_signature_info</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">idx</var>, gnutls_pkcs7_signature_info_st * <var class="var">info</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fget_005fcrt_005fcount">gnutls_pkcs7_get_crt_count</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fget_005fcrt_005fraw2">gnutls_pkcs7_get_crt_raw2</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">cert</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fget_005fcrl_005fcount">gnutls_pkcs7_get_crl_count</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fget_005fcrl_005fraw2">gnutls_pkcs7_get_crl_raw2</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">crl</var>)</code></dt>
</dl>
<p>To append certificates, or CRLs in the structure the following functions are provided.
</p><dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fset_005fcrt_005fraw">gnutls_pkcs7_set_crt_raw</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, const gnutls_datum_t * <var class="var">crt</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fset_005fcrt">gnutls_pkcs7_set_crt</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_t <var class="var">crt</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fset_005fcrl_005fraw">gnutls_pkcs7_set_crl_raw</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, const gnutls_datum_t * <var class="var">crl</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fpkcs7_005fset_005fcrl">gnutls_pkcs7_set_crl</a> (gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crl_t <var class="var">crl</var>)</code></dt>
</dl>
<hr>
</div>
<div class="section-level-extent" id="Hash-and-MAC-functions">
<div class="nav-panel">
<p>
Next: <a href="#Random-number-generation" accesskey="n" rel="next">Random number generation</a>, Previous: <a href="#Cryptographic-Message-Syntax-_002f-PKCS7" accesskey="p" rel="prev">Cryptographic Message Syntax / PKCS7</a>, Up: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="u" rel="up">Using GnuTLS as a cryptographic library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Hash-and-MAC-functions-1"><span>9.4 Hash and MAC functions<a class="copiable-link" href="#Hash-and-MAC-functions-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-hash-functions"></a>
<a class="index-entry-id" id="index-HMAC-functions"></a>
<a class="index-entry-id" id="index-MAC-functions"></a>
<p>The available operations to access hash functions and hash-MAC (HMAC) algorithms
are shown below. HMAC algorithms provided keyed hash functionality. The supported MAC and HMAC
algorithms are listed in <a class="ref" href="#gnutls_005fmac_005falgorithm_005ft">Figure 9.3</a>. Note that, despite the <code class="code">hmac</code> part
in the name of the MAC functions listed below, they can be used either for HMAC or MAC operations.
</p>
<div class="float" id="gnutls_005fmac_005falgorithm_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_MAC_UNKNOWN</code></dt>
<dd><p>Unknown MAC algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_NULL</code></dt>
<dd><p>NULL MAC algorithm (empty output).
</p></dd>
<dt><code class="code">GNUTLS_MAC_MD5</code></dt>
<dd><p>HMAC-MD5 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA1</code></dt>
<dd><p>HMAC-SHA-1 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_RMD160</code></dt>
<dd><p>HMAC-RMD160 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_MD2</code></dt>
<dd><p>HMAC-MD2 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA256</code></dt>
<dd><p>HMAC-SHA-256 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA384</code></dt>
<dd><p>HMAC-SHA-384 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA512</code></dt>
<dd><p>HMAC-SHA-512 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA224</code></dt>
<dd><p>HMAC-SHA-224 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA3_224</code></dt>
<dd><p>Reserved; unimplemented.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA3_256</code></dt>
<dd><p>Reserved; unimplemented.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA3_384</code></dt>
<dd><p>Reserved; unimplemented.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHA3_512</code></dt>
<dd><p>Reserved; unimplemented.
</p></dd>
<dt><code class="code">GNUTLS_MAC_MD5_SHA1</code></dt>
<dd><p>Combined MD5+SHA1 MAC placeholder.
</p></dd>
<dt><code class="code">GNUTLS_MAC_GOSTR_94</code></dt>
<dd><p>HMAC GOST R 34.11-94 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_STREEBOG_256</code></dt>
<dd><p>HMAC GOST R 34.11-2001 (Streebog) algorithm, 256 bit.
</p></dd>
<dt><code class="code">GNUTLS_MAC_STREEBOG_512</code></dt>
<dd><p>HMAC GOST R 34.11-2001 (Streebog) algorithm, 512 bit.
</p></dd>
<dt><code class="code">GNUTLS_MAC_AEAD</code></dt>
<dd><p>MAC implicit through AEAD cipher.
</p></dd>
<dt><code class="code">GNUTLS_MAC_UMAC_96</code></dt>
<dd><p>The UMAC-96 MAC algorithm (requires nonce).
</p></dd>
<dt><code class="code">GNUTLS_MAC_UMAC_128</code></dt>
<dd><p>The UMAC-128 MAC algorithm (requires nonce).
</p></dd>
<dt><code class="code">GNUTLS_MAC_AES_CMAC_128</code></dt>
<dd><p>The AES-CMAC-128 MAC algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_AES_CMAC_256</code></dt>
<dd><p>The AES-CMAC-256 MAC algorithm.
</p></dd>
<dt><code class="code">GNUTLS_MAC_AES_GMAC_128</code></dt>
<dd><p>The AES-GMAC-128 MAC algorithm (requires nonce).
</p></dd>
<dt><code class="code">GNUTLS_MAC_AES_GMAC_192</code></dt>
<dd><p>The AES-GMAC-192 MAC algorithm (requires nonce).
</p></dd>
<dt><code class="code">GNUTLS_MAC_AES_GMAC_256</code></dt>
<dd><p>The AES-GMAC-256 MAC algorithm (requires nonce).
</p></dd>
<dt><code class="code">GNUTLS_MAC_GOST28147_TC26Z_IMIT</code></dt>
<dd><p>The GOST 28147-89 working in IMIT mode with TC26 Z S-box.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHAKE_128</code></dt>
<dd><p>The SHAKE128 extendable output function.
</p></dd>
<dt><code class="code">GNUTLS_MAC_SHAKE_256</code></dt>
<dd><p>The SHAKE256 extendable output function.
</p></dd>
<dt><code class="code">GNUTLS_MAC_MAGMA_OMAC</code></dt>
<dd><p>GOST R 34.12-2015 (Magma) in OMAC (CMAC) mode.
</p></dd>
<dt><code class="code">GNUTLS_MAC_KUZNYECHIK_OMAC</code></dt>
<dd><p>GOST R 34.12-2015 (Kuznyechik) in OMAC (CMAC) mode.
</p></dd>
<dt><code class="code">GNUTLS_MAC_PBMAC1</code></dt>
<dd><p>– undescribed –
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 9.3: </strong>The supported MAC and HMAC algorithms.</p></div></div>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhmac_005finit">gnutls_hmac_init</a> (gnutls_hmac_hd_t * <var class="var">dig</var>, gnutls_mac_algorithm_t <var class="var">algorithm</var>, const void * <var class="var">key</var>, size_t <var class="var">keylen</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhmac">gnutls_hmac</a> (gnutls_hmac_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fhmac_005foutput">gnutls_hmac_output</a> (gnutls_hmac_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fhmac_005fdeinit">gnutls_hmac_deinit</a> (gnutls_hmac_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005fhmac_005fget_005flen">gnutls_hmac_get_len</a> (gnutls_mac_algorithm_t <var class="var">algorithm</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhmac_005ffast">gnutls_hmac_fast</a> (gnutls_mac_algorithm_t <var class="var">algorithm</var>, const void * <var class="var">key</var>, size_t <var class="var">keylen</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">digest</var>)</code></dt>
</dl>
<p>The available functions to access hash functions are shown below. The supported hash functions
are shown in <a class="ref" href="#gnutls_005fdigest_005falgorithm_005ft">Figure 9.4</a>.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhash_005finit">gnutls_hash_init</a> (gnutls_hash_hd_t * <var class="var">dig</var>, gnutls_digest_algorithm_t <var class="var">algorithm</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhash">gnutls_hash</a> (gnutls_hash_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fhash_005foutput">gnutls_hash_output</a> (gnutls_hash_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005fhash_005fdeinit">gnutls_hash_deinit</a> (gnutls_hash_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code></dt>
<dt><code class="code"><var class="var">unsigned</var> <a class="ref" href="#gnutls_005fhash_005fget_005flen">gnutls_hash_get_len</a> (gnutls_digest_algorithm_t <var class="var">algorithm</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005fhash_005ffast">gnutls_hash_fast</a> (gnutls_digest_algorithm_t <var class="var">algorithm</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">digest</var>)</code></dt>
</dl>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ffingerprint">gnutls_fingerprint</a> (gnutls_digest_algorithm_t <var class="var">algo</var>, const gnutls_datum_t * <var class="var">data</var>, void * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code></dt>
</dl>
<div class="float" id="gnutls_005fdigest_005falgorithm_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_DIG_UNKNOWN</code></dt>
<dd><p>Unknown hash algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_NULL</code></dt>
<dd><p>NULL hash algorithm (empty output).
</p></dd>
<dt><code class="code">GNUTLS_DIG_MD5</code></dt>
<dd><p>MD5 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA1</code></dt>
<dd><p>SHA-1 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_RMD160</code></dt>
<dd><p>RMD160 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_MD2</code></dt>
<dd><p>MD2 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA256</code></dt>
<dd><p>SHA-256 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA384</code></dt>
<dd><p>SHA-384 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA512</code></dt>
<dd><p>SHA-512 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA224</code></dt>
<dd><p>SHA-224 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA3_224</code></dt>
<dd><p>SHA3-224 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA3_256</code></dt>
<dd><p>SHA3-256 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA3_384</code></dt>
<dd><p>SHA3-384 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHA3_512</code></dt>
<dd><p>SHA3-512 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_MD5_SHA1</code></dt>
<dd><p>Combined MD5+SHA1 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_GOSTR_94</code></dt>
<dd><p>GOST R 34.11-94 algorithm.
</p></dd>
<dt><code class="code">GNUTLS_DIG_STREEBOG_256</code></dt>
<dd><p>GOST R 34.11-2001 (Streebog) algorithm, 256 bit.
</p></dd>
<dt><code class="code">GNUTLS_DIG_STREEBOG_512</code></dt>
<dd><p>GOST R 34.11-2001 (Streebog) algorithm, 512 bit.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHAKE_128</code></dt>
<dd><p>The SHAKE128 extendable output function.
</p></dd>
<dt><code class="code">GNUTLS_DIG_SHAKE_256</code></dt>
<dd><p>The SHAKE256 extendable output function.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 9.4: </strong>The supported hash algorithms.</p></div></div>
<hr>
</div>
<div class="section-level-extent" id="Random-number-generation">
<div class="nav-panel">
<p>
Next: <a href="#Overriding-algorithms" accesskey="n" rel="next">Overriding algorithms</a>, Previous: <a href="#Hash-and-MAC-functions" accesskey="p" rel="prev">Hash and MAC functions</a>, Up: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="u" rel="up">Using GnuTLS as a cryptographic library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Random-number-generation-1"><span>9.5 Random number generation<a class="copiable-link" href="#Random-number-generation-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-random-numbers"></a>
<p>Access to the random number generator is provided using the <a class="ref" href="#gnutls_005frnd">gnutls_rnd</a>
function. It allows obtaining random data of various levels.
</p>
<div class="float" id="gnutls_005frnd_005flevel_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_RND_NONCE</code></dt>
<dd><p>Non-predictable random number. Fatal in parts
of session if broken, i.e., vulnerable to statistical analysis.
</p></dd>
<dt><code class="code">GNUTLS_RND_RANDOM</code></dt>
<dd><p>Pseudo-random cryptographic random number.
Fatal in session if broken. Example use: temporal keys.
</p></dd>
<dt><code class="code">GNUTLS_RND_KEY</code></dt>
<dd><p>Fatal in many sessions if broken. Example use:
Long-term keys.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 9.5: </strong>The random number levels.</p></div></div>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frnd"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_rnd</strong> <code class="def-code-arguments">(gnutls_rnd_level_t <var class="var">level</var>, void * <var class="var">data</var>, size_t <var class="var">len</var>)</code><a class="copiable-link" href="#index-gnutls_005frnd"> ¶</a></span></dt>
<dd><p><var class="var">level</var>: a security level
</p>
<p><var class="var">data</var>: place to store random bytes
</p>
<p><var class="var">len</var>: The requested size
</p>
<p>This function will generate random data and store it to output
buffer. The value of <code class="code">level</code> should be one of <code class="code">GNUTLS_RND_NONCE</code> ,
<code class="code">GNUTLS_RND_RANDOM</code> and <code class="code">GNUTLS_RND_KEY</code> . See the manual and
<code class="code">gnutls_rnd_level_t</code> for detailed information.
</p>
<p>This function is thread-safe and also fork-safe.
</p>
<p><strong class="strong">Returns:</strong> Zero on success, or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<p>See <a class="ref" href="#Random-Number-Generators_002dinternals">Random Number Generators</a> for more information
on the random number generator operation.
</p>
<hr>
</div>
<div class="section-level-extent" id="Overriding-algorithms">
<div class="nav-panel">
<p>
Previous: <a href="#Random-number-generation" accesskey="p" rel="prev">Random number generation</a>, Up: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="u" rel="up">Using GnuTLS as a cryptographic library</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Overriding-algorithms-1"><span>9.6 Overriding algorithms<a class="copiable-link" href="#Overriding-algorithms-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-overriding-algorithms"></a>
<p>In systems which provide a hardware accelerated cipher implementation
that is not directly supported by GnuTLS, it is possible to utilize it.
There are functions which allow overriding the default cipher, digest and MAC
implementations. Those are described below.
</p>
<p>To override public key operations see <a class="ref" href="#Abstract-private-keys">Private keys</a>.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005fcipher"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_cipher</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_cipher_init_func <var class="var">init</var>, gnutls_cipher_setkey_func <var class="var">setkey</var>, gnutls_cipher_setiv_func <var class="var">setiv</var>, gnutls_cipher_encrypt_func <var class="var">encrypt</var>, gnutls_cipher_decrypt_func <var class="var">decrypt</var>, gnutls_cipher_deinit_func <var class="var">deinit</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005fcipher"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls algorithm identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the cipher
</p>
<p><var class="var">setkey</var>: A function which sets the key of the cipher
</p>
<p><var class="var">setiv</var>: A function which sets the nonce/IV of the cipher (non-AEAD)
</p>
<p><var class="var">encrypt</var>: A function which performs encryption (non-AEAD)
</p>
<p><var class="var">decrypt</var>: A function which performs decryption (non-AEAD)
</p>
<p><var class="var">deinit</var>: A function which deinitializes the cipher
</p>
<p>This function will register a cipher algorithm to be used by
gnutls. Any algorithm registered will override the included
algorithms and by convention kernel implemented algorithms have
priority of 90 and CPU-assisted of 80. The algorithm with the lowest priority will be
used by gnutls.
</p>
<p>In the case the registered init or setkey functions return <code class="code">GNUTLS_E_NEED_FALLBACK</code> ,
GnuTLS will attempt to use the next in priority registered cipher.
</p>
<p>The functions which are marked as non-AEAD they are not required when
registering a cipher to be used with the new AEAD API introduced in
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005faead_005fcipher"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_aead_cipher</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_cipher_init_func <var class="var">init</var>, gnutls_cipher_setkey_func <var class="var">setkey</var>, gnutls_cipher_aead_encrypt_func <var class="var">aead_encrypt</var>, gnutls_cipher_aead_decrypt_func <var class="var">aead_decrypt</var>, gnutls_cipher_deinit_func <var class="var">deinit</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005faead_005fcipher"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls AEAD cipher identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the cipher
</p>
<p><var class="var">setkey</var>: A function which sets the key of the cipher
</p>
<p><var class="var">aead_encrypt</var>: Perform the AEAD encryption
</p>
<p><var class="var">aead_decrypt</var>: Perform the AEAD decryption
</p>
<p><var class="var">deinit</var>: A function which deinitializes the cipher
</p>
<p>This function will register a cipher algorithm to be used by
gnutls. Any algorithm registered will override the included
algorithms and by convention kernel implemented algorithms have
priority of 90 and CPU-assisted of 80. The algorithm with the lowest priority will be
used by gnutls.
</p>
<p>In the case the registered init or setkey functions return <code class="code">GNUTLS_E_NEED_FALLBACK</code> ,
GnuTLS will attempt to use the next in priority registered cipher.
</p>
<p>The functions registered will be used with the new AEAD API introduced in
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005fmac"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_mac</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_mac_init_func <var class="var">init</var>, gnutls_mac_setkey_func <var class="var">setkey</var>, gnutls_mac_setnonce_func <var class="var">setnonce</var>, gnutls_mac_hash_func <var class="var">hash</var>, gnutls_mac_output_func <var class="var">output</var>, gnutls_mac_deinit_func <var class="var">deinit</var>, gnutls_mac_fast_func <var class="var">hash_fast</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005fmac"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls MAC identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the MAC
</p>
<p><var class="var">setkey</var>: A function which sets the key of the MAC
</p>
<p><var class="var">setnonce</var>: A function which sets the nonce for the mac (may be <code class="code">NULL</code> for common MAC algorithms)
</p>
<p><var class="var">hash</var>: Perform the hash operation
</p>
<p><var class="var">output</var>: Provide the output of the MAC
</p>
<p><var class="var">deinit</var>: A function which deinitializes the MAC
</p>
<p><var class="var">hash_fast</var>: Perform the MAC operation in one go
</p>
<p>This function will register a MAC algorithm to be used by gnutls.
Any algorithm registered will override the included algorithms and
by convention kernel implemented algorithms have priority of 90
and CPU-assisted of 80.
The algorithm with the lowest priority will be used by gnutls.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005fdigest"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_digest</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_digest_init_func <var class="var">init</var>, gnutls_digest_hash_func <var class="var">hash</var>, gnutls_digest_output_func <var class="var">output</var>, gnutls_digest_deinit_func <var class="var">deinit</var>, gnutls_digest_fast_func <var class="var">hash_fast</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005fdigest"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls digest identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the digest
</p>
<p><var class="var">hash</var>: Perform the hash operation
</p>
<p><var class="var">output</var>: Provide the output of the digest
</p>
<p><var class="var">deinit</var>: A function which deinitializes the digest
</p>
<p><var class="var">hash_fast</var>: Perform the digest operation in one go
</p>
<p>This function will register a digest algorithm to be used by gnutls.
Any algorithm registered will override the included algorithms and
by convention kernel implemented algorithms have priority of 90
and CPU-assisted of 80.
The algorithm with the lowest priority will be used by gnutls.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<hr>
</div>
</div>
<div class="chapter-level-extent" id="Other-included-programs">
<div class="nav-panel">
<p>
Next: <a href="#Internal-architecture-of-GnuTLS" accesskey="n" rel="next">Internal Architecture of GnuTLS</a>, Previous: <a href="#Using-GnuTLS-as-a-cryptographic-library" accesskey="p" rel="prev">Using GnuTLS as a cryptographic library</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Other-included-programs-1"><span>10 Other included programs<a class="copiable-link" href="#Other-included-programs-1"> ¶</a></span></h2>
<p>Included with <abbr class="acronym">GnuTLS</abbr> are also a few command line tools that
let you use the library for common tasks without writing an
application. The applications are discussed in this chapter.
</p>
<hr>
<a class="node" id="gnutls_002dcli-Invocation"></a><div class="nav-panel">
<p>
[<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="heading" id="Invoking-gnutls_002dcli"><span>Invoking gnutls-cli<a class="copiable-link" href="#Invoking-gnutls_002dcli"> ¶</a></span></h3>
<a class="index-entry-id" id="index-gnutls_002dcli"></a>
<p>Simple client program to set up a TLS connection to some other computer.
It sets up a TLS connection and forwards data from the standard input to the secured socket and vice versa.
</p>
<a class="anchor" id="gnutls_002dcli-usage"></a><h4 class="subheading" id="gnutls_002dcli-help_002fusage-_0028_002d_003f_0029"><span>gnutls-cli help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#gnutls_002dcli-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-gnutls_002dcli-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">gnutls-cli - GnuTLS client
Usage: gnutls-cli [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostname]
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
-V, --verbose More verbose output
--tofu Enable trust on first use authentication
--strict-tofu Fail to connect if a certificate is unknown or a known certificate has changed
--dane Enable DANE certificate verification (DNSSEC)
--local-dns Use the local DNS server for DNSSEC resolving
--ca-verification Enable CA certificate verification
- enabled by default
- disabled as '--no-ca-verification'
--ocsp Enable OCSP certificate verification
-r, --resume Establish a session and resume
--earlydata=str Send early data on resumption from the specified file
-e, --rehandshake Establish a session and rehandshake
--sni-hostname=str Server's hostname for server name indication extension
--verify-hostname=str Server's hostname to use for validation
-s, --starttls Connect, establish a plain session and start TLS
--app-proto an alias for the 'starttls-proto' option
--starttls-proto=str The application protocol to be used to obtain the server's certificate (https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres)
- prohibits the option 'starttls'
--starttls-name=str The hostname presented to the application protocol for STARTTLS (for smtp, xmpp, lmtp)
- prohibits the option 'starttls'
- requires the option 'starttls-proto'
-u, --udp Use DTLS (datagram TLS) over UDP
--mtu=num Set MTU for datagram TLS
- it must be in the range:
0 to 17000
--crlf Send CR LF instead of LF
--fastopen Enable TCP Fast Open
--x509fmtder Use DER format for certificates to read from
--print-cert Print peer's certificate in PEM format
--save-cert=str Save the peer's certificate chain in the specified file in PEM format
--save-ocsp=str Save the peer's OCSP status response in the provided file
- prohibits the option 'save-ocsp-multi'
--save-ocsp-multi=str Save all OCSP responses provided by the peer in this file
- prohibits the option 'save-ocsp'
--save-server-trace=str Save the server-side TLS message trace in the provided file
--save-client-trace=str Save the client-side TLS message trace in the provided file
--dh-bits=num The minimum number of bits allowed for DH
--priority=str Priorities string
--x509cafile=str Certificate file or PKCS #11 URL to use
--x509crlfile=file CRL file to use
- file must pre-exist
--x509keyfile=str X.509 key file or PKCS #11 URL to use
--x509certfile=str X.509 Certificate file or PKCS #11 URL to use
- requires the option 'x509keyfile'
--rawpkkeyfile=str Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use
--rawpkfile=str Raw public-key file to use
- requires the option 'rawpkkeyfile'
--srpusername=str SRP username to use
--srppasswd=str SRP password to use
--pskusername=str PSK username to use
--pskkey=str PSK key (in hex) to use
-p, --port=str The port or service to connect to
--insecure Don't abort program if server certificate can't be validated
--verify-allow-broken Allow broken algorithms, such as MD5 for certificate verification
--benchmark-ciphers Benchmark individual ciphers
--benchmark-tls-kx Benchmark TLS key exchange methods
--benchmark-tls-ciphers Benchmark TLS ciphers
-l, --list Print a list of the supported algorithms and modes
- prohibits the option 'port'
--priority-list Print a list of the supported priority strings
--noticket Don't allow session tickets
--srtp-profiles=str Offer SRTP profiles
--alpn=str Application layer protocol
--compress-cert=str Compress certificate
-b, --heartbeat Activate heartbeat support
--recordsize=num The maximum record size to advertise
- it must be in the range:
0 to 4096
--disable-sni Do not send a Server Name Indication (SNI)
--single-key-share Send a single key share under TLS1.3
--post-handshake-auth Enable post-handshake authentication under TLS1.3
--inline-commands Inline commands of the form ^<cmd>^
--inline-commands-prefix=str Change the default delimiter for inline commands
--provider=file Specify the PKCS #11 provider library
- file must pre-exist
--fips140-mode Reports the status of the FIPS140-2 mode in gnutls library
--list-config Reports the configuration of the library
--logfile=str Redirect informational messages to a specific file
--keymatexport=str Label used for exporting keying material
--keymatexportsize=num Size of the exported keying material
--waitresumption Block waiting for the resumption data under TLS1.3
--ca-auto-retrieve Enable automatic retrieval of missing CA certificates
--attime=str Perform validation at the timestamp instead of the system time
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Operands and options may be intermixed. They will be reordered.
Simple client program to set up a TLS connection to some other computer.
It sets up a TLS connection and forwards data from the standard input to the secured socket and vice versa.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subheading" id="debug-option-_0028_002dd_0029_002e"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subheading" id="tofu-option_002e"><span>tofu option.<a class="copiable-link" href="#tofu-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-tofu"></a>
<p>This is the “enable trust on first use authentication” option.
This option will, in addition to certificate authentication, perform authentication
based on previously seen public keys, a model similar to SSH authentication. Note that when tofu
is specified (PKI) and DANE authentication will become advisory to assist the public key acceptance
process.
</p><h4 class="subheading" id="strict_002dtofu-option_002e"><span>strict-tofu option.<a class="copiable-link" href="#strict_002dtofu-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-strict_002dtofu"></a>
<p>This is the “fail to connect if a certificate is unknown or a known certificate has changed” option.
This option will perform authentication as with option –tofu; however, no questions shall be asked whatsoever, neither to accept an unknown certificate nor a changed one.
</p><h4 class="subheading" id="dane-option_002e"><span>dane option.<a class="copiable-link" href="#dane-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-dane"></a>
<p>This is the “enable dane certificate verification (dnssec)” option.
This option will, in addition to certificate authentication using
the trusted CAs, verify the server certificates using on the DANE information
available via DNSSEC.
</p><h4 class="subheading" id="local_002ddns-option_002e"><span>local-dns option.<a class="copiable-link" href="#local_002ddns-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-local_002ddns"></a>
<p>This is the “use the local dns server for dnssec resolving” option.
This option will use the local DNS server for DNSSEC.
This is disabled by default due to many servers not allowing DNSSEC.
</p><h4 class="subheading" id="ca_002dverification-option_002e"><span>ca-verification option.<a class="copiable-link" href="#ca_002dverification-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-ca_002dverification"></a>
<p>This is the “enable ca certificate verification” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>can be disabled with –no-ca-verification.
</li><li>It is enabled by default.
</li></ul>
<p>This option can be used to enable or disable CA certificate verification. It is to be used with the –dane or –tofu options.
</p><h4 class="subheading" id="ocsp-option_002e"><span>ocsp option.<a class="copiable-link" href="#ocsp-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-ocsp"></a>
<p>This is the “enable ocsp certificate verification” option.
This option will enable verification of the peer’s certificate using ocsp
</p><h4 class="subheading" id="resume-option-_0028_002dr_0029_002e"><span>resume option (-r).<a class="copiable-link" href="#resume-option-_0028_002dr_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-resume"></a>
<p>This is the “establish a session and resume” option.
Connect, establish a session, reconnect and resume.
</p><h4 class="subheading" id="rehandshake-option-_0028_002de_0029_002e"><span>rehandshake option (-e).<a class="copiable-link" href="#rehandshake-option-_0028_002de_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-rehandshake"></a>
<p>This is the “establish a session and rehandshake” option.
Connect, establish a session and rehandshake immediately.
</p><h4 class="subheading" id="sni_002dhostname-option_002e"><span>sni-hostname option.<a class="copiable-link" href="#sni_002dhostname-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-sni_002dhostname"></a>
<p>This is the “server’s hostname for server name indication extension” option.
This option takes a ArgumentType.STRING argument.
Set explicitly the server name used in the TLS server name indication extension. That is useful when testing with servers setup on different DNS name than the intended. If not specified, the provided hostname is used. Even with this option server certificate verification still uses the hostname passed on the main commandline. Use –verify-hostname to change this.
</p><h4 class="subheading" id="verify_002dhostname-option_002e"><span>verify-hostname option.<a class="copiable-link" href="#verify_002dhostname-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-verify_002dhostname"></a>
<p>This is the “server’s hostname to use for validation” option.
This option takes a ArgumentType.STRING argument.
Set explicitly the server name to be used when validating the server’s certificate.
</p><h4 class="subheading" id="starttls-option-_0028_002ds_0029_002e"><span>starttls option (-s).<a class="copiable-link" href="#starttls-option-_0028_002ds_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-starttls"></a>
<p>This is the “connect, establish a plain session and start tls” option.
The TLS session will be initiated when EOF or a SIGALRM is received.
</p><h4 class="subheading" id="app_002dproto-option_002e"><span>app-proto option.<a class="copiable-link" href="#app_002dproto-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-app_002dproto"></a>
<p>This is an alias for the <code class="code">starttls-proto</code> option,
see <a class="pxref" href="#gnutls_002dcli-starttls_002dproto">the starttls-proto option documentation</a>.
</p>
<h4 class="subheading" id="starttls_002dproto-option_002e"><span>starttls-proto option.<a class="copiable-link" href="#starttls_002dproto-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-starttls_002dproto"></a>
<p>This is the “the application protocol to be used to obtain the server’s certificate (https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres)” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
starttls.
</li></ul>
<p>Specify the application layer protocol for STARTTLS. If the protocol is supported, gnutls-cli will proceed to the TLS negotiation.
</p><h4 class="subheading" id="starttls_002dname-option_002e"><span>starttls-name option.<a class="copiable-link" href="#starttls_002dname-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-starttls_002dname"></a>
<p>This is the “the hostname presented to the application protocol for starttls (for smtp, xmpp, lmtp)” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
starttls.
</li><li>must appear in combination with the following options:
starttls-proto.
</li></ul>
<p>Specify the hostname presented to the application protocol for STARTTLS.
</p><h4 class="subheading" id="save_002docsp_002dmulti-option_002e"><span>save-ocsp-multi option.<a class="copiable-link" href="#save_002docsp_002dmulti-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-save_002docsp_002dmulti"></a>
<p>This is the “save all ocsp responses provided by the peer in this file” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
save-ocsp.
</li></ul>
<p>The file will contain a list of PEM encoded OCSP status responses if any were provided by the peer, starting with the one for the peer’s server certificate.
</p><h4 class="subheading" id="dh_002dbits-option_002e"><span>dh-bits option.<a class="copiable-link" href="#dh_002dbits-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-dh_002dbits"></a>
<p>This is the “the minimum number of bits allowed for dh” option.
This option takes a ArgumentType.NUMBER argument.
This option sets the minimum number of bits allowed for a Diffie-Hellman key exchange. You may want to lower the default value if the peer sends a weak prime and you get an connection error with unacceptable prime.
</p><h4 class="subheading" id="priority-option_002e"><span>priority option.<a class="copiable-link" href="#priority-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-priority"></a>
<p>This is the “priorities string” option.
This option takes a ArgumentType.STRING argument.
TLS algorithms and protocols to enable. You can
use predefined sets of ciphersuites such as PERFORMANCE,
NORMAL, PFS, SECURE128, SECURE256. The default is NORMAL.
</p>
<p>Check the GnuTLS manual on section “Priority strings” for more
information on the allowed keywords
</p><h4 class="subheading" id="rawpkkeyfile-option_002e"><span>rawpkkeyfile option.<a class="copiable-link" href="#rawpkkeyfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-rawpkkeyfile"></a>
<p>This is the “private key file (pkcs #8 or pkcs #12) or pkcs #11 url to use” option.
This option takes a ArgumentType.STRING argument.
In order to instruct the application to negotiate raw public keys one
must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-*
and CTYPE-SRV-* flags).
</p>
<p>Check the GnuTLS manual on section “Priority strings” for more
information on how to set certificate types.
</p><h4 class="subheading" id="rawpkfile-option_002e"><span>rawpkfile option.<a class="copiable-link" href="#rawpkfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-rawpkfile"></a>
<p>This is the “raw public-key file to use” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must appear in combination with the following options:
rawpkkeyfile.
</li></ul>
<p>In order to instruct the application to negotiate raw public keys one
must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-*
and CTYPE-SRV-* flags).
</p>
<p>Check the GnuTLS manual on section “Priority strings” for more
information on how to set certificate types.
</p><h4 class="subheading" id="ranges-option_002e"><span>ranges option.<a class="copiable-link" href="#ranges-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-ranges"></a>
<p>This is the “use length-hiding padding to prevent traffic analysis” option.
When possible (e.g., when using CBC ciphersuites), use length-hiding padding to prevent traffic analysis.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subheading" id="benchmark_002dciphers-option_002e"><span>benchmark-ciphers option.<a class="copiable-link" href="#benchmark_002dciphers-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-benchmark_002dciphers"></a>
<p>This is the “benchmark individual ciphers” option.
By default the benchmarked ciphers will utilize any capabilities of the local CPU to improve performance. To test against the raw software implementation set the environment variable GNUTLS_CPUID_OVERRIDE to 0x1.
</p><h4 class="subheading" id="benchmark_002dtls_002dciphers-option_002e"><span>benchmark-tls-ciphers option.<a class="copiable-link" href="#benchmark_002dtls_002dciphers-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-benchmark_002dtls_002dciphers"></a>
<p>This is the “benchmark tls ciphers” option.
By default the benchmarked ciphers will utilize any capabilities of the local CPU to improve performance. To test against the raw software implementation set the environment variable GNUTLS_CPUID_OVERRIDE to 0x1.
</p><h4 class="subheading" id="list-option-_0028_002dl_0029_002e"><span>list option (-l).<a class="copiable-link" href="#list-option-_0028_002dl_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-list"></a>
<p>This is the “print a list of the supported algorithms and modes” option.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must not appear in combination with any of the following options:
port.
</li></ul>
<p>Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown.
</p><h4 class="subheading" id="priority_002dlist-option_002e"><span>priority-list option.<a class="copiable-link" href="#priority_002dlist-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-priority_002dlist"></a>
<p>This is the “print a list of the supported priority strings” option.
Print a list of the supported priority strings. The ciphersuites corresponding to each priority string can be examined using -l -p.
</p><h4 class="subheading" id="noticket-option_002e"><span>noticket option.<a class="copiable-link" href="#noticket-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-noticket"></a>
<p>This is the “don’t allow session tickets” option.
Disable the request of receiving of session tickets under TLS1.2 or earlier
</p><h4 class="subheading" id="alpn-option_002e"><span>alpn option.<a class="copiable-link" href="#alpn-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-alpn"></a>
<p>This is the “application layer protocol” option.
This option takes a ArgumentType.STRING argument.
This option will set and enable the Application Layer Protocol Negotiation (ALPN) in the TLS protocol.
</p><h4 class="subheading" id="compress_002dcert-option_002e"><span>compress-cert option.<a class="copiable-link" href="#compress_002dcert-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-compress_002dcert"></a>
<p>This is the “compress certificate” option.
This option takes a ArgumentType.STRING argument.
This option sets a supported compression method for certificate compression.
</p><h4 class="subheading" id="disable_002dextensions-option_002e"><span>disable-extensions option.<a class="copiable-link" href="#disable_002dextensions-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-disable_002dextensions"></a>
<p>This is the “disable all the tls extensions” option.
This option disables all TLS extensions. Deprecated option. Use the priority string.
</p>
<p><strong class="strong">NOTE</strong><strong class="strong">: THIS OPTION IS DEPRECATED</strong>
</p><h4 class="subheading" id="single_002dkey_002dshare-option_002e"><span>single-key-share option.<a class="copiable-link" href="#single_002dkey_002dshare-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-single_002dkey_002dshare"></a>
<p>This is the “send a single key share under tls1.3” option.
This option switches the default mode of sending multiple
key shares, to send a single one (the top one).
</p><h4 class="subheading" id="post_002dhandshake_002dauth-option_002e"><span>post-handshake-auth option.<a class="copiable-link" href="#post_002dhandshake_002dauth-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-post_002dhandshake_002dauth"></a>
<p>This is the “enable post-handshake authentication under tls1.3” option.
This option enables post-handshake authentication when under TLS1.3.
</p><h4 class="subheading" id="inline_002dcommands-option_002e"><span>inline-commands option.<a class="copiable-link" href="#inline_002dcommands-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-inline_002dcommands"></a>
<p>This is the “inline commands of the form ^<cmd>^” option.
Enable inline commands of the form ^<cmd>^. The inline commands are expected to be in a line by themselves. The available commands are: resume, rekey1 (local rekey), rekey (rekey on both peers) and renegotiate.
</p><h4 class="subheading" id="inline_002dcommands_002dprefix-option_002e"><span>inline-commands-prefix option.<a class="copiable-link" href="#inline_002dcommands_002dprefix-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-inline_002dcommands_002dprefix"></a>
<p>This is the “change the default delimiter for inline commands” option.
This option takes a ArgumentType.STRING argument.
Change the default delimiter (^) used for inline commands. The delimiter is expected to be a single US-ASCII character (octets 0 - 127). This option is only relevant if inline commands are enabled via the inline-commands option
</p><h4 class="subheading" id="provider-option_002e"><span>provider option.<a class="copiable-link" href="#provider-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-provider"></a>
<p>This is the “specify the pkcs #11 provider library” option.
This option takes a ArgumentType.FILE argument.
This will override the default options in /etc/gnutls/pkcs11.conf
</p><h4 class="subheading" id="logfile-option_002e"><span>logfile option.<a class="copiable-link" href="#logfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-logfile"></a>
<p>This is the “redirect informational messages to a specific file” option.
This option takes a ArgumentType.STRING argument.
Redirect informational messages to a specific file. The file may be /dev/null also to make the gnutls client quiet to use it in piped server connections where only the server communication may appear on stdout.
</p><h4 class="subheading" id="waitresumption-option_002e"><span>waitresumption option.<a class="copiable-link" href="#waitresumption-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-waitresumption"></a>
<p>This is the “block waiting for the resumption data under tls1.3” option.
This option makes the client to block waiting for the resumption data under TLS1.3. The option has effect only when –resume is provided.
</p><h4 class="subheading" id="ca_002dauto_002dretrieve-option_002e"><span>ca-auto-retrieve option.<a class="copiable-link" href="#ca_002dauto_002dretrieve-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-ca_002dauto_002dretrieve"></a>
<p>This is the “enable automatic retrieval of missing ca certificates” option.
This option enables the client to automatically retrieve the missing intermediate CA certificates in the certificate chain, based on the Authority Information Access (AIA) extension.
</p><h4 class="subheading" id="attime-option_002e"><span>attime option.<a class="copiable-link" href="#attime-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-attime"></a>
<p>This is the “perform validation at the timestamp instead of the system time” option.
This option takes a ArgumentType.STRING argument <samp class="file">timestamp</samp>.
timestamp is an instance in time encoded as Unix time or in a human
readable timestring such as "29 Feb 2004", "2004-02-29".
Full documentation available at
<https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html>
or locally via info ’(coreutils) date invocation’.
</p><h4 class="subheading" id="version-option-_0028_002dv_0029_002e"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subheading" id="help-option-_0028_002dh_0029_002e"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="gnutls_002dcli-exit-status"></a></p><h4 class="subheading" id="gnutls_002dcli-exit-status-1"><span>gnutls-cli exit status<a class="copiable-link" href="#gnutls_002dcli-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="gnutls_002dcli-See-Also"></a><h4 class="subsubheading" id="gnutls_002dcli-See-Also-1"><span>gnutls-cli See Also<a class="copiable-link" href="#gnutls_002dcli-See-Also-1"> ¶</a></span></h4>
<p>gnutls-cli-debug(1), gnutls-serv(1)
<a class="anchor" id="gnutls_002dcli-Examples"></a></p><h4 class="subsubheading" id="gnutls_002dcli-Examples-1"><span>gnutls-cli Examples<a class="copiable-link" href="#gnutls_002dcli-Examples-1"> ¶</a></span></h4>
<h4 class="subheading" id="Connecting-using-PSK-authentication"><span>Connecting using PSK authentication<a class="copiable-link" href="#Connecting-using-PSK-authentication"> ¶</a></span></h4>
<p>To connect to a server using PSK authentication, you need to enable the choice of PSK by using a cipher priority parameter such as in the example below.
</p><div class="example">
<pre class="example-preformatted">$ ./gnutls-cli -p 5556 localhost --pskusername psk_identity \
--pskkey 88f3824b3e5659f52d00e959bacab954b6540344 \
--priority NORMAL:-KX-ALL:+ECDHE-PSK:+DHE-PSK:+PSK
Resolving 'localhost'...
Connecting to '127.0.0.1:5556'...
- PSK authentication.
- Version: TLS1.1
- Key Exchange: PSK
- Cipher: AES-128-CBC
- MAC: SHA1
- Compression: NULL
- Handshake was completed
- Simple Client Mode:
</pre></div>
<p>By keeping the –pskusername parameter and removing the –pskkey parameter, it will query only for the password during the handshake.
</p>
<h4 class="subheading" id="Connecting-using-raw-public_002dkey-authentication"><span>Connecting using raw public-key authentication<a class="copiable-link" href="#Connecting-using-raw-public_002dkey-authentication"> ¶</a></span></h4>
<p>To connect to a server using raw public-key authentication, you need to enable the option to negotiate raw public-keys via the priority strings such as in the example below.
</p><div class="example">
<pre class="example-preformatted">$ ./gnutls-cli -p 5556 localhost --priority NORMAL:-CTYPE-CLI-ALL:+CTYPE-CLI-RAWPK \
--rawpkkeyfile cli.key.pem \
--rawpkfile cli.rawpk.pem
Processed 1 client raw public key pair...
Resolving 'localhost'...
Connecting to '127.0.0.1:5556'...
- Successfully sent 1 certificate(s) to server.
- Server has requested a certificate.
- Certificate type: X.509
- Got a certificate list of 1 certificates.
- Certificate[0] info:
- skipped
- Description: (TLS1.3-Raw Public Key-X.509)-(ECDHE-SECP256R1)-(RSA-PSS-RSAE-SHA256)-(AES-256-GCM)
- Options:
- Handshake was completed
- Simple Client Mode:
</pre></div>
<h4 class="subheading" id="Connecting-to-STARTTLS-services"><span>Connecting to STARTTLS services<a class="copiable-link" href="#Connecting-to-STARTTLS-services"> ¶</a></span></h4>
<p>You could also use the client to connect to services with starttls capability.
</p><div class="example">
<pre class="example-preformatted">$ gnutls-cli --starttls-proto smtp --port 25 localhost
</pre></div>
<h4 class="subheading" id="Listing-ciphersuites-in-a-priority-string"><span>Listing ciphersuites in a priority string<a class="copiable-link" href="#Listing-ciphersuites-in-a-priority-string"> ¶</a></span></h4>
<p>To list the ciphersuites in a priority string:
</p><div class="example">
<pre class="example-preformatted">$ ./gnutls-cli --priority SECURE192 -l
Cipher suites for SECURE192
TLS_ECDHE_ECDSA_AES_256_CBC_SHA384 0xc0, 0x24 TLS1.2
TLS_ECDHE_ECDSA_AES_256_GCM_SHA384 0xc0, 0x2e TLS1.2
TLS_ECDHE_RSA_AES_256_GCM_SHA384 0xc0, 0x30 TLS1.2
TLS_DHE_RSA_AES_256_CBC_SHA256 0x00, 0x6b TLS1.2
TLS_DHE_DSS_AES_256_CBC_SHA256 0x00, 0x6a TLS1.2
TLS_RSA_AES_256_CBC_SHA256 0x00, 0x3d TLS1.2
Certificate types: CTYPE-X.509
Protocols: VERS-TLS1.2, VERS-TLS1.1, VERS-TLS1.0, VERS-SSL3.0, VERS-DTLS1.0
Compression: COMP-NULL
Elliptic curves: CURVE-SECP384R1, CURVE-SECP521R1
PK-signatures: SIGN-RSA-SHA384, SIGN-ECDSA-SHA384, SIGN-RSA-SHA512, SIGN-ECDSA-SHA512
</pre></div>
<h4 class="subheading" id="Connecting-using-a-PKCS-_002311-token"><span>Connecting using a PKCS #11 token<a class="copiable-link" href="#Connecting-using-a-PKCS-_002311-token"> ¶</a></span></h4>
<p>To connect to a server using a certificate and a private key present in a PKCS #11 token you
need to substitute the PKCS 11 URLs in the x509certfile and x509keyfile parameters.
</p>
<p>Those can be found using "p11tool –list-tokens" and then listing all the objects in the
needed token, and using the appropriate.
</p><div class="example">
<pre class="example-preformatted">$ p11tool --list-tokens
Token 0:
URL: pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test
Label: Test
Manufacturer: EnterSafe
Model: PKCS15
Serial: 1234
$ p11tool --login --list-certs "pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test"
Object 0:
URL: pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test;object=client;type=cert
Type: X.509 Certificate
Label: client
ID: 2a:97:0d:58:d1:51:3c:23:07:ae:4e:0d:72:26:03:7d:99:06:02:6a
$ MYCERT="pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test;object=client;type=cert"
$ MYKEY="pkcs11:model=PKCS15;manufacturer=MyMan;serial=1234;token=Test;object=client;type=private"
$ export MYCERT MYKEY
$ gnutls-cli www.example.com --x509keyfile $MYKEY --x509certfile $MYCERT
</pre></div>
<p>Notice that the private key only differs from the certificate in the type.
</p><hr>
<a class="node" id="gnutls_002dserv-Invocation"></a><div class="nav-panel">
<p>
[<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="heading" id="Invoking-gnutls_002dserv"><span>Invoking gnutls-serv<a class="copiable-link" href="#Invoking-gnutls_002dserv"> ¶</a></span></h3>
<a class="index-entry-id" id="index-gnutls_002dserv"></a>
<p>Server program that listens to incoming TLS connections.
</p>
<a class="anchor" id="gnutls_002dserv-usage"></a><h4 class="subheading" id="gnutls_002dserv-help_002fusage-_0028_002d_003f_0029"><span>gnutls-serv help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#gnutls_002dserv-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-gnutls_002dserv-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">gnutls-serv - GnuTLS server
Usage: gnutls-serv [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
--sni-hostname=str Server's hostname for server name extension
--sni-hostname-fatal Send fatal alert on sni-hostname mismatch
--alpn=str Specify ALPN protocol to be enabled by the server
--alpn-fatal Send fatal alert on non-matching ALPN name
--noticket Don't accept session tickets
--earlydata Accept early data
--maxearlydata=num The maximum early data size to accept
- it must be in the range:
1 to 2147483648
--nocookie Don't require cookie on DTLS sessions
-g, --generate Generate Diffie-Hellman parameters
-q, --quiet Suppress some messages
--nodb Do not use a resumption database
--http Act as an HTTP server
--echo Act as an Echo server
--crlf Do not replace CRLF by LF in Echo server mode
-u, --udp Use DTLS (datagram TLS) over UDP
--mtu=num Set MTU for datagram TLS
- it must be in the range:
0 to 17000
--srtp-profiles=str Offer SRTP profiles
-a, --disable-client-cert Do not request a client certificate
- prohibits the option 'require-client-cert'
-r, --require-client-cert Require a client certificate
--verify-client-cert If a client certificate is sent then verify it
--compress-cert=str Compress certificate
-b, --heartbeat Activate heartbeat support
--x509fmtder Use DER format for certificates to read from
--priority=str Priorities string
--dhparams=file DH params file to use
- file must pre-exist
--x509cafile=str Certificate file or PKCS #11 URL to use
--x509crlfile=file CRL file to use
- file must pre-exist
--x509keyfile=str X.509 key file or PKCS #11 URL to use
--x509certfile=str X.509 Certificate file or PKCS #11 URL to use
--rawpkkeyfile=str Private key file (PKCS #8 or PKCS #12) or PKCS #11 URL to use
--rawpkfile=str Raw public-key file to use
- requires the option 'rawpkkeyfile'
--srppasswd=file SRP password file to use
- file must pre-exist
--srppasswdconf=file SRP password configuration file to use
- file must pre-exist
--pskpasswd=file PSK password file to use
- file must pre-exist
--pskhint=str PSK identity hint to use
--ocsp-response=str The OCSP response to send to client
--ignore-ocsp-response-errors Ignore any errors when setting the OCSP response
-p, --port=num The port to connect to
-l, --list Print a list of the supported algorithms and modes
--provider=file Specify the PKCS #11 provider library
- file must pre-exist
--keymatexport=str Label used for exporting keying material
--keymatexportsize=num Size of the exported keying material
--recordsize=num The maximum record size to advertise
- it must be in the range:
0 to 16384
--httpdata=file The data used as HTTP response
- file must pre-exist
--timeout=num The timeout period for server
--attime=str Perform validation at the timestamp instead of the system time
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Server program that listens to incoming TLS connections.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subheading" id="debug-option-_0028_002dd_0029_002e-1"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subheading" id="sni_002dhostname-option_002e-1"><span>sni-hostname option.<a class="copiable-link" href="#sni_002dhostname-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-sni_002dhostname"></a>
<p>This is the “server’s hostname for server name extension” option.
This option takes a ArgumentType.STRING argument.
Server name of type host_name that the server will recognise as its own. If the server receives client hello with different name, it will send a warning-level unrecognized_name alert.
</p><h4 class="subheading" id="alpn-option_002e-1"><span>alpn option.<a class="copiable-link" href="#alpn-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-alpn"></a>
<p>This is the “specify alpn protocol to be enabled by the server” option.
This option takes a ArgumentType.STRING argument.
Specify the (textual) ALPN protocol for the server to use.
</p><h4 class="subheading" id="require_002dclient_002dcert-option-_0028_002dr_0029_002e"><span>require-client-cert option (-r).<a class="copiable-link" href="#require_002dclient_002dcert-option-_0028_002dr_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-require_002dclient_002dcert"></a>
<p>This is the “require a client certificate” option.
This option before 3.6.0 used to imply –verify-client-cert.
Since 3.6.0 it will no longer verify the certificate by default.
</p><h4 class="subheading" id="verify_002dclient_002dcert-option_002e"><span>verify-client-cert option.<a class="copiable-link" href="#verify_002dclient_002dcert-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-verify_002dclient_002dcert"></a>
<p>This is the “if a client certificate is sent then verify it” option.
Do not require, but if a client certificate is sent then verify it and close the connection if invalid.
</p><h4 class="subheading" id="compress_002dcert-option_002e-1"><span>compress-cert option.<a class="copiable-link" href="#compress_002dcert-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-compress_002dcert"></a>
<p>This is the “compress certificate” option.
This option takes a ArgumentType.STRING argument.
This option sets a supported compression method for certificate compression.
</p><h4 class="subheading" id="heartbeat-option-_0028_002db_0029_002e"><span>heartbeat option (-b).<a class="copiable-link" href="#heartbeat-option-_0028_002db_0029_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-heartbeat"></a>
<p>This is the “activate heartbeat support” option.
Regularly ping client via heartbeat extension messages
</p><h4 class="subheading" id="priority-option_002e-1"><span>priority option.<a class="copiable-link" href="#priority-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-priority"></a>
<p>This is the “priorities string” option.
This option takes a ArgumentType.STRING argument.
TLS algorithms and protocols to enable. You can
use predefined sets of ciphersuites such as PERFORMANCE,
NORMAL, SECURE128, SECURE256. The default is NORMAL.
</p>
<p>Check the GnuTLS manual on section “Priority strings” for more
information on allowed keywords
</p><h4 class="subheading" id="x509keyfile-option_002e"><span>x509keyfile option.<a class="copiable-link" href="#x509keyfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-x509keyfile"></a>
<p>This is the “x.509 key file or pkcs #11 url to use” option.
This option takes a ArgumentType.STRING argument.
Specify the private key file or URI to use; it must correspond to
the certificate specified in –x509certfile. Multiple keys and certificates
can be specified with this option and in that case each occurrence of keyfile
must be followed by the corresponding x509certfile or vice-versa.
</p><h4 class="subheading" id="x509certfile-option_002e"><span>x509certfile option.<a class="copiable-link" href="#x509certfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-x509certfile"></a>
<p>This is the “x.509 certificate file or pkcs #11 url to use” option.
This option takes a ArgumentType.STRING argument.
Specify the certificate file or URI to use; it must correspond to
the key specified in –x509keyfile. Multiple keys and certificates
can be specified with this option and in that case each occurrence of keyfile
must be followed by the corresponding x509certfile or vice-versa.
</p><h4 class="subheading" id="x509dsakeyfile-option_002e"><span>x509dsakeyfile option.<a class="copiable-link" href="#x509dsakeyfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-x509dsakeyfile"></a>
<p>This is an alias for the <code class="code">x509keyfile</code> option,
see <a class="pxref" href="#gnutls_002dserv-x509keyfile">the x509keyfile option documentation</a>.
</p>
<h4 class="subheading" id="x509dsacertfile-option_002e"><span>x509dsacertfile option.<a class="copiable-link" href="#x509dsacertfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-x509dsacertfile"></a>
<p>This is an alias for the <code class="code">x509certfile</code> option,
see <a class="pxref" href="#gnutls_002dserv-x509certfile">the x509certfile option documentation</a>.
</p>
<h4 class="subheading" id="x509ecckeyfile-option_002e"><span>x509ecckeyfile option.<a class="copiable-link" href="#x509ecckeyfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-x509ecckeyfile"></a>
<p>This is an alias for the <code class="code">x509keyfile</code> option,
see <a class="pxref" href="#gnutls_002dserv-x509keyfile">the x509keyfile option documentation</a>.
</p>
<h4 class="subheading" id="x509ecccertfile-option_002e"><span>x509ecccertfile option.<a class="copiable-link" href="#x509ecccertfile-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-x509ecccertfile"></a>
<p>This is an alias for the <code class="code">x509certfile</code> option,
see <a class="pxref" href="#gnutls_002dserv-x509certfile">the x509certfile option documentation</a>.
</p>
<h4 class="subheading" id="rawpkkeyfile-option_002e-1"><span>rawpkkeyfile option.<a class="copiable-link" href="#rawpkkeyfile-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-rawpkkeyfile"></a>
<p>This is the “private key file (pkcs #8 or pkcs #12) or pkcs #11 url to use” option.
This option takes a ArgumentType.STRING argument.
Specify the private key file or URI to use; it must correspond to
the raw public-key specified in –rawpkfile. Multiple key pairs
can be specified with this option and in that case each occurrence of keyfile
must be followed by the corresponding rawpkfile or vice-versa.
</p>
<p>In order to instruct the application to negotiate raw public keys one
must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-*
and CTYPE-SRV-* flags).
</p>
<p>Check the GnuTLS manual on section “Priority strings” for more
information on how to set certificate types.
</p><h4 class="subheading" id="rawpkfile-option_002e-1"><span>rawpkfile option.<a class="copiable-link" href="#rawpkfile-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-rawpkfile"></a>
<p>This is the “raw public-key file to use” option.
This option takes a ArgumentType.STRING argument.
</p>
<p>This option has some usage constraints. It:
</p><ul class="itemize mark-bullet">
<li>must appear in combination with the following options:
rawpkkeyfile.
</li></ul>
<p>Specify the raw public-key file to use; it must correspond to
the private key specified in –rawpkkeyfile. Multiple key pairs
can be specified with this option and in that case each occurrence of keyfile
must be followed by the corresponding rawpkfile or vice-versa.
</p>
<p>In order to instruct the application to negotiate raw public keys one
must enable the respective certificate types via the priority strings (i.e. CTYPE-CLI-*
and CTYPE-SRV-* flags).
</p>
<p>Check the GnuTLS manual on section “Priority strings” for more
information on how to set certificate types.
</p><h4 class="subheading" id="ocsp_002dresponse-option_002e"><span>ocsp-response option.<a class="copiable-link" href="#ocsp_002dresponse-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-ocsp_002dresponse"></a>
<p>This is the “the ocsp response to send to client” option.
This option takes a ArgumentType.STRING argument.
If the client requested an OCSP response, return data from this file to the client.
</p><h4 class="subheading" id="ignore_002docsp_002dresponse_002derrors-option_002e"><span>ignore-ocsp-response-errors option.<a class="copiable-link" href="#ignore_002docsp_002dresponse_002derrors-option_002e"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-ignore_002docsp_002dresponse_002derrors"></a>
<p>This is the “ignore any errors when setting the ocsp response” option.
That option instructs gnutls to not attempt to match the provided OCSP responses with the certificates.
</p><h4 class="subheading" id="list-option-_0028_002dl_0029_002e-1"><span>list option (-l).<a class="copiable-link" href="#list-option-_0028_002dl_0029_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-list"></a>
<p>This is the “print a list of the supported algorithms and modes” option.
Print a list of the supported algorithms and modes. If a priority string is given then only the enabled ciphersuites are shown.
</p><h4 class="subheading" id="provider-option_002e-1"><span>provider option.<a class="copiable-link" href="#provider-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-provider"></a>
<p>This is the “specify the pkcs #11 provider library” option.
This option takes a ArgumentType.FILE argument.
This will override the default options in /etc/gnutls/pkcs11.conf
</p><h4 class="subheading" id="attime-option_002e-1"><span>attime option.<a class="copiable-link" href="#attime-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-attime"></a>
<p>This is the “perform validation at the timestamp instead of the system time” option.
This option takes a ArgumentType.STRING argument <samp class="file">timestamp</samp>.
timestamp is an instance in time encoded as Unix time or in a human
readable timestring such as "29 Feb 2004", "2004-02-29".
Full documentation available at
<https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html>
or locally via info ’(coreutils) date invocation’.
</p><h4 class="subheading" id="version-option-_0028_002dv_0029_002e-1"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subheading" id="help-option-_0028_002dh_0029_002e-1"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-1"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dserv-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="gnutls_002dserv-exit-status"></a></p><h4 class="subheading" id="gnutls_002dserv-exit-status-1"><span>gnutls-serv exit status<a class="copiable-link" href="#gnutls_002dserv-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="gnutls_002dserv-See-Also"></a><h4 class="subsubheading" id="gnutls_002dserv-See-Also-1"><span>gnutls-serv See Also<a class="copiable-link" href="#gnutls_002dserv-See-Also-1"> ¶</a></span></h4>
<p>gnutls-cli-debug(1), gnutls-cli(1)
<a class="anchor" id="gnutls_002dserv-Examples"></a></p><h4 class="subsubheading" id="gnutls_002dserv-Examples-1"><span>gnutls-serv Examples<a class="copiable-link" href="#gnutls_002dserv-Examples-1"> ¶</a></span></h4>
<p>Running your own TLS server based on GnuTLS can be useful when
debugging clients and/or GnuTLS itself. This section describes how to
use <code class="code">gnutls-serv</code> as a simple HTTPS server.
</p>
<p>The most basic server can be started as:
</p>
<div class="example">
<pre class="example-preformatted">gnutls-serv --http --priority "NORMAL:+ANON-ECDH:+ANON-DH"
</pre></div>
<p>It will only support anonymous ciphersuites, which many TLS clients
refuse to use.
</p>
<p>The next step is to add support for X.509. First we generate a CA:
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey > x509-ca-key.pem
$ echo 'cn = GnuTLS test CA' > ca.tmpl
$ echo 'ca' >> ca.tmpl
$ echo 'cert_signing_key' >> ca.tmpl
$ certtool --generate-self-signed --load-privkey x509-ca-key.pem \
--template ca.tmpl --outfile x509-ca.pem
</pre></div>
<p>Then generate a server certificate. Remember to change the dns_name
value to the name of your server host, or skip that command to avoid
the field.
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey > x509-server-key.pem
$ echo 'organization = GnuTLS test server' > server.tmpl
$ echo 'cn = test.gnutls.org' >> server.tmpl
$ echo 'tls_www_server' >> server.tmpl
$ echo 'encryption_key' >> server.tmpl
$ echo 'signing_key' >> server.tmpl
$ echo 'dns_name = test.gnutls.org' >> server.tmpl
$ certtool --generate-certificate --load-privkey x509-server-key.pem \
--load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem \
--template server.tmpl --outfile x509-server.pem
</pre></div>
<p>For use in the client, you may want to generate a client certificate
as well.
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey > x509-client-key.pem
$ echo 'cn = GnuTLS test client' > client.tmpl
$ echo 'tls_www_client' >> client.tmpl
$ echo 'encryption_key' >> client.tmpl
$ echo 'signing_key' >> client.tmpl
$ certtool --generate-certificate --load-privkey x509-client-key.pem \
--load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem \
--template client.tmpl --outfile x509-client.pem
</pre></div>
<p>To be able to import the client key/certificate into some
applications, you will need to convert them into a PKCS#12 structure.
This also encrypts the security sensitive key with a password.
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --to-p12 --load-ca-certificate x509-ca.pem \
--load-privkey x509-client-key.pem --load-certificate x509-client.pem \
--outder --outfile x509-client.p12
</pre></div>
<p>For icing, we’ll create a proxy certificate for the client too.
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey > x509-proxy-key.pem
$ echo 'cn = GnuTLS test client proxy' > proxy.tmpl
$ certtool --generate-proxy --load-privkey x509-proxy-key.pem \
--load-ca-certificate x509-client.pem --load-ca-privkey x509-client-key.pem \
--load-certificate x509-client.pem --template proxy.tmpl \
--outfile x509-proxy.pem
</pre></div>
<p>Then start the server again:
</p>
<div class="example">
<pre class="example-preformatted">$ gnutls-serv --http \
--x509cafile x509-ca.pem \
--x509keyfile x509-server-key.pem \
--x509certfile x509-server.pem
</pre></div>
<p>Try connecting to the server using your web browser. Note that the
server listens to port 5556 by default.
</p>
<p>While you are at it, to allow connections using ECDSA, you can also
create a ECDSA key and certificate for the server. These credentials
will be used in the final example below.
</p>
<div class="example">
<pre class="example-preformatted">$ certtool --generate-privkey --ecdsa > x509-server-key-ecc.pem
$ certtool --generate-certificate --load-privkey x509-server-key-ecc.pem \
--load-ca-certificate x509-ca.pem --load-ca-privkey x509-ca-key.pem \
--template server.tmpl --outfile x509-server-ecc.pem
</pre></div>
<p>The next step is to add support for SRP authentication. This requires
an SRP password file created with <code class="code">srptool</code>.
To start the server with SRP support:
</p>
<div class="example">
<pre class="example-preformatted">gnutls-serv --http --priority NORMAL:+SRP-RSA:+SRP \
--srppasswdconf srp-tpasswd.conf \
--srppasswd srp-passwd.txt
</pre></div>
<p>Let’s also start a server with support for PSK. This would require
a password file created with <code class="code">psktool</code>.
</p>
<div class="example">
<pre class="example-preformatted">gnutls-serv --http --priority NORMAL:+ECDHE-PSK:+PSK \
--pskpasswd psk-passwd.txt
</pre></div>
<p>If you want a server with support for raw public-keys we can also add these
credentials. Note however that there is no identity information linked to these
keys as is the case with regular x509 certificates. Authentication must be done
via different means. Also we need to explicitly enable raw public-key certificates
via the priority strings.
</p>
<div class="example">
<pre class="example-preformatted">gnutls-serv --http --priority NORMAL:+CTYPE-CLI-RAWPK:+CTYPE-SRV-RAWPK \
--rawpkfile srv.rawpk.pem \
--rawpkkeyfile srv.key.pem
</pre></div>
<p>Finally, we start the server with all the earlier parameters and you
get this command:
</p>
<div class="example">
<pre class="example-preformatted">gnutls-serv --http --priority NORMAL:+PSK:+SRP:+CTYPE-CLI-RAWPK:+CTYPE-SRV-RAWPK \
--x509cafile x509-ca.pem \
--x509keyfile x509-server-key.pem \
--x509certfile x509-server.pem \
--x509keyfile x509-server-key-ecc.pem \
--x509certfile x509-server-ecc.pem \
--srppasswdconf srp-tpasswd.conf \
--srppasswd srp-passwd.txt \
--pskpasswd psk-passwd.txt \
--rawpkfile srv.rawpk.pem \
--rawpkkeyfile srv.key.pem
</pre></div>
<hr>
<a class="node" id="gnutls_002dcli_002ddebug-Invocation"></a><div class="nav-panel">
<p>
[<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="heading" id="Invoking-gnutls_002dcli_002ddebug"><span>Invoking gnutls-cli-debug<a class="copiable-link" href="#Invoking-gnutls_002dcli_002ddebug"> ¶</a></span></h3>
<a class="index-entry-id" id="index-gnutls_002dcli_002ddebug"></a>
<p>TLS debug client. It sets up multiple TLS connections to
a server and queries its capabilities. It was created to assist in debugging
GnuTLS, but it might be useful to extract a TLS server’s capabilities.
It connects to a TLS server, performs tests and print the server’s
capabilities. If called with the ‘-V’ parameter more checks will be performed.
Can be used to check for servers with special needs or bugs.
</p>
<a class="anchor" id="gnutls_002dcli_002ddebug-usage"></a><h4 class="subheading" id="gnutls_002dcli_002ddebug-help_002fusage-_0028_002d_003f_0029"><span>gnutls-cli-debug help/usage (<samp class="option">-?</samp>)<a class="copiable-link" href="#gnutls_002dcli_002ddebug-help_002fusage-_0028_002d_003f_0029"> ¶</a></span></h4>
<a class="index-entry-id" id="index-gnutls_002dcli_002ddebug-help"></a>
<p>The text printed is the same whether selected with the <code class="code">help</code> option
(<samp class="option">--help</samp>) or the <code class="code">more-help</code> option (<samp class="option">--more-help</samp>). <code class="code">more-help</code> will print
the usage text by passing it through a pager program.
<code class="code">more-help</code> is disabled on platforms without a working
<code class="code">fork(2)</code> function. The <code class="code">PAGER</code> environment variable is
used to select the program, defaulting to <samp class="file">more</samp>. Both will exit
with a status code of 0.
</p>
<div class="example">
<pre class="example-preformatted">gnutls-cli-debug - GnuTLS debug client
Usage: gnutls-cli-debug [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostname]
None:
-d, --debug=num Enable debugging
- it must be in the range:
0 to 9999
-V, --verbose More verbose output
-p, --port=num The port to connect to
- it must be in the range:
0 to 65536
--app-proto an alias for the 'starttls-proto' option
--starttls-proto=str The application protocol to be used to obtain the server's certificate (https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres)
--attime=str Perform validation at the timestamp instead of the system time
Version, usage and configuration options:
-v, --version[=arg] output version information and exit
-h, --help display extended usage information and exit
-!, --more-help extended usage information passed thru pager
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
Operands and options may be intermixed. They will be reordered.
TLS debug client. It sets up multiple TLS connections to
a server and queries its capabilities. It was created to assist in debugging
GnuTLS, but it might be useful to extract a TLS server's capabilities.
It connects to a TLS server, performs tests and print the server's
capabilities. If called with the `-V' parameter more checks will be performed.
Can be used to check for servers with special needs or bugs.
Please send bug reports to: <bugs@gnutls.org>
</pre></div>
<h4 class="subheading" id="debug-option-_0028_002dd_0029_002e-2"><span>debug option (-d).<a class="copiable-link" href="#debug-option-_0028_002dd_0029_002e-2"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli_002ddebug-debug"></a>
<p>This is the “enable debugging” option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
</p><h4 class="subheading" id="app_002dproto-option_002e-1"><span>app-proto option.<a class="copiable-link" href="#app_002dproto-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli_002ddebug-app_002dproto"></a>
<p>This is an alias for the <code class="code">starttls-proto</code> option,
see <a class="pxref" href="#gnutls_002dcli_002ddebug-starttls_002dproto">the starttls-proto option documentation</a>.
</p>
<h4 class="subheading" id="starttls_002dproto-option_002e-1"><span>starttls-proto option.<a class="copiable-link" href="#starttls_002dproto-option_002e-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli_002ddebug-starttls_002dproto"></a>
<p>This is the “the application protocol to be used to obtain the server’s certificate (https, ftp, smtp, imap, ldap, xmpp, lmtp, pop3, nntp, sieve, postgres)” option.
This option takes a ArgumentType.STRING argument.
Specify the application layer protocol for STARTTLS. If the protocol is supported, gnutls-cli will proceed to the TLS negotiation.
</p><h4 class="subheading" id="attime-option_002e-2"><span>attime option.<a class="copiable-link" href="#attime-option_002e-2"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli_002ddebug-attime"></a>
<p>This is the “perform validation at the timestamp instead of the system time” option.
This option takes a ArgumentType.STRING argument <samp class="file">timestamp</samp>.
timestamp is an instance in time encoded as Unix time or in a human
readable timestring such as "29 Feb 2004", "2004-02-29".
Full documentation available at
<https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html>
or locally via info ’(coreutils) date invocation’.
</p><h4 class="subheading" id="version-option-_0028_002dv_0029_002e-2"><span>version option (-v).<a class="copiable-link" href="#version-option-_0028_002dv_0029_002e-2"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli_002ddebug-version"></a>
<p>This is the “output version information and exit” option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit. The default mode is ‘v’, a simple
version. The ‘c’ mode will print copyright information and ‘n’ will
print the full copyright notice.
</p><h4 class="subheading" id="help-option-_0028_002dh_0029_002e-2"><span>help option (-h).<a class="copiable-link" href="#help-option-_0028_002dh_0029_002e-2"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli_002ddebug-help"></a>
<p>This is the “display extended usage information and exit” option.
Display usage information and exit.
</p><h4 class="subheading" id="more_002dhelp-option-_0028_002d_0021_0029_002e-2"><span>more-help option (-!).<a class="copiable-link" href="#more_002dhelp-option-_0028_002d_0021_0029_002e-2"> ¶</a></span></h4>
<a class="anchor" id="gnutls_002dcli_002ddebug-more_002dhelp"></a>
<p>This is the “extended usage information passed thru pager” option.
Pass the extended usage information through a pager.
<a class="anchor" id="gnutls_002dcli_002ddebug-exit-status"></a></p><h4 class="subheading" id="gnutls_002dcli_002ddebug-exit-status-1"><span>gnutls-cli-debug exit status<a class="copiable-link" href="#gnutls_002dcli_002ddebug-exit-status-1"> ¶</a></span></h4>
<p>One of the following exit values will be returned:
</p><dl class="table">
<dt>‘<samp class="samp">0 (EXIT_SUCCESS)</samp>’</dt>
<dd><p>Successful program execution.
</p></dd>
<dt>‘<samp class="samp">1 (EXIT_FAILURE)</samp>’</dt>
<dd><p>The operation failed or the command syntax was not valid.
</p></dd>
</dl>
<a class="anchor" id="gnutls_002dcli_002ddebug-See-Also"></a><h4 class="subsubheading" id="gnutls_002dcli_002ddebug-See-Also-1"><span>gnutls-cli-debug See Also<a class="copiable-link" href="#gnutls_002dcli_002ddebug-See-Also-1"> ¶</a></span></h4>
<p>gnutls-cli(1), gnutls-serv(1)
<a class="anchor" id="gnutls_002dcli_002ddebug-Examples"></a></p><h4 class="subsubheading" id="gnutls_002dcli_002ddebug-Examples-1"><span>gnutls-cli-debug Examples<a class="copiable-link" href="#gnutls_002dcli_002ddebug-Examples-1"> ¶</a></span></h4>
<div class="example">
<pre class="example-preformatted">$ gnutls-cli-debug localhost
GnuTLS debug client 3.5.0
Checking localhost:443
for SSL 3.0 (RFC6101) support... yes
whether we need to disable TLS 1.2... no
whether we need to disable TLS 1.1... no
whether we need to disable TLS 1.0... no
whether %NO_EXTENSIONS is required... no
whether %COMPAT is required... no
for TLS 1.0 (RFC2246) support... yes
for TLS 1.1 (RFC4346) support... yes
for TLS 1.2 (RFC5246) support... yes
fallback from TLS 1.6 to... TLS1.2
for RFC7507 inappropriate fallback... yes
for HTTPS server name... Local
for certificate chain order... sorted
for safe renegotiation (RFC5746) support... yes
for Safe renegotiation support (SCSV)... no
for encrypt-then-MAC (RFC7366) support... no
for ext master secret (RFC7627) support... no
for heartbeat (RFC6520) support... no
for version rollback bug in RSA PMS... dunno
for version rollback bug in Client Hello... no
whether the server ignores the RSA PMS version... yes
whether small records (512 bytes) are tolerated on handshake... yes
whether cipher suites not in SSL 3.0 spec are accepted... yes
whether a bogus TLS record version in the client hello is accepted... yes
whether the server understands TLS closure alerts... partially
whether the server supports session resumption... yes
for anonymous authentication support... no
for ephemeral Diffie-Hellman support... no
for ephemeral EC Diffie-Hellman support... yes
ephemeral EC Diffie-Hellman group info... SECP256R1
for AES-128-GCM cipher (RFC5288) support... yes
for AES-128-CCM cipher (RFC6655) support... no
for AES-128-CCM-8 cipher (RFC6655) support... no
for AES-128-CBC cipher (RFC3268) support... yes
for CAMELLIA-128-GCM cipher (RFC6367) support... no
for CAMELLIA-128-CBC cipher (RFC5932) support... no
for 3DES-CBC cipher (RFC2246) support... yes
for ARCFOUR 128 cipher (RFC2246) support... yes
for MD5 MAC support... yes
for SHA1 MAC support... yes
for SHA256 MAC support... yes
for ZLIB compression support... no
for max record size (RFC6066) support... no
for OCSP status response (RFC6066) support... no
for OpenPGP authentication (RFC6091) support... no
</pre></div>
<p>You could also use the client to debug services with starttls capability.
</p><div class="example">
<pre class="example-preformatted">$ gnutls-cli-debug --starttls-proto smtp --port 25 localhost
</pre></div>
<hr>
</div>
<div class="chapter-level-extent" id="Internal-architecture-of-GnuTLS">
<div class="nav-panel">
<p>
Next: <a href="#Upgrading-from-previous-versions" accesskey="n" rel="next">Upgrading from previous versions</a>, Previous: <a href="#Other-included-programs" accesskey="p" rel="prev">Other included programs</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="chapter" id="Internal-Architecture-of-GnuTLS"><span>11 Internal Architecture of GnuTLS<a class="copiable-link" href="#Internal-Architecture-of-GnuTLS"> ¶</a></span></h2>
<a class="index-entry-id" id="index-internal-architecture"></a>
<p>This chapter is to give a brief description of the
way <abbr class="acronym">GnuTLS</abbr> works. The focus is to give an idea
to potential developers and those who want to know what
happens inside the black box.
</p>
<ul class="mini-toc">
<li><a href="#The-TLS-Protocol" accesskey="1">The TLS Protocol</a></li>
<li><a href="#TLS-Handshake-Protocol" accesskey="2">TLS Handshake Protocol</a></li>
<li><a href="#TLS-Authentication-Methods" accesskey="3">TLS Authentication Methods</a></li>
<li><a href="#TLS-Hello-Extension-Handling" accesskey="4">TLS Extension Handling</a></li>
<li><a href="#Cryptographic-Backend" accesskey="5">Cryptographic Backend</a></li>
<li><a href="#Random-Number-Generators_002dinternals" accesskey="6">Random Number Generators</a></li>
<li><a href="#FIPS140_002d2-mode" accesskey="7">FIPS140-2 mode</a></li>
</ul>
<hr>
<div class="section-level-extent" id="The-TLS-Protocol">
<div class="nav-panel">
<p>
Next: <a href="#TLS-Handshake-Protocol" accesskey="n" rel="next">TLS Handshake Protocol</a>, Up: <a href="#Internal-architecture-of-GnuTLS" accesskey="u" rel="up">Internal Architecture of GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="The-TLS-Protocol-1"><span>11.1 The TLS Protocol<a class="copiable-link" href="#The-TLS-Protocol-1"> ¶</a></span></h3>
<p>The main use case for the TLS protocol is shown in <a class="ref" href="#fig_002dclient_002dserver">Figure 11.1</a>.
A user of a library implementing the protocol expects no less than this functionality,
i.e., to be able to set parameters such as the accepted security level, perform a
negotiation with the peer and be able to exchange data.
</p>
<div class="float" id="fig_002dclient_002dserver">
<img class="image" src="gnutls-client-server-use-case.png" alt="gnutls-client-server-use-case">
<div class="caption"><p><strong class="strong">Figure 11.1: </strong>TLS protocol use case.</p></div></div>
<hr>
</div>
<div class="section-level-extent" id="TLS-Handshake-Protocol">
<div class="nav-panel">
<p>
Next: <a href="#TLS-Authentication-Methods" accesskey="n" rel="next">TLS Authentication Methods</a>, Previous: <a href="#The-TLS-Protocol" accesskey="p" rel="prev">The TLS Protocol</a>, Up: <a href="#Internal-architecture-of-GnuTLS" accesskey="u" rel="up">Internal Architecture of GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="TLS-Handshake-Protocol-1"><span>11.2 TLS Handshake Protocol<a class="copiable-link" href="#TLS-Handshake-Protocol-1"> ¶</a></span></h3>
<p>The <abbr class="acronym">GnuTLS</abbr> handshake protocol is implemented as a state
machine that waits for input or returns immediately when the non-blocking
transport layer functions are used. The main idea is shown in <a class="ref" href="#fig_002dgnutls_002dhandshake">Figure 11.2</a>.
</p>
<div class="float" id="fig_002dgnutls_002dhandshake">
<img class="image" src="gnutls-handshake-state.png" alt="gnutls-handshake-state">
<div class="caption"><p><strong class="strong">Figure 11.2: </strong>GnuTLS handshake state machine.</p></div></div>
<p>Also the way the input is processed varies per ciphersuite. Several
implementations of the internal handlers are available and
<a class="ref" href="#gnutls_005fhandshake">gnutls_handshake</a> only multiplexes the input to the appropriate
handler. For example a <abbr class="acronym">PSK</abbr> ciphersuite has a different
implementation of the <code class="code">process_client_key_exchange</code> than a
certificate ciphersuite. We illustrate the idea in <a class="ref" href="#fig_002dgnutls_002dhandshake_002dsequence">Figure 11.3</a>.
</p>
<div class="float" id="fig_002dgnutls_002dhandshake_002dsequence">
<img class="image" src="gnutls-handshake-sequence.png" alt="gnutls-handshake-sequence">
<div class="caption"><p><strong class="strong">Figure 11.3: </strong>GnuTLS handshake process sequence.</p></div></div>
<hr>
</div>
<div class="section-level-extent" id="TLS-Authentication-Methods">
<div class="nav-panel">
<p>
Next: <a href="#TLS-Hello-Extension-Handling" accesskey="n" rel="next">TLS Extension Handling</a>, Previous: <a href="#TLS-Handshake-Protocol" accesskey="p" rel="prev">TLS Handshake Protocol</a>, Up: <a href="#Internal-architecture-of-GnuTLS" accesskey="u" rel="up">Internal Architecture of GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="TLS-Authentication-Methods-1"><span>11.3 TLS Authentication Methods<a class="copiable-link" href="#TLS-Authentication-Methods-1"> ¶</a></span></h3>
<p>In <abbr class="acronym">GnuTLS</abbr> authentication methods can be implemented quite
easily. Since the required changes to add a new authentication method
affect only the handshake protocol, a simple interface is used. An
authentication method needs to implement the functions shown below.
</p>
<pre class="verbatim">typedef struct
{
const char *name;
int (*gnutls_generate_server_certificate) (gnutls_session_t, gnutls_buffer_st*);
int (*gnutls_generate_client_certificate) (gnutls_session_t, gnutls_buffer_st*);
int (*gnutls_generate_server_kx) (gnutls_session_t, gnutls_buffer_st*);
int (*gnutls_generate_client_kx) (gnutls_session_t, gnutls_buffer_st*);
int (*gnutls_generate_client_cert_vrfy) (gnutls_session_t, gnutls_buffer_st *);
int (*gnutls_generate_server_certificate_request) (gnutls_session_t,
gnutls_buffer_st *);
int (*gnutls_process_server_certificate) (gnutls_session_t, opaque *,
size_t);
int (*gnutls_process_client_certificate) (gnutls_session_t, opaque *,
size_t);
int (*gnutls_process_server_kx) (gnutls_session_t, opaque *, size_t);
int (*gnutls_process_client_kx) (gnutls_session_t, opaque *, size_t);
int (*gnutls_process_client_cert_vrfy) (gnutls_session_t, opaque *, size_t);
int (*gnutls_process_server_certificate_request) (gnutls_session_t,
opaque *, size_t);
} mod_auth_st;
</pre>
<p>Those functions are responsible for the
interpretation of the handshake protocol messages. It is common for such
functions to read data from one or more <code class="code">credentials_t</code>
structures<a class="footnote" id="DOCF23" href="#FOOT23"><sup>23</sup></a> and write data,
such as certificates, usernames etc. to <code class="code">auth_info_t</code> structures.
</p>
<p>Simple examples of existing authentication methods can be seen in
<code class="code">auth/psk.c</code> for PSK ciphersuites and <code class="code">auth/srp.c</code> for SRP
ciphersuites. After implementing these functions the structure holding
its pointers has to be registered in <code class="code">gnutls_algorithms.c</code> in the
<code class="code">_gnutls_kx_algorithms</code> structure.
</p>
<hr>
</div>
<div class="section-level-extent" id="TLS-Hello-Extension-Handling">
<div class="nav-panel">
<p>
Next: <a href="#Cryptographic-Backend" accesskey="n" rel="next">Cryptographic Backend</a>, Previous: <a href="#TLS-Authentication-Methods" accesskey="p" rel="prev">TLS Authentication Methods</a>, Up: <a href="#Internal-architecture-of-GnuTLS" accesskey="u" rel="up">Internal Architecture of GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="TLS-Extension-Handling"><span>11.4 TLS Extension Handling<a class="copiable-link" href="#TLS-Extension-Handling"> ¶</a></span></h3>
<p>As with authentication methods, adding TLS hello extensions can be done
quite easily by implementing the interface shown below.
</p>
<pre class="verbatim">typedef int (*gnutls_ext_recv_func) (gnutls_session_t session,
const unsigned char *data, size_t len);
typedef int (*gnutls_ext_send_func) (gnutls_session_t session,
gnutls_buffer_st *extdata);
</pre>
<p>Here there are two main functions, one for parsing the received extension data
and one for formatting the extension data that must be send. These functions
have to check internally whether they operate within a client or a server session.
</p>
<p>A simple example of an extension handler can be seen in
<code class="code">lib/ext/srp.c</code> in GnuTLS’ source code. After implementing these functions,
the extension has to be registered. Registering an extension can be done in two
ways. You can create a GnuTLS internal extension and register it in
<code class="code">hello_ext.c</code> or write an external extension (not inside GnuTLS but
inside an application using GnuTLS) and register it via the exported functions
<a class="ref" href="#gnutls_005fsession_005fext_005fregister">gnutls_session_ext_register</a> or <a class="ref" href="#gnutls_005fext_005fregister">gnutls_ext_register</a>.
</p>
<h4 class="subheading" id="Adding-a-new-TLS-hello-extension"><span>Adding a new TLS hello extension<a class="copiable-link" href="#Adding-a-new-TLS-hello-extension"> ¶</a></span></h4>
<p>Adding support for a new TLS hello extension is done from time to time, and
the process to do so is not difficult. Here are the steps you need to
follow if you wish to do this yourself. For the sake of discussion, let’s
consider adding support for the hypothetical TLS extension <code class="code">foobar</code>.
The following section is about adding an hello extension to GnuTLS itself.
For custom application extensions you should check the exported functions
<a class="ref" href="#gnutls_005fsession_005fext_005fregister">gnutls_session_ext_register</a> or <a class="ref" href="#gnutls_005fext_005fregister">gnutls_ext_register</a>.
</p>
<h4 class="subsubheading" id="Add-configure-option-like-_002d_002denable_002dfoobar-or-_002d_002ddisable_002dfoobar_002e"><span>Add <code class="code">configure</code> option like <code class="code">--enable-foobar</code> or <code class="code">--disable-foobar</code>.<a class="copiable-link" href="#Add-configure-option-like-_002d_002denable_002dfoobar-or-_002d_002ddisable_002dfoobar_002e"> ¶</a></span></h4>
<p>This step is useful when the extension code is large and it might be desirable
under some circumstances to be able to leave out the extension during compilation of GnuTLS.
If you don’t need this kind of feature this step can be safely skipped.
</p>
<p>Whether to choose enable or disable depends on whether you intend to make the extension be
enabled by default. Look at existing checks (i.e., SRP, authz) for
how to model the code. For example:
</p>
<div class="example">
<pre class="example-preformatted">AC_MSG_CHECKING([whether to disable foobar support])
AC_ARG_ENABLE(foobar,
AS_HELP_STRING([--disable-foobar],
[disable foobar support]),
ac_enable_foobar=no)
if test x$ac_enable_foobar != xno; then
AC_MSG_RESULT(no)
AC_DEFINE(ENABLE_FOOBAR, 1, [enable foobar])
else
ac_full=0
AC_MSG_RESULT(yes)
fi
AM_CONDITIONAL(ENABLE_FOOBAR, test "$ac_enable_foobar" != "no")
</pre></div>
<p>These lines should go in <code class="code">lib/m4/hooks.m4</code>.
</p>
<h4 class="subsubheading" id="Add-an-extension-identifier-to-extensions_005ft-in-gnutls_005fint_002eh_002e"><span>Add an extension identifier to <code class="code">extensions_t</code> in <code class="code">gnutls_int.h</code>.<a class="copiable-link" href="#Add-an-extension-identifier-to-extensions_005ft-in-gnutls_005fint_002eh_002e"> ¶</a></span></h4>
<p>A good name for the identifier would be GNUTLS_EXTENSION_FOOBAR. If the
extension that you are implementing is an extension that is officially
registered by IANA then it is recommended to use its official name such
that the extension can be correctly identified by other developers. Check
with <a class="url" href="https://www.iana.org/assignments/tls-extensiontype-values">https://www.iana.org/assignments/tls-extensiontype-values</a>
for registered extensions.
</p>
<h4 class="subsubheading" id="Register-the-extension-in-lib_002fhello_005fext_002ec_002e"><span>Register the extension in <code class="code">lib/hello_ext.c</code>.<a class="copiable-link" href="#Register-the-extension-in-lib_002fhello_005fext_002ec_002e"> ¶</a></span></h4>
<p>In order for the extension to be executed you need to register it in the
<code class="code">static hello_ext_entry_st const *extfunc[]</code> list in <code class="code">lib/hello_ext.c</code>.
</p>
<p>A typical entry would be:
</p>
<div class="example">
<pre class="example-preformatted">#ifdef ENABLE_FOOBAR
[GNUTLS_EXTENSION_FOOBAR] = &ext_mod_foobar,
#endif
</pre></div>
<p>Also for every extension you need to create an <code class="code">hello_ext_entry_st</code>
that describes the extension. This structure is placed in the designated
c file for your extension and its name is used in the registration entry
as depicted above.
</p>
<p>The structure of <code class="code">hello_ext_entry_st</code> is as follows:
</p><div class="example">
<pre class="example-preformatted"> const hello_ext_entry_st ext_mod_foobar = {
.name = "FOOBAR",
.tls_id = 255,
.gid = GNUTLS_EXTENSION_FOOBAR,
.parse_type = GNUTLS_EXT_TLS,
.validity = GNUTLS_EXT_FLAG_CLIENT_HELLO |
GNUTLS_EXT_FLAG_TLS12_SERVER_HELLO |
GNUTLS_EXT_FLAG_TLS13_SERVER_HELLO |
GNUTLS_EXT_FLAG_TLS,
.recv_func = _gnutls_foobar_recv_params,
.send_func = _gnutls_foobar_send_params,
.pack_func = _gnutls_foobar_pack,
.unpack_func = _gnutls_foobar_unpack,
.deinit_func = _gnutls_foobar_deinit,
.cannot_be_overriden = 1
};
</pre></div>
<p>The GNUTLS_EXTENSION_FOOBAR is the identifier that you’ve added to
<code class="code">gnutls_int.h</code> earlier. The <code class="code">.tls_id</code> should contain the number
that IANA has assigned to this extension, or an unassigned number of your
choice if this is an unregistered extension. In the rest of this structure
you specify the functions to handle the extension data. The <code class="code">receive</code> function
will be called upon reception of the data and will be used to parse or
interpret the extension data. The <code class="code">send</code> function will be called prior to
sending the extension data on the wire and will be used to format the data
such that it can be send over the wire. The <code class="code">pack</code> and <code class="code">unpack</code>
functions will be used to prepare the data for storage in case of session resumption
(and vice versa). The <code class="code">deinit</code> function will be called to deinitialize
the extension’s private parameters, if any.
</p>
<p>Look at <code class="code">gnutls_ext_parse_type_t</code> and <code class="code">gnutls_ext_flags_t</code> for a complete
list of available flags.
</p>
<p>Note that the conditional <code class="code">ENABLE_FOOBAR</code> definition should only be
used if step 1 with the <code class="code">configure</code> options has taken place.
</p>
<h4 class="subsubheading" id="Add-new-files-that-implement-the-hello-extension_002e"><span>Add new files that implement the hello extension.<a class="copiable-link" href="#Add-new-files-that-implement-the-hello-extension_002e"> ¶</a></span></h4>
<p>To keep things structured every extension should have its own files. The
functions that you should (at least) add are those referenced in the struct
from the previous step. Use descriptive file names such as <code class="code">lib/ext/foobar.c</code>
and for the corresponding header <code class="code">lib/ext/foobar.h</code>.
As a starter, you could add this:
</p>
<div class="example">
<pre class="example-preformatted">int
_gnutls_foobar_recv_params (gnutls_session_t session, const uint8_t * data,
size_t data_size)
{
return 0;
}
int
_gnutls_foobar_send_params (gnutls_session_t session, gnutls_buffer_st* data)
{
return 0;
}
int
_gnutls_foobar_pack (extension_priv_data_t epriv, gnutls_buffer_st * ps)
{
/* Append the extension's internal state to buffer */
return 0;
}
int
_gnutls_foobar_unpack (gnutls_buffer_st * ps, extension_priv_data_t * epriv)
{
/* Read the internal state from buffer */
return 0;
}
</pre></div>
<p>The <code class="code">_gnutls_foobar_recv_params</code> function is responsible for
parsing incoming extension data (both in the client and server).
</p>
<p>The <code class="code">_gnutls_foobar_send_params</code> function is responsible for
formatting extension data such that it can be send over the wire (both in
the client and server). It should append data to provided buffer and
return a positive (or zero) number on success or a negative error code.
Previous to 3.6.0 versions of GnuTLS required that function to return the
number of bytes that were written. If zero is returned and no bytes are
appended the extension will not be sent. If a zero byte extension is to
be sent this function must return <code class="code">GNUTLS_E_INT_RET_0</code>.
</p>
<p>If you receive length fields that don’t match, return
<code class="code">GNUTLS_E_UNEXPECTED_PACKET_LENGTH</code>. If you receive invalid
data, return <code class="code">GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER</code>. You can use
other error codes from the list in <a class="ref" href="#Error-codes">Error Codes and Descriptions</a>. Return 0 on success.
</p>
<p>An extension typically stores private information in the <code class="code">session</code>
data for later usage. That can be done using the functions
<code class="code">_gnutls_hello_ext_set_datum</code> and
<code class="code">_gnutls_hello_ext_get_datum</code>. You can check simple examples
at <code class="code">lib/ext/max_record.c</code> and <code class="code">lib/ext/server_name.c</code> extensions.
That private information can be saved and restored across session
resumption if the following functions are set:
</p>
<p>The <code class="code">_gnutls_foobar_pack</code> function is responsible for packing
internal extension data to save them in the session resumption storage.
</p>
<p>The <code class="code">_gnutls_foobar_unpack</code> function is responsible for
restoring session data from the session resumption storage.
</p>
<p>When the internal data is stored using the <code class="code">_gnutls_hello_ext_set_datum</code>,
then you can rely on the default pack and unpack functions:
<code class="code">_gnutls_hello_ext_default_pack</code> and
<code class="code">_gnutls_hello_ext_default_unpack</code>.
</p>
<p>Recall that both for the client and server, the send and receive
functions most likely will need to do different things
depending on which mode they are in. It may be useful to make this
distinction explicit in the code. Thus, for example, a better
template than above would be:
</p>
<div class="example">
<pre class="example-preformatted">int
_gnutls_foobar_recv_params (gnutls_session_t session,
const uint8_t * data,
size_t data_size)
{
if (session->security_parameters.entity == GNUTLS_CLIENT)
return foobar_recv_client (session, data, data_size);
else
return foobar_recv_server (session, data, data_size);
}
int
_gnutls_foobar_send_params (gnutls_session_t session,
gnutls_buffer_st * data)
{
if (session->security_parameters.entity == GNUTLS_CLIENT)
return foobar_send_client (session, data);
else
return foobar_send_server (session, data);
}
</pre></div>
<p>The functions used would be declared as <code class="code">static</code> functions, of
the appropriate prototype, in the same file.
</p>
<p>When adding the new extension files, you’ll need to add them to <code class="code">lib/ext/Makefile.am</code>
as well, for example:
</p>
<div class="example">
<pre class="example-preformatted">if ENABLE_FOOBAR
libgnutls_ext_la_SOURCES += ext/foobar.c ext/foobar.h
endif
</pre></div>
<h4 class="subsubheading" id="Add-API-functions-to-use-the-extension_002e"><span>Add API functions to use the extension.<a class="copiable-link" href="#Add-API-functions-to-use-the-extension_002e"> ¶</a></span></h4>
<p>It might be desirable to allow users of the extension to
request the use of the extension, or set extension specific data.
This can be implemented by adding extension specific function calls
that can be added to <code class="code">includes/gnutls/gnutls.h</code>,
as long as the LGPLv2.1+ applies.
The implementation of these functions should lie in the <code class="code">lib/ext/foobar.c</code> file.
</p>
<p>To make the API available in the shared library you need to add the added
symbols in <code class="code">lib/libgnutls.map</code>, so that the symbols are exported properly.
</p>
<p>When writing GTK-DOC style documentation for your new APIs, don’t
forget to add <code class="code">Since:</code> tags to indicate the GnuTLS version the
API was introduced in.
</p>
<h4 class="subheading" id="Adding-a-new-Supplemental-Data-Handshake-Message"><span>Adding a new Supplemental Data Handshake Message<a class="copiable-link" href="#Adding-a-new-Supplemental-Data-Handshake-Message"> ¶</a></span></h4>
<p>TLS handshake extensions allow to send so called supplemental data
handshake messages [<a class="ref" href="#RFC4680">RFC4680</a>]. This short section explains how to
implement a supplemental data handshake message for a given TLS extension.
</p>
<p>First of all, modify your extension <code class="code">foobar</code> in the way, to instruct
the handshake process to send and receive supplemental data, as shown below.
</p>
<div class="example">
<pre class="example-preformatted">int
_gnutls_foobar_recv_params (gnutls_session_t session, const opaque * data,
size_t _data_size)
{
...
gnutls_supplemental_recv(session, 1);
...
}
int
_gnutls_foobar_send_params (gnutls_session_t session, gnutls_buffer_st *extdata)
{
...
gnutls_supplemental_send(session, 1);
...
}
</pre></div>
<p>Furthermore you’ll need two new functions <code class="code">_foobar_supp_recv_params</code>
and <code class="code">_foobar_supp_send_params</code>, which must conform to the following
prototypes.
</p>
<div class="example">
<pre class="example-preformatted">typedef int (*gnutls_supp_recv_func)(gnutls_session_t session,
const unsigned char *data,
size_t data_size);
typedef int (*gnutls_supp_send_func)(gnutls_session_t session,
gnutls_buffer_t buf);
</pre></div>
<p>The following example code shows how to send a
“Hello World” string in the supplemental data handshake message.
</p>
<div class="example">
<pre class="example-preformatted">int
_foobar_supp_recv_params(gnutls_session_t session, const opaque *data, size_t _data_size)
{
uint8_t len = _data_size;
unsigned char *msg;
msg = gnutls_malloc(len);
if (msg == NULL) return GNUTLS_E_MEMORY_ERROR;
memcpy(msg, data, len);
msg[len]='\0';
/* do something with msg */
gnutls_free(msg);
return len;
}
int
_foobar_supp_send_params(gnutls_session_t session, gnutls_buffer_t buf)
{
unsigned char *msg = "hello world";
int len = strlen(msg);
if (gnutls_buffer_append_data(buf, msg, len) < 0)
abort();
return len;
}
</pre></div>
<p>Afterwards, register the new supplemental data using <a class="ref" href="#gnutls_005fsession_005fsupplemental_005fregister">gnutls_session_supplemental_register</a>,
or <a class="ref" href="#gnutls_005fsupplemental_005fregister">gnutls_supplemental_register</a> at some point in your program.
</p>
<hr>
</div>
<div class="section-level-extent" id="Cryptographic-Backend">
<div class="nav-panel">
<p>
Next: <a href="#Random-Number-Generators_002dinternals" accesskey="n" rel="next">Random Number Generators</a>, Previous: <a href="#TLS-Hello-Extension-Handling" accesskey="p" rel="prev">TLS Extension Handling</a>, Up: <a href="#Internal-architecture-of-GnuTLS" accesskey="u" rel="up">Internal Architecture of GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Cryptographic-Backend-1"><span>11.5 Cryptographic Backend<a class="copiable-link" href="#Cryptographic-Backend-1"> ¶</a></span></h3>
<p>Today most new processors, either for embedded or desktop systems
include either instructions intended to speed up cryptographic operations,
or a co-processor with cryptographic capabilities. Taking advantage of
those is a challenging task for every cryptographic application or
library. GnuTLS handles the cryptographic provider in a modular
way, following a layered approach to access
cryptographic operations as in <a class="ref" href="#fig_002dcrypto_002dlayers">Figure 11.4</a>.
</p>
<div class="float" id="fig_002dcrypto_002dlayers">
<img class="image" src="gnutls-crypto-layers.png" alt="gnutls-crypto-layers">
<div class="caption"><p><strong class="strong">Figure 11.4: </strong>GnuTLS cryptographic back-end design.</p></div></div>
<p>The TLS layer uses a cryptographic provider layer, that will in turn either
use the default crypto provider – a software crypto library, or use an external
crypto provider, if available in the local system. The reason of handling
the external cryptographic provider in GnuTLS and not delegating it to
the cryptographic libraries, is that none of the supported cryptographic
libraries support <code class="code">/dev/crypto</code> or CPU-optimized cryptography in
an efficient way.
</p>
<h4 class="subheading" id="Cryptographic-library-layer"><span>Cryptographic library layer<a class="copiable-link" href="#Cryptographic-library-layer"> ¶</a></span></h4>
<p>The Cryptographic library layer, currently supports only
libnettle. Older versions of GnuTLS used to support libgcrypt,
but it was switched with nettle mainly for performance reasons<a class="footnote" id="DOCF24" href="#FOOT24"><sup>24</sup></a>
and secondary because it is a simpler library to use.
In the future other cryptographic libraries might be supported as well.
</p>
<h4 class="subheading" id="External-cryptography-provider"><span>External cryptography provider<a class="copiable-link" href="#External-cryptography-provider"> ¶</a></span></h4>
<p>Systems that include a cryptographic co-processor, typically come with
kernel drivers to utilize the operations from software. For this reason
GnuTLS provides a layer where each individual algorithm used can be replaced
by another implementation, i.e., the one provided by the driver. The
FreeBSD, OpenBSD and Linux kernels<a class="footnote" id="DOCF25" href="#FOOT25"><sup>25</sup></a> include already
a number of hardware assisted implementations, and also provide an interface
to access them, called <code class="code">/dev/crypto</code>.
GnuTLS will take advantage of this interface if compiled with special
options. That is because in most systems where hardware-assisted
cryptographic operations are not available, using this interface might
actually harm performance.
</p>
<p>In systems that include cryptographic instructions with the CPU’s
instructions set, using the kernel interface will introduce an
unneeded layer. For this reason GnuTLS includes such optimizations
found in popular processors such as the AES-NI or VIA PADLOCK instruction sets.
This is achieved using a mechanism that detects CPU capabilities and
overrides parts of crypto back-end at runtime.
The next section discusses the registration of a detected algorithm
optimization. For more information please consult the <abbr class="acronym">GnuTLS</abbr>
source code in <code class="code">lib/accelerated/</code>.
</p>
<h4 class="subsubheading" id="Overriding-specific-algorithms"><span>Overriding specific algorithms<a class="copiable-link" href="#Overriding-specific-algorithms"> ¶</a></span></h4>
<p>When an optimized implementation of a single algorithm is available,
say a hardware assisted version of <abbr class="acronym">AES-CBC</abbr> then the
following functions, from <code class="code">crypto.h</code>, can
be used to register those algorithms.
</p>
<ul class="itemize mark-bullet">
<li><a class="ref" href="#gnutls_005fcrypto_005fregister_005fcipher">gnutls_crypto_register_cipher</a>:
To register a cipher algorithm.
</li><li><a class="ref" href="#gnutls_005fcrypto_005fregister_005faead_005fcipher">gnutls_crypto_register_aead_cipher</a>:
To register an AEAD cipher algorithm.
</li><li><a class="ref" href="#gnutls_005fcrypto_005fregister_005fmac">gnutls_crypto_register_mac</a>:
To register a MAC algorithm.
</li><li><a class="ref" href="#gnutls_005fcrypto_005fregister_005fdigest">gnutls_crypto_register_digest</a>:
To register a hash algorithm.
</li></ul>
<p>Those registration functions will only replace the specified algorithm
and leave the rest of subsystem intact.
</p>
<h4 class="subheading" id="Protecting-keys-through-isolation"><span>Protecting keys through isolation<a class="copiable-link" href="#Protecting-keys-through-isolation"> ¶</a></span></h4>
<p>For asymmetric or public keys, GnuTLS supports PKCS #11 which allows
operation without access to long term keys, in addition to CPU offloading.
For more information see <a class="ref" href="#Hardware-security-modules-and-abstract-key-types">Abstract key types and Hardware security modules</a>.
</p>
<hr>
</div>
<div class="section-level-extent" id="Random-Number-Generators_002dinternals">
<div class="nav-panel">
<p>
Next: <a href="#FIPS140_002d2-mode" accesskey="n" rel="next">FIPS140-2 mode</a>, Previous: <a href="#Cryptographic-Backend" accesskey="p" rel="prev">Cryptographic Backend</a>, Up: <a href="#Internal-architecture-of-GnuTLS" accesskey="u" rel="up">Internal Architecture of GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Random-Number-Generators"><span>11.6 Random Number Generators<a class="copiable-link" href="#Random-Number-Generators"> ¶</a></span></h3>
<h4 class="subheading" id="About-the-generators"><span>About the generators<a class="copiable-link" href="#About-the-generators"> ¶</a></span></h4>
<p>GnuTLS provides two random generators. The default, and the AES-DRBG random
generator which is only used when the library is compiled with support for
FIPS140-2 and the system is in FIPS140-2 mode.
</p>
<h4 class="subheading" id="The-default-generator-_002d-inner-workings"><span>The default generator - inner workings<a class="copiable-link" href="#The-default-generator-_002d-inner-workings"> ¶</a></span></h4>
<p>The random number generator levels in <code class="code">gnutls_rnd_level_t</code> map to two CHACHA-based random generators which
are initially seeded using the OS random device, e.g., <code class="code">/dev/urandom</code>
or <code class="code">getrandom()</code>. These random generators are unique per thread, and
are automatically re-seeded when a fork is detected.
</p>
<p>The reason the CHACHA cipher was selected for the GnuTLS’ PRNG is the fact
that CHACHA is considered a secure and fast stream cipher, and is already
defined for use in TLS protocol. As such, the utilization of it would
not stress the CPU caches, and would allow for better performance on busy
servers, irrespective of their architecture (e.g., even if AES is not
available with an optimized instruction set).
</p>
<p>The generators are unique per thread to allow lock-free operation. That
induces a cost of around 140-bytes for the state of the generators per
thread, on threads that would utilize <a class="ref" href="#gnutls_005frnd">gnutls_rnd</a>. At the same time
it allows fast and lock-free access to the generators. The lock-free access
benefits servers which utilize more than 4 threads, while imposes no cost on
single threaded processes.
</p>
<p>On the first call to <a class="ref" href="#gnutls_005frnd">gnutls_rnd</a> the generators are seeded with two independent
keys obtained from the OS random device. Their seed is used to output a fixed amount
of bytes before re-seeding; the number of bytes output varies per generator.
</p>
<p>One generator is dedicated for the <code class="code">GNUTLS_RND_NONCE</code> level, and the
second is shared for the <code class="code">GNUTLS_RND_KEY</code> and <code class="code">GNUTLS_RND_RANDOM</code>
levels. For the rest of this section we refer to the first as the nonce
generator and the second as the key generator.
</p>
<p>The nonce generator will reseed after outputting a fixed amount of bytes
(typically few megabytes), or after few hours of operation without reaching
the limit has passed. It is being re-seed using
the key generator to obtain a new key for the CHACHA cipher, which is mixed
with its old one.
</p>
<p>Similarly, the key generator, will also re-seed after a fixed amount
of bytes is generated (typically less than the nonce), and will also re-seed
based on time, i.e., after few hours of operation without reaching the limit
for a re-seed. For its re-seed it mixes mixes data obtained from the OS random
device with the previous key.
</p>
<p>Although the key generator used to provide data for the <code class="code">GNUTLS_RND_RANDOM</code>
and <code class="code">GNUTLS_RND_KEY</code> levels is identical, when used with the <code class="code">GNUTLS_RND_KEY</code> level
a re-key of the PRNG using its own output, is additionally performed. That ensures that
the recovery of the PRNG state will not be sufficient to recover previously generated values.
</p>
<h4 class="subheading" id="The-AES_002dDRBG-generator-_002d-inner-workings"><span>The AES-DRBG generator - inner workings<a class="copiable-link" href="#The-AES_002dDRBG-generator-_002d-inner-workings"> ¶</a></span></h4>
<p>Similar with the default generator, the random number generator levels in <code class="code">gnutls_rnd_level_t</code> map to two
AES-DRBG random generators which are initially seeded using the OS random device,
e.g., <code class="code">/dev/urandom</code> or <code class="code">getrandom()</code>. These random generators are
unique per thread, and are automatically re-seeded when a fork is detected.
</p>
<p>The AES-DRBG generator is based on the AES cipher in counter mode and is
re-seeded after a fixed amount of bytes are generated.
</p>
<h4 class="subheading" id="Defense-against-PRNG-attacks"><span>Defense against PRNG attacks<a class="copiable-link" href="#Defense-against-PRNG-attacks"> ¶</a></span></h4>
<p>This section describes the counter-measures available in the Pseudo-random number generator (PRNG)
of GnuTLS for known attacks as described in [<a class="ref" href="#PRNGATTACKS">PRNGATTACKS</a>]. Note that, the attacks on a PRNG such as
state-compromise, assume a quite powerful adversary which has in practice
access to the PRNG state.
</p>
<h4 class="subsubheading" id="Cryptanalytic"><span>Cryptanalytic<a class="copiable-link" href="#Cryptanalytic"> ¶</a></span></h4>
<p>To defend against cryptanalytic attacks GnuTLS’ PRNG is a stream cipher
designed to defend against the same attacks. As such, GnuTLS’ PRNG strength
with regards to this attack relies on the underlying crypto block,
which at the time of writing is CHACHA. That is easily replaceable in
the future if attacks are found to be possible in that cipher.
</p>
<h4 class="subsubheading" id="Input_002dbased-attacks"><span>Input-based attacks<a class="copiable-link" href="#Input_002dbased-attacks"> ¶</a></span></h4>
<p>These attacks assume that the attacker can influence the input that is used
to form the state of the PRNG. To counter these attacks GnuTLS does not
gather input from the system environment but rather relies on the OS
provided random generator. That is the <code class="code">/dev/urandom</code> or
<code class="code">getentropy</code>/<code class="code">getrandom</code> system calls. As such, GnuTLS’ PRNG
is as strong as the system random generator can assure with regards to
input-based attacks.
</p>
<h4 class="subsubheading" id="State_002dcompromise_003a-Backtracking"><span>State-compromise: Backtracking<a class="copiable-link" href="#State_002dcompromise_003a-Backtracking"> ¶</a></span></h4>
<p>A backtracking attack, assumes that an adversary obtains at some point of time
access to the generator state, and wants to recover past bytes. As the
GnuTLS generator is fine-tuned to provide multiple levels, such an attack
mainly concerns levels <code class="code">GNUTLS_RND_RANDOM</code> and <code class="code">GNUTLS_RND_KEY</code>,
since <code class="code">GNUTLS_RND_NONCE</code> is intended to output non-secret data.
The <code class="code">GNUTLS_RND_RANDOM</code> generator at the time of writing can output
2MB prior to being re-seeded thus this is its upper bound for previously
generated data recovered using this attack. That assumes that the state
of the operating system random generator is unknown to the attacker, and we carry that
assumption on the next paragraphs. The usage of <code class="code">GNUTLS_RND_KEY</code> level
ensures that no backtracking is possible for all output data, by re-keying
the PRNG using its own output.
</p>
<p>Such an attack reflects the real world scenario where application’s memory is
temporarily compromised, while the kernel’s memory is inaccessible.
</p>
<h4 class="subsubheading" id="State_002dcompromise_003a-Permanent-Compromise-Attack"><span>State-compromise: Permanent Compromise Attack<a class="copiable-link" href="#State_002dcompromise_003a-Permanent-Compromise-Attack"> ¶</a></span></h4>
<p>A permanent compromise attack implies that once an attacker compromises the
state of GnuTLS’ random generator at a specific time, future and past
outputs from the generator are compromised. For past outputs the
previous paragraph applies. For future outputs, both the <code class="code">GNUTLS_RND_RANDOM</code>
and the <code class="code">GNUTLS_RND_KEY</code> will recover after 2MB of data have been generated
or few hours have passed (two at the time of writing). Similarly the <code class="code">GNUTLS_RND_NONCE</code>
level generator will recover after several megabytes of output is generated,
or its re-key time is reached.
</p>
<h4 class="subsubheading" id="State_002dcompromise_003a-Iterative-guessing"><span>State-compromise: Iterative guessing<a class="copiable-link" href="#State_002dcompromise_003a-Iterative-guessing"> ¶</a></span></h4>
<p>This attack assumes that after an attacker obtained the PRNG state
at some point, is able to recover the state at a later time by observing
outputs of the PRNG. That is countered by switching the key to generators
using a combination of a fresh key and the old one (using XOR), at
re-seed time. All levels are immune to such attack after a re-seed.
</p>
<h4 class="subsubheading" id="State_002dcompromise_003a-Meet_002din_002dthe_002dMiddle"><span>State-compromise: Meet-in-the-Middle<a class="copiable-link" href="#State_002dcompromise_003a-Meet_002din_002dthe_002dMiddle"> ¶</a></span></h4>
<p>This attack assumes that the attacker obtained the PRNG state at
two distinct times, and being able to recover the state at the third time
after observing the output of the PRNG. Given the approach described
on the above paragraph, all levels are immune to such attack.
</p>
<hr>
</div>
<div class="section-level-extent" id="FIPS140_002d2-mode">
<div class="nav-panel">
<p>
Previous: <a href="#Random-Number-Generators_002dinternals" accesskey="p" rel="prev">Random Number Generators</a>, Up: <a href="#Internal-architecture-of-GnuTLS" accesskey="u" rel="up">Internal Architecture of GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="FIPS140_002d2-mode-1"><span>11.7 FIPS140-2 mode<a class="copiable-link" href="#FIPS140_002d2-mode-1"> ¶</a></span></h3>
<p>GnuTLS can operate in a special mode for FIPS140-2. That mode of operation
is for the conformance to NIST’s FIPS140-2 publication, which consists of policies
for cryptographic modules (such as software libraries). Its implementation in
GnuTLS is designed for Red Hat Enterprise Linux, and can only be enabled
when the library is explicitly compiled with the ’–enable-fips140-mode’
configure option.
</p>
<p>There are two distinct library states with regard to FIPS140-2: the FIPS140-2
mode is <em class="emph">installed</em> if <code class="code">/etc/system-fips</code> is present, and the
FIPS140-2 mode is <em class="emph">enabled</em> if <code class="code">/proc/sys/crypto/fips_enabled</code>
contains ’1’, which is typically set with the “fips=1” kernel command line
option.
</p>
<p>When the FIPS140-2 mode is installed, the operation of the library is modified
as follows.
</p>
<ul class="itemize mark-bullet">
<li>The random generator used switches to DRBG-AES
</li><li>The integrity of the GnuTLS and dependent libraries is checked on startup
</li><li>Algorithm self-tests are run on library load
</li></ul>
<p>When the FIPS140-2 mode is enabled, The operation of the library is in addition
modified as follows.
</p>
<ul class="itemize mark-bullet">
<li>Only approved by FIPS140-2 algorithms are enabled
</li><li>Only approved by FIPS140-2 key lengths are allowed for key generation
</li><li>Any cryptographic operation will be refused if any of the self-tests failed
</li></ul>
<p>There are also few environment variables which modify that operation. The
environment variable <code class="code">GNUTLS_SKIP_FIPS_INTEGRITY_CHECKS</code> will disable
the library integrity tests on startup, and the variable
<code class="code">GNUTLS_FORCE_FIPS_MODE</code> can be set to force a value from
<a class="ref" href="#gnutls_005ffips_005fmode_005ft">Figure 11.5</a>, i.e., ’1’ will enable the FIPS140-2
mode, while ’0’ will disable it.
</p>
<p>The integrity checks for the dependent libraries and GnuTLS are performed
using ’.hmac’ files which are present at the same path as the library. The
key for the operations can be provided on compile-time with the configure
option ’–with-fips140-key’. The MAC algorithm used is HMAC-SHA256.
</p>
<p>On runtime an application can verify whether the library is in FIPS140-2
mode using the <a class="ref" href="#gnutls_005ffips140_005fmode_005fenabled">gnutls_fips140_mode_enabled</a> function.
</p>
<h4 class="subheading" id="Relaxing-FIPS140_002d2-requirements"><span>Relaxing FIPS140-2 requirements<a class="copiable-link" href="#Relaxing-FIPS140_002d2-requirements"> ¶</a></span></h4>
<p>The library by default operates in a strict enforcing mode, ensuring that
all constraints imposed by the FIPS140-2 specification are enforced. However
the application can relax these requirements via <a class="ref" href="#gnutls_005ffips140_005fset_005fmode">gnutls_fips140_set_mode</a>
which can switch to alternative modes as in <a class="ref" href="#gnutls_005ffips_005fmode_005ft">Figure 11.5</a>.
</p>
<div class="float" id="gnutls_005ffips_005fmode_005ft">
<dl class="table">
<dt><code class="code">GNUTLS_FIPS140_DISABLED</code></dt>
<dd><p>The FIPS140-2 mode is disabled.
</p></dd>
<dt><code class="code">GNUTLS_FIPS140_STRICT</code></dt>
<dd><p>The default mode; all forbidden operations will cause an
operation failure via error code.
</p></dd>
<dt><code class="code">GNUTLS_FIPS140_SELFTESTS</code></dt>
<dd><p>A transient state during library initialization. That state
cannot be set or seen by applications.
</p></dd>
<dt><code class="code">GNUTLS_FIPS140_LAX</code></dt>
<dd><p>The library still uses the FIPS140-2 relevant algorithms but all
forbidden by FIPS140-2 operations are allowed; this is useful when the
application is aware of the followed security policy, and needs
to utilize disallowed operations for other reasons (e.g., compatibility).
</p></dd>
<dt><code class="code">GNUTLS_FIPS140_LOG</code></dt>
<dd><p>Similarly to <code class="code">GNUTLS_FIPS140_LAX</code> , it allows forbidden operations; any use of them results
to a message to the audit callback functions.
</p></dd>
</dl>
<div class="caption"><p><strong class="strong">Figure 11.5: </strong>The <code class="code">gnutls_fips_mode_t</code> enumeration.</p></div></div>
<p>The intention of this API is to be used by applications which may run in
FIPS140-2 mode, while they utilize few algorithms not in the allowed set,
e.g., for non-security related purposes. In these cases applications should
wrap the non-compliant code within blocks like the following.
</p>
<div class="example">
<pre class="example-preformatted">GNUTLS_FIPS140_SET_LAX_MODE();
_gnutls_hash_fast(GNUTLS_DIG_MD5, buffer, sizeof(buffer), output);
GNUTLS_FIPS140_SET_STRICT_MODE();
</pre></div>
<p>The <code class="code">GNUTLS_FIPS140_SET_LAX_MODE</code> and
<code class="code">GNUTLS_FIPS140_SET_STRICT_MODE</code> are macros to simplify the following
sequence of calls.
</p>
<div class="example">
<pre class="example-preformatted">if (gnutls_fips140_mode_enabled())
gnutls_fips140_set_mode(GNUTLS_FIPS140_LAX, GNUTLS_FIPS140_SET_MODE_THREAD);
_gnutls_hash_fast(GNUTLS_DIG_MD5, buffer, sizeof(buffer), output);
if (gnutls_fips140_mode_enabled())
gnutls_fips140_set_mode(GNUTLS_FIPS140_STRICT, GNUTLS_FIPS140_SET_MODE_THREAD);
</pre></div>
<p>The reason of the <code class="code">GNUTLS_FIPS140_SET_MODE_THREAD</code> flag in the
previous calls is to localize the change in the mode. Note also, that
such a block has no effect when the library is not operating
under FIPS140-2 mode, and thus it can be considered a no-op.
</p>
<p>Applications could also switch FIPS140-2 mode explicitly off, by calling
</p><div class="example">
<pre class="example-preformatted">gnutls_fips140_set_mode(GNUTLS_FIPS140_LAX, 0);
</pre></div>
<h4 class="subheading" id="Service-indicator"><span>Service indicator<a class="copiable-link" href="#Service-indicator"> ¶</a></span></h4>
<p>The above restrictions may not cover all the requirements in every
usage context, and as the FIPS140 standard evolves (like FIPS140-3),
GnuTLS may not be able to add new restrictions without breaking
compatibility.
</p>
<p>Therefore an additional set of API functions is provided to
communicate with the user whether any approved mode of operations is
performed within a given context.
</p>
<dl class="table">
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ffips140_005fcontext_005finit">gnutls_fips140_context_init</a> (gnutls_fips140_context_t * <var class="var">context</var>)</code></dt>
<dt><code class="code"><var class="var">void</var> <a class="ref" href="#gnutls_005ffips140_005fcontext_005fdeinit">gnutls_fips140_context_deinit</a> (gnutls_fips140_context_t <var class="var">context</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ffips140_005fpush_005fcontext">gnutls_fips140_push_context</a> (gnutls_fips140_context_t <var class="var">context</var>)</code></dt>
<dt><code class="code"><var class="var">int</var> <a class="ref" href="#gnutls_005ffips140_005fpop_005fcontext">gnutls_fips140_pop_context</a> ( <var class="var">void</var>)</code></dt>
</dl>
<p>The <code class="code">gnutls_fips140_context_t</code> represents the FIPS140-2 mode of
operation. It can be attached to the current execution thread with
<a class="ref" href="#gnutls_005ffips140_005fpush_005fcontext">gnutls_fips140_push_context</a> and its internal state will be
updated until it is detached with
<a class="ref" href="#gnutls_005ffips140_005fpop_005fcontext">gnutls_fips140_pop_context</a>. Afterwards
<a class="ref" href="#gnutls_005ffips140_005fget_005foperation_005fstate">gnutls_fips140_get_operation_state</a> allows the user
to examine whether any approved (or non-approved) security function is
invoked.
</p>
<dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fget_005foperation_005fstate"><span class="category-def">Function: </span><span><code class="def-type">gnutls_fips140_operation_state_t</code> <strong class="def-name">gnutls_fips140_get_operation_state</strong> <code class="def-code-arguments">(gnutls_fips140_context_t <var class="var">context</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fget_005foperation_005fstate"> ¶</a></span></dt>
<dd><p><var class="var">context</var>: a <code class="code">gnutls_fips140_context_t</code>
</p>
<p>Get the previous operation state of <code class="code">context</code> in terms of FIPS.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_fips140_operation_state_t</code>
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<hr>
</div>
</div>
<div class="appendix-level-extent" id="Upgrading-from-previous-versions">
<div class="nav-panel">
<p>
Next: <a href="#Support" accesskey="n" rel="next">Support</a>, Previous: <a href="#Internal-architecture-of-GnuTLS" accesskey="p" rel="prev">Internal Architecture of GnuTLS</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="appendix" id="Upgrading-from-previous-versions-1"><span>Appendix A Upgrading from previous versions<a class="copiable-link" href="#Upgrading-from-previous-versions-1"> ¶</a></span></h2>
<a class="index-entry-id" id="index-upgrading"></a>
<p>The GnuTLS library typically maintains binary and source code compatibility
across versions. The releases that have the major version increased
break binary compatibility but source compatibility is provided.
This section lists exceptional cases where changes to existing code are
required due to library changes.
</p>
<h3 class="heading" id="Upgrading-to-2_002e12_002ex-from-previous-versions"><span>Upgrading to 2.12.x from previous versions<a class="copiable-link" href="#Upgrading-to-2_002e12_002ex-from-previous-versions"> ¶</a></span></h3>
<p>GnuTLS 2.12.x is binary compatible with previous versions but changes the
semantics of <code class="code">gnutls_transport_set_lowat</code>, which might cause breakage
in applications that relied on its default value be 1. Two fixes
are proposed:
</p><ul class="itemize mark-bullet">
<li>Quick fix. Explicitly call <code class="code">gnutls_transport_set_lowat (session, 1);</code>
after <a class="ref" href="#gnutls_005finit">gnutls_init</a>.
</li><li>Long term fix. Because later versions of gnutls abolish the functionality
of using the system call <code class="code">select</code> to check for gnutls pending data, the
function <a class="ref" href="#gnutls_005frecord_005fcheck_005fpending">gnutls_record_check_pending</a> has to be used to achieve the same
functionality as described in <a class="ref" href="#Asynchronous-operation">Asynchronous operation</a>.
</li></ul>
<h3 class="heading" id="Upgrading-to-3_002e0_002ex-from-2_002e12_002ex"><span>Upgrading to 3.0.x from 2.12.x<a class="copiable-link" href="#Upgrading-to-3_002e0_002ex-from-2_002e12_002ex"> ¶</a></span></h3>
<p>GnuTLS 3.0.x is source compatible with previous versions except for the functions
listed below.
</p>
<table class="multitable">
<thead><tr><th width="30%">Old function</th><th width="60%">Replacement</th></tr></thead>
<tbody><tr><td width="30%"><code class="code">gnutls_transport_set_lowat</code></td><td width="60%">To replace its functionality the function <a class="ref" href="#gnutls_005frecord_005fcheck_005fpending">gnutls_record_check_pending</a> has to be used,
as described in <a class="ref" href="#Asynchronous-operation">Asynchronous operation</a></td></tr>
<tr><td width="30%"><code class="code">gnutls_session_get_server_random</code>,
<code class="code">gnutls_session_get_client_random</code></td><td width="60%">They are replaced by the safer function <a class="ref" href="#gnutls_005fsession_005fget_005frandom">gnutls_session_get_random</a></td></tr>
<tr><td width="30%"><code class="code">gnutls_session_get_master_secret</code></td><td width="60%">Replaced by the keying material exporters discussed in <a class="ref" href="#Deriving-keys-for-other-applications_002fprotocols">Deriving keys for other applications/protocols</a></td></tr>
<tr><td width="30%"><code class="code">gnutls_transport_set_global_errno</code></td><td width="60%">Replaced by using the system’s errno facility or <a class="ref" href="#gnutls_005ftransport_005fset_005ferrno">gnutls_transport_set_errno</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_x509_privkey_verify_data</code></td><td width="60%">Replaced by <a class="ref" href="#gnutls_005fpubkey_005fverify_005fdata2">gnutls_pubkey_verify_data2</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_certificate_verify_peers</code></td><td width="60%">Replaced by <a class="ref" href="#gnutls_005fcertificate_005fverify_005fpeers2">gnutls_certificate_verify_peers2</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_psk_netconf_derive_key</code></td><td width="60%">Removed. The key derivation function was never standardized.</td></tr>
<tr><td width="30%"><code class="code">gnutls_session_set_finished_function</code></td><td width="60%">Removed.</td></tr>
<tr><td width="30%"><code class="code">gnutls_ext_register</code></td><td width="60%">Removed. Extension registration API is now internal to allow easier changes in the API.</td></tr>
<tr><td width="30%"><code class="code">gnutls_certificate_get_x509_crls</code>, <code class="code">gnutls_certificate_get_x509_cas</code></td><td width="60%">Removed to allow updating the internal structures. Replaced by <a class="ref" href="#gnutls_005fcertificate_005fget_005fissuer">gnutls_certificate_get_issuer</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_certificate_get_openpgp_keyring</code></td><td width="60%">Removed.</td></tr>
<tr><td width="30%"><code class="code">gnutls_ia_</code></td><td width="60%">Removed. The inner application extensions were completely removed (they failed to be standardized).</td></tr>
</tbody>
</table>
<h3 class="heading" id="Upgrading-to-3_002e1_002ex-from-3_002e0_002ex"><span>Upgrading to 3.1.x from 3.0.x<a class="copiable-link" href="#Upgrading-to-3_002e1_002ex-from-3_002e0_002ex"> ¶</a></span></h3>
<p>GnuTLS 3.1.x is source and binary compatible with GnuTLS 3.0.x releases. Few
functions have been deprecated and are listed below.
</p>
<table class="multitable">
<thead><tr><th width="30%">Old function</th><th width="60%">Replacement</th></tr></thead>
<tbody><tr><td width="30%"><code class="code">gnutls_pubkey_verify_hash</code></td><td width="60%">The function <a class="ref" href="#gnutls_005fpubkey_005fverify_005fhash2">gnutls_pubkey_verify_hash2</a> is provided and
is functionally equivalent and safer to use.</td></tr>
<tr><td width="30%"><code class="code">gnutls_pubkey_verify_data</code></td><td width="60%">The function <a class="ref" href="#gnutls_005fpubkey_005fverify_005fdata2">gnutls_pubkey_verify_data2</a> is provided and
is functionally equivalent and safer to use.</td></tr>
</tbody>
</table>
<h3 class="heading" id="Upgrading-to-3_002e2_002ex-from-3_002e1_002ex"><span>Upgrading to 3.2.x from 3.1.x<a class="copiable-link" href="#Upgrading-to-3_002e2_002ex-from-3_002e1_002ex"> ¶</a></span></h3>
<p>GnuTLS 3.2.x is source and binary compatible with GnuTLS 3.1.x releases. Few
functions have been deprecated and are listed below.
</p>
<table class="multitable">
<thead><tr><th width="30%">Old function</th><th width="60%">Replacement</th></tr></thead>
<tbody><tr><td width="30%"><code class="code">gnutls_privkey_sign_raw_data</code></td><td width="60%">The function <a class="ref" href="#gnutls_005fprivkey_005fsign_005fhash">gnutls_privkey_sign_hash</a> is equivalent
when the flag <code class="code">GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA</code> is specified.</td></tr>
</tbody>
</table>
<h3 class="heading" id="Upgrading-to-3_002e3_002ex-from-3_002e2_002ex"><span>Upgrading to 3.3.x from 3.2.x<a class="copiable-link" href="#Upgrading-to-3_002e3_002ex-from-3_002e2_002ex"> ¶</a></span></h3>
<p>GnuTLS 3.3.x is source and binary compatible with GnuTLS 3.2.x releases;
however there few changes in semantics which are listed below.
</p>
<table class="multitable">
<thead><tr><th width="30%">Old function</th><th width="60%">Replacement</th></tr></thead>
<tbody><tr><td width="30%"><code class="code">gnutls_global_init</code></td><td width="60%">No longer required. The library is initialized using a constructor.</td></tr>
<tr><td width="30%"><code class="code">gnutls_global_deinit</code></td><td width="60%">No longer required. The library is deinitialized using a destructor.</td></tr>
</tbody>
</table>
<h3 class="heading" id="Upgrading-to-3_002e4_002ex-from-3_002e3_002ex"><span>Upgrading to 3.4.x from 3.3.x<a class="copiable-link" href="#Upgrading-to-3_002e4_002ex-from-3_002e3_002ex"> ¶</a></span></h3>
<p>GnuTLS 3.4.x is source compatible with GnuTLS 3.3.x releases;
however, several deprecated functions were removed, and are listed below.
</p>
<table class="multitable">
<thead><tr><th width="30%">Old function</th><th width="60%">Replacement</th></tr></thead>
<tbody><tr><td width="30%">Priority string "NORMAL" has been modified</td><td width="60%">The following string emulates the 3.3.x behavior "NORMAL:+VERS-SSL3.0:+ARCFOUR-128:+DHE-DSS:+SIGN-DSA-SHA512:+SIGN-DSA-SHA256:+SIGN-DSA-SHA1"</td></tr>
<tr><td width="30%"><code class="code">gnutls_certificate_client_set_retrieve_function</code>,
<code class="code">gnutls_certificate_server_set_retrieve_function</code></td><td width="60%"><a class="ref" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction">gnutls_certificate_set_retrieve_function</a></td></tr>
<tr><td width="30%"><code class="code">gnutls_certificate_set_rsa_export_params</code>,
<code class="code">gnutls_rsa_export_get_modulus_bits</code>,
<code class="code">gnutls_rsa_export_get_pubkey</code>,
<code class="code">gnutls_rsa_params_cpy</code>,
<code class="code">gnutls_rsa_params_deinit</code>,
<code class="code">gnutls_rsa_params_export_pkcs1</code>,
<code class="code">gnutls_rsa_params_export_raw</code>,
<code class="code">gnutls_rsa_params_generate2</code>,
<code class="code">gnutls_rsa_params_import_pkcs1</code>,
<code class="code">gnutls_rsa_params_import_raw</code>,
<code class="code">gnutls_rsa_params_init</code></td><td width="60%">No replacement; the library does not support the RSA-EXPORT ciphersuites.</td></tr>
<tr><td width="30%"><code class="code">gnutls_pubkey_verify_hash</code>,</td><td width="60%"><a class="ref" href="#gnutls_005fpubkey_005fverify_005fhash2">gnutls_pubkey_verify_hash2</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_pubkey_verify_data</code>,</td><td width="60%"><a class="ref" href="#gnutls_005fpubkey_005fverify_005fdata2">gnutls_pubkey_verify_data2</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_x509_crt_get_verify_algorithm</code>,</td><td width="60%">No replacement; a similar function is <a class="ref" href="#gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm">gnutls_x509_crt_get_signature_algorithm</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_pubkey_get_verify_algorithm</code>,</td><td width="60%">No replacement; a similar function is <a class="ref" href="#gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm">gnutls_pubkey_get_preferred_hash_algorithm</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_certificate_type_set_priority</code>,
<code class="code">gnutls_cipher_set_priority</code>,
<code class="code">gnutls_compression_set_priority</code>,
<code class="code">gnutls_kx_set_priority</code>,
<code class="code">gnutls_mac_set_priority</code>,
<code class="code">gnutls_protocol_set_priority</code></td><td width="60%"><a class="ref" href="#gnutls_005fpriority_005fset_005fdirect">gnutls_priority_set_direct</a>.</td></tr>
<tr><td width="30%"><code class="code">gnutls_sign_callback_get</code>,
<code class="code">gnutls_sign_callback_set</code></td><td width="60%"><a class="ref" href="#gnutls_005fprivkey_005fimport_005fext3">gnutls_privkey_import_ext3</a></td></tr>
<tr><td width="30%"><code class="code">gnutls_x509_crt_verify_hash</code></td><td width="60%"><a class="ref" href="#gnutls_005fpubkey_005fverify_005fhash2">gnutls_pubkey_verify_hash2</a></td></tr>
<tr><td width="30%"><code class="code">gnutls_x509_crt_verify_data</code></td><td width="60%"><a class="ref" href="#gnutls_005fpubkey_005fverify_005fdata2">gnutls_pubkey_verify_data2</a></td></tr>
<tr><td width="30%"><code class="code">gnutls_privkey_sign_raw_data</code></td><td width="60%"><a class="ref" href="#gnutls_005fprivkey_005fsign_005fhash">gnutls_privkey_sign_hash</a> with the flag GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA</td></tr>
</tbody>
</table>
<h3 class="heading" id="Upgrading-to-3_002e6_002ex-from-3_002e5_002ex"><span>Upgrading to 3.6.x from 3.5.x<a class="copiable-link" href="#Upgrading-to-3_002e6_002ex-from-3_002e5_002ex"> ¶</a></span></h3>
<p>GnuTLS 3.6.x is source and binary compatible with GnuTLS 3.5.x releases;
however, there are minor differences, listed below.
</p>
<table class="multitable">
<thead><tr><th width="30%">Old functionality</th><th width="60%">Replacement</th></tr></thead>
<tbody><tr><td width="30%">The priority strings "+COMP" are a no-op</td><td width="60%">TLS compression is no longer available.</td></tr>
<tr><td width="30%">The SSL 3.0 protocol is a no-op</td><td width="60%">SSL 3.0 is no longer compiled in by default. It is a legacy protocol
which is completely eliminated from public internet. As such it was removed
to reduce the attack vector for applications using the library.</td></tr>
<tr><td width="30%">The hash function SHA2-224 is a no-op for TLS1.2</td><td width="60%">TLS 1.3 no longer uses SHA2-224, and it was never a widespread hash
algorithm. As such it was removed for simplicity.</td></tr>
<tr><td width="30%">The SRP key exchange accepted parameters outside the [<a class="ref" href="#TLSSRP">TLSSRP</a>] spec</td><td width="60%">The SRP key exchange is restricted to [<a class="ref" href="#TLSSRP">TLSSRP</a>] spec parameters
to protect clients from MitM attacks.</td></tr>
<tr><td width="30%">The compression-related functions are deprecated</td><td width="60%">No longer use <code class="code">gnutls_compression_get</code>,
<code class="code">gnutls_compression_get_name</code>, <code class="code">gnutls_compression_list</code>,
and <code class="code">gnutls_compression_get_id</code>.</td></tr>
<tr><td width="30%"><a class="ref" href="#gnutls_005fx509_005fcrt_005fsign">gnutls_x509_crt_sign</a>, <a class="ref" href="#gnutls_005fx509_005fcrl_005fsign">gnutls_x509_crl_sign</a>, <a class="ref" href="#gnutls_005fx509_005fcrq_005fsign">gnutls_x509_crq_sign</a></td><td width="60%">These signing functions will no longer sign using SHA1, but with a secure hash algorithm.</td></tr>
<tr><td width="30%"><a class="ref" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile">gnutls_certificate_set_ocsp_status_request_file</a></td><td width="60%">This function will return an error if the loaded response doesn’t match
any of the present certificates. To revert to previous semantics set the <code class="code">GNUTLS_CERTIFICATE_SKIP_OCSP_RESPONSE_CHECK</code>
flag using <a class="ref" href="#gnutls_005fcertificate_005fset_005fflags">gnutls_certificate_set_flags</a>.</td></tr>
<tr><td width="30%">The callback <a class="ref" href="#gnutls_005fprivkey_005fimport_005fext3">gnutls_privkey_import_ext3</a> is not flexible enough for new signature algorithms such as RSA-PSS</td><td width="60%">It is replaced with <a class="ref" href="#gnutls_005fprivkey_005fimport_005fext4">gnutls_privkey_import_ext4</a></td></tr>
<tr><td width="30%">Re-handshake functionality is not applicable under TLS 1.3.</td><td width="60%">It is replaced by separate key update and re-authentication functionality
which can be accessed directly via <a class="ref" href="#gnutls_005fsession_005fkey_005fupdate">gnutls_session_key_update</a> and <a class="ref" href="#gnutls_005freauth">gnutls_reauth</a>.</td></tr>
<tr><td width="30%">TLS session identifiers are not shared with the server under TLS 1.3.</td><td width="60%">The TLS session identifiers are persistent across resumption only on
server side and can be obtained as before via <a class="ref" href="#gnutls_005fsession_005fget_005fid2">gnutls_session_get_id2</a>.</td></tr>
<tr><td width="30%"><a class="ref" href="#gnutls_005fpkcs11_005fprivkey_005fgenerate3">gnutls_pkcs11_privkey_generate3</a>, <a class="ref" href="#gnutls_005fpkcs11_005fcopy_005fsecret_005fkey">gnutls_pkcs11_copy_secret_key</a>, <a class="ref" href="#gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2">gnutls_pkcs11_copy_x509_privkey2</a></td><td width="60%">These functions no longer create an exportable key by default; they require the flag <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_SENSITIVE</code> to do so.</td></tr>
<tr><td width="30%"><a class="ref" href="#gnutls_005fdb_005fset_005fretrieve_005ffunction">gnutls_db_set_retrieve_function</a>, <a class="ref" href="#gnutls_005fdb_005fset_005fstore_005ffunction">gnutls_db_set_store_function</a>, <a class="ref" href="#gnutls_005fdb_005fset_005fremove_005ffunction">gnutls_db_set_remove_function</a></td><td width="60%">These functions are no longer relevant under TLS 1.3; resumption under
TLS 1.3 is done via session tickets, c.f. <a class="ref" href="#gnutls_005fsession_005fticket_005fenable_005fserver">gnutls_session_ticket_enable_server</a>.</td></tr>
<tr><td width="30%"><a class="ref" href="#gnutls_005fsession_005fget_005fdata2">gnutls_session_get_data2</a>, <a class="ref" href="#gnutls_005fsession_005fget_005fdata">gnutls_session_get_data</a></td><td width="60%">These functions may introduce a slight delay under TLS 1.3 for few
milliseconds. Check output of <a class="ref" href="#gnutls_005fsession_005fget_005fflags">gnutls_session_get_flags</a> for GNUTLS_SFLAGS_SESSION_TICKET
before calling this function to avoid delays. To work efficiently under
TLS 1.3 this function requires the application setting
<a class="ref" href="#gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction">gnutls_transport_set_pull_timeout_function</a>.</td></tr>
<tr><td width="30%">SRP and RSA-PSK key exchanges are not supported under TLS 1.3</td><td width="60%">SRP and RSA-PSK key exchanges are not supported in TLS 1.3, so when these key exchanges are present in a priority string, TLS 1.3 is disabled.</td></tr>
<tr><td width="30%">Anonymous key exchange is not supported under TLS 1.3</td><td width="60%">There is no anonymous key exchange supported under TLS 1.3, so if an anonymous key exchange method is set in a priority string, and no certificate credentials are set in the client or server, TLS 1.3 will not be negotiated.</td></tr>
<tr><td width="30%">ECDHE-PSK and DHE-PSK keywords have the same meaning under TLS 1.3</td><td width="60%">In the priority strings, both <code class="code">ECDHEPSK</code> and <code class="code">DHEPSK</code> indicate the intent to support an ephemeral key exchange with the pre-shared key. The parameters of the key exchange are negotiated with the supported groups specified in the priority string.</td></tr>
<tr><td width="30%">Authentication-only ciphersuites are not supported under TLS 1.3</td><td width="60%">Ciphersuites with the <code class="code">NULL</code> cipher (i.e., authentication-only) are not supported in TLS 1.3, so when they are specified in a priority string, TLS 1.3 is disabled.</td></tr>
<tr><td width="30%">Supplemental data is not supported under TLS 1.3</td><td width="60%">The TLS supplemental data handshake message (RFC 4680) is not supported under TLS 1.3, so if the application calls <a class="ref" href="#gnutls_005fsupplemental_005fregister">gnutls_supplemental_register</a> or <a class="ref" href="#gnutls_005fsession_005fsupplemental_005fregister">gnutls_session_supplemental_register</a>, TLS 1.3 is disabled.</td></tr>
<tr><td width="30%">The GNUTLS_X509_NO_WELL_DEFINED_EXPIRATION macro is a no-op</td><td width="60%">The macro was non-functional and because of the nature of the
definition of the no-well-defined date for certificates (a real date),
it will not be fixed or re-introduced.</td></tr>
</tbody>
</table>
<hr>
</div>
<div class="appendix-level-extent" id="Support">
<div class="nav-panel">
<p>
Next: <a href="#Error-codes" accesskey="n" rel="next">Error Codes and Descriptions</a>, Previous: <a href="#Upgrading-from-previous-versions" accesskey="p" rel="prev">Upgrading from previous versions</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="appendix" id="Support-1"><span>Appendix B Support<a class="copiable-link" href="#Support-1"> ¶</a></span></h2>
<ul class="mini-toc">
<li><a href="#Getting-help" accesskey="1">Getting Help</a></li>
<li><a href="#Commercial-Support" accesskey="2">Commercial Support</a></li>
<li><a href="#Bug-Reports" accesskey="3">Bug Reports</a></li>
<li><a href="#Contributing" accesskey="4">Contributing</a></li>
<li><a href="#Certification" accesskey="5">Certification</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Getting-help">
<div class="nav-panel">
<p>
Next: <a href="#Commercial-Support" accesskey="n" rel="next">Commercial Support</a>, Up: <a href="#Support" accesskey="u" rel="up">Support</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Getting-Help"><span>B.1 Getting Help<a class="copiable-link" href="#Getting-Help"> ¶</a></span></h3>
<p>A mailing list where users may help each other exists, and you can
reach it by sending e-mail to <a class="email" href="mailto:gnutls-help@gnutls.org">gnutls-help@gnutls.org</a>. Archives
of the mailing list discussions, and an interface to manage
subscriptions, is available through the World Wide Web at
<a class="url" href="https://lists.gnutls.org/pipermail/gnutls-help/">https://lists.gnutls.org/pipermail/gnutls-help/</a>.
</p>
<p>A mailing list for developers are also available, see
<a class="url" href="https://www.gnutls.org/lists.html">https://www.gnutls.org/lists.html</a>.
Bug reports should be sent to <a class="email" href="mailto:bugs@gnutls.org">bugs@gnutls.org</a>, see
<a class="ref" href="#Bug-Reports">Bug Reports</a>.
</p>
<hr>
</div>
<div class="section-level-extent" id="Commercial-Support">
<div class="nav-panel">
<p>
Next: <a href="#Bug-Reports" accesskey="n" rel="next">Bug Reports</a>, Previous: <a href="#Getting-help" accesskey="p" rel="prev">Getting Help</a>, Up: <a href="#Support" accesskey="u" rel="up">Support</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Commercial-Support-1"><span>B.2 Commercial Support<a class="copiable-link" href="#Commercial-Support-1"> ¶</a></span></h3>
<p>Commercial support is available for users of GnuTLS. See
<a class="url" href="https://www.gnutls.org/commercial.html">https://www.gnutls.org/commercial.html</a> for more information.
</p>
<hr>
</div>
<div class="section-level-extent" id="Bug-Reports">
<div class="nav-panel">
<p>
Next: <a href="#Contributing" accesskey="n" rel="next">Contributing</a>, Previous: <a href="#Commercial-Support" accesskey="p" rel="prev">Commercial Support</a>, Up: <a href="#Support" accesskey="u" rel="up">Support</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Bug-Reports-1"><span>B.3 Bug Reports<a class="copiable-link" href="#Bug-Reports-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-reporting-bugs"></a>
<p>If you think you have found a bug in GnuTLS, please investigate it and
report it.
</p>
<ul class="itemize mark-bullet">
<li>Please make sure that the bug is really in GnuTLS, and
preferably also check that it hasn’t already been fixed in the latest
version.
</li><li>You have to send us a test case that makes it possible for us to
reproduce the bug.
</li><li>You also have to explain what is wrong; if you get a crash, or
if the results printed are not good and in that case, in what way.
Make sure that the bug report includes all information you would need
to fix this kind of bug for someone else.
</li></ul>
<p>Please make an effort to produce a self-contained report, with
something definite that can be tested or debugged. Vague queries or
piecemeal messages are difficult to act on and don’t help the
development effort.
</p>
<p>If your bug report is good, we will do our best to help you to get a
corrected version of the software; if the bug report is poor, we won’t
do anything about it (apart from asking you to send better bug
reports).
</p>
<p>If you think something in this manual is unclear, or downright
incorrect, or if the language needs to be improved, please also send a
note.
</p>
<p>Send your bug report to:
</p>
<div class="center">‘<samp class="samp">bugs@gnutls.org</samp>’
</div>
<hr>
</div>
<div class="section-level-extent" id="Contributing">
<div class="nav-panel">
<p>
Next: <a href="#Certification" accesskey="n" rel="next">Certification</a>, Previous: <a href="#Bug-Reports" accesskey="p" rel="prev">Bug Reports</a>, Up: <a href="#Support" accesskey="u" rel="up">Support</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Contributing-1"><span>B.4 Contributing<a class="copiable-link" href="#Contributing-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-contributing"></a>
<a class="index-entry-id" id="index-hacking"></a>
<p>If you want to submit a patch for inclusion – from solving a typo you
discovered, up to adding support for a new feature – you should
submit it as a bug report, using the process in <a class="ref" href="#Bug-Reports">Bug Reports</a>. There are some
things that you can do to increase the chances for it to be included
in the official package.
</p>
<p>Unless your patch is very small (say, under 10 lines) we require that
you assign the copyright of your work to the Free Software Foundation.
This is to protect the freedom of the project. If you have not
already signed papers, we will send you the necessary information when
you submit your contribution.
</p>
<p>For contributions that doesn’t consist of actual programming code, the
only guidelines are common sense.
For code contributions, a number of style guides will help you:
</p>
<ul class="itemize mark-bullet">
<li>Coding Style.
Follow the Linux kernel coding style<a class="footnote" id="DOCF26" href="#FOOT26"><sup>26</sup></a>.
<p>If you normally code using another coding standard, there is no
problem, but you should run the ‘<samp class="samp">indent-gnutls</samp>’ script found in
the ‘<samp class="samp">devel</samp>’ directory to reformat the code before submitting your
work.
</p>
</li><li>Use the unified diff format ‘<samp class="samp">diff -u</samp>’.
</li><li>Return errors.
No reason whatsoever should abort the execution of the library. Even
memory allocation errors, e.g. when malloc return NULL, should work
although result in an error code.
</li><li>Design with thread safety in mind.
Don’t use global variables. Don’t even write to per-handle global
variables unless the documented behaviour of the function you write is
to write to the per-handle global variable.
</li><li>Avoid using the C math library.
It causes problems for embedded implementations, and in most
situations it is very easy to avoid using it.
</li><li>Document your functions.
Use comments before each function headers, that, if properly
formatted, are extracted into Texinfo manuals and GTK-DOC web pages.
</li><li>Supply a ChangeLog and NEWS entries, where appropriate.
</li></ul>
<hr>
</div>
<div class="section-level-extent" id="Certification">
<div class="nav-panel">
<p>
Previous: <a href="#Contributing" accesskey="p" rel="prev">Contributing</a>, Up: <a href="#Support" accesskey="u" rel="up">Support</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Certification-1"><span>B.5 Certification<a class="copiable-link" href="#Certification-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-certification"></a>
<p>There are certifications from national or international bodies which "prove"
to an auditor that the crypto component follows some best practices, such
as unit testing and reliance on well known crypto primitives.
</p>
<p>GnuTLS has support for the FIPS 140-2 certification under Red Hat Enterprise Linux.
See <a class="ref" href="#FIPS140_002d2-mode">FIPS140-2 mode</a> for more information.
</p>
<hr>
</div>
</div>
<div class="appendix-level-extent" id="Error-codes">
<div class="nav-panel">
<p>
Next: <a href="#Supported-ciphersuites" accesskey="n" rel="next">Supported Ciphersuites</a>, Previous: <a href="#Support" accesskey="p" rel="prev">Support</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="appendix" id="Error-Codes-and-Descriptions"><span>Appendix C Error Codes and Descriptions<a class="copiable-link" href="#Error-Codes-and-Descriptions"> ¶</a></span></h2>
<a class="index-entry-id" id="index-error-codes"></a>
<p>The error codes used throughout the library are described below. The
return code <code class="code">GNUTLS_E_SUCCESS</code> indicates a successful operation, and
is guaranteed to have the value 0, so you can use it in logical
expressions.
</p>
<table class="multitable">
<tbody><tr><td width="15%">0</td><td width="40%">GNUTLS_E_SUCCESS</td><td width="37%">Success.</td></tr>
<tr><td width="15%">-3</td><td width="40%">GNUTLS_E_UNKNOWN_COMPRESSION_ALGORITHM</td><td width="37%">Could not negotiate a supported compression method.</td></tr>
<tr><td width="15%">-6</td><td width="40%">GNUTLS_E_UNKNOWN_CIPHER_TYPE</td><td width="37%">The cipher type is unsupported.</td></tr>
<tr><td width="15%">-7</td><td width="40%">GNUTLS_E_LARGE_PACKET</td><td width="37%">The transmitted packet is too large (EMSGSIZE).</td></tr>
<tr><td width="15%">-8</td><td width="40%">GNUTLS_E_UNSUPPORTED_VERSION_PACKET</td><td width="37%">A packet with illegal or unsupported version was received.</td></tr>
<tr><td width="15%">-9</td><td width="40%">GNUTLS_E_UNEXPECTED_PACKET_LENGTH</td><td width="37%">Error decoding the received TLS packet.</td></tr>
<tr><td width="15%">-10</td><td width="40%">GNUTLS_E_INVALID_SESSION</td><td width="37%">The specified session has been invalidated for some reason.</td></tr>
<tr><td width="15%">-12</td><td width="40%">GNUTLS_E_FATAL_ALERT_RECEIVED</td><td width="37%">A TLS fatal alert has been received.</td></tr>
<tr><td width="15%">-15</td><td width="40%">GNUTLS_E_UNEXPECTED_PACKET</td><td width="37%">An unexpected TLS packet was received.</td></tr>
<tr><td width="15%">-16</td><td width="40%">GNUTLS_E_WARNING_ALERT_RECEIVED</td><td width="37%">A TLS warning alert has been received.</td></tr>
<tr><td width="15%">-18</td><td width="40%">GNUTLS_E_ERROR_IN_FINISHED_PACKET</td><td width="37%">An error was encountered at the TLS Finished packet calculation.</td></tr>
<tr><td width="15%">-19</td><td width="40%">GNUTLS_E_UNEXPECTED_HANDSHAKE_PACKET</td><td width="37%">An unexpected TLS handshake packet was received.</td></tr>
<tr><td width="15%">-21</td><td width="40%">GNUTLS_E_UNKNOWN_CIPHER_SUITE</td><td width="37%">Could not negotiate a supported cipher suite.</td></tr>
<tr><td width="15%">-22</td><td width="40%">GNUTLS_E_UNWANTED_ALGORITHM</td><td width="37%">An algorithm that is not enabled was negotiated.</td></tr>
<tr><td width="15%">-23</td><td width="40%">GNUTLS_E_MPI_SCAN_FAILED</td><td width="37%">The scanning of a large integer has failed.</td></tr>
<tr><td width="15%">-24</td><td width="40%">GNUTLS_E_DECRYPTION_FAILED</td><td width="37%">Decryption has failed.</td></tr>
<tr><td width="15%">-25</td><td width="40%">GNUTLS_E_MEMORY_ERROR</td><td width="37%">Internal error in memory allocation.</td></tr>
<tr><td width="15%">-26</td><td width="40%">GNUTLS_E_DECOMPRESSION_FAILED</td><td width="37%">Decompression of the TLS record packet has failed.</td></tr>
<tr><td width="15%">-27</td><td width="40%">GNUTLS_E_COMPRESSION_FAILED</td><td width="37%">Compression of the TLS record packet has failed.</td></tr>
<tr><td width="15%">-28</td><td width="40%">GNUTLS_E_AGAIN</td><td width="37%">Resource temporarily unavailable, try again.</td></tr>
<tr><td width="15%">-29</td><td width="40%">GNUTLS_E_EXPIRED</td><td width="37%">The session or certificate has expired.</td></tr>
<tr><td width="15%">-30</td><td width="40%">GNUTLS_E_DB_ERROR</td><td width="37%">Error in Database backend.</td></tr>
<tr><td width="15%">-31</td><td width="40%">GNUTLS_E_SRP_PWD_ERROR</td><td width="37%">Error in password/key file.</td></tr>
<tr><td width="15%">-32</td><td width="40%">GNUTLS_E_INSUFFICIENT_CREDENTIALS</td><td width="37%">Insufficient credentials for that request.</td></tr>
<tr><td width="15%">-33</td><td width="40%">GNUTLS_E_HASH_FAILED</td><td width="37%">Hashing has failed.</td></tr>
<tr><td width="15%">-34</td><td width="40%">GNUTLS_E_BASE64_DECODING_ERROR</td><td width="37%">Base64 decoding error.</td></tr>
<tr><td width="15%">-35</td><td width="40%">GNUTLS_E_MPI_PRINT_FAILED</td><td width="37%">Could not export a large integer.</td></tr>
<tr><td width="15%">-37</td><td width="40%">GNUTLS_E_REHANDSHAKE</td><td width="37%">Rehandshake was requested by the peer.</td></tr>
<tr><td width="15%">-38</td><td width="40%">GNUTLS_E_GOT_APPLICATION_DATA</td><td width="37%">TLS Application data were received, while expecting handshake data.</td></tr>
<tr><td width="15%">-39</td><td width="40%">GNUTLS_E_RECORD_LIMIT_REACHED</td><td width="37%">The upper limit of record packet sequence numbers has been reached. Wow!</td></tr>
<tr><td width="15%">-40</td><td width="40%">GNUTLS_E_ENCRYPTION_FAILED</td><td width="37%">Encryption has failed.</td></tr>
<tr><td width="15%">-43</td><td width="40%">GNUTLS_E_CERTIFICATE_ERROR</td><td width="37%">Error in the certificate.</td></tr>
<tr><td width="15%">-44</td><td width="40%">GNUTLS_E_PK_ENCRYPTION_FAILED</td><td width="37%">Public key encryption has failed.</td></tr>
<tr><td width="15%">-45</td><td width="40%">GNUTLS_E_PK_DECRYPTION_FAILED</td><td width="37%">Public key decryption has failed.</td></tr>
<tr><td width="15%">-46</td><td width="40%">GNUTLS_E_PK_SIGN_FAILED</td><td width="37%">Public key signing has failed.</td></tr>
<tr><td width="15%">-47</td><td width="40%">GNUTLS_E_X509_UNSUPPORTED_CRITICAL_EXTENSION</td><td width="37%">Unsupported critical extension in X.509 certificate.</td></tr>
<tr><td width="15%">-48</td><td width="40%">GNUTLS_E_KEY_USAGE_VIOLATION</td><td width="37%">Key usage violation in certificate has been detected.</td></tr>
<tr><td width="15%">-49</td><td width="40%">GNUTLS_E_NO_CERTIFICATE_FOUND</td><td width="37%">No certificate was found.</td></tr>
<tr><td width="15%">-50</td><td width="40%">GNUTLS_E_INVALID_REQUEST</td><td width="37%">The request is invalid.</td></tr>
<tr><td width="15%">-51</td><td width="40%">GNUTLS_E_SHORT_MEMORY_BUFFER</td><td width="37%">The given memory buffer is too short to hold parameters.</td></tr>
<tr><td width="15%">-52</td><td width="40%">GNUTLS_E_INTERRUPTED</td><td width="37%">Function was interrupted.</td></tr>
<tr><td width="15%">-53</td><td width="40%">GNUTLS_E_PUSH_ERROR</td><td width="37%">Error in the push function.</td></tr>
<tr><td width="15%">-54</td><td width="40%">GNUTLS_E_PULL_ERROR</td><td width="37%">Error in the pull function.</td></tr>
<tr><td width="15%">-55</td><td width="40%">GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER</td><td width="37%">An illegal parameter has been received.</td></tr>
<tr><td width="15%">-56</td><td width="40%">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</td><td width="37%">The requested data were not available.</td></tr>
<tr><td width="15%">-57</td><td width="40%">GNUTLS_E_PKCS1_WRONG_PAD</td><td width="37%">Wrong padding in PKCS1 packet.</td></tr>
<tr><td width="15%">-58</td><td width="40%">GNUTLS_E_RECEIVED_ILLEGAL_EXTENSION</td><td width="37%">An illegal TLS extension was received.</td></tr>
<tr><td width="15%">-59</td><td width="40%">GNUTLS_E_INTERNAL_ERROR</td><td width="37%">GnuTLS internal error.</td></tr>
<tr><td width="15%">-60</td><td width="40%">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</td><td width="37%">The certificate and the given key do not match.</td></tr>
<tr><td width="15%">-61</td><td width="40%">GNUTLS_E_UNSUPPORTED_CERTIFICATE_TYPE</td><td width="37%">The certificate type is not supported.</td></tr>
<tr><td width="15%">-62</td><td width="40%">GNUTLS_E_X509_UNKNOWN_SAN</td><td width="37%">Unknown Subject Alternative name in X.509 certificate.</td></tr>
<tr><td width="15%">-63</td><td width="40%">GNUTLS_E_DH_PRIME_UNACCEPTABLE</td><td width="37%">The Diffie-Hellman prime sent by the server is not acceptable (not long enough).</td></tr>
<tr><td width="15%">-64</td><td width="40%">GNUTLS_E_FILE_ERROR</td><td width="37%">Error while reading file.</td></tr>
<tr><td width="15%">-67</td><td width="40%">GNUTLS_E_ASN1_ELEMENT_NOT_FOUND</td><td width="37%">ASN1 parser: Element was not found.</td></tr>
<tr><td width="15%">-68</td><td width="40%">GNUTLS_E_ASN1_IDENTIFIER_NOT_FOUND</td><td width="37%">ASN1 parser: Identifier was not found</td></tr>
<tr><td width="15%">-69</td><td width="40%">GNUTLS_E_ASN1_DER_ERROR</td><td width="37%">ASN1 parser: Error in DER parsing.</td></tr>
<tr><td width="15%">-70</td><td width="40%">GNUTLS_E_ASN1_VALUE_NOT_FOUND</td><td width="37%">ASN1 parser: Value was not found.</td></tr>
<tr><td width="15%">-71</td><td width="40%">GNUTLS_E_ASN1_GENERIC_ERROR</td><td width="37%">ASN1 parser: Generic parsing error.</td></tr>
<tr><td width="15%">-72</td><td width="40%">GNUTLS_E_ASN1_VALUE_NOT_VALID</td><td width="37%">ASN1 parser: Value is not valid.</td></tr>
<tr><td width="15%">-73</td><td width="40%">GNUTLS_E_ASN1_TAG_ERROR</td><td width="37%">ASN1 parser: Error in TAG.</td></tr>
<tr><td width="15%">-74</td><td width="40%">GNUTLS_E_ASN1_TAG_IMPLICIT</td><td width="37%">ASN1 parser: error in implicit tag</td></tr>
<tr><td width="15%">-75</td><td width="40%">GNUTLS_E_ASN1_TYPE_ANY_ERROR</td><td width="37%">ASN1 parser: Error in type ’ANY’.</td></tr>
<tr><td width="15%">-76</td><td width="40%">GNUTLS_E_ASN1_SYNTAX_ERROR</td><td width="37%">ASN1 parser: Syntax error.</td></tr>
<tr><td width="15%">-77</td><td width="40%">GNUTLS_E_ASN1_DER_OVERFLOW</td><td width="37%">ASN1 parser: Overflow in DER parsing.</td></tr>
<tr><td width="15%">-78</td><td width="40%">GNUTLS_E_TOO_MANY_EMPTY_PACKETS</td><td width="37%">Too many empty record packets have been received.</td></tr>
<tr><td width="15%">-79</td><td width="40%">GNUTLS_E_OPENPGP_UID_REVOKED</td><td width="37%">The OpenPGP User ID is revoked.</td></tr>
<tr><td width="15%">-80</td><td width="40%">GNUTLS_E_UNKNOWN_PK_ALGORITHM</td><td width="37%">An unknown public key algorithm was encountered.</td></tr>
<tr><td width="15%">-81</td><td width="40%">GNUTLS_E_TOO_MANY_HANDSHAKE_PACKETS</td><td width="37%">Too many handshake packets have been received.</td></tr>
<tr><td width="15%">-82</td><td width="40%">GNUTLS_E_RECEIVED_DISALLOWED_NAME</td><td width="37%">A disallowed SNI server name has been received.</td></tr>
<tr><td width="15%">-84</td><td width="40%">GNUTLS_E_NO_TEMPORARY_RSA_PARAMS</td><td width="37%">No temporary RSA parameters were found.</td></tr>
<tr><td width="15%">-86</td><td width="40%">GNUTLS_E_NO_COMPRESSION_ALGORITHMS</td><td width="37%">No supported compression algorithms have been found.</td></tr>
<tr><td width="15%">-87</td><td width="40%">GNUTLS_E_NO_CIPHER_SUITES</td><td width="37%">No supported cipher suites have been found.</td></tr>
<tr><td width="15%">-88</td><td width="40%">GNUTLS_E_OPENPGP_GETKEY_FAILED</td><td width="37%">Could not get OpenPGP key.</td></tr>
<tr><td width="15%">-89</td><td width="40%">GNUTLS_E_PK_SIG_VERIFY_FAILED</td><td width="37%">Public key signature verification has failed.</td></tr>
<tr><td width="15%">-90</td><td width="40%">GNUTLS_E_ILLEGAL_SRP_USERNAME</td><td width="37%">The SRP username supplied is illegal.</td></tr>
<tr><td width="15%">-91</td><td width="40%">GNUTLS_E_SRP_PWD_PARSING_ERROR</td><td width="37%">Parsing error in password/key file.</td></tr>
<tr><td width="15%">-93</td><td width="40%">GNUTLS_E_NO_TEMPORARY_DH_PARAMS</td><td width="37%">No temporary DH parameters were found.</td></tr>
<tr><td width="15%">-94</td><td width="40%">GNUTLS_E_OPENPGP_FINGERPRINT_UNSUPPORTED</td><td width="37%">The OpenPGP fingerprint is not supported.</td></tr>
<tr><td width="15%">-95</td><td width="40%">GNUTLS_E_X509_UNSUPPORTED_ATTRIBUTE</td><td width="37%">The certificate has unsupported attributes.</td></tr>
<tr><td width="15%">-96</td><td width="40%">GNUTLS_E_UNKNOWN_HASH_ALGORITHM</td><td width="37%">The hash algorithm is unknown.</td></tr>
<tr><td width="15%">-97</td><td width="40%">GNUTLS_E_UNKNOWN_PKCS_CONTENT_TYPE</td><td width="37%">The PKCS structure’s content type is unknown.</td></tr>
<tr><td width="15%">-98</td><td width="40%">GNUTLS_E_UNKNOWN_PKCS_BAG_TYPE</td><td width="37%">The PKCS structure’s bag type is unknown.</td></tr>
<tr><td width="15%">-99</td><td width="40%">GNUTLS_E_INVALID_PASSWORD</td><td width="37%">The given password contains invalid characters.</td></tr>
<tr><td width="15%">-100</td><td width="40%">GNUTLS_E_MAC_VERIFY_FAILED</td><td width="37%">The Message Authentication Code verification failed.</td></tr>
<tr><td width="15%">-101</td><td width="40%">GNUTLS_E_CONSTRAINT_ERROR</td><td width="37%">Some constraint limits were reached.</td></tr>
<tr><td width="15%">-104</td><td width="40%">GNUTLS_E_IA_VERIFY_FAILED</td><td width="37%">Verifying TLS/IA phase checksum failed</td></tr>
<tr><td width="15%">-105</td><td width="40%">GNUTLS_E_UNKNOWN_ALGORITHM</td><td width="37%">The specified algorithm or protocol is unknown.</td></tr>
<tr><td width="15%">-106</td><td width="40%">GNUTLS_E_UNSUPPORTED_SIGNATURE_ALGORITHM</td><td width="37%">The signature algorithm is not supported.</td></tr>
<tr><td width="15%">-107</td><td width="40%">GNUTLS_E_SAFE_RENEGOTIATION_FAILED</td><td width="37%">Safe renegotiation failed.</td></tr>
<tr><td width="15%">-108</td><td width="40%">GNUTLS_E_UNSAFE_RENEGOTIATION_DENIED</td><td width="37%">Unsafe renegotiation denied.</td></tr>
<tr><td width="15%">-109</td><td width="40%">GNUTLS_E_UNKNOWN_SRP_USERNAME</td><td width="37%">The username supplied is unknown.</td></tr>
<tr><td width="15%">-110</td><td width="40%">GNUTLS_E_PREMATURE_TERMINATION</td><td width="37%">The TLS connection was non-properly terminated.</td></tr>
<tr><td width="15%">-111</td><td width="40%">GNUTLS_E_MALFORMED_CIDR</td><td width="37%">CIDR name constraint is malformed in size or structure.</td></tr>
<tr><td width="15%">-112</td><td width="40%">GNUTLS_E_CERTIFICATE_REQUIRED</td><td width="37%">Certificate is required.</td></tr>
<tr><td width="15%">-113</td><td width="40%">GNUTLS_E_UNSUPPORTED_ENCRYPTION_ALGORITHM</td><td width="37%">The encryption algorithm is not supported.</td></tr>
<tr><td width="15%">-201</td><td width="40%">GNUTLS_E_BASE64_ENCODING_ERROR</td><td width="37%">Base64 encoding error.</td></tr>
<tr><td width="15%">-202</td><td width="40%">GNUTLS_E_INCOMPATIBLE_GCRYPT_LIBRARY</td><td width="37%">The crypto library version is too old.</td></tr>
<tr><td width="15%">-203</td><td width="40%">GNUTLS_E_INCOMPATIBLE_LIBTASN1_LIBRARY</td><td width="37%">The tasn1 library version is too old.</td></tr>
<tr><td width="15%">-204</td><td width="40%">GNUTLS_E_OPENPGP_KEYRING_ERROR</td><td width="37%">Error loading the keyring.</td></tr>
<tr><td width="15%">-205</td><td width="40%">GNUTLS_E_X509_UNSUPPORTED_OID</td><td width="37%">The OID is not supported.</td></tr>
<tr><td width="15%">-206</td><td width="40%">GNUTLS_E_RANDOM_FAILED</td><td width="37%">Failed to acquire random data.</td></tr>
<tr><td width="15%">-207</td><td width="40%">GNUTLS_E_BASE64_UNEXPECTED_HEADER_ERROR</td><td width="37%">Base64 unexpected header error.</td></tr>
<tr><td width="15%">-208</td><td width="40%">GNUTLS_E_OPENPGP_SUBKEY_ERROR</td><td width="37%">Could not find OpenPGP subkey.</td></tr>
<tr><td width="15%">-209</td><td width="40%">GNUTLS_E_CRYPTO_ALREADY_REGISTERED</td><td width="37%">There is already a crypto algorithm with lower priority.</td></tr>
<tr><td width="15%">-210</td><td width="40%">GNUTLS_E_HANDSHAKE_TOO_LARGE</td><td width="37%">The handshake data size is too large.</td></tr>
<tr><td width="15%">-211</td><td width="40%">GNUTLS_E_CRYPTODEV_IOCTL_ERROR</td><td width="37%">Error interfacing with /dev/crypto</td></tr>
<tr><td width="15%">-212</td><td width="40%">GNUTLS_E_CRYPTODEV_DEVICE_ERROR</td><td width="37%">Error opening /dev/crypto</td></tr>
<tr><td width="15%">-213</td><td width="40%">GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE</td><td width="37%">Channel binding data not available</td></tr>
<tr><td width="15%">-214</td><td width="40%">GNUTLS_E_BAD_COOKIE</td><td width="37%">The cookie was bad.</td></tr>
<tr><td width="15%">-215</td><td width="40%">GNUTLS_E_OPENPGP_PREFERRED_KEY_ERROR</td><td width="37%">The OpenPGP key has not a preferred key set.</td></tr>
<tr><td width="15%">-216</td><td width="40%">GNUTLS_E_INCOMPAT_DSA_KEY_WITH_TLS_PROTOCOL</td><td width="37%">The given DSA key is incompatible with the selected TLS protocol.</td></tr>
<tr><td width="15%">-217</td><td width="40%">GNUTLS_E_INSUFFICIENT_SECURITY</td><td width="37%">One of the involved algorithms has insufficient security level.</td></tr>
<tr><td width="15%">-292</td><td width="40%">GNUTLS_E_HEARTBEAT_PONG_RECEIVED</td><td width="37%">A heartbeat pong message was received.</td></tr>
<tr><td width="15%">-293</td><td width="40%">GNUTLS_E_HEARTBEAT_PING_RECEIVED</td><td width="37%">A heartbeat ping message was received.</td></tr>
<tr><td width="15%">-294</td><td width="40%">GNUTLS_E_UNRECOGNIZED_NAME</td><td width="37%">The SNI host name not recognised.</td></tr>
<tr><td width="15%">-300</td><td width="40%">GNUTLS_E_PKCS11_ERROR</td><td width="37%">PKCS #11 error.</td></tr>
<tr><td width="15%">-301</td><td width="40%">GNUTLS_E_PKCS11_LOAD_ERROR</td><td width="37%">PKCS #11 initialization error.</td></tr>
<tr><td width="15%">-302</td><td width="40%">GNUTLS_E_PARSING_ERROR</td><td width="37%">Error in parsing.</td></tr>
<tr><td width="15%">-303</td><td width="40%">GNUTLS_E_PKCS11_PIN_ERROR</td><td width="37%">Error in provided PIN.</td></tr>
<tr><td width="15%">-305</td><td width="40%">GNUTLS_E_PKCS11_SLOT_ERROR</td><td width="37%">PKCS #11 error in slot</td></tr>
<tr><td width="15%">-306</td><td width="40%">GNUTLS_E_LOCKING_ERROR</td><td width="37%">Thread locking error</td></tr>
<tr><td width="15%">-307</td><td width="40%">GNUTLS_E_PKCS11_ATTRIBUTE_ERROR</td><td width="37%">PKCS #11 error in attribute</td></tr>
<tr><td width="15%">-308</td><td width="40%">GNUTLS_E_PKCS11_DEVICE_ERROR</td><td width="37%">PKCS #11 error in device</td></tr>
<tr><td width="15%">-309</td><td width="40%">GNUTLS_E_PKCS11_DATA_ERROR</td><td width="37%">PKCS #11 error in data</td></tr>
<tr><td width="15%">-310</td><td width="40%">GNUTLS_E_PKCS11_UNSUPPORTED_FEATURE_ERROR</td><td width="37%">PKCS #11 unsupported feature</td></tr>
<tr><td width="15%">-311</td><td width="40%">GNUTLS_E_PKCS11_KEY_ERROR</td><td width="37%">PKCS #11 error in key</td></tr>
<tr><td width="15%">-312</td><td width="40%">GNUTLS_E_PKCS11_PIN_EXPIRED</td><td width="37%">PKCS #11 PIN expired</td></tr>
<tr><td width="15%">-313</td><td width="40%">GNUTLS_E_PKCS11_PIN_LOCKED</td><td width="37%">PKCS #11 PIN locked</td></tr>
<tr><td width="15%">-314</td><td width="40%">GNUTLS_E_PKCS11_SESSION_ERROR</td><td width="37%">PKCS #11 error in session</td></tr>
<tr><td width="15%">-315</td><td width="40%">GNUTLS_E_PKCS11_SIGNATURE_ERROR</td><td width="37%">PKCS #11 error in signature</td></tr>
<tr><td width="15%">-316</td><td width="40%">GNUTLS_E_PKCS11_TOKEN_ERROR</td><td width="37%">PKCS #11 error in token</td></tr>
<tr><td width="15%">-317</td><td width="40%">GNUTLS_E_PKCS11_USER_ERROR</td><td width="37%">PKCS #11 user error</td></tr>
<tr><td width="15%">-318</td><td width="40%">GNUTLS_E_CRYPTO_INIT_FAILED</td><td width="37%">The initialization of crypto backend has failed.</td></tr>
<tr><td width="15%">-319</td><td width="40%">GNUTLS_E_TIMEDOUT</td><td width="37%">The operation timed out</td></tr>
<tr><td width="15%">-320</td><td width="40%">GNUTLS_E_USER_ERROR</td><td width="37%">The operation was cancelled due to user error</td></tr>
<tr><td width="15%">-321</td><td width="40%">GNUTLS_E_ECC_NO_SUPPORTED_CURVES</td><td width="37%">No supported ECC curves were found</td></tr>
<tr><td width="15%">-322</td><td width="40%">GNUTLS_E_ECC_UNSUPPORTED_CURVE</td><td width="37%">The curve is unsupported</td></tr>
<tr><td width="15%">-323</td><td width="40%">GNUTLS_E_PKCS11_REQUESTED_OBJECT_NOT_AVAILBLE</td><td width="37%">The requested PKCS #11 object is not available</td></tr>
<tr><td width="15%">-324</td><td width="40%">GNUTLS_E_CERTIFICATE_LIST_UNSORTED</td><td width="37%">The provided X.509 certificate list is not sorted (in subject to issuer order)</td></tr>
<tr><td width="15%">-325</td><td width="40%">GNUTLS_E_ILLEGAL_PARAMETER</td><td width="37%">An illegal parameter was found.</td></tr>
<tr><td width="15%">-326</td><td width="40%">GNUTLS_E_NO_PRIORITIES_WERE_SET</td><td width="37%">No or insufficient priorities were set.</td></tr>
<tr><td width="15%">-327</td><td width="40%">GNUTLS_E_X509_UNSUPPORTED_EXTENSION</td><td width="37%">Unsupported extension in X.509 certificate.</td></tr>
<tr><td width="15%">-328</td><td width="40%">GNUTLS_E_SESSION_EOF</td><td width="37%">Peer has terminated the connection</td></tr>
<tr><td width="15%">-329</td><td width="40%">GNUTLS_E_TPM_ERROR</td><td width="37%">TPM error.</td></tr>
<tr><td width="15%">-330</td><td width="40%">GNUTLS_E_TPM_KEY_PASSWORD_ERROR</td><td width="37%">Error in provided password for key to be loaded in TPM.</td></tr>
<tr><td width="15%">-331</td><td width="40%">GNUTLS_E_TPM_SRK_PASSWORD_ERROR</td><td width="37%">Error in provided SRK password for TPM.</td></tr>
<tr><td width="15%">-332</td><td width="40%">GNUTLS_E_TPM_SESSION_ERROR</td><td width="37%">Cannot initialize a session with the TPM.</td></tr>
<tr><td width="15%">-333</td><td width="40%">GNUTLS_E_TPM_KEY_NOT_FOUND</td><td width="37%">TPM key was not found in persistent storage.</td></tr>
<tr><td width="15%">-334</td><td width="40%">GNUTLS_E_TPM_UNINITIALIZED</td><td width="37%">TPM is not initialized.</td></tr>
<tr><td width="15%">-335</td><td width="40%">GNUTLS_E_TPM_NO_LIB</td><td width="37%">The TPM library (trousers) cannot be found.</td></tr>
<tr><td width="15%">-340</td><td width="40%">GNUTLS_E_NO_CERTIFICATE_STATUS</td><td width="37%">There is no certificate status (OCSP).</td></tr>
<tr><td width="15%">-341</td><td width="40%">GNUTLS_E_OCSP_RESPONSE_ERROR</td><td width="37%">The OCSP response is invalid</td></tr>
<tr><td width="15%">-342</td><td width="40%">GNUTLS_E_RANDOM_DEVICE_ERROR</td><td width="37%">Error in the system’s randomness device.</td></tr>
<tr><td width="15%">-343</td><td width="40%">GNUTLS_E_AUTH_ERROR</td><td width="37%">Could not authenticate peer.</td></tr>
<tr><td width="15%">-344</td><td width="40%">GNUTLS_E_NO_APPLICATION_PROTOCOL</td><td width="37%">No common application protocol could be negotiated.</td></tr>
<tr><td width="15%">-345</td><td width="40%">GNUTLS_E_SOCKETS_INIT_ERROR</td><td width="37%">Error in sockets initialization.</td></tr>
<tr><td width="15%">-346</td><td width="40%">GNUTLS_E_KEY_IMPORT_FAILED</td><td width="37%">Failed to import the key into store.</td></tr>
<tr><td width="15%">-347</td><td width="40%">GNUTLS_E_INAPPROPRIATE_FALLBACK</td><td width="37%">A connection with inappropriate fallback was attempted.</td></tr>
<tr><td width="15%">-348</td><td width="40%">GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR</td><td width="37%">Error in the certificate verification.</td></tr>
<tr><td width="15%">-349</td><td width="40%">GNUTLS_E_PRIVKEY_VERIFICATION_ERROR</td><td width="37%">Error in the private key verification; seed doesn’t match.</td></tr>
<tr><td width="15%">-350</td><td width="40%">GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH</td><td width="37%">Invalid TLS extensions length field.</td></tr>
<tr><td width="15%">-351</td><td width="40%">GNUTLS_E_ASN1_EMBEDDED_NULL_IN_STRING</td><td width="37%">The provided string has an embedded null.</td></tr>
<tr><td width="15%">-400</td><td width="40%">GNUTLS_E_SELF_TEST_ERROR</td><td width="37%">Error while performing self checks.</td></tr>
<tr><td width="15%">-401</td><td width="40%">GNUTLS_E_NO_SELF_TEST</td><td width="37%">There is no self test for this algorithm.</td></tr>
<tr><td width="15%">-402</td><td width="40%">GNUTLS_E_LIB_IN_ERROR_STATE</td><td width="37%">An error has been detected in the library and cannot continue operations.</td></tr>
<tr><td width="15%">-403</td><td width="40%">GNUTLS_E_PK_GENERATION_ERROR</td><td width="37%">Error in public key generation.</td></tr>
<tr><td width="15%">-404</td><td width="40%">GNUTLS_E_IDNA_ERROR</td><td width="37%">There was an issue converting to or from UTF8.</td></tr>
<tr><td width="15%">-406</td><td width="40%">GNUTLS_E_SESSION_USER_ID_CHANGED</td><td width="37%">Peer’s certificate or username has changed during a rehandshake.</td></tr>
<tr><td width="15%">-407</td><td width="40%">GNUTLS_E_HANDSHAKE_DURING_FALSE_START</td><td width="37%">Attempted handshake during false start.</td></tr>
<tr><td width="15%">-408</td><td width="40%">GNUTLS_E_UNAVAILABLE_DURING_HANDSHAKE</td><td width="37%">Cannot perform this action while handshake is in progress.</td></tr>
<tr><td width="15%">-409</td><td width="40%">GNUTLS_E_PK_INVALID_PUBKEY</td><td width="37%">The public key is invalid.</td></tr>
<tr><td width="15%">-410</td><td width="40%">GNUTLS_E_PK_INVALID_PRIVKEY</td><td width="37%">The private key is invalid.</td></tr>
<tr><td width="15%">-411</td><td width="40%">GNUTLS_E_NOT_YET_ACTIVATED</td><td width="37%">The certificate is not yet activated.</td></tr>
<tr><td width="15%">-412</td><td width="40%">GNUTLS_E_INVALID_UTF8_STRING</td><td width="37%">The given string contains invalid UTF-8 characters.</td></tr>
<tr><td width="15%">-413</td><td width="40%">GNUTLS_E_NO_EMBEDDED_DATA</td><td width="37%">There are no embedded data in the structure.</td></tr>
<tr><td width="15%">-414</td><td width="40%">GNUTLS_E_INVALID_UTF8_EMAIL</td><td width="37%">The given email string contains non-ASCII characters before ’.́</td></tr>
<tr><td width="15%">-415</td><td width="40%">GNUTLS_E_INVALID_PASSWORD_STRING</td><td width="37%">The given password contains invalid characters.</td></tr>
<tr><td width="15%">-416</td><td width="40%">GNUTLS_E_CERTIFICATE_TIME_ERROR</td><td width="37%">Error in the time fields of certificate.</td></tr>
<tr><td width="15%">-417</td><td width="40%">GNUTLS_E_RECORD_OVERFLOW</td><td width="37%">A TLS record packet with invalid length was received.</td></tr>
<tr><td width="15%">-418</td><td width="40%">GNUTLS_E_ASN1_TIME_ERROR</td><td width="37%">The DER time encoding is invalid.</td></tr>
<tr><td width="15%">-419</td><td width="40%">GNUTLS_E_INCOMPATIBLE_SIG_WITH_KEY</td><td width="37%">The signature is incompatible with the public key.</td></tr>
<tr><td width="15%">-420</td><td width="40%">GNUTLS_E_PK_INVALID_PUBKEY_PARAMS</td><td width="37%">The public key parameters are invalid.</td></tr>
<tr><td width="15%">-421</td><td width="40%">GNUTLS_E_PK_NO_VALIDATION_PARAMS</td><td width="37%">There are no validation parameters present.</td></tr>
<tr><td width="15%">-422</td><td width="40%">GNUTLS_E_OCSP_MISMATCH_WITH_CERTS</td><td width="37%">The OCSP response provided doesn’t match the available certificates</td></tr>
<tr><td width="15%">-423</td><td width="40%">GNUTLS_E_NO_COMMON_KEY_SHARE</td><td width="37%">No common key share with peer.</td></tr>
<tr><td width="15%">-424</td><td width="40%">GNUTLS_E_REAUTH_REQUEST</td><td width="37%">Re-authentication was requested by the peer.</td></tr>
<tr><td width="15%">-425</td><td width="40%">GNUTLS_E_TOO_MANY_MATCHES</td><td width="37%">More than a single object matches the criteria.</td></tr>
<tr><td width="15%">-426</td><td width="40%">GNUTLS_E_CRL_VERIFICATION_ERROR</td><td width="37%">Error in the CRL verification.</td></tr>
<tr><td width="15%">-427</td><td width="40%">GNUTLS_E_MISSING_EXTENSION</td><td width="37%">An required TLS extension was received.</td></tr>
<tr><td width="15%">-428</td><td width="40%">GNUTLS_E_DB_ENTRY_EXISTS</td><td width="37%">The Database entry already exists.</td></tr>
<tr><td width="15%">-429</td><td width="40%">GNUTLS_E_EARLY_DATA_REJECTED</td><td width="37%">The early data were rejected.</td></tr>
<tr><td width="15%">-430</td><td width="40%">GNUTLS_E_X509_DUPLICATE_EXTENSION</td><td width="37%">Duplicate extension in X.509 certificate.</td></tr>
</tbody>
</table>
<hr>
</div>
<div class="appendix-level-extent" id="Supported-ciphersuites">
<div class="nav-panel">
<p>
Next: <a href="#API-reference" accesskey="n" rel="next">API reference</a>, Previous: <a href="#Error-codes" accesskey="p" rel="prev">Error Codes and Descriptions</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="appendix" id="Supported-Ciphersuites"><span>Appendix D Supported Ciphersuites<a class="copiable-link" href="#Supported-Ciphersuites"> ¶</a></span></h2>
<a class="anchor" id="ciphersuites"></a><a class="index-entry-id" id="index-ciphersuites"></a>
<h3 class="heading" id="Ciphersuites"><span>Ciphersuites<a class="copiable-link" href="#Ciphersuites"> ¶</a></span></h3>
<table class="multitable">
<thead><tr><th width="60%">Ciphersuite name</th><th width="20%">TLS ID</th><th width="20%">Since</th></tr></thead>
<tbody><tr><td width="60%">TLS_AES_128_GCM_SHA256</td><td width="20%">0x13 0x01</td><td width="20%">TLS1.3</td></tr>
<tr><td width="60%">TLS_AES_256_GCM_SHA384</td><td width="20%">0x13 0x02</td><td width="20%">TLS1.3</td></tr>
<tr><td width="60%">TLS_CHACHA20_POLY1305_SHA256</td><td width="20%">0x13 0x03</td><td width="20%">TLS1.3</td></tr>
<tr><td width="60%">TLS_AES_128_CCM_SHA256</td><td width="20%">0x13 0x04</td><td width="20%">TLS1.3</td></tr>
<tr><td width="60%">TLS_AES_128_CCM_8_SHA256</td><td width="20%">0x13 0x05</td><td width="20%">TLS1.3</td></tr>
<tr><td width="60%">TLS_RSA_NULL_MD5</td><td width="20%">0x00 0x01</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_NULL_SHA1</td><td width="20%">0x00 0x02</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_NULL_SHA256</td><td width="20%">0x00 0x3B</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_ARCFOUR_128_SHA1</td><td width="20%">0x00 0x05</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_ARCFOUR_128_MD5</td><td width="20%">0x00 0x04</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_3DES_EDE_CBC_SHA1</td><td width="20%">0x00 0x0A</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_AES_128_CBC_SHA1</td><td width="20%">0x00 0x2F</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_AES_256_CBC_SHA1</td><td width="20%">0x00 0x35</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_CAMELLIA_128_CBC_SHA256</td><td width="20%">0x00 0xBA</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_CAMELLIA_256_CBC_SHA256</td><td width="20%">0x00 0xC0</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_CAMELLIA_128_CBC_SHA1</td><td width="20%">0x00 0x41</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_CAMELLIA_256_CBC_SHA1</td><td width="20%">0x00 0x84</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_AES_128_CBC_SHA256</td><td width="20%">0x00 0x3C</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_AES_256_CBC_SHA256</td><td width="20%">0x00 0x3D</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_AES_128_GCM_SHA256</td><td width="20%">0x00 0x9C</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_AES_256_GCM_SHA384</td><td width="20%">0x00 0x9D</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x7A</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x7B</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_AES_128_CCM</td><td width="20%">0xC0 0x9C</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_AES_256_CCM</td><td width="20%">0xC0 0x9D</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_AES_128_CCM_8</td><td width="20%">0xC0 0xA0</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_AES_256_CCM_8</td><td width="20%">0xC0 0xA1</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_ARCFOUR_128_SHA1</td><td width="20%">0x00 0x66</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_DSS_3DES_EDE_CBC_SHA1</td><td width="20%">0x00 0x13</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_DSS_AES_128_CBC_SHA1</td><td width="20%">0x00 0x32</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_DSS_AES_256_CBC_SHA1</td><td width="20%">0x00 0x38</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_DSS_CAMELLIA_128_CBC_SHA256</td><td width="20%">0x00 0xBD</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_CAMELLIA_256_CBC_SHA256</td><td width="20%">0x00 0xC3</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_CAMELLIA_128_CBC_SHA1</td><td width="20%">0x00 0x44</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_DSS_CAMELLIA_256_CBC_SHA1</td><td width="20%">0x00 0x87</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_DSS_AES_128_CBC_SHA256</td><td width="20%">0x00 0x40</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_AES_256_CBC_SHA256</td><td width="20%">0x00 0x6A</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_AES_128_GCM_SHA256</td><td width="20%">0x00 0xA2</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_AES_256_GCM_SHA384</td><td width="20%">0x00 0xA3</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x80</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_DSS_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x81</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_3DES_EDE_CBC_SHA1</td><td width="20%">0x00 0x16</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_128_CBC_SHA1</td><td width="20%">0x00 0x33</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_256_CBC_SHA1</td><td width="20%">0x00 0x39</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_RSA_CAMELLIA_128_CBC_SHA256</td><td width="20%">0x00 0xBE</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_CAMELLIA_256_CBC_SHA256</td><td width="20%">0x00 0xC4</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_CAMELLIA_128_CBC_SHA1</td><td width="20%">0x00 0x45</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_RSA_CAMELLIA_256_CBC_SHA1</td><td width="20%">0x00 0x88</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_128_CBC_SHA256</td><td width="20%">0x00 0x67</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_256_CBC_SHA256</td><td width="20%">0x00 0x6B</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_128_GCM_SHA256</td><td width="20%">0x00 0x9E</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_256_GCM_SHA384</td><td width="20%">0x00 0x9F</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x7C</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x7D</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_CHACHA20_POLY1305</td><td width="20%">0xCC 0xAA</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_128_CCM</td><td width="20%">0xC0 0x9E</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_256_CCM</td><td width="20%">0xC0 0x9F</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_128_CCM_8</td><td width="20%">0xC0 0xA2</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_RSA_AES_256_CCM_8</td><td width="20%">0xC0 0xA3</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_NULL_SHA1</td><td width="20%">0xC0 0x10</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_3DES_EDE_CBC_SHA1</td><td width="20%">0xC0 0x12</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_AES_128_CBC_SHA1</td><td width="20%">0xC0 0x13</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_AES_256_CBC_SHA1</td><td width="20%">0xC0 0x14</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_AES_256_CBC_SHA384</td><td width="20%">0xC0 0x28</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_ARCFOUR_128_SHA1</td><td width="20%">0xC0 0x11</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_CAMELLIA_128_CBC_SHA256</td><td width="20%">0xC0 0x76</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_CAMELLIA_256_CBC_SHA384</td><td width="20%">0xC0 0x77</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_NULL_SHA1</td><td width="20%">0xC0 0x06</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_3DES_EDE_CBC_SHA1</td><td width="20%">0xC0 0x08</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_128_CBC_SHA1</td><td width="20%">0xC0 0x09</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_256_CBC_SHA1</td><td width="20%">0xC0 0x0A</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_ARCFOUR_128_SHA1</td><td width="20%">0xC0 0x07</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_CAMELLIA_128_CBC_SHA256</td><td width="20%">0xC0 0x72</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_CAMELLIA_256_CBC_SHA384</td><td width="20%">0xC0 0x73</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_128_CBC_SHA256</td><td width="20%">0xC0 0x23</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_AES_128_CBC_SHA256</td><td width="20%">0xC0 0x27</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x86</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x87</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_128_GCM_SHA256</td><td width="20%">0xC0 0x2B</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_256_GCM_SHA384</td><td width="20%">0xC0 0x2C</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_AES_128_GCM_SHA256</td><td width="20%">0xC0 0x2F</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_AES_256_GCM_SHA384</td><td width="20%">0xC0 0x30</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_256_CBC_SHA384</td><td width="20%">0xC0 0x24</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x8A</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x8B</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_RSA_CHACHA20_POLY1305</td><td width="20%">0xCC 0xA8</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_CHACHA20_POLY1305</td><td width="20%">0xCC 0xA9</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_128_CCM</td><td width="20%">0xC0 0xAC</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_256_CCM</td><td width="20%">0xC0 0xAD</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_128_CCM_8</td><td width="20%">0xC0 0xAE</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_ECDSA_AES_256_CCM_8</td><td width="20%">0xC0 0xAF</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_3DES_EDE_CBC_SHA1</td><td width="20%">0xC0 0x34</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_AES_128_CBC_SHA1</td><td width="20%">0xC0 0x35</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_AES_256_CBC_SHA1</td><td width="20%">0xC0 0x36</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_AES_128_CBC_SHA256</td><td width="20%">0xC0 0x37</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_AES_256_CBC_SHA384</td><td width="20%">0xC0 0x38</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_ARCFOUR_128_SHA1</td><td width="20%">0xC0 0x33</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_NULL_SHA1</td><td width="20%">0xC0 0x39</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_NULL_SHA256</td><td width="20%">0xC0 0x3A</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_NULL_SHA384</td><td width="20%">0xC0 0x3B</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_CAMELLIA_128_CBC_SHA256</td><td width="20%">0xC0 0x9A</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_CAMELLIA_256_CBC_SHA384</td><td width="20%">0xC0 0x9B</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_ARCFOUR_128_SHA1</td><td width="20%">0x00 0x8A</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_PSK_3DES_EDE_CBC_SHA1</td><td width="20%">0x00 0x8B</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_PSK_AES_128_CBC_SHA1</td><td width="20%">0x00 0x8C</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_PSK_AES_256_CBC_SHA1</td><td width="20%">0x00 0x8D</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_PSK_AES_128_CBC_SHA256</td><td width="20%">0x00 0xAE</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_AES_256_GCM_SHA384</td><td width="20%">0x00 0xA9</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x8E</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x8F</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_AES_128_GCM_SHA256</td><td width="20%">0x00 0xA8</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_NULL_SHA1</td><td width="20%">0x00 0x2C</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_PSK_NULL_SHA256</td><td width="20%">0x00 0xB0</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_CAMELLIA_128_CBC_SHA256</td><td width="20%">0xC0 0x94</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_CAMELLIA_256_CBC_SHA384</td><td width="20%">0xC0 0x95</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_AES_256_CBC_SHA384</td><td width="20%">0x00 0xAF</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_NULL_SHA384</td><td width="20%">0x00 0xB1</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_ARCFOUR_128_SHA1</td><td width="20%">0x00 0x92</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_PSK_3DES_EDE_CBC_SHA1</td><td width="20%">0x00 0x93</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_PSK_AES_128_CBC_SHA1</td><td width="20%">0x00 0x94</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_PSK_AES_256_CBC_SHA1</td><td width="20%">0x00 0x95</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_PSK_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x92</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x93</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_AES_128_GCM_SHA256</td><td width="20%">0x00 0xAC</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_AES_128_CBC_SHA256</td><td width="20%">0x00 0xB6</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_NULL_SHA1</td><td width="20%">0x00 0x2E</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_RSA_PSK_NULL_SHA256</td><td width="20%">0x00 0xB8</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_AES_256_GCM_SHA384</td><td width="20%">0x00 0xAD</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_AES_256_CBC_SHA384</td><td width="20%">0x00 0xB7</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_NULL_SHA384</td><td width="20%">0x00 0xB9</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_CAMELLIA_128_CBC_SHA256</td><td width="20%">0xC0 0x98</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_CAMELLIA_256_CBC_SHA384</td><td width="20%">0xC0 0x99</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_ARCFOUR_128_SHA1</td><td width="20%">0x00 0x8E</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_PSK_3DES_EDE_CBC_SHA1</td><td width="20%">0x00 0x8F</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_128_CBC_SHA1</td><td width="20%">0x00 0x90</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_256_CBC_SHA1</td><td width="20%">0x00 0x91</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_128_CBC_SHA256</td><td width="20%">0x00 0xB2</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_128_GCM_SHA256</td><td width="20%">0x00 0xAA</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_NULL_SHA1</td><td width="20%">0x00 0x2D</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DHE_PSK_NULL_SHA256</td><td width="20%">0x00 0xB4</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_NULL_SHA384</td><td width="20%">0x00 0xB5</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_256_CBC_SHA384</td><td width="20%">0x00 0xB3</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_256_GCM_SHA384</td><td width="20%">0x00 0xAB</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_CAMELLIA_128_CBC_SHA256</td><td width="20%">0xC0 0x96</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_CAMELLIA_256_CBC_SHA384</td><td width="20%">0xC0 0x97</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x90</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x91</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_AES_128_CCM</td><td width="20%">0xC0 0xA4</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_AES_256_CCM</td><td width="20%">0xC0 0xA5</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_128_CCM</td><td width="20%">0xC0 0xA6</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_256_CCM</td><td width="20%">0xC0 0xA7</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_AES_128_CCM_8</td><td width="20%">0xC0 0xA8</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_AES_256_CCM_8</td><td width="20%">0xC0 0xA9</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_128_CCM_8</td><td width="20%">0xC0 0xAA</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_AES_256_CCM_8</td><td width="20%">0xC0 0xAB</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DHE_PSK_CHACHA20_POLY1305</td><td width="20%">0xCC 0xAD</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDHE_PSK_CHACHA20_POLY1305</td><td width="20%">0xCC 0xAC</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_RSA_PSK_CHACHA20_POLY1305</td><td width="20%">0xCC 0xAE</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_PSK_CHACHA20_POLY1305</td><td width="20%">0xCC 0xAB</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_ARCFOUR_128_MD5</td><td width="20%">0x00 0x18</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DH_ANON_3DES_EDE_CBC_SHA1</td><td width="20%">0x00 0x1B</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DH_ANON_AES_128_CBC_SHA1</td><td width="20%">0x00 0x34</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DH_ANON_AES_256_CBC_SHA1</td><td width="20%">0x00 0x3A</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DH_ANON_CAMELLIA_128_CBC_SHA256</td><td width="20%">0x00 0xBF</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_CAMELLIA_256_CBC_SHA256</td><td width="20%">0x00 0xC5</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_CAMELLIA_128_CBC_SHA1</td><td width="20%">0x00 0x46</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DH_ANON_CAMELLIA_256_CBC_SHA1</td><td width="20%">0x00 0x89</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_DH_ANON_AES_128_CBC_SHA256</td><td width="20%">0x00 0x6C</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_AES_256_CBC_SHA256</td><td width="20%">0x00 0x6D</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_AES_128_GCM_SHA256</td><td width="20%">0x00 0xA6</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_AES_256_GCM_SHA384</td><td width="20%">0x00 0xA7</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_CAMELLIA_128_GCM_SHA256</td><td width="20%">0xC0 0x84</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_DH_ANON_CAMELLIA_256_GCM_SHA384</td><td width="20%">0xC0 0x85</td><td width="20%">TLS1.2</td></tr>
<tr><td width="60%">TLS_ECDH_ANON_NULL_SHA1</td><td width="20%">0xC0 0x15</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDH_ANON_3DES_EDE_CBC_SHA1</td><td width="20%">0xC0 0x17</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDH_ANON_AES_128_CBC_SHA1</td><td width="20%">0xC0 0x18</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDH_ANON_AES_256_CBC_SHA1</td><td width="20%">0xC0 0x19</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_ECDH_ANON_ARCFOUR_128_SHA1</td><td width="20%">0xC0 0x16</td><td width="20%">TLS1.0</td></tr>
<tr><td width="60%">TLS_GOSTR341112_256_28147_CNT_IMIT</td><td width="20%">0xC1 0x02</td><td width="20%">TLS1.2</td></tr>
</tbody>
</table>
<h3 class="heading" id="Certificate-types"><span>Certificate types<a class="copiable-link" href="#Certificate-types"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">X.509</code></dt>
<dt><code class="code">Raw Public Key</code></dt>
</dl>
<h3 class="heading" id="Protocols"><span>Protocols<a class="copiable-link" href="#Protocols"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">TLS1.0</code></dt>
<dt><code class="code">TLS1.1</code></dt>
<dt><code class="code">TLS1.2</code></dt>
<dt><code class="code">TLS1.3</code></dt>
<dt><code class="code">DTLS0.9</code></dt>
<dt><code class="code">DTLS1.0</code></dt>
<dt><code class="code">DTLS1.2</code></dt>
</dl>
<h3 class="heading" id="Ciphers"><span>Ciphers<a class="copiable-link" href="#Ciphers"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">AES-256-CBC</code></dt>
<dt><code class="code">AES-192-CBC</code></dt>
<dt><code class="code">AES-128-CBC</code></dt>
<dt><code class="code">AES-128-GCM</code></dt>
<dt><code class="code">AES-192-GCM</code></dt>
<dt><code class="code">AES-256-GCM</code></dt>
<dt><code class="code">AES-128-CCM</code></dt>
<dt><code class="code">AES-256-CCM</code></dt>
<dt><code class="code">AES-128-CCM-8</code></dt>
<dt><code class="code">AES-256-CCM-8</code></dt>
<dt><code class="code">ARCFOUR-128</code></dt>
<dt><code class="code">ESTREAM-SALSA20-256</code></dt>
<dt><code class="code">SALSA20-256</code></dt>
<dt><code class="code">CHACHA20-32</code></dt>
<dt><code class="code">CHACHA20-64</code></dt>
<dt><code class="code">CAMELLIA-256-CBC</code></dt>
<dt><code class="code">CAMELLIA-192-CBC</code></dt>
<dt><code class="code">CAMELLIA-128-CBC</code></dt>
<dt><code class="code">CHACHA20-POLY1305</code></dt>
<dt><code class="code">CAMELLIA-128-GCM</code></dt>
<dt><code class="code">CAMELLIA-256-GCM</code></dt>
<dt><code class="code">GOST28147-TC26Z-CFB</code></dt>
<dt><code class="code">GOST28147-CPA-CFB</code></dt>
<dt><code class="code">GOST28147-CPB-CFB</code></dt>
<dt><code class="code">GOST28147-CPC-CFB</code></dt>
<dt><code class="code">GOST28147-CPD-CFB</code></dt>
<dt><code class="code">AES-128-CFB8</code></dt>
<dt><code class="code">AES-192-CFB8</code></dt>
<dt><code class="code">AES-256-CFB8</code></dt>
<dt><code class="code">AES-128-CFB</code></dt>
<dt><code class="code">AES-192-CFB</code></dt>
<dt><code class="code">AES-256-CFB</code></dt>
<dt><code class="code">AES-128-XTS</code></dt>
<dt><code class="code">AES-256-XTS</code></dt>
<dt><code class="code">AES-128-SIV</code></dt>
<dt><code class="code">AES-256-SIV</code></dt>
<dt><code class="code">AES-128-SIV-GCM</code></dt>
<dt><code class="code">AES-256-SIV-GCM</code></dt>
<dt><code class="code">GOST28147-TC26Z-CNT</code></dt>
<dt><code class="code">MAGMA-CTR-ACPKM</code></dt>
<dt><code class="code">KUZNYECHIK-CTR-ACPKM</code></dt>
<dt><code class="code">3DES-CBC</code></dt>
<dt><code class="code">DES-CBC</code></dt>
<dt><code class="code">RC2-40</code></dt>
<dt><code class="code">NULL</code></dt>
</dl>
<h3 class="heading" id="MAC-algorithms"><span>MAC algorithms<a class="copiable-link" href="#MAC-algorithms"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">SHA1</code></dt>
<dt><code class="code">SHA256</code></dt>
<dt><code class="code">SHA384</code></dt>
<dt><code class="code">SHA512</code></dt>
<dt><code class="code">SHA224</code></dt>
<dt><code class="code">UMAC-96</code></dt>
<dt><code class="code">UMAC-128</code></dt>
<dt><code class="code">AEAD</code></dt>
<dt><code class="code">MD5</code></dt>
<dt><code class="code">GOSTR341194</code></dt>
<dt><code class="code">STREEBOG-256</code></dt>
<dt><code class="code">STREEBOG-512</code></dt>
<dt><code class="code">AES-CMAC-128</code></dt>
<dt><code class="code">AES-CMAC-256</code></dt>
<dt><code class="code">AES-GMAC-128</code></dt>
<dt><code class="code">AES-GMAC-192</code></dt>
<dt><code class="code">AES-GMAC-256</code></dt>
<dt><code class="code">GOST28147-TC26Z-IMIT</code></dt>
<dt><code class="code">OMAC-MAGMA</code></dt>
<dt><code class="code">OMAC-KUZNYECHIK</code></dt>
<dt><code class="code">PBMAC1</code></dt>
</dl>
<h3 class="heading" id="Key-exchange-methods"><span>Key exchange methods<a class="copiable-link" href="#Key-exchange-methods"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">ECDHE-RSA</code></dt>
<dt><code class="code">ECDHE-ECDSA</code></dt>
<dt><code class="code">RSA</code></dt>
<dt><code class="code">DHE-RSA</code></dt>
<dt><code class="code">DHE-DSS</code></dt>
<dt><code class="code">PSK</code></dt>
<dt><code class="code">RSA-PSK</code></dt>
<dt><code class="code">DHE-PSK</code></dt>
<dt><code class="code">ECDHE-PSK</code></dt>
<dt><code class="code">ANON-DH</code></dt>
<dt><code class="code">ANON-ECDH</code></dt>
<dt><code class="code">VKO-GOST-12</code></dt>
<dt><code class="code">RSA-EXPORT</code></dt>
</dl>
<h3 class="heading" id="Public-key-algorithms-2"><span>Public key algorithms<a class="copiable-link" href="#Public-key-algorithms-2"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">RSA</code></dt>
<dt><code class="code">RSA-PSS</code></dt>
<dt><code class="code">RSA-OAEP</code></dt>
<dt><code class="code">RSA</code></dt>
<dt><code class="code">DSA</code></dt>
<dt><code class="code">GOST R 34.10-2012-512</code></dt>
<dt><code class="code">GOST R 34.10-2012-256</code></dt>
<dt><code class="code">GOST R 34.10-2001</code></dt>
<dt><code class="code">EC/ECDSA</code></dt>
<dt><code class="code">EdDSA (Ed25519)</code></dt>
<dt><code class="code">EdDSA (Ed448)</code></dt>
<dt><code class="code">DH</code></dt>
<dt><code class="code">ECDH (X25519)</code></dt>
<dt><code class="code">ECDH (X448)</code></dt>
</dl>
<h3 class="heading" id="Public-key-signature-algorithms"><span>Public key signature algorithms<a class="copiable-link" href="#Public-key-signature-algorithms"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">RSA-SHA256</code></dt>
<dt><code class="code">RSA-SHA384</code></dt>
<dt><code class="code">RSA-SHA512</code></dt>
<dt><code class="code">RSA-PSS-SHA256</code></dt>
<dt><code class="code">RSA-PSS-RSAE-SHA256</code></dt>
<dt><code class="code">RSA-PSS-SHA384</code></dt>
<dt><code class="code">RSA-PSS-RSAE-SHA384</code></dt>
<dt><code class="code">RSA-PSS-SHA512</code></dt>
<dt><code class="code">RSA-PSS-RSAE-SHA512</code></dt>
<dt><code class="code">EdDSA-Ed25519</code></dt>
<dt><code class="code">EdDSA-Ed448</code></dt>
<dt><code class="code">ECDSA-SHA256</code></dt>
<dt><code class="code">ECDSA-SHA384</code></dt>
<dt><code class="code">ECDSA-SHA512</code></dt>
<dt><code class="code">ECDSA-SECP256R1-SHA256</code></dt>
<dt><code class="code">ECDSA-SECP384R1-SHA384</code></dt>
<dt><code class="code">ECDSA-SECP521R1-SHA512</code></dt>
<dt><code class="code">ECDSA-SHA3-224</code></dt>
<dt><code class="code">ECDSA-SHA3-256</code></dt>
<dt><code class="code">ECDSA-SHA3-384</code></dt>
<dt><code class="code">ECDSA-SHA3-512</code></dt>
<dt><code class="code">RSA-SHA3-224</code></dt>
<dt><code class="code">RSA-SHA3-256</code></dt>
<dt><code class="code">RSA-SHA3-384</code></dt>
<dt><code class="code">RSA-SHA3-512</code></dt>
<dt><code class="code">DSA-SHA3-224</code></dt>
<dt><code class="code">DSA-SHA3-256</code></dt>
<dt><code class="code">DSA-SHA3-384</code></dt>
<dt><code class="code">DSA-SHA3-512</code></dt>
<dt><code class="code">RSA-RAW</code></dt>
<dt><code class="code">RSA-SHA1</code></dt>
<dt><code class="code">RSA-SHA1</code></dt>
<dt><code class="code">RSA-SHA224</code></dt>
<dt><code class="code">RSA-RMD160</code></dt>
<dt><code class="code">DSA-SHA1</code></dt>
<dt><code class="code">DSA-SHA1</code></dt>
<dt><code class="code">DSA-SHA224</code></dt>
<dt><code class="code">DSA-SHA256</code></dt>
<dt><code class="code">RSA-MD5</code></dt>
<dt><code class="code">RSA-MD5</code></dt>
<dt><code class="code">RSA-MD2</code></dt>
<dt><code class="code">ECDSA-SHA1</code></dt>
<dt><code class="code">ECDSA-SHA224</code></dt>
<dt><code class="code">GOSTR341012-512</code></dt>
<dt><code class="code">GOSTR341012-256</code></dt>
<dt><code class="code">GOSTR341001</code></dt>
<dt><code class="code">DSA-SHA384</code></dt>
<dt><code class="code">DSA-SHA512</code></dt>
</dl>
<h3 class="heading" id="Groups"><span>Groups<a class="copiable-link" href="#Groups"> ¶</a></span></h3>
<dl class="table">
<dt><code class="code">SECP256R1</code></dt>
<dt><code class="code">SECP384R1</code></dt>
<dt><code class="code">SECP521R1</code></dt>
<dt><code class="code">X25519</code></dt>
<dt><code class="code">GC256B</code></dt>
<dt><code class="code">GC512A</code></dt>
<dt><code class="code">X448</code></dt>
<dt><code class="code">FFDHE2048</code></dt>
<dt><code class="code">FFDHE3072</code></dt>
<dt><code class="code">FFDHE4096</code></dt>
<dt><code class="code">FFDHE6144</code></dt>
<dt><code class="code">FFDHE8192</code></dt>
</dl>
<hr>
</div>
<div class="appendix-level-extent" id="API-reference">
<div class="nav-panel">
<p>
Next: <a href="#Copying-Information" accesskey="n" rel="next">Copying Information</a>, Previous: <a href="#Supported-ciphersuites" accesskey="p" rel="prev">Supported Ciphersuites</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="appendix" id="API-reference-1"><span>Appendix E API reference<a class="copiable-link" href="#API-reference-1"> ¶</a></span></h2>
<a class="index-entry-id" id="index-API-reference"></a>
<ul class="mini-toc">
<li><a href="#Core-TLS-API" accesskey="1">Core TLS API</a></li>
<li><a href="#Datagram-TLS-API" accesskey="2">Datagram TLS API</a></li>
<li><a href="#X509-certificate-API" accesskey="3"><abbr class="acronym">X.509</abbr> certificate API</a></li>
<li><a href="#PKCS-7-API" accesskey="4"><abbr class="acronym">PKCS</abbr> 7 API</a></li>
<li><a href="#OCSP-API" accesskey="5"><abbr class="acronym">OCSP</abbr> API</a></li>
<li><a href="#PKCS-12-API" accesskey="6">PKCS 12 API</a></li>
<li><a href="#PKCS-11-API" accesskey="7">Hardware token via PKCS 11 API</a></li>
<li><a href="#TPM-API" accesskey="8">TPM API</a></li>
<li><a href="#Abstract-key-API" accesskey="9">Abstract key API</a></li>
<li><a href="#Socket-specific-API">Socket specific API</a></li>
<li><a href="#DANE-API">DANE API</a></li>
<li><a href="#Cryptographic-API">Cryptographic API</a></li>
<li><a href="#Compatibility-API">Compatibility API</a></li>
</ul>
<hr>
<div class="section-level-extent" id="Core-TLS-API">
<div class="nav-panel">
<p>
Next: <a href="#Datagram-TLS-API" accesskey="n" rel="next">Datagram TLS API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Core-TLS-API-1"><span>E.1 Core TLS API<a class="copiable-link" href="#Core-TLS-API-1"> ¶</a></span></h3>
<p>The prototypes for the following functions lie in
<samp class="file">gnutls/gnutls.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005falert_005fget-1"><span>gnutls_alert_get<a class="copiable-link" href="#gnutls_005falert_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falert_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fget-1"><span class="category-def">Function: </span><span><code class="def-type">gnutls_alert_description_t</code> <strong class="def-name">gnutls_alert_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fget-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return the last alert number received. This
function should be called when <code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code> or
<code class="code">GNUTLS_E_FATAL_ALERT_RECEIVED</code> errors are returned by a gnutls
function. The peer may send alerts if he encounters an error.
If no alert has been received the returned value is undefined.
</p>
<p><strong class="strong">Returns:</strong> the last alert received, a
<code class="code">gnutls_alert_description_t</code> value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005falert_005fget_005fname-1"><span>gnutls_alert_get_name<a class="copiable-link" href="#gnutls_005falert_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falert_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fget_005fname-1"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_alert_get_name</strong> <code class="def-code-arguments">(gnutls_alert_description_t <var class="var">alert</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fget_005fname-1"> ¶</a></span></dt>
<dd><p><var class="var">alert</var>: is an alert number.
</p>
<p>This function will return a string that describes the given alert
number, or <code class="code">NULL</code> . See <code class="code">gnutls_alert_get()</code> .
</p>
<p><strong class="strong">Returns:</strong> string corresponding to <code class="code">gnutls_alert_description_t</code> value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005falert_005fget_005fstrname-1"><span>gnutls_alert_get_strname<a class="copiable-link" href="#gnutls_005falert_005fget_005fstrname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falert_005fget_005fstrname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fget_005fstrname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_alert_get_strname</strong> <code class="def-code-arguments">(gnutls_alert_description_t <var class="var">alert</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fget_005fstrname"> ¶</a></span></dt>
<dd><p><var class="var">alert</var>: is an alert number.
</p>
<p>This function will return a string of the name of the alert.
</p>
<p><strong class="strong">Returns:</strong> string corresponding to <code class="code">gnutls_alert_description_t</code> value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005falert_005fsend-1"><span>gnutls_alert_send<a class="copiable-link" href="#gnutls_005falert_005fsend-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falert_005fsend"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fsend-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_alert_send</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_alert_level_t <var class="var">level</var>, gnutls_alert_description_t <var class="var">desc</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fsend-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">level</var>: is the level of the alert
</p>
<p><var class="var">desc</var>: is the alert description
</p>
<p>This function will send an alert to the peer in order to inform
him of something important (eg. his Certificate could not be verified).
If the alert level is Fatal then the peer is expected to close the
connection, otherwise he may ignore the alert and continue.
</p>
<p>The error code of the underlying record send function will be
returned, so you may also receive <code class="code">GNUTLS_E_INTERRUPTED</code> or
<code class="code">GNUTLS_E_AGAIN</code> as well.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005falert_005fsend_005fappropriate-1"><span>gnutls_alert_send_appropriate<a class="copiable-link" href="#gnutls_005falert_005fsend_005fappropriate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falert_005fsend_005fappropriate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fsend_005fappropriate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_alert_send_appropriate</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">err</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fsend_005fappropriate"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">err</var>: is an error code returned by another GnuTLS function
</p>
<p>Sends an alert to the peer depending on the error code returned by
a gnutls function. This function will call <code class="code">gnutls_error_to_alert()</code>
to determine the appropriate alert to send.
</p>
<p>This function may also return <code class="code">GNUTLS_E_AGAIN</code> , or
<code class="code">GNUTLS_E_INTERRUPTED</code> .
</p>
<p>This function historically was always sending an alert to the
peer, even if <code class="code">err</code> was inappropriate to respond with an alert
(e.g., <code class="code">GNUTLS_E_SUCCESS</code> ). Since 3.6.6 this function returns
success without transmitting any data on error codes that
should not result to an alert.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005falert_005fset_005fread_005ffunction-1"><span>gnutls_alert_set_read_function<a class="copiable-link" href="#gnutls_005falert_005fset_005fread_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falert_005fset_005fread_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falert_005fset_005fread_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_alert_set_read_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_alert_read_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005falert_005fset_005fread_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback to be called when an alert
message is being sent.
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005falpn_005fget_005fselected_005fprotocol-1"><span>gnutls_alpn_get_selected_protocol<a class="copiable-link" href="#gnutls_005falpn_005fget_005fselected_005fprotocol-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falpn_005fget_005fselected_005fprotocol"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falpn_005fget_005fselected_005fprotocol"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_alpn_get_selected_protocol</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">protocol</var>)</code><a class="copiable-link" href="#index-gnutls_005falpn_005fget_005fselected_005fprotocol"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">protocol</var>: will hold the protocol name
</p>
<p>This function allows you to get the negotiated protocol name. The
returned protocol should be treated as opaque, constant value and
only valid during the session life.
</p>
<p>The selected protocol is the first supported by the list sent
by the client.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p>Since 3.2.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005falpn_005fset_005fprotocols-1"><span>gnutls_alpn_set_protocols<a class="copiable-link" href="#gnutls_005falpn_005fset_005fprotocols-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005falpn_005fset_005fprotocols"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005falpn_005fset_005fprotocols"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_alpn_set_protocols</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_datum_t * <var class="var">protocols</var>, unsigned <var class="var">protocols_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005falpn_005fset_005fprotocols"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">protocols</var>: is the protocol names to add.
</p>
<p><var class="var">protocols_size</var>: the number of protocols to add.
</p>
<p><var class="var">flags</var>: zero or a sequence of <code class="code">gnutls_alpn_flags_t</code>
</p>
<p>This function is to be used by both clients and servers, to declare
the supported ALPN protocols, which are used during negotiation with peer.
</p>
<p>See <code class="code">gnutls_alpn_flags_t</code> description for the documentation of available
flags.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p>Since 3.2.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005fallocate_005fclient_005fcredentials-1"><span>gnutls_anon_allocate_client_credentials<a class="copiable-link" href="#gnutls_005fanon_005fallocate_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005fallocate_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005fallocate_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_anon_allocate_client_credentials</strong> <code class="def-code-arguments">(gnutls_anon_client_credentials_t * <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005fallocate_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_anon_client_credentials_t</code> type.
</p>
<p>Allocate a gnutls_anon_client_credentials_t structure.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005fallocate_005fserver_005fcredentials-1"><span>gnutls_anon_allocate_server_credentials<a class="copiable-link" href="#gnutls_005fanon_005fallocate_005fserver_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005fallocate_005fserver_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005fallocate_005fserver_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_anon_allocate_server_credentials</strong> <code class="def-code-arguments">(gnutls_anon_server_credentials_t * <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005fallocate_005fserver_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_anon_server_credentials_t</code> type.
</p>
<p>Allocate a gnutls_anon_server_credentials_t structure.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005ffree_005fclient_005fcredentials-1"><span>gnutls_anon_free_client_credentials<a class="copiable-link" href="#gnutls_005fanon_005ffree_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005ffree_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005ffree_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anon_free_client_credentials</strong> <code class="def-code-arguments">(gnutls_anon_client_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005ffree_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_anon_client_credentials_t</code> type.
</p>
<p>Free a gnutls_anon_client_credentials_t structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005ffree_005fserver_005fcredentials-1"><span>gnutls_anon_free_server_credentials<a class="copiable-link" href="#gnutls_005fanon_005ffree_005fserver_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005ffree_005fserver_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005ffree_005fserver_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anon_free_server_credentials</strong> <code class="def-code-arguments">(gnutls_anon_server_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005ffree_005fserver_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_anon_server_credentials_t</code> type.
</p>
<p>Free a gnutls_anon_server_credentials_t structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005fset_005fparams_005ffunction-1"><span>gnutls_anon_set_params_function<a class="copiable-link" href="#gnutls_005fanon_005fset_005fparams_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005fset_005fparams_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005fset_005fparams_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anon_set_params_function</strong> <code class="def-code-arguments">(gnutls_anon_server_credentials_t <var class="var">res</var>, gnutls_params_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005fset_005fparams_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_anon_server_credentials_t type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback in order for the server to get
the Diffie-Hellman or RSA parameters for anonymous authentication.
The callback should return <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005fset_005fserver_005fdh_005fparams-1"><span>gnutls_anon_set_server_dh_params<a class="copiable-link" href="#gnutls_005fanon_005fset_005fserver_005fdh_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005fset_005fserver_005fdh_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005fset_005fserver_005fdh_005fparams"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anon_set_server_dh_params</strong> <code class="def-code-arguments">(gnutls_anon_server_credentials_t <var class="var">res</var>, gnutls_dh_params_t <var class="var">dh_params</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005fset_005fserver_005fdh_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_anon_server_credentials_t type
</p>
<p><var class="var">dh_params</var>: The Diffie-Hellman parameters.
</p>
<p>This function will set the Diffie-Hellman parameters for an
anonymous server to use. These parameters will be used in
Anonymous Diffie-Hellman cipher suites.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams-1"><span>gnutls_anon_set_server_known_dh_params<a class="copiable-link" href="#gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_anon_set_server_known_dh_params</strong> <code class="def-code-arguments">(gnutls_anon_server_credentials_t <var class="var">res</var>, gnutls_sec_param_t <var class="var">sec_param</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_anon_server_credentials_t type
</p>
<p><var class="var">sec_param</var>: is an option of the <code class="code">gnutls_sec_param_t</code> enumeration
</p>
<p>This function will set the Diffie-Hellman parameters for an
anonymous server to use. These parameters will be used in
Anonymous Diffie-Hellman cipher suites and will be selected from
the FFDHE set of RFC7919 according to the security level provided.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanon_005fset_005fserver_005fparams_005ffunction-1"><span>gnutls_anon_set_server_params_function<a class="copiable-link" href="#gnutls_005fanon_005fset_005fserver_005fparams_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanon_005fset_005fserver_005fparams_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanon_005fset_005fserver_005fparams_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anon_set_server_params_function</strong> <code class="def-code-arguments">(gnutls_anon_server_credentials_t <var class="var">res</var>, gnutls_params_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fanon_005fset_005fserver_005fparams_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials_t type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback in order for the server to get
the Diffie-Hellman parameters for anonymous authentication. The
callback should return <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanti_005freplay_005fdeinit-1"><span>gnutls_anti_replay_deinit<a class="copiable-link" href="#gnutls_005fanti_005freplay_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanti_005freplay_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanti_005freplay_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anti_replay_deinit</strong> <code class="def-code-arguments">(gnutls_anti_replay_t <var class="var">anti_replay</var>)</code><a class="copiable-link" href="#index-gnutls_005fanti_005freplay_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">anti_replay</var>: is a <code class="code">gnutls_anti_replay</code> type
</p>
<p>This function will deinitialize all resources occupied by the given
anti-replay context.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanti_005freplay_005fenable-1"><span>gnutls_anti_replay_enable<a class="copiable-link" href="#gnutls_005fanti_005freplay_005fenable-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanti_005freplay_005fenable"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanti_005freplay_005fenable"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anti_replay_enable</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_anti_replay_t <var class="var">anti_replay</var>)</code><a class="copiable-link" href="#index-gnutls_005fanti_005freplay_005fenable"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">anti_replay</var>: is a <code class="code">gnutls_anti_replay_t</code> type.
</p>
<p>Request that the server should use anti-replay mechanism.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanti_005freplay_005finit-1"><span>gnutls_anti_replay_init<a class="copiable-link" href="#gnutls_005fanti_005freplay_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanti_005freplay_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanti_005freplay_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_anti_replay_init</strong> <code class="def-code-arguments">(gnutls_anti_replay_t * <var class="var">anti_replay</var>)</code><a class="copiable-link" href="#index-gnutls_005fanti_005freplay_005finit"> ¶</a></span></dt>
<dd><p><var class="var">anti_replay</var>: is a pointer to <code class="code">gnutls_anti_replay_t</code> type
</p>
<p>This function will allocate and initialize the <code class="code">anti_replay</code> context
to be usable for detect replay attacks. The context can then be
attached to a <code class="code">gnutls_session_t</code> with
<code class="code">gnutls_anti_replay_enable()</code> .
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanti_005freplay_005fset_005fadd_005ffunction-1"><span>gnutls_anti_replay_set_add_function<a class="copiable-link" href="#gnutls_005fanti_005freplay_005fset_005fadd_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanti_005freplay_005fset_005fadd_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanti_005freplay_005fset_005fadd_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anti_replay_set_add_function</strong> <code class="def-code-arguments">(gnutls_anti_replay_t <var class="var">anti_replay</var>, gnutls_db_add_func <var class="var">add_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fanti_005freplay_005fset_005fadd_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">anti_replay</var>: is a <code class="code">gnutls_anti_replay_t</code> type.
</p>
<p><var class="var">add_func</var>: is the function.
</p>
<p>Sets the function that will be used to store an entry if it is not
already present in the resumed sessions database. This function returns 0
if the entry is successfully stored, and a negative error code
otherwise. In particular, if the entry is found in the database,
it returns <code class="code">GNUTLS_E_DB_ENTRY_EXISTS</code> .
</p>
<p>The arguments to the <code class="code">add_func</code> are:
- <code class="code">ptr</code> : the pointer set with <code class="code">gnutls_anti_replay_set_ptr()</code>
- <code class="code">exp_time</code> : the expiration time of the entry
- <code class="code">key</code> : a pointer to the key
- <code class="code">data</code> : a pointer to data to store
</p>
<p>The data set by this function can be examined using
<code class="code">gnutls_db_check_entry_expire_time()</code> and <code class="code">gnutls_db_check_entry_time()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanti_005freplay_005fset_005fptr-1"><span>gnutls_anti_replay_set_ptr<a class="copiable-link" href="#gnutls_005fanti_005freplay_005fset_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanti_005freplay_005fset_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanti_005freplay_005fset_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anti_replay_set_ptr</strong> <code class="def-code-arguments">(gnutls_anti_replay_t <var class="var">anti_replay</var>, void * <var class="var">ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005fanti_005freplay_005fset_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">anti_replay</var>: is a <code class="code">gnutls_anti_replay_t</code> type.
</p>
<p><var class="var">ptr</var>: is the pointer
</p>
<p>Sets the pointer that will be provided to db add function
as the first argument.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fanti_005freplay_005fset_005fwindow-1"><span>gnutls_anti_replay_set_window<a class="copiable-link" href="#gnutls_005fanti_005freplay_005fset_005fwindow-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fanti_005freplay_005fset_005fwindow"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fanti_005freplay_005fset_005fwindow"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_anti_replay_set_window</strong> <code class="def-code-arguments">(gnutls_anti_replay_t <var class="var">anti_replay</var>, unsigned int <var class="var">window</var>)</code><a class="copiable-link" href="#index-gnutls_005fanti_005freplay_005fset_005fwindow"> ¶</a></span></dt>
<dd><p><var class="var">anti_replay</var>: is a <code class="code">gnutls_anti_replay_t</code> type.
</p>
<p><var class="var">window</var>: is the time window recording ClientHello, in milliseconds
</p>
<p>Sets the time window used for ClientHello recording. In order to
protect against replay attacks, the server records ClientHello
messages within this time period from the last update, and
considers it a replay when a ClientHello outside of the period; if
a ClientHello arrives within this period, the server checks the
database and detects duplicates.
</p>
<p>For the details of the algorithm, see RFC 8446, section 8.2.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faudit_005fcurrent_005fcontext-1"><span>gnutls_audit_current_context<a class="copiable-link" href="#gnutls_005faudit_005fcurrent_005fcontext-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faudit_005fcurrent_005fcontext"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faudit_005fcurrent_005fcontext"><span class="category-def">Function: </span><span><code class="def-type">long</code> <strong class="def-name">gnutls_audit_current_context</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005faudit_005fcurrent_005fcontext"> ¶</a></span></dt>
<dd>
<p>Return the current crypto-auditing context from the thread-local
context stack. This is useful for the applications that define
their own probe points for application level protocols.
</p>
<p><strong class="strong">Returns:</strong> an opaque context
</p>
<p><strong class="strong">Since:</strong> 3.8.11
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faudit_005fpop_005fcontext-1"><span>gnutls_audit_pop_context<a class="copiable-link" href="#gnutls_005faudit_005fpop_005fcontext-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faudit_005fpop_005fcontext"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faudit_005fpop_005fcontext"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_audit_pop_context</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005faudit_005fpop_005fcontext"> ¶</a></span></dt>
<dd>
<p>Pop the current crypto-auditing context from the thread-local
context stack. This is useful for the applications that define
their own probe points for application level protocols.
</p>
<p><strong class="strong">Since:</strong> 3.8.11
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faudit_005fpush_005fcontext-1"><span>gnutls_audit_push_context<a class="copiable-link" href="#gnutls_005faudit_005fpush_005fcontext-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faudit_005fpush_005fcontext"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faudit_005fpush_005fcontext"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_audit_push_context</strong> <code class="def-code-arguments">(long <var class="var">context</var>)</code><a class="copiable-link" href="#index-gnutls_005faudit_005fpush_005fcontext"> ¶</a></span></dt>
<dd><p><var class="var">context</var>: an opaque context
</p>
<p>Push a new crypto-auditing context to the thread-local context
stack. The call must match the following <code class="code">gnutls_audit_pop_context()</code>
call. This is useful for the applications that define their own
probe points for application level protocols.
</p>
<p><strong class="strong">Since:</strong> 3.8.11
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fauth_005fclient_005fget_005ftype-1"><span>gnutls_auth_client_get_type<a class="copiable-link" href="#gnutls_005fauth_005fclient_005fget_005ftype-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fauth_005fclient_005fget_005ftype"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fauth_005fclient_005fget_005ftype"><span class="category-def">Function: </span><span><code class="def-type">gnutls_credentials_type_t</code> <strong class="def-name">gnutls_auth_client_get_type</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fauth_005fclient_005fget_005ftype"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns the type of credentials that were used for client authentication.
The returned information is to be used to distinguish the function used
to access authentication data.
</p>
<p>Note that on resumed sessions, this function returns the schema
used in the original session authentication.
</p>
<p><strong class="strong">Returns:</strong> The type of credentials for the client authentication
schema, a <code class="code">gnutls_credentials_type_t</code> type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fauth_005fget_005ftype-1"><span>gnutls_auth_get_type<a class="copiable-link" href="#gnutls_005fauth_005fget_005ftype-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fauth_005fget_005ftype"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fauth_005fget_005ftype"><span class="category-def">Function: </span><span><code class="def-type">gnutls_credentials_type_t</code> <strong class="def-name">gnutls_auth_get_type</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fauth_005fget_005ftype"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns type of credentials for the current authentication schema.
The returned information is to be used to distinguish the function used
to access authentication data.
</p>
<p>Eg. for CERTIFICATE ciphersuites (key exchange algorithms:
<code class="code">GNUTLS_KX_RSA</code> , <code class="code">GNUTLS_KX_DHE_RSA</code> ), the same function are to be
used to access the authentication data.
</p>
<p>Note that on resumed sessions, this function returns the schema
used in the original session authentication.
</p>
<p><strong class="strong">Returns:</strong> The type of credentials for the current authentication
schema, a <code class="code">gnutls_credentials_type_t</code> type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fauth_005fserver_005fget_005ftype-1"><span>gnutls_auth_server_get_type<a class="copiable-link" href="#gnutls_005fauth_005fserver_005fget_005ftype-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fauth_005fserver_005fget_005ftype"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fauth_005fserver_005fget_005ftype"><span class="category-def">Function: </span><span><code class="def-type">gnutls_credentials_type_t</code> <strong class="def-name">gnutls_auth_server_get_type</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fauth_005fserver_005fget_005ftype"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns the type of credentials that were used for server authentication.
The returned information is to be used to distinguish the function used
to access authentication data.
</p>
<p>Note that on resumed sessions, this function returns the schema
used in the original session authentication.
</p>
<p><strong class="strong">Returns:</strong> The type of credentials for the server authentication
schema, a <code class="code">gnutls_credentials_type_t</code> type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fbase64_005fdecode2-1"><span>gnutls_base64_decode2<a class="copiable-link" href="#gnutls_005fbase64_005fdecode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fbase64_005fdecode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fbase64_005fdecode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_base64_decode2</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">base64</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fbase64_005fdecode2"> ¶</a></span></dt>
<dd><p><var class="var">base64</var>: contains the encoded data
</p>
<p><var class="var">result</var>: the location of decoded data
</p>
<p>This function will decode the given base64 encoded data. The decoded data
will be allocated, and stored into result.
</p>
<p>You should use <code class="code">gnutls_free()</code> to free the returned data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fbase64_005fencode2-1"><span>gnutls_base64_encode2<a class="copiable-link" href="#gnutls_005fbase64_005fencode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fbase64_005fencode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fbase64_005fencode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_base64_encode2</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fbase64_005fencode2"> ¶</a></span></dt>
<dd><p><var class="var">data</var>: contains the raw data
</p>
<p><var class="var">result</var>: will hold the newly allocated encoded data
</p>
<p>This function will convert the given data to printable data, using
the base64 encoding. This function will allocate the required
memory to hold the encoded data.
</p>
<p>You should use <code class="code">gnutls_free()</code> to free the returned data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fbuffer_005fappend_005fdata-1"><span>gnutls_buffer_append_data<a class="copiable-link" href="#gnutls_005fbuffer_005fappend_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fbuffer_005fappend_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fbuffer_005fappend_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_buffer_append_data</strong> <code class="def-code-arguments">(gnutls_buffer_t <var class="var">dest</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fbuffer_005fappend_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">dest</var>: the buffer to append to
</p>
<p><var class="var">data</var>: the data
</p>
<p><var class="var">data_size</var>: the size of <code class="code">data</code>
</p>
<p>Appends the provided <code class="code">data</code> to the destination buffer.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fbye-1"><span>gnutls_bye<a class="copiable-link" href="#gnutls_005fbye-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fbye"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fbye-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_bye</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_close_request_t <var class="var">how</var>)</code><a class="copiable-link" href="#index-gnutls_005fbye-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">how</var>: is an integer
</p>
<p>Terminates the current TLS/SSL connection. The connection should
have been initiated using <code class="code">gnutls_handshake()</code> . <code class="code">how</code> should be one
of <code class="code">GNUTLS_SHUT_RDWR</code> , <code class="code">GNUTLS_SHUT_WR</code> .
</p>
<p>In case of <code class="code">GNUTLS_SHUT_RDWR</code> the TLS session gets
terminated and further receives and sends will be disallowed. If
the return value is zero you may continue using the underlying
transport layer. <code class="code">GNUTLS_SHUT_RDWR</code> sends an alert containing a close
request and waits for the peer to reply with the same message.
</p>
<p>In case of <code class="code">GNUTLS_SHUT_WR</code> the TLS session gets terminated
and further sends will be disallowed. In order to reuse the
connection you should wait for an EOF from the peer.
<code class="code">GNUTLS_SHUT_WR</code> sends an alert containing a close request.
</p>
<p>Note that not all implementations will properly terminate a TLS
connection. Some of them, usually for performance reasons, will
terminate only the underlying transport layer, and thus not
distinguishing between a malicious party prematurely terminating
the connection and normal termination.
</p>
<p>This function may also return <code class="code">GNUTLS_E_AGAIN</code> or
<code class="code">GNUTLS_E_INTERRUPTED</code> ; cf. <code class="code">gnutls_record_get_direction()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code, see
function documentation for entire semantics.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005factivation_005ftime_005fpeers-1"><span>gnutls_certificate_activation_time_peers<a class="copiable-link" href="#gnutls_005fcertificate_005factivation_005ftime_005fpeers-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005factivation_005ftime_005fpeers"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005factivation_005ftime_005fpeers"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_certificate_activation_time_peers</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005factivation_005ftime_005fpeers"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This function will return the peer’s certificate activation time.
</p>
<p><strong class="strong">Returns:</strong> (time_t)-1 on error.
</p>
<p><strong class="strong">Deprecated:</strong> <code class="code">gnutls_certificate_verify_peers2()</code> now verifies activation times.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fallocate_005fcredentials-1"><span>gnutls_certificate_allocate_credentials<a class="copiable-link" href="#gnutls_005fcertificate_005fallocate_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fallocate_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fallocate_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_allocate_credentials</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t * <var class="var">res</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fallocate_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a pointer to a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>Allocate a gnutls_certificate_credentials_t structure.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fclient_005fget_005frequest_005fstatus-1"><span>gnutls_certificate_client_get_request_status<a class="copiable-link" href="#gnutls_005fcertificate_005fclient_005fget_005frequest_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fclient_005fget_005frequest_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fclient_005fget_005frequest_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_certificate_client_get_request_status</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fclient_005fget_005frequest_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>Get whether client certificate was requested on the last
handshake or not.
</p>
<p><strong class="strong">Returns:</strong> 0 if the peer (server) did not request client
authentication or 1 otherwise.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fexpiration_005ftime_005fpeers-1"><span>gnutls_certificate_expiration_time_peers<a class="copiable-link" href="#gnutls_005fcertificate_005fexpiration_005ftime_005fpeers-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fexpiration_005ftime_005fpeers"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fexpiration_005ftime_005fpeers"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_certificate_expiration_time_peers</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fexpiration_005ftime_005fpeers"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This function will return the peer’s certificate expiration time.
</p>
<p><strong class="strong">Returns:</strong> (time_t)-1 on error.
</p>
<p><strong class="strong">Deprecated:</strong> <code class="code">gnutls_certificate_verify_peers2()</code> now verifies expiration times.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ffree_005fca_005fnames-1"><span>gnutls_certificate_free_ca_names<a class="copiable-link" href="#gnutls_005fcertificate_005ffree_005fca_005fnames-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ffree_005fca_005fnames"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ffree_005fca_005fnames"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_free_ca_names</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ffree_005fca_005fnames"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>This function will delete all the CA name in the given
credentials. Clients may call this to save some memory since in
client side the CA names are not used. Servers might want to use
this function if a large list of trusted CAs is present and
sending the names of it would just consume bandwidth without providing
information to client.
</p>
<p>CA names are used by servers to advertise the CAs they support to
clients.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ffree_005fcas-1"><span>gnutls_certificate_free_cas<a class="copiable-link" href="#gnutls_005fcertificate_005ffree_005fcas-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ffree_005fcas"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ffree_005fcas"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_free_cas</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ffree_005fcas"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>This function was operational on very early versions of gnutls.
Due to internal refactorings and the fact that this was hardly ever
used, it is currently a no-op.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ffree_005fcredentials-1"><span>gnutls_certificate_free_credentials<a class="copiable-link" href="#gnutls_005fcertificate_005ffree_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ffree_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ffree_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_free_credentials</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ffree_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>Free a gnutls_certificate_credentials_t structure.
</p>
<p>This function does not free any temporary parameters associated
with this structure (ie RSA and DH parameters are not freed by this
function).
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ffree_005fcrls-1"><span>gnutls_certificate_free_crls<a class="copiable-link" href="#gnutls_005fcertificate_005ffree_005fcrls-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ffree_005fcrls"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ffree_005fcrls"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_free_crls</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ffree_005fcrls"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>This function will delete all the CRLs associated
with the given credentials.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ffree_005fkeys-1"><span>gnutls_certificate_free_keys<a class="copiable-link" href="#gnutls_005fcertificate_005ffree_005fkeys-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ffree_005fkeys"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ffree_005fkeys"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_free_keys</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ffree_005fkeys"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>This function will delete all the keys and the certificates associated
with the given credentials. This function must not be called when a
TLS negotiation that uses the credentials is in progress.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fcrt_005fraw-1"><span>gnutls_certificate_get_crt_raw<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fcrt_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fcrt_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fcrt_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_get_crt_raw</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, unsigned <var class="var">idx1</var>, unsigned <var class="var">idx2</var>, gnutls_datum_t * <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fcrt_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">idx1</var>: the index of the certificate chain if multiple are present
</p>
<p><var class="var">idx2</var>: the index of the certificate in the chain. Zero gives the server’s certificate.
</p>
<p><var class="var">cert</var>: Will hold the DER encoded certificate.
</p>
<p>This function will return the DER encoded certificate of the
server or any other certificate on its certificate chain (based on <code class="code">idx2</code> ).
The returned data should be treated as constant and only accessible during the lifetime
of <code class="code">sc</code> . The <code class="code">idx1</code> matches the value <code class="code">gnutls_certificate_set_x509_key()</code> and friends
functions.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. In case the indexes are out of bounds <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
is returned.
</p>
<p><strong class="strong">Since:</strong> 3.2.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fissuer-1"><span>gnutls_certificate_get_issuer<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_get_issuer</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_crt_t * <var class="var">issuer</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">cert</var>: is the certificate to find issuer for
</p>
<p><var class="var">issuer</var>: Will hold the issuer if any. Should be treated as constant.
</p>
<p><var class="var">flags</var>: Use zero or <code class="code">GNUTLS_TL_GET_COPY</code>
</p>
<p>This function will return the issuer of a given certificate.
If the flag <code class="code">GNUTLS_TL_GET_COPY</code> is specified a copy of the issuer
will be returned which must be freed using <code class="code">gnutls_x509_crt_deinit()</code> .
In that case the provided <code class="code">issuer</code> must not be initialized.
</p>
<p>As with <code class="code">gnutls_x509_trust_list_get_issuer()</code> this function requires
the <code class="code">GNUTLS_TL_GET_COPY</code> flag in order to operate with PKCS<code class="code">11</code> trust
lists in a thread-safe way.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005focsp_005fexpiration-1"><span>gnutls_certificate_get_ocsp_expiration<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005focsp_005fexpiration-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005focsp_005fexpiration"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005focsp_005fexpiration-1"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_certificate_get_ocsp_expiration</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, unsigned <var class="var">idx</var>, int <var class="var">oidx</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005focsp_005fexpiration-1"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a credentials structure.
</p>
<p><var class="var">idx</var>: is a certificate chain index as returned by <code class="code">gnutls_certificate_set_key()</code> and friends
</p>
<p><var class="var">oidx</var>: is an OCSP response index
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function returns the validity of the loaded OCSP responses,
to provide information on when to reload/refresh them.
</p>
<p>Note that the credentials structure should be read-only when in
use, thus when reloading, either the credentials structure must not
be in use by any sessions, or a new credentials structure should be
allocated for new sessions.
</p>
<p>When <code class="code">oidx</code> is (-1) then the minimum refresh time for all responses
is returned. Otherwise the index specifies the response corresponding
to the <code class="code">odix</code> certificate in the certificate chain.
</p>
<p><strong class="strong">Returns:</strong> On success, the expiration time of the OCSP response. Otherwise
(time_t)(-1) on error, or (time_t)-2 on out of bounds.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fours-1"><span>gnutls_certificate_get_ours<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fours-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fours"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fours"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_datum_t *</code> <strong class="def-name">gnutls_certificate_get_ours</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fours"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>Gets the certificate as sent to the peer in the last handshake.
The certificate is in raw (DER) format. No certificate
list is being returned. Only the first certificate.
</p>
<p>This function returns the certificate that was sent in the current
handshake. In subsequent resumed sessions this function will return
<code class="code">NULL</code> . That differs from <code class="code">gnutls_certificate_get_peers()</code> which always
returns the peer’s certificate used in the original session.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a <code class="code">gnutls_datum_t</code> containing our
certificate, or <code class="code">NULL</code> in case of an error or if no certificate
was used.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fpeers-1"><span>gnutls_certificate_get_peers<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fpeers-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fpeers"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fpeers"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_datum_t *</code> <strong class="def-name">gnutls_certificate_get_peers</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int * <var class="var">list_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fpeers"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">list_size</var>: is the length of the certificate list (may be <code class="code">NULL</code> )
</p>
<p>Get the peer’s raw certificate (chain) as sent by the peer. These
certificates are in raw format (DER encoded for X.509). In case of
a X.509 then a certificate list may be present. The list
is provided as sent by the server; the server must send as first
certificate in the list its own certificate, following the
issuer’s certificate, then the issuer’s issuer etc. However, there
are servers which violate this principle and thus on certain
occasions this may be an unsorted list.
</p>
<p>In resumed sessions, this function will return the peer’s certificate
list as used in the first/original session.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a <code class="code">gnutls_datum_t</code> containing the peer’s
certificates, or <code class="code">NULL</code> in case of an error or if no certificate
was used.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fpeers_005fsubkey_005fid-1"><span>gnutls_certificate_get_peers_subkey_id<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fpeers_005fsubkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fpeers_005fsubkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fpeers_005fsubkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_get_peers_subkey_id</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">id</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fpeers_005fsubkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">id</var>: will contain the ID
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fverify_005fflags-1"><span>gnutls_certificate_get_verify_flags<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fverify_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fverify_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fverify_005fflags"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_certificate_get_verify_flags</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fverify_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials_t type
</p>
<p>Returns the verification flags set with
<code class="code">gnutls_certificate_set_verify_flags()</code> .
</p>
<p><strong class="strong">Returns:</strong> The certificate verification flags used by <code class="code">res</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fx509_005fcrt-1"><span>gnutls_certificate_get_x509_crt<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fx509_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fx509_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fx509_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_get_x509_crt</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, unsigned <var class="var">index</var>, gnutls_x509_crt_t ** <var class="var">crt_list</var>, unsigned * <var class="var">crt_list_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fx509_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">index</var>: The index of the certificate list to obtain.
</p>
<p><var class="var">crt_list</var>: Where to store the certificate list.
</p>
<p><var class="var">crt_list_size</var>: Will hold the number of certificates.
</p>
<p>Obtains a X.509 certificate list that has been stored in <code class="code">res</code> with one of
<code class="code">gnutls_certificate_set_x509_key()</code> , <code class="code">gnutls_certificate_set_key()</code> ,
<code class="code">gnutls_certificate_set_x509_key_file()</code> ,
<code class="code">gnutls_certificate_set_x509_key_file2()</code> ,
<code class="code">gnutls_certificate_set_x509_key_mem()</code> , or
<code class="code">gnutls_certificate_set_x509_key_mem2()</code> . Each certificate in the returned
certificate list must be deallocated with <code class="code">gnutls_x509_crt_deinit()</code> , and the
list itself must be freed with <code class="code">gnutls_free()</code> .
</p>
<p>The <code class="code">index</code> matches the return value of <code class="code">gnutls_certificate_set_x509_key()</code> and friends
functions, when the <code class="code">GNUTLS_CERTIFICATE_API_V2</code> flag is set.
</p>
<p>If there is no certificate with the given index,
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned. If the certificate
with the given index is not a X.509 certificate, <code class="code">GNUTLS_E_INVALID_REQUEST</code>
is returned. The returned certificates must be deinitialized after
use, and the <code class="code">crt_list</code> pointer must be freed using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success, or a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005fx509_005fkey-1"><span>gnutls_certificate_get_x509_key<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005fx509_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005fx509_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005fx509_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_get_x509_key</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, unsigned <var class="var">index</var>, gnutls_x509_privkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005fx509_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">index</var>: The index of the key to obtain.
</p>
<p><var class="var">key</var>: Location to store the key.
</p>
<p>Obtains a X.509 private key that has been stored in <code class="code">res</code> with one of
<code class="code">gnutls_certificate_set_x509_key()</code> , <code class="code">gnutls_certificate_set_key()</code> ,
<code class="code">gnutls_certificate_set_x509_key_file()</code> ,
<code class="code">gnutls_certificate_set_x509_key_file2()</code> ,
<code class="code">gnutls_certificate_set_x509_key_mem()</code> , or
<code class="code">gnutls_certificate_set_x509_key_mem2()</code> . The returned key must be deallocated
with <code class="code">gnutls_x509_privkey_deinit()</code> when no longer needed.
</p>
<p>The <code class="code">index</code> matches the return value of <code class="code">gnutls_certificate_set_x509_key()</code> and friends
functions, when the <code class="code">GNUTLS_CERTIFICATE_API_V2</code> flag is set.
</p>
<p>If there is no key with the given index,
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned. If the key with the
given index is not a X.509 key, <code class="code">GNUTLS_E_INVALID_REQUEST</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success, or a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence-1"><span>gnutls_certificate_send_x509_rdn_sequence<a class="copiable-link" href="#gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_send_x509_rdn_sequence</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">status</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">status</var>: is 0 or 1
</p>
<p>If status is non zero, this function will order gnutls not to send
the rdnSequence in the certificate request message. That is the
server will not advertise its trusted CAs to the peer. If status
is zero then the default behaviour will take effect, which is to
advertise the server’s trusted CAs.
</p>
<p>This function has no effect in clients, and in authentication
methods other than certificate with X.509 certificates.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fserver_005fset_005frequest-1"><span>gnutls_certificate_server_set_request<a class="copiable-link" href="#gnutls_005fcertificate_005fserver_005fset_005frequest-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fserver_005fset_005frequest"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fserver_005fset_005frequest-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_server_set_request</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_certificate_request_t <var class="var">req</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fserver_005fset_005frequest-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">req</var>: is one of GNUTLS_CERT_REQUEST, GNUTLS_CERT_REQUIRE, GNUTLS_CERT_IGNORE
</p>
<p>This function specifies if we (in case of a server) are going to
send a certificate request message to the client. If <code class="code">req</code> is
GNUTLS_CERT_REQUIRE then the server will return the <code class="code">GNUTLS_E_NO_CERTIFICATE_FOUND</code>
error if the peer does not provide a certificate. If you do not call this
function then the client will not be asked to send a certificate. Invoking
the function with <code class="code">req</code> GNUTLS_CERT_IGNORE has the same effect.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fdh_005fparams-1"><span>gnutls_certificate_set_dh_params<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fdh_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fdh_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fdh_005fparams"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_dh_params</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_dh_params_t <var class="var">dh_params</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fdh_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials_t type
</p>
<p><var class="var">dh_params</var>: the Diffie-Hellman parameters.
</p>
<p>This function will set the Diffie-Hellman parameters for a
certificate server to use. These parameters will be used in
Ephemeral Diffie-Hellman cipher suites. Note that only a pointer
to the parameters are stored in the certificate handle, so you
must not deallocate the parameters before the certificate is deallocated.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fflags-1"><span>gnutls_certificate_set_flags<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fflags"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_flags</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials_t type
</p>
<p><var class="var">flags</var>: are the flags of <code class="code">gnutls_certificate_flags</code> type
</p>
<p>This function will set flags to tweak the operation of
the credentials structure. See the <code class="code">gnutls_certificate_flags</code> enumerations
for more information on the available flags.
</p>
<p><strong class="strong">Since:</strong> 3.4.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams-1"><span>gnutls_certificate_set_known_dh_params<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_known_dh_params</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_sec_param_t <var class="var">sec_param</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials_t type
</p>
<p><var class="var">sec_param</var>: is an option of the <code class="code">gnutls_sec_param_t</code> enumeration
</p>
<p>This function will set the Diffie-Hellman parameters for a
certificate server to use. These parameters will be used in
Ephemeral Diffie-Hellman cipher suites and will be selected from
the FFDHE set of RFC7919 according to the security level provided.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile-1"><span>gnutls_certificate_set_ocsp_status_request_file<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_ocsp_status_request_file</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, const char * <var class="var">response_file</var>, unsigned <var class="var">idx</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a credentials structure.
</p>
<p><var class="var">response_file</var>: a filename of the OCSP response
</p>
<p><var class="var">idx</var>: is a certificate index as returned by <code class="code">gnutls_certificate_set_key()</code> and friends
</p>
<p>This function loads the provided OCSP response. It will be
sent to the client if requests an OCSP certificate status for
the certificate chain specified by <code class="code">idx</code> .
</p>
<p><strong class="strong">Note:</strong> the ability to set multiple OCSP responses per credential
structure via the index <code class="code">idx</code> was added in version 3.5.6. To keep
backwards compatibility, it requires using <code class="code">gnutls_certificate_set_flags()</code>
with the <code class="code">GNUTLS_CERTIFICATE_API_V2</code> flag to make the set certificate
functions return an index usable by this function.
</p>
<p>This function can be called multiple times since GnuTLS 3.6.3
when multiple responses which apply to the chain are available.
If the response provided does not match any certificates present
in the chain, the code <code class="code">GNUTLS_E_OCSP_MISMATCH_WITH_CERTS</code> is returned.
To revert to the previous behavior set the flag <code class="code">GNUTLS_CERTIFICATE_SKIP_OCSP_RESPONSE_CHECK</code>
in the certificate credentials structure. In that case, only the
end-certificate’s OCSP response can be set.
If the response is already expired at the time of loading the code
<code class="code">GNUTLS_E_EXPIRED</code> is returned.
</p>
<p>To revert to the previous behavior of this function which does not return
any errors, set the flag <code class="code">GNUTLS_CERTIFICATE_SKIP_OCSP_RESPONSE_CHECK</code>
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2-1"><span>gnutls_certificate_set_ocsp_status_request_file2<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_ocsp_status_request_file2</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, const char * <var class="var">response_file</var>, unsigned <var class="var">idx</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a credentials structure.
</p>
<p><var class="var">response_file</var>: a filename of the OCSP response
</p>
<p><var class="var">idx</var>: is a certificate index as returned by <code class="code">gnutls_certificate_set_key()</code> and friends
</p>
<p><var class="var">fmt</var>: is PEM or DER
</p>
<p>This function loads the OCSP responses to be sent to the
peer for the certificate chain specified by <code class="code">idx</code> . When <code class="code">fmt</code> is
set to PEM, multiple responses can be loaded.
</p>
<p>This function must be called after setting any certificates, and
cannot be used for certificates that are provided via a callback –
that is when <code class="code">gnutls_certificate_set_retrieve_function()</code> is used. In
that case consider using <code class="code">gnutls_certificate_set_retrieve_function3()</code> .
</p>
<p>This function can be called multiple times when multiple responses
applicable to the certificate chain are available.
If the response provided does not match any certificates present
in the chain, the code <code class="code">GNUTLS_E_OCSP_MISMATCH_WITH_CERTS</code> is returned.
If the response is already expired at the time of loading the code
<code class="code">GNUTLS_E_EXPIRED</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, the number of loaded responses is returned,
otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction-1"><span>gnutls_certificate_set_ocsp_status_request_function<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_ocsp_status_request_function</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, gnutls_status_request_ocsp_func <var class="var">ocsp_func</var>, void * <var class="var">ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">ocsp_func</var>: function pointer to OCSP status request callback.
</p>
<p><var class="var">ptr</var>: opaque pointer passed to callback function
</p>
<p>This function is to be used by server to register a callback to
handle OCSP status requests from the client. The callback will be
invoked if the client supplied a status-request OCSP extension.
The callback function prototype is:
</p>
<p>typedef int (*gnutls_status_request_ocsp_func)
(gnutls_session_t session, void *ptr, gnutls_datum_t *ocsp_response);
</p>
<p>The callback will be invoked if the client requests an OCSP certificate
status. The callback may return <code class="code">GNUTLS_E_NO_CERTIFICATE_STATUS</code> , if
there is no recent OCSP response. If the callback returns <code class="code">GNUTLS_E_SUCCESS</code> ,
it is expected to have the <code class="code">ocsp_response</code> field set with a valid (DER-encoded)
OCSP response. The response must be a value allocated using <code class="code">gnutls_malloc()</code> ,
and will be deinitialized by the caller.
</p>
<p>It is possible to set a specific callback for each provided certificate
using <code class="code">gnutls_certificate_set_ocsp_status_request_function2()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction2-1"><span>gnutls_certificate_set_ocsp_status_request_function2<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_ocsp_status_request_function2</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, unsigned <var class="var">idx</var>, gnutls_status_request_ocsp_func <var class="var">ocsp_func</var>, void * <var class="var">ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction2"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">idx</var>: is a certificate index as returned by <code class="code">gnutls_certificate_set_key()</code> and friends
</p>
<p><var class="var">ocsp_func</var>: function pointer to OCSP status request callback.
</p>
<p><var class="var">ptr</var>: opaque pointer passed to callback function
</p>
<p>This function is to be used by server to register a callback to
provide OCSP status requests that correspond to the indexed certificate chain
from the client. The callback will be invoked if the client supplied a
status-request OCSP extension.
</p>
<p>The callback function prototype is:
</p>
<p>typedef int (*gnutls_status_request_ocsp_func)
(gnutls_session_t session, void *ptr, gnutls_datum_t *ocsp_response);
</p>
<p>The callback will be invoked if the client requests an OCSP certificate
status. The callback may return <code class="code">GNUTLS_E_NO_CERTIFICATE_STATUS</code> , if
there is no recent OCSP response. If the callback returns <code class="code">GNUTLS_E_SUCCESS</code> ,
it is expected to have the <code class="code">ocsp_response</code> field set with a valid (DER-encoded)
OCSP response. The response must be a value allocated using <code class="code">gnutls_malloc()</code> ,
and will be deinitialized by the caller.
</p>
<p><strong class="strong">Note:</strong> the ability to set multiple OCSP responses per credential
structure via the index <code class="code">idx</code> was added in version 3.5.6. To keep
backwards compatibility, it requires using <code class="code">gnutls_certificate_set_flags()</code>
with the <code class="code">GNUTLS_CERTIFICATE_API_V2</code> flag to make the set certificate
functions return an index usable by this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.5.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005fmem-1"><span>gnutls_certificate_set_ocsp_status_request_mem<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_ocsp_status_request_mem</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">sc</var>, const gnutls_datum_t * <var class="var">resp_data</var>, unsigned <var class="var">idx</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a credentials structure.
</p>
<p><var class="var">resp_data</var>: a memory buffer holding an OCSP response
</p>
<p><var class="var">idx</var>: is a certificate index as returned by <code class="code">gnutls_certificate_set_key()</code> and friends
</p>
<p><var class="var">fmt</var>: is PEM or DER
</p>
<p>This function sets the OCSP responses to be sent to the
peer for the certificate chain specified by <code class="code">idx</code> . When <code class="code">fmt</code> is set
to PEM, multiple responses can be loaded.
</p>
<p><strong class="strong">Note:</strong> the ability to set multiple OCSP responses per credential
structure via the index <code class="code">idx</code> was added in version 3.5.6. To keep
backwards compatibility, it requires using <code class="code">gnutls_certificate_set_flags()</code>
with the <code class="code">GNUTLS_CERTIFICATE_API_V2</code> flag to make the set certificate
functions return an index usable by this function.
</p>
<p>This function must be called after setting any certificates, and
cannot be used for certificates that are provided via a callback –
that is when <code class="code">gnutls_certificate_set_retrieve_function()</code> is used.
</p>
<p>This function can be called multiple times when multiple responses which
apply to the certificate chain are available.
If the response provided does not match any certificates present
in the chain, the code <code class="code">GNUTLS_E_OCSP_MISMATCH_WITH_CERTS</code> is returned.
If the response is already expired at the time of loading the code
<code class="code">GNUTLS_E_EXPIRED</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, the number of loaded responses is returned,
otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fparams_005ffunction-1"><span>gnutls_certificate_set_params_function<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fparams_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fparams_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fparams_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_params_function</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_params_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fparams_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials_t type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback in order for the server to get
the Diffie-Hellman or RSA parameters for certificate
authentication. The callback should return <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fpin_005ffunction-1"><span>gnutls_certificate_set_pin_function<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fpin_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_pin_function</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fpin_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">fn</var>: A PIN callback
</p>
<p><var class="var">userdata</var>: Data to be passed in the callback
</p>
<p>This function will set a callback function to be used when
required to access a protected object. This function overrides any other
global PIN functions.
</p>
<p>Note that this function must be called right after initialization
to have effect.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005frawpk_005fkey_005ffile-1"><span>gnutls_certificate_set_rawpk_key_file<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005frawpk_005fkey_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005frawpk_005fkey_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005frawpk_005fkey_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_rawpk_key_file</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">rawpkfile</var>, const char * <var class="var">privkeyfile</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">key_usage</var>, const char ** <var class="var">names</var>, unsigned int <var class="var">names_length</var>, unsigned int <var class="var">privkey_flags</var>, unsigned int <var class="var">pkcs11_flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005frawpk_005fkey_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">rawpkfile</var>: contains a raw public key in
PKIX.SubjectPublicKeyInfo format.
</p>
<p><var class="var">privkeyfile</var>: contains a file path to a private key.
</p>
<p><var class="var">format</var>: encoding of the keys. DER or PEM.
</p>
<p><var class="var">pass</var>: an optional password to unlock the private key privkeyfile.
</p>
<p><var class="var">key_usage</var>: an ORed sequence of <code class="code">GNUTLS_KEY_</code> * flags.
</p>
<p><var class="var">names</var>: is an array of DNS names belonging to the public-key (NULL if none).
</p>
<p><var class="var">names_length</var>: holds the length of the names list.
</p>
<p><var class="var">privkey_flags</var>: an ORed sequence of <code class="code">gnutls_pkcs_encrypt_flags_t</code> .
These apply to the private key pkey.
</p>
<p><var class="var">pkcs11_flags</var>: one of gnutls_pkcs11_obj_flags. These apply to URLs.
</p>
<p>This function sets a public/private keypair read from file in the
<code class="code">gnutls_certificate_credentials_t</code> type to be used for authentication
and/or encryption. <code class="code">spki</code> and <code class="code">privkey</code> should match otherwise set
signatures cannot be validated. In case of no match this function
returns <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code> . This function should
be called once for the client because there is currently no mechanism
to determine which raw public-key to select for the peer when there
are multiple present. Multiple raw public keys for the server can be
distinghuished by setting the <code class="code">names</code> .
</p>
<p>Note here that <code class="code">spki</code> is a raw public-key as defined
in RFC7250. It means that there is no surrounding certificate that
holds the public key and that there is therefore no direct mechanism
to prove the authenticity of this key. The keypair can be used during
a TLS handshake but its authenticity should be established via a
different mechanism (e.g. TOFU or known fingerprint).
</p>
<p>The supported formats are basic unencrypted key, PKCS8, PKCS12,
and the openssl format and will be autodetected.
</p>
<p>If the raw public-key and the private key are given in PEM encoding
then the strings that hold their values must be null terminated.
</p>
<p>Key usage (as defined by X.509 extension (2.5.29.15)) can be explicitly
set because there is no certificate structure around the key to define
this value. See for more info <code class="code">gnutls_x509_crt_get_key_usage()</code> .
</p>
<p>Note that, this function by default returns zero on success and a
negative value on error. Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code>
is set using <code class="code">gnutls_certificate_set_flags()</code> it returns an index
(greater or equal to zero). That index can be used in other functions
to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, in case the
key pair does not match <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code> is returned,
in other erroneous cases a different negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005frawpk_005fkey_005fmem-1"><span>gnutls_certificate_set_rawpk_key_mem<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005frawpk_005fkey_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005frawpk_005fkey_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005frawpk_005fkey_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_rawpk_key_mem</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, const gnutls_datum_t * <var class="var">spki</var>, const gnutls_datum_t * <var class="var">pkey</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">key_usage</var>, const char ** <var class="var">names</var>, unsigned int <var class="var">names_length</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005frawpk_005fkey_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">spki</var>: contains a raw public key in
PKIX.SubjectPublicKeyInfo format.
</p>
<p><var class="var">pkey</var>: contains a raw private key.
</p>
<p><var class="var">format</var>: encoding of the keys. DER or PEM.
</p>
<p><var class="var">pass</var>: an optional password to unlock the private key pkey.
</p>
<p><var class="var">key_usage</var>: An ORed sequence of <code class="code">GNUTLS_KEY_</code> * flags.
</p>
<p><var class="var">names</var>: is an array of DNS names belonging to the public-key (NULL if none).
</p>
<p><var class="var">names_length</var>: holds the length of the names list.
</p>
<p><var class="var">flags</var>: an ORed sequence of <code class="code">gnutls_pkcs_encrypt_flags_t</code> .
These apply to the private key pkey.
</p>
<p>This function sets a public/private keypair in the
<code class="code">gnutls_certificate_credentials_t</code> type to be used for authentication
and/or encryption. <code class="code">spki</code> and <code class="code">privkey</code> should match otherwise set
signatures cannot be validated. In case of no match this function
returns <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code> . This function should
be called once for the client because there is currently no mechanism
to determine which raw public-key to select for the peer when there
are multiple present. Multiple raw public keys for the server can be
distinghuished by setting the <code class="code">names</code> .
</p>
<p>Note here that <code class="code">spki</code> is a raw public-key as defined
in RFC7250. It means that there is no surrounding certificate that
holds the public key and that there is therefore no direct mechanism
to prove the authenticity of this key. The keypair can be used during
a TLS handshake but its authenticity should be established via a
different mechanism (e.g. TOFU or known fingerprint).
</p>
<p>The supported formats are basic unencrypted key, PKCS8, PKCS12,
and the openssl format and will be autodetected.
</p>
<p>If the raw public-key and the private key are given in PEM encoding
then the strings that hold their values must be null terminated.
</p>
<p>Key usage (as defined by X.509 extension (2.5.29.15)) can be explicitly
set because there is no certificate structure around the key to define
this value. See for more info <code class="code">gnutls_x509_crt_get_key_usage()</code> .
</p>
<p>Note that, this function by default returns zero on success and a
negative value on error. Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code>
is set using <code class="code">gnutls_certificate_set_flags()</code> it returns an index
(greater or equal to zero). That index can be used in other functions
to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, in case the
key pair does not match <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code> is returned,
in other erroneous cases a different negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fretrieve_005ffunction-1"><span>gnutls_certificate_set_retrieve_function<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fretrieve_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_retrieve_function</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function sets a callback to be called in order to retrieve the
certificate to be used in the handshake. The callback will take control
only if a certificate is requested by the peer. You are advised
to use <code class="code">gnutls_certificate_set_retrieve_function2()</code> because it
is much more efficient in the processing it requires from gnutls.
</p>
<p>The callback’s function prototype is:
int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs,
const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_retr2_st* st);
</p>
<p><code class="code">req_ca_dn</code> is only used in X.509 certificates.
Contains a list with the CA names that the server considers trusted.
This is a hint and typically the client should send a certificate that is signed
by one of these CAs. These names, when available, are DER encoded. To get a more
meaningful value use the function <code class="code">gnutls_x509_rdn_get()</code> .
</p>
<p><code class="code">pk_algos</code> contains a list with server’s acceptable public key algorithms.
The certificate returned should support the server’s given algorithms.
</p>
<p><code class="code">st</code> should contain the certificates and private keys.
</p>
<p>If the callback function is provided then gnutls will call it, in the
handshake, after the certificate request message has been received.
</p>
<p>In server side pk_algos and req_ca_dn are NULL.
</p>
<p>The callback function should set the certificate list to be sent,
and return 0 on success. If no certificate was selected then the
number of certificates should be set to zero. The value (-1)
indicates error and the handshake will be terminated. If both certificates
are set in the credentials and a callback is available, the callback
takes predence.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fverify_005fflags-1"><span>gnutls_certificate_set_verify_flags<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fverify_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fverify_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fverify_005fflags"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_verify_flags</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fverify_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials_t type
</p>
<p><var class="var">flags</var>: are the flags
</p>
<p>This function will set the flags to be used for verification
of certificates and override any defaults. The provided flags must be an OR of the
<code class="code">gnutls_certificate_verify_flags</code> enumerations.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fverify_005ffunction-1"><span>gnutls_certificate_set_verify_function<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fverify_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fverify_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fverify_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_verify_function</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_verify_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fverify_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function sets a callback to be called when peer’s certificate
has been received in order to verify it on receipt rather than
doing after the handshake is completed.
</p>
<p>The callback’s function prototype is:
int (*callback)(gnutls_session_t);
</p>
<p>If the callback function is provided then gnutls will call it, in the
handshake, just after the certificate message has been received.
To verify or obtain the certificate the <code class="code">gnutls_certificate_verify_peers2()</code> ,
<code class="code">gnutls_certificate_type_get()</code> , <code class="code">gnutls_certificate_get_peers()</code> functions
can be used.
</p>
<p>The callback function should return 0 for the handshake to continue
or non-zero to terminate.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fverify_005flimits-1"><span>gnutls_certificate_set_verify_limits<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fverify_005flimits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fverify_005flimits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fverify_005flimits"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_verify_limits</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, unsigned int <var class="var">max_bits</var>, unsigned int <var class="var">max_depth</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fverify_005flimits"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_certificate_credentials type
</p>
<p><var class="var">max_bits</var>: is the number of bits of an acceptable certificate (default 8200)
</p>
<p><var class="var">max_depth</var>: is maximum depth of the verification of a certificate chain (default 5)
</p>
<p>This function will set some upper limits for the default
verification function, <code class="code">gnutls_certificate_verify_peers2()</code> , to avoid
denial of service attacks. You can set them to zero to disable
limits.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fcrl-1"><span>gnutls_certificate_set_x509_crl<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fcrl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fcrl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fcrl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_crl</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_x509_crl_t * <var class="var">crl_list</var>, int <var class="var">crl_list_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fcrl"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">crl_list</var>: is a list of trusted CRLs. They should have been verified before.
</p>
<p><var class="var">crl_list_size</var>: holds the size of the crl_list
</p>
<p>This function adds the trusted CRLs in order to verify client or
server certificates. In case of a client this is not required to
be called if the certificates are not verified using
<code class="code">gnutls_certificate_verify_peers2()</code> . This function may be called
multiple times.
</p>
<p><strong class="strong">Returns:</strong> number of CRLs processed, or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fcrl_005ffile-1"><span>gnutls_certificate_set_x509_crl_file<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fcrl_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fcrl_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fcrl_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_crl_file</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">crlfile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fcrl_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">crlfile</var>: is a file containing the list of verified CRLs (DER or PEM list)
</p>
<p><var class="var">type</var>: is PEM or DER
</p>
<p>This function adds the trusted CRLs in order to verify client or server
certificates. In case of a client this is not required
to be called if the certificates are not verified using
<code class="code">gnutls_certificate_verify_peers2()</code> .
This function may be called multiple times.
</p>
<p><strong class="strong">Returns:</strong> number of CRLs processed or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fcrl_005fmem-1"><span>gnutls_certificate_set_x509_crl_mem<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fcrl_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fcrl_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fcrl_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_crl_mem</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const gnutls_datum_t * <var class="var">CRL</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fcrl_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">CRL</var>: is a list of trusted CRLs. They should have been verified before.
</p>
<p><var class="var">type</var>: is DER or PEM
</p>
<p>This function adds the trusted CRLs in order to verify client or
server certificates. In case of a client this is not required to
be called if the certificates are not verified using
<code class="code">gnutls_certificate_verify_peers2()</code> . This function may be called
multiple times.
</p>
<p><strong class="strong">Returns:</strong> number of CRLs processed, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fkey-1"><span>gnutls_certificate_set_x509_key<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_key</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_x509_crt_t * <var class="var">cert_list</var>, int <var class="var">cert_list_size</var>, gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">cert_list</var>: contains a certificate list (path) for the specified private key
</p>
<p><var class="var">cert_list_size</var>: holds the size of the certificate list
</p>
<p><var class="var">key</var>: is a <code class="code">gnutls_x509_privkey_t</code> key
</p>
<p>This function sets a certificate/private key pair in the
gnutls_certificate_credentials_t type. This function may be
called more than once, in case multiple keys/certificates exist for
the server. For clients that wants to send more than their own end
entity certificate (e.g., also an intermediate CA cert) then put
the certificate chain in <code class="code">cert_list</code> .
</p>
<p>Note that the certificates and keys provided, can be safely deinitialized
after this function is called.
</p>
<p>If that function fails to load the <code class="code">res</code> type is at an undefined state, it must
not be reused to load other keys or certificates.
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used to other functions to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile-1"><span>gnutls_certificate_set_x509_key_file<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_key_file</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">certfile</var>, const char * <var class="var">keyfile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">certfile</var>: is a file that containing the certificate list (path) for
the specified private key, in PKCS7 format, or a list of certificates
</p>
<p><var class="var">keyfile</var>: is a file that contains the private key
</p>
<p><var class="var">type</var>: is PEM or DER
</p>
<p>This function sets a certificate/private key pair in the
gnutls_certificate_credentials_t type. This function may be
called more than once, in case multiple keys/certificates exist for
the server. For clients that need to send more than its own end
entity certificate, e.g., also an intermediate CA cert, then the
<code class="code">certfile</code> must contain the ordered certificate chain.
</p>
<p>Note that the names in the certificate provided will be considered
when selecting the appropriate certificate to use (in case of multiple
certificate/key pairs).
</p>
<p>This function can also accept URLs at <code class="code">keyfile</code> and <code class="code">certfile</code> . In that case it
will use the private key and certificate indicated by the URLs. Note
that the supported URLs are the ones indicated by <code class="code">gnutls_url_is_supported()</code> .
</p>
<p>In case the <code class="code">certfile</code> is provided as a PKCS <code class="code">11</code> URL, then the certificate, and its
present issuers in the token are imported (i.e., forming the required trust chain).
</p>
<p>If that function fails to load the <code class="code">res</code> structure is at an undefined state, it must
not be reused to load other keys or certificates.
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used to other functions to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p>
<p><strong class="strong">Since:</strong> 3.1.11
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2-1"><span>gnutls_certificate_set_x509_key_file2<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_key_file2</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">certfile</var>, const char * <var class="var">keyfile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">certfile</var>: is a file that containing the certificate list (path) for
the specified private key, in PKCS7 format, or a list of certificates
</p>
<p><var class="var">keyfile</var>: is a file that contains the private key
</p>
<p><var class="var">type</var>: is PEM or DER
</p>
<p><var class="var">pass</var>: is the password of the key
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p>This function sets a certificate/private key pair in the
gnutls_certificate_credentials_t type. This function may be
called more than once, in case multiple keys/certificates exist for
the server. For clients that need to send more than its own end
entity certificate, e.g., also an intermediate CA cert, then the
<code class="code">certfile</code> must contain the ordered certificate chain.
</p>
<p>Note that the names in the certificate provided will be considered
when selecting the appropriate certificate to use (in case of multiple
certificate/key pairs).
</p>
<p>This function can also accept URLs at <code class="code">keyfile</code> and <code class="code">certfile</code> . In that case it
will use the private key and certificate indicated by the URLs. Note
that the supported URLs are the ones indicated by <code class="code">gnutls_url_is_supported()</code> .
Before GnuTLS 3.4.0 when a URL was specified, the <code class="code">pass</code> part was ignored and a
PIN callback had to be registered, this is no longer the case in current releases.
</p>
<p>In case the <code class="code">certfile</code> is provided as a PKCS <code class="code">11</code> URL, then the certificate, and its
present issuers in the token are imported (i.e., forming the required trust chain).
</p>
<p>If that function fails to load the <code class="code">res</code> structure is at an undefined state, it must
not be reused to load other keys or certificates.
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used to other functions to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem-1"><span>gnutls_certificate_set_x509_key_mem<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_key_mem</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const gnutls_datum_t * <var class="var">cert</var>, const gnutls_datum_t * <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">cert</var>: contains a certificate list (path) for the specified private key
</p>
<p><var class="var">key</var>: is the private key, or <code class="code">NULL</code>
</p>
<p><var class="var">type</var>: is PEM or DER
</p>
<p>This function sets a certificate/private key pair in the
gnutls_certificate_credentials_t type. This function may be called
more than once, in case multiple keys/certificates exist for the
server.
</p>
<p>Note that the keyUsage (2.5.29.15) PKIX extension in X.509 certificates
is supported. This means that certificates intended for signing cannot
be used for ciphersuites that require encryption.
</p>
<p>If the certificate and the private key are given in PEM encoding
then the strings that hold their values must be null terminated.
</p>
<p>The <code class="code">key</code> may be <code class="code">NULL</code> if you are using a sign callback, see
<code class="code">gnutls_sign_callback_set()</code> .
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used to other functions to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem2-1"><span>gnutls_certificate_set_x509_key_mem2<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_key_mem2</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const gnutls_datum_t * <var class="var">cert</var>, const gnutls_datum_t * <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem2"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">cert</var>: contains a certificate list (path) for the specified private key
</p>
<p><var class="var">key</var>: is the private key, or <code class="code">NULL</code>
</p>
<p><var class="var">type</var>: is PEM or DER
</p>
<p><var class="var">pass</var>: is the key’s password
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p>This function sets a certificate/private key pair in the
gnutls_certificate_credentials_t type. This function may be called
more than once, in case multiple keys/certificates exist for the
server.
</p>
<p>Note that the keyUsage (2.5.29.15) PKIX extension in X.509 certificates
is supported. This means that certificates intended for signing cannot
be used for ciphersuites that require encryption.
</p>
<p>If the certificate and the private key are given in PEM encoding
then the strings that hold their values must be null terminated.
</p>
<p>The <code class="code">key</code> may be <code class="code">NULL</code> if you are using a sign callback, see
<code class="code">gnutls_sign_callback_set()</code> .
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used to other functions to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile-1"><span>gnutls_certificate_set_x509_simple_pkcs12_file<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_simple_pkcs12_file</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const char * <var class="var">pkcs12file</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">password</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">pkcs12file</var>: filename of file containing PKCS<code class="code">12</code> blob.
</p>
<p><var class="var">type</var>: is PEM or DER of the <code class="code">pkcs12file</code> .
</p>
<p><var class="var">password</var>: optional password used to decrypt PKCS<code class="code">12</code> file, bags and keys.
</p>
<p>This function sets a certificate/private key pair and/or a CRL in
the gnutls_certificate_credentials_t type. This function may
be called more than once (in case multiple keys/certificates exist
for the server).
</p>
<p>PKCS<code class="code">12</code> files with a MAC, encrypted bags and PKCS <code class="code">8</code>
private keys are supported. However,
only password based security, and the same password for all
operations, are supported.
</p>
<p>PKCS<code class="code">12</code> file may contain many keys and/or certificates, and this
function will try to auto-detect based on the key ID the certificate
and key pair to use. If the PKCS<code class="code">12</code> file contain the issuer of
the selected certificate, it will be appended to the certificate
to form a chain.
</p>
<p>If more than one private keys are stored in the PKCS<code class="code">12</code> file,
then only one key will be read (and it is undefined which one).
</p>
<p>It is believed that the limitations of this function is acceptable
for most usage, and that any more flexibility would introduce
complexity that would make it harder to use this functionality at
all.
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used to other functions to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005fmem-1"><span>gnutls_certificate_set_x509_simple_pkcs12_mem<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_simple_pkcs12_mem</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const gnutls_datum_t * <var class="var">p12blob</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, const char * <var class="var">password</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">p12blob</var>: the PKCS<code class="code">12</code> blob.
</p>
<p><var class="var">type</var>: is PEM or DER of the <code class="code">pkcs12file</code> .
</p>
<p><var class="var">password</var>: optional password used to decrypt PKCS<code class="code">12</code> file, bags and keys.
</p>
<p>This function sets a certificate/private key pair and/or a CRL in
the gnutls_certificate_credentials_t type. This function may
be called more than once (in case multiple keys/certificates exist
for the server).
</p>
<p>Encrypted PKCS<code class="code">12</code> bags and PKCS<code class="code">8</code> private keys are supported. However,
only password based security, and the same password for all
operations, are supported.
</p>
<p>PKCS<code class="code">12</code> file may contain many keys and/or certificates, and this
function will try to auto-detect based on the key ID the certificate
and key pair to use. If the PKCS<code class="code">12</code> file contain the issuer of
the selected certificate, it will be appended to the certificate
to form a chain.
</p>
<p>If more than one private keys are stored in the PKCS<code class="code">12</code> file,
then only one key will be read (and it is undefined which one).
</p>
<p>It is believed that the limitations of this function is acceptable
for most usage, and that any more flexibility would introduce
complexity that would make it harder to use this functionality at
all.
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used to other functions to refer to the added key-pair.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust-1"><span>gnutls_certificate_set_x509_system_trust<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_system_trust</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust-1"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p>This function adds the system’s default trusted CAs in order to
verify client or server certificates.
</p>
<p>In the case the system is currently unsupported <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code>
is returned.
</p>
<p><strong class="strong">Returns:</strong> the number of certificates processed or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 3.0.20
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005ftrust-1"><span>gnutls_certificate_set_x509_trust<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005ftrust"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005ftrust"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_trust</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_x509_crt_t * <var class="var">ca_list</var>, int <var class="var">ca_list_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">ca_list</var>: is a list of trusted CAs
</p>
<p><var class="var">ca_list_size</var>: holds the size of the CA list
</p>
<p>This function adds the trusted CAs in order to verify client
or server certificates. In case of a client this is not required
to be called if the certificates are not verified using
<code class="code">gnutls_certificate_verify_peers2()</code> .
This function may be called multiple times.
</p>
<p>In case of a server the CAs set here will be sent to the client if
a certificate request is sent. This can be disabled using
<code class="code">gnutls_certificate_send_x509_rdn_sequence()</code> .
</p>
<p><strong class="strong">Returns:</strong> the number of certificates processed or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir-1"><span>gnutls_certificate_set_x509_trust_dir<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_trust_dir</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">ca_dir</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">ca_dir</var>: is a directory containing the list of trusted CAs (DER or PEM list)
</p>
<p><var class="var">type</var>: is PEM or DER
</p>
<p>This function adds the trusted CAs present in the directory in order to
verify client or server certificates. This function is identical
to <code class="code">gnutls_certificate_set_x509_trust_file()</code> but loads all certificates
in a directory.
</p>
<p><strong class="strong">Returns:</strong> the number of certificates processed
</p>
<p><strong class="strong">Since:</strong> 3.3.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile-1"><span>gnutls_certificate_set_x509_trust_file<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_trust_file</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, const char * <var class="var">cafile</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">cafile</var>: is a file containing the list of trusted CAs (DER or PEM list)
</p>
<p><var class="var">type</var>: is PEM or DER
</p>
<p>This function adds the trusted CAs in order to verify client or
server certificates. In case of a client this is not required to
be called if the certificates are not verified using
<code class="code">gnutls_certificate_verify_peers2()</code> . This function may be called
multiple times.
</p>
<p>In case of a server the names of the CAs set here will be sent to
the client if a certificate request is sent. This can be disabled
using <code class="code">gnutls_certificate_send_x509_rdn_sequence()</code> .
</p>
<p>This function can also accept URLs. In that case it
will import all certificates that are marked as trusted. Note
that the supported URLs are the ones indicated by <code class="code">gnutls_url_is_supported()</code> .
</p>
<p><strong class="strong">Returns:</strong> the number of certificates processed
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fx509_005ftrust_005fmem-1"><span>gnutls_certificate_set_x509_trust_mem<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fx509_005ftrust_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fx509_005ftrust_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_x509_trust_mem</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const gnutls_datum_t * <var class="var">ca</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">ca</var>: is a list of trusted CAs or a DER certificate
</p>
<p><var class="var">type</var>: is DER or PEM
</p>
<p>This function adds the trusted CAs in order to verify client or
server certificates. In case of a client this is not required to be
called if the certificates are not verified using
<code class="code">gnutls_certificate_verify_peers2()</code> . This function may be called
multiple times.
</p>
<p>In case of a server the CAs set here will be sent to the client if
a certificate request is sent. This can be disabled using
<code class="code">gnutls_certificate_send_x509_rdn_sequence()</code> .
</p>
<p><strong class="strong">Returns:</strong> the number of certificates processed or a negative error code
on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ftype_005fget-1"><span>gnutls_certificate_type_get<a class="copiable-link" href="#gnutls_005fcertificate_005ftype_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ftype_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ftype_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_certificate_type_t</code> <strong class="def-name">gnutls_certificate_type_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ftype_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function returns the type of the certificate that is negotiated
for this side to send to the peer. The certificate type is by default
X.509, unless an alternative certificate type is enabled by
<code class="code">gnutls_init()</code> and negotiated during the session.
</p>
<p>Resumed sessions will return the certificate type that was negotiated
and used in the original session.
</p>
<p>As of version 3.6.4 it is recommended to use
<code class="code">gnutls_certificate_type_get2()</code> which is more fine-grained.
</p>
<p><strong class="strong">Returns:</strong> the currently used <code class="code">gnutls_certificate_type_t</code> certificate
type as negotiated for ’our’ side of the connection.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ftype_005fget2-1"><span>gnutls_certificate_type_get2<a class="copiable-link" href="#gnutls_005fcertificate_005ftype_005fget2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ftype_005fget2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ftype_005fget2"><span class="category-def">Function: </span><span><code class="def-type">gnutls_certificate_type_t</code> <strong class="def-name">gnutls_certificate_type_get2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_ctype_target_t <var class="var">target</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ftype_005fget2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">target</var>: is a <code class="code">gnutls_ctype_target_t</code> type.
</p>
<p>This function returns the type of the certificate that a side
is negotiated to use. The certificate type is by default X.509,
unless an alternative certificate type is enabled by <code class="code">gnutls_init()</code> and
negotiated during the session.
</p>
<p>The <code class="code">target</code> parameter specifies whether to request the negotiated
certificate type for the client (<code class="code">GNUTLS_CTYPE_CLIENT</code> ),
or for the server (<code class="code">GNUTLS_CTYPE_SERVER</code> ). Additionally, in P2P mode
connection set up where you don’t know in advance who will be client
and who will be server you can use the flag (<code class="code">GNUTLS_CTYPE_OURS</code> ) and
(<code class="code">GNUTLS_CTYPE_PEERS</code> ) to retrieve the corresponding certificate types.
</p>
<p>Resumed sessions will return the certificate type that was negotiated
and used in the original session. That is, this function can be used
to reliably determine the type of the certificate returned by
<code class="code">gnutls_certificate_get_peers()</code> .
</p>
<p><strong class="strong">Returns:</strong> the currently used <code class="code">gnutls_certificate_type_t</code> certificate
type for the client or the server.
</p>
<p><strong class="strong">Since:</strong> 3.6.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ftype_005fget_005fid-1"><span>gnutls_certificate_type_get_id<a class="copiable-link" href="#gnutls_005fcertificate_005ftype_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ftype_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ftype_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_certificate_type_t</code> <strong class="def-name">gnutls_certificate_type_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ftype_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a certificate type name
</p>
<p>The names are compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_certificate_type_t</code> for the specified in a
string certificate type, or <code class="code">GNUTLS_CRT_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ftype_005fget_005fname-1"><span>gnutls_certificate_type_get_name<a class="copiable-link" href="#gnutls_005fcertificate_005ftype_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ftype_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ftype_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_certificate_type_get_name</strong> <code class="def-code-arguments">(gnutls_certificate_type_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ftype_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">type</var>: is a certificate type
</p>
<p>Convert a <code class="code">gnutls_certificate_type_t</code> type to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified
certificate type, or <code class="code">NULL</code> in case of unknown types.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005ftype_005flist-1"><span>gnutls_certificate_type_list<a class="copiable-link" href="#gnutls_005fcertificate_005ftype_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005ftype_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005ftype_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_certificate_type_t *</code> <strong class="def-name">gnutls_certificate_type_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005ftype_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of certificate types.
</p>
<p><strong class="strong">Returns:</strong> a (0)-terminated list of <code class="code">gnutls_certificate_type_t</code>
integers indicating the available certificate types.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fverification_005fstatus_005fprint-1"><span>gnutls_certificate_verification_status_print<a class="copiable-link" href="#gnutls_005fcertificate_005fverification_005fstatus_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fverification_005fstatus_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fverification_005fstatus_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_verification_status_print</strong> <code class="def-code-arguments">(unsigned int <var class="var">status</var>, gnutls_certificate_type_t <var class="var">type</var>, gnutls_datum_t * <var class="var">out</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fverification_005fstatus_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">status</var>: The status flags to be printed
</p>
<p><var class="var">type</var>: The certificate type
</p>
<p><var class="var">out</var>: Newly allocated datum with (0) terminated string.
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will pretty print the status of a verification
process – eg. the one obtained by <code class="code">gnutls_certificate_verify_peers3()</code> .
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fverify_005fpeers-1"><span>gnutls_certificate_verify_peers<a class="copiable-link" href="#gnutls_005fcertificate_005fverify_005fpeers-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fverify_005fpeers"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fverify_005fpeers"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_verify_peers</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_typed_vdata_st * <var class="var">data</var>, unsigned int <var class="var">elements</var>, unsigned int * <var class="var">status</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fverify_005fpeers"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">data</var>: an array of typed data
</p>
<p><var class="var">elements</var>: the number of data elements
</p>
<p><var class="var">status</var>: is the output of the verification
</p>
<p>This function will verify the peer’s certificate and store the
the status in the <code class="code">status</code> variable as a bitwise OR of gnutls_certificate_status_t
values or zero if the certificate is trusted. Note that value in <code class="code">status</code> is set only when the return value of this function is success (i.e, failure
to trust a certificate does not imply a negative return value).
The default verification flags used by this function can be overridden
using <code class="code">gnutls_certificate_set_verify_flags()</code> . See the documentation
of <code class="code">gnutls_certificate_verify_peers2()</code> for details in the verification process.
</p>
<p>This function will take into account the stapled OCSP responses sent by the server,
as well as the following X.509 certificate extensions: Name Constraints,
Key Usage, and Basic Constraints (pathlen).
</p>
<p>The acceptable <code class="code">data</code> types are <code class="code">GNUTLS_DT_DNS_HOSTNAME</code> , <code class="code">GNUTLS_DT_RFC822NAME</code> and <code class="code">GNUTLS_DT_KEY_PURPOSE_OID</code> .
The former two accept as data a null-terminated hostname or email address, and the latter a null-terminated
object identifier (e.g., <code class="code">GNUTLS_KP_TLS_WWW_SERVER</code> ).
</p>
<p>If a DNS hostname is provided then this function will compare
the hostname in the certificate against the given. If names do not match the
<code class="code">GNUTLS_CERT_UNEXPECTED_OWNER</code> status flag will be set.
If a key purpose OID is provided and the end-certificate contains the extended key
usage PKIX extension, it will be required to be have the provided key purpose
or be marked for any purpose, otherwise verification status will have the
<code class="code">GNUTLS_CERT_SIGNER_CONSTRAINTS_FAILURE</code> flag set.
</p>
<p>To avoid denial of service attacks some
default upper limits regarding the certificate key size and chain
size are set. To override them use <code class="code">gnutls_certificate_set_verify_limits()</code> .
</p>
<p>Note that when using raw public-keys verification will not work because there is
no corresponding certificate body belonging to the raw key that can be verified. In that
case this function will return <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) when the validation is performed, or a negative error code otherwise.
A successful error code means that the <code class="code">status</code> parameter must be checked to obtain the validation status.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fverify_005fpeers2-1"><span>gnutls_certificate_verify_peers2<a class="copiable-link" href="#gnutls_005fcertificate_005fverify_005fpeers2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fverify_005fpeers2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fverify_005fpeers2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_verify_peers2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int * <var class="var">status</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fverify_005fpeers2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">status</var>: is the output of the verification
</p>
<p>This function will verify the peer’s certificate and store
the status in the <code class="code">status</code> variable as a bitwise OR of gnutls_certificate_status_t
values or zero if the certificate is trusted. Note that value in <code class="code">status</code> is set only when the return value of this function is success (i.e, failure
to trust a certificate does not imply a negative return value).
The default verification flags used by this function can be overridden
using <code class="code">gnutls_certificate_set_verify_flags()</code> .
</p>
<p>This function will take into account the stapled OCSP responses sent by the server,
as well as the following X.509 certificate extensions: Name Constraints,
Key Usage, and Basic Constraints (pathlen).
</p>
<p>Note that you must also check the peer’s name in order to check if
the verified certificate belongs to the actual peer, see <code class="code">gnutls_x509_crt_check_hostname()</code> ,
or use <code class="code">gnutls_certificate_verify_peers3()</code> .
</p>
<p>To avoid denial of service attacks some
default upper limits regarding the certificate key size and chain
size are set. To override them use <code class="code">gnutls_certificate_set_verify_limits()</code> .
</p>
<p>Note that when using raw public-keys verification will not work because there is
no corresponding certificate body belonging to the raw key that can be verified. In that
case this function will return <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) when the validation is performed, or a negative error code otherwise.
A successful error code means that the <code class="code">status</code> parameter must be checked to obtain the validation status.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fverify_005fpeers3-1"><span>gnutls_certificate_verify_peers3<a class="copiable-link" href="#gnutls_005fcertificate_005fverify_005fpeers3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fverify_005fpeers3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fverify_005fpeers3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_verify_peers3</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, unsigned int * <var class="var">status</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fverify_005fpeers3"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">hostname</var>: is the expected name of the peer; may be <code class="code">NULL</code>
</p>
<p><var class="var">status</var>: is the output of the verification
</p>
<p>This function will verify the peer’s certificate and store the
the status in the <code class="code">status</code> variable as a bitwise OR of gnutls_certificate_status_t
values or zero if the certificate is trusted. Note that value in <code class="code">status</code> is set only when the return value of this function is success (i.e, failure
to trust a certificate does not imply a negative return value).
The default verification flags used by this function can be overridden
using <code class="code">gnutls_certificate_set_verify_flags()</code> . See the documentation
of <code class="code">gnutls_certificate_verify_peers2()</code> for details in the verification process.
</p>
<p>This function will take into account the stapled OCSP responses sent by the server,
as well as the following X.509 certificate extensions: Name Constraints,
Key Usage, and Basic Constraints (pathlen).
</p>
<p>If the <code class="code">hostname</code> provided is non-NULL then this function will compare
the hostname in the certificate against it. The comparison will follow
the RFC6125 recommendations. If names do not match the
<code class="code">GNUTLS_CERT_UNEXPECTED_OWNER</code> status flag will be set.
</p>
<p>In order to verify the purpose of the end-certificate (by checking the extended
key usage), use <code class="code">gnutls_certificate_verify_peers()</code> .
</p>
<p>To avoid denial of service attacks some
default upper limits regarding the certificate key size and chain
size are set. To override them use <code class="code">gnutls_certificate_set_verify_limits()</code> .
</p>
<p>Note that when using raw public-keys verification will not work because there is
no corresponding certificate body belonging to the raw key that can be verified. In that
case this function will return <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) when the validation is performed, or a negative error code otherwise.
A successful error code means that the <code class="code">status</code> parameter must be checked to obtain the validation status.
</p>
<p><strong class="strong">Since:</strong> 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcheck_005fversion-1"><span>gnutls_check_version<a class="copiable-link" href="#gnutls_005fcheck_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcheck_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcheck_005fversion"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_check_version</strong> <code class="def-code-arguments">(const char * <var class="var">req_version</var>)</code><a class="copiable-link" href="#index-gnutls_005fcheck_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">req_version</var>: version string to compare with, or <code class="code">NULL</code> .
</p>
<p>Check the GnuTLS Library version against the provided string.
See <code class="code">GNUTLS_VERSION</code> for a suitable <code class="code">req_version</code> string.
</p>
<p>See also <code class="code">gnutls_check_version_numeric()</code> , which provides this
functionality as a macro.
</p>
<p><strong class="strong">Returns:</strong> Check that the version of the library is at
minimum the one given as a string in <code class="code">req_version</code> and return the
actual version string of the library; return <code class="code">NULL</code> if the
condition is not met. If <code class="code">NULL</code> is passed to this function no
check is done and only the version string is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fget-1"><span>gnutls_cipher_get<a class="copiable-link" href="#gnutls_005fcipher_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_cipher_algorithm_t</code> <strong class="def-name">gnutls_cipher_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the currently used cipher.
</p>
<p><strong class="strong">Returns:</strong> the currently used cipher, a <code class="code">gnutls_cipher_algorithm_t</code>
type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fget_005fid-1"><span>gnutls_cipher_get_id<a class="copiable-link" href="#gnutls_005fcipher_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_cipher_algorithm_t</code> <strong class="def-name">gnutls_cipher_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a cipher algorithm name
</p>
<p>The names are compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_cipher_algorithm_t</code> value corresponding to
the specified cipher, or <code class="code">GNUTLS_CIPHER_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fget_005fkey_005fsize-1"><span>gnutls_cipher_get_key_size<a class="copiable-link" href="#gnutls_005fcipher_005fget_005fkey_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fget_005fkey_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fget_005fkey_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_cipher_get_key_size</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fget_005fkey_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is an encryption algorithm
</p>
<p>This function returns the key size of the provided algorithm.
</p>
<p><strong class="strong">Returns:</strong> length (in bytes) of the given cipher’s key size, or 0 if
the given cipher is invalid.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fget_005fname-1"><span>gnutls_cipher_get_name<a class="copiable-link" href="#gnutls_005fcipher_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_cipher_get_name</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is an encryption algorithm
</p>
<p>Convert a <code class="code">gnutls_cipher_algorithm_t</code> type to a string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the name of the
specified cipher, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005flist-1"><span>gnutls_cipher_list<a class="copiable-link" href="#gnutls_005fcipher_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_cipher_algorithm_t *</code> <strong class="def-name">gnutls_cipher_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of supported cipher algorithms. Note that not
necessarily all ciphers are supported as TLS cipher suites. For
example, DES is not supported as a cipher suite, but is supported
for other purposes (e.g., PKCS<code class="code">8</code> or similar).
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> a (0)-terminated list of <code class="code">gnutls_cipher_algorithm_t</code>
integers indicating the available ciphers.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fsuite_005fget_005fname-1"><span>gnutls_cipher_suite_get_name<a class="copiable-link" href="#gnutls_005fcipher_005fsuite_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fsuite_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fsuite_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_cipher_suite_get_name</strong> <code class="def-code-arguments">(gnutls_kx_algorithm_t <var class="var">kx_algorithm</var>, gnutls_cipher_algorithm_t <var class="var">cipher_algorithm</var>, gnutls_mac_algorithm_t <var class="var">mac_algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fsuite_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">kx_algorithm</var>: is a Key exchange algorithm
</p>
<p><var class="var">cipher_algorithm</var>: is a cipher algorithm
</p>
<p><var class="var">mac_algorithm</var>: is a MAC algorithm
</p>
<p>This function returns the ciphersuite name under TLS1.2 or earlier
versions when provided with individual algorithms. The full cipher suite
name must be prepended by TLS or SSL depending of the protocol in use.
</p>
<p>To get a description of the current ciphersuite across versions, it
is recommended to use <code class="code">gnutls_session_get_desc()</code> .
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of a TLS cipher suite,
specified by the given algorithms, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fsuite_005finfo-1"><span>gnutls_cipher_suite_info<a class="copiable-link" href="#gnutls_005fcipher_005fsuite_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fsuite_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fsuite_005finfo"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_cipher_suite_info</strong> <code class="def-code-arguments">(size_t <var class="var">idx</var>, unsigned char * <var class="var">cs_id</var>, gnutls_kx_algorithm_t * <var class="var">kx</var>, gnutls_cipher_algorithm_t * <var class="var">cipher</var>, gnutls_mac_algorithm_t * <var class="var">mac</var>, gnutls_protocol_t * <var class="var">min_version</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fsuite_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">idx</var>: index of cipher suite to get information about, starts on 0.
</p>
<p><var class="var">cs_id</var>: output buffer with room for 2 bytes, indicating cipher suite value
</p>
<p><var class="var">kx</var>: output variable indicating key exchange algorithm, or <code class="code">NULL</code> .
</p>
<p><var class="var">cipher</var>: output variable indicating cipher, or <code class="code">NULL</code> .
</p>
<p><var class="var">mac</var>: output variable indicating MAC algorithm, or <code class="code">NULL</code> .
</p>
<p><var class="var">min_version</var>: output variable indicating TLS protocol version, or <code class="code">NULL</code> .
</p>
<p>Get information about supported cipher suites. Use the function
iteratively to get information about all supported cipher suites.
Call with idx=0 to get information about first cipher suite, then
idx=1 and so on until the function returns NULL.
</p>
<p><strong class="strong">Returns:</strong> the name of <code class="code">idx</code> cipher suite, and set the information
about the cipher suite in the output variables. If <code class="code">idx</code> is out of
bounds, <code class="code">NULL</code> is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fciphersuite_005fget-1"><span>gnutls_ciphersuite_get<a class="copiable-link" href="#gnutls_005fciphersuite_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fciphersuite_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fciphersuite_005fget"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_ciphersuite_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fciphersuite_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the canonical name of negotiated TLS ciphersuite. The names
returned by this function match the IANA registry, with one
exception:
</p>
<p>TLS_DHE_DSS_RC4_128_SHA { 0x00, 0x66 }
</p>
<p>which is reserved for compatibility.
</p>
<p>To get a detailed description of the current ciphersuite, it is
recommended to use <code class="code">gnutls_session_get_desc()</code> .
</p>
<p><strong class="strong">Returns:</strong> a string that contains the canonical name of a TLS ciphersuite,
or <code class="code">NULL</code> if the handshake is not completed.
</p>
<p><strong class="strong">Since:</strong> 3.7.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcompress_005fcertificate_005fget_005fselected_005fmethod-1"><span>gnutls_compress_certificate_get_selected_method<a class="copiable-link" href="#gnutls_005fcompress_005fcertificate_005fget_005fselected_005fmethod-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcompress_005fcertificate_005fget_005fselected_005fmethod"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcompress_005fcertificate_005fget_005fselected_005fmethod"><span class="category-def">Function: </span><span><code class="def-type">gnutls_compression_method_t</code> <strong class="def-name">gnutls_compress_certificate_get_selected_method</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcompress_005fcertificate_005fget_005fselected_005fmethod"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function returns the certificate compression method that has been
selected to compress the certificate before sending it to the peer.
The selection is done based on the local list of supported compression
methods and the peer’s requested compression methods.
</p>
<p><strong class="strong">Returns:</strong> selected certificate compression method.
</p>
<p>Since 3.7.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcompress_005fcertificate_005fset_005fmethods-1"><span>gnutls_compress_certificate_set_methods<a class="copiable-link" href="#gnutls_005fcompress_005fcertificate_005fset_005fmethods-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcompress_005fcertificate_005fset_005fmethods"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcompress_005fcertificate_005fset_005fmethods"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_compress_certificate_set_methods</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_compression_method_t * <var class="var">methods</var>, size_t <var class="var">methods_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fcompress_005fcertificate_005fset_005fmethods"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">methods</var>: is a list of supported compression methods.
</p>
<p><var class="var">methods_len</var>: number of compression methods in <code class="code">methods</code>
</p>
<p>This function sets the supported compression methods for certificate compression
for the given session. The list of supported compression methods will be used
for a) requesting the compression of peer’s certificate and b) selecting the
method to compress the local certificate before sending it to the peer.
The order of compression methods inside the list does matter as the method
that appears earlier in the list will be preferred before the later ones.
Note that even if you set the list of supported compression methods, the
compression might not be used if the peer does not support any of your chosen
compression methods.
</p>
<p>The list of supported compression methods must meet the following criteria:
Argument <code class="code">methods</code> must be an array of valid compression methods of type
<code class="code">gnutls_compression_method_t</code> . Argument <code class="code">methods_len</code> must contain the number of
compression methods stored in the <code class="code">methods</code> array and must be within range <1, 127>.
The length constraints are defined by <code class="code">MIN_COMPRESS_CERTIFICATE_METHODS</code>
and <code class="code">MAX_COMPRESS_CERTIFICATE_METHODS</code> macros located in the header file
compress_certificate.h.
</p>
<p>If either <code class="code">methods</code> or <code class="code">methods_len</code> is equal to 0, current list of supported
compression methods will be unset.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p>Since 3.7.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcredentials_005fclear-1"><span>gnutls_credentials_clear<a class="copiable-link" href="#gnutls_005fcredentials_005fclear-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcredentials_005fclear"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcredentials_005fclear"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_credentials_clear</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcredentials_005fclear"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Clears all the credentials previously set in this session.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcredentials_005fget-1"><span>gnutls_credentials_get<a class="copiable-link" href="#gnutls_005fcredentials_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcredentials_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcredentials_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_credentials_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_credentials_type_t <var class="var">type</var>, void ** <var class="var">cred</var>)</code><a class="copiable-link" href="#index-gnutls_005fcredentials_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">type</var>: is the type of the credentials to return
</p>
<p><var class="var">cred</var>: will contain the credentials.
</p>
<p>Returns the previously provided credentials structures.
</p>
<p>For <code class="code">GNUTLS_CRD_ANON</code> , <code class="code">cred</code> will be
<code class="code">gnutls_anon_client_credentials_t</code> in case of a client. In case of
a server it should be <code class="code">gnutls_anon_server_credentials_t</code> .
</p>
<p>For <code class="code">GNUTLS_CRD_SRP</code> , <code class="code">cred</code> will be <code class="code">gnutls_srp_client_credentials_t</code>
in case of a client, and <code class="code">gnutls_srp_server_credentials_t</code> , in case
of a server.
</p>
<p>For <code class="code">GNUTLS_CRD_PSK</code> , <code class="code">cred</code> will be <code class="code">gnutls_psk_client_credentials_t</code>
in case of a client, and <code class="code">gnutls_psk_server_credentials_t</code> , in case
of a server.
</p>
<p>For <code class="code">GNUTLS_CRD_CERTIFICATE</code> , <code class="code">cred</code> will be
<code class="code">gnutls_certificate_credentials_t</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.3.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcredentials_005fset-1"><span>gnutls_credentials_set<a class="copiable-link" href="#gnutls_005fcredentials_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcredentials_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcredentials_005fset-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_credentials_set</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_credentials_type_t <var class="var">type</var>, void * <var class="var">cred</var>)</code><a class="copiable-link" href="#index-gnutls_005fcredentials_005fset-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">type</var>: is the type of the credentials
</p>
<p><var class="var">cred</var>: the credentials to set
</p>
<p>Sets the needed credentials for the specified type. E.g. username,
password - or public and private keys etc. The <code class="code">cred</code> parameter is
a structure that depends on the specified <code class="code">type</code> and on the current
session (client or server). Only a single <code class="code">cred</code> may be set for
each different <code class="code">type</code> , subsequent calls with the same <code class="code">type</code> will
replace the previously set credentials.
</p>
<p>In order to minimize memory usage, and share credentials between
several threads gnutls keeps a pointer to <code class="code">cred</code> , and not the whole
cred structure. Thus you will have to keep the structure allocated
until you call <code class="code">gnutls_deinit()</code> , or a future call of
<code class="code">gnutls_credentials_set()</code> with the same <code class="code">type</code> replaces the <code class="code">cred</code> structure.
</p>
<p>For <code class="code">GNUTLS_CRD_ANON</code> , <code class="code">cred</code> should be
<code class="code">gnutls_anon_client_credentials_t</code> in case of a client. In case of
a server it should be <code class="code">gnutls_anon_server_credentials_t</code> .
</p>
<p>For <code class="code">GNUTLS_CRD_SRP</code> , <code class="code">cred</code> should be <code class="code">gnutls_srp_client_credentials_t</code>
in case of a client, and <code class="code">gnutls_srp_server_credentials_t</code> , in case
of a server.
</p>
<p>For <code class="code">GNUTLS_CRD_CERTIFICATE</code> , <code class="code">cred</code> should be
<code class="code">gnutls_certificate_credentials_t</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fcheck_005fentry-1"><span>gnutls_db_check_entry<a class="copiable-link" href="#gnutls_005fdb_005fcheck_005fentry-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fcheck_005fentry"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fcheck_005fentry"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_db_check_entry</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t <var class="var">session_entry</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fcheck_005fentry"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">session_entry</var>: is the session data (not key)
</p>
<p>This function has no effect.
</p>
<p><strong class="strong">Returns:</strong> Returns <code class="code">GNUTLS_E_EXPIRED</code> , if the database entry has
expired or 0 otherwise.
</p>
<p><strong class="strong">Deprecated:</strong> This function is deprecated.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fcheck_005fentry_005fexpire_005ftime-1"><span>gnutls_db_check_entry_expire_time<a class="copiable-link" href="#gnutls_005fdb_005fcheck_005fentry_005fexpire_005ftime-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fcheck_005fentry_005fexpire_005ftime"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fcheck_005fentry_005fexpire_005ftime"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_db_check_entry_expire_time</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">entry</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fcheck_005fentry_005fexpire_005ftime"> ¶</a></span></dt>
<dd><p><var class="var">entry</var>: is a pointer to a <code class="code">gnutls_datum_t</code> type.
</p>
<p>This function returns the time that this entry will expire.
It can be used for database entry expiration.
</p>
<p><strong class="strong">Returns:</strong> The time this entry will expire, or zero on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fcheck_005fentry_005ftime-1"><span>gnutls_db_check_entry_time<a class="copiable-link" href="#gnutls_005fdb_005fcheck_005fentry_005ftime-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fcheck_005fentry_005ftime"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fcheck_005fentry_005ftime"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_db_check_entry_time</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">entry</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fcheck_005fentry_005ftime"> ¶</a></span></dt>
<dd><p><var class="var">entry</var>: is a pointer to a <code class="code">gnutls_datum_t</code> type.
</p>
<p>This function returns the time that this entry was active.
It can be used for database entry expiration.
</p>
<p><strong class="strong">Returns:</strong> The time this entry was created, or zero on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fget_005fdefault_005fcache_005fexpiration-1"><span>gnutls_db_get_default_cache_expiration<a class="copiable-link" href="#gnutls_005fdb_005fget_005fdefault_005fcache_005fexpiration-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fget_005fdefault_005fcache_005fexpiration"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fget_005fdefault_005fcache_005fexpiration"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_db_get_default_cache_expiration</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fget_005fdefault_005fcache_005fexpiration"> ¶</a></span></dt>
<dd>
<p>Returns the expiration time (in seconds) of stored sessions for resumption.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fget_005fptr-1"><span>gnutls_db_get_ptr<a class="copiable-link" href="#gnutls_005fdb_005fget_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fget_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fget_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void *</code> <strong class="def-name">gnutls_db_get_ptr</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fget_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get db function pointer.
</p>
<p><strong class="strong">Returns:</strong> the pointer that will be sent to db store, retrieve and
delete functions, as the first argument.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fremove_005fsession-1"><span>gnutls_db_remove_session<a class="copiable-link" href="#gnutls_005fdb_005fremove_005fsession-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fremove_005fsession"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fremove_005fsession"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_db_remove_session</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fremove_005fsession"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will remove the current session data from the
session database. This will prevent future handshakes reusing
these session data. This function should be called if a session
was terminated abnormally, and before <code class="code">gnutls_deinit()</code> is called.
</p>
<p>Normally <code class="code">gnutls_deinit()</code> will remove abnormally terminated
sessions.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fset_005fcache_005fexpiration-1"><span>gnutls_db_set_cache_expiration<a class="copiable-link" href="#gnutls_005fdb_005fset_005fcache_005fexpiration-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fset_005fcache_005fexpiration"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fset_005fcache_005fexpiration"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_db_set_cache_expiration</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">seconds</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fset_005fcache_005fexpiration"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">seconds</var>: is the number of seconds.
</p>
<p>Set the expiration time for resumed sessions. The default is 21600
(6 hours) at the time of writing.
</p>
<p>The maximum value that can be set using this function is 604800
(7 days).
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fset_005fptr-1"><span>gnutls_db_set_ptr<a class="copiable-link" href="#gnutls_005fdb_005fset_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fset_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fset_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_db_set_ptr</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fset_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">ptr</var>: is the pointer
</p>
<p>Sets the pointer that will be provided to db store, retrieve and
delete functions, as the first argument.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fset_005fremove_005ffunction-1"><span>gnutls_db_set_remove_function<a class="copiable-link" href="#gnutls_005fdb_005fset_005fremove_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fset_005fremove_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fset_005fremove_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_db_set_remove_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_db_remove_func <var class="var">rem_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fset_005fremove_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">rem_func</var>: is the function.
</p>
<p>Sets the function that will be used to remove data from the
resumed sessions database. This function must return 0 on success.
</p>
<p>The first argument to <code class="code">rem_func</code> will be null unless
<code class="code">gnutls_db_set_ptr()</code> has been called.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fset_005fretrieve_005ffunction-1"><span>gnutls_db_set_retrieve_function<a class="copiable-link" href="#gnutls_005fdb_005fset_005fretrieve_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fset_005fretrieve_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fset_005fretrieve_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_db_set_retrieve_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_db_retr_func <var class="var">retr_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fset_005fretrieve_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">retr_func</var>: is the function.
</p>
<p>Sets the function that will be used to retrieve data from the
resumed sessions database. This function must return a
gnutls_datum_t containing the data on success, or a gnutls_datum_t
containing null and 0 on failure.
</p>
<p>The datum’s data must be allocated using the function
<code class="code">gnutls_malloc()</code> .
</p>
<p>The first argument to <code class="code">retr_func</code> will be null unless
<code class="code">gnutls_db_set_ptr()</code> has been called.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdb_005fset_005fstore_005ffunction-1"><span>gnutls_db_set_store_function<a class="copiable-link" href="#gnutls_005fdb_005fset_005fstore_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdb_005fset_005fstore_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdb_005fset_005fstore_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_db_set_store_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_db_store_func <var class="var">store_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fdb_005fset_005fstore_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">store_func</var>: is the function
</p>
<p>Sets the function that will be used to store data in the resumed
sessions database. This function must return 0 on success.
</p>
<p>The first argument to <code class="code">store_func</code> will be null unless
<code class="code">gnutls_db_set_ptr()</code> has been called.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdeinit-1"><span>gnutls_deinit<a class="copiable-link" href="#gnutls_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdeinit-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_deinit</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdeinit-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function clears all buffers associated with the <code class="code">session</code> .
This function will also remove session data from the session
database if the session was terminated abnormally.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fget_005fgroup-1"><span>gnutls_dh_get_group<a class="copiable-link" href="#gnutls_005fdh_005fget_005fgroup-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fget_005fgroup"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fget_005fgroup"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_get_group</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">raw_gen</var>, gnutls_datum_t * <var class="var">raw_prime</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fget_005fgroup"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">raw_gen</var>: will hold the generator.
</p>
<p><var class="var">raw_prime</var>: will hold the prime.
</p>
<p>This function will return the group parameters used in the last
Diffie-Hellman key exchange with the peer. These are the prime and
the generator used. This function should be used for both
anonymous and ephemeral Diffie-Hellman. The output parameters must
be freed with <code class="code">gnutls_free()</code> .
</p>
<p>Note, that the prime and generator are exported as non-negative
integers and may include a leading zero byte.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fget_005fpeers_005fpublic_005fbits-1"><span>gnutls_dh_get_peers_public_bits<a class="copiable-link" href="#gnutls_005fdh_005fget_005fpeers_005fpublic_005fbits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fget_005fpeers_005fpublic_005fbits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fget_005fpeers_005fpublic_005fbits"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_get_peers_public_bits</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fget_005fpeers_005fpublic_005fbits"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>Get the Diffie-Hellman public key bit size. Can be used for both
anonymous and ephemeral Diffie-Hellman.
</p>
<p><strong class="strong">Returns:</strong> The public key bit size used in the last Diffie-Hellman
key exchange with the peer, or a negative error code in case of error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fget_005fprime_005fbits-1"><span>gnutls_dh_get_prime_bits<a class="copiable-link" href="#gnutls_005fdh_005fget_005fprime_005fbits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fget_005fprime_005fbits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fget_005fprime_005fbits"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_get_prime_bits</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fget_005fprime_005fbits"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This function will return the bits of the prime used in the last
Diffie-Hellman key exchange with the peer. Should be used for both
anonymous and ephemeral Diffie-Hellman. Note that some ciphers,
like RSA and DSA without DHE, do not use a Diffie-Hellman key
exchange, and then this function will return 0.
</p>
<p><strong class="strong">Returns:</strong> The Diffie-Hellman bit strength is returned, or 0 if no
Diffie-Hellman key exchange was done, or a negative error code on
failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fget_005fpubkey-1"><span>gnutls_dh_get_pubkey<a class="copiable-link" href="#gnutls_005fdh_005fget_005fpubkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fget_005fpubkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fget_005fpubkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_get_pubkey</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">raw_key</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fget_005fpubkey"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">raw_key</var>: will hold the public key.
</p>
<p>This function will return the peer’s public key used in the last
Diffie-Hellman key exchange. This function should be used for both
anonymous and ephemeral Diffie-Hellman. The output parameters must
be freed with <code class="code">gnutls_free()</code> .
</p>
<p>Note, that public key is exported as non-negative
integer and may include a leading zero byte.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fget_005fsecret_005fbits-1"><span>gnutls_dh_get_secret_bits<a class="copiable-link" href="#gnutls_005fdh_005fget_005fsecret_005fbits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fget_005fsecret_005fbits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fget_005fsecret_005fbits"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_get_secret_bits</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fget_005fsecret_005fbits"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This function will return the bits used in the last Diffie-Hellman
key exchange with the peer. Should be used for both anonymous and
ephemeral Diffie-Hellman.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fcpy-1"><span>gnutls_dh_params_cpy<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fcpy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fcpy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fcpy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_cpy</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">dst</var>, gnutls_dh_params_t <var class="var">src</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fcpy"> ¶</a></span></dt>
<dd><p><var class="var">dst</var>: Is the destination parameters, which should be initialized.
</p>
<p><var class="var">src</var>: Is the source parameters
</p>
<p>This function will copy the DH parameters structure from source
to destination. The destination should be already initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fdeinit-1"><span>gnutls_dh_params_deinit<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_dh_params_deinit</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">dh_params</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">dh_params</var>: The parameters
</p>
<p>This function will deinitialize the DH parameters type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fexport2_005fpkcs3-1"><span>gnutls_dh_params_export2_pkcs3<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fexport2_005fpkcs3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fexport2_005fpkcs3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fexport2_005fpkcs3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_export2_pkcs3</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">params</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fexport2_005fpkcs3"> ¶</a></span></dt>
<dd><p><var class="var">params</var>: Holds the DH parameters
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a PKCS3 DHParams structure PEM or DER encoded
</p>
<p>This function will export the given dh parameters to a PKCS3
DHParams structure. This is the format generated by "openssl dhparam" tool.
The data in <code class="code">out</code> will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN DH PARAMETERS".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fexport_005fpkcs3-1"><span>gnutls_dh_params_export_pkcs3<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fexport_005fpkcs3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fexport_005fpkcs3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fexport_005fpkcs3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_export_pkcs3</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">params</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned char * <var class="var">params_data</var>, size_t * <var class="var">params_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fexport_005fpkcs3"> ¶</a></span></dt>
<dd><p><var class="var">params</var>: Holds the DH parameters
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">params_data</var>: will contain a PKCS3 DHParams structure PEM or DER encoded
</p>
<p><var class="var">params_data_size</var>: holds the size of params_data (and will be replaced by the actual size of parameters)
</p>
<p>This function will export the given dh parameters to a PKCS3
DHParams structure. This is the format generated by "openssl dhparam" tool.
If the buffer provided is not long enough to hold the output, then
GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN DH PARAMETERS".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fexport_005fraw-1"><span>gnutls_dh_params_export_raw<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fexport_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fexport_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fexport_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_export_raw</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">params</var>, gnutls_datum_t * <var class="var">prime</var>, gnutls_datum_t * <var class="var">generator</var>, unsigned int * <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fexport_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">params</var>: Holds the DH parameters
</p>
<p><var class="var">prime</var>: will hold the new prime
</p>
<p><var class="var">generator</var>: will hold the new generator
</p>
<p><var class="var">bits</var>: if non null will hold the secret key’s number of bits
</p>
<p>This function will export the pair of prime and generator for use
in the Diffie-Hellman key exchange. The new parameters will be
allocated using <code class="code">gnutls_malloc()</code> and will be stored in the
appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fgenerate2-1"><span>gnutls_dh_params_generate2<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fgenerate2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fgenerate2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fgenerate2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_generate2</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">dparams</var>, unsigned int <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fgenerate2"> ¶</a></span></dt>
<dd><p><var class="var">dparams</var>: The parameters
</p>
<p><var class="var">bits</var>: is the prime’s number of bits
</p>
<p>This function will generate a new pair of prime and generator for use in
the Diffie-Hellman key exchange. This may take long time.
</p>
<p>It is recommended not to set the number of bits directly, but
use <code class="code">gnutls_sec_param_to_pk_bits()</code> instead.
Also note that the DH parameters are only useful to servers.
Since clients use the parameters sent by the server, it’s of
no use to call this in client side.
</p>
<p>The parameters generated are of the DSA form. It also is possible
to generate provable parameters (following the Shawe-Taylor
algorithm), using <code class="code">gnutls_x509_privkey_generate2()</code> with DSA option
and the <code class="code">GNUTLS_PRIVKEY_FLAG_PROVABLE</code> flag set. These can the
be imported with <code class="code">gnutls_dh_params_import_dsa()</code> .
</p>
<p>It is no longer recommended for applications to generate parameters.
See the "Parameter generation" section in the manual.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fimport_005fdsa-1"><span>gnutls_dh_params_import_dsa<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fimport_005fdsa-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fimport_005fdsa"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fimport_005fdsa"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_import_dsa</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">dh_params</var>, gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fimport_005fdsa"> ¶</a></span></dt>
<dd><p><var class="var">dh_params</var>: The parameters
</p>
<p><var class="var">key</var>: holds a DSA private key
</p>
<p>This function will import the prime and generator of the DSA key for use
in the Diffie-Hellman key exchange.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fimport_005fpkcs3-1"><span>gnutls_dh_params_import_pkcs3<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fimport_005fpkcs3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fimport_005fpkcs3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fimport_005fpkcs3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_import_pkcs3</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">params</var>, const gnutls_datum_t * <var class="var">pkcs3_params</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fimport_005fpkcs3"> ¶</a></span></dt>
<dd><p><var class="var">params</var>: The parameters
</p>
<p><var class="var">pkcs3_params</var>: should contain a PKCS3 DHParams structure PEM or DER encoded
</p>
<p><var class="var">format</var>: the format of params. PEM or DER.
</p>
<p>This function will extract the DHParams found in a PKCS3 formatted
structure. This is the format generated by "openssl dhparam" tool.
</p>
<p>If the structure is PEM encoded, it should have a header
of "BEGIN DH PARAMETERS".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fimport_005fraw-1"><span>gnutls_dh_params_import_raw<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fimport_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fimport_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fimport_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_import_raw</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">dh_params</var>, const gnutls_datum_t * <var class="var">prime</var>, const gnutls_datum_t * <var class="var">generator</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fimport_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">dh_params</var>: The parameters
</p>
<p><var class="var">prime</var>: holds the new prime
</p>
<p><var class="var">generator</var>: holds the new generator
</p>
<p>This function will replace the pair of prime and generator for use
in the Diffie-Hellman key exchange. The new parameters should be
stored in the appropriate gnutls_datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fimport_005fraw2-1"><span>gnutls_dh_params_import_raw2<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fimport_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fimport_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fimport_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_import_raw2</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">dh_params</var>, const gnutls_datum_t * <var class="var">prime</var>, const gnutls_datum_t * <var class="var">generator</var>, unsigned <var class="var">key_bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fimport_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">dh_params</var>: The parameters
</p>
<p><var class="var">prime</var>: holds the new prime
</p>
<p><var class="var">generator</var>: holds the new generator
</p>
<p><var class="var">key_bits</var>: the private key bits (set to zero when unknown)
</p>
<p>This function will replace the pair of prime and generator for use
in the Diffie-Hellman key exchange. The new parameters should be
stored in the appropriate gnutls_datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005fimport_005fraw3-1"><span>gnutls_dh_params_import_raw3<a class="copiable-link" href="#gnutls_005fdh_005fparams_005fimport_005fraw3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005fimport_005fraw3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005fimport_005fraw3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_import_raw3</strong> <code class="def-code-arguments">(gnutls_dh_params_t <var class="var">dh_params</var>, const gnutls_datum_t * <var class="var">prime</var>, const gnutls_datum_t * <var class="var">q</var>, const gnutls_datum_t * <var class="var">generator</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005fimport_005fraw3"> ¶</a></span></dt>
<dd><p><var class="var">dh_params</var>: The parameters
</p>
<p><var class="var">prime</var>: holds the new prime
</p>
<p><var class="var">q</var>: holds the subgroup if available, otherwise NULL
</p>
<p><var class="var">generator</var>: holds the new generator
</p>
<p>This function will replace the pair of prime and generator for use
in the Diffie-Hellman key exchange. The new parameters should be
stored in the appropriate gnutls_datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fparams_005finit-1"><span>gnutls_dh_params_init<a class="copiable-link" href="#gnutls_005fdh_005fparams_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fparams_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fparams_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dh_params_init</strong> <code class="def-code-arguments">(gnutls_dh_params_t * <var class="var">dh_params</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fparams_005finit"> ¶</a></span></dt>
<dd><p><var class="var">dh_params</var>: The parameters
</p>
<p>This function will initialize the DH parameters type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdh_005fset_005fprime_005fbits-1"><span>gnutls_dh_set_prime_bits<a class="copiable-link" href="#gnutls_005fdh_005fset_005fprime_005fbits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdh_005fset_005fprime_005fbits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdh_005fset_005fprime_005fbits"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_dh_set_prime_bits</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fdh_005fset_005fprime_005fbits"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">bits</var>: is the number of bits
</p>
<p>This function sets the number of bits, for use in a Diffie-Hellman
key exchange. This is used both in DH ephemeral and DH anonymous
cipher suites. This will set the minimum size of the prime that
will be used for the handshake.
</p>
<p>In the client side it sets the minimum accepted number of bits. If
a server sends a prime with less bits than that
<code class="code">GNUTLS_E_DH_PRIME_UNACCEPTABLE</code> will be returned by the handshake.
</p>
<p>Note that this function will warn via the audit log for value that
are believed to be weak.
</p>
<p>The function has no effect in server side.
</p>
<p>Note that since 3.1.7 this function is deprecated. The minimum
number of bits is set by the priority string level.
Also this function must be called after <code class="code">gnutls_priority_set_direct()</code>
or the set value may be overridden by the selected priority options.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdigest_005fget_005fid-1"><span>gnutls_digest_get_id<a class="copiable-link" href="#gnutls_005fdigest_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdigest_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdigest_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_digest_algorithm_t</code> <strong class="def-name">gnutls_digest_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fdigest_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a digest algorithm name
</p>
<p>Convert a string to a <code class="code">gnutls_digest_algorithm_t</code> value. The names are
compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_digest_algorithm_t</code> id of the specified MAC
algorithm string, or <code class="code">GNUTLS_DIG_UNKNOWN</code> on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdigest_005fget_005fname-1"><span>gnutls_digest_get_name<a class="copiable-link" href="#gnutls_005fdigest_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdigest_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdigest_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_digest_get_name</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fdigest_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a digest algorithm
</p>
<p>Convert a <code class="code">gnutls_digest_algorithm_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified digest
algorithm, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdigest_005fget_005foid-1"><span>gnutls_digest_get_oid<a class="copiable-link" href="#gnutls_005fdigest_005fget_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdigest_005fget_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdigest_005fget_005foid"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_digest_get_oid</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fdigest_005fget_005foid"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a digest algorithm
</p>
<p>Convert a <code class="code">gnutls_digest_algorithm_t</code> value to its object identifier.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the object identifier of the specified digest
algorithm, or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdigest_005flist-1"><span>gnutls_digest_list<a class="copiable-link" href="#gnutls_005fdigest_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdigest_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdigest_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_digest_algorithm_t *</code> <strong class="def-name">gnutls_digest_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fdigest_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of hash (digest) algorithms supported by GnuTLS.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> Return a (0)-terminated list of <code class="code">gnutls_digest_algorithm_t</code>
integers indicating the available digests.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdigest_005fset_005fsecure-1"><span>gnutls_digest_set_secure<a class="copiable-link" href="#gnutls_005fdigest_005fset_005fsecure-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdigest_005fset_005fsecure"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdigest_005fset_005fsecure"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_digest_set_secure</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">secure</var>)</code><a class="copiable-link" href="#index-gnutls_005fdigest_005fset_005fsecure"> ¶</a></span></dt>
<dd><p><var class="var">dig</var>: is a digest algorithm
</p>
<p><var class="var">secure</var>: whether to mark the digest algorithm secure
</p>
<p>Modify the previous system wide setting that marked <code class="code">dig</code> as secure
or insecure. This only has effect when the algorithm is enabled
through the allowlisting mode in the configuration file, or when
the setting is modified with a prior call to this function.
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fearly_005fcipher_005fget-1"><span>gnutls_early_cipher_get<a class="copiable-link" href="#gnutls_005fearly_005fcipher_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fearly_005fcipher_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fearly_005fcipher_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_cipher_algorithm_t</code> <strong class="def-name">gnutls_early_cipher_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fearly_005fcipher_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the cipher algorithm used for encrypting early data.
</p>
<p><strong class="strong">Returns:</strong> the cipher used for early data, a
<code class="code">gnutls_cipher_algorithm_t</code> type.
</p>
<p><strong class="strong">Since:</strong> 3.7.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fearly_005fprf_005fhash_005fget-1"><span>gnutls_early_prf_hash_get<a class="copiable-link" href="#gnutls_005fearly_005fprf_005fhash_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fearly_005fprf_005fhash_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fearly_005fprf_005fhash_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_digest_algorithm_t</code> <strong class="def-name">gnutls_early_prf_hash_get</strong> <code class="def-code-arguments">(const gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fearly_005fprf_005fhash_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the hash algorithm used as a PRF to derive keys for encrypting
early data in TLS 1.3.
</p>
<p><strong class="strong">Returns:</strong> the hash algorithm used for early data, a
<code class="code">gnutls_digest_algorithm_t</code> value.
</p>
<p><strong class="strong">Since:</strong> 3.7.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005fget-1"><span>gnutls_ecc_curve_get<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_ecc_curve_t</code> <strong class="def-name">gnutls_ecc_curve_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns the currently used elliptic curve for key exchange. Only valid
when using an elliptic curve ciphersuite.
</p>
<p><strong class="strong">Returns:</strong> the currently used curve, a <code class="code">gnutls_ecc_curve_t</code>
type.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005fget_005fid-1"><span>gnutls_ecc_curve_get_id<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_ecc_curve_t</code> <strong class="def-name">gnutls_ecc_curve_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a curve name
</p>
<p>The names are compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_ecc_curve_t</code> value corresponding to
the specified curve, or <code class="code">GNUTLS_ECC_CURVE_INVALID</code> on error.
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005fget_005fname-1"><span>gnutls_ecc_curve_get_name<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_ecc_curve_get_name</strong> <code class="def-code-arguments">(gnutls_ecc_curve_t <var class="var">curve</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">curve</var>: is an ECC curve
</p>
<p>Convert a <code class="code">gnutls_ecc_curve_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified
curve or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005fget_005foid-1"><span>gnutls_ecc_curve_get_oid<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005fget_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005fget_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005fget_005foid"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_ecc_curve_get_oid</strong> <code class="def-code-arguments">(gnutls_ecc_curve_t <var class="var">curve</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005fget_005foid"> ¶</a></span></dt>
<dd><p><var class="var">curve</var>: is an ECC curve
</p>
<p>Convert a <code class="code">gnutls_ecc_curve_t</code> value to its object identifier.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the OID of the specified
curve or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005fget_005fpk-1"><span>gnutls_ecc_curve_get_pk<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005fget_005fpk-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005fget_005fpk"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005fget_005fpk"><span class="category-def">Function: </span><span><code class="def-type">gnutls_pk_algorithm_t</code> <strong class="def-name">gnutls_ecc_curve_get_pk</strong> <code class="def-code-arguments">(gnutls_ecc_curve_t <var class="var">curve</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005fget_005fpk"> ¶</a></span></dt>
<dd><p><var class="var">curve</var>: is an ECC curve
</p>
<p><strong class="strong">Returns:</strong> the public key algorithm associated with the named curve or <code class="code">GNUTLS_PK_UNKNOWN</code> .
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005fget_005fsize-1"><span>gnutls_ecc_curve_get_size<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005fget_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005fget_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005fget_005fsize"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ecc_curve_get_size</strong> <code class="def-code-arguments">(gnutls_ecc_curve_t <var class="var">curve</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005fget_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">curve</var>: is an ECC curve
</p>
<p><strong class="strong">Returns:</strong> the size in bytes of the curve or 0 on failure.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005flist-1"><span>gnutls_ecc_curve_list<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_ecc_curve_t *</code> <strong class="def-name">gnutls_ecc_curve_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005flist"> ¶</a></span></dt>
<dd>
<p>Get the list of supported elliptic curves.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> Return a (0)-terminated list of <code class="code">gnutls_ecc_curve_t</code>
integers indicating the available curves.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fecc_005fcurve_005fset_005fenabled-1"><span>gnutls_ecc_curve_set_enabled<a class="copiable-link" href="#gnutls_005fecc_005fcurve_005fset_005fenabled-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fecc_005fcurve_005fset_005fenabled"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fecc_005fcurve_005fset_005fenabled"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ecc_curve_set_enabled</strong> <code class="def-code-arguments">(gnutls_ecc_curve_t <var class="var">curve</var>, unsigned int <var class="var">enabled</var>)</code><a class="copiable-link" href="#index-gnutls_005fecc_005fcurve_005fset_005fenabled"> ¶</a></span></dt>
<dd><p><var class="var">curve</var>: is an ECC curve
</p>
<p><var class="var">enabled</var>: whether to enable the curve
</p>
<p>Modify the previous system wide setting that marked <code class="code">curve</code> as
enabled or disabled. Calling this function is allowed
only if allowlisting mode is set in the configuration file,
and only if the system-wide TLS priority string
has not been initialized yet.
The intended usage is to provide applications with a way
to expressly deviate from the distribution or site defaults
inherited from the configuration file.
The modification is composable with further modifications
performed through the priority string mechanism.
</p>
<p>This function is not thread-safe and is intended to be called
in the main thread at the beginning of the process execution.
</p>
<p><strong class="strong">Returns:</strong> 0 on success or negative error code otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ferror_005fis_005ffatal-1"><span>gnutls_error_is_fatal<a class="copiable-link" href="#gnutls_005ferror_005fis_005ffatal-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ferror_005fis_005ffatal"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ferror_005fis_005ffatal-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_error_is_fatal</strong> <code class="def-code-arguments">(int <var class="var">error</var>)</code><a class="copiable-link" href="#index-gnutls_005ferror_005fis_005ffatal-1"> ¶</a></span></dt>
<dd><p><var class="var">error</var>: is a GnuTLS error code, a negative error code
</p>
<p>If a GnuTLS function returns a negative error code you may feed that
value to this function to see if the error condition is fatal to
a TLS session (i.e., must be terminated).
</p>
<p>Note that you may also want to check the error code manually, since some
non-fatal errors to the protocol (such as a warning alert or
a rehandshake request) may be fatal for your program.
</p>
<p>This function is only useful if you are dealing with errors from
functions that relate to a TLS session (e.g., record layer or handshake
layer handling functions).
</p>
<p><strong class="strong">Returns:</strong> Non-zero value on fatal errors or zero on non-fatal.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ferror_005fto_005falert-1"><span>gnutls_error_to_alert<a class="copiable-link" href="#gnutls_005ferror_005fto_005falert-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ferror_005fto_005falert"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ferror_005fto_005falert-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_error_to_alert</strong> <code class="def-code-arguments">(int <var class="var">err</var>, int * <var class="var">level</var>)</code><a class="copiable-link" href="#index-gnutls_005ferror_005fto_005falert-1"> ¶</a></span></dt>
<dd><p><var class="var">err</var>: is a negative integer
</p>
<p><var class="var">level</var>: the alert level will be stored there
</p>
<p>Get an alert depending on the error code returned by a gnutls
function. All alerts sent by this function should be considered
fatal. The only exception is when <code class="code">err</code> is <code class="code">GNUTLS_E_REHANDSHAKE</code> ,
where a warning alert should be sent to the peer indicating that no
renegotiation will be performed.
</p>
<p>If there is no mapping to a valid alert the alert to indicate
internal error (<code class="code">GNUTLS_A_INTERNAL_ERROR</code> ) is returned.
</p>
<p><strong class="strong">Returns:</strong> the alert code to use for a particular error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fest_005frecord_005foverhead_005fsize-1"><span>gnutls_est_record_overhead_size<a class="copiable-link" href="#gnutls_005fest_005frecord_005foverhead_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fest_005frecord_005foverhead_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fest_005frecord_005foverhead_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_est_record_overhead_size</strong> <code class="def-code-arguments">(gnutls_protocol_t <var class="var">version</var>, gnutls_cipher_algorithm_t <var class="var">cipher</var>, gnutls_mac_algorithm_t <var class="var">mac</var>, gnutls_compression_method_t <var class="var">comp</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fest_005frecord_005foverhead_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">version</var>: is a <code class="code">gnutls_protocol_t</code> value
</p>
<p><var class="var">cipher</var>: is a <code class="code">gnutls_cipher_algorithm_t</code> value
</p>
<p><var class="var">mac</var>: is a <code class="code">gnutls_mac_algorithm_t</code> value
</p>
<p><var class="var">comp</var>: is a <code class="code">gnutls_compression_method_t</code> value (ignored)
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return the set size in bytes of the overhead
due to TLS (or DTLS) per record.
</p>
<p>Note that this function may provide inaccurate values when TLS
extensions that modify the record format are negotiated. In these
cases a more accurate value can be obtained using <code class="code">gnutls_record_overhead_size()</code>
after a completed handshake.
</p>
<p><strong class="strong">Since:</strong> 3.2.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fext_005fget_005fcurrent_005fmsg-1"><span>gnutls_ext_get_current_msg<a class="copiable-link" href="#gnutls_005fext_005fget_005fcurrent_005fmsg-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fext_005fget_005fcurrent_005fmsg"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fext_005fget_005fcurrent_005fmsg"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_ext_get_current_msg</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fext_005fget_005fcurrent_005fmsg"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: a <code class="code">gnutls_session_t</code> opaque pointer
</p>
<p>This function allows an extension handler to obtain the message
this extension is being called from. The returned value is a single
entry of the <code class="code">gnutls_ext_flags_t</code> enumeration. That is, if an
extension was registered with the <code class="code">GNUTLS_EXT_FLAG_HRR</code> and
<code class="code">GNUTLS_EXT_FLAG_EE</code> flags, the value when called during parsing of the
encrypted extensions message will be <code class="code">GNUTLS_EXT_FLAG_EE</code> .
</p>
<p>If not called under an extension handler, its value is undefined.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fext_005fget_005fdata-1"><span>gnutls_ext_get_data<a class="copiable-link" href="#gnutls_005fext_005fget_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fext_005fget_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fext_005fget_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ext_get_data</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">tls_id</var>, gnutls_ext_priv_data_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fext_005fget_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: a <code class="code">gnutls_session_t</code> opaque pointer
</p>
<p><var class="var">tls_id</var>: the numeric id of the extension
</p>
<p><var class="var">data</var>: a pointer to the private data to retrieve
</p>
<p>This function retrieves any data previously stored with <code class="code">gnutls_ext_set_data()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fext_005fget_005fname-1"><span>gnutls_ext_get_name<a class="copiable-link" href="#gnutls_005fext_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fext_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fext_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_ext_get_name</strong> <code class="def-code-arguments">(unsigned int <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fext_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: is a TLS extension numeric ID
</p>
<p>Convert a TLS extension numeric ID to a printable string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the name of the
specified cipher, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fext_005fget_005fname2-1"><span>gnutls_ext_get_name2<a class="copiable-link" href="#gnutls_005fext_005fget_005fname2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fext_005fget_005fname2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fext_005fget_005fname2"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_ext_get_name2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">tls_id</var>, gnutls_ext_parse_type_t <var class="var">parse_point</var>)</code><a class="copiable-link" href="#index-gnutls_005fext_005fget_005fname2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: a <code class="code">gnutls_session_t</code> opaque pointer
</p>
<p><var class="var">tls_id</var>: is a TLS extension numeric ID
</p>
<p><var class="var">parse_point</var>: the parse type of the extension
</p>
<p>Convert a TLS extension numeric ID to a printable string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the name of the
specified cipher, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fext_005fraw_005fparse-1"><span>gnutls_ext_raw_parse<a class="copiable-link" href="#gnutls_005fext_005fraw_005fparse-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fext_005fraw_005fparse"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fext_005fraw_005fparse"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ext_raw_parse</strong> <code class="def-code-arguments">(void * <var class="var">ctx</var>, gnutls_ext_raw_process_func <var class="var">cb</var>, const gnutls_datum_t * <var class="var">data</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fext_005fraw_005fparse"> ¶</a></span></dt>
<dd><p><var class="var">ctx</var>: a pointer to pass to callback function
</p>
<p><var class="var">cb</var>: callback function to process each extension found
</p>
<p><var class="var">data</var>: TLS extension data
</p>
<p><var class="var">flags</var>: should be zero or <code class="code">GNUTLS_EXT_RAW_FLAG_TLS_CLIENT_HELLO</code> or <code class="code">GNUTLS_EXT_RAW_FLAG_DTLS_CLIENT_HELLO</code>
</p>
<p>This function iterates through the TLS extensions as passed in
<code class="code">data</code> , passing the individual extension data to callback. The
<code class="code">data</code> must conform to Extension extensions<0..2^16-1> format.
</p>
<p>If flags is <code class="code">GNUTLS_EXT_RAW_TLS_FLAG_CLIENT_HELLO</code> then this function
will parse the extension data from the position, as if the packet in
<code class="code">data</code> is a client hello (without record or handshake headers) -
as provided by <code class="code">gnutls_handshake_set_hook_function()</code> .
</p>
<p>The return value of the callback will be propagated.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code. On unknown
flags it returns <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fext_005fregister-1"><span>gnutls_ext_register<a class="copiable-link" href="#gnutls_005fext_005fregister-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fext_005fregister"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fext_005fregister"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ext_register</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>, int <var class="var">id</var>, gnutls_ext_parse_type_t <var class="var">parse_point</var>, gnutls_ext_recv_func <var class="var">recv_func</var>, gnutls_ext_send_func <var class="var">send_func</var>, gnutls_ext_deinit_data_func <var class="var">deinit_func</var>, gnutls_ext_pack_func <var class="var">pack_func</var>, gnutls_ext_unpack_func <var class="var">unpack_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fext_005fregister"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: the name of the extension to register
</p>
<p><var class="var">id</var>: the numeric TLS id of the extension
</p>
<p><var class="var">parse_point</var>: the parse type of the extension (see gnutls_ext_parse_type_t)
</p>
<p><var class="var">recv_func</var>: a function to receive the data
</p>
<p><var class="var">send_func</var>: a function to send the data
</p>
<p><var class="var">deinit_func</var>: a function deinitialize any private data
</p>
<p><var class="var">pack_func</var>: a function which serializes the extension’s private data (used on session packing for resumption)
</p>
<p><var class="var">unpack_func</var>: a function which will deserialize the extension’s private data
</p>
<p>This function will register a new extension type. The extension will remain
registered until <code class="code">gnutls_global_deinit()</code> is called. If the extension type
is already registered then <code class="code">GNUTLS_E_ALREADY_REGISTERED</code> will be returned.
</p>
<p>Each registered extension can store temporary data into the gnutls_session_t
structure using <code class="code">gnutls_ext_set_data()</code> , and they can be retrieved using
<code class="code">gnutls_ext_get_data()</code> .
</p>
<p>Any extensions registered with this function are valid for the client
and TLS1.2 server hello (or encrypted extensions for TLS1.3).
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fext_005fset_005fdata-1"><span>gnutls_ext_set_data<a class="copiable-link" href="#gnutls_005fext_005fset_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fext_005fset_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fext_005fset_005fdata"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_ext_set_data</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">tls_id</var>, gnutls_ext_priv_data_t <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fext_005fset_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: a <code class="code">gnutls_session_t</code> opaque pointer
</p>
<p><var class="var">tls_id</var>: the numeric id of the extension
</p>
<p><var class="var">data</var>: the private data to set
</p>
<p>This function allows an extension handler to store data in the current session
and retrieve them later on. The set data will be deallocated using
the gnutls_ext_deinit_data_func.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffingerprint-1"><span>gnutls_fingerprint<a class="copiable-link" href="#gnutls_005ffingerprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffingerprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffingerprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_fingerprint</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">algo</var>, const gnutls_datum_t * <var class="var">data</var>, void * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005ffingerprint"> ¶</a></span></dt>
<dd><p><var class="var">algo</var>: is a digest algorithm
</p>
<p><var class="var">data</var>: is the data
</p>
<p><var class="var">result</var>: is the place where the result will be copied (may be null).
</p>
<p><var class="var">result_size</var>: should hold the size of the result. The actual size
of the returned result will also be copied there.
</p>
<p>This function will calculate a fingerprint (actually a hash), of
the given data. The result is not printable data. You should
convert it to hex, or to something else printable.
</p>
<p>This is the usual way to calculate a fingerprint of an X.509 DER
encoded certificate. Note however that the fingerprint of an
OpenPGP certificate is not just a hash and cannot be calculated with this
function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005fcontext_005fdeinit-1"><span>gnutls_fips140_context_deinit<a class="copiable-link" href="#gnutls_005ffips140_005fcontext_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005fcontext_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fcontext_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_fips140_context_deinit</strong> <code class="def-code-arguments">(gnutls_fips140_context_t <var class="var">context</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fcontext_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">context</var>: a <code class="code">gnutls_fips140_context_t</code>
</p>
<p>Uninitialize and release the FIPS context <code class="code">context</code> .
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005fcontext_005finit-1"><span>gnutls_fips140_context_init<a class="copiable-link" href="#gnutls_005ffips140_005fcontext_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005fcontext_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fcontext_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_fips140_context_init</strong> <code class="def-code-arguments">(gnutls_fips140_context_t * <var class="var">context</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fcontext_005finit"> ¶</a></span></dt>
<dd><p><var class="var">context</var>: location to store <code class="code">gnutls_fips140_context_t</code>
</p>
<p>Create and initialize the FIPS context object.
</p>
<p><strong class="strong">Returns:</strong> 0 upon success, a negative error code otherwise
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005fget_005foperation_005fstate-1"><span>gnutls_fips140_get_operation_state<a class="copiable-link" href="#gnutls_005ffips140_005fget_005foperation_005fstate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005fget_005foperation_005fstate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fget_005foperation_005fstate-1"><span class="category-def">Function: </span><span><code class="def-type">gnutls_fips140_operation_state_t</code> <strong class="def-name">gnutls_fips140_get_operation_state</strong> <code class="def-code-arguments">(gnutls_fips140_context_t <var class="var">context</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fget_005foperation_005fstate-1"> ¶</a></span></dt>
<dd><p><var class="var">context</var>: a <code class="code">gnutls_fips140_context_t</code>
</p>
<p>Get the previous operation state of <code class="code">context</code> in terms of FIPS.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_fips140_operation_state_t</code>
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005fmode_005fenabled-1"><span>gnutls_fips140_mode_enabled<a class="copiable-link" href="#gnutls_005ffips140_005fmode_005fenabled-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005fmode_005fenabled"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fmode_005fenabled"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_fips140_mode_enabled</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fmode_005fenabled"> ¶</a></span></dt>
<dd>
<p>Checks whether this library is in FIPS140 mode. The returned
value corresponds to the library mode as set with
<code class="code">gnutls_fips140_set_mode()</code> .
</p>
<p>If <code class="code">gnutls_fips140_set_mode()</code> was called with <code class="code">GNUTLS_FIPS140_SET_MODE_THREAD</code>
then this function will return the current thread’s FIPS140 mode, otherwise
the global value is returned.
</p>
<p><strong class="strong">Returns:</strong> return non-zero if true or zero if false.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005fpop_005fcontext-1"><span>gnutls_fips140_pop_context<a class="copiable-link" href="#gnutls_005ffips140_005fpop_005fcontext-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005fpop_005fcontext"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fpop_005fcontext"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_fips140_pop_context</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fpop_005fcontext"> ¶</a></span></dt>
<dd>
<p>Dissociate the FIPS context currently
active on the current thread, reverting to the previously active
context. If a cryptographic operation is ongoing in the current
thread, e.g., <code class="code">gnutls_aead_cipher_init()</code> is called but
<code class="code">gnutls_aead_cipher_deinit()</code> is not yet called, it returns an error
<code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p>This function is no-op if FIPS140 is not compiled in nor enabled
at run-time.
</p>
<p><strong class="strong">Returns:</strong> 0 upon success, a negative error code otherwise
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005fpush_005fcontext-1"><span>gnutls_fips140_push_context<a class="copiable-link" href="#gnutls_005ffips140_005fpush_005fcontext-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005fpush_005fcontext"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fpush_005fcontext"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_fips140_push_context</strong> <code class="def-code-arguments">(gnutls_fips140_context_t <var class="var">context</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fpush_005fcontext"> ¶</a></span></dt>
<dd><p><var class="var">context</var>: a <code class="code">gnutls_fips140_context_t</code>
</p>
<p>Associate the FIPS <code class="code">context</code> to the current thread, diverting the
currently active context. If a cryptographic operation is ongoing
in the current thread, e.g., <code class="code">gnutls_aead_cipher_init()</code> is called
but <code class="code">gnutls_aead_cipher_deinit()</code> is not yet called, it returns an
error <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p>The operation state of <code class="code">context</code> will be reset to
<code class="code">GNUTLS_FIPS140_OP_INITIAL</code> .
</p>
<p>This function is no-op if FIPS140 is not compiled in nor enabled
at run-time.
</p>
<p><strong class="strong">Returns:</strong> 0 upon success, a negative error code otherwise
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005frun_005fself_005ftests-1"><span>gnutls_fips140_run_self_tests<a class="copiable-link" href="#gnutls_005ffips140_005frun_005fself_005ftests-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005frun_005fself_005ftests"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005frun_005fself_005ftests"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_fips140_run_self_tests</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005frun_005fself_005ftests"> ¶</a></span></dt>
<dd>
<p>Manually perform the second round of the FIPS140 self-tests,
including:
</p>
<p>- Known answer tests (KAT) for the selected set of symmetric
cipher, MAC, public key, KDF, and DRBG
- Library integrity checks
</p>
<p>Upon failure with FIPS140 mode enabled, it makes the library
unusable. This function is not thread-safe.
</p>
<p><strong class="strong">Returns:</strong> 0 upon success, a negative error code otherwise
</p>
<p><strong class="strong">Since:</strong> 3.7.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ffips140_005fset_005fmode-1"><span>gnutls_fips140_set_mode<a class="copiable-link" href="#gnutls_005ffips140_005fset_005fmode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ffips140_005fset_005fmode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ffips140_005fset_005fmode"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_fips140_set_mode</strong> <code class="def-code-arguments">(gnutls_fips_mode_t <var class="var">mode</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005ffips140_005fset_005fmode"> ¶</a></span></dt>
<dd><p><var class="var">mode</var>: the FIPS140-2 mode to switch to
</p>
<p><var class="var">flags</var>: should be zero or <code class="code">GNUTLS_FIPS140_SET_MODE_THREAD</code>
</p>
<p>That function is not thread-safe when changing the mode with no flags
(globally), and should be called prior to creating any threads. Its
behavior with no flags after threads are created is undefined.
</p>
<p>When the flag <code class="code">GNUTLS_FIPS140_SET_MODE_THREAD</code> is specified
then this call will change the FIPS140-2 mode for this particular
thread and not for the whole process. That way an application
can utilize this function to set and reset mode for specific
operations.
</p>
<p>This function never fails but will be a no-op if used when
the library is not in FIPS140-2 mode. When asked to switch to unknown
values for <code class="code">mode</code> or to <code class="code">GNUTLS_FIPS140_SELFTESTS</code> mode, the library
switches to <code class="code">GNUTLS_FIPS140_STRICT</code> mode.
</p>
<p><strong class="strong">Since:</strong> 3.6.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fget_005flibrary_005fconfig-1"><span>gnutls_get_library_config<a class="copiable-link" href="#gnutls_005fget_005flibrary_005fconfig-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fget_005flibrary_005fconfig"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fget_005flibrary_005fconfig"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_library_config_st *</code> <strong class="def-name">gnutls_get_library_config</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fget_005flibrary_005fconfig"> ¶</a></span></dt>
<dd>
<p>Returns the library configuration as key value pairs.
Currently defined keys are:
</p>
<p>- fips-module-name: the name of the FIPS140 module
</p>
<p>- fips-module-version: the version of the FIPS140 module
</p>
<p>- libgnutls-soname: the SONAME of the library itself
</p>
<p>- libnettle-soname: the library SONAME of linked libnettle
</p>
<p>- libhogweed-soname: the library SONAME of linked libhogweed
</p>
<p>- libgmp-soname: the library SONAME of linked libgmp
</p>
<p>- hardware-features: enabled hardware support features
</p>
<p>- tls-features: enabled TLS protocol features
</p>
<p><strong class="strong">Returns:</strong> a NUL-terminated <code class="code">gnutls_library_config_st</code> array
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fget_005fsystem_005fconfig_005ffile-1"><span>gnutls_get_system_config_file<a class="copiable-link" href="#gnutls_005fget_005fsystem_005fconfig_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fget_005fsystem_005fconfig_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fget_005fsystem_005fconfig_005ffile-1"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_get_system_config_file</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fget_005fsystem_005fconfig_005ffile-1"> ¶</a></span></dt>
<dd>
<p>Returns the filename of the system wide configuration
file to be loaded by the library.
</p>
<p><strong class="strong">Returns:</strong> a constant pointer to the config file path
</p>
<p><strong class="strong">Since:</strong> 3.6.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005fdeinit-1"><span>gnutls_global_deinit<a class="copiable-link" href="#gnutls_005fglobal_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_deinit</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fdeinit"> ¶</a></span></dt>
<dd>
<p>This function deinitializes the global data, that were initialized
using <code class="code">gnutls_global_init()</code> .
</p>
<p>Since GnuTLS 3.3.0 this function is no longer necessary to be explicitly
called. GnuTLS will automatically deinitialize on library destructor. See
<code class="code">gnutls_global_init()</code> for disabling the implicit initialization/deinitialization.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005finit-1"><span>gnutls_global_init<a class="copiable-link" href="#gnutls_005fglobal_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_global_init</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005finit"> ¶</a></span></dt>
<dd>
<p>Since GnuTLS 3.3.0 this function is no longer necessary to be explicitly
called. To disable the implicit call (in a library constructor) of this
function set the environment variable <code class="code">GNUTLS_NO_IMPLICIT_INIT</code> to 1.
</p>
<p>This function performs any required precalculations, detects
the supported CPU capabilities and initializes the underlying
cryptographic backend. In order to free any resources
taken by this call you should <code class="code">gnutls_global_deinit()</code>
when gnutls usage is no longer needed.
</p>
<p>This function increments a global counter, so that
<code class="code">gnutls_global_deinit()</code> only releases resources when it has been
called as many times as <code class="code">gnutls_global_init()</code> . This is useful when
GnuTLS is used by more than one library in an application. This
function can be called many times, but will only do something the
first time. It is thread safe since GnuTLS 3.3.0.
</p>
<p>A subsequent call of this function if the initial has failed will
return the same error code.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005fset_005faudit_005flog_005ffunction-1"><span>gnutls_global_set_audit_log_function<a class="copiable-link" href="#gnutls_005fglobal_005fset_005faudit_005flog_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005fset_005faudit_005flog_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fset_005faudit_005flog_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_set_audit_log_function</strong> <code class="def-code-arguments">(gnutls_audit_log_func <var class="var">log_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fset_005faudit_005flog_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">log_func</var>: it is the audit log function
</p>
<p>This is the function to set the audit logging function. This
is a function to report important issues, such as possible
attacks in the protocol. This is different from <code class="code">gnutls_global_set_log_function()</code>
because it will report also session-specific events. The session
parameter will be null if there is no corresponding TLS session.
</p>
<p><code class="code">gnutls_audit_log_func</code> is of the form,
void (*gnutls_audit_log_func)( gnutls_session_t, const char*);
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005fset_005flog_005ffunction-1"><span>gnutls_global_set_log_function<a class="copiable-link" href="#gnutls_005fglobal_005fset_005flog_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005fset_005flog_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fset_005flog_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_set_log_function</strong> <code class="def-code-arguments">(gnutls_log_func <var class="var">log_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fset_005flog_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">log_func</var>: it’s a log function
</p>
<p>This is the function where you set the logging function gnutls is
going to use. This function only accepts a character array.
Normally you may not use this function since it is only used for
debugging purposes.
</p>
<p><code class="code">gnutls_log_func</code> is of the form,
void (*gnutls_log_func)( int level, const char*);
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005fset_005flog_005flevel-1"><span>gnutls_global_set_log_level<a class="copiable-link" href="#gnutls_005fglobal_005fset_005flog_005flevel-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005fset_005flog_005flevel"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fset_005flog_005flevel"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_set_log_level</strong> <code class="def-code-arguments">(int <var class="var">level</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fset_005flog_005flevel"> ¶</a></span></dt>
<dd><p><var class="var">level</var>: it’s an integer from 0 to 99.
</p>
<p>This is the function that allows you to set the log level. The
level is an integer between 0 and 9. Higher values mean more
verbosity. The default value is 0. Larger values should only be
used with care, since they may reveal sensitive information.
</p>
<p>Use a log level over 10 to enable all debugging options.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005fset_005fmutex-1"><span>gnutls_global_set_mutex<a class="copiable-link" href="#gnutls_005fglobal_005fset_005fmutex-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005fset_005fmutex"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fset_005fmutex"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_set_mutex</strong> <code class="def-code-arguments">(mutex_init_func <var class="var">init</var>, mutex_deinit_func <var class="var">deinit</var>, mutex_lock_func <var class="var">lock</var>, mutex_unlock_func <var class="var">unlock</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fset_005fmutex"> ¶</a></span></dt>
<dd><p><var class="var">init</var>: mutex initialization function
</p>
<p><var class="var">deinit</var>: mutex deinitialization function
</p>
<p><var class="var">lock</var>: mutex locking function
</p>
<p><var class="var">unlock</var>: mutex unlocking function
</p>
<p>With this function you are allowed to override the default mutex
locks used in some parts of gnutls and dependent libraries. This function
should be used if you have complete control of your program and libraries.
Do not call this function from a library, or preferably from any application
unless really needed to. GnuTLS will use the appropriate locks for the running
system.
</p>
<p>This function must be called prior to any other GnuTLS function; otherwise
the behavior is undefined.
</p>
<p><strong class="strong">Deprecated:</strong> This function is discouraged on GnuTLS 3.7.3 or later.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005fset_005ftime_005ffunction-1"><span>gnutls_global_set_time_function<a class="copiable-link" href="#gnutls_005fglobal_005fset_005ftime_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005fset_005ftime_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fset_005ftime_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_set_time_function</strong> <code class="def-code-arguments">(gnutls_time_func <var class="var">time_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fset_005ftime_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">time_func</var>: it’s the system time function, a <code class="code">gnutls_time_func()</code> callback.
</p>
<p>This is the function where you can override the default system time
function. The application provided function should behave the same
as the standard function.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fgost_005fparamset_005fget_005fname-1"><span>gnutls_gost_paramset_get_name<a class="copiable-link" href="#gnutls_005fgost_005fparamset_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fgost_005fparamset_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fgost_005fparamset_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_gost_paramset_get_name</strong> <code class="def-code-arguments">(gnutls_gost_paramset_t <var class="var">param</var>)</code><a class="copiable-link" href="#index-gnutls_005fgost_005fparamset_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">param</var>: is a GOST 28147 param set
</p>
<p>Convert a <code class="code">gnutls_gost_paramset_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified GOST param set,
or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fgost_005fparamset_005fget_005foid-1"><span>gnutls_gost_paramset_get_oid<a class="copiable-link" href="#gnutls_005fgost_005fparamset_005fget_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fgost_005fparamset_005fget_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fgost_005fparamset_005fget_005foid"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_gost_paramset_get_oid</strong> <code class="def-code-arguments">(gnutls_gost_paramset_t <var class="var">param</var>)</code><a class="copiable-link" href="#index-gnutls_005fgost_005fparamset_005fget_005foid"> ¶</a></span></dt>
<dd><p><var class="var">param</var>: is a GOST 28147 param set
</p>
<p>Convert a <code class="code">gnutls_gost_paramset_t</code> value to its object identifier.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the object identifier of the specified GOST
param set, or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fgroup_005fget-1"><span>gnutls_group_get<a class="copiable-link" href="#gnutls_005fgroup_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fgroup_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fgroup_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_group_t</code> <strong class="def-name">gnutls_group_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fgroup_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns the currently used group for key exchange. Only valid
when using an elliptic curve or DH ciphersuite.
</p>
<p><strong class="strong">Returns:</strong> the currently used group, a <code class="code">gnutls_group_t</code>
type.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fgroup_005fget_005fid-1"><span>gnutls_group_get_id<a class="copiable-link" href="#gnutls_005fgroup_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fgroup_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fgroup_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_group_t</code> <strong class="def-name">gnutls_group_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fgroup_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a group name
</p>
<p>The names are compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_group_t</code> value corresponding to
the specified group, or <code class="code">GNUTLS_GROUP_INVALID</code> on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fgroup_005fget_005fname-1"><span>gnutls_group_get_name<a class="copiable-link" href="#gnutls_005fgroup_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fgroup_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fgroup_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_group_get_name</strong> <code class="def-code-arguments">(gnutls_group_t <var class="var">group</var>)</code><a class="copiable-link" href="#index-gnutls_005fgroup_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">group</var>: is an element from <code class="code">gnutls_group_t</code>
</p>
<p>Convert a <code class="code">gnutls_group_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified
group or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fgroup_005flist-1"><span>gnutls_group_list<a class="copiable-link" href="#gnutls_005fgroup_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fgroup_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fgroup_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_group_t *</code> <strong class="def-name">gnutls_group_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fgroup_005flist"> ¶</a></span></dt>
<dd>
<p>Get the list of supported elliptic curves.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> Return a (0)-terminated list of <code class="code">gnutls_group_t</code>
integers indicating the available groups.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake-1"><span>gnutls_handshake<a class="copiable-link" href="#gnutls_005fhandshake-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_handshake</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function performs the handshake of the TLS/SSL protocol, and
initializes the TLS session parameters.
</p>
<p>The non-fatal errors expected by this function are:
<code class="code">GNUTLS_E_INTERRUPTED</code> , <code class="code">GNUTLS_E_AGAIN</code> ,
<code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code> . When this function is called
for re-handshake under TLS 1.2 or earlier, the non-fatal error code
<code class="code">GNUTLS_E_GOT_APPLICATION_DATA</code> may also be returned.
</p>
<p>The former two interrupt the handshake procedure due to the transport
layer being interrupted, and the latter because of a "warning" alert that
was sent by the peer (it is always a good idea to check any
received alerts). On these non-fatal errors call this function again,
until it returns 0; cf. <code class="code">gnutls_record_get_direction()</code> and
<code class="code">gnutls_error_is_fatal()</code> . In DTLS sessions the non-fatal error
<code class="code">GNUTLS_E_LARGE_PACKET</code> is also possible, and indicates that
the MTU should be adjusted.
</p>
<p>When this function is called by a server after a rehandshake request
under TLS 1.2 or earlier the <code class="code">GNUTLS_E_GOT_APPLICATION_DATA</code> error code indicates
that some data were pending prior to peer initiating the handshake.
Under TLS 1.3 this function when called after a successful handshake, is a no-op
and always succeeds in server side; in client side this function is
equivalent to <code class="code">gnutls_session_key_update()</code> with <code class="code">GNUTLS_KU_PEER</code> flag.
</p>
<p>This function handles both full and abbreviated TLS handshakes (resumption).
For abbreviated handshakes, in client side, the <code class="code">gnutls_session_set_data()</code>
should be called prior to this function to set parameters from a previous session.
In server side, resumption is handled by either setting a DB back-end, or setting
up keys for session tickets.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on a successful handshake, otherwise a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fdescription_005fget_005fname-1"><span>gnutls_handshake_description_get_name<a class="copiable-link" href="#gnutls_005fhandshake_005fdescription_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fdescription_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fdescription_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_handshake_description_get_name</strong> <code class="def-code-arguments">(gnutls_handshake_description_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fdescription_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">type</var>: is a handshake message description
</p>
<p>Convert a <code class="code">gnutls_handshake_description_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified handshake
message or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fget_005flast_005fin-1"><span>gnutls_handshake_get_last_in<a class="copiable-link" href="#gnutls_005fhandshake_005fget_005flast_005fin-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fget_005flast_005fin"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fget_005flast_005fin"><span class="category-def">Function: </span><span><code class="def-type">gnutls_handshake_description_t</code> <strong class="def-name">gnutls_handshake_get_last_in</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fget_005flast_005fin"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function is only useful to check where the last performed
handshake failed. If the previous handshake succeed or was not
performed at all then no meaningful value will be returned.
</p>
<p>Check <code class="code">gnutls_handshake_description_t</code> in gnutls.h for the
available handshake descriptions.
</p>
<p><strong class="strong">Returns:</strong> the last handshake message type received, a
<code class="code">gnutls_handshake_description_t</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fget_005flast_005fout-1"><span>gnutls_handshake_get_last_out<a class="copiable-link" href="#gnutls_005fhandshake_005fget_005flast_005fout-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fget_005flast_005fout"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fget_005flast_005fout"><span class="category-def">Function: </span><span><code class="def-type">gnutls_handshake_description_t</code> <strong class="def-name">gnutls_handshake_get_last_out</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fget_005flast_005fout"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function is only useful to check where the last performed
handshake failed. If the previous handshake succeed or was not
performed at all then no meaningful value will be returned.
</p>
<p>Check <code class="code">gnutls_handshake_description_t</code> in gnutls.h for the
available handshake descriptions.
</p>
<p><strong class="strong">Returns:</strong> the last handshake message type sent, a
<code class="code">gnutls_handshake_description_t</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005fhook_005ffunction-1"><span>gnutls_handshake_set_hook_function<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005fhook_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005fhook_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005fhook_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_hook_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">htype</var>, int <var class="var">when</var>, gnutls_handshake_hook_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005fhook_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">htype</var>: the <code class="code">gnutls_handshake_description_t</code> of the message to hook at
</p>
<p><var class="var">when</var>: <code class="code">GNUTLS_HOOK_</code> * depending on when the hook function should be called
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback to be called after or before the specified
handshake message has been received or generated. This is a
generalization of <code class="code">gnutls_handshake_set_post_client_hello_function()</code> .
</p>
<p>To call the hook function prior to the message being generated or processed
use <code class="code">GNUTLS_HOOK_PRE</code> as <code class="code">when</code> parameter, <code class="code">GNUTLS_HOOK_POST</code> to call
after, and <code class="code">GNUTLS_HOOK_BOTH</code> for both cases.
</p>
<p>This callback must return 0 on success or a gnutls error code to
terminate the handshake.
</p>
<p>To hook at all handshake messages use an <code class="code">htype</code> of <code class="code">GNUTLS_HANDSHAKE_ANY</code> .
</p>
<p><strong class="strong">Warning:</strong> You should not use this function to terminate the
handshake based on client input unless you know what you are
doing. Before the handshake is finished there is no way to know if
there is a man-in-the-middle attack being performed.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005fmax_005fpacket_005flength-1"><span>gnutls_handshake_set_max_packet_length<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005fmax_005fpacket_005flength-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005fmax_005fpacket_005flength"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005fmax_005fpacket_005flength"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_max_packet_length</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">max</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005fmax_005fpacket_005flength"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">max</var>: is the maximum number.
</p>
<p>This function will set the maximum size of all handshake messages.
Handshakes over this size are rejected with
<code class="code">GNUTLS_E_HANDSHAKE_TOO_LARGE</code> error code. The default value is
128kb which is typically large enough. Set this to 0 if you do not
want to set an upper limit.
</p>
<p>The reason for restricting the handshake message sizes are to
limit Denial of Service attacks.
</p>
<p>Note that the maximum handshake size was increased to 128kb
from 48kb in GnuTLS 3.5.5.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005fpost_005fclient_005fhello_005ffunction-1"><span>gnutls_handshake_set_post_client_hello_function<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005fpost_005fclient_005fhello_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005fpost_005fclient_005fhello_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005fpost_005fclient_005fhello_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_post_client_hello_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_handshake_simple_hook_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005fpost_005fclient_005fhello_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback to be called after the client
hello has been received (callback valid in server side only). This
allows the server to adjust settings based on received extensions.
</p>
<p>Those settings could be ciphersuites, requesting certificate, or
anything else except for version negotiation (this is done before
the hello message is parsed).
</p>
<p>This callback must return 0 on success or a gnutls error code to
terminate the handshake.
</p>
<p>Since GnuTLS 3.3.5 the callback is
allowed to return <code class="code">GNUTLS_E_AGAIN</code> or <code class="code">GNUTLS_E_INTERRUPTED</code> to
put the handshake on hold. In that case <code class="code">gnutls_handshake()</code>
will return <code class="code">GNUTLS_E_INTERRUPTED</code> and can be resumed when needed.
</p>
<p><strong class="strong">Warning:</strong> You should not use this function to terminate the
handshake based on client input unless you know what you are
doing. Before the handshake is finished there is no way to know if
there is a man-in-the-middle attack being performed.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005fprivate_005fextensions-1"><span>gnutls_handshake_set_private_extensions<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005fprivate_005fextensions-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005fprivate_005fextensions"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005fprivate_005fextensions"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_private_extensions</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">allow</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005fprivate_005fextensions"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">allow</var>: is an integer (0 or 1)
</p>
<p>This function will enable or disable the use of private cipher
suites (the ones that start with 0xFF). By default or if <code class="code">allow</code> is 0 then these cipher suites will not be advertised nor used.
</p>
<p>Currently GnuTLS does not include such cipher-suites or
compression algorithms.
</p>
<p>Enabling the private ciphersuites when talking to other than
gnutls servers and clients may cause interoperability problems.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005frandom-1"><span>gnutls_handshake_set_random<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005frandom-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005frandom"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005frandom"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_handshake_set_random</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_datum_t * <var class="var">random</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005frandom"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">random</var>: a random value of 32-bytes
</p>
<p>This function will explicitly set the server or client hello
random value in the subsequent TLS handshake. The random value
should be a 32-byte value.
</p>
<p>Note that this function should not normally be used as gnutls
will select automatically a random value for the handshake.
</p>
<p>This function should not be used when resuming a session.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p>Since 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005fread_005ffunction-1"><span>gnutls_handshake_set_read_function<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005fread_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005fread_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005fread_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_read_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_handshake_read_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005fread_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback to be called when a handshake
message is being sent.
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005fsecret_005ffunction-1"><span>gnutls_handshake_set_secret_function<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005fsecret_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005fsecret_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005fsecret_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_secret_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_handshake_secret_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005fsecret_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">func</var>: the secret func
</p>
<p>This function will set a callback to be called when a new traffic
secret is installed.
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fset_005ftimeout-1"><span>gnutls_handshake_set_timeout<a class="copiable-link" href="#gnutls_005fhandshake_005fset_005ftimeout-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fset_005ftimeout"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fset_005ftimeout-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_handshake_set_timeout</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">ms</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fset_005ftimeout-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">ms</var>: is a timeout value in milliseconds
</p>
<p>This function sets the timeout for the TLS handshake process
to the provided value. Use an <code class="code">ms</code> value of zero to disable
timeout, or <code class="code">GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT</code> for a reasonable
default value. For the DTLS protocol, the more detailed
<code class="code">gnutls_dtls_set_timeouts()</code> is provided.
</p>
<p>This function requires to set a pull timeout callback. See
<code class="code">gnutls_transport_set_pull_timeout_function()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fupdate_005freceiving_005fkey-1"><span>gnutls_handshake_update_receiving_key<a class="copiable-link" href="#gnutls_005fhandshake_005fupdate_005freceiving_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fupdate_005freceiving_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fupdate_005freceiving_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_handshake_update_receiving_key</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fupdate_005freceiving_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will update/refresh the session receiving keys when
the TLS protocol is 1.3 or better. Unlike <code class="code">gnutls_session_key_update()</code>
this function does not notify the peer, it will only update
the local keys.
</p>
<p>If the negotiated version is not TLS 1.3 or better this
function will return <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.8.11
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhandshake_005fwrite-1"><span>gnutls_handshake_write<a class="copiable-link" href="#gnutls_005fhandshake_005fwrite-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhandshake_005fwrite"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhandshake_005fwrite"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_handshake_write</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_record_encryption_level_t <var class="var">level</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fhandshake_005fwrite"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">level</var>: the current encryption level for reading a handshake message
</p>
<p><var class="var">data</var>: the (const) handshake data to be processed
</p>
<p><var class="var">data_size</var>: the size of data
</p>
<p>This function processes a handshake message in the encryption level
specified with <code class="code">level</code> . Prior to calling this function, a handshake
read callback must be set on <code class="code">session</code> . Use
<code class="code">gnutls_handshake_set_read_function()</code> to do this.
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fheartbeat_005fallowed-1"><span>gnutls_heartbeat_allowed<a class="copiable-link" href="#gnutls_005fheartbeat_005fallowed-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fheartbeat_005fallowed"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fheartbeat_005fallowed"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_heartbeat_allowed</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fheartbeat_005fallowed"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">type</var>: one of <code class="code">GNUTLS_HB_LOCAL_ALLOWED_TO_SEND</code> and <code class="code">GNUTLS_HB_PEER_ALLOWED_TO_SEND</code>
</p>
<p>This function will check whether heartbeats are allowed
to be sent or received in this session.
</p>
<p><strong class="strong">Returns:</strong> Non zero if heartbeats are allowed.
</p>
<p><strong class="strong">Since:</strong> 3.1.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fheartbeat_005fenable-1"><span>gnutls_heartbeat_enable<a class="copiable-link" href="#gnutls_005fheartbeat_005fenable-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fheartbeat_005fenable"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fheartbeat_005fenable"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_heartbeat_enable</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fheartbeat_005fenable"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">type</var>: one of the GNUTLS_HB_* flags
</p>
<p>If this function is called with the <code class="code">GNUTLS_HB_PEER_ALLOWED_TO_SEND</code>
<code class="code">type</code> , GnuTLS will allow heartbeat messages to be received. Moreover it also
request the peer to accept heartbeat messages. This function
must be called prior to TLS handshake.
</p>
<p>If the <code class="code">type</code> used is <code class="code">GNUTLS_HB_LOCAL_ALLOWED_TO_SEND</code> , then the peer
will be asked to accept heartbeat messages but not send ones.
</p>
<p>The function <code class="code">gnutls_heartbeat_allowed()</code> can be used to test Whether
locally generated heartbeat messages can be accepted by the peer.
</p>
<p><strong class="strong">Since:</strong> 3.1.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fheartbeat_005fget_005ftimeout-1"><span>gnutls_heartbeat_get_timeout<a class="copiable-link" href="#gnutls_005fheartbeat_005fget_005ftimeout-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fheartbeat_005fget_005ftimeout"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fheartbeat_005fget_005ftimeout"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_heartbeat_get_timeout</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fheartbeat_005fget_005ftimeout"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return the milliseconds remaining
for a retransmission of the previously sent ping
message. This function is useful when ping is used in
non-blocking mode, to estimate when to call <code class="code">gnutls_heartbeat_ping()</code>
if no packets have been received.
</p>
<p><strong class="strong">Returns:</strong> the remaining time in milliseconds.
</p>
<p><strong class="strong">Since:</strong> 3.1.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fheartbeat_005fping-1"><span>gnutls_heartbeat_ping<a class="copiable-link" href="#gnutls_005fheartbeat_005fping-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fheartbeat_005fping"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fheartbeat_005fping"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_heartbeat_ping</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">data_size</var>, unsigned int <var class="var">max_tries</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fheartbeat_005fping"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data_size</var>: is the length of the ping payload.
</p>
<p><var class="var">max_tries</var>: if flags is <code class="code">GNUTLS_HEARTBEAT_WAIT</code> then this sets the number of retransmissions. Use zero for indefinite (until timeout).
</p>
<p><var class="var">flags</var>: if <code class="code">GNUTLS_HEARTBEAT_WAIT</code> then wait for pong or timeout instead of returning immediately.
</p>
<p>This function sends a ping to the peer. If the <code class="code">flags</code> is set
to <code class="code">GNUTLS_HEARTBEAT_WAIT</code> then it waits for a reply from the peer.
</p>
<p>Note that it is highly recommended to use this function with the
flag <code class="code">GNUTLS_HEARTBEAT_WAIT</code> , or you need to handle retransmissions
and timeouts manually.
</p>
<p>The total TLS data transmitted as part of the ping message are given by
the following formula: MAX(16, <code class="code">data_size</code> )+<code class="code">gnutls_record_overhead_size()</code> +3.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.1.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fheartbeat_005fpong-1"><span>gnutls_heartbeat_pong<a class="copiable-link" href="#gnutls_005fheartbeat_005fpong-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fheartbeat_005fpong"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fheartbeat_005fpong"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_heartbeat_pong</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fheartbeat_005fpong"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function replies to a ping by sending a pong to the peer.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.1.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fheartbeat_005fset_005ftimeouts-1"><span>gnutls_heartbeat_set_timeouts<a class="copiable-link" href="#gnutls_005fheartbeat_005fset_005ftimeouts-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fheartbeat_005fset_005ftimeouts"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fheartbeat_005fset_005ftimeouts"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_heartbeat_set_timeouts</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">retrans_timeout</var>, unsigned int <var class="var">total_timeout</var>)</code><a class="copiable-link" href="#index-gnutls_005fheartbeat_005fset_005ftimeouts"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">retrans_timeout</var>: The time at which a retransmission will occur in milliseconds
</p>
<p><var class="var">total_timeout</var>: The time at which the connection will be aborted, in milliseconds.
</p>
<p>This function will override the timeouts for the DTLS heartbeat
protocol. The retransmission timeout is the time after which a
message from the peer is not received, the previous request will
be retransmitted. The total timeout is the time after which the
handshake will be aborted with <code class="code">GNUTLS_E_TIMEDOUT</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhex2bin-1"><span>gnutls_hex2bin<a class="copiable-link" href="#gnutls_005fhex2bin-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhex2bin"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhex2bin"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hex2bin</strong> <code class="def-code-arguments">(const char * <var class="var">hex_data</var>, size_t <var class="var">hex_size</var>, void * <var class="var">bin_data</var>, size_t * <var class="var">bin_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fhex2bin"> ¶</a></span></dt>
<dd><p><var class="var">hex_data</var>: string with data in hex format
</p>
<p><var class="var">hex_size</var>: size of hex data
</p>
<p><var class="var">bin_data</var>: output array with binary data
</p>
<p><var class="var">bin_size</var>: when calling should hold maximum size of <code class="code">bin_data</code> ,
on return will hold actual length of <code class="code">bin_data</code> .
</p>
<p>Convert a buffer with hex data to binary data. This function
unlike <code class="code">gnutls_hex_decode()</code> can parse hex data with separators
between numbers. That is, it ignores any non-hex characters.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhex_005fdecode-1"><span>gnutls_hex_decode<a class="copiable-link" href="#gnutls_005fhex_005fdecode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhex_005fdecode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhex_005fdecode"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hex_decode</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">hex_data</var>, void * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fhex_005fdecode"> ¶</a></span></dt>
<dd><p><var class="var">hex_data</var>: contain the encoded data
</p>
<p><var class="var">result</var>: the place where decoded data will be copied
</p>
<p><var class="var">result_size</var>: holds the size of the result
</p>
<p>This function will decode the given encoded data, using the hex
encoding used by PSK password files.
</p>
<p>Initially <code class="code">result_size</code> must hold the maximum size available in
<code class="code">result</code> , and on return it will contain the number of bytes written.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the buffer given is not
long enough, <code class="code">GNUTLS_E_PARSING_ERROR</code> on invalid hex data, or 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhex_005fdecode2-1"><span>gnutls_hex_decode2<a class="copiable-link" href="#gnutls_005fhex_005fdecode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhex_005fdecode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhex_005fdecode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hex_decode2</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">hex_data</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fhex_005fdecode2"> ¶</a></span></dt>
<dd><p><var class="var">hex_data</var>: contain the encoded data
</p>
<p><var class="var">result</var>: the result in an allocated string
</p>
<p>This function will decode the given encoded data, using the hex
encoding used by PSK password files.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_PARSING_ERROR</code> on invalid hex data, or 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhex_005fencode-1"><span>gnutls_hex_encode<a class="copiable-link" href="#gnutls_005fhex_005fencode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhex_005fencode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhex_005fencode"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hex_encode</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">data</var>, char * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fhex_005fencode"> ¶</a></span></dt>
<dd><p><var class="var">data</var>: contain the raw data
</p>
<p><var class="var">result</var>: the place where hex data will be copied
</p>
<p><var class="var">result_size</var>: holds the size of the result
</p>
<p>This function will convert the given data to printable data, using
the hex encoding, as used in the PSK password files.
</p>
<p>Note that the size of the result includes the null terminator.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the buffer given is not
long enough, or 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhex_005fencode2-1"><span>gnutls_hex_encode2<a class="copiable-link" href="#gnutls_005fhex_005fencode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhex_005fencode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhex_005fencode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hex_encode2</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fhex_005fencode2"> ¶</a></span></dt>
<dd><p><var class="var">data</var>: contain the raw data
</p>
<p><var class="var">result</var>: the result in an allocated string
</p>
<p>This function will convert the given data to printable data, using
the hex encoding, as used in the PSK password files.
</p>
<p>Note that the size of the result does NOT include the null terminator.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fidna_005fmap-1"><span>gnutls_idna_map<a class="copiable-link" href="#gnutls_005fidna_005fmap-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fidna_005fmap"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fidna_005fmap"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_idna_map</strong> <code class="def-code-arguments">(const char * <var class="var">input</var>, unsigned <var class="var">ilen</var>, gnutls_datum_t * <var class="var">out</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fidna_005fmap"> ¶</a></span></dt>
<dd><p><var class="var">input</var>: contain the UTF-8 formatted domain name
</p>
<p><var class="var">ilen</var>: the length of the provided string
</p>
<p><var class="var">out</var>: the result in an null-terminated allocated string
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will convert the provided UTF-8 domain name, to
its IDNA mapping in an allocated variable. Note that depending on the flags the used gnutls
library was compiled with, the output of this function may vary (i.e.,
may be IDNA2008, or IDNA2003).
</p>
<p>To force IDNA2008 specify the flag <code class="code">GNUTLS_IDNA_FORCE_2008</code> . In
the case GnuTLS is not compiled with the necessary dependencies,
<code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> will be returned to indicate that
gnutls is unable to perform the requested conversion.
</p>
<p>Note also, that this function will return an empty string if an
empty string is provided as input.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_INVALID_UTF8_STRING</code> on invalid UTF-8 data, or 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.5.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fidna_005freverse_005fmap-1"><span>gnutls_idna_reverse_map<a class="copiable-link" href="#gnutls_005fidna_005freverse_005fmap-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fidna_005freverse_005fmap"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fidna_005freverse_005fmap"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_idna_reverse_map</strong> <code class="def-code-arguments">(const char * <var class="var">input</var>, unsigned <var class="var">ilen</var>, gnutls_datum_t * <var class="var">out</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fidna_005freverse_005fmap"> ¶</a></span></dt>
<dd><p><var class="var">input</var>: contain the ACE (IDNA) formatted domain name
</p>
<p><var class="var">ilen</var>: the length of the provided string
</p>
<p><var class="var">out</var>: the result in an null-terminated allocated UTF-8 string
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will convert an ACE (ASCII-encoded) domain name to a UTF-8 domain name.
</p>
<p>If GnuTLS is compiled without IDNA support, then this function
will return <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p>Note also, that this function will return an empty string if an
empty string is provided as input.
</p>
<p><strong class="strong">Returns:</strong> A negative error code on error, or 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.5.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005finit-1"><span>gnutls_init<a class="copiable-link" href="#gnutls_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005finit-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_init</strong> <code class="def-code-arguments">(gnutls_session_t * <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005finit-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a pointer to a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">flags</var>: indicate if this session is to be used for server or client.
</p>
<p>This function initializes the provided session. Every session must
be initialized before use, and after successful initialization and
use must be deinitialized by calling <code class="code">gnutls_deinit()</code> .
</p>
<p><code class="code">flags</code> can be any combination of flags from <code class="code">gnutls_init_flags_t</code> .
</p>
<p>Note that since version 3.1.2 this function enables some common
TLS extensions such as session tickets and OCSP certificate status
request in client side by default. To prevent that use the <code class="code">GNUTLS_NO_DEFAULT_EXTENSIONS</code>
flag.
</p>
<p>Note that it is never mandatory to use <code class="code">gnutls_deinit()</code> after this
function fails. Since gnutls 3.8.0, it is safe to unconditionally
use <code class="code">gnutls_deinit()</code> even after failure regardless of whether the
memory was initialized prior to <code class="code">gnutls_init()</code> ; however, clients
wanting to be portable to older versions of the library should
either skip deinitialization on failure, or pre-initialize the
memory passed in to <code class="code">gnutls_init()</code> to all zeroes via <code class="code">memset()</code> or
similar.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fkey_005fgenerate-1"><span>gnutls_key_generate<a class="copiable-link" href="#gnutls_005fkey_005fgenerate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fkey_005fgenerate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fkey_005fgenerate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_key_generate</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">key</var>, unsigned int <var class="var">key_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fkey_005fgenerate"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: is a pointer to a <code class="code">gnutls_datum_t</code> which will contain a newly
created key
</p>
<p><var class="var">key_size</var>: the number of bytes of the key
</p>
<p>Generates a random key of <code class="code">key_size</code> bytes.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fkx_005fget-1"><span>gnutls_kx_get<a class="copiable-link" href="#gnutls_005fkx_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fkx_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fkx_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_kx_algorithm_t</code> <strong class="def-name">gnutls_kx_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fkx_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the currently used key exchange algorithm.
</p>
<p>This function will return <code class="code">GNUTLS_KX_ECDHE_RSA</code> , or <code class="code">GNUTLS_KX_DHE_RSA</code>
under TLS 1.3, to indicate an elliptic curve DH key exchange or
a finite field one. The precise group used is available
by calling <code class="code">gnutls_group_get()</code> instead.
</p>
<p><strong class="strong">Returns:</strong> the key exchange algorithm used in the last handshake, a
<code class="code">gnutls_kx_algorithm_t</code> value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fkx_005fget_005fid-1"><span>gnutls_kx_get_id<a class="copiable-link" href="#gnutls_005fkx_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fkx_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fkx_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_kx_algorithm_t</code> <strong class="def-name">gnutls_kx_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fkx_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a KX name
</p>
<p>Convert a string to a <code class="code">gnutls_kx_algorithm_t</code> value. The names are
compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> an id of the specified KX algorithm, or <code class="code">GNUTLS_KX_UNKNOWN</code>
on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fkx_005fget_005fname-1"><span>gnutls_kx_get_name<a class="copiable-link" href="#gnutls_005fkx_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fkx_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fkx_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_kx_get_name</strong> <code class="def-code-arguments">(gnutls_kx_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fkx_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a key exchange algorithm
</p>
<p>Convert a <code class="code">gnutls_kx_algorithm_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the name of the
specified key exchange algorithm, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fkx_005flist-1"><span>gnutls_kx_list<a class="copiable-link" href="#gnutls_005fkx_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fkx_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fkx_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_kx_algorithm_t *</code> <strong class="def-name">gnutls_kx_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fkx_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of supported key exchange algorithms.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> a (0)-terminated list of <code class="code">gnutls_kx_algorithm_t</code> integers
indicating the available key exchange algorithms.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fload_005ffile-1"><span>gnutls_load_file<a class="copiable-link" href="#gnutls_005fload_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fload_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fload_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_load_file</strong> <code class="def-code-arguments">(const char * <var class="var">filename</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fload_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">filename</var>: the name of the file to load
</p>
<p><var class="var">data</var>: Where the file will be stored
</p>
<p>This function will load a file into a datum. The data are
zero terminated but the terminating null is not included in length.
The returned data are allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>Note that this function is not designed for reading sensitive materials,
such as private keys, on practical applications. When the reading fails
in the middle, the partially loaded content might remain on memory.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p>Since 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmac_005fget-1"><span>gnutls_mac_get<a class="copiable-link" href="#gnutls_005fmac_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmac_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmac_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_mac_algorithm_t</code> <strong class="def-name">gnutls_mac_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fmac_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the currently used MAC algorithm.
</p>
<p><strong class="strong">Returns:</strong> the currently used mac algorithm, a
<code class="code">gnutls_mac_algorithm_t</code> value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmac_005fget_005fid-1"><span>gnutls_mac_get_id<a class="copiable-link" href="#gnutls_005fmac_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmac_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmac_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_mac_algorithm_t</code> <strong class="def-name">gnutls_mac_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fmac_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a MAC algorithm name
</p>
<p>Convert a string to a <code class="code">gnutls_mac_algorithm_t</code> value. The names are
compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_mac_algorithm_t</code> id of the specified MAC
algorithm string, or <code class="code">GNUTLS_MAC_UNKNOWN</code> on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmac_005fget_005fkey_005fsize-1"><span>gnutls_mac_get_key_size<a class="copiable-link" href="#gnutls_005fmac_005fget_005fkey_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmac_005fget_005fkey_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmac_005fget_005fkey_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_mac_get_key_size</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fmac_005fget_005fkey_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is an encryption algorithm
</p>
<p>Returns the size of the MAC key used in TLS.
</p>
<p><strong class="strong">Returns:</strong> length (in bytes) of the given MAC key size, or 0 if the
given MAC algorithm is invalid.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmac_005fget_005fname-1"><span>gnutls_mac_get_name<a class="copiable-link" href="#gnutls_005fmac_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmac_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmac_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_mac_get_name</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fmac_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a MAC algorithm
</p>
<p>Convert a <code class="code">gnutls_mac_algorithm_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified MAC
algorithm, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmac_005flist-1"><span>gnutls_mac_list<a class="copiable-link" href="#gnutls_005fmac_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmac_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmac_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_mac_algorithm_t *</code> <strong class="def-name">gnutls_mac_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fmac_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of hash algorithms for use as MACs. Note that not
necessarily all MACs are supported in TLS cipher suites.
This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> Return a (0)-terminated list of <code class="code">gnutls_mac_algorithm_t</code>
integers indicating the available MACs.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmemcmp-1"><span>gnutls_memcmp<a class="copiable-link" href="#gnutls_005fmemcmp-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmemcmp"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmemcmp"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_memcmp</strong> <code class="def-code-arguments">(const void * <var class="var">s1</var>, const void * <var class="var">s2</var>, size_t <var class="var">n</var>)</code><a class="copiable-link" href="#index-gnutls_005fmemcmp"> ¶</a></span></dt>
<dd><p><var class="var">s1</var>: the first address to compare
</p>
<p><var class="var">s2</var>: the second address to compare
</p>
<p><var class="var">n</var>: the size of memory to compare
</p>
<p>This function will operate similarly to <code class="code">memcmp()</code> , but will operate
on time that depends only on the size of the string. That is will
not return early if the strings don’t match on the first byte.
</p>
<p><strong class="strong">Returns:</strong> non zero on difference and zero if the buffers are identical.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmemset-1"><span>gnutls_memset<a class="copiable-link" href="#gnutls_005fmemset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmemset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmemset"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_memset</strong> <code class="def-code-arguments">(void * <var class="var">data</var>, int <var class="var">c</var>, size_t <var class="var">size</var>)</code><a class="copiable-link" href="#index-gnutls_005fmemset"> ¶</a></span></dt>
<dd><p><var class="var">data</var>: the memory to set
</p>
<p><var class="var">c</var>: the constant byte to fill the memory with
</p>
<p><var class="var">size</var>: the size of memory
</p>
<p>This function will operate similarly to <code class="code">memset()</code> , but will
not be optimized out by the compiler.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fstatus_005frequest_005fenable_005fclient-1"><span>gnutls_ocsp_status_request_enable_client<a class="copiable-link" href="#gnutls_005focsp_005fstatus_005frequest_005fenable_005fclient-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fstatus_005frequest_005fenable_005fclient"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fstatus_005frequest_005fenable_005fclient"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_status_request_enable_client</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">responder_id</var>, size_t <var class="var">responder_id_size</var>, gnutls_datum_t * <var class="var">extensions</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fstatus_005frequest_005fenable_005fclient"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">responder_id</var>: ignored, must be <code class="code">NULL</code>
</p>
<p><var class="var">responder_id_size</var>: ignored, must be zero
</p>
<p><var class="var">extensions</var>: ignored, must be <code class="code">NULL</code>
</p>
<p>This function is to be used by clients to request OCSP response
from the server, using the "status_request" TLS extension. Only
OCSP status type is supported.
</p>
<p>Previous versions of GnuTLS supported setting <code class="code">responder_id</code> and
<code class="code">extensions</code> fields, but due to the difficult semantics of the
parameter usage, and other issues, this support was removed
since 3.6.0 and these parameters must be set to <code class="code">NULL</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fstatus_005frequest_005fget-1"><span>gnutls_ocsp_status_request_get<a class="copiable-link" href="#gnutls_005focsp_005fstatus_005frequest_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fstatus_005frequest_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fstatus_005frequest_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_status_request_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">response</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fstatus_005frequest_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">response</var>: a <code class="code">gnutls_datum_t</code> with DER encoded OCSP response
</p>
<p>This function returns the OCSP status response received
from the TLS server. The <code class="code">response</code> should be treated as
constant. If no OCSP response is available then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fstatus_005frequest_005fget2-1"><span>gnutls_ocsp_status_request_get2<a class="copiable-link" href="#gnutls_005focsp_005fstatus_005frequest_005fget2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fstatus_005frequest_005fget2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fstatus_005frequest_005fget2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_status_request_get2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">idx</var>, gnutls_datum_t * <var class="var">response</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fstatus_005frequest_005fget2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">idx</var>: the index of peer’s certificate
</p>
<p><var class="var">response</var>: a <code class="code">gnutls_datum_t</code> with DER encoded OCSP response
</p>
<p>This function returns the OCSP status response received
from the TLS server for the certificate index provided.
The index corresponds to certificates as returned by
gnutls_certificate_get_peers. When index is zero this
function operates identically to <code class="code">gnutls_ocsp_status_request_get()</code> .
</p>
<p>The returned <code class="code">response</code> should be treated as
constant. If no OCSP response is available for the
given index then <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fstatus_005frequest_005fis_005fchecked-1"><span>gnutls_ocsp_status_request_is_checked<a class="copiable-link" href="#gnutls_005focsp_005fstatus_005frequest_005fis_005fchecked-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fstatus_005frequest_005fis_005fchecked"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fstatus_005frequest_005fis_005fchecked"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_ocsp_status_request_is_checked</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fstatus_005frequest_005fis_005fchecked"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">flags</var>: should be zero or <code class="code">GNUTLS_OCSP_SR_IS_AVAIL</code>
</p>
<p>When flags are zero this function returns non-zero if a valid OCSP status
response was included in the TLS handshake. That is, an OCSP status response
which is not too old, superseded or marks the certificate as revoked.
It returns zero otherwise.
</p>
<p>When the flag <code class="code">GNUTLS_OCSP_SR_IS_AVAIL</code> is specified, the function
returns non-zero if an OCSP status response was included in the handshake
even if it was invalid. Otherwise, if no OCSP status response was included,
it returns zero. The <code class="code">GNUTLS_OCSP_SR_IS_AVAIL</code> flag was introduced in GnuTLS 3.4.0.
</p>
<p>This is a helper function when needing to decide whether to perform an
explicit OCSP validity check on the peer’s certificate. Should be called after
any of gnutls_certificate_verify_peers*() are called.
</p>
<p>This function is always usable on client side, but on server side only under
TLS 1.3, which is the first version of TLS that allows clients to send OCSP
responses.
</p>
<p><strong class="strong">Returns:</strong> Non-zero if the response was valid, or a zero if it wasn’t sent,
or sent and was invalid.
</p>
<p><strong class="strong">Since:</strong> 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005foid_005fto_005fdigest-1"><span>gnutls_oid_to_digest<a class="copiable-link" href="#gnutls_005foid_005fto_005fdigest-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005foid_005fto_005fdigest"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005foid_005fto_005fdigest"><span class="category-def">Function: </span><span><code class="def-type">gnutls_digest_algorithm_t</code> <strong class="def-name">gnutls_oid_to_digest</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005foid_005fto_005fdigest"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: is an object identifier
</p>
<p>Converts a textual object identifier to a <code class="code">gnutls_digest_algorithm_t</code> value.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_digest_algorithm_t</code> id of the specified digest
algorithm, or <code class="code">GNUTLS_DIG_UNKNOWN</code> on failure.
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005foid_005fto_005fecc_005fcurve-1"><span>gnutls_oid_to_ecc_curve<a class="copiable-link" href="#gnutls_005foid_005fto_005fecc_005fcurve-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005foid_005fto_005fecc_005fcurve"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005foid_005fto_005fecc_005fcurve"><span class="category-def">Function: </span><span><code class="def-type">gnutls_ecc_curve_t</code> <strong class="def-name">gnutls_oid_to_ecc_curve</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005foid_005fto_005fecc_005fcurve"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: is a curve’s OID
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_ecc_curve_t</code> value corresponding to
the specified OID, or <code class="code">GNUTLS_ECC_CURVE_INVALID</code> on error.
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005foid_005fto_005fgost_005fparamset-1"><span>gnutls_oid_to_gost_paramset<a class="copiable-link" href="#gnutls_005foid_005fto_005fgost_005fparamset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005foid_005fto_005fgost_005fparamset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005foid_005fto_005fgost_005fparamset"><span class="category-def">Function: </span><span><code class="def-type">gnutls_gost_paramset_t</code> <strong class="def-name">gnutls_oid_to_gost_paramset</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005foid_005fto_005fgost_005fparamset"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: is an object identifier
</p>
<p>Converts a textual object identifier to a <code class="code">gnutls_gost_paramset_t</code> value.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_gost_paramset_get_oid</code> of the specified GOST 28147
param st, or <code class="code">GNUTLS_GOST_PARAMSET_UNKNOWN</code> on failure.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005foid_005fto_005fmac-1"><span>gnutls_oid_to_mac<a class="copiable-link" href="#gnutls_005foid_005fto_005fmac-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005foid_005fto_005fmac"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005foid_005fto_005fmac"><span class="category-def">Function: </span><span><code class="def-type">gnutls_mac_algorithm_t</code> <strong class="def-name">gnutls_oid_to_mac</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005foid_005fto_005fmac"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: is an object identifier
</p>
<p>Converts a textual object identifier typically from PKCS<code class="code">5</code> values to a <code class="code">gnutls_mac_algorithm_t</code> value.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_mac_algorithm_t</code> id of the specified digest
algorithm, or <code class="code">GNUTLS_MAC_UNKNOWN</code> on failure.
</p>
<p><strong class="strong">Since:</strong> 3.5.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005foid_005fto_005fpk-1"><span>gnutls_oid_to_pk<a class="copiable-link" href="#gnutls_005foid_005fto_005fpk-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005foid_005fto_005fpk"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005foid_005fto_005fpk"><span class="category-def">Function: </span><span><code class="def-type">gnutls_pk_algorithm_t</code> <strong class="def-name">gnutls_oid_to_pk</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005foid_005fto_005fpk"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: is an object identifier
</p>
<p>Converts a textual object identifier to a <code class="code">gnutls_pk_algorithm_t</code> value.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_pk_algorithm_t</code> id of the specified digest
algorithm, or <code class="code">GNUTLS_PK_UNKNOWN</code> on failure.
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005foid_005fto_005fsign-1"><span>gnutls_oid_to_sign<a class="copiable-link" href="#gnutls_005foid_005fto_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005foid_005fto_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005foid_005fto_005fsign"><span class="category-def">Function: </span><span><code class="def-type">gnutls_sign_algorithm_t</code> <strong class="def-name">gnutls_oid_to_sign</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005foid_005fto_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: is an object identifier
</p>
<p>Converts a textual object identifier to a <code class="code">gnutls_sign_algorithm_t</code> value.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_sign_algorithm_t</code> id of the specified digest
algorithm, or <code class="code">GNUTLS_SIGN_UNKNOWN</code> on failure.
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fopenpgp_005fsend_005fcert-1"><span>gnutls_openpgp_send_cert<a class="copiable-link" href="#gnutls_005fopenpgp_005fsend_005fcert-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fopenpgp_005fsend_005fcert"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fopenpgp_005fsend_005fcert"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_openpgp_send_cert</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_openpgp_crt_status_t <var class="var">status</var>)</code><a class="copiable-link" href="#index-gnutls_005fopenpgp_005fsend_005fcert"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">status</var>: is ignored
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpacket_005fdeinit-1"><span>gnutls_packet_deinit<a class="copiable-link" href="#gnutls_005fpacket_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpacket_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpacket_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_packet_deinit</strong> <code class="def-code-arguments">(gnutls_packet_t <var class="var">packet</var>)</code><a class="copiable-link" href="#index-gnutls_005fpacket_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">packet</var>: is a pointer to a <code class="code">gnutls_packet_st</code> structure.
</p>
<p>This function will deinitialize all data associated with
the received packet.
</p>
<p><strong class="strong">Since:</strong> 3.3.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpacket_005fget-1"><span>gnutls_packet_get<a class="copiable-link" href="#gnutls_005fpacket_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpacket_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpacket_005fget"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_packet_get</strong> <code class="def-code-arguments">(gnutls_packet_t <var class="var">packet</var>, gnutls_datum_t * <var class="var">data</var>, unsigned char * <var class="var">sequence</var>)</code><a class="copiable-link" href="#index-gnutls_005fpacket_005fget"> ¶</a></span></dt>
<dd><p><var class="var">packet</var>: is a <code class="code">gnutls_packet_t</code> type.
</p>
<p><var class="var">data</var>: will contain the data present in the <code class="code">packet</code> structure (may be <code class="code">NULL</code> )
</p>
<p><var class="var">sequence</var>: the 8-bytes of the packet sequence number (may be <code class="code">NULL</code> )
</p>
<p>This function returns the data and sequence number associated with
the received packet.
</p>
<p><strong class="strong">Since:</strong> 3.3.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpem_005fbase64_005fdecode-1"><span>gnutls_pem_base64_decode<a class="copiable-link" href="#gnutls_005fpem_005fbase64_005fdecode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpem_005fbase64_005fdecode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpem_005fbase64_005fdecode"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pem_base64_decode</strong> <code class="def-code-arguments">(const char * <var class="var">header</var>, const gnutls_datum_t * <var class="var">b64_data</var>, unsigned char * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpem_005fbase64_005fdecode"> ¶</a></span></dt>
<dd><p><var class="var">header</var>: A null terminated string with the PEM header (eg. CERTIFICATE)
</p>
<p><var class="var">b64_data</var>: contain the encoded data
</p>
<p><var class="var">result</var>: the place where decoded data will be copied
</p>
<p><var class="var">result_size</var>: holds the size of the result
</p>
<p>This function will decode the given encoded data. If the header
given is non <code class="code">NULL</code> this function will search for "—–BEGIN header"
and decode only this part. Otherwise it will decode the first PEM
packet found.
</p>
<p><strong class="strong">Returns:</strong> On success <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned if the buffer given is
not long enough, or 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpem_005fbase64_005fdecode2-1"><span>gnutls_pem_base64_decode2<a class="copiable-link" href="#gnutls_005fpem_005fbase64_005fdecode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpem_005fbase64_005fdecode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpem_005fbase64_005fdecode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pem_base64_decode2</strong> <code class="def-code-arguments">(const char * <var class="var">header</var>, const gnutls_datum_t * <var class="var">b64_data</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fpem_005fbase64_005fdecode2"> ¶</a></span></dt>
<dd><p><var class="var">header</var>: The PEM header (eg. CERTIFICATE)
</p>
<p><var class="var">b64_data</var>: contains the encoded data
</p>
<p><var class="var">result</var>: the location of decoded data
</p>
<p>This function will decode the given encoded data. The decoded data
will be allocated, and stored into result. If the header given is
non null this function will search for "—–BEGIN header" and
decode only this part. Otherwise it will decode the first PEM
packet found.
</p>
<p>You should use <code class="code">gnutls_free()</code> to free the returned data.
</p>
<p>Note, that prior to GnuTLS 3.4.0 this function was available
under the name <code class="code">gnutls_pem_base64_decode_alloc()</code> . There is
compatibility macro pointing to this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpem_005fbase64_005fencode-1"><span>gnutls_pem_base64_encode<a class="copiable-link" href="#gnutls_005fpem_005fbase64_005fencode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpem_005fbase64_005fencode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpem_005fbase64_005fencode"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pem_base64_encode</strong> <code class="def-code-arguments">(const char * <var class="var">msg</var>, const gnutls_datum_t * <var class="var">data</var>, char * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpem_005fbase64_005fencode"> ¶</a></span></dt>
<dd><p><var class="var">msg</var>: is a message to be put in the header (may be <code class="code">NULL</code> )
</p>
<p><var class="var">data</var>: contain the raw data
</p>
<p><var class="var">result</var>: the place where base64 data will be copied
</p>
<p><var class="var">result_size</var>: holds the size of the result
</p>
<p>This function will convert the given data to printable data, using
the base64 encoding. This is the encoding used in PEM messages.
</p>
<p>The output string will be null terminated, although the output size will
not include the terminating null.
</p>
<p><strong class="strong">Returns:</strong> On success <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned if the buffer given is
not long enough, or 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpem_005fbase64_005fencode2-1"><span>gnutls_pem_base64_encode2<a class="copiable-link" href="#gnutls_005fpem_005fbase64_005fencode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpem_005fbase64_005fencode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpem_005fbase64_005fencode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pem_base64_encode2</strong> <code class="def-code-arguments">(const char * <var class="var">header</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fpem_005fbase64_005fencode2"> ¶</a></span></dt>
<dd><p><var class="var">header</var>: is a message to be put in the encoded header (may be <code class="code">NULL</code> )
</p>
<p><var class="var">data</var>: contains the raw data
</p>
<p><var class="var">result</var>: will hold the newly allocated encoded data
</p>
<p>This function will convert the given data to printable data, using
the base64 encoding. This is the encoding used in PEM messages.
This function will allocate the required memory to hold the encoded
data.
</p>
<p>You should use <code class="code">gnutls_free()</code> to free the returned data.
</p>
<p>Note, that prior to GnuTLS 3.4.0 this function was available
under the name <code class="code">gnutls_pem_base64_encode_alloc()</code> . There is
compatibility macro pointing to this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fperror-1"><span>gnutls_perror<a class="copiable-link" href="#gnutls_005fperror-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fperror"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fperror"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_perror</strong> <code class="def-code-arguments">(int <var class="var">error</var>)</code><a class="copiable-link" href="#index-gnutls_005fperror"> ¶</a></span></dt>
<dd><p><var class="var">error</var>: is a GnuTLS error code, a negative error code
</p>
<p>This function is like <code class="code">perror()</code> . The only difference is that it
accepts an error number returned by a gnutls function.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpk_005falgorithm_005fget_005fname-1"><span>gnutls_pk_algorithm_get_name<a class="copiable-link" href="#gnutls_005fpk_005falgorithm_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpk_005falgorithm_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005falgorithm_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_pk_algorithm_get_name</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005falgorithm_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a pk algorithm
</p>
<p>Convert a <code class="code">gnutls_pk_algorithm_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified public
key algorithm, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpk_005fbits_005fto_005fsec_005fparam-1"><span>gnutls_pk_bits_to_sec_param<a class="copiable-link" href="#gnutls_005fpk_005fbits_005fto_005fsec_005fparam-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpk_005fbits_005fto_005fsec_005fparam"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005fbits_005fto_005fsec_005fparam-1"><span class="category-def">Function: </span><span><code class="def-type">gnutls_sec_param_t</code> <strong class="def-name">gnutls_pk_bits_to_sec_param</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005fbits_005fto_005fsec_005fparam-1"> ¶</a></span></dt>
<dd><p><var class="var">algo</var>: is a public key algorithm
</p>
<p><var class="var">bits</var>: is the number of bits
</p>
<p>This is the inverse of <code class="code">gnutls_sec_param_to_pk_bits()</code> . Given an algorithm
and the number of bits, it will return the security parameter. This is
a rough indication.
</p>
<p><strong class="strong">Returns:</strong> The security parameter.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpk_005fget_005fid-1"><span>gnutls_pk_get_id<a class="copiable-link" href="#gnutls_005fpk_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpk_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_pk_algorithm_t</code> <strong class="def-name">gnutls_pk_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a string containing a public key algorithm name.
</p>
<p>Convert a string to a <code class="code">gnutls_pk_algorithm_t</code> value. The names are
compared in a case insensitive way. For example,
gnutls_pk_get_id("RSA") will return <code class="code">GNUTLS_PK_RSA</code> .
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_pk_algorithm_t</code> id of the specified public key
algorithm string, or <code class="code">GNUTLS_PK_UNKNOWN</code> on failures.
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpk_005fget_005fname-1"><span>gnutls_pk_get_name<a class="copiable-link" href="#gnutls_005fpk_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpk_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_pk_get_name</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a public key algorithm
</p>
<p>Convert a <code class="code">gnutls_pk_algorithm_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the name of the
specified public key algorithm, or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpk_005fget_005foid-1"><span>gnutls_pk_get_oid<a class="copiable-link" href="#gnutls_005fpk_005fget_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpk_005fget_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005fget_005foid"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_pk_get_oid</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005fget_005foid"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a public key algorithm
</p>
<p>Convert a <code class="code">gnutls_pk_algorithm_t</code> value to its object identifier string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the object identifier of the
specified public key algorithm, or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpk_005flist-1"><span>gnutls_pk_list<a class="copiable-link" href="#gnutls_005fpk_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpk_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_pk_algorithm_t *</code> <strong class="def-name">gnutls_pk_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of supported public key algorithms.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> a (0)-terminated list of <code class="code">gnutls_pk_algorithm_t</code> integers
indicating the available ciphers.
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpk_005fto_005fsign-1"><span>gnutls_pk_to_sign<a class="copiable-link" href="#gnutls_005fpk_005fto_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpk_005fto_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpk_005fto_005fsign"><span class="category-def">Function: </span><span><code class="def-type">gnutls_sign_algorithm_t</code> <strong class="def-name">gnutls_pk_to_sign</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">pk</var>, gnutls_digest_algorithm_t <var class="var">hash</var>)</code><a class="copiable-link" href="#index-gnutls_005fpk_005fto_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">pk</var>: is a public key algorithm
</p>
<p><var class="var">hash</var>: a hash algorithm
</p>
<p>This function maps public key and hash algorithms combinations
to signature algorithms.
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_sign_algorithm_t</code> value, or <code class="code">GNUTLS_SIGN_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprf-1"><span>gnutls_prf<a class="copiable-link" href="#gnutls_005fprf-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprf"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprf"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_prf</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">label_size</var>, const char * <var class="var">label</var>, int <var class="var">server_random_first</var>, size_t <var class="var">extra_size</var>, const char * <var class="var">extra</var>, size_t <var class="var">outsize</var>, char * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fprf"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">label_size</var>: length of the <code class="code">label</code> variable.
</p>
<p><var class="var">label</var>: label used in PRF computation, typically a short string.
</p>
<p><var class="var">server_random_first</var>: non-zero if server random field should be first in seed
</p>
<p><var class="var">extra_size</var>: length of the <code class="code">extra</code> variable.
</p>
<p><var class="var">extra</var>: optional extra data to seed the PRF with.
</p>
<p><var class="var">outsize</var>: size of pre-allocated output buffer to hold the output.
</p>
<p><var class="var">out</var>: pre-allocated buffer to hold the generated data.
</p>
<p>Applies the TLS Pseudo-Random-Function (PRF) on the master secret
and the provided data, seeded with the client and server random fields.
For the key expansion specified in RFC5705 see <code class="code">gnutls_prf_rfc5705()</code> .
</p>
<p>The <code class="code">label</code> variable usually contains a string denoting the purpose
for the generated data. The <code class="code">server_random_first</code> indicates whether
the client random field or the server random field should be first
in the seed. Non-zero indicates that the server random field is first,
0 that the client random field is first.
</p>
<p>The <code class="code">extra</code> variable can be used to add more data to the seed, after
the random variables. It can be used to make sure the
generated output is strongly connected to some additional data
(e.g., a string used in user authentication).
</p>
<p>The output is placed in <code class="code">out</code> , which must be pre-allocated.
</p>
<p><strong class="strong">Note:</strong> This function produces identical output with <code class="code">gnutls_prf_rfc5705()</code>
when <code class="code">server_random_first</code> is set to 0 and <code class="code">extra</code> is <code class="code">NULL</code> . Under TLS1.3
this function will only operate when these conditions are true, or otherwise
return <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprf_005fearly-1"><span>gnutls_prf_early<a class="copiable-link" href="#gnutls_005fprf_005fearly-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprf_005fearly"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprf_005fearly"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_prf_early</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">label_size</var>, const char * <var class="var">label</var>, size_t <var class="var">context_size</var>, const char * <var class="var">context</var>, size_t <var class="var">outsize</var>, char * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fprf_005fearly"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">label_size</var>: length of the <code class="code">label</code> variable.
</p>
<p><var class="var">label</var>: label used in PRF computation, typically a short string.
</p>
<p><var class="var">context_size</var>: length of the <code class="code">extra</code> variable.
</p>
<p><var class="var">context</var>: optional extra data to seed the PRF with.
</p>
<p><var class="var">outsize</var>: size of pre-allocated output buffer to hold the output.
</p>
<p><var class="var">out</var>: pre-allocated buffer to hold the generated data.
</p>
<p>This function is similar to <code class="code">gnutls_prf_rfc5705()</code> , but only works in
TLS 1.3 or later to export early keying material.
</p>
<p>Note that the keying material is only available after the
ClientHello message is processed and before the application traffic
keys are established. Therefore this function shall be called in a
handshake hook function for <code class="code">GNUTLS_HANDSHAKE_CLIENT_HELLO</code> .
</p>
<p>The <code class="code">label</code> variable usually contains a string denoting the purpose
for the generated data.
</p>
<p>The <code class="code">context</code> variable can be used to add more data to the seed, after
the random variables. It can be used to make sure the
generated output is strongly connected to some additional data
(e.g., a string used in user authentication).
</p>
<p>The output is placed in <code class="code">out</code> , which must be pre-allocated.
</p>
<p>Note that, to provide the RFC5705 context, the <code class="code">context</code> variable
must be non-null.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprf_005fhash_005fget-1"><span>gnutls_prf_hash_get<a class="copiable-link" href="#gnutls_005fprf_005fhash_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprf_005fhash_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprf_005fhash_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_digest_algorithm_t</code> <strong class="def-name">gnutls_prf_hash_get</strong> <code class="def-code-arguments">(const gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fprf_005fhash_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the currently used hash algorithm. In TLS 1.3, the hash
algorithm is used for both the key derivation function and
handshake message authentication code. In TLS 1.2, it matches the
hash algorithm used for PRF.
</p>
<p><strong class="strong">Returns:</strong> the currently used hash algorithm, a
<code class="code">gnutls_digest_algorithm_t</code> value.
</p>
<p><strong class="strong">Since:</strong> 3.6.13
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprf_005fraw-1"><span>gnutls_prf_raw<a class="copiable-link" href="#gnutls_005fprf_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprf_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprf_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_prf_raw</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">label_size</var>, const char * <var class="var">label</var>, size_t <var class="var">seed_size</var>, const char * <var class="var">seed</var>, size_t <var class="var">outsize</var>, char * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fprf_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">label_size</var>: length of the <code class="code">label</code> variable.
</p>
<p><var class="var">label</var>: label used in PRF computation, typically a short string.
</p>
<p><var class="var">seed_size</var>: length of the <code class="code">seed</code> variable.
</p>
<p><var class="var">seed</var>: optional extra data to seed the PRF with.
</p>
<p><var class="var">outsize</var>: size of pre-allocated output buffer to hold the output.
</p>
<p><var class="var">out</var>: pre-allocated buffer to hold the generated data.
</p>
<p>Apply the TLS Pseudo-Random-Function (PRF) on the master secret
and the provided data.
</p>
<p>The <code class="code">label</code> variable usually contains a string denoting the purpose
for the generated data. The <code class="code">seed</code> usually contains data such as the
client and server random, perhaps together with some additional
data that is added to guarantee uniqueness of the output for a
particular purpose.
</p>
<p>Because the output is not guaranteed to be unique for a particular
session unless <code class="code">seed</code> includes the client random and server random
fields (the PRF would output the same data on another connection
resumed from the first one), it is not recommended to use this
function directly. The <code class="code">gnutls_prf()</code> function seeds the PRF with the
client and server random fields directly, and is recommended if you
want to generate pseudo random data unique for each session.
</p>
<p><strong class="strong">Note:</strong> This function will only operate under TLS versions prior to 1.3.
In TLS1.3 the use of PRF is replaced with HKDF and the generic
exporters like <code class="code">gnutls_prf_rfc5705()</code> should be used instead. Under
TLS1.3 this function returns <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprf_005frfc5705-1"><span>gnutls_prf_rfc5705<a class="copiable-link" href="#gnutls_005fprf_005frfc5705-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprf_005frfc5705"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprf_005frfc5705-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_prf_rfc5705</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">label_size</var>, const char * <var class="var">label</var>, size_t <var class="var">context_size</var>, const char * <var class="var">context</var>, size_t <var class="var">outsize</var>, char * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fprf_005frfc5705-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">label_size</var>: length of the <code class="code">label</code> variable.
</p>
<p><var class="var">label</var>: label used in PRF computation, typically a short string.
</p>
<p><var class="var">context_size</var>: length of the <code class="code">extra</code> variable.
</p>
<p><var class="var">context</var>: optional extra data to seed the PRF with.
</p>
<p><var class="var">outsize</var>: size of pre-allocated output buffer to hold the output.
</p>
<p><var class="var">out</var>: pre-allocated buffer to hold the generated data.
</p>
<p>Exports keying material from TLS/DTLS session to an application, as
specified in RFC5705.
</p>
<p>In the TLS versions prior to 1.3, it applies the TLS
Pseudo-Random-Function (PRF) on the master secret and the provided
data, seeded with the client and server random fields.
</p>
<p>In TLS 1.3, it applies HKDF on the exporter master secret derived
from the master secret.
</p>
<p>The <code class="code">label</code> variable usually contains a string denoting the purpose
for the generated data.
</p>
<p>The <code class="code">context</code> variable can be used to add more data to the seed, after
the random variables. It can be used to make sure the
generated output is strongly connected to some additional data
(e.g., a string used in user authentication).
</p>
<p>The output is placed in <code class="code">out</code> , which must be pre-allocated.
</p>
<p>Note that, to provide the RFC5705 context, the <code class="code">context</code> variable
must be non-null.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fcertificate_005ftype_005flist-1"><span>gnutls_priority_certificate_type_list<a class="copiable-link" href="#gnutls_005fpriority_005fcertificate_005ftype_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fcertificate_005ftype_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fcertificate_005ftype_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_certificate_type_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fcertificate_005ftype_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available certificate types in the priority
structure.
</p>
<p>As of version 3.6.4 this function is an alias for
gnutls_priority_certificate_type_list2 with the target parameter
set to:
- GNUTLS_CTYPE_SERVER, if the <code class="code">SERVER_PRECEDENCE</code> option is set
- GNUTLS_CTYPE_CLIENT, otherwise.
</p>
<p><strong class="strong">Returns:</strong> the number of certificate types, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fcertificate_005ftype_005flist2-1"><span>gnutls_priority_certificate_type_list2<a class="copiable-link" href="#gnutls_005fpriority_005fcertificate_005ftype_005flist2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fcertificate_005ftype_005flist2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fcertificate_005ftype_005flist2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_certificate_type_list2</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>, gnutls_ctype_target_t <var class="var">target</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fcertificate_005ftype_005flist2"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list.
</p>
<p><var class="var">target</var>: is a <code class="code">gnutls_ctype_target_t</code> type. Valid arguments are
GNUTLS_CTYPE_CLIENT and GNUTLS_CTYPE_SERVER
</p>
<p>Get a list of available certificate types for the given target
in the priority structure.
</p>
<p><strong class="strong">Returns:</strong> the number of certificate types, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fcipher_005flist-1"><span>gnutls_priority_cipher_list<a class="copiable-link" href="#gnutls_005fpriority_005fcipher_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fcipher_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fcipher_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_cipher_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fcipher_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available ciphers in the priority
structure.
</p>
<p><strong class="strong">Returns:</strong> the number of items, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.2.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fdeinit-1"><span>gnutls_priority_deinit<a class="copiable-link" href="#gnutls_005fpriority_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_priority_deinit</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">priority_cache</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">priority_cache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p>Deinitializes the priority cache.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fecc_005fcurve_005flist-1"><span>gnutls_priority_ecc_curve_list<a class="copiable-link" href="#gnutls_005fpriority_005fecc_005fcurve_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fecc_005fcurve_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fecc_005fcurve_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_ecc_curve_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fecc_005fcurve_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available elliptic curves in the priority
structure.
</p>
<p><strong class="strong">Deprecated:</strong> This function has been replaced by
<code class="code">gnutls_priority_group_list()</code> since 3.6.0.
</p>
<p><strong class="strong">Returns:</strong> the number of items, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fget_005fcipher_005fsuite_005findex-1"><span>gnutls_priority_get_cipher_suite_index<a class="copiable-link" href="#gnutls_005fpriority_005fget_005fcipher_005fsuite_005findex-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fget_005fcipher_005fsuite_005findex"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fget_005fcipher_005fsuite_005findex"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_get_cipher_suite_index</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, unsigned int <var class="var">idx</var>, unsigned int * <var class="var">sidx</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fget_005fcipher_005fsuite_005findex"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">idx</var>: is an index number.
</p>
<p><var class="var">sidx</var>: internal index of cipher suite to get information about.
</p>
<p>Provides the internal ciphersuite index to be used with
<code class="code">gnutls_cipher_suite_info()</code> . The index <code class="code">idx</code> provided is an
index kept at the priorities structure. It might be that a valid
priorities index does not correspond to a ciphersuite and in
that case <code class="code">GNUTLS_E_UNKNOWN_CIPHER_SUITE</code> will be returned.
Once the last available index is crossed then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Returns:</strong> On success it returns <code class="code">GNUTLS_E_SUCCESS</code> (0), or a negative error value otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.0.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fgroup_005flist-1"><span>gnutls_priority_group_list<a class="copiable-link" href="#gnutls_005fpriority_005fgroup_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fgroup_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fgroup_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_group_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fgroup_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available groups in the priority
structure.
</p>
<p><strong class="strong">Returns:</strong> the number of items, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005finit-1"><span>gnutls_priority_init<a class="copiable-link" href="#gnutls_005fpriority_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_init</strong> <code class="def-code-arguments">(gnutls_priority_t * <var class="var">priority_cache</var>, const char * <var class="var">priorities</var>, const char ** <var class="var">err_pos</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005finit"> ¶</a></span></dt>
<dd><p><var class="var">priority_cache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">priorities</var>: is a string describing priorities (may be <code class="code">NULL</code> )
</p>
<p><var class="var">err_pos</var>: In case of an error this will have the position in the string the error occurred
</p>
<p>For applications that do not modify their crypto settings per release, consider
using <code class="code">gnutls_priority_init2()</code> with <code class="code">GNUTLS_PRIORITY_INIT_DEF_APPEND</code> flag
instead. We suggest to use centralized crypto settings handled by the GnuTLS
library, and applications modifying the default settings to their needs.
</p>
<p>This function is identical to <code class="code">gnutls_priority_init2()</code> with zero
flags.
</p>
<p>A <code class="code">NULL</code> <code class="code">priorities</code> string indicates the default priorities to be
used (this is available since GnuTLS 3.3.0).
</p>
<p><strong class="strong">Returns:</strong> On syntax error <code class="code">GNUTLS_E_INVALID_REQUEST</code> is returned,
<code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005finit2-1"><span>gnutls_priority_init2<a class="copiable-link" href="#gnutls_005fpriority_005finit2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005finit2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005finit2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_init2</strong> <code class="def-code-arguments">(gnutls_priority_t * <var class="var">priority_cache</var>, const char * <var class="var">priorities</var>, const char ** <var class="var">err_pos</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005finit2"> ¶</a></span></dt>
<dd><p><var class="var">priority_cache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">priorities</var>: is a string describing priorities (may be <code class="code">NULL</code> )
</p>
<p><var class="var">err_pos</var>: In case of an error this will have the position in the string the error occurred
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_PRIORITY_INIT_DEF_APPEND</code>
</p>
<p>Sets priorities for the ciphers, key exchange methods, and macs.
The <code class="code">priority_cache</code> should be deinitialized
using <code class="code">gnutls_priority_deinit()</code> .
</p>
<p>The <code class="code">priorities</code> option allows you to specify a colon
separated list of the cipher priorities to enable.
Some keywords are defined to provide quick access
to common preferences.
</p>
<p>When <code class="code">flags</code> is set to <code class="code">GNUTLS_PRIORITY_INIT_DEF_APPEND</code> then the <code class="code">priorities</code> specified will be appended to the default options.
</p>
<p>Unless there is a special need, use the "NORMAL" keyword to
apply a reasonable security level, or "NORMAL:%COMPAT" for compatibility.
</p>
<p>"PERFORMANCE" means all the "secure" ciphersuites are enabled,
limited to 128 bit ciphers and sorted by terms of speed
performance.
</p>
<p>"LEGACY" the NORMAL settings for GnuTLS 3.2.x or earlier. There is
no verification profile set, and the allowed DH primes are considered
weak today.
</p>
<p>"NORMAL" means all "secure" ciphersuites. The 256-bit ciphers are
included as a fallback only. The ciphers are sorted by security
margin.
</p>
<p>"PFS" means all "secure" ciphersuites that support perfect forward secrecy.
The 256-bit ciphers are included as a fallback only.
The ciphers are sorted by security margin.
</p>
<p>"SECURE128" means all "secure" ciphersuites of security level 128-bit
or more.
</p>
<p>"SECURE192" means all "secure" ciphersuites of security level 192-bit
or more.
</p>
<p>"SUITEB128" means all the NSA SuiteB ciphersuites with security level
of 128.
</p>
<p>"SUITEB192" means all the NSA SuiteB ciphersuites with security level
of 192.
</p>
<p>"NONE" means nothing is enabled. This disables everything, including protocols.
</p>
<p>"@KEYWORD1,KEYWORD2,..." The system administrator imposed settings.
The provided keyword(s) will be expanded from a configuration-time
provided file - default is: /etc/gnutls/config.
Any attributes that follow it, will be appended to the expanded
string. If multiple keywords are provided, separated by commas,
then the first keyword that exists in the configuration file
will be used. At least one of the keywords must exist, or this
function will return an error. Typical usage would be to specify
an application specified keyword first, followed by "SYSTEM" as
a default fallback. e.g., " <code class="code">LIBVIRT</code> ,SYSTEM:!-VERS-SSL3.0" will
first try to find a config file entry matching "LIBVIRT", but if
that does not exist will use the entry for "SYSTEM". If "SYSTEM"
does not exist either, an error will be returned. In all cases,
the SSL3.0 protocol will be disabled. The system priority file
entries should be formatted as "KEYWORD=VALUE", e.g.,
"SYSTEM=NORMAL:+ARCFOUR-128".
</p>
<p>Special keywords are "!", "-" and "+".
"!" or "-" appended with an algorithm will remove this algorithm.
"+" appended with an algorithm will add this algorithm.
</p>
<p>Check the GnuTLS manual section "Priority strings" for detailed
information.
</p>
<p><strong class="strong">Examples:</strong>
"NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+AES-128-CBC:+SIGN-ALL:+COMP-NULL"
</p>
<p>"NORMAL:+ARCFOUR-128" means normal ciphers plus ARCFOUR-128.
</p>
<p>"SECURE128:-VERS-SSL3.0" means that only secure ciphers are
and enabled, SSL3.0 is disabled.
</p>
<p>"NONE:+VERS-TLS-ALL:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL:+SIGN-RSA-SHA1",
</p>
<p>"NONE:+VERS-TLS-ALL:+AES-128-CBC:+ECDHE-RSA:+SHA1:+COMP-NULL:+SIGN-RSA-SHA1:+CURVE-SECP256R1",
</p>
<p>"SECURE256:+SECURE128",
</p>
<p>Note that "NORMAL:%COMPAT" is the most compatible mode.
</p>
<p>A <code class="code">NULL</code> <code class="code">priorities</code> string indicates the default priorities to be
used (this is available since GnuTLS 3.3.0).
</p>
<p><strong class="strong">Returns:</strong> On syntax error <code class="code">GNUTLS_E_INVALID_REQUEST</code> is returned,
<code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fkx_005flist-1"><span>gnutls_priority_kx_list<a class="copiable-link" href="#gnutls_005fpriority_005fkx_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fkx_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fkx_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_kx_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fkx_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available key exchange methods in the priority
structure.
</p>
<p><strong class="strong">Returns:</strong> the number of items, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.2.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fmac_005flist-1"><span>gnutls_priority_mac_list<a class="copiable-link" href="#gnutls_005fpriority_005fmac_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fmac_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fmac_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_mac_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fmac_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available MAC algorithms in the priority
structure.
</p>
<p><strong class="strong">Returns:</strong> the number of items, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.2.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fprotocol_005flist-1"><span>gnutls_priority_protocol_list<a class="copiable-link" href="#gnutls_005fpriority_005fprotocol_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fprotocol_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fprotocol_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_protocol_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fprotocol_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available TLS version numbers in the priority
structure.
</p>
<p><strong class="strong">Returns:</strong> the number of protocols, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fset-1"><span>gnutls_priority_set<a class="copiable-link" href="#gnutls_005fpriority_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_set</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_priority_t <var class="var">priority</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fset"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">priority</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p>Sets the priorities to use on the ciphers, key exchange methods,
and macs. Note that this function is expected to be called once
per session; when called multiple times (e.g., before a re-handshake,
the caller should make sure that any new settings are not incompatible
with the original session).
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fset_005fdirect-1"><span>gnutls_priority_set_direct<a class="copiable-link" href="#gnutls_005fpriority_005fset_005fdirect-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fset_005fdirect"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fset_005fdirect"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_set_direct</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">priorities</var>, const char ** <var class="var">err_pos</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fset_005fdirect"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">priorities</var>: is a string describing priorities
</p>
<p><var class="var">err_pos</var>: In case of an error this will have the position in the string the error occurred
</p>
<p>Sets the priorities to use on the ciphers, key exchange methods,
and macs. This function avoids keeping a
priority cache and is used to directly set string priorities to a
TLS session. For documentation check the <code class="code">gnutls_priority_init()</code> .
</p>
<p>To use a reasonable default, consider using <code class="code">gnutls_set_default_priority()</code> ,
or <code class="code">gnutls_set_default_priority_append()</code> instead of this function.
</p>
<p><strong class="strong">Returns:</strong> On syntax error <code class="code">GNUTLS_E_INVALID_REQUEST</code> is returned,
<code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fsign_005flist-1"><span>gnutls_priority_sign_list<a class="copiable-link" href="#gnutls_005fpriority_005fsign_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fsign_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fsign_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_sign_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fsign_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available signature algorithms in the priority
structure.
</p>
<p><strong class="strong">Returns:</strong> the number of algorithms, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fstring_005flist-1"><span>gnutls_priority_string_list<a class="copiable-link" href="#gnutls_005fpriority_005fstring_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fstring_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fstring_005flist"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_priority_string_list</strong> <code class="def-code-arguments">(unsigned <var class="var">iter</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fstring_005flist"> ¶</a></span></dt>
<dd><p><var class="var">iter</var>: an integer counter starting from zero
</p>
<p><var class="var">flags</var>: one of <code class="code">GNUTLS_PRIORITY_LIST_INIT_KEYWORDS</code> , <code class="code">GNUTLS_PRIORITY_LIST_SPECIAL</code>
</p>
<p>Can be used to iterate all available priority strings.
Due to internal implementation details, there are cases where this
function can return the empty string. In that case that string should be ignored.
When no strings are available it returns <code class="code">NULL</code> .
</p>
<p><strong class="strong">Returns:</strong> a priority string
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprotocol_005fget_005fid-1"><span>gnutls_protocol_get_id<a class="copiable-link" href="#gnutls_005fprotocol_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprotocol_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprotocol_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_protocol_t</code> <strong class="def-name">gnutls_protocol_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fprotocol_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a protocol name
</p>
<p>The names are compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> an id of the specified protocol, or
<code class="code">GNUTLS_VERSION_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprotocol_005fget_005fname-1"><span>gnutls_protocol_get_name<a class="copiable-link" href="#gnutls_005fprotocol_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprotocol_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprotocol_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_protocol_get_name</strong> <code class="def-code-arguments">(gnutls_protocol_t <var class="var">version</var>)</code><a class="copiable-link" href="#index-gnutls_005fprotocol_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">version</var>: is a (gnutls) version number
</p>
<p>Convert a <code class="code">gnutls_protocol_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified TLS
version (e.g., "TLS1.0"), or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprotocol_005fget_005fversion-1"><span>gnutls_protocol_get_version<a class="copiable-link" href="#gnutls_005fprotocol_005fget_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprotocol_005fget_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprotocol_005fget_005fversion"><span class="category-def">Function: </span><span><code class="def-type">gnutls_protocol_t</code> <strong class="def-name">gnutls_protocol_get_version</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fprotocol_005fget_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get TLS version, a <code class="code">gnutls_protocol_t</code> value.
</p>
<p><strong class="strong">Returns:</strong> The version of the currently used protocol.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprotocol_005flist-1"><span>gnutls_protocol_list<a class="copiable-link" href="#gnutls_005fprotocol_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprotocol_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprotocol_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_protocol_t *</code> <strong class="def-name">gnutls_protocol_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fprotocol_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of supported protocols, e.g. SSL 3.0, TLS 1.0 etc.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> a (0)-terminated list of <code class="code">gnutls_protocol_t</code> integers
indicating the available protocols.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprotocol_005fset_005fenabled-1"><span>gnutls_protocol_set_enabled<a class="copiable-link" href="#gnutls_005fprotocol_005fset_005fenabled-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprotocol_005fset_005fenabled"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprotocol_005fset_005fenabled"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_protocol_set_enabled</strong> <code class="def-code-arguments">(gnutls_protocol_t <var class="var">version</var>, unsigned int <var class="var">enabled</var>)</code><a class="copiable-link" href="#index-gnutls_005fprotocol_005fset_005fenabled"> ¶</a></span></dt>
<dd><p><var class="var">version</var>: is a (gnutls) version number
</p>
<p><var class="var">enabled</var>: whether to enable the protocol
</p>
<p>Control the previous system-wide setting that marked <code class="code">version</code> as
enabled or disabled. Calling this function is allowed
only if allowlisting mode is set in the configuration file,
and only if the system-wide TLS priority string
has not been initialized yet.
The intended usage is to provide applications with a way
to expressly deviate from the distribution or site defaults
inherited from the configuration file.
The modification is composable with further modifications
performed through the priority string mechanism.
</p>
<p>This function is not thread-safe and is intended to be called
in the main thread at the beginning of the process execution.
</p>
<p><strong class="strong">Returns:</strong> 0 on success or negative error code otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fallocate_005fclient_005fcredentials-1"><span>gnutls_psk_allocate_client_credentials<a class="copiable-link" href="#gnutls_005fpsk_005fallocate_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fallocate_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fallocate_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_allocate_client_credentials</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t * <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fallocate_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_psk_client_credentials_t</code> type.
</p>
<p>Allocate a gnutls_psk_client_credentials_t structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fallocate_005fclient_005fcredentials2-1"><span>gnutls_psk_allocate_client_credentials2<a class="copiable-link" href="#gnutls_005fpsk_005fallocate_005fclient_005fcredentials2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fallocate_005fclient_005fcredentials2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fallocate_005fclient_005fcredentials2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_allocate_client_credentials2</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t * <var class="var">sc</var>, gnutls_mac_algorithm_t <var class="var">mac</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fallocate_005fclient_005fcredentials2"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_psk_client_credentials_t</code> type.
</p>
<p><var class="var">mac</var>: encryption algorithm to use
</p>
<p>Allocate a gnutls_psk_client_credentials_t structure and initializes
the HMAC binder algorithm to <code class="code">mac</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fallocate_005fserver_005fcredentials-1"><span>gnutls_psk_allocate_server_credentials<a class="copiable-link" href="#gnutls_005fpsk_005fallocate_005fserver_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fallocate_005fserver_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fallocate_005fserver_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_allocate_server_credentials</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t * <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fallocate_005fserver_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p>Allocate a gnutls_psk_server_credentials_t structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fallocate_005fserver_005fcredentials2-1"><span>gnutls_psk_allocate_server_credentials2<a class="copiable-link" href="#gnutls_005fpsk_005fallocate_005fserver_005fcredentials2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fallocate_005fserver_005fcredentials2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fallocate_005fserver_005fcredentials2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_allocate_server_credentials2</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t * <var class="var">sc</var>, gnutls_mac_algorithm_t <var class="var">mac</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fallocate_005fserver_005fcredentials2"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">mac</var>: encryption algorithm to use
</p>
<p>Allocate a gnutls_psk_server_credentials_t structure and initializes
the HMAC binder algorithm to <code class="code">mac</code> . If <code class="code">mac</code> is set to GNUTLS_MAC_UNKNOWN
both possible algorithms SHA384 and SHA256 are applied to find a matching
binder value.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fclient_005fget_005fhint-1"><span>gnutls_psk_client_get_hint<a class="copiable-link" href="#gnutls_005fpsk_005fclient_005fget_005fhint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fclient_005fget_005fhint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fclient_005fget_005fhint"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_psk_client_get_hint</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fclient_005fget_005fhint"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>The PSK identity hint may give the client help in deciding which
username to use. This should only be called in case of PSK
authentication and in case of a client.
</p>
<p><strong class="strong">Note:</strong> there is no hint in TLS 1.3, so this function will return <code class="code">NULL</code>
if TLS 1.3 has been negotiated.
</p>
<p><strong class="strong">Returns:</strong> the identity hint of the peer, or <code class="code">NULL</code> in case of an error or if TLS 1.3 is being used.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fformat_005fimported_005fidentity-1"><span>gnutls_psk_format_imported_identity<a class="copiable-link" href="#gnutls_005fpsk_005fformat_005fimported_005fidentity-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fformat_005fimported_005fidentity"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fformat_005fimported_005fidentity"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_format_imported_identity</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">identity</var>, const gnutls_datum_t * <var class="var">context</var>, gnutls_protocol_t <var class="var">version</var>, gnutls_digest_algorithm_t <var class="var">hash</var>, gnutls_datum_t * <var class="var">imported_identity</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fformat_005fimported_005fidentity"> ¶</a></span></dt>
<dd><p><var class="var">identity</var>: external identity
</p>
<p><var class="var">context</var>: optional contextual information
</p>
<p><var class="var">version</var>: protocol version to which the PSK is imported
</p>
<p><var class="var">hash</var>: hash algorithm used for KDF
</p>
<p><var class="var">imported_identity</var>: where the imported identity is stored
</p>
<p>This formats an external PSK identity <code class="code">identity</code> into an imported
form, described in RFC 9258 as ImportedIdentity.
</p>
<p>Upon success, the data field of <code class="code">imported_identity</code> is allocated
using <code class="code">gnutls_malloc()</code> and the caller must free the memory after
use.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.8.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005ffree_005fclient_005fcredentials-1"><span>gnutls_psk_free_client_credentials<a class="copiable-link" href="#gnutls_005fpsk_005ffree_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005ffree_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005ffree_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_free_client_credentials</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005ffree_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_psk_client_credentials_t</code> type.
</p>
<p>Free a gnutls_psk_client_credentials_t structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005ffree_005fserver_005fcredentials-1"><span>gnutls_psk_free_server_credentials<a class="copiable-link" href="#gnutls_005fpsk_005ffree_005fserver_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005ffree_005fserver_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005ffree_005fserver_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_free_server_credentials</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005ffree_005fserver_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p>Free a gnutls_psk_server_credentials_t structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fserver_005fget_005fusername-1"><span>gnutls_psk_server_get_username<a class="copiable-link" href="#gnutls_005fpsk_005fserver_005fget_005fusername-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fserver_005fget_005fusername"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fserver_005fget_005fusername"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_psk_server_get_username</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fserver_005fget_005fusername"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This should only be called in case of PSK authentication and in
case of a server.
</p>
<p>The returned pointer should be considered constant (do not free) and valid
for the lifetime of the session.
</p>
<p>This function will return <code class="code">NULL</code> if the username has embedded NULL bytes.
In that case, <code class="code">gnutls_psk_server_get_username2()</code> should be used to retrieve the username.
</p>
<p><strong class="strong">Returns:</strong> the username of the peer, or <code class="code">NULL</code> in case of an error,
or if the username has embedded NULLs.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fserver_005fget_005fusername2-1"><span>gnutls_psk_server_get_username2<a class="copiable-link" href="#gnutls_005fpsk_005fserver_005fget_005fusername2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fserver_005fget_005fusername2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fserver_005fget_005fusername2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_server_get_username2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">username</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fserver_005fget_005fusername2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">username</var>: a datum that will be filled in by this function
</p>
<p>Return a pointer to the username of the peer in the supplied datum. Does not
need to be null-terminated.
</p>
<p>This should only be called in case of PSK authentication and in
case of a server.
</p>
<p>The returned pointer should be considered constant (do not free) and valid
for the lifetime of the session.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> , or a negative value in case of an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fclient_005fcredentials-1"><span>gnutls_psk_set_client_credentials<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_set_client_credentials</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t <var class="var">res</var>, const char * <var class="var">username</var>, const gnutls_datum_t * <var class="var">key</var>, gnutls_psk_key_flags <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_psk_client_credentials_t</code> type.
</p>
<p><var class="var">username</var>: is the user’s zero-terminated userid
</p>
<p><var class="var">key</var>: is the user’s key
</p>
<p><var class="var">flags</var>: indicate the format of the key, either
<code class="code">GNUTLS_PSK_KEY_RAW</code> or <code class="code">GNUTLS_PSK_KEY_HEX</code> .
</p>
<p>This function sets the username and password, in a
gnutls_psk_client_credentials_t type. Those will be used in
PSK authentication. <code class="code">username</code> should be an ASCII string or UTF-8
string. In case of a UTF-8 string it is recommended to be following
the PRECIS framework for usernames (rfc8265). The key can be either
in raw byte format or in Hex format (without the 0x prefix).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fclient_005fcredentials2-1"><span>gnutls_psk_set_client_credentials2<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fclient_005fcredentials2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fclient_005fcredentials2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fclient_005fcredentials2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_set_client_credentials2</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t <var class="var">res</var>, const gnutls_datum_t * <var class="var">username</var>, const gnutls_datum_t * <var class="var">key</var>, gnutls_psk_key_flags <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials2"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_psk_client_credentials_t</code> type.
</p>
<p><var class="var">username</var>: is the userid
</p>
<p><var class="var">key</var>: is the user’s key
</p>
<p><var class="var">flags</var>: indicate the format of the key, either
<code class="code">GNUTLS_PSK_KEY_RAW</code> or <code class="code">GNUTLS_PSK_KEY_HEX</code> .
</p>
<p>This function is identical to <code class="code">gnutls_psk_set_client_credentials()</code> ,
except that it allows a non-null-terminated username to be introduced.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction-1"><span>gnutls_psk_set_client_credentials_function<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_client_credentials_function</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t <var class="var">cred</var>, gnutls_psk_client_credentials_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the username and
password for client PSK authentication.
The callback’s function form is:
int (*callback)(gnutls_session_t, char** username,
gnutls_datum_t* key);
</p>
<p>The <code class="code">username</code> and <code class="code">key</code> ->data must be allocated using <code class="code">gnutls_malloc()</code> .
The <code class="code">username</code> should be an ASCII string or UTF-8
string. In case of a UTF-8 string it is recommended to be following
the PRECIS framework for usernames (rfc8265).
</p>
<p>The callback function will be called once per handshake.
</p>
<p>The callback function should return 0 on success.
-1 indicates an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction2-1"><span>gnutls_psk_set_client_credentials_function2<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_client_credentials_function2</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t <var class="var">cred</var>, gnutls_psk_client_credentials_function2 * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction2"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the username and
password for client PSK authentication.
The callback’s function form is:
int (*callback)(gnutls_session_t, gnutls_datum_t* username,
gnutls_datum_t* key);
</p>
<p>This callback function has the same semantics as that of <code class="code">gnutls_psk_set_client_credentials_function()</code> ,
but it allows non-string usernames to be used.
</p>
<p>The <code class="code">username</code> and <code class="code">key</code> ->data must be allocated using <code class="code">gnutls_malloc()</code> .
The <code class="code">username</code> should be an ASCII string or UTF-8
string. In case of a UTF-8 string it is recommended to be following
the PRECIS framework for usernames (rfc8265).
</p>
<p>The callback function will be called once per handshake.
</p>
<p>The callback function should return 0 on success.
-1 indicates an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction3-1"><span>gnutls_psk_set_client_credentials_function3<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction3"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_client_credentials_function3</strong> <code class="def-code-arguments">(gnutls_psk_client_credentials_t <var class="var">cred</var>, gnutls_psk_client_credentials_function3 * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction3"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the username and
password for client PSK authentication.
The callback’s function form is:
int (*callback)(gnutls_session_t, gnutls_datum_t* username,
gnutls_datum_t* key, gnutls_datum_t* context, gnutls_psk_key_flags *flags);
</p>
<p>This callback function has the same semantics as that of
<code class="code">gnutls_psk_set_client_credentials_function2()</code> , but it returns flags
associated with the key. The callback may import external PSK
using the method described in RFC 9258 by using
<code class="code">gnutls_psk_format_imported_identity()</code> .
</p>
<p>The data field of <code class="code">username</code> , <code class="code">key</code> , and <code class="code">context</code> must be allocated
using <code class="code">gnutls_malloc()</code> . The <code class="code">username</code> should be an ASCII string or
UTF-8 string. In case of a UTF-8 string it is recommended to be
following the PRECIS framework for usernames (rfc8265).
</p>
<p>The callback function will be called once per handshake.
</p>
<p>The callback function should return 0 on success.
-1 indicates an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fparams_005ffunction-1"><span>gnutls_psk_set_params_function<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fparams_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fparams_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fparams_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_params_function</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">res</var>, gnutls_params_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fparams_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_psk_server_credentials_t type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback in order for the server to get
the Diffie-Hellman or RSA parameters for PSK authentication. The
callback should return <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile-1"><span>gnutls_psk_set_server_credentials_file<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_set_server_credentials_file</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">res</var>, const char * <var class="var">password_file</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile-1"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">password_file</var>: is the PSK password file (passwd.psk)
</p>
<p>This function sets the password file, in a
<code class="code">gnutls_psk_server_credentials_t</code> type. This password file
holds usernames and keys and will be used for PSK authentication.
</p>
<p>Each entry in the file consists of a username, followed by a colon
(’:’) and a hex-encoded key. If the username contains a colon or
any other special character, it can be hex-encoded preceded by a
’#’.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction-1"><span>gnutls_psk_set_server_credentials_function<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_server_credentials_function</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">cred</var>, gnutls_psk_server_credentials_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the user’s PSK credentials.
The callback’s function form is:
int (*callback)(gnutls_session_t, const char* username,
gnutls_datum_t* key);
</p>
<p><code class="code">username</code> contains the actual username.
The <code class="code">key</code> must be filled in using the <code class="code">gnutls_malloc()</code> .
</p>
<p>In case the callback returned a negative number then gnutls will
assume that the username does not exist.
</p>
<p>The callback function will only be called once per handshake. The
callback function should return 0 on success, while -1 indicates
an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction2-1"><span>gnutls_psk_set_server_credentials_function2<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_server_credentials_function2</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">cred</var>, gnutls_psk_server_credentials_function2 <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction2"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the user’s PSK credentials.
The callback’s function form is:
int (*callback)(gnutls_session_t, const gnutls_datum_t* username,
gnutls_datum_t* key);
</p>
<p>This callback function has the same semantics as that of <code class="code">gnutls_psk_set_server_credentials_function()</code> ,
but it allows non-string usernames to be used.
</p>
<p><code class="code">username</code> contains the actual username.
The <code class="code">key</code> must be filled in using the <code class="code">gnutls_malloc()</code> .
</p>
<p>In case the callback returned a negative number then gnutls will
assume that the username does not exist.
</p>
<p>The callback function will only be called once per handshake. The
callback function should return 0 on success, while -1 indicates
an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction3-1"><span>gnutls_psk_set_server_credentials_function3<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction3"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_server_credentials_function3</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">cred</var>, gnutls_psk_server_credentials_function3 <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction3"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the user’s PSK credentials.
The callback’s function form is:
int (*callback)(gnutls_session_t, const gnutls_datum_t* username,
gnutls_datum_t* key, gnutls_psk_key_flags *flags);
</p>
<p>This callback function has the same semantics as that of
<code class="code">gnutls_psk_set_server_credentials_function2()</code> , but it returns flags
associated with the key. The callback may import external PSK
using the method described in RFC 9258 by using
<code class="code">gnutls_psk_format_imported_identity()</code> .
</p>
<p><code class="code">username</code> contains the actual username.
The <code class="code">key</code> must be filled in using the <code class="code">gnutls_malloc()</code> .
</p>
<p>In case the callback returned a negative number then gnutls will
assume that the username does not exist.
</p>
<p>The callback function will only be called once per handshake. The
callback function should return 0 on success, while -1 indicates
an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint-1"><span>gnutls_psk_set_server_credentials_hint<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_set_server_credentials_hint</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">res</var>, const char * <var class="var">hint</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_psk_server_credentials_t</code> type.
</p>
<p><var class="var">hint</var>: is the PSK identity hint string
</p>
<p>This function sets the identity hint, in a
<code class="code">gnutls_psk_server_credentials_t</code> type. This hint is sent to
the client to help it chose a good PSK credential (i.e., username
and password).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fdh_005fparams-1"><span>gnutls_psk_set_server_dh_params<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fdh_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fdh_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fdh_005fparams"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_server_dh_params</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">res</var>, gnutls_dh_params_t <var class="var">dh_params</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fdh_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_psk_server_credentials_t type
</p>
<p><var class="var">dh_params</var>: is a structure that holds Diffie-Hellman parameters.
</p>
<p>This function will set the Diffie-Hellman parameters for an
anonymous server to use. These parameters will be used in
Diffie-Hellman exchange with PSK cipher suites.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams-1"><span>gnutls_psk_set_server_known_dh_params<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_psk_set_server_known_dh_params</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">res</var>, gnutls_sec_param_t <var class="var">sec_param</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a gnutls_psk_server_credentials_t type
</p>
<p><var class="var">sec_param</var>: is an option of the <code class="code">gnutls_sec_param_t</code> enumeration
</p>
<p>This function will set the Diffie-Hellman parameters for a
PSK server to use. These parameters will be used in
Ephemeral Diffie-Hellman cipher suites and will be selected from
the FFDHE set of RFC7919 according to the security level provided.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpsk_005fset_005fserver_005fparams_005ffunction-1"><span>gnutls_psk_set_server_params_function<a class="copiable-link" href="#gnutls_005fpsk_005fset_005fserver_005fparams_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpsk_005fset_005fserver_005fparams_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpsk_005fset_005fserver_005fparams_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_psk_set_server_params_function</strong> <code class="def-code-arguments">(gnutls_psk_server_credentials_t <var class="var">res</var>, gnutls_params_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fpsk_005fset_005fserver_005fparams_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback in order for the server to get
the Diffie-Hellman parameters for PSK authentication. The callback
should return <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Deprecated:</strong> This function is unnecessary and discouraged on GnuTLS 3.6.0
or later. Since 3.6.0, DH parameters are negotiated
following RFC7919.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frandom_005fart-1"><span>gnutls_random_art<a class="copiable-link" href="#gnutls_005frandom_005fart-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frandom_005fart"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frandom_005fart"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_random_art</strong> <code class="def-code-arguments">(gnutls_random_art_t <var class="var">type</var>, const char * <var class="var">key_type</var>, unsigned int <var class="var">key_size</var>, void * <var class="var">fpr</var>, size_t <var class="var">fpr_size</var>, gnutls_datum_t * <var class="var">art</var>)</code><a class="copiable-link" href="#index-gnutls_005frandom_005fart"> ¶</a></span></dt>
<dd><p><var class="var">type</var>: The type of the random art (for now only <code class="code">GNUTLS_RANDOM_ART_OPENSSH</code> is supported)
</p>
<p><var class="var">key_type</var>: The type of the key (RSA, DSA etc.)
</p>
<p><var class="var">key_size</var>: The size of the key in bits
</p>
<p><var class="var">fpr</var>: The fingerprint of the key
</p>
<p><var class="var">fpr_size</var>: The size of the fingerprint
</p>
<p><var class="var">art</var>: The returned random art
</p>
<p>This function will convert a given fingerprint to an "artistic"
image. The returned image is allocated using <code class="code">gnutls_malloc()</code> , is
null-terminated but art->size will not account the terminating null.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frange_005fsplit-1"><span>gnutls_range_split<a class="copiable-link" href="#gnutls_005frange_005fsplit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frange_005fsplit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frange_005fsplit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_range_split</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_range_st * <var class="var">orig</var>, gnutls_range_st * <var class="var">next</var>, gnutls_range_st * <var class="var">remainder</var>)</code><a class="copiable-link" href="#index-gnutls_005frange_005fsplit"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">orig</var>: is the original range provided by the user
</p>
<p><var class="var">next</var>: is the returned range that can be conveyed in a TLS record
</p>
<p><var class="var">remainder</var>: is the returned remaining range
</p>
<p>This function should be used when it is required to hide the length
of very long data that cannot be directly provided to <code class="code">gnutls_record_send_range()</code> .
In that case this function should be called with the desired length
hiding range in <code class="code">orig</code> . The returned <code class="code">next</code> value should then be used in
the next call to <code class="code">gnutls_record_send_range()</code> with the partial data.
That process should be repeated until <code class="code">remainder</code> is (0,0).
</p>
<p><strong class="strong">Returns:</strong> 0 in case splitting succeeds, non zero in case of error.
Note that <code class="code">orig</code> is not changed, while the values of <code class="code">next</code> and <code class="code">remainder</code> are modified to store the resulting values.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005freauth-1"><span>gnutls_reauth<a class="copiable-link" href="#gnutls_005freauth-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005freauth"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005freauth"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_reauth</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005freauth"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function performs the post-handshake authentication
for TLS 1.3. The post-handshake authentication is initiated by the server
by calling this function. Clients respond when <code class="code">GNUTLS_E_REAUTH_REQUEST</code>
has been seen while receiving data.
</p>
<p>The non-fatal errors expected by this function are:
<code class="code">GNUTLS_E_INTERRUPTED</code> , <code class="code">GNUTLS_E_AGAIN</code> , as well as
<code class="code">GNUTLS_E_GOT_APPLICATION_DATA</code> when called on server side.
</p>
<p>The former two interrupt the authentication procedure due to the transport
layer being interrupted, and the latter because there were pending data prior
to peer initiating the re-authentication. The server should read/process that
data as unauthenticated and retry calling <code class="code">gnutls_reauth()</code> .
</p>
<p>When this function is called under TLS1.2 or earlier or the peer didn’t
advertise post-handshake auth, it always fails with
<code class="code">GNUTLS_E_INVALID_REQUEST</code> . The verification of the received peers certificate
is delegated to the session or credentials verification callbacks. A
server can check whether post handshake authentication is supported
by the client by checking the session flags with <code class="code">gnutls_session_get_flags()</code> .
</p>
<p>Prior to calling this function in server side, the function
<code class="code">gnutls_certificate_server_set_request()</code> must be called setting expectations
for the received certificate (request or require). If none are set
this function will return with <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p>Note that post handshake authentication is available irrespective
of the initial negotiation type (PSK or certificate). In all cases
however, certificate credentials must be set to the session prior
to calling this function.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on a successful authentication, otherwise a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fcan_005fuse_005flength_005fhiding-1"><span>gnutls_record_can_use_length_hiding<a class="copiable-link" href="#gnutls_005frecord_005fcan_005fuse_005flength_005fhiding-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fcan_005fuse_005flength_005fhiding"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fcan_005fuse_005flength_005fhiding"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_record_can_use_length_hiding</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fcan_005fuse_005flength_005fhiding"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>If the session supports length-hiding padding, you can
invoke <code class="code">gnutls_record_send_range()</code> to send a message whose
length is hidden in the given range. If the session does not
support length hiding padding, you can use the standard
<code class="code">gnutls_record_send()</code> function, or <code class="code">gnutls_record_send_range()</code>
making sure that the range is the same as the length of the
message you are trying to send.
</p>
<p><strong class="strong">Returns:</strong> true (1) if the current session supports length-hiding
padding, false (0) if the current session does not.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fcheck_005fcorked-1"><span>gnutls_record_check_corked<a class="copiable-link" href="#gnutls_005frecord_005fcheck_005fcorked-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fcheck_005fcorked"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fcheck_005fcorked"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_check_corked</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fcheck_005fcorked"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function checks if there pending corked
data in the gnutls buffers –see <code class="code">gnutls_record_cork()</code> .
</p>
<p><strong class="strong">Returns:</strong> Returns the size of the corked data or zero.
</p>
<p><strong class="strong">Since:</strong> 3.2.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fcheck_005fpending-1"><span>gnutls_record_check_pending<a class="copiable-link" href="#gnutls_005frecord_005fcheck_005fpending-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fcheck_005fpending"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fcheck_005fpending-1"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_check_pending</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fcheck_005fpending-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function checks if there are unread data
in the gnutls buffers. If the return value is
non-zero the next call to <code class="code">gnutls_record_recv()</code>
is guaranteed not to block.
</p>
<p><strong class="strong">Returns:</strong> Returns the size of the data or zero.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fcork-1"><span>gnutls_record_cork<a class="copiable-link" href="#gnutls_005frecord_005fcork-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fcork"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fcork-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_record_cork</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fcork-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>If called, <code class="code">gnutls_record_send()</code> will no longer send any records.
Any sent records will be cached until <code class="code">gnutls_record_uncork()</code> is called.
</p>
<p>This function is safe to use with DTLS after GnuTLS 3.3.0.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fdisable_005fpadding-1"><span>gnutls_record_disable_padding<a class="copiable-link" href="#gnutls_005frecord_005fdisable_005fpadding-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fdisable_005fpadding"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fdisable_005fpadding"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_record_disable_padding</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fdisable_005fpadding"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Used to disabled padding in TLS 1.0 and above. Normally you do not
need to use this function, but there are buggy clients that
complain if a server pads the encrypted data. This of course will
disable protection against statistical attacks on the data.
</p>
<p>This function is defunct since 3.1.7. Random padding is disabled
by default unless requested using <code class="code">gnutls_record_send_range()</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fdiscard_005fqueued-1"><span>gnutls_record_discard_queued<a class="copiable-link" href="#gnutls_005frecord_005fdiscard_005fqueued-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fdiscard_005fqueued"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fdiscard_005fqueued"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_discard_queued</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fdiscard_005fqueued"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function discards all queued to be sent packets in a DTLS session.
These are the packets queued after an interrupted <code class="code">gnutls_record_send()</code> .
</p>
<p>This function can only be used with transports where <code class="code">send()</code> is
an all-or-nothing operation (e.g., UDP). When partial writes are allowed
this function will cause session errors.
</p>
<p><strong class="strong">Returns:</strong> The number of bytes discarded.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fget_005fdirection-1"><span>gnutls_record_get_direction<a class="copiable-link" href="#gnutls_005frecord_005fget_005fdirection-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fget_005fdirection"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fget_005fdirection-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_record_get_direction</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fget_005fdirection-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function is useful to determine whether a GnuTLS function was interrupted
while sending or receiving, so that <code class="code">select()</code> or <code class="code">poll()</code> may be called appropriately.
</p>
<p>It provides information about the internals of the record
protocol and is only useful if a prior gnutls function call,
e.g. <code class="code">gnutls_handshake()</code> , was interrupted and returned
<code class="code">GNUTLS_E_INTERRUPTED</code> or <code class="code">GNUTLS_E_AGAIN</code> . After such an interrupt
applications may call <code class="code">select()</code> or <code class="code">poll()</code> before restoring the
interrupted GnuTLS function.
</p>
<p>This function’s output is unreliable if you are using the same
<code class="code">session</code> in different threads for sending and receiving.
</p>
<p><strong class="strong">Returns:</strong> 0 if interrupted while trying to read data, or 1 while trying to write data.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fget_005fmax_005fearly_005fdata_005fsize-1"><span>gnutls_record_get_max_early_data_size<a class="copiable-link" href="#gnutls_005frecord_005fget_005fmax_005fearly_005fdata_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fget_005fmax_005fearly_005fdata_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fget_005fmax_005fearly_005fdata_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_get_max_early_data_size</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fget_005fmax_005fearly_005fdata_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function returns the maximum early data size in this connection.
This property can only be set to servers. The client may be
provided with the maximum allowed size through the "early_data"
extension of the NewSessionTicket handshake message.
</p>
<p><strong class="strong">Returns:</strong> The maximum early data size in this connection.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fget_005fmax_005fsend_005fsize-1"><span>gnutls_record_get_max_send_size<a class="copiable-link" href="#gnutls_005frecord_005fget_005fmax_005fsend_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fget_005fmax_005fsend_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fget_005fmax_005fsend_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_get_max_send_size</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fget_005fmax_005fsend_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the maximum plaintext send size. This maybe negotiated, or user specified.
</p>
<p><strong class="strong">Returns:</strong> The maximum plaintext send size.
</p>
<p><strong class="strong">Since:</strong> 3.8.11
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fget_005fmax_005fsize-1"><span>gnutls_record_get_max_size<a class="copiable-link" href="#gnutls_005frecord_005fget_005fmax_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fget_005fmax_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fget_005fmax_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_get_max_size</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fget_005fmax_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the record size. The maximum record size is negotiated by the
client after the first handshake message.
</p>
<p><strong class="strong">Returns:</strong> The maximum record packet size in this connection.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fget_005fstate-1"><span>gnutls_record_get_state<a class="copiable-link" href="#gnutls_005frecord_005fget_005fstate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fget_005fstate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fget_005fstate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_record_get_state</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">read</var>, gnutls_datum_t * <var class="var">mac_key</var>, gnutls_datum_t * <var class="var">IV</var>, gnutls_datum_t * <var class="var">cipher_key</var>, unsigned char [8] <var class="var">seq_number</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fget_005fstate"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">read</var>: if non-zero the read parameters are returned, otherwise the write
</p>
<p><var class="var">mac_key</var>: the key used for MAC (if a MAC is used)
</p>
<p><var class="var">IV</var>: the initialization vector or nonce used
</p>
<p><var class="var">cipher_key</var>: the cipher key
</p>
<p><var class="var">seq_number</var>: A 64-bit sequence number
</p>
<p>This function will return the parameters of the current record state.
These are only useful to be provided to an external off-loading device
or subsystem. The returned values should be considered constant
and valid for the lifetime of the session.
</p>
<p>In that case, to sync the state back you must call <code class="code">gnutls_record_set_state()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p>Since 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005foverhead_005fsize-1"><span>gnutls_record_overhead_size<a class="copiable-link" href="#gnutls_005frecord_005foverhead_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005foverhead_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005foverhead_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_record_overhead_size</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005foverhead_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is <code class="code">gnutls_session_t</code>
</p>
<p>This function will return the size in bytes of the overhead
due to TLS (or DTLS) per record. On certain occasions
(e.g., CBC ciphers) the returned value is the maximum
possible overhead.
</p>
<p><strong class="strong">Since:</strong> 3.2.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005frecv-1"><span>gnutls_record_recv<a class="copiable-link" href="#gnutls_005frecord_005frecv-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005frecv"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005frecv-1"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_recv</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005frecv-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: the buffer that the data will be read into
</p>
<p><var class="var">data_size</var>: the number of requested bytes
</p>
<p>This function has the similar semantics with <code class="code">recv()</code> . The only
difference is that it accepts a GnuTLS session, and uses different
error codes.
In the special case that the peer requests a renegotiation, the
caller will receive an error code of <code class="code">GNUTLS_E_REHANDSHAKE</code> . In case
of a client, this message may be simply ignored, replied with an alert
<code class="code">GNUTLS_A_NO_RENEGOTIATION</code> , or replied with a new handshake,
depending on the client’s will. A server receiving this error code
can only initiate a new handshake or terminate the session.
</p>
<p>If <code class="code">EINTR</code> is returned by the internal pull function (the default
is <code class="code">recv()</code> ) then <code class="code">GNUTLS_E_INTERRUPTED</code> will be returned. If
<code class="code">GNUTLS_E_INTERRUPTED</code> or <code class="code">GNUTLS_E_AGAIN</code> is returned, you must
call this function again to get the data. See also
<code class="code">gnutls_record_get_direction()</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of bytes received and zero on EOF (for stream
connections). A negative error code is returned in case of an error.
The number of bytes received might be less than the requested <code class="code">data_size</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005frecv_005fearly_005fdata-1"><span>gnutls_record_recv_early_data<a class="copiable-link" href="#gnutls_005frecord_005frecv_005fearly_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005frecv_005fearly_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005frecv_005fearly_005fdata"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_recv_early_data</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005frecv_005fearly_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: the buffer that the data will be read into
</p>
<p><var class="var">data_size</var>: the number of requested bytes
</p>
<p>This function can be used by a server to retrieve data sent early
in the handshake processes when resuming a session. This is used
to implement a zero-roundtrip (0-RTT) mode. It has the same
semantics as <code class="code">gnutls_record_recv()</code> .
</p>
<p>This function can be called either in a handshake hook, or after
the handshake is complete.
</p>
<p><strong class="strong">Returns:</strong> The number of bytes received and zero when early data
reading is complete. A negative error code is returned in case of
an error. If no early data is received during the handshake, this
function returns <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> . The
number of bytes received might be less than the requested
<code class="code">data_size</code> .
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005frecv_005fpacket-1"><span>gnutls_record_recv_packet<a class="copiable-link" href="#gnutls_005frecord_005frecv_005fpacket-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005frecv_005fpacket"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005frecv_005fpacket"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_recv_packet</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_packet_t * <var class="var">packet</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005frecv_005fpacket"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">packet</var>: the structure that will hold the packet data
</p>
<p>This is a lower-level function than <code class="code">gnutls_record_recv()</code> and allows
to directly receive the whole decrypted packet. That avoids a
memory copy, and is intended to be used by applications seeking high
performance.
</p>
<p>The received packet is accessed using <code class="code">gnutls_packet_get()</code> and
must be deinitialized using <code class="code">gnutls_packet_deinit()</code> . The returned
packet will be <code class="code">NULL</code> if the return value is zero (EOF).
</p>
<p><strong class="strong">Returns:</strong> The number of bytes received and zero on EOF (for stream
connections). A negative error code is returned in case of an error.
</p>
<p><strong class="strong">Since:</strong> 3.3.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005frecv_005fseq-1"><span>gnutls_record_recv_seq<a class="copiable-link" href="#gnutls_005frecord_005frecv_005fseq-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005frecv_005fseq"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005frecv_005fseq-1"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_recv_seq</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">data</var>, size_t <var class="var">data_size</var>, unsigned char * <var class="var">seq</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005frecv_005fseq-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: the buffer that the data will be read into
</p>
<p><var class="var">data_size</var>: the number of requested bytes
</p>
<p><var class="var">seq</var>: is the packet’s 64-bit sequence number. Should have space for 8 bytes.
</p>
<p>This function is the same as <code class="code">gnutls_record_recv()</code> , except that
it returns in addition to data, the sequence number of the data.
This is useful in DTLS where record packets might be received
out-of-order. The returned 8-byte sequence number is an
integer in big-endian format and should be
treated as a unique message identification.
</p>
<p><strong class="strong">Returns:</strong> The number of bytes received and zero on EOF. A negative
error code is returned in case of an error. The number of bytes
received might be less than <code class="code">data_size</code> .
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fsend-1"><span>gnutls_record_send<a class="copiable-link" href="#gnutls_005frecord_005fsend-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fsend"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fsend-1"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_send</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fsend-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: contains the data to send
</p>
<p><var class="var">data_size</var>: is the length of the data
</p>
<p>This function has the similar semantics with <code class="code">send()</code> . The only
difference is that it accepts a GnuTLS session, and uses different
error codes.
Note that if the send buffer is full, <code class="code">send()</code> will block this
function. See the <code class="code">send()</code> documentation for more information.
</p>
<p>You can replace the default push function which is <code class="code">send()</code> , by using
<code class="code">gnutls_transport_set_push_function()</code> .
</p>
<p>If the EINTR is returned by the internal push function
then <code class="code">GNUTLS_E_INTERRUPTED</code> will be returned. If
<code class="code">GNUTLS_E_INTERRUPTED</code> or <code class="code">GNUTLS_E_AGAIN</code> is returned, you must
call this function again with the exact same parameters, or provide a
<code class="code">NULL</code> pointer for <code class="code">data</code> and 0 for <code class="code">data_size</code> , in order to write the
same data as before. If you wish to discard the previous data instead
of retrying, you must call <code class="code">gnutls_record_discard_queued()</code> before
calling this function with different parameters. Note that the latter
works only on special transports (e.g., UDP).
cf. <code class="code">gnutls_record_get_direction()</code> .
</p>
<p>Note that in DTLS this function will return the <code class="code">GNUTLS_E_LARGE_PACKET</code>
error code if the send data exceed the data MTU value - as returned
by <code class="code">gnutls_dtls_get_data_mtu()</code> . The errno value EMSGSIZE
also maps to <code class="code">GNUTLS_E_LARGE_PACKET</code> .
Note that since 3.2.13 this function can be called under cork in DTLS
mode, and will refuse to send data over the MTU size by returning
<code class="code">GNUTLS_E_LARGE_PACKET</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of bytes sent, or a negative error code. The
number of bytes sent might be less than <code class="code">data_size</code> . The maximum
number of bytes this function can send in a single call depends
on the negotiated maximum record size.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fsend2-1"><span>gnutls_record_send2<a class="copiable-link" href="#gnutls_005frecord_005fsend2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fsend2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fsend2-1"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_send2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>, size_t <var class="var">pad</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fsend2-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: contains the data to send
</p>
<p><var class="var">data_size</var>: is the length of the data
</p>
<p><var class="var">pad</var>: padding to be added to the record
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function is identical to <code class="code">gnutls_record_send()</code> except that it
takes an extra argument to specify padding to be added the record.
To determine the maximum size of padding, use
<code class="code">gnutls_record_get_max_size()</code> and <code class="code">gnutls_record_overhead_size()</code> .
</p>
<p>Note that in order for GnuTLS to provide constant time processing
of padding and data in TLS1.3, the flag <code class="code">GNUTLS_SAFE_PADDING_CHECK</code>
must be used in <code class="code">gnutls_init()</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of bytes sent, or a negative error code. The
number of bytes sent might be less than <code class="code">data_size</code> . The maximum
number of bytes this function can send in a single call depends
on the negotiated maximum record size.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fsend_005fearly_005fdata-1"><span>gnutls_record_send_early_data<a class="copiable-link" href="#gnutls_005frecord_005fsend_005fearly_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fsend_005fearly_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fsend_005fearly_005fdata"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_send_early_data</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fsend_005fearly_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: contains the data to send
</p>
<p><var class="var">data_size</var>: is the length of the data
</p>
<p>This function can be used by a client to send data early in the
handshake processes when resuming a session. This is used to
implement a zero-roundtrip (0-RTT) mode. It has the same semantics
as <code class="code">gnutls_record_send()</code> .
</p>
<p>There may be a limit to the amount of data sent as early data. Use
<code class="code">gnutls_record_get_max_early_data_size()</code> to check the limit. If the
limit exceeds, this function returns
<code class="code">GNUTLS_E_RECORD_LIMIT_REACHED</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of bytes sent, or a negative error code. The
number of bytes sent might be less than <code class="code">data_size</code> . The maximum
number of bytes this function can send in a single call depends
on the negotiated maximum record size.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fsend_005ffile-1"><span>gnutls_record_send_file<a class="copiable-link" href="#gnutls_005frecord_005fsend_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fsend_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fsend_005ffile"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_send_file</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">fd</var>, off_t * <var class="var">offset</var>, size_t <var class="var">count</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fsend_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">fd</var>: file descriptor from which to read data.
</p>
<p><var class="var">offset</var>: Is relative to file offset, denotes the starting location for
reading. after function returns, it point to position following
last read byte.
</p>
<p><var class="var">count</var>: is the length of the data in bytes to be read from file and send.
</p>
<p>This function sends data from <code class="code">fd</code> . If KTLS (kernel TLS) is enabled, it will
use the <code class="code">sendfile()</code> system call to avoid overhead of copying data between user
space and the kernel. Otherwise, this functionality is merely emulated by
calling <code class="code">read()</code> and <code class="code">gnutls_record_send()</code> . If this implementation is
suboptimal, check whether KTLS is enabled using
<code class="code">gnutls_transport_is_ktls_enabled()</code> .
</p>
<p>If <code class="code">offset</code> is NULL then file offset is incremented by number of bytes send,
otherwise file offset remains unchanged.
</p>
<p><strong class="strong">Returns:</strong> The number of bytes sent, or a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fsend_005frange-1"><span>gnutls_record_send_range<a class="copiable-link" href="#gnutls_005frecord_005fsend_005frange-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fsend_005frange"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fsend_005frange"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_send_range</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>, const gnutls_range_st * <var class="var">range</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fsend_005frange"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: contains the data to send.
</p>
<p><var class="var">data_size</var>: is the length of the data.
</p>
<p><var class="var">range</var>: is the range of lengths in which the real data length must be hidden.
</p>
<p>This function operates like <code class="code">gnutls_record_send()</code> but, while
<code class="code">gnutls_record_send()</code> adds minimal padding to each TLS record,
this function uses the TLS extra-padding feature to conceal the real
data size within the range of lengths provided.
Some TLS sessions do not support extra padding (e.g. stream ciphers in standard
TLS or SSL3 sessions). To know whether the current session supports extra
padding, and hence length hiding, use the <code class="code">gnutls_record_can_use_length_hiding()</code>
function.
</p>
<p><strong class="strong">Note:</strong> This function currently is limited to blocking sockets.
</p>
<p><strong class="strong">Returns:</strong> The number of bytes sent (that is data_size in a successful invocation),
or a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fset_005fmax_005fearly_005fdata_005fsize-1"><span>gnutls_record_set_max_early_data_size<a class="copiable-link" href="#gnutls_005frecord_005fset_005fmax_005fearly_005fdata_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fset_005fmax_005fearly_005fdata_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fset_005fmax_005fearly_005fdata_005fsize"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_record_set_max_early_data_size</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fset_005fmax_005fearly_005fdata_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">size</var>: is the new size
</p>
<p>This function sets the maximum early data size in this connection.
This property can only be set to servers. The client may be
provided with the maximum allowed size through the "early_data"
extension of the NewSessionTicket handshake message.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fset_005fmax_005frecv_005fsize-1"><span>gnutls_record_set_max_recv_size<a class="copiable-link" href="#gnutls_005frecord_005fset_005fmax_005frecv_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fset_005fmax_005frecv_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fset_005fmax_005frecv_005fsize"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_set_max_recv_size</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fset_005fmax_005frecv_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">size</var>: is the new size
</p>
<p>This function sets the maximum amount of plaintext received in a
record in this connection.
</p>
<p>The limit is also negotiated through a TLS extension called ’record
size limit’. Note that while the ’record size limit’ extension is
preferred, not all TLS implementations use or even understand the
extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fset_005fmax_005fsize-1"><span>gnutls_record_set_max_size<a class="copiable-link" href="#gnutls_005frecord_005fset_005fmax_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fset_005fmax_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fset_005fmax_005fsize"><span class="category-def">Function: </span><span><code class="def-type">ssize_t</code> <strong class="def-name">gnutls_record_set_max_size</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">size</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fset_005fmax_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">size</var>: is the new size
</p>
<p>This function sets the maximum amount of plaintext sent and
received in a record in this connection.
</p>
<p>Prior to 3.6.4, this function was implemented using a TLS extension
called ’max fragment length’, which limits the acceptable values to
512(=2^9), 1024(=2^10), 2048(=2^11) and 4096(=2^12).
</p>
<p>Since 3.6.4, the limit is also negotiated through a new TLS
extension called ’record size limit’, which doesn’t have the
limitation, as long as the value ranges between 512 and 16384.
Note that while the ’record size limit’ extension is preferred, not
all TLS implementations use or even understand the extension.
</p>
<p><strong class="strong">Deprecated:</strong> if the client can assume that the ’record size limit’
extension is supported by the server, we recommend using
<code class="code">gnutls_record_set_max_recv_size()</code> instead.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fset_005fstate-1"><span>gnutls_record_set_state<a class="copiable-link" href="#gnutls_005frecord_005fset_005fstate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fset_005fstate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fset_005fstate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_record_set_state</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">read</var>, const unsigned char [8] <var class="var">seq_number</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fset_005fstate"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">read</var>: if non-zero the read parameters are returned, otherwise the write
</p>
<p><var class="var">seq_number</var>: A 64-bit sequence number
</p>
<p>This function will set the sequence number in the current record state.
This function is useful if sending and receiving are offloaded from
gnutls. That is, if <code class="code">gnutls_record_get_state()</code> was used.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p>Since 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fset_005ftimeout-1"><span>gnutls_record_set_timeout<a class="copiable-link" href="#gnutls_005frecord_005fset_005ftimeout-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fset_005ftimeout"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fset_005ftimeout"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_record_set_timeout</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">ms</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fset_005ftimeout"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">ms</var>: is a timeout value in milliseconds
</p>
<p>This function sets the receive timeout for the record layer
to the provided value. Use an <code class="code">ms</code> value of zero to disable
timeout (the default), or <code class="code">GNUTLS_INDEFINITE_TIMEOUT</code> , to
set an indefinite timeout.
</p>
<p>This function requires to set a pull timeout callback. See
<code class="code">gnutls_transport_set_pull_timeout_function()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005funcork-1"><span>gnutls_record_uncork<a class="copiable-link" href="#gnutls_005frecord_005funcork-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005funcork"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005funcork-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_record_uncork</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005funcork-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">flags</var>: Could be zero or <code class="code">GNUTLS_RECORD_WAIT</code>
</p>
<p>This resets the effect of <code class="code">gnutls_record_cork()</code> , and flushes any pending
data. If the <code class="code">GNUTLS_RECORD_WAIT</code> flag is specified then this
function will block until the data is sent or a fatal error
occurs (i.e., the function will retry on <code class="code">GNUTLS_E_AGAIN</code> and
<code class="code">GNUTLS_E_INTERRUPTED</code> ).
</p>
<p>If the flag <code class="code">GNUTLS_RECORD_WAIT</code> is not specified and the function
is interrupted then the <code class="code">GNUTLS_E_AGAIN</code> or <code class="code">GNUTLS_E_INTERRUPTED</code>
errors will be returned. To obtain the data left in the corked
buffer use <code class="code">gnutls_record_check_corked()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success the number of transmitted data is returned, or
otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frehandshake-1"><span>gnutls_rehandshake<a class="copiable-link" href="#gnutls_005frehandshake-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frehandshake"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frehandshake-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_rehandshake</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frehandshake-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function can only be called in server side, and
instructs a TLS 1.2 or earlier client to renegotiate
parameters (perform a handshake), by sending a
hello request message.
</p>
<p>If this function succeeds, the calling application
should call <code class="code">gnutls_record_recv()</code> until <code class="code">GNUTLS_E_REHANDSHAKE</code>
is returned to clear any pending data. If the <code class="code">GNUTLS_E_REHANDSHAKE</code>
error code is not seen, then the handshake request was
not followed by the peer (the TLS protocol does not require
the client to do, and such compliance should be handled
by the application protocol).
</p>
<p>Once the <code class="code">GNUTLS_E_REHANDSHAKE</code> error code is seen, the
calling application should proceed to calling
<code class="code">gnutls_handshake()</code> to negotiate the new
parameters.
</p>
<p>If the client does not wish to renegotiate parameters he
may reply with an alert message, and in that case the return code seen
by subsequent <code class="code">gnutls_record_recv()</code> will be
<code class="code">GNUTLS_E_WARNING_ALERT_RECEIVED</code> with the specific alert being
<code class="code">GNUTLS_A_NO_RENEGOTIATION</code> . A client may also choose to ignore
this request.
</p>
<p>Under TLS 1.3 this function is equivalent to <code class="code">gnutls_session_key_update()</code>
with the <code class="code">GNUTLS_KU_PEER</code> flag. In that case subsequent calls to
<code class="code">gnutls_record_recv()</code> will not return <code class="code">GNUTLS_E_REHANDSHAKE</code> , and
calls to <code class="code">gnutls_handshake()</code> in server side are a no-op.
</p>
<p>This function always fails with <code class="code">GNUTLS_E_INVALID_REQUEST</code> when
called in client side.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsafe_005frenegotiation_005fstatus-1"><span>gnutls_safe_renegotiation_status<a class="copiable-link" href="#gnutls_005fsafe_005frenegotiation_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsafe_005frenegotiation_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsafe_005frenegotiation_005fstatus-1"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_safe_renegotiation_status</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsafe_005frenegotiation_005fstatus-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Can be used to check whether safe renegotiation is being used
in the current session.
</p>
<p><strong class="strong">Returns:</strong> 0 when safe renegotiation is not used and non (0) when
safe renegotiation is used.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsec_005fparam_005fget_005fname-1"><span>gnutls_sec_param_get_name<a class="copiable-link" href="#gnutls_005fsec_005fparam_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsec_005fparam_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsec_005fparam_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_sec_param_get_name</strong> <code class="def-code-arguments">(gnutls_sec_param_t <var class="var">param</var>)</code><a class="copiable-link" href="#index-gnutls_005fsec_005fparam_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">param</var>: is a security parameter
</p>
<p>Convert a <code class="code">gnutls_sec_param_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the name of the
specified security level, or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsec_005fparam_005fto_005fpk_005fbits-1"><span>gnutls_sec_param_to_pk_bits<a class="copiable-link" href="#gnutls_005fsec_005fparam_005fto_005fpk_005fbits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsec_005fparam_005fto_005fpk_005fbits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsec_005fparam_005fto_005fpk_005fbits-1"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_sec_param_to_pk_bits</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">algo</var>, gnutls_sec_param_t <var class="var">param</var>)</code><a class="copiable-link" href="#index-gnutls_005fsec_005fparam_005fto_005fpk_005fbits-1"> ¶</a></span></dt>
<dd><p><var class="var">algo</var>: is a public key algorithm
</p>
<p><var class="var">param</var>: is a security parameter
</p>
<p>When generating private and public key pairs a difficult question
is which size of "bits" the modulus will be in RSA and the group size
in DSA. The easy answer is 1024, which is also wrong. This function
will convert a human understandable security parameter to an
appropriate size for the specific algorithm.
</p>
<p><strong class="strong">Returns:</strong> The number of bits, or (0).
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsec_005fparam_005fto_005fsymmetric_005fbits-1"><span>gnutls_sec_param_to_symmetric_bits<a class="copiable-link" href="#gnutls_005fsec_005fparam_005fto_005fsymmetric_005fbits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsec_005fparam_005fto_005fsymmetric_005fbits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsec_005fparam_005fto_005fsymmetric_005fbits"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_sec_param_to_symmetric_bits</strong> <code class="def-code-arguments">(gnutls_sec_param_t <var class="var">param</var>)</code><a class="copiable-link" href="#index-gnutls_005fsec_005fparam_005fto_005fsymmetric_005fbits"> ¶</a></span></dt>
<dd><p><var class="var">param</var>: is a security parameter
</p>
<p>This function will return the number of bits that correspond to
symmetric cipher strength for the given security parameter.
</p>
<p><strong class="strong">Returns:</strong> The number of bits, or (0).
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fserver_005fname_005fget-1"><span>gnutls_server_name_get<a class="copiable-link" href="#gnutls_005fserver_005fname_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fserver_005fname_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fserver_005fname_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_server_name_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">data</var>, size_t * <var class="var">data_length</var>, unsigned int * <var class="var">type</var>, unsigned int <var class="var">indx</var>)</code><a class="copiable-link" href="#index-gnutls_005fserver_005fname_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: will hold the data
</p>
<p><var class="var">data_length</var>: will hold the data length. Must hold the maximum size of data.
</p>
<p><var class="var">type</var>: will hold the server name indicator type
</p>
<p><var class="var">indx</var>: is the index of the server_name
</p>
<p>This function will allow you to get the name indication (if any), a
client has sent. The name indication may be any of the enumeration
gnutls_server_name_type_t.
</p>
<p>If <code class="code">type</code> is GNUTLS_NAME_DNS, then this function is to be used by
servers that support virtual hosting, and the data will be a null
terminated IDNA ACE string (prior to GnuTLS 3.4.0 it was a UTF-8 string).
</p>
<p>If <code class="code">data</code> has not enough size to hold the server name
GNUTLS_E_SHORT_MEMORY_BUFFER is returned, and <code class="code">data_length</code> will
hold the required size.
</p>
<p><code class="code">indx</code> is used to retrieve more than one server names (if sent by
the client). The first server name has an index of 0, the second 1
and so on. If no name with the given index exists
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, on UTF-8
decoding error <code class="code">GNUTLS_E_IDNA_ERROR</code> is returned, otherwise a negative
error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fserver_005fname_005fset-1"><span>gnutls_server_name_set<a class="copiable-link" href="#gnutls_005fserver_005fname_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fserver_005fname_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fserver_005fname_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_server_name_set</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_server_name_type_t <var class="var">type</var>, const void * <var class="var">name</var>, size_t <var class="var">name_length</var>)</code><a class="copiable-link" href="#index-gnutls_005fserver_005fname_005fset"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">type</var>: specifies the indicator type
</p>
<p><var class="var">name</var>: is a string that contains the server name.
</p>
<p><var class="var">name_length</var>: holds the length of name excluding the terminating null byte
</p>
<p>This function is to be used by clients that want to inform (via a
TLS extension mechanism) the server of the name they connected to.
This should be used by clients that connect to servers that do
virtual hosting.
</p>
<p>The value of <code class="code">name</code> depends on the <code class="code">type</code> type. In case of
<code class="code">GNUTLS_NAME_DNS</code> , a UTF-8 null-terminated domain name string,
without the trailing dot, is expected.
</p>
<p>IPv4 or IPv6 addresses are not permitted to be set by this function.
If the function is called with a name of <code class="code">name_length</code> zero it will clear
all server names set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fchannel_005fbinding-1"><span>gnutls_session_channel_binding<a class="copiable-link" href="#gnutls_005fsession_005fchannel_005fbinding-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fchannel_005fbinding"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fchannel_005fbinding"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_channel_binding</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_channel_binding_t <var class="var">cbtype</var>, gnutls_datum_t * <var class="var">cb</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fchannel_005fbinding"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">cbtype</var>: an <code class="code">gnutls_channel_binding_t</code> enumeration type
</p>
<p><var class="var">cb</var>: output buffer array with data
</p>
<p>Extract given channel binding data of the <code class="code">cbtype</code> (e.g.,
<code class="code">GNUTLS_CB_TLS_UNIQUE</code> ) type.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success,
<code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> if the <code class="code">cbtype</code> is unsupported,
<code class="code">GNUTLS_E_CHANNEL_BINDING_NOT_AVAILABLE</code> if the data is not
currently available, or an error code.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fenable_005fcompatibility_005fmode-1"><span>gnutls_session_enable_compatibility_mode<a class="copiable-link" href="#gnutls_005fsession_005fenable_005fcompatibility_005fmode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fenable_005fcompatibility_005fmode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fenable_005fcompatibility_005fmode"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_enable_compatibility_mode</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fenable_005fcompatibility_005fmode"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function can be used to disable certain (security) features in
TLS in order to maintain maximum compatibility with buggy
clients. Because several trade-offs with security are enabled,
if required they will be reported through the audit subsystem.
</p>
<p>Normally only servers that require maximum compatibility with
everything out there, need to call this function.
</p>
<p>Note that this function must be called after any call to gnutls_priority
functions.
</p>
<p><strong class="strong">Since:</strong> 2.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fetm_005fstatus-1"><span>gnutls_session_etm_status<a class="copiable-link" href="#gnutls_005fsession_005fetm_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fetm_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fetm_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_session_etm_status</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fetm_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the status of the encrypt-then-mac extension negotiation.
This is in accordance to rfc7366
</p>
<p><strong class="strong">Returns:</strong> Non-zero if the negotiation was successful or zero otherwise.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fext_005fmaster_005fsecret_005fstatus-1"><span>gnutls_session_ext_master_secret_status<a class="copiable-link" href="#gnutls_005fsession_005fext_005fmaster_005fsecret_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fext_005fmaster_005fsecret_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fext_005fmaster_005fsecret_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_session_ext_master_secret_status</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fext_005fmaster_005fsecret_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the status of the extended master secret extension negotiation.
This is in accordance to RFC7627. That information is also
available to the more generic <code class="code">gnutls_session_get_flags()</code> .
</p>
<p><strong class="strong">Returns:</strong> Non-zero if the negotiation was successful or zero otherwise.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fext_005fregister-1"><span>gnutls_session_ext_register<a class="copiable-link" href="#gnutls_005fsession_005fext_005fregister-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fext_005fregister"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fext_005fregister"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ext_register</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">name</var>, int <var class="var">id</var>, gnutls_ext_parse_type_t <var class="var">parse_point</var>, gnutls_ext_recv_func <var class="var">recv_func</var>, gnutls_ext_send_func <var class="var">send_func</var>, gnutls_ext_deinit_data_func <var class="var">deinit_func</var>, gnutls_ext_pack_func <var class="var">pack_func</var>, gnutls_ext_unpack_func <var class="var">unpack_func</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fext_005fregister"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: the session for which this extension will be set
</p>
<p><var class="var">name</var>: the name of the extension to register
</p>
<p><var class="var">id</var>: the numeric id of the extension
</p>
<p><var class="var">parse_point</var>: the parse type of the extension (see gnutls_ext_parse_type_t)
</p>
<p><var class="var">recv_func</var>: a function to receive the data
</p>
<p><var class="var">send_func</var>: a function to send the data
</p>
<p><var class="var">deinit_func</var>: a function deinitialize any private data
</p>
<p><var class="var">pack_func</var>: a function which serializes the extension’s private data (used on session packing for resumption)
</p>
<p><var class="var">unpack_func</var>: a function which will deserialize the extension’s private data
</p>
<p><var class="var">flags</var>: must be zero or flags from <code class="code">gnutls_ext_flags_t</code>
</p>
<p>This function will register a new extension type. The extension will be
only usable within the registered session. If the extension type
is already registered then <code class="code">GNUTLS_E_ALREADY_REGISTERED</code> will be returned,
unless the flag <code class="code">GNUTLS_EXT_FLAG_OVERRIDE_INTERNAL</code> is specified. The latter
flag when specified can be used to override certain extensions introduced
after 3.6.0. It is expected to be used by applications which handle
custom extensions that are not currently supported in GnuTLS, but direct
support for them may be added in the future.
</p>
<p>Each registered extension can store temporary data into the gnutls_session_t
structure using <code class="code">gnutls_ext_set_data()</code> , and they can be retrieved using
<code class="code">gnutls_ext_get_data()</code> .
</p>
<p>The validity of the extension registered can be given by the appropriate flags
of <code class="code">gnutls_ext_flags_t</code> . If no validity is given, then the registered extension
will be valid for client and TLS1.2 server hello (or encrypted extensions for TLS1.3).
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.5.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fforce_005fvalid-1"><span>gnutls_session_force_valid<a class="copiable-link" href="#gnutls_005fsession_005fforce_005fvalid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fforce_005fvalid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fforce_005fvalid"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_force_valid</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fforce_005fvalid"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Clears the invalid flag in a session. That means
that sessions were corrupt or invalid data were received
can be re-used. Use only when debugging or experimenting
with the TLS protocol. Should not be used in typical
applications.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fdata-1"><span>gnutls_session_get_data<a class="copiable-link" href="#gnutls_005fsession_005fget_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_get_data</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">session_data</var>, size_t * <var class="var">session_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">session_data</var>: is a pointer to space to hold the session.
</p>
<p><var class="var">session_data_size</var>: is the session_data’s size, or it will be set by the function.
</p>
<p>Returns all session parameters needed to be stored to support resumption,
in a pre-allocated buffer.
</p>
<p>See <code class="code">gnutls_session_get_data2()</code> for more information.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fdata2-1"><span>gnutls_session_get_data2<a class="copiable-link" href="#gnutls_005fsession_005fget_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_get_data2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">data</var>: is a pointer to a datum that will hold the session.
</p>
<p>Returns necessary parameters to support resumption. The client
should call this function and store the returned session data. A session
can be resumed later by calling <code class="code">gnutls_session_set_data()</code> with the returned
data. Note that under TLS 1.3, it is recommended for clients to use
session parameters only once, to prevent passive-observers from correlating
the different connections.
</p>
<p>The returned <code class="code">data</code> are allocated and must be released using <code class="code">gnutls_free()</code> .
</p>
<p>This function will fail if called prior to handshake completion. In
case of false start TLS, the handshake completes only after data have
been successfully received from the peer.
</p>
<p>Under TLS1.3 session resumption is possible only after a session ticket
is received by the client. To ensure that such a ticket has been received use
<code class="code">gnutls_session_get_flags()</code> and check for flag <code class="code">GNUTLS_SFLAGS_SESSION_TICKET</code> ;
if this flag is not set, this function will wait for a new ticket within
an estimated roundtrip, and if not received will return dummy data which
cannot lead to resumption.
</p>
<p>To get notified when new tickets are received by the server
use <code class="code">gnutls_handshake_set_hook_function()</code> to wait for <code class="code">GNUTLS_HANDSHAKE_NEW_SESSION_TICKET</code>
messages. Each call of <code class="code">gnutls_session_get_data2()</code> after a ticket is
received, will return session resumption data corresponding to the last
received ticket.
</p>
<p>Note that this function under TLS1.3 requires a callback to be set with
<code class="code">gnutls_transport_set_pull_timeout_function()</code> for successful operation. There
was a bug before 3.6.10 which could make this function fail if that callback
was not set. On later versions if not set, the function will return a successful
error code, but will return dummy data that cannot lead to a resumption.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fdesc-1"><span>gnutls_session_get_desc<a class="copiable-link" href="#gnutls_005fsession_005fget_005fdesc-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fdesc"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fdesc"><span class="category-def">Function: </span><span><code class="def-type">char *</code> <strong class="def-name">gnutls_session_get_desc</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fdesc"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This function returns a string describing the current session.
The string is null terminated and allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If initial negotiation is not complete when this function is called,
<code class="code">NULL</code> will be returned.
</p>
<p><strong class="strong">Returns:</strong> a description of the protocols and algorithms in the current session.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fflags-1"><span>gnutls_session_get_flags<a class="copiable-link" href="#gnutls_005fsession_005fget_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fflags"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_session_get_flags</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return a series (ORed) of flags, applicable
for the current session.
</p>
<p>This replaces individual informational functions such as
<code class="code">gnutls_safe_renegotiation_status()</code> , <code class="code">gnutls_session_ext_master_secret_status()</code> ,
etc.
</p>
<p><strong class="strong">Returns:</strong> An ORed sequence of flags (see <code class="code">gnutls_session_flags_t</code> )
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fid-1"><span>gnutls_session_get_id<a class="copiable-link" href="#gnutls_005fsession_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_get_id</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">session_id</var>, size_t * <var class="var">session_id_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">session_id</var>: is a pointer to space to hold the session id.
</p>
<p><var class="var">session_id_size</var>: initially should contain the maximum <code class="code">session_id</code> size and will be updated.
</p>
<p>Returns the TLS session identifier. The session ID is selected by the
server, and in older versions of TLS was a unique identifier shared
between client and server which was persistent across resumption.
In the latest version of TLS (1.3) or TLS with session tickets, the
notion of session identifiers is undefined and cannot be relied for uniquely
identifying sessions across client and server.
</p>
<p>In client side this function returns the identifier returned by the
server, and cannot be assumed to have any relation to session resumption.
In server side this function is guaranteed to return a persistent
identifier of the session since GnuTLS 3.6.4, which may not necessarily
map into the TLS session ID value. Prior to that version the value
could only be considered a persistent identifier, under TLS1.2 or earlier
and when no session tickets were in use.
</p>
<p>The session identifier value returned is always less than
<code class="code">GNUTLS_MAX_SESSION_ID_SIZE</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fid2-1"><span>gnutls_session_get_id2<a class="copiable-link" href="#gnutls_005fsession_005fget_005fid2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fid2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fid2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_get_id2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">session_id</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fid2-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">session_id</var>: will point to the session ID.
</p>
<p>Returns the TLS session identifier. The session ID is selected by the
server, and in older versions of TLS was a unique identifier shared
between client and server which was persistent across resumption.
In the latest version of TLS (1.3) or TLS 1.2 with session tickets, the
notion of session identifiers is undefined and cannot be relied for uniquely
identifying sessions across client and server.
</p>
<p>In client side this function returns the identifier returned by the
server, and cannot be assumed to have any relation to session resumption.
In server side this function is guaranteed to return a persistent
identifier of the session since GnuTLS 3.6.4, which may not necessarily
map into the TLS session ID value. Prior to that version the value
could only be considered a persistent identifier, under TLS1.2 or earlier
and when no session tickets were in use.
</p>
<p>The session identifier value returned is always less than
<code class="code">GNUTLS_MAX_SESSION_ID_SIZE</code> and should be treated as constant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fkeylog_005ffunction-1"><span>gnutls_session_get_keylog_function<a class="copiable-link" href="#gnutls_005fsession_005fget_005fkeylog_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fkeylog_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fkeylog_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">gnutls_keylog_func</code> <strong class="def-name">gnutls_session_get_keylog_function</strong> <code class="def-code-arguments">(const gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fkeylog_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is <code class="code">gnutls_session_t</code> type
</p>
<p>This function will return the callback function set using
<code class="code">gnutls_session_set_keylog_function()</code> .
</p>
<p><strong class="strong">Returns:</strong> The function set or <code class="code">NULL</code> otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.6.13
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fmaster_005fsecret-1"><span>gnutls_session_get_master_secret<a class="copiable-link" href="#gnutls_005fsession_005fget_005fmaster_005fsecret-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fmaster_005fsecret"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fmaster_005fsecret"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_get_master_secret</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">secret</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fmaster_005fsecret"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">secret</var>: the session’s master secret
</p>
<p>This function returns pointers to the master secret
used in the TLS session. The pointers are not to be modified or deallocated.
</p>
<p>This function is only applicable under TLS 1.2 or earlier versions.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fptr-1"><span>gnutls_session_get_ptr<a class="copiable-link" href="#gnutls_005fsession_005fget_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void *</code> <strong class="def-name">gnutls_session_get_ptr</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get user pointer for session. Useful in callbacks. This is the
pointer set with <code class="code">gnutls_session_set_ptr()</code> .
</p>
<p><strong class="strong">Returns:</strong> the user given pointer from the session structure, or
<code class="code">NULL</code> if it was never set.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005frandom-1"><span>gnutls_session_get_random<a class="copiable-link" href="#gnutls_005fsession_005fget_005frandom-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005frandom"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005frandom"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_get_random</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">client</var>, gnutls_datum_t * <var class="var">server</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005frandom"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">client</var>: the client part of the random
</p>
<p><var class="var">server</var>: the server part of the random
</p>
<p>This function returns pointers to the client and server
random fields used in the TLS handshake. The pointers are
not to be modified or deallocated.
</p>
<p>If a client random value has not yet been established, the output
will be garbage.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fget_005fverify_005fcert_005fstatus-1"><span>gnutls_session_get_verify_cert_status<a class="copiable-link" href="#gnutls_005fsession_005fget_005fverify_005fcert_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fget_005fverify_005fcert_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fget_005fverify_005fcert_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_session_get_verify_cert_status</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fget_005fverify_005fcert_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This function returns the status of the verification when initiated
via auto-verification, i.e., by <code class="code">gnutls_session_set_verify_cert2()</code> or
<code class="code">gnutls_session_set_verify_cert()</code> . If no certificate verification
was occurred then the return value would be set to ((unsigned int)-1).
</p>
<p>The certificate verification status is the same as in <code class="code">gnutls_certificate_verify_peers()</code> .
</p>
<p><strong class="strong">Returns:</strong> the certificate verification status.
</p>
<p><strong class="strong">Since:</strong> 3.4.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fis_005fresumed-1"><span>gnutls_session_is_resumed<a class="copiable-link" href="#gnutls_005fsession_005fis_005fresumed-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fis_005fresumed"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fis_005fresumed-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_is_resumed</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fis_005fresumed-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Checks whether session is resumed or not. This is functional
for both server and client side.
</p>
<p><strong class="strong">Returns:</strong> non zero if this session is resumed, or a zero if this is
a new session.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fkey_005fupdate-1"><span>gnutls_session_key_update<a class="copiable-link" href="#gnutls_005fsession_005fkey_005fupdate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fkey_005fupdate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fkey_005fupdate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_key_update</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fkey_005fupdate"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">flags</var>: zero of <code class="code">GNUTLS_KU_PEER</code>
</p>
<p>This function will update/refresh the session keys when the
TLS protocol is 1.3 or better. The peer is notified of the
update by sending a message, so this function should be
treated similarly to <code class="code">gnutls_record_send()</code> –i.e., it may
return <code class="code">GNUTLS_E_AGAIN</code> or <code class="code">GNUTLS_E_INTERRUPTED</code> .
</p>
<p>When this flag <code class="code">GNUTLS_KU_PEER</code> is specified, this function
in addition to updating the local keys, will ask the peer to
refresh its keys too.
</p>
<p>If the negotiated version is not TLS 1.3 or better this
function will return <code class="code">GNUTLS_E_INVALID_REQUEST</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fresumption_005frequested-1"><span>gnutls_session_resumption_requested<a class="copiable-link" href="#gnutls_005fsession_005fresumption_005frequested-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fresumption_005frequested"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fresumption_005frequested-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_resumption_requested</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fresumption_005frequested-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Check whether the client has asked for session resumption.
This function is valid only on server side.
</p>
<p><strong class="strong">Returns:</strong> non zero if session resumption was asked, or a zero if not.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fdata-1"><span>gnutls_session_set_data<a class="copiable-link" href="#gnutls_005fsession_005fset_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_set_data</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const void * <var class="var">session_data</var>, size_t <var class="var">session_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">session_data</var>: is a pointer to space to hold the session.
</p>
<p><var class="var">session_data_size</var>: is the session’s size
</p>
<p>Sets all session parameters, in order to resume a previously
established session. The session data given must be the one
returned by <code class="code">gnutls_session_get_data()</code> . This function should be
called before <code class="code">gnutls_handshake()</code> .
</p>
<p>Keep in mind that session resuming is advisory. The server may
choose not to resume the session, thus a full handshake will be
performed.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fid-1"><span>gnutls_session_set_id<a class="copiable-link" href="#gnutls_005fsession_005fset_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_set_id</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_datum_t * <var class="var">sid</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fid"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">sid</var>: the session identifier
</p>
<p>This function sets the session ID to be used in a client hello.
This is a function intended for exceptional uses. Do not use this
function unless you are implementing a custom protocol.
</p>
<p>To set session resumption parameters use <code class="code">gnutls_session_set_data()</code> instead.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.2.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fkeylog_005ffunction-1"><span>gnutls_session_set_keylog_function<a class="copiable-link" href="#gnutls_005fsession_005fset_005fkeylog_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fkeylog_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fkeylog_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_set_keylog_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_keylog_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fkeylog_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is <code class="code">gnutls_session_t</code> type
</p>
<p><var class="var">func</var>: is the function to be called
</p>
<p>This function will set a callback to be called when a new secret is
derived and installed during handshake.
</p>
<p><strong class="strong">Since:</strong> 3.6.13
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fpremaster-1"><span>gnutls_session_set_premaster<a class="copiable-link" href="#gnutls_005fsession_005fset_005fpremaster-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fpremaster"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fpremaster"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_set_premaster</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">entity</var>, gnutls_protocol_t <var class="var">version</var>, gnutls_kx_algorithm_t <var class="var">kx</var>, gnutls_cipher_algorithm_t <var class="var">cipher</var>, gnutls_mac_algorithm_t <var class="var">mac</var>, gnutls_compression_method_t <var class="var">comp</var>, const gnutls_datum_t * <var class="var">master</var>, const gnutls_datum_t * <var class="var">session_id</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fpremaster"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">entity</var>: GNUTLS_SERVER or GNUTLS_CLIENT
</p>
<p><var class="var">version</var>: the TLS protocol version
</p>
<p><var class="var">kx</var>: the key exchange method
</p>
<p><var class="var">cipher</var>: the cipher
</p>
<p><var class="var">mac</var>: the MAC algorithm
</p>
<p><var class="var">comp</var>: the compression method (ignored)
</p>
<p><var class="var">master</var>: the master key to use
</p>
<p><var class="var">session_id</var>: the session identifier
</p>
<p>This function sets the premaster secret in a session. This is
a function intended for exceptional uses. Do not use this
function unless you are implementing a legacy protocol.
Use <code class="code">gnutls_session_set_data()</code> instead.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fptr-1"><span>gnutls_session_set_ptr<a class="copiable-link" href="#gnutls_005fsession_005fset_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_set_ptr</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">ptr</var>: is the user pointer
</p>
<p>This function will set (associate) the user given pointer <code class="code">ptr</code> to
the session structure. This pointer can be accessed with
<code class="code">gnutls_session_get_ptr()</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fverify_005fcert-1"><span>gnutls_session_set_verify_cert<a class="copiable-link" href="#gnutls_005fsession_005fset_005fverify_005fcert-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fverify_005fcert"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fverify_005fcert-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_set_verify_cert</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fverify_005fcert-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">hostname</var>: is the expected name of the peer; may be <code class="code">NULL</code>
</p>
<p><var class="var">flags</var>: flags for certificate verification – <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p>This function instructs GnuTLS to verify the peer’s certificate
using the provided hostname. If the verification fails the handshake
will also fail with <code class="code">GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR</code> . In that
case the verification result can be obtained using <code class="code">gnutls_session_get_verify_cert_status()</code> .
</p>
<p>The <code class="code">hostname</code> pointer provided must remain valid for the lifetime
of the session. More precisely it should be available during any subsequent
handshakes. If no hostname is provided, no hostname verification
will be performed. For a more advanced verification function check
<code class="code">gnutls_session_set_verify_cert2()</code> .
</p>
<p>If <code class="code">flags</code> is provided which contain a profile, this function should be
called after any session priority setting functions.
</p>
<p>The <code class="code">gnutls_session_set_verify_cert()</code> function is intended to be used by TLS
clients to verify the server’s certificate.
</p>
<p><strong class="strong">Since:</strong> 3.4.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fverify_005fcert2-1"><span>gnutls_session_set_verify_cert2<a class="copiable-link" href="#gnutls_005fsession_005fset_005fverify_005fcert2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fverify_005fcert2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fverify_005fcert2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_set_verify_cert2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_typed_vdata_st * <var class="var">data</var>, unsigned <var class="var">elements</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fverify_005fcert2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p><var class="var">data</var>: an array of typed data
</p>
<p><var class="var">elements</var>: the number of data elements
</p>
<p><var class="var">flags</var>: flags for certificate verification – <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p>This function instructs GnuTLS to verify the peer’s certificate
using the provided typed data information. If the verification fails the handshake
will also fail with <code class="code">GNUTLS_E_CERTIFICATE_VERIFICATION_ERROR</code> . In that
case the verification result can be obtained using <code class="code">gnutls_session_get_verify_cert_status()</code> .
</p>
<p>The acceptable typed data are the same as in <code class="code">gnutls_certificate_verify_peers()</code> ,
and once set must remain valid for the lifetime of the session. More precisely
they should be available during any subsequent handshakes.
</p>
<p>If <code class="code">flags</code> is provided which contain a profile, this function should be
called after any session priority setting functions.
</p>
<p><strong class="strong">Since:</strong> 3.4.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fverify_005ffunction-1"><span>gnutls_session_set_verify_function<a class="copiable-link" href="#gnutls_005fsession_005fset_005fverify_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fverify_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fverify_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_set_verify_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_certificate_verify_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fverify_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function sets a callback to be called when peer’s certificate
has been received in order to verify it on receipt rather than
doing after the handshake is completed. This overrides any callback
set using <code class="code">gnutls_certificate_set_verify_function()</code> .
</p>
<p>The callback’s function prototype is:
int (*callback)(gnutls_session_t);
</p>
<p>If the callback function is provided then gnutls will call it, in the
handshake, just after the certificate message has been received.
To verify or obtain the certificate the <code class="code">gnutls_certificate_verify_peers2()</code> ,
<code class="code">gnutls_certificate_type_get()</code> , <code class="code">gnutls_certificate_get_peers()</code> functions
can be used.
</p>
<p>The callback function should return 0 for the handshake to continue
or non-zero to terminate.
</p>
<p><strong class="strong">Since:</strong> 3.4.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fsupplemental_005fregister-1"><span>gnutls_session_supplemental_register<a class="copiable-link" href="#gnutls_005fsession_005fsupplemental_005fregister-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fsupplemental_005fregister"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fsupplemental_005fregister"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_supplemental_register</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">name</var>, gnutls_supplemental_data_format_type_t <var class="var">type</var>, gnutls_supp_recv_func <var class="var">recv_func</var>, gnutls_supp_send_func <var class="var">send_func</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fsupplemental_005fregister"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: the session for which this will be registered
</p>
<p><var class="var">name</var>: the name of the supplemental data to register
</p>
<p><var class="var">type</var>: the type of the supplemental data format
</p>
<p><var class="var">recv_func</var>: the function to receive the data
</p>
<p><var class="var">send_func</var>: the function to send the data
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will register a new supplemental data type (rfc4680).
The registered supplemental functions will be used for that specific
session. The provided <code class="code">type</code> must be an unassigned type in
<code class="code">gnutls_supplemental_data_format_type_t</code> .
</p>
<p>If the type is already registered or handled by GnuTLS internally
<code class="code">GNUTLS_E_ALREADY_REGISTERED</code> will be returned.
</p>
<p>As supplemental data are not defined under TLS 1.3, this function will
disable TLS 1.3 support for the given session.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.5.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fticket_005fenable_005fclient-1"><span>gnutls_session_ticket_enable_client<a class="copiable-link" href="#gnutls_005fsession_005fticket_005fenable_005fclient-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fticket_005fenable_005fclient"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fticket_005fenable_005fclient"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ticket_enable_client</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fticket_005fenable_005fclient"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Request that the client should attempt session resumption using
SessionTicket. This call is typically unnecessary as session
tickets are enabled by default.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fticket_005fenable_005fserver-1"><span>gnutls_session_ticket_enable_server<a class="copiable-link" href="#gnutls_005fsession_005fticket_005fenable_005fserver-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fticket_005fenable_005fserver"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fticket_005fenable_005fserver-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ticket_enable_server</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_datum_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fticket_005fenable_005fserver-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">key</var>: key to encrypt session parameters.
</p>
<p>Request that the server should attempt session resumption using
session tickets, i.e., by delegating storage to the client.
<code class="code">key</code> must be initialized using <code class="code">gnutls_session_ticket_key_generate()</code> .
To avoid leaking that key, use <code class="code">gnutls_memset()</code> prior to
releasing it.
</p>
<p>The default ticket expiration time can be overridden using
<code class="code">gnutls_db_set_cache_expiration()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fticket_005fkey_005fgenerate-1"><span>gnutls_session_ticket_key_generate<a class="copiable-link" href="#gnutls_005fsession_005fticket_005fkey_005fgenerate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fticket_005fkey_005fgenerate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fticket_005fkey_005fgenerate-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ticket_key_generate</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fticket_005fkey_005fgenerate-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: is a pointer to a <code class="code">gnutls_datum_t</code> which will contain a newly
created key.
</p>
<p>Generate a random key to encrypt security parameters within
SessionTicket.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fticket_005fsend-1"><span>gnutls_session_ticket_send<a class="copiable-link" href="#gnutls_005fsession_005fticket_005fsend-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fticket_005fsend"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fticket_005fsend-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_session_ticket_send</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">nr</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fticket_005fsend-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">nr</var>: the number of tickets to send
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>Sends a fresh session ticket to the peer. This is relevant only
in server side under TLS1.3. This function may also return <code class="code">GNUTLS_E_AGAIN</code>
or <code class="code">GNUTLS_E_INTERRUPTED</code> and in that case it must be called again.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fset_005fdefault_005fpriority-1"><span>gnutls_set_default_priority<a class="copiable-link" href="#gnutls_005fset_005fdefault_005fpriority-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fset_005fdefault_005fpriority"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fset_005fdefault_005fpriority"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_set_default_priority</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fset_005fdefault_005fpriority"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Sets the default priority on the ciphers, key exchange methods,
and macs. This is the recommended method of
setting the defaults, in order to promote consistency between applications
using GnuTLS, and to allow GnuTLS using applications to update settings
in par with the library. For client applications which require
maximum compatibility consider calling <code class="code">gnutls_session_enable_compatibility_mode()</code>
after this function.
</p>
<p>For an application to specify additional options to priority string
consider using <code class="code">gnutls_set_default_priority_append()</code> .
</p>
<p>To allow a user to override the defaults (e.g., when a user interface
or configuration file is available), the functions
<code class="code">gnutls_priority_set_direct()</code> or <code class="code">gnutls_priority_set()</code> can
be used.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p><strong class="strong">Since:</strong> 2.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fset_005fdefault_005fpriority_005fappend-1"><span>gnutls_set_default_priority_append<a class="copiable-link" href="#gnutls_005fset_005fdefault_005fpriority_005fappend-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fset_005fdefault_005fpriority_005fappend"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fset_005fdefault_005fpriority_005fappend"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_set_default_priority_append</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">add_prio</var>, const char ** <var class="var">err_pos</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fset_005fdefault_005fpriority_005fappend"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">add_prio</var>: is a string describing priorities to be appended to default
</p>
<p><var class="var">err_pos</var>: In case of an error this will have the position in the string the error occurred
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>Sets the default priority on the ciphers, key exchange methods,
and macs with the additional options in <code class="code">add_prio</code> . This is the recommended method of
setting the defaults when only few additional options are to be added. This promotes
consistency between applications using GnuTLS, and allows GnuTLS using applications
to update settings in par with the library.
</p>
<p>The <code class="code">add_prio</code> string should start as a normal priority string, e.g.,
’-VERS-TLS-ALL:+VERS-TLS1.3:%COMPAT’ or ’%FORCE_ETM’. That is, it must not start
with ’:’.
</p>
<p>To allow a user to override the defaults (e.g., when a user interface
or configuration file is available), the functions
<code class="code">gnutls_priority_set_direct()</code> or <code class="code">gnutls_priority_set()</code> can
be used.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005falgorithm_005fget-1"><span>gnutls_sign_algorithm_get<a class="copiable-link" href="#gnutls_005fsign_005falgorithm_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005falgorithm_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005falgorithm_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_sign_algorithm_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005falgorithm_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns the signature algorithm that is (or will be) used in this
session by the server to sign data. This function should be
used only with TLS 1.2 or later.
</p>
<p><strong class="strong">Returns:</strong> The sign algorithm or <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005falgorithm_005fget_005fclient-1"><span>gnutls_sign_algorithm_get_client<a class="copiable-link" href="#gnutls_005fsign_005falgorithm_005fget_005fclient-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005falgorithm_005fget_005fclient"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005falgorithm_005fget_005fclient"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_sign_algorithm_get_client</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005falgorithm_005fget_005fclient"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns the signature algorithm that is (or will be) used in this
session by the client to sign data. This function should be
used only with TLS 1.2 or later.
</p>
<p><strong class="strong">Returns:</strong> The sign algorithm or <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.11
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005falgorithm_005fget_005frequested-1"><span>gnutls_sign_algorithm_get_requested<a class="copiable-link" href="#gnutls_005fsign_005falgorithm_005fget_005frequested-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005falgorithm_005fget_005frequested"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005falgorithm_005fget_005frequested"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_sign_algorithm_get_requested</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, size_t <var class="var">indx</var>, gnutls_sign_algorithm_t * <var class="var">algo</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005falgorithm_005fget_005frequested"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">indx</var>: is an index of the signature algorithm to return
</p>
<p><var class="var">algo</var>: the returned certificate type will be stored there
</p>
<p>Returns the signature algorithm specified by index that was
requested by the peer. If the specified index has no data available
this function returns <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> . If
the negotiated TLS version does not support signature algorithms
then <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned even
for the first index. The first index is 0.
</p>
<p>This function is useful in the certificate callback functions
to assist in selecting the correct certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fget_005fhash_005falgorithm-1"><span>gnutls_sign_get_hash_algorithm<a class="copiable-link" href="#gnutls_005fsign_005fget_005fhash_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fget_005fhash_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fget_005fhash_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">gnutls_digest_algorithm_t</code> <strong class="def-name">gnutls_sign_get_hash_algorithm</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">sign</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fget_005fhash_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">sign</var>: is a signature algorithm
</p>
<p>This function returns the digest algorithm corresponding to
the given signature algorithms.
</p>
<p><strong class="strong">Since:</strong> 3.1.1
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_digest_algorithm_t</code> value, or <code class="code">GNUTLS_DIG_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fget_005fid-1"><span>gnutls_sign_get_id<a class="copiable-link" href="#gnutls_005fsign_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_sign_algorithm_t</code> <strong class="def-name">gnutls_sign_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a sign algorithm name
</p>
<p>The names are compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_sign_algorithm_t</code> value corresponding to
the specified algorithm, or <code class="code">GNUTLS_SIGN_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fget_005fname-1"><span>gnutls_sign_get_name<a class="copiable-link" href="#gnutls_005fsign_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_sign_get_name</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a sign algorithm
</p>
<p>Convert a <code class="code">gnutls_sign_algorithm_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified sign
algorithm, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fget_005foid-1"><span>gnutls_sign_get_oid<a class="copiable-link" href="#gnutls_005fsign_005fget_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fget_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fget_005foid"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_sign_get_oid</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">sign</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fget_005foid"> ¶</a></span></dt>
<dd><p><var class="var">sign</var>: is a sign algorithm
</p>
<p>Convert a <code class="code">gnutls_sign_algorithm_t</code> value to its object identifier.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the object identifier of the specified sign
algorithm, or <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fget_005fpk_005falgorithm-1"><span>gnutls_sign_get_pk_algorithm<a class="copiable-link" href="#gnutls_005fsign_005fget_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fget_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fget_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">gnutls_pk_algorithm_t</code> <strong class="def-name">gnutls_sign_get_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">sign</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fget_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">sign</var>: is a signature algorithm
</p>
<p>This function returns the public key algorithm corresponding to
the given signature algorithms. Note that there may be multiple
public key algorithms supporting a particular signature type;
when dealing with such algorithms use instead <code class="code">gnutls_sign_supports_pk_algorithm()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.1
</p>
<p><strong class="strong">Returns:</strong> return a <code class="code">gnutls_pk_algorithm_t</code> value, or <code class="code">GNUTLS_PK_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fis_005fsecure-1"><span>gnutls_sign_is_secure<a class="copiable-link" href="#gnutls_005fsign_005fis_005fsecure-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fis_005fsecure"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fis_005fsecure"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_sign_is_secure</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fis_005fsecure"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a sign algorithm
</p>
<p><strong class="strong">Returns:</strong> Non-zero if the provided signature algorithm is considered to be secure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fis_005fsecure2-1"><span>gnutls_sign_is_secure2<a class="copiable-link" href="#gnutls_005fsign_005fis_005fsecure2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fis_005fsecure2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fis_005fsecure2"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_sign_is_secure2</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">algorithm</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fis_005fsecure2"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a sign algorithm
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_SIGN_FLAG_SECURE_FOR_CERTS</code>
</p>
<p><strong class="strong">Returns:</strong> Non-zero if the provided signature algorithm is considered to be secure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005flist-1"><span>gnutls_sign_list<a class="copiable-link" href="#gnutls_005fsign_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_sign_algorithm_t *</code> <strong class="def-name">gnutls_sign_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of supported public key signature algorithms.
This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> a (0)-terminated list of <code class="code">gnutls_sign_algorithm_t</code>
integers indicating the available ciphers.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fset_005fsecure-1"><span>gnutls_sign_set_secure<a class="copiable-link" href="#gnutls_005fsign_005fset_005fsecure-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fset_005fsecure"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fset_005fsecure"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_sign_set_secure</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">sign</var>, unsigned int <var class="var">secure</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fset_005fsecure"> ¶</a></span></dt>
<dd><p><var class="var">sign</var>: the sign algorithm
</p>
<p><var class="var">secure</var>: whether to mark the sign algorithm secure
</p>
<p>Modify the previous system wide setting that marked <code class="code">sign</code> as secure
or insecure. Calling this function is allowed
only if allowlisting mode is set in the configuration file,
and only if the system-wide TLS priority string
has not been initialized yet.
The intended usage is to provide applications with a way
to expressly deviate from the distribution or site defaults
inherited from the configuration file.
The modification is composable with further modifications
performed through the priority string mechanism.
</p>
<p>This function is not thread-safe and is intended to be called
in the main thread at the beginning of the process execution.
</p>
<p>Even when <code class="code">secure</code> is true, <code class="code">sign</code> is not marked as secure for the
use in certificates. Use <code class="code">gnutls_sign_set_secure_for_certs()</code> to
mark it secure as well for certificates.
</p>
<p><strong class="strong">Returns:</strong> 0 on success or negative error code otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fset_005fsecure_005ffor_005fcerts-1"><span>gnutls_sign_set_secure_for_certs<a class="copiable-link" href="#gnutls_005fsign_005fset_005fsecure_005ffor_005fcerts-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fset_005fsecure_005ffor_005fcerts"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fset_005fsecure_005ffor_005fcerts"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_sign_set_secure_for_certs</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">sign</var>, unsigned int <var class="var">secure</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fset_005fsecure_005ffor_005fcerts"> ¶</a></span></dt>
<dd><p><var class="var">sign</var>: the sign algorithm
</p>
<p><var class="var">secure</var>: whether to mark the sign algorithm secure for certificates
</p>
<p>Modify the previous system wide setting that marked <code class="code">sign</code> as secure
or insecure for the use in certificates. Calling this function is allowed
only if allowlisting mode is set in the configuration file,
and only if the system-wide TLS priority string
has not been initialized yet.
The intended usage is to provide applications with a way
to expressly deviate from the distribution or site defaults
inherited from the configuration file.
The modification is composable with further modifications
performed through the priority string mechanism.
</p>
<p>This function is not thread-safe and is intended to be called
in the main thread at the beginning of the process execution.
When <code class="code">secure</code> is true, <code class="code">sign</code> is marked as secure for any use unlike
<code class="code">gnutls_sign_set_secure()</code> . Otherwise, it is marked as insecure only
for the use in certificates. Use <code class="code">gnutls_sign_set_secure()</code> to mark
it insecure for any uses.
</p>
<p><strong class="strong">Returns:</strong> 0 on success or negative error code otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsign_005fsupports_005fpk_005falgorithm-1"><span>gnutls_sign_supports_pk_algorithm<a class="copiable-link" href="#gnutls_005fsign_005fsupports_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsign_005fsupports_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsign_005fsupports_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_sign_supports_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_sign_algorithm_t <var class="var">sign</var>, gnutls_pk_algorithm_t <var class="var">pk</var>)</code><a class="copiable-link" href="#index-gnutls_005fsign_005fsupports_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">sign</var>: is a signature algorithm
</p>
<p><var class="var">pk</var>: is a public key algorithm
</p>
<p>This function returns non-zero if the public key algorithm corresponds to
the given signature algorithm. That is, if that signature can be generated
from the given private key algorithm.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p>
<p><strong class="strong">Returns:</strong> return non-zero when the provided algorithms are compatible.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fallocate_005fclient_005fcredentials-1"><span>gnutls_srp_allocate_client_credentials<a class="copiable-link" href="#gnutls_005fsrp_005fallocate_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fallocate_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fallocate_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_allocate_client_credentials</strong> <code class="def-code-arguments">(gnutls_srp_client_credentials_t * <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fallocate_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p>Allocate a gnutls_srp_client_credentials_t structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fallocate_005fserver_005fcredentials-1"><span>gnutls_srp_allocate_server_credentials<a class="copiable-link" href="#gnutls_005fsrp_005fallocate_005fserver_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fallocate_005fserver_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fallocate_005fserver_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_allocate_server_credentials</strong> <code class="def-code-arguments">(gnutls_srp_server_credentials_t * <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fallocate_005fserver_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a pointer to a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p>Allocate a gnutls_srp_server_credentials_t structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fbase64_005fdecode-1"><span>gnutls_srp_base64_decode<a class="copiable-link" href="#gnutls_005fsrp_005fbase64_005fdecode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fbase64_005fdecode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fbase64_005fdecode"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_base64_decode</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">b64_data</var>, char * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fbase64_005fdecode"> ¶</a></span></dt>
<dd><p><var class="var">b64_data</var>: contain the encoded data
</p>
<p><var class="var">result</var>: the place where decoded data will be copied
</p>
<p><var class="var">result_size</var>: holds the size of the result
</p>
<p>This function will decode the given encoded data, using the base64
encoding found in libsrp.
</p>
<p>Note that <code class="code">b64_data</code> should be null terminated.
</p>
<p>Warning! This base64 encoding is not the "standard" encoding, so
do not use it for non-SRP purposes.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the buffer given is not
long enough, or 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fbase64_005fdecode2-1"><span>gnutls_srp_base64_decode2<a class="copiable-link" href="#gnutls_005fsrp_005fbase64_005fdecode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fbase64_005fdecode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fbase64_005fdecode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_base64_decode2</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">b64_data</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fbase64_005fdecode2"> ¶</a></span></dt>
<dd><p><var class="var">b64_data</var>: contains the encoded data
</p>
<p><var class="var">result</var>: the place where decoded data lie
</p>
<p>This function will decode the given encoded data. The decoded data
will be allocated, and stored into result. It will decode using
the base64 algorithm as used in libsrp.
</p>
<p>You should use <code class="code">gnutls_free()</code> to free the returned data.
</p>
<p>Warning! This base64 encoding is not the "standard" encoding, so
do not use it for non-SRP purposes.
</p>
<p><strong class="strong">Returns:</strong> 0 on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fbase64_005fencode-1"><span>gnutls_srp_base64_encode<a class="copiable-link" href="#gnutls_005fsrp_005fbase64_005fencode-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fbase64_005fencode"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fbase64_005fencode"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_base64_encode</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">data</var>, char * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fbase64_005fencode"> ¶</a></span></dt>
<dd><p><var class="var">data</var>: contain the raw data
</p>
<p><var class="var">result</var>: the place where base64 data will be copied
</p>
<p><var class="var">result_size</var>: holds the size of the result
</p>
<p>This function will convert the given data to printable data, using
the base64 encoding, as used in the libsrp. This is the encoding
used in SRP password files. If the provided buffer is not long
enough GNUTLS_E_SHORT_MEMORY_BUFFER is returned.
</p>
<p>Warning! This base64 encoding is not the "standard" encoding, so
do not use it for non-SRP purposes.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the buffer given is not
long enough, or 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fbase64_005fencode2-1"><span>gnutls_srp_base64_encode2<a class="copiable-link" href="#gnutls_005fsrp_005fbase64_005fencode2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fbase64_005fencode2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fbase64_005fencode2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_base64_encode2</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">result</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fbase64_005fencode2"> ¶</a></span></dt>
<dd><p><var class="var">data</var>: contains the raw data
</p>
<p><var class="var">result</var>: will hold the newly allocated encoded data
</p>
<p>This function will convert the given data to printable data, using
the base64 encoding. This is the encoding used in SRP password
files. This function will allocate the required memory to hold
the encoded data.
</p>
<p>You should use <code class="code">gnutls_free()</code> to free the returned data.
</p>
<p>Warning! This base64 encoding is not the "standard" encoding, so
do not use it for non-SRP purposes.
</p>
<p><strong class="strong">Returns:</strong> 0 on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005ffree_005fclient_005fcredentials-1"><span>gnutls_srp_free_client_credentials<a class="copiable-link" href="#gnutls_005fsrp_005ffree_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005ffree_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005ffree_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_free_client_credentials</strong> <code class="def-code-arguments">(gnutls_srp_client_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005ffree_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_srp_client_credentials_t</code> type.
</p>
<p>Free a gnutls_srp_client_credentials_t structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005ffree_005fserver_005fcredentials-1"><span>gnutls_srp_free_server_credentials<a class="copiable-link" href="#gnutls_005fsrp_005ffree_005fserver_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005ffree_005fserver_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005ffree_005fserver_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_free_server_credentials</strong> <code class="def-code-arguments">(gnutls_srp_server_credentials_t <var class="var">sc</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005ffree_005fserver_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">sc</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p>Free a gnutls_srp_server_credentials_t structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fserver_005fget_005fusername-1"><span>gnutls_srp_server_get_username<a class="copiable-link" href="#gnutls_005fsrp_005fserver_005fget_005fusername-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fserver_005fget_005fusername"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fserver_005fget_005fusername"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_srp_server_get_username</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fserver_005fget_005fusername"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a gnutls session
</p>
<p>This function will return the username of the peer. This should
only be called in case of SRP authentication and in case of a
server. Returns NULL in case of an error.
</p>
<p><strong class="strong">Returns:</strong> SRP username of the peer, or NULL in case of error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fset_005fclient_005fcredentials-1"><span>gnutls_srp_set_client_credentials<a class="copiable-link" href="#gnutls_005fsrp_005fset_005fclient_005fcredentials-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fset_005fclient_005fcredentials"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fclient_005fcredentials"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_set_client_credentials</strong> <code class="def-code-arguments">(gnutls_srp_client_credentials_t <var class="var">res</var>, const char * <var class="var">username</var>, const char * <var class="var">password</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fclient_005fcredentials"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_srp_client_credentials_t</code> type.
</p>
<p><var class="var">username</var>: is the user’s userid
</p>
<p><var class="var">password</var>: is the user’s password
</p>
<p>This function sets the username and password, in a
<code class="code">gnutls_srp_client_credentials_t</code> type. Those will be used in
SRP authentication. <code class="code">username</code> should be an ASCII string or UTF-8
string. In case of a UTF-8 string it is recommended to be following
the PRECIS framework for usernames (rfc8265). The password can
be in ASCII format, or normalized using <code class="code">gnutls_utf8_password_normalize()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction-1"><span>gnutls_srp_set_client_credentials_function<a class="copiable-link" href="#gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_set_client_credentials_function</strong> <code class="def-code-arguments">(gnutls_srp_client_credentials_t <var class="var">cred</var>, gnutls_srp_client_credentials_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the
username and password for client SRP authentication. The
callback’s function form is:
</p>
<p>int (*callback)(gnutls_session_t, char** username, char**password);
</p>
<p>The <code class="code">username</code> and <code class="code">password</code> must be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p>The <code class="code">username</code> should be an ASCII string or UTF-8
string. In case of a UTF-8 string it is recommended to be following
the PRECIS framework for usernames (rfc8265). The password can
be in ASCII format, or normalized using <code class="code">gnutls_utf8_password_normalize()</code> .
</p>
<p>The callback function will be called once per handshake before the
initial hello message is sent.
</p>
<p>The callback should not return a negative error code the second
time called, since the handshake procedure will be aborted.
</p>
<p>The callback function should return 0 on success.
-1 indicates an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fset_005fprime_005fbits-1"><span>gnutls_srp_set_prime_bits<a class="copiable-link" href="#gnutls_005fsrp_005fset_005fprime_005fbits-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fset_005fprime_005fbits"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fprime_005fbits"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_set_prime_bits</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fprime_005fbits"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">bits</var>: is the number of bits
</p>
<p>This function sets the minimum accepted number of bits, for use in
an SRP key exchange. If zero, the default 2048 bits will be used.
</p>
<p>In the client side it sets the minimum accepted number of bits. If
a server sends a prime with less bits than that
<code class="code">GNUTLS_E_RECEIVED_ILLEGAL_PARAMETER</code> will be returned by the
handshake.
</p>
<p>This function has no effect in server side.
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile-1"><span>gnutls_srp_set_server_credentials_file<a class="copiable-link" href="#gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_set_server_credentials_file</strong> <code class="def-code-arguments">(gnutls_srp_server_credentials_t <var class="var">res</var>, const char * <var class="var">password_file</var>, const char * <var class="var">password_conf_file</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile-1"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p><var class="var">password_file</var>: is the SRP password file (tpasswd)
</p>
<p><var class="var">password_conf_file</var>: is the SRP password conf file (tpasswd.conf)
</p>
<p>This function sets the password files, in a
<code class="code">gnutls_srp_server_credentials_t</code> type. Those password files
hold usernames and verifiers and will be used for SRP
authentication.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction-1"><span>gnutls_srp_set_server_credentials_function<a class="copiable-link" href="#gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_set_server_credentials_function</strong> <code class="def-code-arguments">(gnutls_srp_server_credentials_t <var class="var">cred</var>, gnutls_srp_server_credentials_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function can be used to set a callback to retrieve the user’s
SRP credentials. The callback’s function form is:
</p>
<p>int (*callback)(gnutls_session_t, const char* username,
gnutls_datum_t *salt, gnutls_datum_t *verifier, gnutls_datum_t *generator,
gnutls_datum_t *prime);
</p>
<p><code class="code">username</code> contains the actual username.
The <code class="code">salt</code> , <code class="code">verifier</code> , <code class="code">generator</code> and <code class="code">prime</code> must be filled
in using the <code class="code">gnutls_malloc()</code> . For convenience <code class="code">prime</code> and <code class="code">generator</code> may also be one of the static parameters defined in gnutls.h.
</p>
<p>Initially, the data field is NULL in every <code class="code">gnutls_datum_t</code>
structure that the callback has to fill in. When the
callback is done GnuTLS deallocates all of those buffers
which are non-NULL, regardless of the return value.
</p>
<p>In order to prevent attackers from guessing valid usernames,
if a user does not exist, g and n values should be filled in
using a random user’s parameters. In that case the callback must
return the special value (1).
See <code class="code">gnutls_srp_set_server_fake_salt_seed</code> too.
If this is not required for your application, return a negative
number from the callback to abort the handshake.
</p>
<p>The callback function will only be called once per handshake.
The callback function should return 0 on success, while
-1 indicates an error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fset_005fserver_005ffake_005fsalt_005fseed-1"><span>gnutls_srp_set_server_fake_salt_seed<a class="copiable-link" href="#gnutls_005fsrp_005fset_005fserver_005ffake_005fsalt_005fseed-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fset_005fserver_005ffake_005fsalt_005fseed"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fset_005fserver_005ffake_005fsalt_005fseed"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_srp_set_server_fake_salt_seed</strong> <code class="def-code-arguments">(gnutls_srp_server_credentials_t <var class="var">cred</var>, const gnutls_datum_t * <var class="var">seed</var>, unsigned int <var class="var">salt_length</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fset_005fserver_005ffake_005fsalt_005fseed"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_srp_server_credentials_t</code> type
</p>
<p><var class="var">seed</var>: is the seed data, only needs to be valid until the function
returns; size of the seed must be greater than zero
</p>
<p><var class="var">salt_length</var>: is the length of the generated fake salts
</p>
<p>This function sets the seed that is used to generate salts for
invalid (non-existent) usernames.
</p>
<p>In order to prevent attackers from guessing valid usernames,
when a user does not exist gnutls generates a salt and a verifier
and proceeds with the protocol as usual.
The authentication will ultimately fail, but the client cannot tell
whether the username is valid (exists) or invalid.
</p>
<p>If an attacker learns the seed, given a salt (which is part of the
handshake) which was generated when the seed was in use, it can tell
whether or not the authentication failed because of an unknown username.
This seed cannot be used to reveal application data or passwords.
</p>
<p><code class="code">salt_length</code> should represent the salt length your application uses.
Generating fake salts longer than 20 bytes is not supported.
</p>
<p>By default the seed is a random value, different each time a
<code class="code">gnutls_srp_server_credentials_t</code> is allocated and fake salts are
16 bytes long.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrp_005fverifier-1"><span>gnutls_srp_verifier<a class="copiable-link" href="#gnutls_005fsrp_005fverifier-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrp_005fverifier"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrp_005fverifier-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srp_verifier</strong> <code class="def-code-arguments">(const char * <var class="var">username</var>, const char * <var class="var">password</var>, const gnutls_datum_t * <var class="var">salt</var>, const gnutls_datum_t * <var class="var">generator</var>, const gnutls_datum_t * <var class="var">prime</var>, gnutls_datum_t * <var class="var">res</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrp_005fverifier-1"> ¶</a></span></dt>
<dd><p><var class="var">username</var>: is the user’s name
</p>
<p><var class="var">password</var>: is the user’s password
</p>
<p><var class="var">salt</var>: should be some randomly generated bytes
</p>
<p><var class="var">generator</var>: is the generator of the group
</p>
<p><var class="var">prime</var>: is the group’s prime
</p>
<p><var class="var">res</var>: where the verifier will be stored.
</p>
<p>This function will create an SRP verifier, as specified in
RFC2945. The <code class="code">prime</code> and <code class="code">generator</code> should be one of the static
parameters defined in gnutls/gnutls.h or may be generated.
</p>
<p>The verifier will be allocated with <code class="code">gnutls_malloc</code> () and will be stored in
<code class="code">res</code> using binary format.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or an
error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fget_005fkeys-1"><span>gnutls_srtp_get_keys<a class="copiable-link" href="#gnutls_005fsrtp_005fget_005fkeys-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fget_005fkeys"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fget_005fkeys-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_get_keys</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, void * <var class="var">key_material</var>, unsigned int <var class="var">key_material_size</var>, gnutls_datum_t * <var class="var">client_key</var>, gnutls_datum_t * <var class="var">client_salt</var>, gnutls_datum_t * <var class="var">server_key</var>, gnutls_datum_t * <var class="var">server_salt</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fget_005fkeys-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">key_material</var>: Space to hold the generated key material
</p>
<p><var class="var">key_material_size</var>: The maximum size of the key material
</p>
<p><var class="var">client_key</var>: The master client write key, pointing inside the key material
</p>
<p><var class="var">client_salt</var>: The master client write salt, pointing inside the key material
</p>
<p><var class="var">server_key</var>: The master server write key, pointing inside the key material
</p>
<p><var class="var">server_salt</var>: The master server write salt, pointing inside the key material
</p>
<p>This is a helper function to generate the keying material for SRTP.
It requires the space of the key material to be pre-allocated (should be at least
2x the maximum key size and salt size). The <code class="code">client_key</code> , <code class="code">client_salt</code> , <code class="code">server_key</code> and <code class="code">server_salt</code> are convenience datums that point inside the key material. They may
be <code class="code">NULL</code> .
</p>
<p><strong class="strong">Returns:</strong> On success the size of the key material is returned,
otherwise, <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the buffer given is not
sufficient, or a negative error code.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fget_005fmki-1"><span>gnutls_srtp_get_mki<a class="copiable-link" href="#gnutls_005fsrtp_005fget_005fmki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fget_005fmki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fget_005fmki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_get_mki</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_datum_t * <var class="var">mki</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fget_005fmki"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">mki</var>: will hold the MKI
</p>
<p>This function exports the negotiated Master Key Identifier,
received by the peer if any. The returned value in <code class="code">mki</code> should be
treated as constant and valid only during the session’s lifetime.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fget_005fprofile_005fid-1"><span>gnutls_srtp_get_profile_id<a class="copiable-link" href="#gnutls_005fsrtp_005fget_005fprofile_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fget_005fprofile_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fget_005fprofile_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_get_profile_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>, gnutls_srtp_profile_t * <var class="var">profile</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fget_005fprofile_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: The name of the profile to look up
</p>
<p><var class="var">profile</var>: Will hold the profile id
</p>
<p>This function allows you to look up a profile based on a string.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fget_005fprofile_005fname-1"><span>gnutls_srtp_get_profile_name<a class="copiable-link" href="#gnutls_005fsrtp_005fget_005fprofile_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fget_005fprofile_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fget_005fprofile_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_srtp_get_profile_name</strong> <code class="def-code-arguments">(gnutls_srtp_profile_t <var class="var">profile</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fget_005fprofile_005fname"> ¶</a></span></dt>
<dd><p><var class="var">profile</var>: The profile to look up a string for
</p>
<p>This function allows you to get the corresponding name for a
SRTP protection profile.
</p>
<p><strong class="strong">Returns:</strong> On success, the name of a SRTP profile as a string,
otherwise NULL.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fget_005fselected_005fprofile-1"><span>gnutls_srtp_get_selected_profile<a class="copiable-link" href="#gnutls_005fsrtp_005fget_005fselected_005fprofile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fget_005fselected_005fprofile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fget_005fselected_005fprofile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_get_selected_profile</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_srtp_profile_t * <var class="var">profile</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fget_005fselected_005fprofile"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">profile</var>: will hold the profile
</p>
<p>This function allows you to get the negotiated SRTP profile.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fset_005fmki-1"><span>gnutls_srtp_set_mki<a class="copiable-link" href="#gnutls_005fsrtp_005fset_005fmki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fset_005fmki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fset_005fmki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_set_mki</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const gnutls_datum_t * <var class="var">mki</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fset_005fmki"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">mki</var>: holds the MKI
</p>
<p>This function sets the Master Key Identifier, to be
used by this session (if any).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fset_005fprofile-1"><span>gnutls_srtp_set_profile<a class="copiable-link" href="#gnutls_005fsrtp_005fset_005fprofile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fset_005fprofile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fset_005fprofile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_set_profile</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_srtp_profile_t <var class="var">profile</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fset_005fprofile"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">profile</var>: is the profile id to add.
</p>
<p>This function is to be used by both clients and servers, to declare
what SRTP profiles they support, to negotiate with the peer.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsrtp_005fset_005fprofile_005fdirect-1"><span>gnutls_srtp_set_profile_direct<a class="copiable-link" href="#gnutls_005fsrtp_005fset_005fprofile_005fdirect-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsrtp_005fset_005fprofile_005fdirect"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsrtp_005fset_005fprofile_005fdirect"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_srtp_set_profile_direct</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, const char * <var class="var">profiles</var>, const char ** <var class="var">err_pos</var>)</code><a class="copiable-link" href="#index-gnutls_005fsrtp_005fset_005fprofile_005fdirect"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">profiles</var>: is a string that contains the supported SRTP profiles,
separated by colons.
</p>
<p><var class="var">err_pos</var>: In case of an error this will have the position in the string the error occurred, may be NULL.
</p>
<p>This function is to be used by both clients and servers, to declare
what SRTP profiles they support, to negotiate with the peer.
</p>
<p><strong class="strong">Returns:</strong> On syntax error <code class="code">GNUTLS_E_INVALID_REQUEST</code> is returned,
<code class="code">GNUTLS_E_SUCCESS</code> on success, or an error code.
</p>
<p>Since 3.1.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fstore_005fcommitment-1"><span>gnutls_store_commitment<a class="copiable-link" href="#gnutls_005fstore_005fcommitment-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fstore_005fcommitment"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fstore_005fcommitment-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_store_commitment</strong> <code class="def-code-arguments">(const char * <var class="var">db_name</var>, gnutls_tdb_t <var class="var">tdb</var>, const char * <var class="var">host</var>, const char * <var class="var">service</var>, gnutls_digest_algorithm_t <var class="var">hash_algo</var>, const gnutls_datum_t * <var class="var">hash</var>, time_t <var class="var">expiration</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fstore_005fcommitment-1"> ¶</a></span></dt>
<dd><p><var class="var">db_name</var>: A file specifying the stored keys (use NULL for the default)
</p>
<p><var class="var">tdb</var>: A storage structure or NULL to use the default
</p>
<p><var class="var">host</var>: The peer’s name
</p>
<p><var class="var">service</var>: non-NULL if this key is specific to a service (e.g. http)
</p>
<p><var class="var">hash_algo</var>: The hash algorithm type
</p>
<p><var class="var">hash</var>: The raw hash
</p>
<p><var class="var">expiration</var>: The expiration time (use 0 to disable expiration)
</p>
<p><var class="var">flags</var>: should be 0 or <code class="code">GNUTLS_SCOMMIT_FLAG_ALLOW_BROKEN</code> .
</p>
<p>This function will store the provided hash commitment to
the list of stored public keys. The key with the given
hash will be considered valid until the provided expiration time.
</p>
<p>The <code class="code">tdb</code> variable if non-null specifies a custom backend for
the storage of entries. If it is NULL then the
default file backend will be used.
</p>
<p>Note that this function is not thread safe with the default backend.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fstore_005fpubkey-1"><span>gnutls_store_pubkey<a class="copiable-link" href="#gnutls_005fstore_005fpubkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fstore_005fpubkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fstore_005fpubkey-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_store_pubkey</strong> <code class="def-code-arguments">(const char * <var class="var">db_name</var>, gnutls_tdb_t <var class="var">tdb</var>, const char * <var class="var">host</var>, const char * <var class="var">service</var>, gnutls_certificate_type_t <var class="var">cert_type</var>, const gnutls_datum_t * <var class="var">cert</var>, time_t <var class="var">expiration</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fstore_005fpubkey-1"> ¶</a></span></dt>
<dd><p><var class="var">db_name</var>: A file specifying the stored keys (use NULL for the default)
</p>
<p><var class="var">tdb</var>: A storage structure or NULL to use the default
</p>
<p><var class="var">host</var>: The peer’s name
</p>
<p><var class="var">service</var>: non-NULL if this key is specific to a service (e.g. http)
</p>
<p><var class="var">cert_type</var>: The type of the certificate
</p>
<p><var class="var">cert</var>: The data of the certificate
</p>
<p><var class="var">expiration</var>: The expiration time (use 0 to disable expiration)
</p>
<p><var class="var">flags</var>: should be 0.
</p>
<p>This function will store a raw public-key or a public-key provided via
a raw (DER-encoded) certificate to the list of stored public keys. The key
will be considered valid until the provided expiration time.
</p>
<p>The <code class="code">tdb</code> variable if non-null specifies a custom backend for
the storage of entries. If it is NULL then the
default file backend will be used.
</p>
<p>Unless an alternative <code class="code">tdb</code> is provided, the storage format is a textual format
consisting of a line for each host with fields separated by ’|’. The contents of
the fields are a format-identifier which is set to ’g0’, the hostname that the
rest of the data applies to, the numeric port or host name, the expiration
time in seconds since the epoch (0 for no expiration), and a base64
encoding of the raw (DER) public key information (SPKI) of the peer.
</p>
<p>As of GnuTLS 3.6.6 this function also accepts raw public keys.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0.13
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fstrerror-1"><span>gnutls_strerror<a class="copiable-link" href="#gnutls_005fstrerror-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fstrerror"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fstrerror"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_strerror</strong> <code class="def-code-arguments">(int <var class="var">error</var>)</code><a class="copiable-link" href="#index-gnutls_005fstrerror"> ¶</a></span></dt>
<dd><p><var class="var">error</var>: is a GnuTLS error code, a negative error code
</p>
<p>This function is similar to strerror. The difference is that it
accepts an error number returned by a gnutls function; In case of
an unknown error a descriptive string is sent instead of <code class="code">NULL</code> .
</p>
<p>Error codes are always a negative error code.
</p>
<p><strong class="strong">Returns:</strong> A string explaining the GnuTLS error message.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fstrerror_005fname-1"><span>gnutls_strerror_name<a class="copiable-link" href="#gnutls_005fstrerror_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fstrerror_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fstrerror_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_strerror_name</strong> <code class="def-code-arguments">(int <var class="var">error</var>)</code><a class="copiable-link" href="#index-gnutls_005fstrerror_005fname"> ¶</a></span></dt>
<dd><p><var class="var">error</var>: is an error returned by a gnutls function.
</p>
<p>Return the GnuTLS error code define as a string. For example,
gnutls_strerror_name (GNUTLS_E_DH_PRIME_UNACCEPTABLE) will return
the string "GNUTLS_E_DH_PRIME_UNACCEPTABLE".
</p>
<p><strong class="strong">Returns:</strong> A string corresponding to the symbol name of the error
code.
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsupplemental_005fget_005fname-1"><span>gnutls_supplemental_get_name<a class="copiable-link" href="#gnutls_005fsupplemental_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsupplemental_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsupplemental_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_supplemental_get_name</strong> <code class="def-code-arguments">(gnutls_supplemental_data_format_type_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fsupplemental_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">type</var>: is a supplemental data format type
</p>
<p>Convert a <code class="code">gnutls_supplemental_data_format_type_t</code> value to a
string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified
supplemental data format type, or <code class="code">NULL</code> for unknown types.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsupplemental_005frecv-1"><span>gnutls_supplemental_recv<a class="copiable-link" href="#gnutls_005fsupplemental_005frecv-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsupplemental_005frecv"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsupplemental_005frecv"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_supplemental_recv</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">do_recv_supplemental</var>)</code><a class="copiable-link" href="#index-gnutls_005fsupplemental_005frecv"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">do_recv_supplemental</var>: non-zero in order to expect supplemental data
</p>
<p>This function is to be called by an extension handler to
instruct gnutls to attempt to receive supplemental data
during the handshake process.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsupplemental_005fregister-1"><span>gnutls_supplemental_register<a class="copiable-link" href="#gnutls_005fsupplemental_005fregister-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsupplemental_005fregister"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsupplemental_005fregister"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_supplemental_register</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>, gnutls_supplemental_data_format_type_t <var class="var">type</var>, gnutls_supp_recv_func <var class="var">recv_func</var>, gnutls_supp_send_func <var class="var">send_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsupplemental_005fregister"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: the name of the supplemental data to register
</p>
<p><var class="var">type</var>: the type of the supplemental data format
</p>
<p><var class="var">recv_func</var>: the function to receive the data
</p>
<p><var class="var">send_func</var>: the function to send the data
</p>
<p>This function will register a new supplemental data type (rfc4680).
The registered data will remain until <code class="code">gnutls_global_deinit()</code>
is called. The provided <code class="code">type</code> must be an unassigned type in
<code class="code">gnutls_supplemental_data_format_type_t</code> . If the type is already
registered or handled by GnuTLS internally <code class="code">GNUTLS_E_ALREADY_REGISTERED</code>
will be returned.
</p>
<p>This function is not thread safe. As supplemental data are not defined under
TLS 1.3, this function will disable TLS 1.3 support globally.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsupplemental_005fsend-1"><span>gnutls_supplemental_send<a class="copiable-link" href="#gnutls_005fsupplemental_005fsend-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsupplemental_005fsend"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsupplemental_005fsend"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_supplemental_send</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned <var class="var">do_send_supplemental</var>)</code><a class="copiable-link" href="#index-gnutls_005fsupplemental_005fsend"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">do_send_supplemental</var>: non-zero in order to send supplemental data
</p>
<p>This function is to be called by an extension handler to
instruct gnutls to send supplemental data during the handshake process.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsystem_005frecv_005ftimeout-1"><span>gnutls_system_recv_timeout<a class="copiable-link" href="#gnutls_005fsystem_005frecv_005ftimeout-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsystem_005frecv_005ftimeout"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsystem_005frecv_005ftimeout"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_system_recv_timeout</strong> <code class="def-code-arguments">(gnutls_transport_ptr_t <var class="var">ptr</var>, unsigned int <var class="var">ms</var>)</code><a class="copiable-link" href="#index-gnutls_005fsystem_005frecv_005ftimeout"> ¶</a></span></dt>
<dd><p><var class="var">ptr</var>: A file descriptor (wrapped in a gnutls_transport_ptr_t pointer)
</p>
<p><var class="var">ms</var>: The number of milliseconds to wait.
</p>
<p>Wait for data to be received from the provided socket ( <code class="code">ptr</code> ) within a
timeout period in milliseconds, using <code class="code">select()</code> on the provided <code class="code">ptr</code> .
</p>
<p>This function is provided as a helper for constructing custom
callbacks for <code class="code">gnutls_transport_set_pull_timeout_function()</code> ,
which can be used if you rely on socket file descriptors.
</p>
<p>Returns -1 on error, 0 on timeout, positive value if data are available for reading.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftdb_005fdeinit-1"><span>gnutls_tdb_deinit<a class="copiable-link" href="#gnutls_005ftdb_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftdb_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftdb_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_tdb_deinit</strong> <code class="def-code-arguments">(gnutls_tdb_t <var class="var">tdb</var>)</code><a class="copiable-link" href="#index-gnutls_005ftdb_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">tdb</var>: The structure to be deinitialized
</p>
<p>This function will deinitialize a public key trust storage structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftdb_005finit-1"><span>gnutls_tdb_init<a class="copiable-link" href="#gnutls_005ftdb_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftdb_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftdb_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tdb_init</strong> <code class="def-code-arguments">(gnutls_tdb_t * <var class="var">tdb</var>)</code><a class="copiable-link" href="#index-gnutls_005ftdb_005finit"> ¶</a></span></dt>
<dd><p><var class="var">tdb</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a public key trust storage structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftdb_005fset_005fstore_005fcommitment_005ffunc-1"><span>gnutls_tdb_set_store_commitment_func<a class="copiable-link" href="#gnutls_005ftdb_005fset_005fstore_005fcommitment_005ffunc-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftdb_005fset_005fstore_005fcommitment_005ffunc"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftdb_005fset_005fstore_005fcommitment_005ffunc"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_tdb_set_store_commitment_func</strong> <code class="def-code-arguments">(gnutls_tdb_t <var class="var">tdb</var>, gnutls_tdb_store_commitment_func <var class="var">cstore</var>)</code><a class="copiable-link" href="#index-gnutls_005ftdb_005fset_005fstore_005fcommitment_005ffunc"> ¶</a></span></dt>
<dd><p><var class="var">tdb</var>: The trust storage
</p>
<p><var class="var">cstore</var>: The commitment storage function
</p>
<p>This function will associate a commitment (hash) storage function with the
trust storage structure. The function is of the following form.
</p>
<p>int gnutls_tdb_store_commitment_func(const char* db_name, const char* host,
const char* service, time_t expiration,
gnutls_digest_algorithm_t, const gnutls_datum_t* hash);
</p>
<p>The <code class="code">db_name</code> should be used to pass any private data to this function.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftdb_005fset_005fstore_005ffunc-1"><span>gnutls_tdb_set_store_func<a class="copiable-link" href="#gnutls_005ftdb_005fset_005fstore_005ffunc-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftdb_005fset_005fstore_005ffunc"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftdb_005fset_005fstore_005ffunc"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_tdb_set_store_func</strong> <code class="def-code-arguments">(gnutls_tdb_t <var class="var">tdb</var>, gnutls_tdb_store_func <var class="var">store</var>)</code><a class="copiable-link" href="#index-gnutls_005ftdb_005fset_005fstore_005ffunc"> ¶</a></span></dt>
<dd><p><var class="var">tdb</var>: The trust storage
</p>
<p><var class="var">store</var>: The storage function
</p>
<p>This function will associate a storage function with the
trust storage structure. The function is of the following form.
</p>
<p>int gnutls_tdb_store_func(const char* db_name, const char* host,
const char* service, time_t expiration,
const gnutls_datum_t* pubkey);
</p>
<p>The <code class="code">db_name</code> should be used to pass any private data to this function.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftdb_005fset_005fverify_005ffunc-1"><span>gnutls_tdb_set_verify_func<a class="copiable-link" href="#gnutls_005ftdb_005fset_005fverify_005ffunc-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftdb_005fset_005fverify_005ffunc"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftdb_005fset_005fverify_005ffunc"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_tdb_set_verify_func</strong> <code class="def-code-arguments">(gnutls_tdb_t <var class="var">tdb</var>, gnutls_tdb_verify_func <var class="var">verify</var>)</code><a class="copiable-link" href="#index-gnutls_005ftdb_005fset_005fverify_005ffunc"> ¶</a></span></dt>
<dd><p><var class="var">tdb</var>: The trust storage
</p>
<p><var class="var">verify</var>: The verification function
</p>
<p>This function will associate a retrieval function with the
trust storage structure. The function is of the following form.
</p>
<p>int gnutls_tdb_verify_func(const char* db_name, const char* host,
const char* service, const gnutls_datum_t* pubkey);
</p>
<p>The verify function should return zero on a match, <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code>
if there is a mismatch and any other negative error code otherwise.
</p>
<p>The <code class="code">db_name</code> should be used to pass any private data to this function.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fget_005fint-1"><span>gnutls_transport_get_int<a class="copiable-link" href="#gnutls_005ftransport_005fget_005fint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fget_005fint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fget_005fint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_transport_get_int</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fget_005fint"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Used to get the first argument of the transport function (like
PUSH and PULL). This must have been set using
<code class="code">gnutls_transport_set_int()</code> .
</p>
<p><strong class="strong">Returns:</strong> The first argument of the transport function.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fget_005fint2-1"><span>gnutls_transport_get_int2<a class="copiable-link" href="#gnutls_005ftransport_005fget_005fint2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fget_005fint2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fget_005fint2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_get_int2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int * <var class="var">recv_int</var>, int * <var class="var">send_int</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fget_005fint2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">recv_int</var>: will hold the value for the pull function
</p>
<p><var class="var">send_int</var>: will hold the value for the push function
</p>
<p>Used to get the arguments of the transport functions (like PUSH
and PULL). These should have been set using
<code class="code">gnutls_transport_set_int2()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fget_005fptr-1"><span>gnutls_transport_get_ptr<a class="copiable-link" href="#gnutls_005ftransport_005fget_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fget_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fget_005fptr"><span class="category-def">Function: </span><span><code class="def-type">gnutls_transport_ptr_t</code> <strong class="def-name">gnutls_transport_get_ptr</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fget_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Used to get the first argument of the transport function (like
PUSH and PULL). This must have been set using
<code class="code">gnutls_transport_set_ptr()</code> .
</p>
<p><strong class="strong">Returns:</strong> The first argument of the transport function.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fget_005fptr2-1"><span>gnutls_transport_get_ptr2<a class="copiable-link" href="#gnutls_005ftransport_005fget_005fptr2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fget_005fptr2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fget_005fptr2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_get_ptr2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_transport_ptr_t * <var class="var">recv_ptr</var>, gnutls_transport_ptr_t * <var class="var">send_ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fget_005fptr2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">recv_ptr</var>: will hold the value for the pull function
</p>
<p><var class="var">send_ptr</var>: will hold the value for the push function
</p>
<p>Used to get the arguments of the transport functions (like PUSH
and PULL). These should have been set using
<code class="code">gnutls_transport_set_ptr2()</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fis_005fktls_005fenabled-1"><span>gnutls_transport_is_ktls_enabled<a class="copiable-link" href="#gnutls_005ftransport_005fis_005fktls_005fenabled-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fis_005fktls_005fenabled"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fis_005fktls_005fenabled"><span class="category-def">Function: </span><span><code class="def-type">gnutls_transport_ktls_enable_flags_t</code> <strong class="def-name">gnutls_transport_is_ktls_enabled</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fis_005fktls_005fenabled"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Checks if KTLS is now enabled and was properly inicialized.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_KTLS_RECV</code> , <code class="code">GNUTLS_KTLS_SEND</code> , <code class="code">GNUTLS_KTLS_DUPLEX</code> , otherwise 0
</p>
<p><strong class="strong">Since:</strong> 3.7.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005ferrno-1"><span>gnutls_transport_set_errno<a class="copiable-link" href="#gnutls_005ftransport_005fset_005ferrno-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005ferrno"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005ferrno-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_errno</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">err</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005ferrno-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">err</var>: error value to store in session-specific errno variable.
</p>
<p>Store <code class="code">err</code> in the session-specific errno variable. Useful values
for <code class="code">err</code> are EINTR, EAGAIN and EMSGSIZE, other values are treated will be
treated as real errors in the push/pull function.
</p>
<p>This function is useful in replacement push and pull functions set by
<code class="code">gnutls_transport_set_push_function()</code> and
<code class="code">gnutls_transport_set_pull_function()</code> under Windows, where the
replacements may not have access to the same <code class="code">errno</code> variable that is used by GnuTLS (e.g., the application is linked to
msvcr71.dll and gnutls is linked to msvcrt.dll).
</p>
<p>This function is unreliable if you are using the same
<code class="code">session</code> in different threads for sending and receiving.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005ferrno_005ffunction-1"><span>gnutls_transport_set_errno_function<a class="copiable-link" href="#gnutls_005ftransport_005fset_005ferrno_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005ferrno_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005ferrno_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_errno_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_errno_func <var class="var">errno_func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005ferrno_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">errno_func</var>: a callback function similar to <code class="code">write()</code>
</p>
<p>This is the function where you set a function to retrieve errno
after a failed push or pull operation.
</p>
<p><code class="code">errno_func</code> is of the form,
int (*gnutls_errno_func)(gnutls_transport_ptr_t);
and should return the errno.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fint-1"><span>gnutls_transport_set_int<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fint"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_int</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">fd</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fint"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">fd</var>: is the socket descriptor for the connection.
</p>
<p>This function sets the first argument of the transport function, such
as <code class="code">send()</code> and <code class="code">recv()</code> for the default callbacks using the
system’s socket API.
</p>
<p>This function is equivalent to calling <code class="code">gnutls_transport_set_ptr()</code>
with the descriptor, but requires no casts.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fint2-1"><span>gnutls_transport_set_int2<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fint2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fint2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fint2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_int2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">recv_fd</var>, int <var class="var">send_fd</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fint2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">recv_fd</var>: is socket descriptor for the pull function
</p>
<p><var class="var">send_fd</var>: is socket descriptor for the push function
</p>
<p>This function sets the first argument of the transport functions,
such as <code class="code">send()</code> and <code class="code">recv()</code> for the default callbacks using the
system’s socket API. With this function you can set two different
descriptors for receiving and sending.
</p>
<p>This function is equivalent to calling <code class="code">gnutls_transport_set_ptr2()</code>
with the descriptors, but requires no casts.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fptr-1"><span>gnutls_transport_set_ptr<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_ptr</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_transport_ptr_t <var class="var">ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">ptr</var>: is the value.
</p>
<p>Used to set the first argument of the transport function (for push
and pull callbacks). In berkeley style sockets this function will set the
connection descriptor.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fptr2-1"><span>gnutls_transport_set_ptr2<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fptr2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fptr2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fptr2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_ptr2</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_transport_ptr_t <var class="var">recv_ptr</var>, gnutls_transport_ptr_t <var class="var">send_ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fptr2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">recv_ptr</var>: is the value for the pull function
</p>
<p><var class="var">send_ptr</var>: is the value for the push function
</p>
<p>Used to set the first argument of the transport function (for push
and pull callbacks). In berkeley style sockets this function will set the
connection descriptor. With this function you can use two different
pointers for receiving and sending.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fpull_005ffunction-1"><span>gnutls_transport_set_pull_function<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fpull_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fpull_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fpull_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_pull_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_pull_func <var class="var">pull_func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fpull_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">pull_func</var>: a callback function similar to <code class="code">read()</code>
</p>
<p>This is the function where you set a function for gnutls to receive
data. Normally, if you use berkeley style sockets, do not need to
use this function since the default recv(2) will probably be ok.
The callback should return 0 on connection termination, a positive
number indicating the number of bytes received, and -1 on error.
</p>
<p><code class="code">gnutls_pull_func</code> is of the form,
ssize_t (*gnutls_pull_func)(gnutls_transport_ptr_t, void*, size_t);
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-1"><span>gnutls_transport_set_pull_timeout_function<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_pull_timeout_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_pull_timeout_func <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-2"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">func</var>: a callback function
</p>
<p>This is the function where you set a function for gnutls to know
whether data are ready to be received. It should wait for data a
given time frame in milliseconds. The callback should return 0 on
timeout, a positive number if data can be received, and -1 on error.
You’ll need to override this function if <code class="code">select()</code> is not suitable
for the provided transport calls.
</p>
<p>As with <code class="code">select()</code> , if the timeout value is zero the callback should return
zero if no data are immediately available. The special value
<code class="code">GNUTLS_INDEFINITE_TIMEOUT</code> indicates that the callback should wait indefinitely
for data.
</p>
<p><code class="code">gnutls_pull_timeout_func</code> is of the form,
int (*gnutls_pull_timeout_func)(gnutls_transport_ptr_t, unsigned int ms);
</p>
<p>This callback is necessary when <code class="code">gnutls_handshake_set_timeout()</code> or
<code class="code">gnutls_record_set_timeout()</code> are set, under TLS1.3 and for enforcing the DTLS
mode timeouts when in blocking mode.
</p>
<p>For compatibility with future GnuTLS versions this callback must be set when
a custom pull function is registered. The callback will not be used when the
session is in TLS mode with non-blocking sockets. That is, when <code class="code">GNUTLS_NONBLOCK</code>
is specified for a TLS session in <code class="code">gnutls_init()</code> .
</p>
<p>The helper function <code class="code">gnutls_system_recv_timeout()</code> is provided to
simplify writing callbacks.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fpush_005ffunction-1"><span>gnutls_transport_set_push_function<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fpush_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fpush_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fpush_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_push_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_push_func <var class="var">push_func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fpush_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">push_func</var>: a callback function similar to <code class="code">write()</code>
</p>
<p>This is the function where you set a push function for gnutls to
use in order to send data. If you are going to use berkeley style
sockets, you do not need to use this function since the default
send(2) will probably be ok. Otherwise you should specify this
function for gnutls to be able to send data.
The callback should return a positive number indicating the
bytes sent, and -1 on error.
</p>
<p><code class="code">push_func</code> is of the form,
ssize_t (*gnutls_push_func)(gnutls_transport_ptr_t, const void*, size_t);
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction-1"><span>gnutls_transport_set_vec_push_function<a class="copiable-link" href="#gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_vec_push_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_vec_push_func <var class="var">vec_func</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">vec_func</var>: a callback function similar to <code class="code">writev()</code>
</p>
<p>Using this function you can override the default writev(2)
function for gnutls to send data. Setting this callback
instead of <code class="code">gnutls_transport_set_push_function()</code> is recommended
since it introduces less overhead in the TLS handshake process.
</p>
<p><code class="code">vec_func</code> is of the form,
ssize_t (*gnutls_vec_push_func) (gnutls_transport_ptr_t, const giovec_t * iov, int iovcnt);
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005furl_005fis_005fsupported-1"><span>gnutls_url_is_supported<a class="copiable-link" href="#gnutls_005furl_005fis_005fsupported-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005furl_005fis_005fsupported"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005furl_005fis_005fsupported-1"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_url_is_supported</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>)</code><a class="copiable-link" href="#index-gnutls_005furl_005fis_005fsupported-1"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: A URI to be tested
</p>
<p>Check whether the provided <code class="code">url</code> is supported. Depending on the system libraries
GnuTLS may support pkcs11, tpmkey or other URLs.
</p>
<p><strong class="strong">Returns:</strong> return non-zero if the given URL is supported, and zero if
it is not known.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005futf8_005fpassword_005fnormalize-1"><span>gnutls_utf8_password_normalize<a class="copiable-link" href="#gnutls_005futf8_005fpassword_005fnormalize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005futf8_005fpassword_005fnormalize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005futf8_005fpassword_005fnormalize"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_utf8_password_normalize</strong> <code class="def-code-arguments">(const unsigned char * <var class="var">password</var>, unsigned <var class="var">plen</var>, gnutls_datum_t * <var class="var">out</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005futf8_005fpassword_005fnormalize"> ¶</a></span></dt>
<dd><p><var class="var">password</var>: contain the UTF-8 formatted password
</p>
<p><var class="var">plen</var>: the length of the provided password
</p>
<p><var class="var">out</var>: the result in an null-terminated allocated string
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will convert the provided UTF-8 password according
to the normalization rules in RFC7613.
</p>
<p>If the flag <code class="code">GNUTLS_UTF8_IGNORE_ERRS</code> is specified, any UTF-8 encoding
errors will be ignored, and in that case the output will be a copy of the input.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_INVALID_UTF8_STRING</code> on invalid UTF-8 data, or 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.5.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fverify_005fstored_005fpubkey-1"><span>gnutls_verify_stored_pubkey<a class="copiable-link" href="#gnutls_005fverify_005fstored_005fpubkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fverify_005fstored_005fpubkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fverify_005fstored_005fpubkey-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_verify_stored_pubkey</strong> <code class="def-code-arguments">(const char * <var class="var">db_name</var>, gnutls_tdb_t <var class="var">tdb</var>, const char * <var class="var">host</var>, const char * <var class="var">service</var>, gnutls_certificate_type_t <var class="var">cert_type</var>, const gnutls_datum_t * <var class="var">cert</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fverify_005fstored_005fpubkey-1"> ¶</a></span></dt>
<dd><p><var class="var">db_name</var>: A file specifying the stored keys (use NULL for the default)
</p>
<p><var class="var">tdb</var>: A storage structure or NULL to use the default
</p>
<p><var class="var">host</var>: The peer’s name
</p>
<p><var class="var">service</var>: non-NULL if this key is specific to a service (e.g. http)
</p>
<p><var class="var">cert_type</var>: The type of the certificate
</p>
<p><var class="var">cert</var>: The raw (der) data of the certificate
</p>
<p><var class="var">flags</var>: should be 0.
</p>
<p>This function will try to verify a raw public-key or a public-key provided via
a raw (DER-encoded) certificate using a list of stored public keys.
The <code class="code">service</code> field if non-NULL should be a port number.
</p>
<p>The <code class="code">db_name</code> variable if non-null specifies a custom backend for
the retrieval of entries. If it is NULL then the
default file backend will be used. In POSIX-like systems the
file backend uses the $HOME/.gnutls/known_hosts file.
</p>
<p>Note that if the custom storage backend is provided the
retrieval function should return <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code>
if the host/service pair is found but key doesn’t match,
<code class="code">GNUTLS_E_NO_CERTIFICATE_FOUND</code> if no such host/service with
the given key is found, and 0 if it was found. The storage
function should return 0 on success.
</p>
<p>As of GnuTLS 3.6.6 this function also verifies raw public keys.
</p>
<p><strong class="strong">Returns:</strong> If no associated public key is found
then <code class="code">GNUTLS_E_NO_CERTIFICATE_FOUND</code> will be returned. If a key
is found but does not match <code class="code">GNUTLS_E_CERTIFICATE_KEY_MISMATCH</code>
is returned. On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
or a negative error value on other errors.
</p>
<p><strong class="strong">Since:</strong> 3.0.13
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Datagram-TLS-API">
<div class="nav-panel">
<p>
Next: <a href="#X509-certificate-API" accesskey="n" rel="next"><abbr class="acronym">X.509</abbr> certificate API</a>, Previous: <a href="#Core-TLS-API" accesskey="p" rel="prev">Core TLS API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Datagram-TLS-API-1"><span>E.2 Datagram TLS API<a class="copiable-link" href="#Datagram-TLS-API-1"> ¶</a></span></h3>
<p>The prototypes for the following functions lie in
<samp class="file">gnutls/dtls.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005fdtls_005fcookie_005fsend-1"><span>gnutls_dtls_cookie_send<a class="copiable-link" href="#gnutls_005fdtls_005fcookie_005fsend-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fcookie_005fsend"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fcookie_005fsend"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dtls_cookie_send</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">key</var>, void * <var class="var">client_data</var>, size_t <var class="var">client_data_size</var>, gnutls_dtls_prestate_st * <var class="var">prestate</var>, gnutls_transport_ptr_t <var class="var">ptr</var>, gnutls_push_func <var class="var">push_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fcookie_005fsend"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: is a random key to be used at cookie generation
</p>
<p><var class="var">client_data</var>: contains data identifying the client (i.e. address)
</p>
<p><var class="var">client_data_size</var>: The size of client’s data
</p>
<p><var class="var">prestate</var>: The previous cookie returned by <code class="code">gnutls_dtls_cookie_verify()</code>
</p>
<p><var class="var">ptr</var>: A transport pointer to be used by <code class="code">push_func</code>
</p>
<p><var class="var">push_func</var>: A function that will be used to reply
</p>
<p>This function can be used to prevent denial of service
attacks to a DTLS server by requiring the client to
reply using a cookie sent by this function. That way
it can be ensured that a client we allocated resources
for (i.e. <code class="code">gnutls_session_t</code> ) is the one that the
original incoming packet was originated from.
</p>
<p>This function must be called at the first incoming packet,
prior to allocating any resources and must be succeeded
by <code class="code">gnutls_dtls_cookie_verify()</code> .
</p>
<p><strong class="strong">Returns:</strong> the number of bytes sent, or a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fcookie_005fverify-1"><span>gnutls_dtls_cookie_verify<a class="copiable-link" href="#gnutls_005fdtls_005fcookie_005fverify-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fcookie_005fverify"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fcookie_005fverify"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dtls_cookie_verify</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">key</var>, void * <var class="var">client_data</var>, size_t <var class="var">client_data_size</var>, void * <var class="var">_msg</var>, size_t <var class="var">msg_size</var>, gnutls_dtls_prestate_st * <var class="var">prestate</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fcookie_005fverify"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: is a random key to be used at cookie generation
</p>
<p><var class="var">client_data</var>: contains data identifying the client (i.e. address)
</p>
<p><var class="var">client_data_size</var>: The size of client’s data
</p>
<p><var class="var">_msg</var>: An incoming message that initiates a connection.
</p>
<p><var class="var">msg_size</var>: The size of the message.
</p>
<p><var class="var">prestate</var>: The cookie of this client.
</p>
<p>This function will verify the received message for
a valid cookie. If a valid cookie is returned then
it should be associated with the session using
<code class="code">gnutls_dtls_prestate_set()</code> ;
</p>
<p>This function must be called after <code class="code">gnutls_dtls_cookie_send()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success, or a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fget_005fdata_005fmtu-1"><span>gnutls_dtls_get_data_mtu<a class="copiable-link" href="#gnutls_005fdtls_005fget_005fdata_005fmtu-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fget_005fdata_005fmtu"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fget_005fdata_005fmtu"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_dtls_get_data_mtu</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fget_005fdata_005fmtu"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return the actual maximum transfer unit for
application data. I.e. DTLS headers are subtracted from the
actual MTU which is set using <code class="code">gnutls_dtls_set_mtu()</code> .
</p>
<p><strong class="strong">Returns:</strong> the maximum allowed transfer unit.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fget_005fmtu-1"><span>gnutls_dtls_get_mtu<a class="copiable-link" href="#gnutls_005fdtls_005fget_005fmtu-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fget_005fmtu"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fget_005fmtu"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_dtls_get_mtu</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fget_005fmtu"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return the MTU size as set with
<code class="code">gnutls_dtls_set_mtu()</code> . This is not the actual MTU
of data you can transmit. Use <code class="code">gnutls_dtls_get_data_mtu()</code>
for that reason.
</p>
<p><strong class="strong">Returns:</strong> the set maximum transfer unit.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fget_005ftimeout-1"><span>gnutls_dtls_get_timeout<a class="copiable-link" href="#gnutls_005fdtls_005fget_005ftimeout-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fget_005ftimeout"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fget_005ftimeout-1"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_dtls_get_timeout</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fget_005ftimeout-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>This function will return the milliseconds remaining
for a retransmission of the previously sent handshake
message. This function is useful when DTLS is used in
non-blocking mode, to estimate when to call <code class="code">gnutls_handshake()</code>
if no packets have been received.
</p>
<p><strong class="strong">Returns:</strong> the remaining time in milliseconds.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fprestate_005fset-1"><span>gnutls_dtls_prestate_set<a class="copiable-link" href="#gnutls_005fdtls_005fprestate_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fprestate_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fprestate_005fset"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_dtls_prestate_set</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_dtls_prestate_st * <var class="var">prestate</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fprestate_005fset"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: a new session
</p>
<p><var class="var">prestate</var>: contains the client’s prestate
</p>
<p>This function will associate the prestate acquired by
the cookie authentication with the client, with the newly
established session.
</p>
<p>This functions must be called after a successful <code class="code">gnutls_dtls_cookie_verify()</code>
and should be succeeded by the actual DTLS handshake using <code class="code">gnutls_handshake()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fset_005fdata_005fmtu-1"><span>gnutls_dtls_set_data_mtu<a class="copiable-link" href="#gnutls_005fdtls_005fset_005fdata_005fmtu-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fset_005fdata_005fmtu"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fset_005fdata_005fmtu"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_dtls_set_data_mtu</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">mtu</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fset_005fdata_005fmtu"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">mtu</var>: The maximum unencrypted transfer unit of the session
</p>
<p>This function will set the maximum size of the *unencrypted* records
which will be sent over a DTLS session. It is equivalent to calculating
the DTLS packet overhead with the current encryption parameters, and
calling <code class="code">gnutls_dtls_set_mtu()</code> with that value. In particular, this means
that you may need to call this function again after any negotiation or
renegotiation, in order to ensure that the MTU is still sufficient to
account for the new protocol overhead.
</p>
<p>In most cases you only need to call <code class="code">gnutls_dtls_set_mtu()</code> with
the maximum MTU of your transport layer.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success, or a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fset_005fmtu-1"><span>gnutls_dtls_set_mtu<a class="copiable-link" href="#gnutls_005fdtls_005fset_005fmtu-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fset_005fmtu"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fset_005fmtu"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_dtls_set_mtu</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">mtu</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fset_005fmtu"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">mtu</var>: The maximum transfer unit of the transport
</p>
<p>This function will set the maximum transfer unit of the transport
that DTLS packets are sent over. Note that this should exclude
the IP (or IPv6) and UDP headers. So for DTLS over IPv6 on an
Ethernet device with MTU 1500, the DTLS MTU set with this function
would be 1500 - 40 (IPV6 header) - 8 (UDP header) = 1452.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdtls_005fset_005ftimeouts-1"><span>gnutls_dtls_set_timeouts<a class="copiable-link" href="#gnutls_005fdtls_005fset_005ftimeouts-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdtls_005fset_005ftimeouts"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdtls_005fset_005ftimeouts"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_dtls_set_timeouts</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, unsigned int <var class="var">retrans_timeout</var>, unsigned int <var class="var">total_timeout</var>)</code><a class="copiable-link" href="#index-gnutls_005fdtls_005fset_005ftimeouts"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">retrans_timeout</var>: The time at which a retransmission will occur in milliseconds
</p>
<p><var class="var">total_timeout</var>: The time at which the connection will be aborted, in milliseconds.
</p>
<p>This function will set the timeouts required for the DTLS handshake
protocol. The retransmission timeout is the time after which a
message from the peer is not received, the previous messages will
be retransmitted. The total timeout is the time after which the
handshake will be aborted with <code class="code">GNUTLS_E_TIMEDOUT</code> .
</p>
<p>The DTLS protocol recommends the values of 1 sec and 60 seconds
respectively, and these are the default values.
</p>
<p>To disable retransmissions set a <code class="code">retrans_timeout</code> larger than the <code class="code">total_timeout</code> .
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frecord_005fget_005fdiscarded-1"><span>gnutls_record_get_discarded<a class="copiable-link" href="#gnutls_005frecord_005fget_005fdiscarded-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frecord_005fget_005fdiscarded"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frecord_005fget_005fdiscarded"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">gnutls_record_get_discarded</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005frecord_005fget_005fdiscarded"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Returns the number of discarded packets in a
DTLS connection.
</p>
<p><strong class="strong">Returns:</strong> The number of discarded packets.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="X509-certificate-API">
<div class="nav-panel">
<p>
Next: <a href="#PKCS-7-API" accesskey="n" rel="next"><abbr class="acronym">PKCS</abbr> 7 API</a>, Previous: <a href="#Datagram-TLS-API" accesskey="p" rel="prev">Datagram TLS API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="X_002e509-certificate-API"><span>E.3 <abbr class="acronym">X.509</abbr> certificate API<a class="copiable-link" href="#X_002e509-certificate-API"> ¶</a></span></h3>
<a class="index-entry-id" id="index-X_002e509-Functions"></a>
<p>The following functions are to be used for <abbr class="acronym">X.509</abbr> certificate handling.
Their prototypes lie in <samp class="file">gnutls/x509.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005fcertificate_005fget_005ftrust_005flist-1"><span>gnutls_certificate_get_trust_list<a class="copiable-link" href="#gnutls_005fcertificate_005fget_005ftrust_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fget_005ftrust_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fget_005ftrust_005flist"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_get_trust_list</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_x509_trust_list_t * <var class="var">tlist</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fget_005ftrust_005flist"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">tlist</var>: Location where to store the trust list.
</p>
<p>Obtains the list of trusted certificates stored in <code class="code">res</code> and writes a
pointer to it to the location <code class="code">tlist</code> . The pointer will point to memory
internal to <code class="code">res</code> , and must not be deinitialized. It will be automatically
deallocated when the <code class="code">res</code> structure is deinitialized.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005ftrust_005flist-1"><span>gnutls_certificate_set_trust_list<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005ftrust_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005ftrust_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005ftrust_005flist"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_trust_list</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, gnutls_x509_trust_list_t <var class="var">tlist</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005ftrust_005flist"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">tlist</var>: is a <code class="code">gnutls_x509_trust_list_t</code> type
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function sets a trust list in the gnutls_certificate_credentials_t type.
</p>
<p>Note that the <code class="code">tlist</code> will become part of the credentials
structure and must not be deallocated. It will be automatically deallocated
when the <code class="code">res</code> structure is deinitialized.
</p>
<p><strong class="strong">Since:</strong> 3.2.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fverification_005fprofile_005fget_005fid-1"><span>gnutls_certificate_verification_profile_get_id<a class="copiable-link" href="#gnutls_005fcertificate_005fverification_005fprofile_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fverification_005fprofile_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fverification_005fprofile_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_certificate_verification_profiles_t</code> <strong class="def-name">gnutls_certificate_verification_profile_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fverification_005fprofile_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a profile name
</p>
<p>Convert a string to a <code class="code">gnutls_certificate_verification_profiles_t</code> value. The names are
compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_certificate_verification_profiles_t</code> id of the specified profile,
or <code class="code">GNUTLS_PROFILE_UNKNOWN</code> on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fverification_005fprofile_005fget_005fname-1"><span>gnutls_certificate_verification_profile_get_name<a class="copiable-link" href="#gnutls_005fcertificate_005fverification_005fprofile_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fverification_005fprofile_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fverification_005fprofile_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_certificate_verification_profile_get_name</strong> <code class="def-code-arguments">(gnutls_certificate_verification_profiles_t <var class="var">id</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fverification_005fprofile_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">id</var>: is a profile ID
</p>
<p>Convert a <code class="code">gnutls_certificate_verification_profiles_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified profile or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs8_005finfo-1"><span>gnutls_pkcs8_info<a class="copiable-link" href="#gnutls_005fpkcs8_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs8_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs8_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs8_info</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int * <var class="var">schema</var>, unsigned int * <var class="var">cipher</var>, void * <var class="var">salt</var>, unsigned int * <var class="var">salt_size</var>, unsigned int * <var class="var">iter_count</var>, char ** <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs8_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">data</var>: Holds the PKCS <code class="code">8</code> data
</p>
<p><var class="var">format</var>: the format of the PKCS <code class="code">8</code> data
</p>
<p><var class="var">schema</var>: indicate the schema as one of <code class="code">gnutls_pkcs_encrypt_flags_t</code>
</p>
<p><var class="var">cipher</var>: the cipher used as <code class="code">gnutls_cipher_algorithm_t</code>
</p>
<p><var class="var">salt</var>: PBKDF2 salt (if non-NULL then <code class="code">salt_size</code> initially holds its size)
</p>
<p><var class="var">salt_size</var>: PBKDF2 salt size
</p>
<p><var class="var">iter_count</var>: PBKDF2 iteration count
</p>
<p><var class="var">oid</var>: if non-NULL it will contain an allocated null-terminated variable with the OID
</p>
<p>This function will provide information on the algorithms used
in a particular PKCS <code class="code">8</code> structure. If the structure algorithms
are unknown the code <code class="code">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code> will be returned,
and only <code class="code">oid</code> , will be set. That is, <code class="code">oid</code> will be set on encrypted PKCS <code class="code">8</code>
structures whether supported or not. It must be deinitialized using <code class="code">gnutls_free()</code> .
The other variables are only set on supported structures.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_INVALID_REQUEST</code> if the provided structure isn’t an encrypted key,
<code class="code">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code> if the structure’s encryption isn’t supported, or
another negative error code in case of a failure. Zero on success.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs_005fschema_005fget_005fname-1"><span>gnutls_pkcs_schema_get_name<a class="copiable-link" href="#gnutls_005fpkcs_005fschema_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs_005fschema_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs_005fschema_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_pkcs_schema_get_name</strong> <code class="def-code-arguments">(unsigned int <var class="var">schema</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs_005fschema_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">schema</var>: Holds the PKCS <code class="code">12</code> or PBES2 schema (<code class="code">gnutls_pkcs_encrypt_flags_t</code> )
</p>
<p>This function will return a human readable description of the
PKCS12 or PBES2 schema.
</p>
<p><strong class="strong">Returns:</strong> a constraint string or <code class="code">NULL</code> on error.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs_005fschema_005fget_005foid-1"><span>gnutls_pkcs_schema_get_oid<a class="copiable-link" href="#gnutls_005fpkcs_005fschema_005fget_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs_005fschema_005fget_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs_005fschema_005fget_005foid"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_pkcs_schema_get_oid</strong> <code class="def-code-arguments">(unsigned int <var class="var">schema</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs_005fschema_005fget_005foid"> ¶</a></span></dt>
<dd><p><var class="var">schema</var>: Holds the PKCS <code class="code">12</code> or PBES2 schema (<code class="code">gnutls_pkcs_encrypt_flags_t</code> )
</p>
<p>This function will return the object identifier of the
PKCS12 or PBES2 schema.
</p>
<p><strong class="strong">Returns:</strong> a constraint string or <code class="code">NULL</code> on error.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsession_005fset_005fverify_005foutput_005ffunction-1"><span>gnutls_session_set_verify_output_function<a class="copiable-link" href="#gnutls_005fsession_005fset_005fverify_005foutput_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsession_005fset_005fverify_005foutput_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsession_005fset_005fverify_005foutput_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_session_set_verify_output_function</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, gnutls_verify_output_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fsession_005fset_005fverify_005foutput_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_x509_trust_list_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function sets a callback to be called when the peer’s certificate
chain has to be verified and full path to the trusted root has to be
printed.
</p>
<p>The callback’s function prototype is defined in ‘x509.h’:
int (*callback)(
gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer,
gnutls_x509_crl_t crl,
unsigned int verification_output);
</p>
<p>If the callback function is provided then gnutls will call it, in the
certificate verification procedure.
To verify the certificate chain and print its path uptp the trusted root,
functions such as <code class="code">gnutls_certificate_verify_peers()</code> ,
<code class="code">gnutls_x509_trust_list_verify_crt()</code> , and <code class="code">gnutls_x509_trust_list_verify_crt2()</code>
can be used. The callback is set in <code class="code">_gnutls_verify_crt_status()</code> and
<code class="code">_gnutls_pkcs11_verify_crt_status()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsubject_005falt_005fnames_005fdeinit-1"><span>gnutls_subject_alt_names_deinit<a class="copiable-link" href="#gnutls_005fsubject_005falt_005fnames_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsubject_005falt_005fnames_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsubject_005falt_005fnames_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_subject_alt_names_deinit</strong> <code class="def-code-arguments">(gnutls_subject_alt_names_t <var class="var">sans</var>)</code><a class="copiable-link" href="#index-gnutls_005fsubject_005falt_005fnames_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">sans</var>: The alternative names
</p>
<p>This function will deinitialize an alternative names structure.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsubject_005falt_005fnames_005fget-1"><span>gnutls_subject_alt_names_get<a class="copiable-link" href="#gnutls_005fsubject_005falt_005fnames_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsubject_005falt_005fnames_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsubject_005falt_005fnames_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_subject_alt_names_get</strong> <code class="def-code-arguments">(gnutls_subject_alt_names_t <var class="var">sans</var>, unsigned int <var class="var">seq</var>, unsigned int * <var class="var">san_type</var>, gnutls_datum_t * <var class="var">san</var>, gnutls_datum_t * <var class="var">othername_oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fsubject_005falt_005fnames_005fget"> ¶</a></span></dt>
<dd><p><var class="var">sans</var>: The alternative names
</p>
<p><var class="var">seq</var>: The index of the name to get
</p>
<p><var class="var">san_type</var>: Will hold the type of the name (of <code class="code">gnutls_subject_alt_names_t</code> )
</p>
<p><var class="var">san</var>: The alternative name data (should be treated as constant)
</p>
<p><var class="var">othername_oid</var>: The object identifier if <code class="code">san_type</code> is <code class="code">GNUTLS_SAN_OTHERNAME</code> (should be treated as constant)
</p>
<p>This function will return a specific alternative name as stored in
the <code class="code">sans</code> type. The returned values should be treated as constant
and valid for the lifetime of <code class="code">sans</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the index is out of bounds, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsubject_005falt_005fnames_005finit-1"><span>gnutls_subject_alt_names_init<a class="copiable-link" href="#gnutls_005fsubject_005falt_005fnames_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsubject_005falt_005fnames_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsubject_005falt_005fnames_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_subject_alt_names_init</strong> <code class="def-code-arguments">(gnutls_subject_alt_names_t * <var class="var">sans</var>)</code><a class="copiable-link" href="#index-gnutls_005fsubject_005falt_005fnames_005finit"> ¶</a></span></dt>
<dd><p><var class="var">sans</var>: The alternative names
</p>
<p>This function will initialize an alternative names structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsubject_005falt_005fnames_005fset-1"><span>gnutls_subject_alt_names_set<a class="copiable-link" href="#gnutls_005fsubject_005falt_005fnames_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsubject_005falt_005fnames_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsubject_005falt_005fnames_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_subject_alt_names_set</strong> <code class="def-code-arguments">(gnutls_subject_alt_names_t <var class="var">sans</var>, unsigned int <var class="var">san_type</var>, const gnutls_datum_t * <var class="var">san</var>, const char * <var class="var">othername_oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fsubject_005falt_005fnames_005fset"> ¶</a></span></dt>
<dd><p><var class="var">sans</var>: The alternative names
</p>
<p><var class="var">san_type</var>: The type of the name (of <code class="code">gnutls_subject_alt_names_t</code> )
</p>
<p><var class="var">san</var>: The alternative name data
</p>
<p><var class="var">othername_oid</var>: The object identifier if <code class="code">san_type</code> is <code class="code">GNUTLS_SAN_OTHERNAME</code>
</p>
<p>This function will store the specified alternative name in
the <code class="code">sans</code> .
</p>
<p>Since version 3.5.7 the <code class="code">GNUTLS_SAN_RFC822NAME</code> , <code class="code">GNUTLS_SAN_DNSNAME</code> , and
<code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> are converted to ACE format when necessary.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0), otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faia_005fdeinit-1"><span>gnutls_x509_aia_deinit<a class="copiable-link" href="#gnutls_005fx509_005faia_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faia_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faia_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_aia_deinit</strong> <code class="def-code-arguments">(gnutls_x509_aia_t <var class="var">aia</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faia_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">aia</var>: The authority info access
</p>
<p>This function will deinitialize an authority info access type.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faia_005fget-1"><span>gnutls_x509_aia_get<a class="copiable-link" href="#gnutls_005fx509_005faia_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faia_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faia_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aia_get</strong> <code class="def-code-arguments">(gnutls_x509_aia_t <var class="var">aia</var>, unsigned int <var class="var">seq</var>, gnutls_datum_t * <var class="var">oid</var>, unsigned * <var class="var">san_type</var>, gnutls_datum_t * <var class="var">san</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faia_005fget"> ¶</a></span></dt>
<dd><p><var class="var">aia</var>: The authority info access
</p>
<p><var class="var">seq</var>: specifies the sequence number of the access descriptor (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">oid</var>: the type of available data; to be treated as constant.
</p>
<p><var class="var">san_type</var>: Will hold the type of the name of <code class="code">gnutls_subject_alt_names_t</code> (may be null).
</p>
<p><var class="var">san</var>: the access location name; to be treated as constant (may be null).
</p>
<p>This function reads from the Authority Information Access type.
</p>
<p>The <code class="code">seq</code> input parameter is used to indicate which member of the
sequence the caller is interested in. The first member is 0, the
second member 1 and so on. When the <code class="code">seq</code> value is out of bounds,
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p>Typically <code class="code">oid</code> is <code class="code">GNUTLS_OID_AD_CAISSUERS</code> or <code class="code">GNUTLS_OID_AD_OCSP</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faia_005finit-1"><span>gnutls_x509_aia_init<a class="copiable-link" href="#gnutls_005fx509_005faia_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faia_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faia_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aia_init</strong> <code class="def-code-arguments">(gnutls_x509_aia_t * <var class="var">aia</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faia_005finit"> ¶</a></span></dt>
<dd><p><var class="var">aia</var>: The authority info access
</p>
<p>This function will initialize an authority info access type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faia_005fset-1"><span>gnutls_x509_aia_set<a class="copiable-link" href="#gnutls_005fx509_005faia_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faia_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faia_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aia_set</strong> <code class="def-code-arguments">(gnutls_x509_aia_t <var class="var">aia</var>, const char * <var class="var">oid</var>, unsigned <var class="var">san_type</var>, const gnutls_datum_t * <var class="var">san</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faia_005fset"> ¶</a></span></dt>
<dd><p><var class="var">aia</var>: The authority info access
</p>
<p><var class="var">oid</var>: the type of data.
</p>
<p><var class="var">san_type</var>: The type of the name (of <code class="code">gnutls_subject_alt_names_t</code> )
</p>
<p><var class="var">san</var>: The alternative name data
</p>
<p>This function will store the specified alternative name in
the <code class="code">aia</code> type.
</p>
<p>Typically the value for <code class="code">oid</code> should be <code class="code">GNUTLS_OID_AD_OCSP</code> , or
<code class="code">GNUTLS_OID_AD_CAISSUERS</code> .
</p>
<p>Since version 3.5.7 the <code class="code">GNUTLS_SAN_RFC822NAME</code> , and <code class="code">GNUTLS_SAN_DNSNAME</code> ,
are converted to ACE format when necessary.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0), otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faki_005fdeinit-1"><span>gnutls_x509_aki_deinit<a class="copiable-link" href="#gnutls_005fx509_005faki_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faki_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faki_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_aki_deinit</strong> <code class="def-code-arguments">(gnutls_x509_aki_t <var class="var">aki</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faki_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">aki</var>: The authority key identifier type
</p>
<p>This function will deinitialize an authority key identifier.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faki_005fget_005fcert_005fissuer-1"><span>gnutls_x509_aki_get_cert_issuer<a class="copiable-link" href="#gnutls_005fx509_005faki_005fget_005fcert_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faki_005fget_005fcert_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faki_005fget_005fcert_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aki_get_cert_issuer</strong> <code class="def-code-arguments">(gnutls_x509_aki_t <var class="var">aki</var>, unsigned int <var class="var">seq</var>, unsigned int * <var class="var">san_type</var>, gnutls_datum_t * <var class="var">san</var>, gnutls_datum_t * <var class="var">othername_oid</var>, gnutls_datum_t * <var class="var">serial</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faki_005fget_005fcert_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">aki</var>: The authority key ID
</p>
<p><var class="var">seq</var>: The index of the name to get
</p>
<p><var class="var">san_type</var>: Will hold the type of the name (of <code class="code">gnutls_subject_alt_names_t</code> )
</p>
<p><var class="var">san</var>: The alternative name data
</p>
<p><var class="var">othername_oid</var>: The object identifier if <code class="code">san_type</code> is <code class="code">GNUTLS_SAN_OTHERNAME</code>
</p>
<p><var class="var">serial</var>: The authorityCertSerialNumber number
</p>
<p>This function will return a specific authorityCertIssuer name as stored in
the <code class="code">aki</code> type, as well as the authorityCertSerialNumber. All the returned
values should be treated as constant, and may be set to <code class="code">NULL</code> when are not required.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the index is out of bounds, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faki_005fget_005fid-1"><span>gnutls_x509_aki_get_id<a class="copiable-link" href="#gnutls_005fx509_005faki_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faki_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faki_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aki_get_id</strong> <code class="def-code-arguments">(gnutls_x509_aki_t <var class="var">aki</var>, gnutls_datum_t * <var class="var">id</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faki_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">aki</var>: The authority key ID
</p>
<p><var class="var">id</var>: Will hold the identifier
</p>
<p>This function will return the key identifier as stored in
the <code class="code">aki</code> type. The identifier should be treated as constant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the index is out of bounds, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faki_005finit-1"><span>gnutls_x509_aki_init<a class="copiable-link" href="#gnutls_005fx509_005faki_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faki_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faki_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aki_init</strong> <code class="def-code-arguments">(gnutls_x509_aki_t * <var class="var">aki</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faki_005finit"> ¶</a></span></dt>
<dd><p><var class="var">aki</var>: The authority key ID type
</p>
<p>This function will initialize an authority key ID.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faki_005fset_005fcert_005fissuer-1"><span>gnutls_x509_aki_set_cert_issuer<a class="copiable-link" href="#gnutls_005fx509_005faki_005fset_005fcert_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faki_005fset_005fcert_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faki_005fset_005fcert_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aki_set_cert_issuer</strong> <code class="def-code-arguments">(gnutls_x509_aki_t <var class="var">aki</var>, unsigned int <var class="var">san_type</var>, const gnutls_datum_t * <var class="var">san</var>, const char * <var class="var">othername_oid</var>, const gnutls_datum_t * <var class="var">serial</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faki_005fset_005fcert_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">aki</var>: The authority key ID
</p>
<p><var class="var">san_type</var>: the type of the name (of <code class="code">gnutls_subject_alt_names_t</code> ), may be null
</p>
<p><var class="var">san</var>: The alternative name data
</p>
<p><var class="var">othername_oid</var>: The object identifier if <code class="code">san_type</code> is <code class="code">GNUTLS_SAN_OTHERNAME</code>
</p>
<p><var class="var">serial</var>: The authorityCertSerialNumber number (may be null)
</p>
<p>This function will set the authorityCertIssuer name and the authorityCertSerialNumber
to be stored in the <code class="code">aki</code> type. When storing multiple names, the serial
should be set on the first call, and subsequent calls should use a <code class="code">NULL</code> serial.
</p>
<p>Since version 3.5.7 the <code class="code">GNUTLS_SAN_RFC822NAME</code> , <code class="code">GNUTLS_SAN_DNSNAME</code> , and
<code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> are converted to ACE format when necessary.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005faki_005fset_005fid-1"><span>gnutls_x509_aki_set_id<a class="copiable-link" href="#gnutls_005fx509_005faki_005fset_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005faki_005fset_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005faki_005fset_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_aki_set_id</strong> <code class="def-code-arguments">(gnutls_x509_aki_t <var class="var">aki</var>, const gnutls_datum_t * <var class="var">id</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005faki_005fset_005fid"> ¶</a></span></dt>
<dd><p><var class="var">aki</var>: The authority key ID
</p>
<p><var class="var">id</var>: the key identifier
</p>
<p>This function will set the keyIdentifier to be stored in the <code class="code">aki</code> type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcidr_005fto_005frfc5280-1"><span>gnutls_x509_cidr_to_rfc5280<a class="copiable-link" href="#gnutls_005fx509_005fcidr_005fto_005frfc5280-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcidr_005fto_005frfc5280"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcidr_005fto_005frfc5280"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_cidr_to_rfc5280</strong> <code class="def-code-arguments">(const char * <var class="var">cidr</var>, gnutls_datum_t * <var class="var">cidr_rfc5280</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcidr_005fto_005frfc5280"> ¶</a></span></dt>
<dd><p><var class="var">cidr</var>: CIDR in RFC4632 format (IP/prefix), null-terminated
</p>
<p><var class="var">cidr_rfc5280</var>: CIDR range converted to RFC5280 format
</p>
<p>This function will convert text CIDR range with prefix (such as ’10.0.0.0/8’)
to RFC5280 (IP address in network byte order followed by its network mask).
Works for both IPv4 and IPv6.
</p>
<p>The resulting object is directly usable for IP name constraints usage,
for example in functions <code class="code">gnutls_x509_name_constraints_add_permitted</code>
or <code class="code">gnutls_x509_name_constraints_add_excluded</code> .
</p>
<p>The data in datum needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fcheck_005fissuer-1"><span>gnutls_x509_crl_check_issuer<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fcheck_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fcheck_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fcheck_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crl_check_issuer</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">issuer</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fcheck_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: is the CRL to be checked
</p>
<p><var class="var">issuer</var>: is the certificate of a possible issuer
</p>
<p>This function will check if the given CRL was issued by the given
issuer certificate.
</p>
<p><strong class="strong">Returns:</strong> true (1) if the given CRL was issued by the given issuer,
and false (0) if not.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fdeinit-1"><span>gnutls_x509_crl_deinit<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_crl_deinit</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: The data to be deinitialized
</p>
<p>This function will deinitialize a CRL structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005fdeinit-1"><span>gnutls_x509_crl_dist_points_deinit<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fdist_005fpoints_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_crl_dist_points_deinit</strong> <code class="def-code-arguments">(gnutls_x509_crl_dist_points_t <var class="var">cdp</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">cdp</var>: The CRL distribution points
</p>
<p>This function will deinitialize a CRL distribution points type.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005fget-1"><span>gnutls_x509_crl_dist_points_get<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fdist_005fpoints_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_dist_points_get</strong> <code class="def-code-arguments">(gnutls_x509_crl_dist_points_t <var class="var">cdp</var>, unsigned int <var class="var">seq</var>, unsigned int * <var class="var">type</var>, gnutls_datum_t * <var class="var">san</var>, unsigned int * <var class="var">reasons</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fget"> ¶</a></span></dt>
<dd><p><var class="var">cdp</var>: The CRL distribution points
</p>
<p><var class="var">seq</var>: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">type</var>: The name type of the corresponding name (gnutls_x509_subject_alt_name_t)
</p>
<p><var class="var">san</var>: The distribution point names (to be treated as constant)
</p>
<p><var class="var">reasons</var>: Revocation reasons. An ORed sequence of flags from <code class="code">gnutls_x509_crl_reason_flags_t</code> .
</p>
<p>This function retrieves the individual CRL distribution points (2.5.29.31),
contained in provided type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the index is out of bounds, otherwise a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005finit-1"><span>gnutls_x509_crl_dist_points_init<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fdist_005fpoints_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_dist_points_init</strong> <code class="def-code-arguments">(gnutls_x509_crl_dist_points_t * <var class="var">cdp</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005finit"> ¶</a></span></dt>
<dd><p><var class="var">cdp</var>: The CRL distribution points
</p>
<p>This function will initialize a CRL distribution points type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005fset-1"><span>gnutls_x509_crl_dist_points_set<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fdist_005fpoints_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fdist_005fpoints_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_dist_points_set</strong> <code class="def-code-arguments">(gnutls_x509_crl_dist_points_t <var class="var">cdp</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">san</var>, unsigned int <var class="var">reasons</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fset"> ¶</a></span></dt>
<dd><p><var class="var">cdp</var>: The CRL distribution points
</p>
<p><var class="var">type</var>: The type of the name (of <code class="code">gnutls_subject_alt_names_t</code> )
</p>
<p><var class="var">san</var>: The point name data
</p>
<p><var class="var">reasons</var>: Revocation reasons. An ORed sequence of flags from <code class="code">gnutls_x509_crl_reason_flags_t</code> .
</p>
<p>This function will store the specified CRL distribution point value
the <code class="code">cdp</code> type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0), otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fexport-1"><span>gnutls_x509_crl_export<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_export</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: Holds the revocation list
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a private key PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will
be replaced by the actual size of parameters)
</p>
<p>This function will export the revocation list to DER or PEM format.
</p>
<p>If the buffer provided is not long enough to hold the output, then
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN X509 CRL".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fexport2-1"><span>gnutls_x509_crl_export2<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_export2</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: Holds the revocation list
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a private key PEM or DER encoded
</p>
<p>This function will export the revocation list to DER or PEM format.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN X509 CRL".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p>Since 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fgn_005fserial-1"><span>gnutls_x509_crl_get_authority_key_gn_serial<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fgn_005fserial-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fgn_005fserial"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fgn_005fserial"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_authority_key_gn_serial</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned int <var class="var">seq</var>, void * <var class="var">alt</var>, size_t * <var class="var">alt_size</var>, unsigned int * <var class="var">alt_type</var>, void * <var class="var">serial</var>, size_t * <var class="var">serial_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fgn_005fserial"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">alt</var>: is the place where the alternative name will be copied to
</p>
<p><var class="var">alt_size</var>: holds the size of alt.
</p>
<p><var class="var">alt_type</var>: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
</p>
<p><var class="var">serial</var>: buffer to store the serial number (may be null)
</p>
<p><var class="var">serial_size</var>: Holds the size of the serial field (may be null)
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function will return the X.509 authority key
identifier when stored as a general name (authorityCertIssuer)
and serial number.
</p>
<p>Because more than one general names might be stored
<code class="code">seq</code> can be used as a counter to request them all until
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> Returns 0 on success, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fid-1"><span>gnutls_x509_crl_get_authority_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_authority_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, void * <var class="var">id</var>, size_t * <var class="var">id_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">id</var>: The place where the identifier will be copied
</p>
<p><var class="var">id_size</var>: Holds the size of the result field.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
(may be null)
</p>
<p>This function will return the CRL authority’s key identifier. This
is obtained by the X.509 Authority Key identifier extension field
(2.5.29.35). Note that this function
only returns the keyIdentifier field of the extension and
<code class="code">GNUTLS_E_X509_UNSUPPORTED_EXTENSION</code> , if the extension contains
the name and serial number of the certificate. In that case
<code class="code">gnutls_x509_crl_get_authority_key_gn_serial()</code> may be used.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fcrt_005fcount-1"><span>gnutls_x509_crl_get_crt_count<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fcrt_005fcount-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fcrt_005fcount"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fcount"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_crt_count</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fcount"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p>This function will return the number of revoked certificates in the
given CRL.
</p>
<p><strong class="strong">Returns:</strong> number of certificates, a negative error code on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial-1"><span>gnutls_x509_crl_get_crt_serial<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_crt_serial</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned <var class="var">indx</var>, unsigned char * <var class="var">serial</var>, size_t * <var class="var">serial_size</var>, time_t * <var class="var">t</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial-1"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">indx</var>: the index of the certificate to extract (starting from 0)
</p>
<p><var class="var">serial</var>: where the serial number will be copied
</p>
<p><var class="var">serial_size</var>: initially holds the size of serial
</p>
<p><var class="var">t</var>: if non null, will hold the time this certificate was revoked
</p>
<p>This function will retrieve the serial number of the specified, by
the index, revoked certificate.
</p>
<p>Note that this function will have performance issues in large sequences
of revoked certificates. In that case use <code class="code">gnutls_x509_crl_iter_crt_serial()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fdn_005foid-1"><span>gnutls_x509_crl_get_dn_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fdn_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fdn_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fdn_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_dn_oid</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">sizeof_oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fdn_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">indx</var>: Specifies which DN OID to send. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to store the OID (may be null)
</p>
<p><var class="var">sizeof_oid</var>: initially holds the size of ’oid’
</p>
<p>This function will extract the requested OID of the name of the CRL
issuer, specified by the given index.
</p>
<p>If oid is null then only the size will be filled.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the sizeof_oid will be updated
with the required size. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fextension_005fdata-1"><span>gnutls_x509_crl_get_extension_data<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fextension_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fextension_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fextension_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_extension_data</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned <var class="var">indx</var>, void * <var class="var">data</var>, size_t * <var class="var">sizeof_data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to send. Use (0) to get the first one.
</p>
<p><var class="var">data</var>: a pointer to a structure to hold the data (may be null)
</p>
<p><var class="var">sizeof_data</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the requested extension data in the CRL.
The extension data will be stored as a string in the provided
buffer.
</p>
<p>Use <code class="code">gnutls_x509_crl_get_extension_info()</code> to extract the OID and
critical flag. Use <code class="code">gnutls_x509_crl_get_extension_info()</code> instead,
if you want to get data indexed by the extension OID rather than
sequence.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If your have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fextension_005fdata2-1"><span>gnutls_x509_crl_get_extension_data2<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fextension_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fextension_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fextension_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_extension_data2</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to read. Use (0) to get the first one.
</p>
<p><var class="var">data</var>: will contain the extension DER-encoded data
</p>
<p>This function will return the requested by the index extension data in the
certificate revocation list. The extension data will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p>Use <code class="code">gnutls_x509_crt_get_extension_info()</code> to extract the OID.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If you have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fextension_005finfo-1"><span>gnutls_x509_crl_get_extension_info<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fextension_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fextension_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fextension_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_extension_info</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">sizeof_oid</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to send, use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to store the OID
</p>
<p><var class="var">sizeof_oid</var>: initially holds the maximum size of <code class="code">oid</code> , on return
holds actual size of <code class="code">oid</code> .
</p>
<p><var class="var">critical</var>: output variable with critical flag, may be NULL.
</p>
<p>This function will return the requested extension OID in the CRL,
and the critical flag for it. The extension OID will be stored as
a string in the provided buffer. Use
<code class="code">gnutls_x509_crl_get_extension_data()</code> to extract the data.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">sizeof_oid</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be
returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If your have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fextension_005foid-1"><span>gnutls_x509_crl_get_extension_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fextension_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fextension_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fextension_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_extension_oid</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">sizeof_oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to send, use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to store the OID (may be null)
</p>
<p><var class="var">sizeof_oid</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the requested extension OID in the CRL.
The extension OID will be stored as a string in the provided
buffer.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If your have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn-1"><span>gnutls_x509_crl_get_issuer_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_issuer_dn</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, char * <var class="var">buf</var>, size_t * <var class="var">sizeof_buf</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the peer’s name (may be null)
</p>
<p><var class="var">sizeof_buf</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will copy the name of the CRL issuer in the provided
buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>If buf is <code class="code">NULL</code> then only the size will be filled.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crl_get_issuer_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the sizeof_buf will be updated
with the required size, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn2-1"><span>gnutls_x509_crl_get_issuer_dn2<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_issuer_dn2</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn2"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p>This function will allocate buffer and copy the name of the CRL issuer.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crl_get_issuer_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn3-1"><span>gnutls_x509_crl_get_issuer_dn3<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_issuer_dn3</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_datum_t * <var class="var">dn</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn3"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code>
</p>
<p>This function will allocate buffer and copy the name of the CRL issuer.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>When the flag <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code> is specified, the output
format will match the format output by previous to 3.5.6 versions of GnuTLS
which was not not fully RFC4514-compliant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn_005fby_005foid-1"><span>gnutls_x509_crl_get_issuer_dn_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_issuer_dn_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, unsigned int <var class="var">raw_flag</var>, void * <var class="var">buf</var>, size_t * <var class="var">sizeof_buf</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">oid</var>: holds an Object Identified in null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one.
</p>
<p><var class="var">raw_flag</var>: If non-zero returns the raw DER data of the DN part.
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the peer’s name (may be null)
</p>
<p><var class="var">sizeof_buf</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will extract the part of the name of the CRL issuer
specified by the given OID. The output will be encoded as described
in RFC4514. The output string will be ASCII or UTF-8 encoded,
depending on the certificate data.
</p>
<p>Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is (0), this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC4514 – in
hex format with a ’#’ prefix. You can check about known OIDs
using <code class="code">gnutls_x509_dn_oid_known()</code> .
</p>
<p>If buf is null then only the size will be filled.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the sizeof_buf will be updated
with the required size, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fnext_005fupdate-1"><span>gnutls_x509_crl_get_next_update<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fnext_005fupdate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fnext_005fupdate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fnext_005fupdate"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_x509_crl_get_next_update</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fnext_005fupdate"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p>This function will return the time the next CRL will be issued.
This field is optional in a CRL so it might be normal to get an
error instead.
</p>
<p><strong class="strong">Returns:</strong> when the next CRL will be issued, or (time_t)-1 on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fnumber-1"><span>gnutls_x509_crl_get_number<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fnumber-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fnumber"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fnumber"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_number</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, void * <var class="var">ret</var>, size_t * <var class="var">ret_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fnumber"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">ret</var>: The place where the number will be copied
</p>
<p><var class="var">ret_size</var>: Holds the size of the result field.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
(may be null)
</p>
<p>This function will return the CRL number extension. This is
obtained by the CRL Number extension field (2.5.29.20).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fraw_005fissuer_005fdn-1"><span>gnutls_x509_crl_get_raw_issuer_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fraw_005fissuer_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fraw_005fissuer_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fraw_005fissuer_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_raw_issuer_dn</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fraw_005fissuer_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">dn</var>: will hold the starting point of the DN
</p>
<p>This function will return a pointer to the DER encoded DN structure
and the length.
</p>
<p><strong class="strong">Returns:</strong> a negative error code on error, and (0) on success.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fsignature-1"><span>gnutls_x509_crl_get_signature<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fsignature-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fsignature"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fsignature"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_signature</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, char * <var class="var">sig</var>, size_t * <var class="var">sizeof_sig</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fsignature"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">sig</var>: a pointer where the signature part will be copied (may be null).
</p>
<p><var class="var">sizeof_sig</var>: initially holds the size of <code class="code">sig</code>
</p>
<p>This function will extract the signature field of a CRL.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fsignature_005falgorithm-1"><span>gnutls_x509_crl_get_signature_algorithm<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fsignature_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fsignature_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fsignature_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_signature_algorithm</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fsignature_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p>This function will return a value of the <code class="code">gnutls_sign_algorithm_t</code>
enumeration that is the signature algorithm.
</p>
<p>Since 3.6.0 this function never returns a negative error code.
Error cases and unknown/unsupported signature algorithms are
mapped to <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_sign_algorithm_t</code> value
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fsignature_005foid-1"><span>gnutls_x509_crl_get_signature_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fsignature_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fsignature_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fsignature_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_signature_oid</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, char * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fsignature_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the OID of the signature algorithm
that has been used to sign this CRL. This is function
is useful in the case <code class="code">gnutls_x509_crl_get_signature_algorithm()</code>
returned <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fthis_005fupdate-1"><span>gnutls_x509_crl_get_this_update<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fthis_005fupdate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fthis_005fupdate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fthis_005fupdate"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_x509_crl_get_this_update</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fthis_005fupdate"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p>This function will return the time this CRL was issued.
</p>
<p><strong class="strong">Returns:</strong> when the CRL was issued, or (time_t)-1 on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fget_005fversion-1"><span>gnutls_x509_crl_get_version<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fget_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fget_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fget_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_get_version</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fget_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p>This function will return the version of the specified CRL.
</p>
<p><strong class="strong">Returns:</strong> The version number, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fimport-1"><span>gnutls_x509_crl_import<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_import</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: The data to store the parsed CRL.
</p>
<p><var class="var">data</var>: The DER or PEM encoded CRL.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p>This function will convert the given DER or PEM encoded CRL
to the native <code class="code">gnutls_x509_crl_t</code> format. The output will be stored in ’crl’.
</p>
<p>If the CRL is PEM encoded it should have a header of "X509 CRL".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005finit-1"><span>gnutls_x509_crl_init<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_init</strong> <code class="def-code-arguments">(gnutls_x509_crl_t * <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005finit"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a CRL structure. CRL stands for
Certificate Revocation List. A revocation list usually contains
lists of certificate serial numbers that have been revoked by an
Authority. The revocation lists are always signed with the
authority’s private key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fiter_005fcrt_005fserial-1"><span>gnutls_x509_crl_iter_crt_serial<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fiter_005fcrt_005fserial-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fiter_005fcrt_005fserial"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fiter_005fcrt_005fserial"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_iter_crt_serial</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crl_iter_t * <var class="var">iter</var>, unsigned char * <var class="var">serial</var>, size_t * <var class="var">serial_size</var>, time_t * <var class="var">t</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fiter_005fcrt_005fserial"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a <code class="code">gnutls_x509_crl_t</code> type
</p>
<p><var class="var">iter</var>: A pointer to an iterator (initially the iterator should be <code class="code">NULL</code> )
</p>
<p><var class="var">serial</var>: where the serial number will be copied
</p>
<p><var class="var">serial_size</var>: initially holds the size of serial
</p>
<p><var class="var">t</var>: if non null, will hold the time this certificate was revoked
</p>
<p>This function performs the same as <code class="code">gnutls_x509_crl_get_crt_serial()</code> ,
but reads sequentially and keeps state in the iterator
between calls. That allows it to provide better performance in sequences
with many elements (50000+).
</p>
<p>When past the last element is accessed <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
is returned and the iterator is reset.
</p>
<p>After use, the iterator must be deinitialized using <code class="code">gnutls_x509_crl_iter_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fiter_005fdeinit-1"><span>gnutls_x509_crl_iter_deinit<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fiter_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fiter_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fiter_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_crl_iter_deinit</strong> <code class="def-code-arguments">(gnutls_x509_crl_iter_t <var class="var">iter</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fiter_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">iter</var>: The iterator to be deinitialized
</p>
<p>This function will deinitialize an iterator type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005flist_005fimport-1"><span>gnutls_x509_crl_list_import<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005flist_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005flist_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005flist_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_list_import</strong> <code class="def-code-arguments">(gnutls_x509_crl_t * <var class="var">crls</var>, unsigned int * <var class="var">crl_max</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005flist_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">crls</var>: Indicates where the parsed CRLs will be copied to. Must not be initialized.
</p>
<p><var class="var">crl_max</var>: Initially must hold the maximum number of crls. It will be updated with the number of crls available.
</p>
<p><var class="var">data</var>: The CRL data
</p>
<p><var class="var">format</var>: One of DER or PEM.
</p>
<p><var class="var">flags</var>: must be (0) or an OR’d sequence of gnutls_certificate_import_flags.
</p>
<p>This function will convert the given CRL list
to the native gnutls_x509_crl_t format. The output will be stored
in <code class="code">crls</code> . They will be automatically initialized.
</p>
<p>If the Certificate is PEM encoded it should have a header of "X509 CRL".
</p>
<p><strong class="strong">Returns:</strong> the number of certificates read or a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005flist_005fimport2-1"><span>gnutls_x509_crl_list_import2<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005flist_005fimport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005flist_005fimport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005flist_005fimport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_list_import2</strong> <code class="def-code-arguments">(gnutls_x509_crl_t ** <var class="var">crls</var>, unsigned int * <var class="var">size</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005flist_005fimport2"> ¶</a></span></dt>
<dd><p><var class="var">crls</var>: Will contain the parsed crl list.
</p>
<p><var class="var">size</var>: It will contain the size of the list.
</p>
<p><var class="var">data</var>: The CRL data.
</p>
<p><var class="var">format</var>: One of DER or PEM.
</p>
<p><var class="var">flags</var>: must be (0) or an OR’d sequence of gnutls_certificate_import_flags.
</p>
<p>This function will convert the given CRL list
to the native gnutls_x509_crl_t format. The output will be stored
in <code class="code">crls</code> . They will be automatically initialized.
</p>
<p>If the Certificate is PEM encoded it should have a header of "X509
CRL".
</p>
<p><strong class="strong">Returns:</strong> the number of certificates read or a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fprint-1"><span>gnutls_x509_crl_print<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_print</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: The data to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with null terminated string.
</p>
<p>This function will pretty print a X.509 certificate revocation
list, suitable for display to a human.
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fset_005fauthority_005fkey_005fid-1"><span>gnutls_x509_crl_set_authority_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fset_005fauthority_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fset_005fauthority_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fset_005fauthority_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_set_authority_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, const void * <var class="var">id</var>, size_t <var class="var">id_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fset_005fauthority_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: a CRL of type <code class="code">gnutls_x509_crl_t</code>
</p>
<p><var class="var">id</var>: The key ID
</p>
<p><var class="var">id_size</var>: Holds the size of the serial field.
</p>
<p>This function will set the CRL’s authority key ID extension. Only
the keyIdentifier field can be set with this function. This may
be used by an authority that holds multiple private keys, to distinguish
the used key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fset_005fcrt-1"><span>gnutls_x509_crl_set_crt<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fset_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fset_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fset_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_set_crt</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">crt</var>, time_t <var class="var">revocation_time</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fset_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code> with the revoked certificate
</p>
<p><var class="var">revocation_time</var>: The time this certificate was revoked
</p>
<p>This function will set a revoked certificate’s serial number to the CRL.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fset_005fcrt_005fserial-1"><span>gnutls_x509_crl_set_crt_serial<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fset_005fcrt_005fserial-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fset_005fcrt_005fserial"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fset_005fcrt_005fserial"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_set_crt_serial</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, const void * <var class="var">serial</var>, size_t <var class="var">serial_size</var>, time_t <var class="var">revocation_time</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fset_005fcrt_005fserial"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">serial</var>: The revoked certificate’s serial number
</p>
<p><var class="var">serial_size</var>: Holds the size of the serial field.
</p>
<p><var class="var">revocation_time</var>: The time this certificate was revoked
</p>
<p>This function will set a revoked certificate’s serial number to the CRL.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fset_005fnext_005fupdate-1"><span>gnutls_x509_crl_set_next_update<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fset_005fnext_005fupdate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fset_005fnext_005fupdate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fset_005fnext_005fupdate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_set_next_update</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, time_t <var class="var">exp_time</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fset_005fnext_005fupdate"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">exp_time</var>: The actual time
</p>
<p>This function will set the time this CRL will be updated.
This is an optional value to be set on a CRL and this call
can be omitted when generating a CRL.
</p>
<p>Prior to GnuTLS 3.5.7, setting a nextUpdate field was required
in order to generate a CRL.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fset_005fnumber-1"><span>gnutls_x509_crl_set_number<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fset_005fnumber-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fset_005fnumber"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fset_005fnumber"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_set_number</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, const void * <var class="var">nr</var>, size_t <var class="var">nr_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fset_005fnumber"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: a CRL of type <code class="code">gnutls_x509_crl_t</code>
</p>
<p><var class="var">nr</var>: The CRL number
</p>
<p><var class="var">nr_size</var>: Holds the size of the nr field.
</p>
<p>This function will set the CRL’s number extension. This
is to be used as a unique and monotonic number assigned to
the CRL by the authority.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fset_005fthis_005fupdate-1"><span>gnutls_x509_crl_set_this_update<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fset_005fthis_005fupdate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fset_005fthis_005fupdate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fset_005fthis_005fupdate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_set_this_update</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, time_t <var class="var">act_time</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fset_005fthis_005fupdate"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">act_time</var>: The actual time
</p>
<p>This function will set the time this CRL was issued.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fset_005fversion-1"><span>gnutls_x509_crl_set_version<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fset_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fset_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fset_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_set_version</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, unsigned int <var class="var">version</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fset_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">version</var>: holds the version number. For CRLv1 crls must be 1.
</p>
<p>This function will set the version of the CRL. This
must be one for CRL version 1, and so on. The CRLs generated
by gnutls should have a version number of 2.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fsign-1"><span>gnutls_x509_crl_sign<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fsign"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_sign</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_x509_privkey_t <var class="var">issuer_key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p>This function is the same a <code class="code">gnutls_x509_crl_sign2()</code> with no flags,
and an appropriate hash algorithm. The hash algorithm used may
vary between versions of GnuTLS, and it is tied to the security
level of the issuer’s public key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fsign2-1"><span>gnutls_x509_crl_sign2<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fsign2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fsign2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fsign2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_sign2</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_x509_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fsign2-1"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p><var class="var">dig</var>: The message digest to use. GNUTLS_DIG_SHA256 is the safe choice unless you know what you’re doing.
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the CRL with the issuer’s private key, and
will copy the issuer’s information into the CRL.
</p>
<p>This must be the last step in a certificate CRL since all
the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed CRL will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fverify-1"><span>gnutls_x509_crl_verify<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fverify-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fverify"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fverify"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_verify</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, const gnutls_x509_crt_t * <var class="var">trusted_cas</var>, unsigned <var class="var">tcas_size</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">verify</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fverify"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: is the crl to be verified
</p>
<p><var class="var">trusted_cas</var>: is a certificate list that is considered to be trusted one
</p>
<p><var class="var">tcas_size</var>: holds the number of CA certificates in CA_list
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">verify</var>: will hold the crl verification output.
</p>
<p>This function will try to verify the given crl and return its verification status.
See <code class="code">gnutls_x509_crt_list_verify()</code> for a detailed description of
return values. Note that since GnuTLS 3.1.4 this function includes
the time checks.
</p>
<p>Note that value in <code class="code">verify</code> is set only when the return value of this
function is success (i.e, failure to trust a CRL a certificate does not imply
a negative return value).
</p>
<p>Before GnuTLS 3.5.7 this function would return zero or a positive
number on success.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0), otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fdeinit-1"><span>gnutls_x509_crq_deinit<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_crq_deinit</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: the type to be deinitialized
</p>
<p>This function will deinitialize a PKCS<code class="code">10</code> certificate request
structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fexport-1"><span>gnutls_x509_crq_export<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_export</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a certificate request PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the certificate request to a PEM or DER
encoded PKCS10 structure.
</p>
<p>If the buffer provided is not long enough to hold the output, then
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be returned and
* <code class="code">output_data_size</code> will be updated.
</p>
<p>If the structure is PEM encoded, it will have a header of "BEGIN
NEW CERTIFICATE REQUEST".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fexport2-1"><span>gnutls_x509_crq_export2<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_export2</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a certificate request PEM or DER encoded
</p>
<p>This function will export the certificate request to a PEM or DER
encoded PKCS10 structure.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header of "BEGIN
NEW CERTIFICATE REQUEST".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p>Since 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fattribute_005fby_005foid-1"><span>gnutls_x509_crq_get_attribute_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fattribute_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fattribute_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fattribute_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_attribute_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fattribute_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identifier in null-terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the attribute list, this
specifies which to get, use (0) to get the first one
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the attribute data (may be <code class="code">NULL</code> )
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will return the attribute in the certificate request
specified by the given Object ID. The attribute will be DER
encoded.
</p>
<p>Attributes in a certificate request is an optional set of data
appended to the request. Their interpretation depends on the CA policy.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fattribute_005fdata-1"><span>gnutls_x509_crq_get_attribute_data<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fattribute_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fattribute_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fattribute_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_attribute_data</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned <var class="var">indx</var>, void * <var class="var">data</var>, size_t * <var class="var">sizeof_data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fattribute_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which attribute number to get. Use (0) to get the first one.
</p>
<p><var class="var">data</var>: a pointer to a structure to hold the data (may be null)
</p>
<p><var class="var">sizeof_data</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the requested attribute data in the
certificate request. The attribute data will be stored as a string in the
provided buffer.
</p>
<p>Use <code class="code">gnutls_x509_crq_get_attribute_info()</code> to extract the OID.
Use <code class="code">gnutls_x509_crq_get_attribute_by_oid()</code> instead,
if you want to get data indexed by the attribute OID rather than
sequence.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If your have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fattribute_005finfo-1"><span>gnutls_x509_crq_get_attribute_info<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fattribute_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fattribute_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fattribute_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_attribute_info</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">sizeof_oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fattribute_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which attribute number to get. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to a structure to hold the OID
</p>
<p><var class="var">sizeof_oid</var>: initially holds the maximum size of <code class="code">oid</code> , on return
holds actual size of <code class="code">oid</code> .
</p>
<p>This function will return the requested attribute OID in the
certificate, and the critical flag for it. The attribute OID will
be stored as a string in the provided buffer. Use
<code class="code">gnutls_x509_crq_get_attribute_data()</code> to extract the data.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">sizeof_oid</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be
returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If your have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fbasic_005fconstraints-1"><span>gnutls_x509_crq_get_basic_constraints<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fbasic_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fbasic_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fbasic_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_basic_constraints</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int * <var class="var">critical</var>, unsigned int * <var class="var">ca</var>, int * <var class="var">pathlen</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fbasic_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p><var class="var">ca</var>: pointer to output integer indicating CA status, may be NULL,
value is 1 if the certificate CA flag is set, 0 otherwise.
</p>
<p><var class="var">pathlen</var>: pointer to output integer indicating path length (may be
NULL), non-negative error codes indicate a present pathLenConstraint
field and the actual value, -1 indicate that the field is absent.
</p>
<p>This function will read the certificate’s basic constraints, and
return the certificates CA status. It reads the basicConstraints
X.509 extension (2.5.29.19).
</p>
<p><strong class="strong">Returns:</strong> If the certificate is a CA a positive value will be
returned, or (0) if the certificate does not have CA flag set.
A negative error code may be returned in case of errors. If the
certificate does not contain the basicConstraints extension
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fchallenge_005fpassword-1"><span>gnutls_x509_crq_get_challenge_password<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fchallenge_005fpassword-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fchallenge_005fpassword"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fchallenge_005fpassword"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_challenge_password</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, char * <var class="var">pass</var>, size_t * <var class="var">pass_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fchallenge_005fpassword"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">pass</var>: will hold a (0)-terminated password string
</p>
<p><var class="var">pass_size</var>: Initially holds the size of <code class="code">pass</code> .
</p>
<p>This function will return the challenge password in the request.
The challenge password is intended to be used for requesting a
revocation of the certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fdn-1"><span>gnutls_x509_crq_get_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_dn</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the name (may be <code class="code">NULL</code> )
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will copy the name of the Certificate request subject
to the provided buffer. The name will be in the form
"C=xxxx,O=yyyy,CN=zzzz" as described in RFC 2253. The output string
<code class="code">buf</code> will be ASCII or UTF-8 encoded, depending on the certificate
data.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crq_get_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is not
long enough, and in that case the * <code class="code">buf_size</code> will be updated with
the required size. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fdn2-1"><span>gnutls_x509_crq_get_dn2<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fdn2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fdn2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fdn2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_dn2</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fdn2"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p>This function will allocate buffer and copy the name of the Certificate
request. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crq_get_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. and a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fdn3-1"><span>gnutls_x509_crq_get_dn3<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fdn3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fdn3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fdn3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_dn3</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_datum_t * <var class="var">dn</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fdn3"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code>
</p>
<p>This function will allocate buffer and copy the name of the Certificate
request. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>When the flag <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code> is specified, the output
format will match the format output by previous to 3.5.6 versions of GnuTLS
which was not not fully RFC4514-compliant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. and a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.5.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fdn_005fby_005foid-1"><span>gnutls_x509_crq_get_dn_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fdn_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fdn_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fdn_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_dn_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, unsigned int <var class="var">raw_flag</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fdn_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a gnutls_x509_crq_t type
</p>
<p><var class="var">oid</var>: holds an Object Identifier in a null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the RDN, this specifies
which to get. Use (0) to get the first one.
</p>
<p><var class="var">raw_flag</var>: If non-zero returns the raw DER data of the DN part.
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the name (may be <code class="code">NULL</code> )
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will extract the part of the name of the Certificate
request subject, specified by the given OID. The output will be
encoded as described in RFC2253. The output string will be ASCII
or UTF-8 encoded, depending on the certificate data.
</p>
<p>Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is (0), this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC2253 –
in hex format with a ’\#’ prefix. You can check about known OIDs
using <code class="code">gnutls_x509_dn_oid_known()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the * <code class="code">buf_size</code> will be
updated with the required size. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fdn_005foid-1"><span>gnutls_x509_crq_get_dn_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fdn_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fdn_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fdn_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_dn_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">sizeof_oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fdn_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a gnutls_x509_crq_t type
</p>
<p><var class="var">indx</var>: Specifies which DN OID to get. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to a structure to hold the name (may be <code class="code">NULL</code> )
</p>
<p><var class="var">sizeof_oid</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will extract the requested OID of the name of the
certificate request subject, specified by the given index.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the * <code class="code">sizeof_oid</code> will be
updated with the required size. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid-1"><span>gnutls_x509_crq_get_extension_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_extension_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identifier in a null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the extensions, this
specifies which to get. Use (0) to get the first one.
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the name (may be null)
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return the extension specified by the OID in
the certificate. The extensions will be returned as binary data
DER encoded, in the provided buffer.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If the certificate does not
contain the specified extension
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid2-1"><span>gnutls_x509_crq_get_extension_by_oid2<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_extension_by_oid2</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">output</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid2"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identifier in a null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the extensions, this
specifies which to get. Use (0) to get the first one.
</p>
<p><var class="var">output</var>: will hold the allocated extension data
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return the extension specified by the OID in
the certificate. The extensions will be returned as binary data
DER encoded, in the provided buffer.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If the certificate does not
contain the specified extension
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fdata-1"><span>gnutls_x509_crq_get_extension_data<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fextension_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fextension_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_extension_data</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned <var class="var">indx</var>, void * <var class="var">data</var>, size_t * <var class="var">sizeof_data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension number to get. Use (0) to get the first one.
</p>
<p><var class="var">data</var>: a pointer to a structure to hold the data (may be null)
</p>
<p><var class="var">sizeof_data</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the requested extension data in the
certificate. The extension data will be stored as a string in the
provided buffer.
</p>
<p>Use <code class="code">gnutls_x509_crq_get_extension_info()</code> to extract the OID and
critical flag. Use <code class="code">gnutls_x509_crq_get_extension_by_oid()</code> instead,
if you want to get data indexed by the extension OID rather than
sequence.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If your have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fdata2-1"><span>gnutls_x509_crq_get_extension_data2<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fextension_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fextension_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fextension_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_extension_data2</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to read. Use (0) to get the first one.
</p>
<p><var class="var">data</var>: will contain the extension DER-encoded data
</p>
<p>This function will return the requested extension data in the
certificate request. The extension data will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p>Use <code class="code">gnutls_x509_crq_get_extension_info()</code> to extract the OID.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If you have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fextension_005finfo-1"><span>gnutls_x509_crq_get_extension_info<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fextension_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fextension_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fextension_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_extension_info</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">sizeof_oid</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension number to get. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to store the OID
</p>
<p><var class="var">sizeof_oid</var>: initially holds the maximum size of <code class="code">oid</code> , on return
holds actual size of <code class="code">oid</code> .
</p>
<p><var class="var">critical</var>: output variable with critical flag, may be NULL.
</p>
<p>This function will return the requested extension OID in the
certificate, and the critical flag for it. The extension OID will
be stored as a string in the provided buffer. Use
<code class="code">gnutls_x509_crq_get_extension_data()</code> to extract the data.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">sizeof_oid</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be
returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code in case of an error. If your have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fkey_005fid-1"><span>gnutls_x509_crq_get_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">flags</var>: should be one of the flags from <code class="code">gnutls_keyid_flags_t</code>
</p>
<p><var class="var">output_data</var>: will contain the key ID
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will return a unique ID that depends on the public key
parameters. This ID can be used in checking whether a certificate
corresponds to the given private key.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">output_data_size</code> is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned. The output will normally be a SHA-1 hash output,
which is 20 bytes.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fkey_005fpurpose_005foid-1"><span>gnutls_x509_crq_get_key_purpose_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fkey_005fpurpose_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fkey_005fpurpose_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fkey_005fpurpose_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_key_purpose_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">sizeof_oid</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005fpurpose_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">indx</var>: This specifies which OID to return, use (0) to get the first one
</p>
<p><var class="var">oid</var>: a pointer to store the OID (may be <code class="code">NULL</code> )
</p>
<p><var class="var">sizeof_oid</var>: initially holds the size of <code class="code">oid</code>
</p>
<p><var class="var">critical</var>: output variable with critical flag, may be <code class="code">NULL</code> .
</p>
<p>This function will extract the key purpose OIDs of the Certificate
specified by the given index. These are stored in the Extended Key
Usage extension (2.5.29.37). See the GNUTLS_KP_* definitions for
human readable names.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the * <code class="code">sizeof_oid</code> will be
updated with the required size. On success 0 is returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fkey_005frsa_005fraw-1"><span>gnutls_x509_crq_get_key_rsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fkey_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fkey_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fkey_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_key_rsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: Holds the certificate
</p>
<p><var class="var">m</var>: will hold the modulus
</p>
<p><var class="var">e</var>: will hold the public exponent
</p>
<p>This function will export the RSA public key’s parameters found in
the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fkey_005fusage-1"><span>gnutls_x509_crq_get_key_usage<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_key_usage</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int * <var class="var">key_usage</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key_usage</var>: where the key usage bits will be stored
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return certificate’s key usage, by reading the
keyUsage X.509 extension (2.5.29.15). The key usage value will
ORed values of the: <code class="code">GNUTLS_KEY_DIGITAL_SIGNATURE</code> ,
<code class="code">GNUTLS_KEY_NON_REPUDIATION</code> , <code class="code">GNUTLS_KEY_KEY_ENCIPHERMENT</code> ,
<code class="code">GNUTLS_KEY_DATA_ENCIPHERMENT</code> , <code class="code">GNUTLS_KEY_KEY_AGREEMENT</code> ,
<code class="code">GNUTLS_KEY_KEY_CERT_SIGN</code> , <code class="code">GNUTLS_KEY_CRL_SIGN</code> ,
<code class="code">GNUTLS_KEY_ENCIPHER_ONLY</code> , <code class="code">GNUTLS_KEY_DECIPHER_ONLY</code> .
</p>
<p><strong class="strong">Returns:</strong> the certificate key usage, or a negative error code in case of
parsing error. If the certificate does not contain the keyUsage
extension <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fpk_005falgorithm-1"><span>gnutls_x509_crq_get_pk_algorithm<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int * <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">bits</var>: if bits is non-<code class="code">NULL</code> it will hold the size of the parameters’ in bits
</p>
<p>This function will return the public key algorithm of a PKCS<code class="code">10</code>
certificate request.
</p>
<p>If bits is non-<code class="code">NULL</code> , it should have enough size to hold the
parameters size in bits. For RSA the bits returned is the modulus.
For DSA the bits returned are of the public exponent.
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_pk_algorithm_t</code> enumeration on
success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fpk_005foid-1"><span>gnutls_x509_crq_get_pk_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fpk_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fpk_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fpk_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_pk_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, char * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fpk_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the OID of the public key algorithm
on that certificate request. This function
is useful in the case <code class="code">gnutls_x509_crq_get_pk_algorithm()</code>
returned <code class="code">GNUTLS_PK_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fprivate_005fkey_005fusage_005fperiod-1"><span>gnutls_x509_crq_get_private_key_usage_period<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fprivate_005fkey_005fusage_005fperiod-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fprivate_005fkey_005fusage_005fperiod"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fprivate_005fkey_005fusage_005fperiod"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_private_key_usage_period</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, time_t * <var class="var">activation</var>, time_t * <var class="var">expiration</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fprivate_005fkey_005fusage_005fperiod"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">activation</var>: The activation time
</p>
<p><var class="var">expiration</var>: The expiration time
</p>
<p><var class="var">critical</var>: the extension status
</p>
<p>This function will return the expiration and activation
times of the private key of the certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fsignature_005falgorithm-1"><span>gnutls_x509_crq_get_signature_algorithm<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fsignature_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fsignature_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fsignature_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_signature_algorithm</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fsignature_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_cr_t</code> type
</p>
<p>This function will return a value of the <code class="code">gnutls_sign_algorithm_t</code>
enumeration that is the signature algorithm that has been used to
sign this certificate request.
</p>
<p>Since 3.6.0 this function never returns a negative error code.
Error cases and unknown/unsupported signature algorithms are
mapped to <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_sign_algorithm_t</code> value
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fsignature_005foid-1"><span>gnutls_x509_crq_get_signature_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fsignature_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fsignature_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fsignature_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_signature_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, char * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fsignature_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the OID of the signature algorithm
that has been used to sign this certificate request. This function
is useful in the case <code class="code">gnutls_x509_crq_get_signature_algorithm()</code>
returned <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fspki-1"><span>gnutls_x509_crq_get_spki<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_spki</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_x509_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return the public key information of a PKCS<code class="code">10</code>
certificate request. The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Returns:</strong> Zero on success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fname-1"><span>gnutls_x509_crq_get_subject_alt_name<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_subject_alt_name</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">seq</var>, void * <var class="var">ret</var>, size_t * <var class="var">ret_size</var>, unsigned int * <var class="var">ret_type</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fname"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name, 0 for the
first one, 1 for the second etc.
</p>
<p><var class="var">ret</var>: is the place where the alternative name will be copied to
</p>
<p><var class="var">ret_size</var>: holds the size of ret.
</p>
<p><var class="var">ret_type</var>: holds the <code class="code">gnutls_x509_subject_alt_name_t</code> name type
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
(may be null)
</p>
<p>This function will return the alternative names, contained in the
given certificate. It is the same as
<code class="code">gnutls_x509_crq_get_subject_alt_name()</code> except for the fact that it
will return the type of the alternative name in <code class="code">ret_type</code> even if
the function fails for some reason (i.e. the buffer provided is
not enough).
</p>
<p><strong class="strong">Returns:</strong> the alternative subject name type on success, one of the
enumerated <code class="code">gnutls_x509_subject_alt_name_t</code> . It will return
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if <code class="code">ret_size</code> is not large enough to
hold the value. In that case <code class="code">ret_size</code> will be updated with the
required size. If the certificate request does not have an
Alternative name with the specified sequence number then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fothername_005foid-1"><span>gnutls_x509_crq_get_subject_alt_othername_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fothername_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fothername_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fothername_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_subject_alt_othername_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">seq</var>, void * <var class="var">ret</var>, size_t * <var class="var">ret_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fothername_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">ret</var>: is the place where the otherName OID will be copied to
</p>
<p><var class="var">ret_size</var>: holds the size of ret.
</p>
<p>This function will extract the type OID of an otherName Subject
Alternative Name, contained in the given certificate, and return
the type as an enumerated element.
</p>
<p>This function is only useful if
<code class="code">gnutls_x509_crq_get_subject_alt_name()</code> returned
<code class="code">GNUTLS_SAN_OTHERNAME</code> .
</p>
<p><strong class="strong">Returns:</strong> the alternative subject name type on success, one of the
enumerated gnutls_x509_subject_alt_name_t. For supported OIDs,
it will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types,
e.g. <code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> , and <code class="code">GNUTLS_SAN_OTHERNAME</code> for
unknown OIDs. It will return <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if
<code class="code">ret_size</code> is not large enough to hold the value. In that case
<code class="code">ret_size</code> will be updated with the required size. If the
certificate does not have an Alternative name with the specified
sequence number and with the otherName type then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005ftlsfeatures-1"><span>gnutls_x509_crq_get_tlsfeatures<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005ftlsfeatures-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005ftlsfeatures"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005ftlsfeatures"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_tlsfeatures</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_tlsfeatures_t <var class="var">features</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005ftlsfeatures"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: An X.509 certificate request
</p>
<p><var class="var">features</var>: If the function succeeds, the
features will be stored in this variable.
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_EXT_FLAG_APPEND</code>
</p>
<p><var class="var">critical</var>: the extension status
</p>
<p>This function will get the X.509 TLS features
extension structure from the certificate request.
The returned structure needs to be freed using
<code class="code">gnutls_x509_tlsfeatures_deinit()</code> .
</p>
<p>When the <code class="code">flags</code> is set to <code class="code">GNUTLS_EXT_FLAG_APPEND</code> ,
then if the <code class="code">features</code> structure is empty this function will behave
identically as if the flag was not set. Otherwise if there are elements
in the <code class="code">features</code> structure then they will be merged with.
</p>
<p>Note that <code class="code">features</code> must be initialized prior to calling this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fget_005fversion-1"><span>gnutls_x509_crq_get_version<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fget_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fget_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fget_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_get_version</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fget_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p>This function will return the version of the specified Certificate
request.
</p>
<p><strong class="strong">Returns:</strong> version of certificate request, or a negative error code on
error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fimport-1"><span>gnutls_x509_crq_import<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_import</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: The data to store the parsed certificate request.
</p>
<p><var class="var">data</var>: The DER or PEM encoded certificate.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p>This function will convert the given DER or PEM encoded certificate
request to a <code class="code">gnutls_x509_crq_t</code> type. The output will be
stored in <code class="code">crq</code> .
</p>
<p>If the Certificate is PEM encoded it should have a header of "NEW
CERTIFICATE REQUEST".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005finit-1"><span>gnutls_x509_crq_init<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_init</strong> <code class="def-code-arguments">(gnutls_x509_crq_t * <var class="var">crq</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005finit"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a PKCS<code class="code">10</code> certificate request
structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fprint-1"><span>gnutls_x509_crq_print<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_print</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: The data to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with null terminated string.
</p>
<p>This function will pretty print a certificate request, suitable for
display to a human.
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fattribute_005fby_005foid-1"><span>gnutls_x509_crq_set_attribute_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fattribute_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fattribute_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fattribute_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_attribute_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, void * <var class="var">buf</var>, size_t <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fattribute_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identifier in a null-terminated string
</p>
<p><var class="var">buf</var>: a pointer to a structure that holds the attribute data
</p>
<p><var class="var">buf_size</var>: holds the size of <code class="code">buf</code>
</p>
<p>This function will set the attribute in the certificate request
specified by the given Object ID. The provided attribute must be be DER
encoded.
</p>
<p>Attributes in a certificate request is an optional set of data
appended to the request. Their interpretation depends on the CA policy.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fbasic_005fconstraints-1"><span>gnutls_x509_crq_set_basic_constraints<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fbasic_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fbasic_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fbasic_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_basic_constraints</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">ca</var>, int <var class="var">pathLenConstraint</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fbasic_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate request of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">ca</var>: true(1) or false(0) depending on the Certificate authority status.
</p>
<p><var class="var">pathLenConstraint</var>: non-negative error codes indicate maximum length of path,
and negative error codes indicate that the pathLenConstraints field should
not be present.
</p>
<p>This function will set the basicConstraints certificate extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fchallenge_005fpassword-1"><span>gnutls_x509_crq_set_challenge_password<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fchallenge_005fpassword-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fchallenge_005fpassword"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fchallenge_005fpassword"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_challenge_password</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">pass</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fchallenge_005fpassword"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">pass</var>: holds a (0)-terminated password
</p>
<p>This function will set a challenge password to be used when
revoking the request.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fdn-1"><span>gnutls_x509_crq_set_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_dn</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">dn</var>, const char ** <var class="var">err</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">dn</var>: a comma separated DN string (RFC4514)
</p>
<p><var class="var">err</var>: indicates the error position (if any)
</p>
<p>This function will set the DN on the provided certificate.
The input string should be plain ASCII or UTF-8 encoded. On
DN parsing error <code class="code">GNUTLS_E_PARSING_ERROR</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fdn_005fby_005foid-1"><span>gnutls_x509_crq_set_dn_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fdn_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fdn_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fdn_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_dn_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, unsigned int <var class="var">raw_flag</var>, const void * <var class="var">data</var>, unsigned int <var class="var">sizeof_data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fdn_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identifier in a (0)-terminated string
</p>
<p><var class="var">raw_flag</var>: must be 0, or 1 if the data are DER encoded
</p>
<p><var class="var">data</var>: a pointer to the input data
</p>
<p><var class="var">sizeof_data</var>: holds the size of <code class="code">data</code>
</p>
<p>This function will set the part of the name of the Certificate
request subject, specified by the given OID. The input string
should be ASCII or UTF-8 encoded.
</p>
<p>Some helper macros with popular OIDs can be found in gnutls/x509.h
With this function you can only set the known OIDs. You can test
for known OIDs using <code class="code">gnutls_x509_dn_oid_known()</code> . For OIDs that are
not known (by gnutls) you should properly DER encode your data, and
call this function with raw_flag set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fextension_005fby_005foid-1"><span>gnutls_x509_crq_set_extension_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fextension_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fextension_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fextension_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_extension_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, const void * <var class="var">buf</var>, size_t <var class="var">sizeof_buf</var>, unsigned int <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fextension_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">oid</var>: holds an Object Identifier in null terminated string
</p>
<p><var class="var">buf</var>: a pointer to a DER encoded data
</p>
<p><var class="var">sizeof_buf</var>: holds the size of <code class="code">buf</code>
</p>
<p><var class="var">critical</var>: should be non-zero if the extension is to be marked as critical
</p>
<p>This function will set an the extension, by the specified OID, in
the certificate request. The extension data should be binary data DER
encoded.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fkey-1"><span>gnutls_x509_crq_set_key<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fkey-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_key</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fkey-1"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a private key
</p>
<p>This function will set the public parameters from the given private
key to the request.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fkey_005fpurpose_005foid-1"><span>gnutls_x509_crq_set_key_purpose_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fkey_005fpurpose_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fkey_005fpurpose_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fkey_005fpurpose_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_key_purpose_oid</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const void * <var class="var">oid</var>, unsigned int <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fkey_005fpurpose_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">oid</var>: a pointer to a null-terminated string that holds the OID
</p>
<p><var class="var">critical</var>: Whether this extension will be critical or not
</p>
<p>This function will set the key purpose OIDs of the Certificate.
These are stored in the Extended Key Usage extension (2.5.29.37)
See the GNUTLS_KP_* definitions for human readable names.
</p>
<p>Subsequent calls to this function will append OIDs to the OID list.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fkey_005frsa_005fraw-1"><span>gnutls_x509_crq_set_key_rsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fkey_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fkey_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fkey_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_key_rsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const gnutls_datum_t * <var class="var">m</var>, const gnutls_datum_t * <var class="var">e</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fkey_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">m</var>: holds the modulus
</p>
<p><var class="var">e</var>: holds the public exponent
</p>
<p>This function will set the public parameters from the given private
key to the request. Only RSA keys are currently supported.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fkey_005fusage-1"><span>gnutls_x509_crq_set_key_usage<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_key_usage</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">usage</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate request of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">usage</var>: an ORed sequence of the GNUTLS_KEY_* elements.
</p>
<p>This function will set the keyUsage certificate extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fprivate_005fkey_005fusage_005fperiod-1"><span>gnutls_x509_crq_set_private_key_usage_period<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fprivate_005fkey_005fusage_005fperiod-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fprivate_005fkey_005fusage_005fperiod"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fprivate_005fkey_005fusage_005fperiod"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_private_key_usage_period</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, time_t <var class="var">activation</var>, time_t <var class="var">expiration</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fprivate_005fkey_005fusage_005fperiod"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">activation</var>: The activation time
</p>
<p><var class="var">expiration</var>: The expiration time
</p>
<p>This function will set the private key usage period extension (2.5.29.16).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fspki-1"><span>gnutls_x509_crq_set_spki<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_spki</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate request of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_x509_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will set the certificate request’s subject public key
information explicitly. This is intended to be used in the cases
where a single public key (e.g., RSA) can be used for multiple
signature algorithms (RSA PKCS1-1.5, and RSA-PSS).
</p>
<p>To export the public key (i.e., the SubjectPublicKeyInfo part), check
<code class="code">gnutls_pubkey_import_x509()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fname-1"><span>gnutls_x509_crq_set_subject_alt_name<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_subject_alt_name</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_subject_alt_name_t <var class="var">nt</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fname"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate request of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">nt</var>: is one of the <code class="code">gnutls_x509_subject_alt_name_t</code> enumerations
</p>
<p><var class="var">data</var>: The data to be set
</p>
<p><var class="var">data_size</var>: The size of data to be set
</p>
<p><var class="var">flags</var>: <code class="code">GNUTLS_FSAN_SET</code> to clear previous data or
<code class="code">GNUTLS_FSAN_APPEND</code> to append.
</p>
<p>This function will set the subject alternative name certificate
extension. It can set the following types:
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fothername-1"><span>gnutls_x509_crq_set_subject_alt_othername<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fothername-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fothername"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fothername"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_subject_alt_othername</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fothername"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: a certificate request of type <code class="code">gnutls_x509_crq_t</code>
</p>
<p><var class="var">oid</var>: is the othername OID
</p>
<p><var class="var">data</var>: The data to be set
</p>
<p><var class="var">data_size</var>: The size of data to be set
</p>
<p><var class="var">flags</var>: <code class="code">GNUTLS_FSAN_SET</code> to clear previous data or
<code class="code">GNUTLS_FSAN_APPEND</code> to append.
</p>
<p>This function will set the subject alternative name certificate
extension. It can set the following types:
</p>
<p>The values set must be binary values and must be properly DER encoded.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005ftlsfeatures-1"><span>gnutls_x509_crq_set_tlsfeatures<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005ftlsfeatures-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005ftlsfeatures"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005ftlsfeatures"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_tlsfeatures</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_tlsfeatures_t <var class="var">features</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005ftlsfeatures"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: An X.509 certificate request
</p>
<p><var class="var">features</var>: If the function succeeds, the
features will be added to the certificate
request.
</p>
<p>This function will set the certificate request’s
X.509 TLS extension from the given structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fversion-1"><span>gnutls_x509_crq_set_version<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_version</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">version</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">version</var>: holds the version number, for v1 Requests must be 1
</p>
<p>This function will set the version of the certificate request. For
version 1 requests this must be one.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fsign-1"><span>gnutls_x509_crq_sign<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fsign"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_sign</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a private key
</p>
<p>This function is the same a <code class="code">gnutls_x509_crq_sign2()</code> with no flags,
and an appropriate hash algorithm. The hash algorithm used may
vary between versions of GnuTLS, and it is tied to the security
level of the issuer’s public key.
</p>
<p>A known limitation of this function is, that a newly-signed request will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fsign2-1"><span>gnutls_x509_crq_sign2<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fsign2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fsign2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fsign2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_sign2</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_x509_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fsign2-1"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a private key
</p>
<p><var class="var">dig</var>: The message digest to use, i.e., <code class="code">GNUTLS_DIG_SHA256</code>
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the certificate request with a private key.
This must be the same key as the one used in
<code class="code">gnutls_x509_crt_set_key()</code> since a certificate request is self
signed.
</p>
<p>This must be the last step in a certificate request generation
since all the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed request will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
<code class="code">GNUTLS_E_ASN1_VALUE_NOT_FOUND</code> is returned if you didn’t set all
information in the certificate request (e.g., the version using
<code class="code">gnutls_x509_crq_set_version()</code> ).
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fverify-1"><span>gnutls_x509_crq_verify<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fverify-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fverify"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fverify"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_verify</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fverify"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: is the crq to be verified
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p>This function will verify self signature in the certificate
request and return its status.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code>
is returned, and zero or positive code on success.
</p>
<p>Since 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcheck_005femail-1"><span>gnutls_x509_crt_check_email<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcheck_005femail-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcheck_005femail"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcheck_005femail"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_check_email</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">email</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcheck_005femail"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain an gnutls_x509_crt_t type
</p>
<p><var class="var">email</var>: A null terminated string that contains an email address (RFC822)
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will check if the given certificate’s subject matches
the given email address.
</p>
<p><strong class="strong">Returns:</strong> non-zero for a successful match, and zero on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcheck_005fhostname-1"><span>gnutls_x509_crt_check_hostname<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcheck_005fhostname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcheck_005fhostname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcheck_005fhostname"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_check_hostname</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">hostname</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcheck_005fhostname"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain an gnutls_x509_crt_t type
</p>
<p><var class="var">hostname</var>: A null terminated string that contains a DNS name
</p>
<p>This function will check if the given certificate’s subject matches
the given hostname. This is a basic implementation of the matching
described in RFC6125, and takes into account wildcards,
and the DNSName/IPAddress subject alternative name PKIX extension.
</p>
<p>For details see also <code class="code">gnutls_x509_crt_check_hostname2()</code> .
</p>
<p><strong class="strong">Returns:</strong> non-zero for a successful match, and zero on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcheck_005fhostname2-1"><span>gnutls_x509_crt_check_hostname2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcheck_005fhostname2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcheck_005fhostname2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcheck_005fhostname2"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_check_hostname2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">hostname</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcheck_005fhostname2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain an gnutls_x509_crt_t type
</p>
<p><var class="var">hostname</var>: A null terminated string that contains a DNS name
</p>
<p><var class="var">flags</var>: gnutls_certificate_verify_flags
</p>
<p>This function will check if the given certificate’s subject matches
the given hostname. This is a basic implementation of the matching
described in RFC6125, and takes into account wildcards,
and the DNSName/IPAddress subject alternative name PKIX extension.
</p>
<p>IPv4 addresses are accepted by this function in the dotted-decimal
format (e.g, ddd.ddd.ddd.ddd), and IPv6 addresses in the hexadecimal
x:x:x:x:x:x:x:x format. For them the IPAddress subject alternative
name extension is consulted. Previous versions to 3.6.0 of GnuTLS
in case of a non-match would consult (in a non-standard extension)
the DNSname and CN fields. This is no longer the case.
</p>
<p>When the flag <code class="code">GNUTLS_VERIFY_DO_NOT_ALLOW_WILDCARDS</code> is specified no
wildcards are considered. Otherwise they are only considered if the
domain name consists of three components or more, and the wildcard
starts at the leftmost position.
When the flag <code class="code">GNUTLS_VERIFY_DO_NOT_ALLOW_IP_MATCHES</code> is specified,
the input will be treated as a DNS name, and matching of textual IP addresses
against the IPAddress part of the alternative name will not be allowed.
</p>
<p>The function <code class="code">gnutls_x509_crt_check_ip()</code> is available for matching
IP addresses.
</p>
<p><strong class="strong">Returns:</strong> non-zero for a successful match, and zero on failure.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcheck_005fip-1"><span>gnutls_x509_crt_check_ip<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcheck_005fip-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcheck_005fip"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcheck_005fip"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_check_ip</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const unsigned char * <var class="var">ip</var>, unsigned int <var class="var">ip_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcheck_005fip"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain an gnutls_x509_crt_t type
</p>
<p><var class="var">ip</var>: A pointer to the raw IP address
</p>
<p><var class="var">ip_size</var>: the number of bytes in ip (4 or 16)
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will check if the IP allowed IP addresses in
the certificate’s subject alternative name match the provided
IP address.
</p>
<p><strong class="strong">Returns:</strong> non-zero for a successful match, and zero on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcheck_005fissuer-1"><span>gnutls_x509_crt_check_issuer<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcheck_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcheck_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcheck_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_check_issuer</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_crt_t <var class="var">issuer</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcheck_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: is the certificate to be checked
</p>
<p><var class="var">issuer</var>: is the certificate of a possible issuer
</p>
<p>This function will check if the given certificate was issued by the
given issuer. It checks the DN fields and the authority
key identifier and subject key identifier fields match.
</p>
<p>If the same certificate is provided at the <code class="code">cert</code> and <code class="code">issuer</code> fields,
it will check whether the certificate is self-signed.
</p>
<p><strong class="strong">Returns:</strong> It will return true (1) if the given certificate is issued
by the given issuer, and false (0) if not.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcheck_005fkey_005fpurpose-1"><span>gnutls_x509_crt_check_key_purpose<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcheck_005fkey_005fpurpose-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcheck_005fkey_005fpurpose"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcheck_005fkey_005fpurpose"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_check_key_purpose</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">purpose</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcheck_005fkey_005fpurpose"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">purpose</var>: a key purpose OID (e.g., <code class="code">GNUTLS_KP_CODE_SIGNING</code> )
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_KP_FLAG_DISALLOW_ANY</code>
</p>
<p>This function will check whether the given certificate matches
the provided key purpose. If <code class="code">flags</code> contains <code class="code">GNUTLS_KP_FLAG_ALLOW_ANY</code> then
it a certificate marked for any purpose will not match.
</p>
<p><strong class="strong">Returns:</strong> zero if the key purpose doesn’t match, and non-zero otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.5.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcheck_005frevocation-1"><span>gnutls_x509_crt_check_revocation<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcheck_005frevocation-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcheck_005frevocation"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcheck_005frevocation"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_check_revocation</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const gnutls_x509_crl_t * <var class="var">crl_list</var>, unsigned <var class="var">crl_list_length</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcheck_005frevocation"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">crl_list</var>: should contain a list of gnutls_x509_crl_t types
</p>
<p><var class="var">crl_list_length</var>: the length of the crl_list
</p>
<p>This function will check if the given certificate is
revoked. It is assumed that the CRLs have been verified before.
</p>
<p><strong class="strong">Returns:</strong> 0 if the certificate is NOT revoked, and 1 if it is. A
negative error code is returned on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fcpy_005fcrl_005fdist_005fpoints-1"><span>gnutls_x509_crt_cpy_crl_dist_points<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fcpy_005fcrl_005fdist_005fpoints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fcpy_005fcrl_005fdist_005fpoints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fcpy_005fcrl_005fdist_005fpoints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_cpy_crl_dist_points</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">dst</var>, gnutls_x509_crt_t <var class="var">src</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fcpy_005fcrl_005fdist_005fpoints"> ¶</a></span></dt>
<dd><p><var class="var">dst</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">src</var>: the certificate where the dist points will be copied from
</p>
<p>This function will copy the CRL distribution points certificate
extension, from the source to the destination certificate.
This may be useful to copy from a CA certificate to issued ones.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fdeinit-1"><span>gnutls_x509_crt_deinit<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_crt_deinit</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: The data to be deinitialized
</p>
<p>This function will deinitialize a certificate structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fequals-1"><span>gnutls_x509_crt_equals<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fequals-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fequals"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fequals"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_equals</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert1</var>, gnutls_x509_crt_t <var class="var">cert2</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fequals"> ¶</a></span></dt>
<dd><p><var class="var">cert1</var>: The first certificate
</p>
<p><var class="var">cert2</var>: The second certificate
</p>
<p>This function will compare two X.509 certificate structures.
</p>
<p><strong class="strong">Returns:</strong> On equality non-zero is returned, otherwise zero.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fequals2-1"><span>gnutls_x509_crt_equals2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fequals2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fequals2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fequals2"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_crt_equals2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert1</var>, const gnutls_datum_t * <var class="var">der</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fequals2"> ¶</a></span></dt>
<dd><p><var class="var">cert1</var>: The first certificate
</p>
<p><var class="var">der</var>: A DER encoded certificate
</p>
<p>This function will compare an X.509 certificate structures, with DER
encoded certificate data.
</p>
<p><strong class="strong">Returns:</strong> On equality non-zero is returned, otherwise zero.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fexport-1"><span>gnutls_x509_crt_export<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_export</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: Holds the certificate
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a certificate PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the certificate to DER or PEM format.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fexport2-1"><span>gnutls_x509_crt_export2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_export2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: Holds the certificate
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a certificate PEM or DER encoded
</p>
<p>This function will export the certificate to DER or PEM format.
The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005factivation_005ftime-1"><span>gnutls_x509_crt_get_activation_time<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005factivation_005ftime-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005factivation_005ftime"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005factivation_005ftime"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_x509_crt_get_activation_time</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005factivation_005ftime"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p>This function will return the time this Certificate was or will be
activated.
</p>
<p><strong class="strong">Returns:</strong> activation time, or (time_t)-1 on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fauthority_005finfo_005faccess-1"><span>gnutls_x509_crt_get_authority_info_access<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fauthority_005finfo_005faccess-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fauthority_005finfo_005faccess"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fauthority_005finfo_005faccess"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_authority_info_access</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">seq</var>, int <var class="var">what</var>, gnutls_datum_t * <var class="var">data</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fauthority_005finfo_005faccess"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">seq</var>: specifies the sequence number of the access descriptor (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">what</var>: what data to get, a <code class="code">gnutls_info_access_what_t</code> type.
</p>
<p><var class="var">data</var>: output data to be freed with <code class="code">gnutls_free()</code> .
</p>
<p><var class="var">critical</var>: pointer to output integer that is set to non-zero if the extension is marked as critical (may be <code class="code">NULL</code> )
</p>
<p>Note that a simpler API to access the authority info data is provided
by <code class="code">gnutls_x509_aia_get()</code> and <code class="code">gnutls_x509_ext_import_aia()</code> .
</p>
<p>This function extracts the Authority Information Access (AIA)
extension, see RFC 5280 section 4.2.2.1 for more information. The
AIA extension holds a sequence of AccessDescription (AD) data.
</p>
<p>The <code class="code">seq</code> input parameter is used to indicate which member of the
sequence the caller is interested in. The first member is 0, the
second member 1 and so on. When the <code class="code">seq</code> value is out of bounds,
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p>The type of data returned in <code class="code">data</code> is specified via <code class="code">what</code> which
should be <code class="code">gnutls_info_access_what_t</code> values.
</p>
<p>If <code class="code">what</code> is <code class="code">GNUTLS_IA_ACCESSMETHOD_OID</code> then <code class="code">data</code> will hold the
accessMethod OID (e.g., "1.3.6.1.5.5.7.48.1").
</p>
<p>If <code class="code">what</code> is <code class="code">GNUTLS_IA_ACCESSLOCATION_GENERALNAME_TYPE</code> , <code class="code">data</code> will
hold the accessLocation GeneralName type (e.g.,
"uniformResourceIdentifier").
</p>
<p>If <code class="code">what</code> is <code class="code">GNUTLS_IA_URI</code> , <code class="code">data</code> will hold the accessLocation URI
data. Requesting this <code class="code">what</code> value leads to an error if the
accessLocation is not of the "uniformResourceIdentifier" type.
</p>
<p>If <code class="code">what</code> is <code class="code">GNUTLS_IA_OCSP_URI</code> , <code class="code">data</code> will hold the OCSP URI.
Requesting this <code class="code">what</code> value leads to an error if the accessMethod
is not 1.3.6.1.5.5.7.48.1 aka OCSP, or if accessLocation is not of
the "uniformResourceIdentifier" type. In that case <code class="code">GNUTLS_E_UNKNOWN_ALGORITHM</code>
will be returned, and <code class="code">seq</code> should be increased and this function
called again.
</p>
<p>If <code class="code">what</code> is <code class="code">GNUTLS_IA_CAISSUERS_URI</code> , <code class="code">data</code> will hold the caIssuers
URI. Requesting this <code class="code">what</code> value leads to an error if the
accessMethod is not 1.3.6.1.5.5.7.48.2 aka caIssuers, or if
accessLocation is not of the "uniformResourceIdentifier" type.
In that case handle as in <code class="code">GNUTLS_IA_OCSP_URI</code> .
</p>
<p>More <code class="code">what</code> values may be allocated in the future as needed.
</p>
<p>If <code class="code">data</code> is NULL, the function does the same without storing the
output data, that is, it will set <code class="code">critical</code> and do error checking
as usual.
</p>
<p>The value of the critical flag is returned in * <code class="code">critical</code> . Supply a
NULL <code class="code">critical</code> if you want the function to make sure the extension
is non-critical, as required by RFC 5280.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, <code class="code">GNUTLS_E_INVALID_REQUEST</code> on
invalid <code class="code">crt</code> , <code class="code">GNUTLS_E_CONSTRAINT_ERROR</code> if the extension is
incorrectly marked as critical (use a non-NULL <code class="code">critical</code> to
override), <code class="code">GNUTLS_E_UNKNOWN_ALGORITHM</code> if the requested OID does
not match (e.g., when using <code class="code">GNUTLS_IA_OCSP_URI</code> ), otherwise a
negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fgn_005fserial-1"><span>gnutls_x509_crt_get_authority_key_gn_serial<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fgn_005fserial-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fgn_005fserial"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fgn_005fserial"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_authority_key_gn_serial</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">alt</var>, size_t * <var class="var">alt_size</var>, unsigned int * <var class="var">alt_type</var>, void * <var class="var">serial</var>, size_t * <var class="var">serial_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fgn_005fserial"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">alt</var>: is the place where the alternative name will be copied to
</p>
<p><var class="var">alt_size</var>: holds the size of alt.
</p>
<p><var class="var">alt_type</var>: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
</p>
<p><var class="var">serial</var>: buffer to store the serial number (may be null)
</p>
<p><var class="var">serial_size</var>: Holds the size of the serial field (may be null)
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function will return the X.509 authority key
identifier when stored as a general name (authorityCertIssuer)
and serial number.
</p>
<p>Because more than one general names might be stored
<code class="code">seq</code> can be used as a counter to request them all until
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fid-1"><span>gnutls_x509_crt_get_authority_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_authority_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, void * <var class="var">id</var>, size_t * <var class="var">id_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">id</var>: The place where the identifier will be copied
</p>
<p><var class="var">id_size</var>: Holds the size of the id field.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function will return the X.509v3 certificate authority’s key
identifier. This is obtained by the X.509 Authority Key
identifier extension field (2.5.29.35). Note that this function
only returns the keyIdentifier field of the extension and
<code class="code">GNUTLS_E_X509_UNSUPPORTED_EXTENSION</code> , if the extension contains
the name and serial number of the certificate. In that case
<code class="code">gnutls_x509_crt_get_authority_key_gn_serial()</code> may be used.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fbasic_005fconstraints-1"><span>gnutls_x509_crt_get_basic_constraints<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fbasic_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fbasic_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fbasic_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_basic_constraints</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">critical</var>, unsigned int * <var class="var">ca</var>, int * <var class="var">pathlen</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fbasic_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p><var class="var">ca</var>: pointer to output integer indicating CA status, may be NULL,
value is 1 if the certificate CA flag is set, 0 otherwise.
</p>
<p><var class="var">pathlen</var>: pointer to output integer indicating path length (may be
NULL), non-negative error codes indicate a present pathLenConstraint
field and the actual value, -1 indicate that the field is absent.
</p>
<p>This function will read the certificate’s basic constraints, and
return the certificates CA status. It reads the basicConstraints
X.509 extension (2.5.29.19).
</p>
<p><strong class="strong">Returns:</strong> If the certificate is a CA a positive value will be
returned, or (0) if the certificate does not have CA flag set. A
negative error code may be returned in case of errors. If the
certificate does not contain the basicConstraints extension
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fca_005fstatus-1"><span>gnutls_x509_crt_get_ca_status<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fca_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fca_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fca_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_ca_status</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fca_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return certificates CA status, by reading the
basicConstraints X.509 extension (2.5.29.19). If the certificate is
a CA a positive value will be returned, or (0) if the certificate
does not have CA flag set.
</p>
<p>Use <code class="code">gnutls_x509_crt_get_basic_constraints()</code> if you want to read the
pathLenConstraint field too.
</p>
<p><strong class="strong">Returns:</strong> If the certificate is a CA a positive value will be
returned, or (0) if the certificate does not have CA flag set. A
negative error code may be returned in case of errors. If the
certificate does not contain the basicConstraints extension
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fcrl_005fdist_005fpoints-1"><span>gnutls_x509_crt_get_crl_dist_points<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fcrl_005fdist_005fpoints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fcrl_005fdist_005fpoints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fcrl_005fdist_005fpoints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_crl_dist_points</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">san</var>, size_t * <var class="var">san_size</var>, unsigned int * <var class="var">reason_flags</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fcrl_005fdist_005fpoints"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the distribution point (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">san</var>: is the place where the distribution point will be copied to
</p>
<p><var class="var">san_size</var>: holds the size of ret.
</p>
<p><var class="var">reason_flags</var>: Revocation reasons. An ORed sequence of flags from <code class="code">gnutls_x509_crl_reason_flags_t</code> .
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function retrieves the CRL distribution points (2.5.29.31),
contained in the given certificate in the X509v3 Certificate
Extensions.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> and updates <code class="code">ret_size</code> if
<code class="code">ret_size</code> is not enough to hold the distribution point, or the
type of the distribution point if everything was ok. The type is
one of the enumerated <code class="code">gnutls_x509_subject_alt_name_t</code> . If the
certificate does not have an Alternative name with the specified
sequence number then <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is
returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fdn-1"><span>gnutls_x509_crt_get_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_dn</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the name (may be null)
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will copy the name of the Certificate in the provided
buffer. The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>The <code class="code">buf</code> returned will be null terminated and the <code class="code">buf_size</code> will account
for the trailing null. If <code class="code">buf</code> is null then only the size will be filled.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crt_get_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is not
long enough, and in that case the <code class="code">buf_size</code> will be updated
with the required size. <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if
the DN does not exist, or another error value on error. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fdn2-1"><span>gnutls_x509_crt_get_dn2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fdn2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fdn2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fdn2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_dn2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fdn2-1"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p>This function will allocate buffer and copy the name of the Certificate.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crt_get_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fdn3-1"><span>gnutls_x509_crt_get_dn3<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fdn3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fdn3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fdn3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_dn3</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fdn3"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code>
</p>
<p>This function will allocate buffer and copy the name of the Certificate.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>When the flag <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code> is specified, the output
format will match the format output by previous to 3.5.6 versions of GnuTLS
which was not not fully RFC4514-compliant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid-1"><span>gnutls_x509_crt_get_dn_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_dn_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, unsigned int <var class="var">raw_flag</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identified in null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one.
</p>
<p><var class="var">raw_flag</var>: If non-zero returns the raw DER data of the DN part.
</p>
<p><var class="var">buf</var>: a pointer where the DN part will be copied (may be null).
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will extract the part of the name of the Certificate
subject specified by the given OID. The output, if the raw flag is
not used, will be encoded as described in RFC4514. Thus a string
that is ASCII or UTF-8 encoded, depending on the certificate data.
</p>
<p>Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is (0), this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC4514 –
in hex format with a ’#’ prefix. You can check about known OIDs
using <code class="code">gnutls_x509_dn_oid_known()</code> .
</p>
<p>If <code class="code">buf</code> is null then only the size will be filled. If the <code class="code">raw_flag</code> is not specified the output is always null terminated, although the
<code class="code">buf_size</code> will not include the null character.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is not
long enough, and in that case the <code class="code">buf_size</code> will be updated with
the required size. <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if there
are no data in the current index. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fdn_005foid-1"><span>gnutls_x509_crt_get_dn_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fdn_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fdn_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fdn_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_dn_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fdn_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: This specifies which OID to return. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will extract the OIDs of the name of the Certificate
subject specified by the given index.
</p>
<p>If <code class="code">oid</code> is null then only the size will be filled. The <code class="code">oid</code> returned will be null terminated, although <code class="code">oid_size</code> will not
account for the trailing null.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is not
long enough, and in that case the <code class="code">buf_size</code> will be updated with
the required size. <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if there
are no data in the current index. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fexpiration_005ftime-1"><span>gnutls_x509_crt_get_expiration_time<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fexpiration_005ftime-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fexpiration_005ftime"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fexpiration_005ftime"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_x509_crt_get_expiration_time</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fexpiration_005ftime"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p>This function will return the time this certificate was or will be
expired.
</p>
<p><strong class="strong">Returns:</strong> expiration time, or (time_t)-1 on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid-1"><span>gnutls_x509_crt_get_extension_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_extension_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identified in null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the extensions, this specifies which to send. Use (0) to get the first one.
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the name (may be null)
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return the extension specified by the OID in the
certificate. The extensions will be returned as binary data DER
encoded, in the provided buffer.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If the certificate does not
contain the specified extension
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid2-1"><span>gnutls_x509_crt_get_extension_by_oid2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_extension_by_oid2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">output</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identified in null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the extensions, this specifies which to send. Use (0) to get the first one.
</p>
<p><var class="var">output</var>: will hold the allocated extension data
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return the extension specified by the OID in the
certificate. The extensions will be returned as binary data DER
encoded, in the provided buffer.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If the certificate does not
contain the specified extension
GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fdata-1"><span>gnutls_x509_crt_get_extension_data<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fextension_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_extension_data</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">data</var>, size_t * <var class="var">sizeof_data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to send. Use (0) to get the first one.
</p>
<p><var class="var">data</var>: a pointer to a structure to hold the data (may be null)
</p>
<p><var class="var">sizeof_data</var>: initially holds the size of <code class="code">data</code>
</p>
<p>This function will return the requested extension data in the
certificate. The extension data will be stored in the
provided buffer.
</p>
<p>Use <code class="code">gnutls_x509_crt_get_extension_info()</code> to extract the OID and
critical flag. Use <code class="code">gnutls_x509_crt_get_extension_by_oid()</code> instead,
if you want to get data indexed by the extension OID rather than
sequence.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If you have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fdata2-1"><span>gnutls_x509_crt_get_extension_data2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fextension_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fextension_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_extension_data2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to read. Use (0) to get the first one.
</p>
<p><var class="var">data</var>: will contain the extension DER-encoded data
</p>
<p>This function will return the requested by the index extension data in the
certificate. The extension data will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p>Use <code class="code">gnutls_x509_crt_get_extension_info()</code> to extract the OID.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If you have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fextension_005finfo-1"><span>gnutls_x509_crt_get_extension_info<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fextension_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fextension_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_extension_info</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to send. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to a structure to hold the OID
</p>
<p><var class="var">oid_size</var>: initially holds the maximum size of <code class="code">oid</code> , on return
holds actual size of <code class="code">oid</code> .
</p>
<p><var class="var">critical</var>: output variable with critical flag, may be NULL.
</p>
<p>This function will return the requested extension OID in the
certificate, and the critical flag for it. The extension OID will
be stored as a string in the provided buffer. Use
<code class="code">gnutls_x509_crt_get_extension()</code> to extract the data.
</p>
<p>If the buffer provided is not long enough to hold the output, then
<code class="code">oid_size</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be
returned. The <code class="code">oid</code> returned will be null terminated, although
<code class="code">oid_size</code> will not account for the trailing null (the latter is not
true for GnuTLS prior to 3.6.0).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If you have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fextension_005foid-1"><span>gnutls_x509_crt_get_extension_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fextension_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fextension_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fextension_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_extension_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to send. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to a structure to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the requested extension OID in the certificate.
The extension OID will be stored as a string in the provided buffer.
</p>
<p>The <code class="code">oid</code> returned will be null terminated, although <code class="code">oid_size</code> will not
account for the trailing null.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned. If you have reached the
last extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005ffingerprint-1"><span>gnutls_x509_crt_get_fingerprint<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005ffingerprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005ffingerprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005ffingerprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_fingerprint</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_digest_algorithm_t <var class="var">algo</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005ffingerprint"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">algo</var>: is a digest algorithm
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the fingerprint (may be null)
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will calculate and copy the certificate’s fingerprint
in the provided buffer. The fingerprint is a hash of the DER-encoded
data of the certificate.
</p>
<p>If the buffer is null then only the size will be filled.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the *buf_size will be updated
with the required size. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005finhibit_005fanypolicy-1"><span>gnutls_x509_crt_get_inhibit_anypolicy<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005finhibit_005fanypolicy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005finhibit_005fanypolicy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005finhibit_005fanypolicy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_inhibit_anypolicy</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">skipcerts</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005finhibit_005fanypolicy"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">skipcerts</var>: will hold the number of certificates after which anypolicy is no longer acceptable.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return certificate’s value of the SkipCerts, i.e.,
the Inhibit anyPolicy X.509 extension (2.5.29.54).
</p>
<p>The returned value is the number of additional certificates that
may appear in the path before the anyPolicy is no longer acceptable.
</p>
<p><strong class="strong">Returns:</strong> zero on success, or a negative error code in case of
parsing error. If the certificate does not contain the Inhibit anyPolicy
extension <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer-1"><span>gnutls_x509_crt_get_issuer<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_dn_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: output variable with pointer to uint8_t DN
</p>
<p>Return the Certificate’s Issuer DN as a <code class="code">gnutls_x509_dn_t</code> data type,
that can be decoded using <code class="code">gnutls_x509_dn_get_rdn_ava()</code> .
</p>
<p>Note that <code class="code">dn</code> should be treated as constant. Because it points
into the <code class="code">cert</code> object, you should not use <code class="code">dn</code> after <code class="code">cert</code> is
deallocated.
</p>
<p><strong class="strong">Returns:</strong> Returns 0 on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname-1"><span>gnutls_x509_crt_get_issuer_alt_name<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_alt_name</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">ian</var>, size_t * <var class="var">ian_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">ian</var>: is the place where the alternative name will be copied to
</p>
<p><var class="var">ian_size</var>: holds the size of ian.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function retrieves the Issuer Alternative Name (2.5.29.18),
contained in the given certificate in the X509v3 Certificate
Extensions.
</p>
<p>When the SAN type is otherName, it will extract the data in the
otherName’s value field, and <code class="code">GNUTLS_SAN_OTHERNAME</code> is returned.
You may use <code class="code">gnutls_x509_crt_get_subject_alt_othername_oid()</code> to get
the corresponding OID and the "virtual" SAN types (e.g.,
<code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> ).
</p>
<p>If an otherName OID is known, the data will be decoded. Otherwise
the returned data will be DER encoded, and you will have to decode
it yourself. Currently, only the RFC 3920 id-on-xmppAddr Issuer
AltName is recognized.
</p>
<p><strong class="strong">Returns:</strong> the alternative issuer name type on success, one of the
enumerated <code class="code">gnutls_x509_subject_alt_name_t</code> . It will return
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if <code class="code">ian_size</code> is not large enough
to hold the value. In that case <code class="code">ian_size</code> will be updated with
the required size. If the certificate does not have an
Alternative name with the specified sequence number then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname2-1"><span>gnutls_x509_crt_get_issuer_alt_name2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_alt_name2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">ian</var>, size_t * <var class="var">ian_size</var>, unsigned int * <var class="var">ian_type</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">ian</var>: is the place where the alternative name will be copied to
</p>
<p><var class="var">ian_size</var>: holds the size of ret.
</p>
<p><var class="var">ian_type</var>: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function will return the alternative names, contained in the
given certificate. It is the same as
<code class="code">gnutls_x509_crt_get_issuer_alt_name()</code> except for the fact that it
will return the type of the alternative name in <code class="code">ian_type</code> even if
the function fails for some reason (i.e. the buffer provided is
not enough).
</p>
<p><strong class="strong">Returns:</strong> the alternative issuer name type on success, one of the
enumerated <code class="code">gnutls_x509_subject_alt_name_t</code> . It will return
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if <code class="code">ian_size</code> is not large enough
to hold the value. In that case <code class="code">ian_size</code> will be updated with
the required size. If the certificate does not have an
Alternative name with the specified sequence number then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fothername_005foid-1"><span>gnutls_x509_crt_get_issuer_alt_othername_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fothername_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fothername_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fothername_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_alt_othername_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">ret</var>, size_t * <var class="var">ret_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fothername_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">ret</var>: is the place where the otherName OID will be copied to
</p>
<p><var class="var">ret_size</var>: holds the size of ret.
</p>
<p>This function will extract the type OID of an otherName Subject
Alternative Name, contained in the given certificate, and return
the type as an enumerated element.
</p>
<p>If <code class="code">oid</code> is null then only the size will be filled. The <code class="code">oid</code> returned will be null terminated, although <code class="code">oid_size</code> will not
account for the trailing null.
</p>
<p>This function is only useful if
<code class="code">gnutls_x509_crt_get_issuer_alt_name()</code> returned
<code class="code">GNUTLS_SAN_OTHERNAME</code> .
</p>
<p><strong class="strong">Returns:</strong> the alternative issuer name type on success, one of the
enumerated gnutls_x509_subject_alt_name_t. For supported OIDs, it
will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types,
e.g. <code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> , and <code class="code">GNUTLS_SAN_OTHERNAME</code> for
unknown OIDs. It will return <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if
<code class="code">ret_size</code> is not large enough to hold the value. In that case
<code class="code">ret_size</code> will be updated with the required size. If the
certificate does not have an Alternative name with the specified
sequence number and with the otherName type then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn-1"><span>gnutls_x509_crt_get_issuer_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_dn</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the name (may be null)
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will copy the name of the Certificate issuer in the
provided buffer. The name will be in the form
"C=xxxx,O=yyyy,CN=zzzz" as described in RFC4514. The output string
will be ASCII or UTF-8 encoded, depending on the certificate data.
</p>
<p>If <code class="code">buf</code> is null then only the size will be filled.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crt_get_issuer_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is not
long enough, and in that case the <code class="code">buf_size</code> will be updated
with the required size. <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if
the DN does not exist, or another error value on error. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn2-1"><span>gnutls_x509_crt_get_issuer_dn2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_dn2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p>This function will allocate buffer and copy the name of issuer of the Certificate.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_crt_get_issuer_dn3()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn3-1"><span>gnutls_x509_crt_get_issuer_dn3<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_dn3</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn3"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: a pointer to a structure to hold the name; must be freed using <code class="code">gnutls_free()</code>
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code>
</p>
<p>This function will allocate buffer and copy the name of issuer of the Certificate.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>When the flag <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code> is specified, the output
format will match the format output by previous to 3.5.6 versions of GnuTLS
which was not not fully RFC4514-compliant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005fby_005foid-1"><span>gnutls_x509_crt_get_issuer_dn_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_dn_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, unsigned int <var class="var">raw_flag</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">oid</var>: holds an Object Identified in null terminated string
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the RDN, this specifies which to send. Use (0) to get the first one.
</p>
<p><var class="var">raw_flag</var>: If non-zero returns the raw DER data of the DN part.
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the name (may be null)
</p>
<p><var class="var">buf_size</var>: initially holds the size of <code class="code">buf</code>
</p>
<p>This function will extract the part of the name of the Certificate
issuer specified by the given OID. The output, if the raw flag is not
used, will be encoded as described in RFC4514. Thus a string that is
ASCII or UTF-8 encoded, depending on the certificate data.
</p>
<p>Some helper macros with popular OIDs can be found in gnutls/x509.h
If raw flag is (0), this function will only return known OIDs as
text. Other OIDs will be DER encoded, as described in RFC4514 –
in hex format with a ’#’ prefix. You can check about known OIDs
using <code class="code">gnutls_x509_dn_oid_known()</code> .
</p>
<p>If <code class="code">buf</code> is null then only the size will be filled. If the <code class="code">raw_flag</code> is not specified the output is always null terminated, although the
<code class="code">buf_size</code> will not include the null character.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is not
long enough, and in that case the <code class="code">buf_size</code> will be updated with
the required size. <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if there
are no data in the current index. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005foid-1"><span>gnutls_x509_crt_get_issuer_dn_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_dn_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: This specifies which OID to return. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will extract the OIDs of the name of the Certificate
issuer specified by the given index.
</p>
<p>If <code class="code">oid</code> is null then only the size will be filled. The <code class="code">oid</code> returned will be null terminated, although <code class="code">oid_size</code> will not
account for the trailing null.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is not
long enough, and in that case the <code class="code">buf_size</code> will be updated with
the required size. <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if there
are no data in the current index. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005funique_005fid-1"><span>gnutls_x509_crt_get_issuer_unique_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fissuer_005funique_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fissuer_005funique_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fissuer_005funique_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_issuer_unique_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005funique_005fid"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">buf</var>: user allocated memory buffer, will hold the unique id
</p>
<p><var class="var">buf_size</var>: size of user allocated memory buffer (on input), will hold
actual size of the unique ID on return.
</p>
<p>This function will extract the issuerUniqueID value (if present) for
the given certificate.
</p>
<p>If the user allocated memory buffer is not large enough to hold the
full subjectUniqueID, then a GNUTLS_E_SHORT_MEMORY_BUFFER error will be
returned, and buf_size will be set to the actual length.
</p>
<p>This function had a bug prior to 3.4.8 that prevented the setting
of <code class="code">NULL</code> <code class="code">buf</code> to discover the <code class="code">buf_size</code> . To use this function safely
with the older versions the <code class="code">buf</code> must be a valid buffer that can hold
at least a single byte if <code class="code">buf_size</code> is zero.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fkey_005fid-1"><span>gnutls_x509_crt_get_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fkey_005fid-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fid-1"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">flags</var>: should be one of the flags from <code class="code">gnutls_keyid_flags_t</code>
</p>
<p><var class="var">output_data</var>: will contain the key ID
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will return a unique ID that depends on the public
key parameters. This ID can be used in checking whether a
certificate corresponds to the given private key.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned. The output will normally be a SHA-1 hash output,
which is 20 bytes.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fkey_005fpurpose_005foid-1"><span>gnutls_x509_crt_get_key_purpose_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fkey_005fpurpose_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fkey_005fpurpose_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fkey_005fpurpose_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_key_purpose_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned <var class="var">indx</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fpurpose_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: This specifies which OID to return. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p><var class="var">critical</var>: output flag to indicate criticality of extension
</p>
<p>This function will extract the key purpose OIDs of the Certificate
specified by the given index. These are stored in the Extended Key
Usage extension (2.5.29.37) See the GNUTLS_KP_* definitions for
human readable names.
</p>
<p>If <code class="code">oid</code> is null then only the size will be filled. The <code class="code">oid</code> returned will be null terminated, although <code class="code">oid_size</code> will not
account for the trailing null.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if the provided buffer is
not long enough, and in that case the *oid_size will be updated
with the required size. On success 0 is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fkey_005fusage-1"><span>gnutls_x509_crt_get_key_usage<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_key_usage</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">key_usage</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">key_usage</var>: where the key usage bits will be stored
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will return certificate’s key usage, by reading the
keyUsage X.509 extension (2.5.29.15). The key usage value will ORed
values of the: <code class="code">GNUTLS_KEY_DIGITAL_SIGNATURE</code> ,
<code class="code">GNUTLS_KEY_NON_REPUDIATION</code> , <code class="code">GNUTLS_KEY_KEY_ENCIPHERMENT</code> ,
<code class="code">GNUTLS_KEY_DATA_ENCIPHERMENT</code> , <code class="code">GNUTLS_KEY_KEY_AGREEMENT</code> ,
<code class="code">GNUTLS_KEY_KEY_CERT_SIGN</code> , <code class="code">GNUTLS_KEY_CRL_SIGN</code> ,
<code class="code">GNUTLS_KEY_ENCIPHER_ONLY</code> , <code class="code">GNUTLS_KEY_DECIPHER_ONLY</code> .
</p>
<p><strong class="strong">Returns:</strong> zero on success, or a negative error code in case of
parsing error. If the certificate does not contain the keyUsage
extension <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fname_005fconstraints-1"><span>gnutls_x509_crt_get_name_constraints<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fname_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fname_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fname_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_name_constraints</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fname_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">nc</var>: The nameconstraints intermediate type
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_EXT_FLAG_APPEND</code>
</p>
<p><var class="var">critical</var>: the extension status
</p>
<p>This function will return an intermediate type containing
the name constraints of the provided CA certificate. That
structure can be used in combination with <code class="code">gnutls_x509_name_constraints_check()</code>
to verify whether a server’s name is in accordance with the constraints.
</p>
<p>When the <code class="code">flags</code> is set to <code class="code">GNUTLS_EXT_FLAG_APPEND</code> ,
then if the <code class="code">nc</code> structure is empty this function will behave
identically as if the flag was not set.
Otherwise if there are elements in the <code class="code">nc</code> structure then the
constraints will be merged with the existing constraints following
RFC5280 p6.1.4 (excluded constraints will be appended, permitted
will be intersected).
</p>
<p>Note that <code class="code">nc</code> must be initialized prior to calling this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpk_005falgorithm-1"><span>gnutls_x509_crt_get_pk_algorithm<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">bits</var>: if bits is non null it will hold the size of the parameters’ in bits
</p>
<p>This function will return the public key algorithm of an X.509
certificate.
</p>
<p>If bits is non null, it should have enough size to hold the parameters
size in bits. For RSA the bits returned is the modulus.
For DSA the bits returned are of the public
exponent.
</p>
<p>Unknown/unsupported algorithms are mapped to <code class="code">GNUTLS_PK_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_pk_algorithm_t</code> enumeration on
success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpk_005fdsa_005fraw-1"><span>gnutls_x509_crt_get_pk_dsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpk_005fdsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpk_005fdsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpk_005fdsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_pk_dsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005fdsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">p</var>: will hold the p
</p>
<p><var class="var">q</var>: will hold the q
</p>
<p><var class="var">g</var>: will hold the g
</p>
<p><var class="var">y</var>: will hold the y
</p>
<p>This function will export the DSA public key’s parameters found in
the given certificate. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpk_005fecc_005fraw-1"><span>gnutls_x509_crt_get_pk_ecc_raw<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpk_005fecc_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpk_005fecc_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpk_005fecc_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_pk_ecc_raw</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005fecc_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">curve</var>: will hold the curve
</p>
<p><var class="var">x</var>: will hold the x-coordinate
</p>
<p><var class="var">y</var>: will hold the y-coordinate
</p>
<p>This function will export the ECC public key’s parameters found in
the given certificate. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter will be <code class="code">NULL</code> and the other parameters
will be in the native format for the curve.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpk_005fgost_005fraw-1"><span>gnutls_x509_crt_get_pk_gost_raw<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpk_005fgost_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpk_005fgost_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpk_005fgost_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_pk_gost_raw</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_gost_paramset_t * <var class="var">paramset</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005fgost_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">curve</var>: will hold the curve
</p>
<p><var class="var">digest</var>: will hold the digest
</p>
<p><var class="var">paramset</var>: will hold the GOST parameter set ID
</p>
<p><var class="var">x</var>: will hold the x-coordinate
</p>
<p><var class="var">y</var>: will hold the y-coordinate
</p>
<p>This function will export the GOST public key’s parameters found in
the given certificate. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpk_005foid-1"><span>gnutls_x509_crt_get_pk_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpk_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpk_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpk_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_pk_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, char * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the OID of the public key algorithm
on that certificate. This is function
is useful in the case <code class="code">gnutls_x509_crt_get_pk_algorithm()</code>
returned <code class="code">GNUTLS_PK_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpk_005frsa_005fraw-1"><span>gnutls_x509_crt_get_pk_rsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpk_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpk_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpk_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_pk_rsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">m</var>: will hold the modulus
</p>
<p><var class="var">e</var>: will hold the public exponent
</p>
<p>This function will export the RSA public key’s parameters found in
the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpolicy-1"><span>gnutls_x509_crt_get_policy<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpolicy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpolicy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpolicy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_policy</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned <var class="var">indx</var>, struct gnutls_x509_policy_st * <var class="var">policy</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpolicy"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">indx</var>: This specifies which policy to return. Use (0) to get the first one.
</p>
<p><var class="var">policy</var>: A pointer to a policy structure.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p>This function will extract the certificate policy (extension 2.5.29.32)
specified by the given index.
</p>
<p>The policy returned by this function must be deinitialized by using
<code class="code">gnutls_x509_policy_release()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fprivate_005fkey_005fusage_005fperiod-1"><span>gnutls_x509_crt_get_private_key_usage_period<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fprivate_005fkey_005fusage_005fperiod-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fprivate_005fkey_005fusage_005fperiod"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fprivate_005fkey_005fusage_005fperiod"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_private_key_usage_period</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, time_t * <var class="var">activation</var>, time_t * <var class="var">expiration</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fprivate_005fkey_005fusage_005fperiod"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">activation</var>: The activation time
</p>
<p><var class="var">expiration</var>: The expiration time
</p>
<p><var class="var">critical</var>: the extension status
</p>
<p>This function will return the expiration and activation
times of the private key of the certificate. It relies on
the PKIX extension 2.5.29.16 being present.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fproxy-1"><span>gnutls_x509_crt_get_proxy<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fproxy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fproxy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fproxy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_proxy</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int * <var class="var">critical</var>, int * <var class="var">pathlen</var>, char ** <var class="var">policyLanguage</var>, char ** <var class="var">policy</var>, size_t * <var class="var">sizeof_policy</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fproxy"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical
</p>
<p><var class="var">pathlen</var>: pointer to output integer indicating path length (may be
NULL), non-negative error codes indicate a present pCPathLenConstraint
field and the actual value, -1 indicate that the field is absent.
</p>
<p><var class="var">policyLanguage</var>: output variable with OID of policy language
</p>
<p><var class="var">policy</var>: output variable with policy data
</p>
<p><var class="var">sizeof_policy</var>: output variable size of policy data
</p>
<p>This function will get information from a proxy certificate. It
reads the ProxyCertInfo X.509 extension (1.3.6.1.5.5.7.1.14).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fraw_005fdn-1"><span>gnutls_x509_crt_get_raw_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fraw_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fraw_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fraw_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_raw_dn</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fraw_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: will hold the starting point of the DN
</p>
<p>This function will return a pointer to the DER encoded DN structure and
the length. This points to allocated data that must be free’d using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fraw_005fissuer_005fdn-1"><span>gnutls_x509_crt_get_raw_issuer_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fraw_005fissuer_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fraw_005fissuer_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fraw_005fissuer_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_raw_issuer_dn</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fraw_005fissuer_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: will hold the starting point of the DN
</p>
<p>This function will return a pointer to the DER encoded DN structure
and the length. This points to allocated data that must be free’d using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fserial-1"><span>gnutls_x509_crt_get_serial<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fserial-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fserial"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fserial"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_serial</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, void * <var class="var">result</var>, size_t * <var class="var">result_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fserial"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">result</var>: The place where the serial number will be copied
</p>
<p><var class="var">result_size</var>: Holds the size of the result field.
</p>
<p>This function will return the X.509 certificate’s serial number.
This is obtained by the X509 Certificate serialNumber field. Serial
is not always a 32 or 64bit number. Some CAs use large serial
numbers, thus it may be wise to handle it as something uint8_t.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsignature-1"><span>gnutls_x509_crt_get_signature<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsignature-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsignature"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsignature"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_signature</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, char * <var class="var">sig</var>, size_t * <var class="var">sig_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsignature"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">sig</var>: a pointer where the signature part will be copied (may be null).
</p>
<p><var class="var">sig_size</var>: initially holds the size of <code class="code">sig</code>
</p>
<p>This function will extract the signature field of a certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm-1"><span>gnutls_x509_crt_get_signature_algorithm<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_signature_algorithm</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p>This function will return a value of the <code class="code">gnutls_sign_algorithm_t</code>
enumeration that is the signature algorithm that has been used to
sign this certificate.
</p>
<p>Since 3.6.0 this function never returns a negative error code.
Error cases and unknown/unsupported signature algorithms are
mapped to <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_sign_algorithm_t</code> value
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsignature_005foid-1"><span>gnutls_x509_crt_get_signature_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsignature_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsignature_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsignature_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_signature_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, char * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsignature_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">oid</var>: a pointer to a buffer to hold the OID (may be null)
</p>
<p><var class="var">oid_size</var>: initially holds the size of <code class="code">oid</code>
</p>
<p>This function will return the OID of the signature algorithm
that has been used to sign this certificate. This is function
is useful in the case <code class="code">gnutls_x509_crt_get_signature_algorithm()</code>
returned <code class="code">GNUTLS_SIGN_UNKNOWN</code> .
</p>
<p><strong class="strong">Returns:</strong> zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fspki-1"><span>gnutls_x509_crt_get_spki<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_spki</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_x509_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return the public key information of an X.509
certificate. The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsubject-1"><span>gnutls_x509_crt_get_subject<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsubject-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsubject"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsubject"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_subject</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_dn_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">dn</var>: output variable with pointer to uint8_t DN.
</p>
<p>Return the Certificate’s Subject DN as a <code class="code">gnutls_x509_dn_t</code> data type,
that can be decoded using <code class="code">gnutls_x509_dn_get_rdn_ava()</code> .
</p>
<p>Note that <code class="code">dn</code> should be treated as constant. Because it points
into the <code class="code">cert</code> object, you should not use <code class="code">dn</code> after <code class="code">cert</code> is
deallocated.
</p>
<p><strong class="strong">Returns:</strong> Returns 0 on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname-1"><span>gnutls_x509_crt_get_subject_alt_name<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_subject_alt_name</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">san</var>, size_t * <var class="var">san_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">san</var>: is the place where the alternative name will be copied to
</p>
<p><var class="var">san_size</var>: holds the size of san.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function retrieves the Alternative Name (2.5.29.17), contained
in the given certificate in the X509v3 Certificate Extensions.
</p>
<p>When the SAN type is otherName, it will extract the data in the
otherName’s value field, and <code class="code">GNUTLS_SAN_OTHERNAME</code> is returned.
You may use <code class="code">gnutls_x509_crt_get_subject_alt_othername_oid()</code> to get
the corresponding OID and the "virtual" SAN types (e.g.,
<code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> ).
</p>
<p>If an otherName OID is known, the data will be decoded. Otherwise
the returned data will be DER encoded, and you will have to decode
it yourself. Currently, only the RFC 3920 id-on-xmppAddr SAN is
recognized.
</p>
<p><strong class="strong">Returns:</strong> the alternative subject name type on success, one of the
enumerated <code class="code">gnutls_x509_subject_alt_name_t</code> . It will return
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if <code class="code">san_size</code> is not large enough to
hold the value. In that case <code class="code">san_size</code> will be updated with the
required size. If the certificate does not have an Alternative
name with the specified sequence number then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname2-1"><span>gnutls_x509_crt_get_subject_alt_name2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_subject_alt_name2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">san</var>, size_t * <var class="var">san_size</var>, unsigned int * <var class="var">san_type</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname2"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">san</var>: is the place where the alternative name will be copied to
</p>
<p><var class="var">san_size</var>: holds the size of ret.
</p>
<p><var class="var">san_type</var>: holds the type of the alternative name (one of gnutls_x509_subject_alt_name_t).
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function will return the alternative names, contained in the
given certificate. It is the same as
<code class="code">gnutls_x509_crt_get_subject_alt_name()</code> except for the fact that it
will return the type of the alternative name in <code class="code">san_type</code> even if
the function fails for some reason (i.e. the buffer provided is
not enough).
</p>
<p><strong class="strong">Returns:</strong> the alternative subject name type on success, one of the
enumerated <code class="code">gnutls_x509_subject_alt_name_t</code> . It will return
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if <code class="code">san_size</code> is not large enough
to hold the value. In that case <code class="code">san_size</code> will be updated with
the required size. If the certificate does not have an
Alternative name with the specified sequence number then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fothername_005foid-1"><span>gnutls_x509_crt_get_subject_alt_othername_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fothername_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fothername_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fothername_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_subject_alt_othername_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">seq</var>, void * <var class="var">oid</var>, size_t * <var class="var">oid_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fothername_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">seq</var>: specifies the sequence number of the alt name (0 for the first one, 1 for the second etc.)
</p>
<p><var class="var">oid</var>: is the place where the otherName OID will be copied to
</p>
<p><var class="var">oid_size</var>: holds the size of ret.
</p>
<p>This function will extract the type OID of an otherName Subject
Alternative Name, contained in the given certificate, and return
the type as an enumerated element.
</p>
<p>This function is only useful if
<code class="code">gnutls_x509_crt_get_subject_alt_name()</code> returned
<code class="code">GNUTLS_SAN_OTHERNAME</code> .
</p>
<p>If <code class="code">oid</code> is null then only the size will be filled. The <code class="code">oid</code> returned will be null terminated, although <code class="code">oid_size</code> will not
account for the trailing null.
</p>
<p><strong class="strong">Returns:</strong> the alternative subject name type on success, one of the
enumerated gnutls_x509_subject_alt_name_t. For supported OIDs, it
will return one of the virtual (GNUTLS_SAN_OTHERNAME_*) types,
e.g. <code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> , and <code class="code">GNUTLS_SAN_OTHERNAME</code> for
unknown OIDs. It will return <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> if
<code class="code">ian_size</code> is not large enough to hold the value. In that case
<code class="code">ian_size</code> will be updated with the required size. If the
certificate does not have an Alternative name with the specified
sequence number and with the otherName type then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005fkey_005fid-1"><span>gnutls_x509_crt_get_subject_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsubject_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsubject_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_subject_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, void * <var class="var">ret</var>, size_t * <var class="var">ret_size</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">ret</var>: The place where the identifier will be copied
</p>
<p><var class="var">ret_size</var>: Holds the size of the result field.
</p>
<p><var class="var">critical</var>: will be non-zero if the extension is marked as critical (may be null)
</p>
<p>This function will return the X.509v3 certificate’s subject key
identifier. This is obtained by the X.509 Subject Key identifier
extension field (2.5.29.14).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005funique_005fid-1"><span>gnutls_x509_crt_get_subject_unique_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fsubject_005funique_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fsubject_005funique_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fsubject_005funique_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_subject_unique_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005funique_005fid"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">buf</var>: user allocated memory buffer, will hold the unique id
</p>
<p><var class="var">buf_size</var>: size of user allocated memory buffer (on input), will hold
actual size of the unique ID on return.
</p>
<p>This function will extract the subjectUniqueID value (if present) for
the given certificate.
</p>
<p>If the user allocated memory buffer is not large enough to hold the
full subjectUniqueID, then a GNUTLS_E_SHORT_MEMORY_BUFFER error will be
returned, and buf_size will be set to the actual length.
</p>
<p>This function had a bug prior to 3.4.8 that prevented the setting
of <code class="code">NULL</code> <code class="code">buf</code> to discover the <code class="code">buf_size</code> . To use this function safely
with the older versions the <code class="code">buf</code> must be a valid buffer that can hold
at least a single byte if <code class="code">buf_size</code> is zero.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005ftlsfeatures-1"><span>gnutls_x509_crt_get_tlsfeatures<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005ftlsfeatures-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005ftlsfeatures"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005ftlsfeatures"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_tlsfeatures</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_tlsfeatures_t <var class="var">features</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005ftlsfeatures"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: A X.509 certificate
</p>
<p><var class="var">features</var>: If the function succeeds, the
features will be stored in this variable.
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_EXT_FLAG_APPEND</code>
</p>
<p><var class="var">critical</var>: the extension status
</p>
<p>This function will get the X.509 TLS features
extension structure from the certificate. The
returned structure needs to be freed using
<code class="code">gnutls_x509_tlsfeatures_deinit()</code> .
</p>
<p>When the <code class="code">flags</code> is set to <code class="code">GNUTLS_EXT_FLAG_APPEND</code> ,
then if the <code class="code">features</code> structure is empty this function will behave
identically as if the flag was not set. Otherwise if there are elements
in the <code class="code">features</code> structure then they will be merged with.
</p>
<p>Note that <code class="code">features</code> must be initialized prior to calling this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fversion-1"><span>gnutls_x509_crt_get_version<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_version</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p>This function will return the version of the specified Certificate.
</p>
<p><strong class="strong">Returns:</strong> version of certificate, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fimport-1"><span>gnutls_x509_crt_import<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_import</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: The data to store the parsed certificate.
</p>
<p><var class="var">data</var>: The DER or PEM encoded certificate.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p>This function will convert the given DER or PEM encoded Certificate
to the native gnutls_x509_crt_t format. The output will be stored
in <code class="code">cert</code> .
</p>
<p>If the Certificate is PEM encoded it should have a header of "X509
CERTIFICATE", or "CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fimport_005furl-1"><span>gnutls_x509_crt_import_url<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fimport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fimport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fimport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_import_url</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fimport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: A certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">url</var>: A PKCS 11 url
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags for PKCS<code class="code">11</code> URLs or zero otherwise
</p>
<p>This function will import a certificate present in a PKCS<code class="code">11</code> token
or any type of back-end that supports URLs.
</p>
<p>In previous versions of gnutls this function was named
gnutls_x509_crt_import_pkcs11_url, and the old name is
an alias to this one.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005finit-1"><span>gnutls_x509_crt_init<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_init</strong> <code class="def-code-arguments">(gnutls_x509_crt_t * <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005finit"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize an X.509 certificate structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005flist_005fimport-1"><span>gnutls_x509_crt_list_import<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005flist_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005flist_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005flist_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_list_import</strong> <code class="def-code-arguments">(gnutls_x509_crt_t * <var class="var">certs</var>, unsigned int * <var class="var">cert_max</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005flist_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">certs</var>: Indicates where the parsed list will be copied to. Must not be initialized.
</p>
<p><var class="var">cert_max</var>: Initially must hold the maximum number of certs. It will be updated with the number of certs available.
</p>
<p><var class="var">data</var>: The PEM encoded certificate.
</p>
<p><var class="var">format</var>: One of DER or PEM.
</p>
<p><var class="var">flags</var>: must be (0) or an OR’d sequence of gnutls_certificate_import_flags.
</p>
<p>This function will convert the given PEM encoded certificate list
to the native gnutls_x509_crt_t format. The output will be stored
in <code class="code">certs</code> . They will be automatically initialized.
</p>
<p>The flag <code class="code">GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED</code> will cause
import to fail if the certificates in the provided buffer are more
than the available structures. The <code class="code">GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED</code>
flag will cause the function to fail if the provided list is not
sorted from subject to issuer.
</p>
<p>If the Certificate is PEM encoded it should have a header of "X509
CERTIFICATE", or "CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> the number of certificates read or a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005flist_005fimport2-1"><span>gnutls_x509_crt_list_import2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005flist_005fimport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005flist_005fimport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005flist_005fimport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_list_import2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t ** <var class="var">certs</var>, unsigned int * <var class="var">size</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005flist_005fimport2"> ¶</a></span></dt>
<dd><p><var class="var">certs</var>: Will hold the parsed certificate list.
</p>
<p><var class="var">size</var>: It will contain the size of the list.
</p>
<p><var class="var">data</var>: The PEM encoded certificate.
</p>
<p><var class="var">format</var>: One of DER or PEM.
</p>
<p><var class="var">flags</var>: must be (0) or an OR’d sequence of gnutls_certificate_import_flags.
</p>
<p>This function will convert the given PEM encoded certificate list
to the native gnutls_x509_crt_t format. The output will be stored
in <code class="code">certs</code> which will be allocated and initialized.
</p>
<p>If the Certificate is PEM encoded it should have a header of "X509
CERTIFICATE", or "CERTIFICATE".
</p>
<p>To deinitialize <code class="code">certs</code> , you need to deinitialize each crt structure
independently, and use <code class="code">gnutls_free()</code> at <code class="code">certs</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005flist_005fimport_005furl-1"><span>gnutls_x509_crt_list_import_url<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005flist_005fimport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005flist_005fimport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005flist_005fimport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_list_import_url</strong> <code class="def-code-arguments">(gnutls_x509_crt_t ** <var class="var">certs</var>, unsigned int * <var class="var">size</var>, const char * <var class="var">url</var>, gnutls_pin_callback_t <var class="var">pin_fn</var>, void * <var class="var">pin_fn_userdata</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005flist_005fimport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">certs</var>: Will hold the allocated certificate list.
</p>
<p><var class="var">size</var>: It will contain the size of the list.
</p>
<p><var class="var">url</var>: A PKCS 11 url
</p>
<p><var class="var">pin_fn</var>: a PIN callback if not globally set
</p>
<p><var class="var">pin_fn_userdata</var>: parameter for the PIN callback
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags for PKCS<code class="code">11</code> URLs or zero otherwise
</p>
<p>This function will import a certificate chain present in a PKCS<code class="code">11</code> token
or any type of back-end that supports URLs. The certificates
must be deinitialized afterwards using <code class="code">gnutls_x509_crt_deinit()</code>
and the returned pointer must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>The URI provided must be the first certificate in the chain; subsequent
certificates will be retrieved using <code class="code">gnutls_pkcs11_get_raw_issuer()</code> or
equivalent functionality for the supported URI.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005flist_005fverify-1"><span>gnutls_x509_crt_list_verify<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005flist_005fverify-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005flist_005fverify"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005flist_005fverify"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_list_verify</strong> <code class="def-code-arguments">(const gnutls_x509_crt_t * <var class="var">cert_list</var>, unsigned <var class="var">cert_list_length</var>, const gnutls_x509_crt_t * <var class="var">CA_list</var>, unsigned <var class="var">CA_list_length</var>, const gnutls_x509_crl_t * <var class="var">CRL_list</var>, unsigned <var class="var">CRL_list_length</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">verify</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005flist_005fverify"> ¶</a></span></dt>
<dd><p><var class="var">cert_list</var>: is the certificate list to be verified
</p>
<p><var class="var">cert_list_length</var>: holds the number of certificate in cert_list
</p>
<p><var class="var">CA_list</var>: is the CA list which will be used in verification
</p>
<p><var class="var">CA_list_length</var>: holds the number of CA certificate in CA_list
</p>
<p><var class="var">CRL_list</var>: holds a list of CRLs.
</p>
<p><var class="var">CRL_list_length</var>: the length of CRL list.
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">verify</var>: will hold the certificate verification output.
</p>
<p>This function will try to verify the given certificate list and
return its status. The details of the verification are the same
as in <code class="code">gnutls_x509_trust_list_verify_crt2()</code> .
</p>
<p>You must check the peer’s name in order to check if the verified
certificate belongs to the actual peer.
</p>
<p>The certificate verification output will be put in <code class="code">verify</code> and will
be one or more of the gnutls_certificate_status_t enumerated
elements bitwise or’d. For a more detailed verification status use
<code class="code">gnutls_x509_crt_verify()</code> per list element.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fprint-1"><span>gnutls_x509_crt_print<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_print</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: The data to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with null terminated string.
</p>
<p>This function will pretty print a X.509 certificate, suitable for
display to a human.
</p>
<p>If the format is <code class="code">GNUTLS_CRT_PRINT_FULL</code> then all fields of the
certificate will be output, on multiple lines. The
<code class="code">GNUTLS_CRT_PRINT_ONELINE</code> format will generate one line with some
selected fields, which is useful for logging purposes.
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005factivation_005ftime-1"><span>gnutls_x509_crt_set_activation_time<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005factivation_005ftime-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005factivation_005ftime"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005factivation_005ftime"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_activation_time</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, time_t <var class="var">act_time</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005factivation_005ftime"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">act_time</var>: The actual time
</p>
<p>This function will set the time this certificate was or will be
activated.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fauthority_005finfo_005faccess-1"><span>gnutls_x509_crt_set_authority_info_access<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fauthority_005finfo_005faccess-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fauthority_005finfo_005faccess"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fauthority_005finfo_005faccess"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_authority_info_access</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, int <var class="var">what</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fauthority_005finfo_005faccess"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">what</var>: what data to get, a <code class="code">gnutls_info_access_what_t</code> type.
</p>
<p><var class="var">data</var>: output data to be freed with <code class="code">gnutls_free()</code> .
</p>
<p>This function sets the Authority Information Access (AIA)
extension, see RFC 5280 section 4.2.2.1 for more information.
</p>
<p>The type of data stored in <code class="code">data</code> is specified via <code class="code">what</code> which
should be <code class="code">gnutls_info_access_what_t</code> values.
</p>
<p>If <code class="code">what</code> is <code class="code">GNUTLS_IA_OCSP_URI</code> , <code class="code">data</code> will hold the OCSP URI.
If <code class="code">what</code> is <code class="code">GNUTLS_IA_CAISSUERS_URI</code> , <code class="code">data</code> will hold the caIssuers
URI.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fauthority_005fkey_005fid-1"><span>gnutls_x509_crt_set_authority_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fauthority_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fauthority_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fauthority_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_authority_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">id</var>, size_t <var class="var">id_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fauthority_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">id</var>: The key ID
</p>
<p><var class="var">id_size</var>: Holds the size of the key ID field.
</p>
<p>This function will set the X.509 certificate’s authority key ID extension.
Only the keyIdentifier field can be set with this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fbasic_005fconstraints-1"><span>gnutls_x509_crt_set_basic_constraints<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fbasic_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fbasic_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fbasic_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_basic_constraints</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">ca</var>, int <var class="var">pathLenConstraint</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fbasic_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">ca</var>: true(1) or false(0). Depending on the Certificate authority status.
</p>
<p><var class="var">pathLenConstraint</var>: non-negative error codes indicate maximum length of path,
and negative error codes indicate that the pathLenConstraints field should
not be present.
</p>
<p>This function will set the basicConstraints certificate extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fca_005fstatus-1"><span>gnutls_x509_crt_set_ca_status<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fca_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fca_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fca_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_ca_status</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">ca</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fca_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">ca</var>: true(1) or false(0). Depending on the Certificate authority status.
</p>
<p>This function will set the basicConstraints certificate extension.
Use <code class="code">gnutls_x509_crt_set_basic_constraints()</code> if you want to control
the pathLenConstraint field too.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints-1"><span>gnutls_x509_crt_set_crl_dist_points<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_crl_dist_points</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const void * <var class="var">data_string</var>, unsigned int <var class="var">reason_flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">type</var>: is one of the gnutls_x509_subject_alt_name_t enumerations
</p>
<p><var class="var">data_string</var>: The data to be set
</p>
<p><var class="var">reason_flags</var>: revocation reasons
</p>
<p>This function will set the CRL distribution points certificate extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints2-1"><span>gnutls_x509_crt_set_crl_dist_points2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_crl_dist_points2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">reason_flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints2"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">type</var>: is one of the gnutls_x509_subject_alt_name_t enumerations
</p>
<p><var class="var">data</var>: The data to be set
</p>
<p><var class="var">data_size</var>: The data size
</p>
<p><var class="var">reason_flags</var>: revocation reasons
</p>
<p>This function will set the CRL distribution points certificate extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fcrq-1"><span>gnutls_x509_crt_set_crq<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fcrq-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fcrq"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fcrq"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_crq</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crq_t <var class="var">crq</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fcrq"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">crq</var>: holds a certificate request
</p>
<p>This function will set the name and public parameters as well as
the extensions from the given certificate request to the certificate.
Only RSA keys are currently supported.
</p>
<p>Note that this function will only set the <code class="code">crq</code> if it is self
signed and the signature is correct. See <code class="code">gnutls_x509_crq_sign2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fcrq_005fextension_005fby_005foid-1"><span>gnutls_x509_crt_set_crq_extension_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fcrq_005fextension_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fcrq_005fextension_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fcrq_005fextension_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_crq_extension_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crq_t <var class="var">crq</var>, const char * <var class="var">oid</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fcrq_005fextension_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">crq</var>: holds a certificate request
</p>
<p><var class="var">oid</var>: the object identifier of the OID to copy
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will set the extension specify by <code class="code">oid</code> from the given request to the
certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fcrq_005fextensions-1"><span>gnutls_x509_crt_set_crq_extensions<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fcrq_005fextensions-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fcrq_005fextensions"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fcrq_005fextensions"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_crq_extensions</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crq_t <var class="var">crq</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fcrq_005fextensions"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">crq</var>: holds a certificate request
</p>
<p>This function will set the extensions from the given request to the
certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.8.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fdn-1"><span>gnutls_x509_crt_set_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_dn</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">dn</var>, const char ** <var class="var">err</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">dn</var>: a comma separated DN string (RFC4514)
</p>
<p><var class="var">err</var>: indicates the error position (if any)
</p>
<p>This function will set the DN on the provided certificate.
The input string should be plain ASCII or UTF-8 encoded. On
DN parsing error <code class="code">GNUTLS_E_PARSING_ERROR</code> is returned.
</p>
<p>Note that DNs are not expected to hold DNS information, and thus
no automatic IDNA conversions are attempted when using this function.
If that is required (e.g., store a domain in CN), process the corresponding
input with <code class="code">gnutls_idna_map()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fdn_005fby_005foid-1"><span>gnutls_x509_crt_set_dn_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fdn_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fdn_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fdn_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_dn_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">oid</var>, unsigned int <var class="var">raw_flag</var>, const void * <var class="var">name</var>, unsigned int <var class="var">sizeof_name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fdn_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">oid</var>: holds an Object Identifier in a null terminated string
</p>
<p><var class="var">raw_flag</var>: must be 0, or 1 if the data are DER encoded
</p>
<p><var class="var">name</var>: a pointer to the name
</p>
<p><var class="var">sizeof_name</var>: holds the size of <code class="code">name</code>
</p>
<p>This function will set the part of the name of the Certificate
subject, specified by the given OID. The input string should be
ASCII or UTF-8 encoded.
</p>
<p>Some helper macros with popular OIDs can be found in gnutls/x509.h
With this function you can only set the known OIDs. You can test
for known OIDs using <code class="code">gnutls_x509_dn_oid_known()</code> . For OIDs that are
not known (by gnutls) you should properly DER encode your data,
and call this function with <code class="code">raw_flag</code> set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fexpiration_005ftime-1"><span>gnutls_x509_crt_set_expiration_time<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fexpiration_005ftime-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fexpiration_005ftime"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fexpiration_005ftime"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_expiration_time</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, time_t <var class="var">exp_time</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fexpiration_005ftime"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">exp_time</var>: The actual time
</p>
<p>This function will set the time this Certificate will expire.
Setting an expiration time to (time_t)-1 will set
to the no well-defined expiration date value.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fextension_005fby_005foid-1"><span>gnutls_x509_crt_set_extension_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fextension_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fextension_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fextension_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_extension_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">oid</var>, const void * <var class="var">buf</var>, size_t <var class="var">sizeof_buf</var>, unsigned int <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fextension_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">oid</var>: holds an Object Identifier in null terminated string
</p>
<p><var class="var">buf</var>: a pointer to a DER encoded data
</p>
<p><var class="var">sizeof_buf</var>: holds the size of <code class="code">buf</code>
</p>
<p><var class="var">critical</var>: should be non-zero if the extension is to be marked as critical
</p>
<p>This function will set an the extension, by the specified OID, in
the certificate. The extension data should be binary data DER
encoded.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fflags-1"><span>gnutls_x509_crt_set_flags<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fflags"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_crt_set_flags</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: A type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">flags</var>: flags from the <code class="code">gnutls_x509_crt_flags</code>
</p>
<p>This function will set flags for the specified certificate.
Currently this is useful for the <code class="code">GNUTLS_X509_CRT_FLAG_IGNORE_SANITY</code>
which allows importing certificates even if they have known issues.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005finhibit_005fanypolicy-1"><span>gnutls_x509_crt_set_inhibit_anypolicy<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005finhibit_005fanypolicy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005finhibit_005fanypolicy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005finhibit_005fanypolicy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_inhibit_anypolicy</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">skipcerts</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005finhibit_005fanypolicy"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">skipcerts</var>: number of certificates after which anypolicy is no longer acceptable.
</p>
<p>This function will set the Inhibit anyPolicy certificate extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fname-1"><span>gnutls_x509_crt_set_issuer_alt_name<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_issuer_alt_name</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fname"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">type</var>: is one of the gnutls_x509_subject_alt_name_t enumerations
</p>
<p><var class="var">data</var>: The data to be set
</p>
<p><var class="var">data_size</var>: The size of data to be set
</p>
<p><var class="var">flags</var>: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append.
</p>
<p>This function will set the issuer alternative name certificate
extension. It can set the same types as <code class="code">gnutls_x509_crt_set_subject_alt_name()</code> .
</p>
<p>Since version 3.5.7 the <code class="code">GNUTLS_SAN_RFC822NAME</code> , <code class="code">GNUTLS_SAN_DNSNAME</code> , and
<code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> are converted to ACE format when necessary.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fothername-1"><span>gnutls_x509_crt_set_issuer_alt_othername<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fothername-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fothername"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fothername"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_issuer_alt_othername</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">oid</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fothername"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">oid</var>: The other name OID
</p>
<p><var class="var">data</var>: The data to be set
</p>
<p><var class="var">data_size</var>: The size of data to be set
</p>
<p><var class="var">flags</var>: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append.
</p>
<p>This function will set an "othername" to the issuer alternative name certificate
extension.
</p>
<p>The values set are set as binary values and are expected to have the proper DER encoding.
For convenience the flags <code class="code">GNUTLS_FSAN_ENCODE_OCTET_STRING</code> and <code class="code">GNUTLS_FSAN_ENCODE_UTF8_STRING</code>
can be used to encode the provided data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn-1"><span>gnutls_x509_crt_set_issuer_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_issuer_dn</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">dn</var>, const char ** <var class="var">err</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">dn</var>: a comma separated DN string (RFC4514)
</p>
<p><var class="var">err</var>: indicates the error position (if any)
</p>
<p>This function will set the DN on the provided certificate.
The input string should be plain ASCII or UTF-8 encoded. On
DN parsing error <code class="code">GNUTLS_E_PARSING_ERROR</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn_005fby_005foid-1"><span>gnutls_x509_crt_set_issuer_dn_by_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_issuer_dn_by_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">oid</var>, unsigned int <var class="var">raw_flag</var>, const void * <var class="var">name</var>, unsigned int <var class="var">sizeof_name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">oid</var>: holds an Object Identifier in a null terminated string
</p>
<p><var class="var">raw_flag</var>: must be 0, or 1 if the data are DER encoded
</p>
<p><var class="var">name</var>: a pointer to the name
</p>
<p><var class="var">sizeof_name</var>: holds the size of <code class="code">name</code>
</p>
<p>This function will set the part of the name of the Certificate
issuer, specified by the given OID. The input string should be
ASCII or UTF-8 encoded.
</p>
<p>Some helper macros with popular OIDs can be found in gnutls/x509.h
With this function you can only set the known OIDs. You can test
for known OIDs using <code class="code">gnutls_x509_dn_oid_known()</code> . For OIDs that are
not known (by gnutls) you should properly DER encode your data,
and call this function with <code class="code">raw_flag</code> set.
</p>
<p>Normally you do not need to call this function, since the signing
operation will copy the signer’s name as the issuer of the
certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005funique_005fid-1"><span>gnutls_x509_crt_set_issuer_unique_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fissuer_005funique_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fissuer_005funique_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fissuer_005funique_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_issuer_unique_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">id</var>, size_t <var class="var">id_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005funique_005fid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">id</var>: The unique ID
</p>
<p><var class="var">id_size</var>: Holds the size of the unique ID.
</p>
<p>This function will set the X.509 certificate’s issuer unique ID field.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fkey-1"><span>gnutls_x509_crt_set_key<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_key</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">key</var>: holds a private key
</p>
<p>This function will set the public parameters from the given
private key to the certificate.
</p>
<p>To export the public key (i.e., the SubjectPublicKeyInfo part), check
<code class="code">gnutls_pubkey_import_x509()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fkey_005fpurpose_005foid-1"><span>gnutls_x509_crt_set_key_purpose_oid<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fkey_005fpurpose_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fkey_005fpurpose_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fkey_005fpurpose_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_key_purpose_oid</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">oid</var>, unsigned int <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fkey_005fpurpose_005foid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">oid</var>: a pointer to a null terminated string that holds the OID
</p>
<p><var class="var">critical</var>: Whether this extension will be critical or not
</p>
<p>This function will set the key purpose OIDs of the Certificate.
These are stored in the Extended Key Usage extension (2.5.29.37)
See the GNUTLS_KP_* definitions for human readable names.
</p>
<p>Subsequent calls to this function will append OIDs to the OID list.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fkey_005fusage-1"><span>gnutls_x509_crt_set_key_usage<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_key_usage</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">usage</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">usage</var>: an ORed sequence of the GNUTLS_KEY_* elements.
</p>
<p>This function will set the keyUsage certificate extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fname_005fconstraints-1"><span>gnutls_x509_crt_set_name_constraints<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fname_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fname_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fname_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_name_constraints</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned int <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fname_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: The certificate
</p>
<p><var class="var">nc</var>: The nameconstraints structure
</p>
<p><var class="var">critical</var>: whether this extension will be critical
</p>
<p>This function will set the provided name constraints to
the certificate extension list. This extension is always
marked as critical.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fpin_005ffunction-1"><span>gnutls_x509_crt_set_pin_function<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_crt_set_pin_function</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: The certificate structure
</p>
<p><var class="var">fn</var>: the callback
</p>
<p><var class="var">userdata</var>: data associated with the callback
</p>
<p>This function will set a callback function to be used when
it is required to access a protected object. This function overrides
the global function set using <code class="code">gnutls_pkcs11_set_pin_function()</code> .
</p>
<p>Note that this callback is currently used only during the import
of a PKCS <code class="code">11</code> certificate with <code class="code">gnutls_x509_crt_import_url()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fpolicy-1"><span>gnutls_x509_crt_set_policy<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fpolicy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fpolicy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fpolicy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_policy</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const struct gnutls_x509_policy_st * <var class="var">policy</var>, unsigned int <var class="var">critical</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fpolicy"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">policy</var>: A pointer to a policy
</p>
<p><var class="var">critical</var>: use non-zero if the extension is marked as critical
</p>
<p>This function will set the certificate policy extension (2.5.29.32).
Multiple calls to this function append a new policy.
</p>
<p>Note the maximum text size for the qualifier <code class="code">GNUTLS_X509_QUALIFIER_NOTICE</code>
is 200 characters. This function will fail with <code class="code">GNUTLS_E_INVALID_REQUEST</code>
if this is exceeded.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fprivate_005fkey_005fusage_005fperiod-1"><span>gnutls_x509_crt_set_private_key_usage_period<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fprivate_005fkey_005fusage_005fperiod-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fprivate_005fkey_005fusage_005fperiod"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fprivate_005fkey_005fusage_005fperiod"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_private_key_usage_period</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, time_t <var class="var">activation</var>, time_t <var class="var">expiration</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fprivate_005fkey_005fusage_005fperiod"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">activation</var>: The activation time
</p>
<p><var class="var">expiration</var>: The expiration time
</p>
<p>This function will set the private key usage period extension (2.5.29.16).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fproxy-1"><span>gnutls_x509_crt_set_proxy<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fproxy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fproxy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fproxy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_proxy</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, int <var class="var">pathLenConstraint</var>, const char * <var class="var">policyLanguage</var>, const char * <var class="var">policy</var>, size_t <var class="var">sizeof_policy</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fproxy"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">pathLenConstraint</var>: non-negative error codes indicate maximum length of path,
and negative error codes indicate that the pathLenConstraints field should
not be present.
</p>
<p><var class="var">policyLanguage</var>: OID describing the language of <code class="code">policy</code> .
</p>
<p><var class="var">policy</var>: uint8_t byte array with policy language, can be <code class="code">NULL</code>
</p>
<p><var class="var">sizeof_policy</var>: size of <code class="code">policy</code> .
</p>
<p>This function will set the proxyCertInfo extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fproxy_005fdn-1"><span>gnutls_x509_crt_set_proxy_dn<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fproxy_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fproxy_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fproxy_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_proxy_dn</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crt_t <var class="var">eecrt</var>, unsigned int <var class="var">raw_flag</var>, const void * <var class="var">name</var>, unsigned int <var class="var">sizeof_name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fproxy_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a gnutls_x509_crt_t type with the new proxy cert
</p>
<p><var class="var">eecrt</var>: the end entity certificate that will be issuing the proxy
</p>
<p><var class="var">raw_flag</var>: must be 0, or 1 if the CN is DER encoded
</p>
<p><var class="var">name</var>: a pointer to the CN name, may be NULL (but MUST then be added later)
</p>
<p><var class="var">sizeof_name</var>: holds the size of <code class="code">name</code>
</p>
<p>This function will set the subject in <code class="code">crt</code> to the end entity’s
<code class="code">eecrt</code> subject name, and add a single Common Name component <code class="code">name</code> of size <code class="code">sizeof_name</code> . This corresponds to the required proxy
certificate naming style. Note that if <code class="code">name</code> is <code class="code">NULL</code> , you MUST
set it later by using <code class="code">gnutls_x509_crt_set_dn_by_oid()</code> or similar.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fserial-1"><span>gnutls_x509_crt_set_serial<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fserial-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fserial"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fserial"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_serial</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">serial</var>, size_t <var class="var">serial_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fserial"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">serial</var>: The serial number
</p>
<p><var class="var">serial_size</var>: Holds the size of the serial field.
</p>
<p>This function will set the X.509 certificate’s serial number.
While the serial number is an integer, it is often handled
as an opaque field by several CAs. For this reason this function
accepts any kind of data as a serial number. To be consistent
with the X.509/PKIX specifications the provided <code class="code">serial</code> should be
a big-endian positive number (i.e. its leftmost bit should be zero).
</p>
<p>The size of the serial is restricted to 20 bytes maximum by RFC5280.
This function allows writing more than 20 bytes but the generated
certificates in that case may be rejected by other implementations.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fspki-1"><span>gnutls_x509_crt_set_spki<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_spki</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_x509_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will set the certificate’s subject public key
information explicitly. This is intended to be used in the cases
where a single public key (e.g., RSA) can be used for multiple
signature algorithms (RSA PKCS1-1.5, and RSA-PSS).
</p>
<p>To export the public key (i.e., the SubjectPublicKeyInfo part), check
<code class="code">gnutls_pubkey_import_x509()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fname-1"><span>gnutls_x509_crt_set_subject_alt_name<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_subject_alt_name</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fname"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">type</var>: is one of the gnutls_x509_subject_alt_name_t enumerations
</p>
<p><var class="var">data</var>: The data to be set
</p>
<p><var class="var">data_size</var>: The size of data to be set
</p>
<p><var class="var">flags</var>: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append.
</p>
<p>This function will set the subject alternative name certificate
extension. It can set the following types: <code class="code">GNUTLS_SAN_DNSNAME</code> as a text string,
<code class="code">GNUTLS_SAN_RFC822NAME</code> as a text string, <code class="code">GNUTLS_SAN_URI</code> as a text string,
<code class="code">GNUTLS_SAN_IPADDRESS</code> as a binary IP address (4 or 16 bytes),
<code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> as a UTF8 string (since 3.5.0).
</p>
<p>Since version 3.5.7 the <code class="code">GNUTLS_SAN_RFC822NAME</code> , <code class="code">GNUTLS_SAN_DNSNAME</code> , and
<code class="code">GNUTLS_SAN_OTHERNAME_XMPP</code> are converted to ACE format when necessary.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fothername-1"><span>gnutls_x509_crt_set_subject_alt_othername<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fothername-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fothername"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fothername"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_subject_alt_othername</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">oid</var>, const void * <var class="var">data</var>, unsigned int <var class="var">data_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fothername"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">oid</var>: The other name OID
</p>
<p><var class="var">data</var>: The data to be set
</p>
<p><var class="var">data_size</var>: The size of data to be set
</p>
<p><var class="var">flags</var>: GNUTLS_FSAN_SET to clear previous data or GNUTLS_FSAN_APPEND to append.
</p>
<p>This function will set an "othername" to the subject alternative name certificate
extension.
</p>
<p>The values set are set as binary values and are expected to have the proper DER encoding.
For convenience the flags <code class="code">GNUTLS_FSAN_ENCODE_OCTET_STRING</code> and <code class="code">GNUTLS_FSAN_ENCODE_UTF8_STRING</code>
can be used to encode the provided data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005falternative_005fname-1"><span>gnutls_x509_crt_set_subject_alternative_name<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fsubject_005falternative_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005falternative_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falternative_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_subject_alternative_name</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const char * <var class="var">data_string</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falternative_005fname"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">type</var>: is one of the gnutls_x509_subject_alt_name_t enumerations
</p>
<p><var class="var">data_string</var>: The data to be set, a (0) terminated string
</p>
<p>This function will set the subject alternative name certificate
extension. This function assumes that data can be expressed as a null
terminated string.
</p>
<p>The name of the function is unfortunate since it is inconsistent with
<code class="code">gnutls_x509_crt_get_subject_alt_name()</code> .
</p>
<p>See <code class="code">gnutls_x509_crt_set_subject_alt_name()</code> for more information.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005fkey_005fid-1"><span>gnutls_x509_crt_set_subject_key_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fsubject_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fsubject_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_subject_key_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">id</var>, size_t <var class="var">id_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">id</var>: The key ID
</p>
<p><var class="var">id_size</var>: Holds the size of the subject key ID field.
</p>
<p>This function will set the X.509 certificate’s subject key ID
extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005funique_005fid-1"><span>gnutls_x509_crt_set_subject_unique_id<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fsubject_005funique_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fsubject_005funique_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fsubject_005funique_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_subject_unique_id</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">id</var>, size_t <var class="var">id_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005funique_005fid"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">id</var>: The unique ID
</p>
<p><var class="var">id_size</var>: Holds the size of the unique ID.
</p>
<p>This function will set the X.509 certificate’s subject unique ID field.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005ftlsfeatures-1"><span>gnutls_x509_crt_set_tlsfeatures<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005ftlsfeatures-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005ftlsfeatures"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005ftlsfeatures"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_tlsfeatures</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_tlsfeatures_t <var class="var">features</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005ftlsfeatures"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: A X.509 certificate
</p>
<p><var class="var">features</var>: If the function succeeds, the
features will be added to the certificate.
</p>
<p>This function will set the certificates
X.509 TLS extension from the given structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fversion-1"><span>gnutls_x509_crt_set_version<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_version</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">version</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">version</var>: holds the version number. For X.509v1 certificates must be 1.
</p>
<p>This function will set the version of the certificate. This must
be one for X.509 version 1, and so on. Plain certificates without
extensions must have version set to one.
</p>
<p>To create well-formed certificates, you must specify version 3 if
you use any certificate extensions. Extensions are created by
functions such as <code class="code">gnutls_x509_crt_set_subject_alt_name()</code>
or <code class="code">gnutls_x509_crt_set_key_usage()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fsign-1"><span>gnutls_x509_crt_sign<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fsign"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_sign</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_x509_privkey_t <var class="var">issuer_key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p>This function is the same a <code class="code">gnutls_x509_crt_sign2()</code> with no flags,
and an appropriate hash algorithm. The hash algorithm used may
vary between versions of GnuTLS, and it is tied to the security
level of the issuer’s public key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fsign2-1"><span>gnutls_x509_crt_sign2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fsign2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fsign2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fsign2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_sign2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_x509_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fsign2"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p><var class="var">dig</var>: The message digest to use, <code class="code">GNUTLS_DIG_SHA256</code> is a safe choice
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the certificate with the issuer’s private key, and
will copy the issuer’s information into the certificate.
</p>
<p>This must be the last step in a certificate generation since all
the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed certificate will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fverify-1"><span>gnutls_x509_crt_verify<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fverify-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fverify"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fverify"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_verify</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">cert</var>, const gnutls_x509_crt_t * <var class="var">CA_list</var>, unsigned <var class="var">CA_list_length</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">verify</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fverify"> ¶</a></span></dt>
<dd><p><var class="var">cert</var>: is the certificate to be verified
</p>
<p><var class="var">CA_list</var>: is one certificate that is considered to be trusted one
</p>
<p><var class="var">CA_list_length</var>: holds the number of CA certificate in CA_list
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">verify</var>: will hold the certificate verification output.
</p>
<p>This function will try to verify the given certificate and return
its status. Note that a verification error does not imply a negative
return status. In that case the <code class="code">verify</code> status is set.
</p>
<p>The details of the verification are the same
as in <code class="code">gnutls_x509_trust_list_verify_crt2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fverify_005fdata2-1"><span>gnutls_x509_crt_verify_data2<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fverify_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fverify_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fverify_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_verify_data2</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, const gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fverify_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate to verify with
</p>
<p><var class="var">algo</var>: The signature algorithm used
</p>
<p><var class="var">flags</var>: Zero or an OR list of <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p><var class="var">data</var>: holds the signed data
</p>
<p><var class="var">signature</var>: contains the signature
</p>
<p>This function will verify the given signed data, using the
parameters from the certificate.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code>
is returned, <code class="code">GNUTLS_E_EXPIRED</code> or <code class="code">GNUTLS_E_NOT_YET_ACTIVATED</code> on expired
or not yet activated certificate and zero or positive code on success.
</p>
<p>Note that since GnuTLS 3.5.6 this function introduces checks in the
end certificate ( <code class="code">crt</code> ), including time checks and key usage checks.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fct_005fsct_005fget-1"><span>gnutls_x509_ct_sct_get<a class="copiable-link" href="#gnutls_005fx509_005fct_005fsct_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fct_005fsct_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fct_005fsct_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ct_sct_get</strong> <code class="def-code-arguments">(const gnutls_x509_ct_scts_t <var class="var">scts</var>, unsigned <var class="var">idx</var>, time_t * <var class="var">timestamp</var>, gnutls_datum_t * <var class="var">logid</var>, gnutls_sign_algorithm_t * <var class="var">sigalg</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fct_005fsct_005fget"> ¶</a></span></dt>
<dd><p><var class="var">scts</var>: A list of SCTs
</p>
<p><var class="var">idx</var>: The index of the target SCT in the list
</p>
<p><var class="var">timestamp</var>: The timestamp of the SCT
</p>
<p><var class="var">logid</var>: The LogID field of the SCT; must be freed with <code class="code">gnutls_free()</code>
</p>
<p><var class="var">sigalg</var>: The signature algorithm
</p>
<p><var class="var">signature</var>: The signature of the SCT; must be freed with <code class="code">gnutls_free()</code>
</p>
<p>This function will return a specific SCT (Signed Certificate Timestamp)
stored in the SCT list <code class="code">scts</code> .
</p>
<p>The datums holding the SCT’s LogId and signature will be allocated
using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) will be returned on success,
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if <code class="code">idx</code> exceeds the number of SCTs in the list
or a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fct_005fsct_005fget_005fversion-1"><span>gnutls_x509_ct_sct_get_version<a class="copiable-link" href="#gnutls_005fx509_005fct_005fsct_005fget_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fct_005fsct_005fget_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fct_005fsct_005fget_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ct_sct_get_version</strong> <code class="def-code-arguments">(gnutls_x509_ct_scts_t <var class="var">scts</var>, unsigned <var class="var">idx</var>, unsigned int * <var class="var">version_out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fct_005fsct_005fget_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">scts</var>: A list of SCTs
</p>
<p><var class="var">idx</var>: The index of the target SCT in the list
</p>
<p><var class="var">version_out</var>: The version of the target SCT.
</p>
<p>This function obtains the version of the SCT at the given position
in the SCT list.
</p>
<p>The version of that SCT will be placed on <code class="code">version_out</code> .
</p>
<p>Return : <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned on success,
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if <code class="code">idx</code> exceeds the number of SCTs in the list
and <code class="code">GNUTLS_E_INVALID_REQUEST</code> if the SCT’s version is different than 1, as that’s currently
the only defined version.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fdeinit-1"><span>gnutls_x509_dn_deinit<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_dn_deinit</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: a DN uint8_t object pointer.
</p>
<p>This function deallocates the DN object as returned by
<code class="code">gnutls_x509_dn_import()</code> .
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fexport-1"><span>gnutls_x509_dn_export<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_export</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: Holds the uint8_t DN object
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a DN PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the DN to DER or PEM format.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">output_data_size</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code>
will be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN NAME".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fexport2-1"><span>gnutls_x509_dn_export2<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_export2</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: Holds the uint8_t DN object
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a DN PEM or DER encoded
</p>
<p>This function will export the DN to DER or PEM format.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN NAME".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fget_005frdn_005fava-1"><span>gnutls_x509_dn_get_rdn_ava<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fget_005frdn_005fava-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fget_005frdn_005fava"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fget_005frdn_005fava-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_get_rdn_ava</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, int <var class="var">irdn</var>, int <var class="var">iava</var>, gnutls_x509_ava_st * <var class="var">ava</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fget_005frdn_005fava-1"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: a pointer to DN
</p>
<p><var class="var">irdn</var>: index of RDN
</p>
<p><var class="var">iava</var>: index of AVA.
</p>
<p><var class="var">ava</var>: Pointer to structure which will hold output information.
</p>
<p>Get pointers to data within the DN. The format of the <code class="code">ava</code> structure
is shown below.
</p>
<p>struct gnutls_x509_ava_st {
gnutls_datum_t oid;
gnutls_datum_t value;
unsigned long value_tag;
};
</p>
<p>The X.509 distinguished name is a sequence of sequences of strings
and this is what the <code class="code">irdn</code> and <code class="code">iava</code> indexes model.
</p>
<p>Note that <code class="code">ava</code> will contain pointers into the <code class="code">dn</code> structure which
in turns points to the original certificate. Thus you should not
modify any data or deallocate any of those.
</p>
<p>This is a low-level function that requires the caller to do the
value conversions when necessary (e.g. from UCS-2).
</p>
<p><strong class="strong">Returns:</strong> Returns 0 on success, or an error code.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fget_005fstr-1"><span>gnutls_x509_dn_get_str<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fget_005fstr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fget_005fstr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fget_005fstr"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_get_str</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, gnutls_datum_t * <var class="var">str</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fget_005fstr"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: a pointer to DN
</p>
<p><var class="var">str</var>: a datum that will hold the name
</p>
<p>This function will allocate buffer and copy the name in the provided DN.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fget_005fstr2-1"><span>gnutls_x509_dn_get_str2<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fget_005fstr2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fget_005fstr2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fget_005fstr2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_get_str2</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, gnutls_datum_t * <var class="var">str</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fget_005fstr2"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: a pointer to DN
</p>
<p><var class="var">str</var>: a datum that will hold the name
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code>
</p>
<p>This function will allocate buffer and copy the name in the provided DN.
The name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as
described in RFC4514. The output string will be ASCII or UTF-8
encoded, depending on the certificate data.
</p>
<p>When the flag <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code> is specified, the output
format will match the format output by previous to 3.5.6 versions of GnuTLS
which was not not fully RFC4514-compliant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fimport-1"><span>gnutls_x509_dn_import<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_import</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, const gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: the structure that will hold the imported DN
</p>
<p><var class="var">data</var>: should contain a DER encoded RDN sequence
</p>
<p>This function parses an RDN sequence and stores the result to a
<code class="code">gnutls_x509_dn_t</code> type. The data must have been initialized
with <code class="code">gnutls_x509_dn_init()</code> . You may use <code class="code">gnutls_x509_dn_get_rdn_ava()</code> to
decode the DN.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005finit-1"><span>gnutls_x509_dn_init<a class="copiable-link" href="#gnutls_005fx509_005fdn_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_init</strong> <code class="def-code-arguments">(gnutls_x509_dn_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005finit"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: the object to be initialized
</p>
<p>This function initializes a <code class="code">gnutls_x509_dn_t</code> type.
</p>
<p>The object returned must be deallocated using
<code class="code">gnutls_x509_dn_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005foid_005fknown-1"><span>gnutls_x509_dn_oid_known<a class="copiable-link" href="#gnutls_005fx509_005fdn_005foid_005fknown-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005foid_005fknown"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005foid_005fknown"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_oid_known</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005foid_005fknown"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: holds an Object Identifier in a null terminated string
</p>
<p>This function will inform about known DN OIDs. This is useful since
functions like <code class="code">gnutls_x509_crt_set_dn_by_oid()</code> use the information
on known OIDs to properly encode their input. Object Identifiers
that are not known are not encoded by these functions, and their
input is stored directly into the ASN.1 structure. In that case of
unknown OIDs, you have the responsibility of DER encoding your
data.
</p>
<p><strong class="strong">Returns:</strong> 1 on known OIDs and 0 otherwise.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005foid_005fname-1"><span>gnutls_x509_dn_oid_name<a class="copiable-link" href="#gnutls_005fx509_005fdn_005foid_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005foid_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005foid_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_x509_dn_oid_name</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005foid_005fname"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: holds an Object Identifier in a null terminated string
</p>
<p><var class="var">flags</var>: 0 or GNUTLS_X509_DN_OID_*
</p>
<p>This function will return the name of a known DN OID. If
<code class="code">GNUTLS_X509_DN_OID_RETURN_OID</code> is specified this function
will return the given OID if no descriptive name has been
found.
</p>
<p><strong class="strong">Returns:</strong> A null terminated string or NULL otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fdn_005fset_005fstr-1"><span>gnutls_x509_dn_set_str<a class="copiable-link" href="#gnutls_005fx509_005fdn_005fset_005fstr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fdn_005fset_005fstr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fdn_005fset_005fstr"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_dn_set_str</strong> <code class="def-code-arguments">(gnutls_x509_dn_t <var class="var">dn</var>, const char * <var class="var">str</var>, const char ** <var class="var">err</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fdn_005fset_005fstr"> ¶</a></span></dt>
<dd><p><var class="var">dn</var>: a pointer to DN
</p>
<p><var class="var">str</var>: a comma separated DN string (RFC4514)
</p>
<p><var class="var">err</var>: indicates the error position (if any)
</p>
<p>This function will set the DN on the provided DN structure.
The input string should be plain ASCII or UTF-8 encoded. On
DN parsing error <code class="code">GNUTLS_E_PARSING_ERROR</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fct_005fexport_005fscts-1"><span>gnutls_x509_ext_ct_export_scts<a class="copiable-link" href="#gnutls_005fx509_005fext_005fct_005fexport_005fscts-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fct_005fexport_005fscts"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fct_005fexport_005fscts"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_ct_export_scts</strong> <code class="def-code-arguments">(const gnutls_x509_ct_scts_t <var class="var">scts</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fct_005fexport_005fscts"> ¶</a></span></dt>
<dd><p><var class="var">scts</var>: An initialized SCT list
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed with <code class="code">gnutls_free()</code>
</p>
<p>This function will convert the provided list of SCTs to a DER-encoded
SignedCertificateTimestampList extension (1.3.6.1.4.1.11129.2.4.2).
The output data in <code class="code">ext</code> will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fct_005fimport_005fscts-1"><span>gnutls_x509_ext_ct_import_scts<a class="copiable-link" href="#gnutls_005fx509_005fext_005fct_005fimport_005fscts-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fct_005fimport_005fscts"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fct_005fimport_005fscts"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_ct_import_scts</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_ct_scts_t <var class="var">scts</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fct_005fimport_005fscts"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: a DER-encoded extension
</p>
<p><var class="var">scts</var>: The SCT list
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will read a SignedCertificateTimestampList structure
from the DER data of the X.509 Certificate Transparency SCT extension
(OID 1.3.6.1.4.1.11129.2.4.2).
</p>
<p>The list of SCTs (Signed Certificate Timestamps) is placed on <code class="code">scts</code> ,
which must be previously initialized with <code class="code">gnutls_x509_ext_ct_scts_init()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fct_005fscts_005fdeinit-1"><span>gnutls_x509_ext_ct_scts_deinit<a class="copiable-link" href="#gnutls_005fx509_005fext_005fct_005fscts_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fct_005fscts_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fct_005fscts_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_ext_ct_scts_deinit</strong> <code class="def-code-arguments">(gnutls_x509_ct_scts_t <var class="var">scts</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fct_005fscts_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">scts</var>: The SCT list
</p>
<p>This function will deinitialize a Certificate Transparency SCT list.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fct_005fscts_005finit-1"><span>gnutls_x509_ext_ct_scts_init<a class="copiable-link" href="#gnutls_005fx509_005fext_005fct_005fscts_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fct_005fscts_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fct_005fscts_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_ct_scts_init</strong> <code class="def-code-arguments">(gnutls_x509_ct_scts_t * <var class="var">scts</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fct_005fscts_005finit"> ¶</a></span></dt>
<dd><p><var class="var">scts</var>: The SCT list
</p>
<p>This function will initialize a Certificate Transparency SCT list.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success, otherwise a negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fdeinit-1"><span>gnutls_x509_ext_deinit<a class="copiable-link" href="#gnutls_005fx509_005fext_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_ext_deinit</strong> <code class="def-code-arguments">(gnutls_x509_ext_st * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: The extensions structure
</p>
<p>This function will deinitialize an extensions structure.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005faia-1"><span>gnutls_x509_ext_export_aia<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005faia-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005faia"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005faia"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_aia</strong> <code class="def-code-arguments">(gnutls_x509_aia_t <var class="var">aia</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005faia"> ¶</a></span></dt>
<dd><p><var class="var">aia</var>: The authority info access
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will DER encode the Authority Information Access (AIA)
extension; see RFC 5280 section 4.2.2.1 for more information on the
extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fauthority_005fkey_005fid-1"><span>gnutls_x509_ext_export_authority_key_id<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fauthority_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fauthority_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fauthority_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_authority_key_id</strong> <code class="def-code-arguments">(gnutls_x509_aki_t <var class="var">aki</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fauthority_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">aki</var>: An initialized authority key identifier
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the provided key identifier to a
DER-encoded PKIX AuthorityKeyIdentifier extension.
The output data in <code class="code">ext</code> will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fbasic_005fconstraints-1"><span>gnutls_x509_ext_export_basic_constraints<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fbasic_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fbasic_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fbasic_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_basic_constraints</strong> <code class="def-code-arguments">(unsigned int <var class="var">ca</var>, int <var class="var">pathlen</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fbasic_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">ca</var>: non-zero for a CA
</p>
<p><var class="var">pathlen</var>: The path length constraint (set to -1 for no constraint)
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the parameters provided to a basic constraints
DER encoded extension (2.5.29.19).
The <code class="code">ext</code> data will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fcrl_005fdist_005fpoints-1"><span>gnutls_x509_ext_export_crl_dist_points<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fcrl_005fdist_005fpoints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fcrl_005fdist_005fpoints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fcrl_005fdist_005fpoints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_crl_dist_points</strong> <code class="def-code-arguments">(gnutls_x509_crl_dist_points_t <var class="var">cdp</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fcrl_005fdist_005fpoints"> ¶</a></span></dt>
<dd><p><var class="var">cdp</var>: A pointer to an initialized CRL distribution points.
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the provided policies, to a certificate policy
DER encoded extension (2.5.29.31).
</p>
<p>The <code class="code">ext</code> data will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005finhibit_005fanypolicy-1"><span>gnutls_x509_ext_export_inhibit_anypolicy<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005finhibit_005fanypolicy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005finhibit_005fanypolicy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005finhibit_005fanypolicy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_inhibit_anypolicy</strong> <code class="def-code-arguments">(unsigned int <var class="var">skipcerts</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005finhibit_005fanypolicy"> ¶</a></span></dt>
<dd><p><var class="var">skipcerts</var>: number of certificates after which anypolicy is no longer acceptable.
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the <code class="code">skipcerts</code> value to a DER
encoded Inhibit AnyPolicy PKIX extension. The <code class="code">ext</code> data will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fkey_005fpurposes-1"><span>gnutls_x509_ext_export_key_purposes<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fkey_005fpurposes-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fkey_005fpurposes"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fkey_005fpurposes"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_key_purposes</strong> <code class="def-code-arguments">(gnutls_x509_key_purposes_t <var class="var">p</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fkey_005fpurposes"> ¶</a></span></dt>
<dd><p><var class="var">p</var>: The key purposes
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the key purposes type to a
DER-encoded PKIX ExtKeyUsageSyntax (2.5.29.37) extension. The output data in
<code class="code">ext</code> will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fkey_005fusage-1"><span>gnutls_x509_ext_export_key_usage<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_key_usage</strong> <code class="def-code-arguments">(unsigned int <var class="var">usage</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">usage</var>: an ORed sequence of the GNUTLS_KEY_* elements.
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the keyUsage bit string to a DER
encoded PKIX extension. The <code class="code">ext</code> data will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fname_005fconstraints-1"><span>gnutls_x509_ext_export_name_constraints<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fname_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fname_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fname_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_name_constraints</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fname_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: The nameconstraints
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the provided name constraints type to a
DER-encoded PKIX NameConstraints (2.5.29.30) extension. The output data in
<code class="code">ext</code> will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fpolicies-1"><span>gnutls_x509_ext_export_policies<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fpolicies-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fpolicies"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fpolicies"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_policies</strong> <code class="def-code-arguments">(gnutls_x509_policies_t <var class="var">policies</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fpolicies"> ¶</a></span></dt>
<dd><p><var class="var">policies</var>: A pointer to an initialized policies.
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the provided policies, to a certificate policy
DER encoded extension (2.5.29.32).
</p>
<p>The <code class="code">ext</code> data will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fprivate_005fkey_005fusage_005fperiod-1"><span>gnutls_x509_ext_export_private_key_usage_period<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fprivate_005fkey_005fusage_005fperiod-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fprivate_005fkey_005fusage_005fperiod"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fprivate_005fkey_005fusage_005fperiod"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_private_key_usage_period</strong> <code class="def-code-arguments">(time_t <var class="var">activation</var>, time_t <var class="var">expiration</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fprivate_005fkey_005fusage_005fperiod"> ¶</a></span></dt>
<dd><p><var class="var">activation</var>: The activation time
</p>
<p><var class="var">expiration</var>: The expiration time
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the periods provided to a private key
usage DER encoded extension (2.5.29.16).
The <code class="code">ext</code> data will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fproxy-1"><span>gnutls_x509_ext_export_proxy<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fproxy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fproxy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fproxy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_proxy</strong> <code class="def-code-arguments">(int <var class="var">pathLenConstraint</var>, const char * <var class="var">policyLanguage</var>, const char * <var class="var">policy</var>, size_t <var class="var">sizeof_policy</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fproxy"> ¶</a></span></dt>
<dd><p><var class="var">pathLenConstraint</var>: A negative value will remove the path length constraint,
while non-negative values will be set as the length of the pathLenConstraints field.
</p>
<p><var class="var">policyLanguage</var>: OID describing the language of <code class="code">policy</code> .
</p>
<p><var class="var">policy</var>: uint8_t byte array with policy language, can be <code class="code">NULL</code>
</p>
<p><var class="var">sizeof_policy</var>: size of <code class="code">policy</code> .
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the parameters provided to a proxyCertInfo extension.
</p>
<p>The <code class="code">ext</code> data will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fsubject_005falt_005fnames-1"><span>gnutls_x509_ext_export_subject_alt_names<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fsubject_005falt_005fnames-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fsubject_005falt_005fnames"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fsubject_005falt_005fnames"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_subject_alt_names</strong> <code class="def-code-arguments">(gnutls_subject_alt_names_t <var class="var">sans</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fsubject_005falt_005fnames"> ¶</a></span></dt>
<dd><p><var class="var">sans</var>: The alternative names
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the provided alternative names structure to a
DER-encoded SubjectAltName PKIX extension. The output data in <code class="code">ext</code> will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005fsubject_005fkey_005fid-1"><span>gnutls_x509_ext_export_subject_key_id<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005fsubject_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005fsubject_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005fsubject_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_subject_key_id</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">id</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005fsubject_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">id</var>: The key identifier
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the provided key identifier to a
DER-encoded PKIX SubjectKeyIdentifier extension.
The output data in <code class="code">ext</code> will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fexport_005ftlsfeatures-1"><span>gnutls_x509_ext_export_tlsfeatures<a class="copiable-link" href="#gnutls_005fx509_005fext_005fexport_005ftlsfeatures-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fexport_005ftlsfeatures"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fexport_005ftlsfeatures"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_export_tlsfeatures</strong> <code class="def-code-arguments">(gnutls_x509_tlsfeatures_t <var class="var">f</var>, gnutls_datum_t * <var class="var">ext</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fexport_005ftlsfeatures"> ¶</a></span></dt>
<dd><p><var class="var">f</var>: The features structure
</p>
<p><var class="var">ext</var>: The DER-encoded extension data; must be freed using <code class="code">gnutls_free()</code> .
</p>
<p>This function will convert the provided TLS features structure structure to a
DER-encoded TLS features PKIX extension. The output data in <code class="code">ext</code> will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005faia-1"><span>gnutls_x509_ext_import_aia<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005faia-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005faia"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005faia"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_aia</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_aia_t <var class="var">aia</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005faia"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: The DER-encoded extension data
</p>
<p><var class="var">aia</var>: The authority info access
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function extracts the Authority Information Access (AIA)
extension from the provided DER-encoded data; see RFC 5280 section 4.2.2.1
for more information on the extension. The
AIA extension holds a sequence of AccessDescription (AD) data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fauthority_005fkey_005fid-1"><span>gnutls_x509_ext_import_authority_key_id<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fauthority_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fauthority_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fauthority_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_authority_key_id</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_aki_t <var class="var">aki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fauthority_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: a DER encoded extension
</p>
<p><var class="var">aki</var>: An initialized authority key identifier type
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will return the subject key ID stored in the provided
AuthorityKeyIdentifier extension.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fbasic_005fconstraints-1"><span>gnutls_x509_ext_import_basic_constraints<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fbasic_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fbasic_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fbasic_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_basic_constraints</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, unsigned int * <var class="var">ca</var>, int * <var class="var">pathlen</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fbasic_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: the DER encoded extension data
</p>
<p><var class="var">ca</var>: will be non zero if the CA status is true
</p>
<p><var class="var">pathlen</var>: the path length constraint; will be set to -1 for no limit
</p>
<p>This function will return the CA status and path length constraint
as written in the PKIX extension 2.5.29.19.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fcrl_005fdist_005fpoints-1"><span>gnutls_x509_ext_import_crl_dist_points<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fcrl_005fdist_005fpoints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fcrl_005fdist_005fpoints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fcrl_005fdist_005fpoints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_crl_dist_points</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_crl_dist_points_t <var class="var">cdp</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fcrl_005fdist_005fpoints"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: the DER encoded extension data
</p>
<p><var class="var">cdp</var>: A pointer to an initialized CRL distribution points.
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will extract the CRL distribution points extension (2.5.29.31)
and store it into the provided type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005finhibit_005fanypolicy-1"><span>gnutls_x509_ext_import_inhibit_anypolicy<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005finhibit_005fanypolicy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005finhibit_005fanypolicy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005finhibit_005fanypolicy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_inhibit_anypolicy</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, unsigned int * <var class="var">skipcerts</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005finhibit_005fanypolicy"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: the DER encoded extension data
</p>
<p><var class="var">skipcerts</var>: will hold the number of certificates after which anypolicy is no longer acceptable.
</p>
<p>This function will return certificate’s value of SkipCerts,
by reading the DER data of the Inhibit anyPolicy X.509 extension (2.5.29.54).
</p>
<p>The <code class="code">skipcerts</code> value is the number of additional certificates that
may appear in the path before the anyPolicy (<code class="code">GNUTLS_X509_OID_POLICY_ANY</code> )
is no longer acceptable.
</p>
<p><strong class="strong">Returns:</strong> zero, or a negative error code in case of
parsing error. If the certificate does not contain the Inhibit anyPolicy
extension <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fkey_005fpurposes-1"><span>gnutls_x509_ext_import_key_purposes<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fkey_005fpurposes-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fkey_005fpurposes"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fkey_005fpurposes"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_key_purposes</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_key_purposes_t <var class="var">p</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fkey_005fpurposes"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: The DER-encoded extension data
</p>
<p><var class="var">p</var>: The key purposes
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will extract the key purposes in the provided DER-encoded
ExtKeyUsageSyntax PKIX extension, to a <code class="code">gnutls_x509_key_purposes_t</code> type.
The data must be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fkey_005fusage-1"><span>gnutls_x509_ext_import_key_usage<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_key_usage</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, unsigned int * <var class="var">key_usage</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: the DER encoded extension data
</p>
<p><var class="var">key_usage</var>: where the key usage bits will be stored
</p>
<p>This function will return certificate’s key usage, by reading the DER
data of the keyUsage X.509 extension (2.5.29.15). The key usage value will ORed
values of the: <code class="code">GNUTLS_KEY_DIGITAL_SIGNATURE</code> ,
<code class="code">GNUTLS_KEY_NON_REPUDIATION</code> , <code class="code">GNUTLS_KEY_KEY_ENCIPHERMENT</code> ,
<code class="code">GNUTLS_KEY_DATA_ENCIPHERMENT</code> , <code class="code">GNUTLS_KEY_KEY_AGREEMENT</code> ,
<code class="code">GNUTLS_KEY_KEY_CERT_SIGN</code> , <code class="code">GNUTLS_KEY_CRL_SIGN</code> ,
<code class="code">GNUTLS_KEY_ENCIPHER_ONLY</code> , <code class="code">GNUTLS_KEY_DECIPHER_ONLY</code> .
</p>
<p><strong class="strong">Returns:</strong> the certificate key usage, or a negative error code in case of
parsing error. If the certificate does not contain the keyUsage
extension <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fname_005fconstraints-1"><span>gnutls_x509_ext_import_name_constraints<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fname_005fconstraints-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fname_005fconstraints"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fname_005fconstraints"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_name_constraints</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fname_005fconstraints"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: a DER encoded extension
</p>
<p><var class="var">nc</var>: The nameconstraints
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND</code>
</p>
<p>This function will return an intermediate type containing
the name constraints of the provided NameConstraints extension. That
can be used in combination with <code class="code">gnutls_x509_name_constraints_check()</code>
to verify whether a server’s name is in accordance with the constraints.
</p>
<p>When the <code class="code">flags</code> is set to <code class="code">GNUTLS_NAME_CONSTRAINTS_FLAG_APPEND</code> , then if
the <code class="code">nc</code> type is empty this function will behave identically as if the flag was not set.
Otherwise if there are elements in the <code class="code">nc</code> structure then the
constraints will be merged with the existing constraints following
RFC5280 p6.1.4 (excluded constraints will be appended, permitted
will be intersected).
</p>
<p>Note that <code class="code">nc</code> must be initialized prior to calling this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fpolicies-1"><span>gnutls_x509_ext_import_policies<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fpolicies-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fpolicies"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fpolicies"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_policies</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_policies_t <var class="var">policies</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fpolicies"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: the DER encoded extension data
</p>
<p><var class="var">policies</var>: A pointer to an initialized policies.
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will extract the certificate policy extension (2.5.29.32)
and store it the provided policies.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fprivate_005fkey_005fusage_005fperiod-1"><span>gnutls_x509_ext_import_private_key_usage_period<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fprivate_005fkey_005fusage_005fperiod-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fprivate_005fkey_005fusage_005fperiod"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fprivate_005fkey_005fusage_005fperiod"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_private_key_usage_period</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, time_t * <var class="var">activation</var>, time_t * <var class="var">expiration</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fprivate_005fkey_005fusage_005fperiod"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: the DER encoded extension data
</p>
<p><var class="var">activation</var>: Will hold the activation time
</p>
<p><var class="var">expiration</var>: Will hold the expiration time
</p>
<p>This function will return the expiration and activation
times of the private key as written in the
PKIX extension 2.5.29.16.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fproxy-1"><span>gnutls_x509_ext_import_proxy<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fproxy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fproxy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fproxy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_proxy</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, int * <var class="var">pathlen</var>, char ** <var class="var">policyLanguage</var>, char ** <var class="var">policy</var>, size_t * <var class="var">sizeof_policy</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fproxy"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: the DER encoded extension data
</p>
<p><var class="var">pathlen</var>: pointer to output integer indicating path length (may be
NULL), non-negative error codes indicate a present pCPathLenConstraint
field and the actual value, -1 indicate that the field is absent.
</p>
<p><var class="var">policyLanguage</var>: output variable with OID of policy language
</p>
<p><var class="var">policy</var>: output variable with policy data
</p>
<p><var class="var">sizeof_policy</var>: output variable with size of policy data
</p>
<p>This function will return the information from a proxy certificate
extension. It reads the ProxyCertInfo X.509 extension (1.3.6.1.5.5.7.1.14).
The <code class="code">policyLanguage</code> and <code class="code">policy</code> values must be deinitialized using <code class="code">gnutls_free()</code> after use.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fsubject_005falt_005fnames-1"><span>gnutls_x509_ext_import_subject_alt_names<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fsubject_005falt_005fnames-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fsubject_005falt_005fnames"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fsubject_005falt_005fnames"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_subject_alt_names</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_subject_alt_names_t <var class="var">sans</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fsubject_005falt_005fnames"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: The DER-encoded extension data
</p>
<p><var class="var">sans</var>: The alternative names
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will export the alternative names in the provided DER-encoded
SubjectAltName PKIX extension, to a <code class="code">gnutls_subject_alt_names_t</code> type. <code class="code">sans</code> must be initialized.
</p>
<p>This function will succeed even if there no subject alternative names
in the structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005fsubject_005fkey_005fid-1"><span>gnutls_x509_ext_import_subject_key_id<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005fsubject_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005fsubject_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005fsubject_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_subject_key_id</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_datum_t * <var class="var">id</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005fsubject_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: a DER encoded extension
</p>
<p><var class="var">id</var>: will contain the subject key ID
</p>
<p>This function will return the subject key ID stored in the provided
SubjectKeyIdentifier extension. The ID will be allocated using
<code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fimport_005ftlsfeatures-1"><span>gnutls_x509_ext_import_tlsfeatures<a class="copiable-link" href="#gnutls_005fx509_005fext_005fimport_005ftlsfeatures-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fimport_005ftlsfeatures"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fimport_005ftlsfeatures"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_import_tlsfeatures</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">ext</var>, gnutls_x509_tlsfeatures_t <var class="var">f</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fimport_005ftlsfeatures"> ¶</a></span></dt>
<dd><p><var class="var">ext</var>: The DER-encoded extension data
</p>
<p><var class="var">f</var>: The features structure
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_EXT_FLAG_APPEND</code>
</p>
<p>This function will export the features in the provided DER-encoded
TLS Features PKIX extension, to a <code class="code">gnutls_x509_tlsfeatures_t</code> type. <code class="code">f</code> must be initialized.
</p>
<p>When the <code class="code">flags</code> is set to <code class="code">GNUTLS_EXT_FLAG_APPEND</code> ,
then if the <code class="code">features</code> structure is empty this function will behave
identically as if the flag was not set. Otherwise if there are elements
in the <code class="code">features</code> structure then they will be merged with.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fext_005fprint-1"><span>gnutls_x509_ext_print<a class="copiable-link" href="#gnutls_005fx509_005fext_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fext_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fext_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_ext_print</strong> <code class="def-code-arguments">(gnutls_x509_ext_st * <var class="var">exts</var>, unsigned int <var class="var">exts_size</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fext_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">exts</var>: The data to be printed
</p>
<p><var class="var">exts_size</var>: the number of available structures
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with null terminated string.
</p>
<p>This function will pretty print X.509 certificate extensions,
suitable for display to a human.
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fkey_005fpurpose_005fdeinit-1"><span>gnutls_x509_key_purpose_deinit<a class="copiable-link" href="#gnutls_005fx509_005fkey_005fpurpose_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fkey_005fpurpose_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fkey_005fpurpose_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_key_purpose_deinit</strong> <code class="def-code-arguments">(gnutls_x509_key_purposes_t <var class="var">p</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fkey_005fpurpose_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">p</var>: The key purposes
</p>
<p>This function will deinitialize a key purposes type.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fkey_005fpurpose_005fget-1"><span>gnutls_x509_key_purpose_get<a class="copiable-link" href="#gnutls_005fx509_005fkey_005fpurpose_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fkey_005fpurpose_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fkey_005fpurpose_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_key_purpose_get</strong> <code class="def-code-arguments">(gnutls_x509_key_purposes_t <var class="var">p</var>, unsigned <var class="var">idx</var>, gnutls_datum_t * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fkey_005fpurpose_005fget"> ¶</a></span></dt>
<dd><p><var class="var">p</var>: The key purposes
</p>
<p><var class="var">idx</var>: The index of the key purpose to retrieve
</p>
<p><var class="var">oid</var>: Will hold the object identifier of the key purpose (to be treated as constant)
</p>
<p>This function will retrieve the specified by the index key purpose in the
purposes type. The object identifier will be a null terminated string.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the index is out of bounds, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fkey_005fpurpose_005finit-1"><span>gnutls_x509_key_purpose_init<a class="copiable-link" href="#gnutls_005fx509_005fkey_005fpurpose_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fkey_005fpurpose_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fkey_005fpurpose_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_key_purpose_init</strong> <code class="def-code-arguments">(gnutls_x509_key_purposes_t * <var class="var">p</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fkey_005fpurpose_005finit"> ¶</a></span></dt>
<dd><p><var class="var">p</var>: The key purposes
</p>
<p>This function will initialize an alternative names type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fkey_005fpurpose_005fset-1"><span>gnutls_x509_key_purpose_set<a class="copiable-link" href="#gnutls_005fx509_005fkey_005fpurpose_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fkey_005fpurpose_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fkey_005fpurpose_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_key_purpose_set</strong> <code class="def-code-arguments">(gnutls_x509_key_purposes_t <var class="var">p</var>, const char * <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fkey_005fpurpose_005fset"> ¶</a></span></dt>
<dd><p><var class="var">p</var>: The key purposes
</p>
<p><var class="var">oid</var>: The object identifier of the key purpose
</p>
<p>This function will store the specified key purpose in the
purposes.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0), otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005fadd_005fexcluded-1"><span>gnutls_x509_name_constraints_add_excluded<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005fadd_005fexcluded-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005fadd_005fexcluded"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005fadd_005fexcluded"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_name_constraints_add_excluded</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005fadd_005fexcluded"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: The nameconstraints
</p>
<p><var class="var">type</var>: The type of the constraints
</p>
<p><var class="var">name</var>: The data of the constraints
</p>
<p>This function will add a name constraint to the list of excluded
constraints. The constraints <code class="code">type</code> can be any of the following types:
<code class="code">GNUTLS_SAN_DNSNAME</code> , <code class="code">GNUTLS_SAN_RFC822NAME</code> , <code class="code">GNUTLS_SAN_DN</code> ,
<code class="code">GNUTLS_SAN_URI</code> , <code class="code">GNUTLS_SAN_IPADDRESS</code> . For the latter, an IP address
in network byte order is expected, followed by its network mask (which is
4 bytes in IPv4 or 16-bytes in IPv6).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005fadd_005fpermitted-1"><span>gnutls_x509_name_constraints_add_permitted<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005fadd_005fpermitted-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005fadd_005fpermitted"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005fadd_005fpermitted"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_name_constraints_add_permitted</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005fadd_005fpermitted"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: The nameconstraints
</p>
<p><var class="var">type</var>: The type of the constraints
</p>
<p><var class="var">name</var>: The data of the constraints
</p>
<p>This function will add a name constraint to the list of permitted
constraints. The constraints <code class="code">type</code> can be any of the following types:
<code class="code">GNUTLS_SAN_DNSNAME</code> , <code class="code">GNUTLS_SAN_RFC822NAME</code> , <code class="code">GNUTLS_SAN_DN</code> ,
<code class="code">GNUTLS_SAN_URI</code> , <code class="code">GNUTLS_SAN_IPADDRESS</code> . For the latter, an IP address
in network byte order is expected, followed by its network mask.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005fcheck-1"><span>gnutls_x509_name_constraints_check<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005fcheck-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005fcheck"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005fcheck"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_name_constraints_check</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005fcheck"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: the extracted name constraints
</p>
<p><var class="var">type</var>: the type of the constraint to check (of type gnutls_x509_subject_alt_name_t)
</p>
<p><var class="var">name</var>: the name to be checked
</p>
<p>This function will check the provided name against the constraints in
<code class="code">nc</code> using the RFC5280 rules. Currently this function is limited to DNS
names, emails and IP addresses (of type <code class="code">GNUTLS_SAN_DNSNAME</code> ,
<code class="code">GNUTLS_SAN_RFC822NAME</code> and <code class="code">GNUTLS_SAN_IPADDRESS</code> ).
</p>
<p><strong class="strong">Returns:</strong> zero if the provided name is not acceptable, and non-zero otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005fcheck_005fcrt-1"><span>gnutls_x509_name_constraints_check_crt<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005fcheck_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005fcheck_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005fcheck_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_name_constraints_check_crt</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>, gnutls_x509_subject_alt_name_t <var class="var">type</var>, gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005fcheck_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: the extracted name constraints
</p>
<p><var class="var">type</var>: the type of the constraint to check (of type gnutls_x509_subject_alt_name_t)
</p>
<p><var class="var">cert</var>: the certificate to be checked
</p>
<p>This function will check the provided certificate names against the constraints in
<code class="code">nc</code> using the RFC5280 rules. It will traverse all the certificate’s names and
alternative names.
</p>
<p>Currently this function is limited to DNS
names and emails (of type <code class="code">GNUTLS_SAN_DNSNAME</code> and <code class="code">GNUTLS_SAN_RFC822NAME</code> ).
</p>
<p><strong class="strong">Returns:</strong> zero if the provided name is not acceptable, and non-zero otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005fdeinit-1"><span>gnutls_x509_name_constraints_deinit<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_name_constraints_deinit</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: The nameconstraints
</p>
<p>This function will deinitialize a name constraints type.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005fget_005fexcluded-1"><span>gnutls_x509_name_constraints_get_excluded<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005fget_005fexcluded-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005fget_005fexcluded"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005fget_005fexcluded"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_name_constraints_get_excluded</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned <var class="var">idx</var>, unsigned * <var class="var">type</var>, gnutls_datum_t * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005fget_005fexcluded"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: the extracted name constraints
</p>
<p><var class="var">idx</var>: the index of the constraint
</p>
<p><var class="var">type</var>: the type of the constraint (of type gnutls_x509_subject_alt_name_t)
</p>
<p><var class="var">name</var>: the name in the constraint (of the specific type)
</p>
<p>This function will return an intermediate type containing
the name constraints of the provided CA certificate. That
structure can be used in combination with <code class="code">gnutls_x509_name_constraints_check()</code>
to verify whether a server’s name is in accordance with the constraints.
</p>
<p>The name should be treated as constant and valid for the lifetime of <code class="code">nc</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005fget_005fpermitted-1"><span>gnutls_x509_name_constraints_get_permitted<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005fget_005fpermitted-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005fget_005fpermitted"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005fget_005fpermitted"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_name_constraints_get_permitted</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t <var class="var">nc</var>, unsigned <var class="var">idx</var>, unsigned * <var class="var">type</var>, gnutls_datum_t * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005fget_005fpermitted"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: the extracted name constraints
</p>
<p><var class="var">idx</var>: the index of the constraint
</p>
<p><var class="var">type</var>: the type of the constraint (of type gnutls_x509_subject_alt_name_t)
</p>
<p><var class="var">name</var>: the name in the constraint (of the specific type)
</p>
<p>This function will return an intermediate type containing
the name constraints of the provided CA certificate. That
structure can be used in combination with <code class="code">gnutls_x509_name_constraints_check()</code>
to verify whether a server’s name is in accordance with the constraints.
</p>
<p>The name should be treated as constant and valid for the lifetime of <code class="code">nc</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the extension is not present, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fname_005fconstraints_005finit-1"><span>gnutls_x509_name_constraints_init<a class="copiable-link" href="#gnutls_005fx509_005fname_005fconstraints_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fname_005fconstraints_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fname_005fconstraints_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_name_constraints_init</strong> <code class="def-code-arguments">(gnutls_x509_name_constraints_t * <var class="var">nc</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fname_005fconstraints_005finit"> ¶</a></span></dt>
<dd><p><var class="var">nc</var>: The nameconstraints
</p>
<p>This function will initialize a name constraints type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fothername_005fto_005fvirtual-1"><span>gnutls_x509_othername_to_virtual<a class="copiable-link" href="#gnutls_005fx509_005fothername_005fto_005fvirtual-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fothername_005fto_005fvirtual"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fothername_005fto_005fvirtual"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_othername_to_virtual</strong> <code class="def-code-arguments">(const char * <var class="var">oid</var>, const gnutls_datum_t * <var class="var">othername</var>, unsigned int * <var class="var">virt_type</var>, gnutls_datum_t * <var class="var">virt</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fothername_005fto_005fvirtual"> ¶</a></span></dt>
<dd><p><var class="var">oid</var>: The othername object identifier
</p>
<p><var class="var">othername</var>: The othername data
</p>
<p><var class="var">virt_type</var>: GNUTLS_SAN_OTHERNAME_XXX
</p>
<p><var class="var">virt</var>: allocated printable data
</p>
<p>This function will parse and convert the othername data to a virtual
type supported by gnutls.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fpolicies_005fdeinit-1"><span>gnutls_x509_policies_deinit<a class="copiable-link" href="#gnutls_005fx509_005fpolicies_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fpolicies_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fpolicies_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_policies_deinit</strong> <code class="def-code-arguments">(gnutls_x509_policies_t <var class="var">policies</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fpolicies_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">policies</var>: The authority key identifier
</p>
<p>This function will deinitialize an authority key identifier type.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fpolicies_005fget-1"><span>gnutls_x509_policies_get<a class="copiable-link" href="#gnutls_005fx509_005fpolicies_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fpolicies_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fpolicies_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_policies_get</strong> <code class="def-code-arguments">(gnutls_x509_policies_t <var class="var">policies</var>, unsigned int <var class="var">seq</var>, struct gnutls_x509_policy_st * <var class="var">policy</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fpolicies_005fget"> ¶</a></span></dt>
<dd><p><var class="var">policies</var>: The policies
</p>
<p><var class="var">seq</var>: The index of the name to get
</p>
<p><var class="var">policy</var>: Will hold the policy
</p>
<p>This function will return a specific policy as stored in
the <code class="code">policies</code> type. The returned values should be treated as constant
and valid for the lifetime of <code class="code">policies</code> .
</p>
<p>The any policy OID is available as the <code class="code">GNUTLS_X509_OID_POLICY_ANY</code> macro.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
if the index is out of bounds, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fpolicies_005finit-1"><span>gnutls_x509_policies_init<a class="copiable-link" href="#gnutls_005fx509_005fpolicies_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fpolicies_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fpolicies_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_policies_init</strong> <code class="def-code-arguments">(gnutls_x509_policies_t * <var class="var">policies</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fpolicies_005finit"> ¶</a></span></dt>
<dd><p><var class="var">policies</var>: The authority key ID
</p>
<p>This function will initialize an authority key ID type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fpolicies_005fset-1"><span>gnutls_x509_policies_set<a class="copiable-link" href="#gnutls_005fx509_005fpolicies_005fset-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fpolicies_005fset"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fpolicies_005fset"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_policies_set</strong> <code class="def-code-arguments">(gnutls_x509_policies_t <var class="var">policies</var>, const struct gnutls_x509_policy_st * <var class="var">policy</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fpolicies_005fset"> ¶</a></span></dt>
<dd><p><var class="var">policies</var>: An initialized policies
</p>
<p><var class="var">policy</var>: Contains the policy to set
</p>
<p>This function will store the specified policy in
the provided <code class="code">policies</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0), otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fpolicy_005frelease-1"><span>gnutls_x509_policy_release<a class="copiable-link" href="#gnutls_005fx509_005fpolicy_005frelease-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fpolicy_005frelease"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fpolicy_005frelease"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_policy_release</strong> <code class="def-code-arguments">(struct gnutls_x509_policy_st * <var class="var">policy</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fpolicy_005frelease"> ¶</a></span></dt>
<dd><p><var class="var">policy</var>: a certificate policy
</p>
<p>This function will deinitialize all memory associated with the provided
<code class="code">policy</code> . The policy is allocated using <code class="code">gnutls_x509_crt_get_policy()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fcpy-1"><span>gnutls_x509_privkey_cpy<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fcpy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fcpy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fcpy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_cpy</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">dst</var>, gnutls_x509_privkey_t <var class="var">src</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fcpy"> ¶</a></span></dt>
<dd><p><var class="var">dst</var>: The destination key, which should be initialized.
</p>
<p><var class="var">src</var>: The source key
</p>
<p>This function will copy a private key from source to destination
key. Destination has to be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fdeinit-1"><span>gnutls_x509_privkey_deinit<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_privkey_deinit</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The key to be deinitialized
</p>
<p>This function will deinitialize a private key structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport-1"><span>gnutls_x509_privkey_export<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a private key PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the private key to a PKCS<code class="code">1</code> structure for
RSA or RSA-PSS keys, and integer sequence for DSA keys. Other keys types
will be exported in PKCS<code class="code">8</code> form.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN RSA PRIVATE KEY".
</p>
<p>It is recommended to use <code class="code">gnutls_x509_privkey_export_pkcs8()</code> instead
of this function, when a consistent output format is required.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport2-1"><span>gnutls_x509_privkey_export2<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export2</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a private key PEM or DER encoded
</p>
<p>This function will export the private key to a PKCS<code class="code">1</code> structure for
RSA or RSA-PSS keys, and integer sequence for DSA keys. Other keys types
will be exported in PKCS<code class="code">8</code> form.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>It is recommended to use <code class="code">gnutls_x509_privkey_export2_pkcs8()</code> instead
of this function, when a consistent output format is required.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p>Since 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport2_005fpkcs8-1"><span>gnutls_x509_privkey_export2_pkcs8<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport2_005fpkcs8-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport2_005fpkcs8"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport2_005fpkcs8"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export2_pkcs8</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport2_005fpkcs8"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">password</var>: the password that will be used to encrypt the key.
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p><var class="var">out</var>: will contain a private key PEM or DER encoded
</p>
<p>This function will export the private key to a PKCS8 structure.
Both RSA and DSA keys can be exported. For DSA keys we use
PKCS <code class="code">11</code> definitions. If the flags do not specify the encryption
cipher, then the default 3DES (PBES2) will be used.
</p>
<p>The <code class="code">password</code> can be either ASCII or UTF-8 in the default PBES2
encryption schemas, or ASCII for the PKCS12 schemas.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if
encryption is not used.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p>Since 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport_005fdsa_005fraw-1"><span>gnutls_x509_privkey_export_dsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport_005fdsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport_005fdsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport_005fdsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export_dsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">x</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport_005fdsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">p</var>: will hold the p
</p>
<p><var class="var">q</var>: will hold the q
</p>
<p><var class="var">g</var>: will hold the g
</p>
<p><var class="var">y</var>: will hold the y
</p>
<p><var class="var">x</var>: will hold the x
</p>
<p>This function will export the DSA private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport_005fecc_005fraw-1"><span>gnutls_x509_privkey_export_ecc_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport_005fecc_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport_005fecc_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport_005fecc_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export_ecc_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">k</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport_005fecc_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">curve</var>: will hold the curve
</p>
<p><var class="var">x</var>: will hold the x-coordinate
</p>
<p><var class="var">y</var>: will hold the y-coordinate
</p>
<p><var class="var">k</var>: will hold the private key
</p>
<p>This function will export the ECC private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter will be <code class="code">NULL</code> and the other parameters
will be in the native format for the curve.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport_005fgost_005fraw-1"><span>gnutls_x509_privkey_export_gost_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport_005fgost_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport_005fgost_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport_005fgost_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export_gost_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_gost_paramset_t * <var class="var">paramset</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">k</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport_005fgost_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">curve</var>: will hold the curve
</p>
<p><var class="var">digest</var>: will hold the digest
</p>
<p><var class="var">paramset</var>: will hold the GOST parameter set ID
</p>
<p><var class="var">x</var>: will hold the x-coordinate
</p>
<p><var class="var">y</var>: will hold the y-coordinate
</p>
<p><var class="var">k</var>: will hold the private key
</p>
<p>This function will export the GOST private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Note:</strong> parameters will be stored with least significant byte first. On
version 3.6.3 this was incorrectly returned in big-endian format.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport_005fpkcs8-1"><span>gnutls_x509_privkey_export_pkcs8<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport_005fpkcs8-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport_005fpkcs8"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport_005fpkcs8"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export_pkcs8</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport_005fpkcs8"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">password</var>: the password that will be used to encrypt the key.
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p><var class="var">output_data</var>: will contain a private key PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the private key to a PKCS8 structure.
Both RSA and DSA keys can be exported. For DSA keys we use
PKCS <code class="code">11</code> definitions. If the flags do not specify the encryption
cipher, then the default 3DES (PBES2) will be used.
</p>
<p>The <code class="code">password</code> can be either ASCII or UTF-8 in the default PBES2
encryption schemas, or ASCII for the PKCS12 schemas.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN ENCRYPTED PRIVATE KEY" or "BEGIN PRIVATE KEY" if
encryption is not used.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw-1"><span>gnutls_x509_privkey_export_rsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export_rsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, gnutls_datum_t * <var class="var">d</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">u</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">m</var>: will hold the modulus
</p>
<p><var class="var">e</var>: will hold the public exponent
</p>
<p><var class="var">d</var>: will hold the private exponent
</p>
<p><var class="var">p</var>: will hold the first prime (p)
</p>
<p><var class="var">q</var>: will hold the second prime (q)
</p>
<p><var class="var">u</var>: will hold the coefficient
</p>
<p>This function will export the RSA private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw2-1"><span>gnutls_x509_privkey_export_rsa_raw2<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_export_rsa_raw2</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, gnutls_datum_t * <var class="var">d</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">u</var>, gnutls_datum_t * <var class="var">e1</var>, gnutls_datum_t * <var class="var">e2</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">m</var>: will hold the modulus
</p>
<p><var class="var">e</var>: will hold the public exponent
</p>
<p><var class="var">d</var>: will hold the private exponent
</p>
<p><var class="var">p</var>: will hold the first prime (p)
</p>
<p><var class="var">q</var>: will hold the second prime (q)
</p>
<p><var class="var">u</var>: will hold the coefficient
</p>
<p><var class="var">e1</var>: will hold e1 = d mod (p-1)
</p>
<p><var class="var">e2</var>: will hold e2 = d mod (q-1)
</p>
<p>This function will export the RSA private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005ffix-1"><span>gnutls_x509_privkey_fix<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005ffix-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005ffix"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005ffix"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_fix</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005ffix"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p>This function will recalculate the secondary parameters in a key.
In RSA keys, this can be the coefficient and exponent1,2.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fgenerate-1"><span>gnutls_x509_privkey_generate<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fgenerate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fgenerate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fgenerate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_generate</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_pk_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">bits</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fgenerate"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: an initialized key
</p>
<p><var class="var">algo</var>: is one of the algorithms in <code class="code">gnutls_pk_algorithm_t</code> .
</p>
<p><var class="var">bits</var>: the size of the parameters to generate
</p>
<p><var class="var">flags</var>: Must be zero or flags from <code class="code">gnutls_privkey_flags_t</code> .
</p>
<p>This function will generate a random private key. Note that this
function must be called on an initialized private key.
</p>
<p>The flag <code class="code">GNUTLS_PRIVKEY_FLAG_PROVABLE</code>
instructs the key generation process to use algorithms like Shawe-Taylor
(from FIPS PUB186-4) which generate provable parameters out of a seed
for RSA and DSA keys. See <code class="code">gnutls_x509_privkey_generate2()</code> for more
information.
</p>
<p>Note that when generating an elliptic curve key, the curve
can be substituted in the place of the bits parameter using the
<code class="code">GNUTLS_CURVE_TO_BITS()</code> macro. The input to the macro is any curve from
<code class="code">gnutls_ecc_curve_t</code> .
</p>
<p>For DSA keys, if the subgroup size needs to be specified check
the <code class="code">GNUTLS_SUBGROUP_TO_BITS()</code> macro.
</p>
<p>It is recommended to do not set the number of <code class="code">bits</code> directly, use <code class="code">gnutls_sec_param_to_pk_bits()</code> instead .
</p>
<p>See also <code class="code">gnutls_privkey_generate()</code> , <code class="code">gnutls_x509_privkey_generate2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fgenerate2-1"><span>gnutls_x509_privkey_generate2<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fgenerate2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fgenerate2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fgenerate2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_generate2</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_pk_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">bits</var>, unsigned int <var class="var">flags</var>, const gnutls_keygen_data_st * <var class="var">data</var>, unsigned <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fgenerate2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">algo</var>: is one of the algorithms in <code class="code">gnutls_pk_algorithm_t</code> .
</p>
<p><var class="var">bits</var>: the size of the modulus
</p>
<p><var class="var">flags</var>: Must be zero or flags from <code class="code">gnutls_privkey_flags_t</code> .
</p>
<p><var class="var">data</var>: Allow specifying <code class="code">gnutls_keygen_data_st</code> types such as the seed to be used.
</p>
<p><var class="var">data_size</var>: The number of <code class="code">data</code> available.
</p>
<p>This function will generate a random private key. Note that this
function must be called on an initialized private key.
</p>
<p>The flag <code class="code">GNUTLS_PRIVKEY_FLAG_PROVABLE</code>
instructs the key generation process to use algorithms like Shawe-Taylor
(from FIPS PUB186-4) which generate provable parameters out of a seed
for RSA and DSA keys. On DSA keys the PQG parameters are generated using the
seed, while on RSA the two primes. To specify an explicit seed
(by default a random seed is used), use the <code class="code">data</code> with a <code class="code">GNUTLS_KEYGEN_SEED</code>
type.
</p>
<p>Note that when generating an elliptic curve key, the curve
can be substituted in the place of the bits parameter using the
<code class="code">GNUTLS_CURVE_TO_BITS()</code> macro.
</p>
<p>To export the generated keys in memory or in files it is recommended to use the
PKCS<code class="code">8</code> form as it can handle all key types, and can store additional parameters
such as the seed, in case of provable RSA or DSA keys.
Generated keys can be exported in memory using <code class="code">gnutls_privkey_export_x509()</code> ,
and then with <code class="code">gnutls_x509_privkey_export2_pkcs8()</code> .
</p>
<p>If key generation is part of your application, avoid setting the number
of bits directly, and instead use <code class="code">gnutls_sec_param_to_pk_bits()</code> .
That way the generated keys will adapt to the security levels
of the underlying GnuTLS library.
</p>
<p>See also <code class="code">gnutls_privkey_generate2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fget_005fkey_005fid-1"><span>gnutls_x509_privkey_get_key_id<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fget_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fget_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fget_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_get_key_id</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fget_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">flags</var>: should be one of the flags from <code class="code">gnutls_keyid_flags_t</code>
</p>
<p><var class="var">output_data</var>: will contain the key ID
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will return a unique ID that depends on the public key
parameters. This ID can be used in checking whether a certificate
corresponds to the given key.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">output_data_size</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will
be returned. The output will normally be a SHA-1 hash output,
which is 20 bytes.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm-1"><span>gnutls_x509_privkey_get_pk_algorithm<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_get_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_x509_privkey_t</code> type
</p>
<p>This function will return the public key algorithm of a private
key.
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_pk_algorithm_t</code> enumeration on
success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm2-1"><span>gnutls_x509_privkey_get_pk_algorithm2<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_get_pk_algorithm2</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, unsigned int * <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_x509_privkey_t</code> type
</p>
<p><var class="var">bits</var>: The number of bits in the public key algorithm
</p>
<p>This function will return the public key algorithm of a private
key.
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_pk_algorithm_t</code> enumeration on
success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fget_005fseed-1"><span>gnutls_x509_privkey_get_seed<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fget_005fseed-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fget_005fseed"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fget_005fseed"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_get_seed</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, void * <var class="var">seed</var>, size_t * <var class="var">seed_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fget_005fseed"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_x509_privkey_t</code> type
</p>
<p><var class="var">digest</var>: if non-NULL it will contain the digest algorithm used for key generation (if applicable)
</p>
<p><var class="var">seed</var>: where seed will be copied to
</p>
<p><var class="var">seed_size</var>: originally holds the size of <code class="code">seed</code> , will be updated with actual size
</p>
<p>This function will return the seed that was used to generate the
given private key. That function will succeed only if the key was generated
as a provable key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fget_005fspki-1"><span>gnutls_x509_privkey_get_spki<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fget_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fget_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fget_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_get_spki</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fget_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_x509_privkey_t</code> type
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_x509_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return the public key information of a private
key. The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Returns:</strong> Zero on success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport-1"><span>gnutls_x509_privkey_import<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">data</var>: The DER or PEM encoded certificate.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p>This function will convert the given DER or PEM encoded key to the
native <code class="code">gnutls_x509_privkey_t</code> format. The output will be stored in
<code class="code">key</code> .
</p>
<p>If the key is PEM encoded it should have a header that contains "PRIVATE
KEY". Note that this function falls back to PKCS <code class="code">8</code> decoding without
password, if the default format fails to import.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport2-1"><span>gnutls_x509_privkey_import2<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import2</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport2-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">data</var>: The DER or PEM encoded key.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p><var class="var">password</var>: A password (optional)
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p>This function will import the given DER or PEM encoded key, to
the native <code class="code">gnutls_x509_privkey_t</code> format, irrespective of the
input format. The input format is auto-detected.
</p>
<p>The supported formats are basic unencrypted key, PKCS8, PKCS12,
and the openssl format.
</p>
<p>If the provided key is encrypted but no password was given, then
<code class="code">GNUTLS_E_DECRYPTION_FAILED</code> is returned. Since GnuTLS 3.4.0 this
function will utilize the PIN callbacks if any.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005fdh_005fraw-1"><span>gnutls_x509_privkey_import_dh_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005fdh_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005fdh_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005fdh_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_dh_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_dh_params_t <var class="var">params</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">x</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005fdh_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">params</var>: holds the <code class="code">gnutls_dh_params_t</code>
</p>
<p><var class="var">y</var>: holds the y (optional)
</p>
<p><var class="var">x</var>: holds the x
</p>
<p>This function will convert the given Diffie-Hellman raw parameters
to the native <code class="code">gnutls_x509_privkey_t</code> format. The output will be
stored in <code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005fdsa_005fraw-1"><span>gnutls_x509_privkey_import_dsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005fdsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005fdsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005fdsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_dsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">p</var>, const gnutls_datum_t * <var class="var">q</var>, const gnutls_datum_t * <var class="var">g</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">x</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005fdsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">p</var>: holds the p
</p>
<p><var class="var">q</var>: holds the q
</p>
<p><var class="var">g</var>: holds the g
</p>
<p><var class="var">y</var>: holds the y (optional)
</p>
<p><var class="var">x</var>: holds the x
</p>
<p>This function will convert the given DSA raw parameters to the
native <code class="code">gnutls_x509_privkey_t</code> format. The output will be stored
in <code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005fecc_005fraw-1"><span>gnutls_x509_privkey_import_ecc_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005fecc_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005fecc_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005fecc_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_ecc_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t <var class="var">curve</var>, const gnutls_datum_t * <var class="var">x</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">k</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005fecc_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">curve</var>: holds the curve
</p>
<p><var class="var">x</var>: holds the x-coordinate
</p>
<p><var class="var">y</var>: holds the y-coordinate
</p>
<p><var class="var">k</var>: holds the k
</p>
<p>This function will convert the given elliptic curve parameters to the
native <code class="code">gnutls_x509_privkey_t</code> format. The output will be stored
in <code class="code">key</code> . For EdDSA keys, the <code class="code">x</code> and <code class="code">k</code> values must be in the
native to curve format.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005fgost_005fraw-1"><span>gnutls_x509_privkey_import_gost_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005fgost_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005fgost_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005fgost_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_gost_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t <var class="var">curve</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, gnutls_gost_paramset_t <var class="var">paramset</var>, const gnutls_datum_t * <var class="var">x</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">k</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005fgost_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">curve</var>: holds the curve
</p>
<p><var class="var">digest</var>: will hold the digest
</p>
<p><var class="var">paramset</var>: will hold the GOST parameter set ID
</p>
<p><var class="var">x</var>: holds the x-coordinate
</p>
<p><var class="var">y</var>: holds the y-coordinate
</p>
<p><var class="var">k</var>: holds the k (private key)
</p>
<p>This function will convert the given GOST private key’s parameters to the
native <code class="code">gnutls_x509_privkey_t</code> format. The output will be stored
in <code class="code">key</code> . <code class="code">digest</code> should be one of GNUTLS_DIG_GOSR_94,
GNUTLS_DIG_STREEBOG_256 or GNUTLS_DIG_STREEBOG_512. If <code class="code">paramset</code> is set to
GNUTLS_GOST_PARAMSET_UNKNOWN default one will be selected depending on
<code class="code">digest</code> .
</p>
<p><strong class="strong">Note:</strong> parameters should be stored with least significant byte first. On
version 3.6.3 big-endian format was used incorrectly.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005fopenssl-1"><span>gnutls_x509_privkey_import_openssl<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005fopenssl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005fopenssl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005fopenssl-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_openssl</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, const char * <var class="var">password</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005fopenssl-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">data</var>: The DER or PEM encoded key.
</p>
<p><var class="var">password</var>: the password to decrypt the key (if it is encrypted).
</p>
<p>This function will convert the given PEM encrypted to
the native gnutls_x509_privkey_t format. The
output will be stored in <code class="code">key</code> .
</p>
<p>The <code class="code">password</code> should be in ASCII. If the password is not provided
or wrong then <code class="code">GNUTLS_E_DECRYPTION_FAILED</code> will be returned.
</p>
<p>If the Certificate is PEM encoded it should have a header of
"PRIVATE KEY" and the "DEK-Info" header.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005fpkcs8-1"><span>gnutls_x509_privkey_import_pkcs8<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005fpkcs8-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005fpkcs8"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005fpkcs8"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_pkcs8</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005fpkcs8"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">data</var>: The DER or PEM encoded key.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p><var class="var">password</var>: the password to decrypt the key (if it is encrypted).
</p>
<p><var class="var">flags</var>: 0 if encrypted or GNUTLS_PKCS_PLAIN if not encrypted.
</p>
<p>This function will convert the given DER or PEM encoded PKCS8 2.0
encrypted key to the native gnutls_x509_privkey_t format. The
output will be stored in <code class="code">key</code> . Both RSA and DSA keys can be
imported, and flags can only be used to indicate an unencrypted
key.
</p>
<p>The <code class="code">password</code> can be either ASCII or UTF-8 in the default PBES2
encryption schemas, or ASCII for the PKCS12 schemas.
</p>
<p>If the Certificate is PEM encoded it should have a header of
"ENCRYPTED PRIVATE KEY", or "PRIVATE KEY". You only need to
specify the flags if the key is DER encoded, since in that case
the encryption status cannot be auto-detected.
</p>
<p>If the <code class="code">GNUTLS_PKCS_PLAIN</code> flag is specified and the supplied data
are encrypted then <code class="code">GNUTLS_E_DECRYPTION_FAILED</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw-1"><span>gnutls_x509_privkey_import_rsa_raw<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_rsa_raw</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">m</var>, const gnutls_datum_t * <var class="var">e</var>, const gnutls_datum_t * <var class="var">d</var>, const gnutls_datum_t * <var class="var">p</var>, const gnutls_datum_t * <var class="var">q</var>, const gnutls_datum_t * <var class="var">u</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">m</var>: holds the modulus
</p>
<p><var class="var">e</var>: holds the public exponent
</p>
<p><var class="var">d</var>: holds the private exponent
</p>
<p><var class="var">p</var>: holds the first prime (p)
</p>
<p><var class="var">q</var>: holds the second prime (q)
</p>
<p><var class="var">u</var>: holds the coefficient
</p>
<p>This function will convert the given RSA raw parameters to the
native <code class="code">gnutls_x509_privkey_t</code> format. The output will be stored in
<code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw2-1"><span>gnutls_x509_privkey_import_rsa_raw2<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_import_rsa_raw2</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">m</var>, const gnutls_datum_t * <var class="var">e</var>, const gnutls_datum_t * <var class="var">d</var>, const gnutls_datum_t * <var class="var">p</var>, const gnutls_datum_t * <var class="var">q</var>, const gnutls_datum_t * <var class="var">u</var>, const gnutls_datum_t * <var class="var">e1</var>, const gnutls_datum_t * <var class="var">e2</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The data to store the parsed key
</p>
<p><var class="var">m</var>: holds the modulus
</p>
<p><var class="var">e</var>: holds the public exponent
</p>
<p><var class="var">d</var>: holds the private exponent
</p>
<p><var class="var">p</var>: holds the first prime (p)
</p>
<p><var class="var">q</var>: holds the second prime (q)
</p>
<p><var class="var">u</var>: holds the coefficient (optional)
</p>
<p><var class="var">e1</var>: holds e1 = d mod (p-1) (optional)
</p>
<p><var class="var">e2</var>: holds e2 = d mod (q-1) (optional)
</p>
<p>This function will convert the given RSA raw parameters to the
native <code class="code">gnutls_x509_privkey_t</code> format. The output will be stored in
<code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005finit-1"><span>gnutls_x509_privkey_init<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_init</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005finit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a private key type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fsec_005fparam-1"><span>gnutls_x509_privkey_sec_param<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fsec_005fparam-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fsec_005fparam"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fsec_005fparam"><span class="category-def">Function: </span><span><code class="def-type">gnutls_sec_param_t</code> <strong class="def-name">gnutls_x509_privkey_sec_param</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fsec_005fparam"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p>This function will return the security parameter appropriate with
this private key.
</p>
<p><strong class="strong">Returns:</strong> On success, a valid security parameter is returned otherwise
<code class="code">GNUTLS_SEC_PARAM_UNKNOWN</code> is returned.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fset_005fflags-1"><span>gnutls_x509_privkey_set_flags<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fset_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fset_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fset_005fflags"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_privkey_set_flags</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fset_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_x509_privkey_t</code>
</p>
<p><var class="var">flags</var>: flags from the <code class="code">gnutls_privkey_flags</code>
</p>
<p>This function will set flags for the specified private key, after
it is generated. Currently this is useful for the <code class="code">GNUTLS_PRIVKEY_FLAG_EXPORT_COMPAT</code>
to allow exporting a "provable" private key in backwards compatible way.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fset_005fpin_005ffunction-1"><span>gnutls_x509_privkey_set_pin_function<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_privkey_set_pin_function</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">privkey</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">privkey</var>: The certificate structure
</p>
<p><var class="var">fn</var>: the callback
</p>
<p><var class="var">userdata</var>: data associated with the callback
</p>
<p>This function will set a callback function to be used when
it is required to access a protected object. This function overrides
the global function set using <code class="code">gnutls_pkcs11_set_pin_function()</code> .
</p>
<p>Note that this callback is used when decrypting a key.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fset_005fspki-1"><span>gnutls_x509_privkey_set_spki<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fset_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fset_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fset_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_set_spki</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fset_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_x509_privkey_t</code> type
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_x509_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return the public key information of a private
key. The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Returns:</strong> Zero on success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fsign_005fdata-1"><span>gnutls_x509_privkey_sign_data<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fsign_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fsign_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fsign_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_sign_data</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, void * <var class="var">signature</var>, size_t * <var class="var">signature_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fsign_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">digest</var>: should be a digest algorithm
</p>
<p><var class="var">flags</var>: should be 0 for now
</p>
<p><var class="var">data</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain the signature
</p>
<p><var class="var">signature_size</var>: holds the size of signature (and will be replaced
by the new size)
</p>
<p>This function will sign the given data using a signature algorithm
supported by the private key. Signature algorithms are always used
together with a hash functions. Different hash functions may be
used for the RSA algorithm, but only SHA-1 for the DSA keys.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">signature_size</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will
be returned.
</p>
<p>Use <code class="code">gnutls_x509_crt_get_preferred_hash_algorithm()</code> to determine
the hash algorithm.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fverify_005fparams-1"><span>gnutls_x509_privkey_verify_params<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fverify_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fverify_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fverify_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_verify_params</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fverify_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p>This function will verify the private key parameters.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fverify_005fseed-1"><span>gnutls_x509_privkey_verify_seed<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fverify_005fseed-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fverify_005fseed"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fverify_005fseed"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_verify_seed</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, const void * <var class="var">seed</var>, size_t <var class="var">seed_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fverify_005fseed"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_x509_privkey_t</code> type
</p>
<p><var class="var">digest</var>: it contains the digest algorithm used for key generation (if applicable)
</p>
<p><var class="var">seed</var>: the seed of the key to be checked with
</p>
<p><var class="var">seed_size</var>: holds the size of <code class="code">seed</code>
</p>
<p>This function will verify that the given private key was generated from
the provided seed. If <code class="code">seed</code> is <code class="code">NULL</code> then the seed stored in the <code class="code">key</code> ’s structure
will be used for verification.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PRIVKEY_VERIFICATION_ERROR</code>
is returned, and zero or positive code on success.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005frdn_005fget-1"><span>gnutls_x509_rdn_get<a class="copiable-link" href="#gnutls_005fx509_005frdn_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005frdn_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005frdn_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_rdn_get</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">idn</var>, char * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005frdn_005fget"> ¶</a></span></dt>
<dd><p><var class="var">idn</var>: should contain a DER encoded RDN sequence
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the peer’s name
</p>
<p><var class="var">buf_size</var>: holds the size of <code class="code">buf</code>
</p>
<p>This function will return the name of the given RDN sequence. The
name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in
RFC4514.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_x509_rdn_get2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned and * <code class="code">buf_size</code> is
updated if the provided buffer is not long enough, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005frdn_005fget2-1"><span>gnutls_x509_rdn_get2<a class="copiable-link" href="#gnutls_005fx509_005frdn_005fget2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005frdn_005fget2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005frdn_005fget2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_rdn_get2</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">idn</var>, gnutls_datum_t * <var class="var">str</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005frdn_005fget2"> ¶</a></span></dt>
<dd><p><var class="var">idn</var>: should contain a DER encoded RDN sequence
</p>
<p><var class="var">str</var>: a datum that will hold the name
</p>
<p><var class="var">flags</var>: zero of <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code>
</p>
<p>This function will return the name of the given RDN sequence. The
name will be in the form "C=xxxx,O=yyyy,CN=zzzz" as described in
RFC4514.
</p>
<p>When the flag <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code> is specified, the output
format will match the format output by previous to 3.5.6 versions of GnuTLS
which was not not fully RFC4514-compliant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned and * <code class="code">buf_size</code> is
updated if the provided buffer is not long enough, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005frdn_005fget_005fby_005foid-1"><span>gnutls_x509_rdn_get_by_oid<a class="copiable-link" href="#gnutls_005fx509_005frdn_005fget_005fby_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005frdn_005fget_005fby_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005frdn_005fget_005fby_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_rdn_get_by_oid</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">idn</var>, const char * <var class="var">oid</var>, unsigned <var class="var">indx</var>, unsigned int <var class="var">raw_flag</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005frdn_005fget_005fby_005foid"> ¶</a></span></dt>
<dd><p><var class="var">idn</var>: should contain a DER encoded RDN sequence
</p>
<p><var class="var">oid</var>: an Object Identifier
</p>
<p><var class="var">indx</var>: In case multiple same OIDs exist in the RDN indicates which
to send. Use 0 for the first one.
</p>
<p><var class="var">raw_flag</var>: If non-zero then the raw DER data are returned.
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the peer’s name
</p>
<p><var class="var">buf_size</var>: holds the size of <code class="code">buf</code>
</p>
<p>This function will return the name of the given Object identifier,
of the RDN sequence. The name will be encoded using the rules
from RFC4514.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned and * <code class="code">buf_size</code> is
updated if the provided buffer is not long enough, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005frdn_005fget_005foid-1"><span>gnutls_x509_rdn_get_oid<a class="copiable-link" href="#gnutls_005fx509_005frdn_005fget_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005frdn_005fget_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005frdn_005fget_005foid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_rdn_get_oid</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">idn</var>, unsigned <var class="var">indx</var>, void * <var class="var">buf</var>, size_t * <var class="var">buf_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005frdn_005fget_005foid"> ¶</a></span></dt>
<dd><p><var class="var">idn</var>: should contain a DER encoded RDN sequence
</p>
<p><var class="var">indx</var>: Indicates which OID to return. Use 0 for the first one.
</p>
<p><var class="var">buf</var>: a pointer to a structure to hold the peer’s name OID
</p>
<p><var class="var">buf_size</var>: holds the size of <code class="code">buf</code>
</p>
<p>This function will return the specified Object identifier, of the
RDN sequence.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, or
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned and * <code class="code">buf_size</code> is
updated if the provided buffer is not long enough, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fspki_005fdeinit-1"><span>gnutls_x509_spki_deinit<a class="copiable-link" href="#gnutls_005fx509_005fspki_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fspki_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fspki_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_spki_deinit</strong> <code class="def-code-arguments">(gnutls_x509_spki_t <var class="var">spki</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fspki_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">spki</var>: the SubjectPublicKeyInfo structure
</p>
<p>This function will deinitialize a SubjectPublicKeyInfo structure.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fspki_005fget_005frsa_005foaep_005fparams-1"><span>gnutls_x509_spki_get_rsa_oaep_params<a class="copiable-link" href="#gnutls_005fx509_005fspki_005fget_005frsa_005foaep_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fspki_005fget_005frsa_005foaep_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fspki_005fget_005frsa_005foaep_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_spki_get_rsa_oaep_params</strong> <code class="def-code-arguments">(gnutls_x509_spki_t <var class="var">spki</var>, gnutls_digest_algorithm_t * <var class="var">dig</var>, gnutls_datum_t * <var class="var">label</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fspki_005fget_005frsa_005foaep_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">spki</var>: the SubjectPublicKeyInfo structure
</p>
<p><var class="var">dig</var>: if non-NULL, it will hold the digest algorithm
</p>
<p><var class="var">label</var>: if non-NULL, it will hold the pointer to label
</p>
<p>This function will get the public key algorithm parameters
of RSA-OAEP type.
</p>
<p><strong class="strong">Returns:</strong> zero if the parameters are present or a negative
value on error.
</p>
<p><strong class="strong">Since:</strong> 3.8.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fspki_005fget_005frsa_005fpss_005fparams-1"><span>gnutls_x509_spki_get_rsa_pss_params<a class="copiable-link" href="#gnutls_005fx509_005fspki_005fget_005frsa_005fpss_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fspki_005fget_005frsa_005fpss_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fspki_005fget_005frsa_005fpss_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_spki_get_rsa_pss_params</strong> <code class="def-code-arguments">(gnutls_x509_spki_t <var class="var">spki</var>, gnutls_digest_algorithm_t * <var class="var">dig</var>, unsigned int * <var class="var">salt_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fspki_005fget_005frsa_005fpss_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">spki</var>: the SubjectPublicKeyInfo structure
</p>
<p><var class="var">dig</var>: if non-NULL, it will hold the digest algorithm
</p>
<p><var class="var">salt_size</var>: if non-NULL, it will hold the salt size
</p>
<p>This function will get the public key algorithm parameters
of RSA-PSS type.
</p>
<p><strong class="strong">Returns:</strong> zero if the parameters are present or a negative
value on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fspki_005finit-1"><span>gnutls_x509_spki_init<a class="copiable-link" href="#gnutls_005fx509_005fspki_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fspki_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fspki_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_spki_init</strong> <code class="def-code-arguments">(gnutls_x509_spki_t * <var class="var">spki</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fspki_005finit"> ¶</a></span></dt>
<dd><p><var class="var">spki</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a SubjectPublicKeyInfo structure used
in PKIX. The structure is used to set additional parameters
in the public key information field of a certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fspki_005fset_005frsa_005foaep_005fparams-1"><span>gnutls_x509_spki_set_rsa_oaep_params<a class="copiable-link" href="#gnutls_005fx509_005fspki_005fset_005frsa_005foaep_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fspki_005fset_005frsa_005foaep_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fspki_005fset_005frsa_005foaep_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_spki_set_rsa_oaep_params</strong> <code class="def-code-arguments">(gnutls_x509_spki_t <var class="var">spki</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, const gnutls_datum_t * <var class="var">label</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fspki_005fset_005frsa_005foaep_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">spki</var>: the SubjectPublicKeyInfo structure
</p>
<p><var class="var">dig</var>: a digest algorithm of type <code class="code">gnutls_digest_algorithm_t</code>
</p>
<p><var class="var">label</var>: optional label
</p>
<p>This function will set the public key parameters for
an RSA-OAEP algorithm, in the SubjectPublicKeyInfo structure.
</p>
<p><strong class="strong">Returns:</strong> zero if the parameters are present or a negative
value on error.
</p>
<p><strong class="strong">Since:</strong> 3.8.4
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fspki_005fset_005frsa_005fpss_005fparams-1"><span>gnutls_x509_spki_set_rsa_pss_params<a class="copiable-link" href="#gnutls_005fx509_005fspki_005fset_005frsa_005fpss_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fspki_005fset_005frsa_005fpss_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fspki_005fset_005frsa_005fpss_005fparams"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_spki_set_rsa_pss_params</strong> <code class="def-code-arguments">(gnutls_x509_spki_t <var class="var">spki</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">salt_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fspki_005fset_005frsa_005fpss_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">spki</var>: the SubjectPublicKeyInfo structure
</p>
<p><var class="var">dig</var>: a digest algorithm of type <code class="code">gnutls_digest_algorithm_t</code>
</p>
<p><var class="var">salt_size</var>: the size of salt string
</p>
<p>This function will set the public key parameters for
an RSA-PSS algorithm, in the SubjectPublicKeyInfo structure.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftlsfeatures_005fadd-1"><span>gnutls_x509_tlsfeatures_add<a class="copiable-link" href="#gnutls_005fx509_005ftlsfeatures_005fadd-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftlsfeatures_005fadd"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftlsfeatures_005fadd"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_tlsfeatures_add</strong> <code class="def-code-arguments">(gnutls_x509_tlsfeatures_t <var class="var">f</var>, unsigned int <var class="var">feature</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftlsfeatures_005fadd"> ¶</a></span></dt>
<dd><p><var class="var">f</var>: The TLS features
</p>
<p><var class="var">feature</var>: The feature to add
</p>
<p>This function will append a feature to the X.509 TLS features
extension structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftlsfeatures_005fcheck_005fcrt-1"><span>gnutls_x509_tlsfeatures_check_crt<a class="copiable-link" href="#gnutls_005fx509_005ftlsfeatures_005fcheck_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftlsfeatures_005fcheck_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftlsfeatures_005fcheck_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_x509_tlsfeatures_check_crt</strong> <code class="def-code-arguments">(gnutls_x509_tlsfeatures_t <var class="var">feat</var>, gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftlsfeatures_005fcheck_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">feat</var>: a set of TLSFeatures
</p>
<p><var class="var">cert</var>: the certificate to be checked
</p>
<p>This function will check the provided certificate against the TLSFeatures
set in <code class="code">feat</code> using the RFC7633 p.4.2.2 rules. It will check whether the certificate
contains the features in <code class="code">feat</code> or a superset.
</p>
<p><strong class="strong">Returns:</strong> non-zero if the provided certificate complies, and zero otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftlsfeatures_005fdeinit-1"><span>gnutls_x509_tlsfeatures_deinit<a class="copiable-link" href="#gnutls_005fx509_005ftlsfeatures_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftlsfeatures_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftlsfeatures_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_tlsfeatures_deinit</strong> <code class="def-code-arguments">(gnutls_x509_tlsfeatures_t <var class="var">f</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftlsfeatures_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">f</var>: The TLS features
</p>
<p>This function will deinitialize a X.509 TLS features extension structure
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftlsfeatures_005fget-1"><span>gnutls_x509_tlsfeatures_get<a class="copiable-link" href="#gnutls_005fx509_005ftlsfeatures_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftlsfeatures_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftlsfeatures_005fget"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_tlsfeatures_get</strong> <code class="def-code-arguments">(gnutls_x509_tlsfeatures_t <var class="var">f</var>, unsigned <var class="var">idx</var>, unsigned int * <var class="var">feature</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftlsfeatures_005fget"> ¶</a></span></dt>
<dd><p><var class="var">f</var>: The TLS features
</p>
<p><var class="var">idx</var>: The index of the feature to get
</p>
<p><var class="var">feature</var>: If the function succeeds, the feature will be stored in this variable
</p>
<p>This function will get a feature from the X.509 TLS features
extension structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftlsfeatures_005finit-1"><span>gnutls_x509_tlsfeatures_init<a class="copiable-link" href="#gnutls_005fx509_005ftlsfeatures_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftlsfeatures_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftlsfeatures_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_tlsfeatures_init</strong> <code class="def-code-arguments">(gnutls_x509_tlsfeatures_t * <var class="var">f</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftlsfeatures_005finit"> ¶</a></span></dt>
<dd><p><var class="var">f</var>: The TLS features
</p>
<p>This function will initialize a X.509 TLS features extension structure
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fcas-1"><span>gnutls_x509_trust_list_add_cas<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005fcas-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fcas"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcas-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_cas</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_x509_crt_t * <var class="var">clist</var>, unsigned <var class="var">clist_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcas-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">clist</var>: A list of CAs
</p>
<p><var class="var">clist_size</var>: The length of the CA list
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p>This function will add the given certificate authorities
to the trusted list. The CAs in <code class="code">clist</code> must not be deinitialized
during the lifetime of <code class="code">list</code> .
</p>
<p>If the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code> is specified, then
this function will ensure that no duplicates will be
present in the final trust list.
</p>
<p>If the flag <code class="code">GNUTLS_TL_NO_DUPLICATE_KEY</code> is specified, then
this function will ensure that no certificates with the
same key are present in the final trust list.
</p>
<p>If either <code class="code">GNUTLS_TL_NO_DUPLICATE_KEY</code> or <code class="code">GNUTLS_TL_NO_DUPLICATES</code>
are given, <code class="code">gnutls_x509_trust_list_deinit()</code> must be called with parameter
<code class="code">all</code> being 1.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned; that includes
duplicate entries.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls-1"><span>gnutls_x509_trust_list_add_crls<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_crls</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_x509_crl_t * <var class="var">crl_list</var>, unsigned <var class="var">crl_size</var>, unsigned int <var class="var">flags</var>, unsigned int <var class="var">verification_flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">crl_list</var>: A list of CRLs
</p>
<p><var class="var">crl_size</var>: The length of the CRL list
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p><var class="var">verification_flags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function will add the given certificate revocation lists
to the trusted list. The CRLs in <code class="code">crl_list</code> must not be deinitialized
during the lifetime of <code class="code">list</code> .
</p>
<p>This function must be called after <code class="code">gnutls_x509_trust_list_add_cas()</code>
to allow verifying the CRLs for validity. If the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code>
is given, then the final CRL list will not contain duplicate entries.
</p>
<p>If the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code> is given, <code class="code">gnutls_x509_trust_list_deinit()</code> must be
called with parameter <code class="code">all</code> being 1.
</p>
<p>If flag <code class="code">GNUTLS_TL_VERIFY_CRL</code> is given the CRLs will be verified before being added,
and if verification fails, they will be skipped.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned; that includes
duplicate entries.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt-1"><span>gnutls_x509_trust_list_add_named_crt<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_named_crt</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">name</var>, size_t <var class="var">name_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert</var>: A certificate
</p>
<p><var class="var">name</var>: An identifier for the certificate
</p>
<p><var class="var">name_size</var>: The size of the identifier
</p>
<p><var class="var">flags</var>: should be 0.
</p>
<p>This function will add the given certificate to the trusted
list and associate it with a name. The certificate will not be
be used for verification with <code class="code">gnutls_x509_trust_list_verify_crt()</code>
but with <code class="code">gnutls_x509_trust_list_verify_named_crt()</code> or
<code class="code">gnutls_x509_trust_list_verify_crt2()</code> - the latter only since
GnuTLS 3.4.0 and if a hostname is provided.
</p>
<p>In principle this function can be used to set individual "server"
certificates that are trusted by the user for that specific server
but for no other purposes.
</p>
<p>The certificate <code class="code">cert</code> must not be deinitialized during the lifetime
of the <code class="code">list</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust-1"><span>gnutls_x509_trust_list_add_system_trust<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_system_trust</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, unsigned int <var class="var">tl_flags</var>, unsigned int <var class="var">tl_vflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The structure of the list
</p>
<p><var class="var">tl_flags</var>: GNUTLS_TL_*
</p>
<p><var class="var">tl_vflags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function adds the system’s default trusted certificate
authorities to the trusted list. Note that on unsupported systems
this function returns <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p>This function implies the flag <code class="code">GNUTLS_TL_NO_DUPLICATES</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of added elements or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fdir-1"><span>gnutls_x509_trust_list_add_trust_dir<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fdir-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fdir"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fdir"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_trust_dir</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const char * <var class="var">ca_dir</var>, const char * <var class="var">crl_dir</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, unsigned int <var class="var">tl_flags</var>, unsigned int <var class="var">tl_vflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fdir"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">ca_dir</var>: A directory containing the CAs (optional)
</p>
<p><var class="var">crl_dir</var>: A directory containing a list of CRLs (optional)
</p>
<p><var class="var">type</var>: The format of the certificates
</p>
<p><var class="var">tl_flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p><var class="var">tl_vflags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function will add the given certificate authorities
to the trusted list. Only directories are accepted by
this function.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.3.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile-1"><span>gnutls_x509_trust_list_add_trust_file<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_trust_file</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const char * <var class="var">ca_file</var>, const char * <var class="var">crl_file</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, unsigned int <var class="var">tl_flags</var>, unsigned int <var class="var">tl_vflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">ca_file</var>: A file containing a list of CAs (optional)
</p>
<p><var class="var">crl_file</var>: A file containing a list of CRLs (optional)
</p>
<p><var class="var">type</var>: The format of the certificates
</p>
<p><var class="var">tl_flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p><var class="var">tl_vflags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function will add the given certificate authorities
to the trusted list. PKCS <code class="code">11</code> URLs are also accepted, instead
of files, by this function. A PKCS <code class="code">11</code> URL implies a trust
database (a specially marked module in p11-kit); the URL "pkcs11:"
implies all trust databases in the system. Only a single URL specifying
trust databases can be set; they cannot be stacked with multiple calls.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem-1"><span>gnutls_x509_trust_list_add_trust_mem<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_add_trust_mem</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_datum_t * <var class="var">cas</var>, const gnutls_datum_t * <var class="var">crls</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>, unsigned int <var class="var">tl_flags</var>, unsigned int <var class="var">tl_vflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cas</var>: A buffer containing a list of CAs (optional)
</p>
<p><var class="var">crls</var>: A buffer containing a list of CRLs (optional)
</p>
<p><var class="var">type</var>: The format of the certificates
</p>
<p><var class="var">tl_flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code>
</p>
<p><var class="var">tl_vflags</var>: gnutls_certificate_verify_flags if flags specifies GNUTLS_TL_VERIFY_CRL
</p>
<p>This function will add the given certificate authorities
to the trusted list.
</p>
<p>If this function is used <code class="code">gnutls_x509_trust_list_deinit()</code> must be called
with parameter <code class="code">all</code> being 1.
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fdeinit-1"><span>gnutls_x509_trust_list_deinit<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_trust_list_deinit</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, unsigned int <var class="var">all</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list to be deinitialized
</p>
<p><var class="var">all</var>: if non-zero it will deinitialize all the certificates and CRLs contained in the structure.
</p>
<p>This function will deinitialize a trust list. Note that the
<code class="code">all</code> flag should be typically non-zero unless you have specified
your certificates using <code class="code">gnutls_x509_trust_list_add_cas()</code> and you
want to prevent them from being deinitialized by this function.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fget_005fissuer-1"><span>gnutls_x509_trust_list_get_issuer<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fget_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fget_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_get_issuer</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t <var class="var">cert</var>, gnutls_x509_crt_t * <var class="var">issuer</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert</var>: is the certificate to find issuer for
</p>
<p><var class="var">issuer</var>: Will hold the issuer if any. Should be treated as constant
unless <code class="code">GNUTLS_TL_GET_COPY</code> is set in <code class="code">flags</code> .
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_trust_list_flags_t</code> (<code class="code">GNUTLS_TL_GET_COPY</code> is applicable)
</p>
<p>This function will find the issuer of the given certificate.
If the flag <code class="code">GNUTLS_TL_GET_COPY</code> is specified a copy of the issuer
will be returned which must be freed using <code class="code">gnutls_x509_crt_deinit()</code> .
In that case the provided <code class="code">issuer</code> must not be initialized.
</p>
<p>Note that the flag <code class="code">GNUTLS_TL_GET_COPY</code> is required for this function
to work with PKCS<code class="code">11</code> trust lists in a thread-safe way.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fdn-1"><span>gnutls_x509_trust_list_get_issuer_by_dn<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_get_issuer_by_dn</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_datum_t * <var class="var">dn</var>, gnutls_x509_crt_t * <var class="var">issuer</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">dn</var>: is the issuer’s DN
</p>
<p><var class="var">issuer</var>: Will hold the issuer if any. Should be deallocated after use.
</p>
<p><var class="var">flags</var>: Use zero
</p>
<p>This function will find the issuer with the given name, and
return a copy of the issuer, which must be freed using <code class="code">gnutls_x509_crt_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fsubject_005fkey_005fid-1"><span>gnutls_x509_trust_list_get_issuer_by_subject_key_id<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fsubject_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fsubject_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fsubject_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_get_issuer_by_subject_key_id</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_datum_t * <var class="var">dn</var>, const gnutls_datum_t * <var class="var">spki</var>, gnutls_x509_crt_t * <var class="var">issuer</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fsubject_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">dn</var>: is the issuer’s DN (may be <code class="code">NULL</code> )
</p>
<p><var class="var">spki</var>: is the subject key ID
</p>
<p><var class="var">issuer</var>: Will hold the issuer if any. Should be deallocated after use.
</p>
<p><var class="var">flags</var>: Use zero
</p>
<p>This function will find the issuer with the given name and subject key ID, and
return a copy of the issuer, which must be freed using <code class="code">gnutls_x509_crt_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fget_005fptr-1"><span>gnutls_x509_trust_list_get_ptr<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fget_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fget_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fget_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void *</code> <strong class="def-name">gnutls_x509_trust_list_get_ptr</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">tlist</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">tlist</var>: is a <code class="code">gnutls_x509_trust_list_t</code> type.
</p>
<p>Get user pointer for tlist. Useful in callback function
gnutls_x509_trust_list_set_getissuer_function.
This is the pointer set with <code class="code">gnutls_x509_trust_list_set_ptr()</code> .
</p>
<p><strong class="strong">Returns:</strong> the user given pointer from the tlist structure, or
<code class="code">NULL</code> if it was never set.
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005finit-1"><span>gnutls_x509_trust_list_init<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_init</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t * <var class="var">list</var>, unsigned int <var class="var">size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005finit"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: A pointer to the type to be initialized
</p>
<p><var class="var">size</var>: The size of the internal hash table. Use (0) for default size.
</p>
<p>This function will initialize an X.509 trust list structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fiter_005fdeinit-1"><span>gnutls_x509_trust_list_iter_deinit<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fiter_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fiter_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fiter_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_trust_list_iter_deinit</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_iter_t <var class="var">iter</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fiter_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">iter</var>: The iterator structure to be deinitialized
</p>
<p>This function will deinitialize an iterator structure.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fiter_005fget_005fca-1"><span>gnutls_x509_trust_list_iter_get_ca<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fiter_005fget_005fca-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fiter_005fget_005fca"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fiter_005fget_005fca"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_iter_get_ca</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_trust_list_iter_t * <var class="var">iter</var>, gnutls_x509_crt_t * <var class="var">crt</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fiter_005fget_005fca"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">iter</var>: A pointer to an iterator (initially the iterator should be <code class="code">NULL</code> )
</p>
<p><var class="var">crt</var>: where the certificate will be copied
</p>
<p>This function obtains a certificate in the trust list and advances the
iterator to the next certificate. The certificate returned in <code class="code">crt</code> must be
deallocated with <code class="code">gnutls_x509_crt_deinit()</code> .
</p>
<p>When past the last element is accessed <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
is returned and the iterator is reset.
</p>
<p>The iterator is deinitialized and reset to <code class="code">NULL</code> automatically by this
function after iterating through all elements until
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned. If the iteration is
aborted early, it must be manually deinitialized using
<code class="code">gnutls_x509_trust_list_iter_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fremove_005fcas-1"><span>gnutls_x509_trust_list_remove_cas<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fremove_005fcas-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fremove_005fcas"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fremove_005fcas"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_remove_cas</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_x509_crt_t * <var class="var">clist</var>, unsigned <var class="var">clist_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fremove_005fcas"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">clist</var>: A list of CAs
</p>
<p><var class="var">clist_size</var>: The length of the CA list
</p>
<p>This function will remove the given certificate authorities
from the trusted list.
</p>
<p>Note that this function can accept certificates and authorities
not yet known. In that case they will be kept in a separate
block list that will be used during certificate verification.
Unlike <code class="code">gnutls_x509_trust_list_add_cas()</code> there is no deinitialization
restriction for certificate list provided in this function.
</p>
<p><strong class="strong">Returns:</strong> The number of removed elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005ffile-1"><span>gnutls_x509_trust_list_remove_trust_file<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_remove_trust_file</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const char * <var class="var">ca_file</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">ca_file</var>: A file containing a list of CAs
</p>
<p><var class="var">type</var>: The format of the certificates
</p>
<p>This function will remove the given certificate authorities
from the trusted list, and add them into a block list when needed.
PKCS 11 URLs are also accepted, instead
of files, by this function.
</p>
<p>See also <code class="code">gnutls_x509_trust_list_remove_cas()</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of added elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005fmem-1"><span>gnutls_x509_trust_list_remove_trust_mem<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005fmem-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005fmem"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005fmem"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_remove_trust_mem</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, const gnutls_datum_t * <var class="var">cas</var>, gnutls_x509_crt_fmt_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005fmem"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cas</var>: A buffer containing a list of CAs (optional)
</p>
<p><var class="var">type</var>: The format of the certificates
</p>
<p>This function will remove the provided certificate authorities
from the trusted list, and add them into a block list when needed.
</p>
<p>See also <code class="code">gnutls_x509_trust_list_remove_cas()</code> .
</p>
<p><strong class="strong">Returns:</strong> The number of removed elements is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fset_005fgetissuer_005ffunction-1"><span>gnutls_x509_trust_list_set_getissuer_function<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fset_005fgetissuer_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fset_005fgetissuer_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fset_005fgetissuer_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_trust_list_set_getissuer_function</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">tlist</var>, gnutls_x509_trust_list_getissuer_function * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fset_005fgetissuer_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">tlist</var>: is a <code class="code">gnutls_x509_trust_list_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function sets a callback to be called when the peer’s certificate
chain is incomplete due a missing intermediate certificate. The callback
may provide the missing certificate for use during verification.
</p>
<p>The callback’s function prototype is defined in gnutls/x509.h as:
</p>
<p>int (*callback)(gnutls_x509_trust_list_t list,
const gnutls_x509_crt_t cert,
gnutls_x509_crt_t **issuers,
unsigned int *issuers_size);
</p>
<p>If the callback function is provided then gnutls will call it during the
certificate verification procedure. The callback may wish to use
<code class="code">gnutls_x509_crt_get_authority_info_access()</code> to get a URI from which
to attempt to download the missing issuer certificate, if available.
</p>
<p>On a successful call, the callback shall set ’*issuers’ and ’*issuers_size’
even if the result is empty; in that case ’*issuers’ will point to <code class="code">NULL</code> and
’*issuers_size’ will be 0. Otherwise, the ’*issuers’ array shall be
allocated using <code class="code">gnutls_x509_crt_list_import2()</code> . The ownership of both the
array and the elements is transferred to the caller and thus the application
does not need to maintain the memory after the call.
</p>
<p>The callback function should return 0 if the attempt to retrieve the issuer
certificates for ’crt’ succeeded, or non-zero to indicate any error occurred
during the attempt. In the latter case, ’*issuers’ and ’*issuers_size’ are
not set.
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fset_005fptr-1"><span>gnutls_x509_trust_list_set_ptr<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fset_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fset_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fset_005fptr"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_x509_trust_list_set_ptr</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">tlist</var>, void * <var class="var">ptr</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fset_005fptr"> ¶</a></span></dt>
<dd><p><var class="var">tlist</var>: is a <code class="code">gnutls_x509_trust_list_t</code> type.
</p>
<p><var class="var">ptr</var>: is the user pointer
</p>
<p>This function will set (associate) the user given pointer <code class="code">ptr</code> to
the tlist structure. This pointer can be accessed with
<code class="code">gnutls_x509_trust_list_get_ptr()</code> . Useful in the callback function
gnutls_x509_trust_list_set_getissuer_function.
</p>
<p><strong class="strong">Since:</strong> 3.7.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt-1"><span>gnutls_x509_trust_list_verify_crt<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_verify_crt</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t * <var class="var">cert_list</var>, unsigned int <var class="var">cert_list_size</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">voutput</var>, gnutls_verify_output_function <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert_list</var>: is the certificate list to be verified
</p>
<p><var class="var">cert_list_size</var>: is the certificate list size
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">voutput</var>: will hold the certificate verification output.
</p>
<p><var class="var">func</var>: If non-null will be called on each chain element verification with the output.
</p>
<p>This function will try to verify the given certificate and return
its status. The <code class="code">voutput</code> parameter will hold an OR’ed sequence of
<code class="code">gnutls_certificate_status_t</code> flags.
</p>
<p>The details of the verification are the same as in <code class="code">gnutls_x509_trust_list_verify_crt2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2-1"><span>gnutls_x509_trust_list_verify_crt2<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_verify_crt2</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t * <var class="var">cert_list</var>, unsigned int <var class="var">cert_list_size</var>, gnutls_typed_vdata_st * <var class="var">data</var>, unsigned int <var class="var">elements</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">voutput</var>, gnutls_verify_output_function <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert_list</var>: is the certificate list to be verified
</p>
<p><var class="var">cert_list_size</var>: is the certificate list size
</p>
<p><var class="var">data</var>: an array of typed data
</p>
<p><var class="var">elements</var>: the number of data elements
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">voutput</var>: will hold the certificate verification output.
</p>
<p><var class="var">func</var>: If non-null will be called on each chain element verification with the output.
</p>
<p>This function will attempt to verify the given certificate chain and return
its status. The <code class="code">voutput</code> parameter will hold an OR’ed sequence of
<code class="code">gnutls_certificate_status_t</code> flags.
</p>
<p>When a certificate chain of <code class="code">cert_list_size</code> with more than one certificates is
provided, the verification status will apply to the first certificate in the chain
that failed verification. The verification process starts from the end of the chain
(from CA to end certificate). The first certificate in the chain must be the end-certificate
while the rest of the members may be sorted or not.
</p>
<p>Additionally a certificate verification profile can be specified
from the ones in <code class="code">gnutls_certificate_verification_profiles_t</code> by
ORing the result of <code class="code">GNUTLS_PROFILE_TO_VFLAGS()</code> to the verification
flags.
</p>
<p>Additional verification parameters are possible via the <code class="code">data</code> types; the
acceptable types are <code class="code">GNUTLS_DT_DNS_HOSTNAME</code> , <code class="code">GNUTLS_DT_IP_ADDRESS</code> and <code class="code">GNUTLS_DT_KEY_PURPOSE_OID</code> .
The former accepts as data a null-terminated hostname, and the latter a null-terminated
object identifier (e.g., <code class="code">GNUTLS_KP_TLS_WWW_SERVER</code> ).
If a DNS hostname is provided then this function will compare
the hostname in the end certificate against the given. If names do not match the
<code class="code">GNUTLS_CERT_UNEXPECTED_OWNER</code> status flag will be set. In addition it
will consider certificates provided with <code class="code">gnutls_x509_trust_list_add_named_crt()</code> .
</p>
<p>If a key purpose OID is provided and the end-certificate contains the extended key
usage PKIX extension, it will be required to match the provided OID
or be marked for any purpose, otherwise verification will fail with
<code class="code">GNUTLS_CERT_PURPOSE_MISMATCH</code> status.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. Note that verification failure will not result to an
error code, only <code class="code">voutput</code> will be updated.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt-1"><span>gnutls_x509_trust_list_verify_named_crt<a class="copiable-link" href="#gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_trust_list_verify_named_crt</strong> <code class="def-code-arguments">(gnutls_x509_trust_list_t <var class="var">list</var>, gnutls_x509_crt_t <var class="var">cert</var>, const void * <var class="var">name</var>, size_t <var class="var">name_size</var>, unsigned int <var class="var">flags</var>, unsigned int * <var class="var">voutput</var>, gnutls_verify_output_function <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt-1"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: The list
</p>
<p><var class="var">cert</var>: is the certificate to be verified
</p>
<p><var class="var">name</var>: is the certificate’s name
</p>
<p><var class="var">name_size</var>: is the certificate’s name size
</p>
<p><var class="var">flags</var>: Flags that may be used to change the verification algorithm. Use OR of the gnutls_certificate_verify_flags enumerations.
</p>
<p><var class="var">voutput</var>: will hold the certificate verification output.
</p>
<p><var class="var">func</var>: If non-null will be called on each chain element verification with the output.
</p>
<p>This function will try to find a certificate that is associated with the provided
name –see <code class="code">gnutls_x509_trust_list_add_named_crt()</code> . If a match is found the
certificate is considered valid. In addition to that this function will also
check CRLs. The <code class="code">voutput</code> parameter will hold an OR’ed sequence of
<code class="code">gnutls_certificate_status_t</code> flags.
</p>
<p>Additionally a certificate verification profile can be specified
from the ones in <code class="code">gnutls_certificate_verification_profiles_t</code> by
ORing the result of <code class="code">GNUTLS_PROFILE_TO_VFLAGS()</code> to the verification
flags.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0.0
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="PKCS-7-API">
<div class="nav-panel">
<p>
Next: <a href="#OCSP-API" accesskey="n" rel="next"><abbr class="acronym">OCSP</abbr> API</a>, Previous: <a href="#X509-certificate-API" accesskey="p" rel="prev"><abbr class="acronym">X.509</abbr> certificate API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="PKCS-7-API-1"><span>E.4 <abbr class="acronym">PKCS</abbr> 7 API<a class="copiable-link" href="#PKCS-7-API-1"> ¶</a></span></h3>
<p>The following functions are to be used for PKCS 7 structures handling.
Their prototypes lie in <samp class="file">gnutls/pkcs7.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005fpkcs7_005fadd_005fattr-1"><span>gnutls_pkcs7_add_attr<a class="copiable-link" href="#gnutls_005fpkcs7_005fadd_005fattr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fadd_005fattr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fadd_005fattr"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_add_attr</strong> <code class="def-code-arguments">(gnutls_pkcs7_attrs_t * <var class="var">list</var>, const char * <var class="var">oid</var>, gnutls_datum_t * <var class="var">data</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fadd_005fattr"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: A list of existing attributes or pointer to <code class="code">NULL</code> for the first one
</p>
<p><var class="var">oid</var>: the OID of the attribute to be set
</p>
<p><var class="var">data</var>: the raw (DER-encoded) data of the attribute to be set
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_PKCS7_ATTR_ENCODE_OCTET_STRING</code>
</p>
<p>This function will set a PKCS <code class="code">7</code> attribute in the provided list.
If this function fails, the previous list would be deallocated.
</p>
<p>Note that any attributes set with this function must either be
DER or BER encoded, unless a special flag is present.
</p>
<p><strong class="strong">Returns:</strong> On success, the new list head, otherwise <code class="code">NULL</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fattrs_005fdeinit-1"><span>gnutls_pkcs7_attrs_deinit<a class="copiable-link" href="#gnutls_005fpkcs7_005fattrs_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fattrs_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fattrs_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs7_attrs_deinit</strong> <code class="def-code-arguments">(gnutls_pkcs7_attrs_t <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fattrs_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: A list of existing attributes
</p>
<p>This function will clear a PKCS <code class="code">7</code> attribute list.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fdeinit-1"><span>gnutls_pkcs7_deinit<a class="copiable-link" href="#gnutls_005fpkcs7_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs7_deinit</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: the type to be deinitialized
</p>
<p>This function will deinitialize a PKCS7 type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fdelete_005fcrl-1"><span>gnutls_pkcs7_delete_crl<a class="copiable-link" href="#gnutls_005fpkcs7_005fdelete_005fcrl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fdelete_005fcrl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fdelete_005fcrl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_delete_crl</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, int <var class="var">indx</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fdelete_005fcrl"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">indx</var>: the index of the crl to delete
</p>
<p>This function will delete a crl from a PKCS7 or RFC2630 crl set.
Index starts from 0. Returns 0 on success.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fdelete_005fcrt-1"><span>gnutls_pkcs7_delete_crt<a class="copiable-link" href="#gnutls_005fpkcs7_005fdelete_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fdelete_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fdelete_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_delete_crt</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, int <var class="var">indx</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fdelete_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">indx</var>: the index of the certificate to delete
</p>
<p>This function will delete a certificate from a PKCS7 or RFC2630
certificate set. Index starts from 0. Returns 0 on success.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fexport-1"><span>gnutls_pkcs7_export<a class="copiable-link" href="#gnutls_005fpkcs7_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_export</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a structure PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the pkcs7 structure to DER or PEM format.
</p>
<p>If the buffer provided is not long enough to hold the output, then
* <code class="code">output_data_size</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code>
will be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN PKCS7".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fexport2-1"><span>gnutls_pkcs7_export2<a class="copiable-link" href="#gnutls_005fpkcs7_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_export2</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a structure PEM or DER encoded
</p>
<p>This function will export the pkcs7 structure to DER or PEM format.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN PKCS7".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fattr-1"><span>gnutls_pkcs7_get_attr<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fattr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fattr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fattr"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_attr</strong> <code class="def-code-arguments">(gnutls_pkcs7_attrs_t <var class="var">list</var>, unsigned <var class="var">idx</var>, char ** <var class="var">oid</var>, gnutls_datum_t * <var class="var">data</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fattr"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: A list of existing attributes or <code class="code">NULL</code> for the first one
</p>
<p><var class="var">idx</var>: the index of the attribute to get
</p>
<p><var class="var">oid</var>: the OID of the attribute (read-only)
</p>
<p><var class="var">data</var>: the raw data of the attribute
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_PKCS7_ATTR_ENCODE_OCTET_STRING</code>
</p>
<p>This function will get a PKCS <code class="code">7</code> attribute from the provided list.
The OID is a constant string, but data will be allocated and must be
deinitialized by the caller.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> is returned
if there are no data in the current index.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fcrl_005fcount-1"><span>gnutls_pkcs7_get_crl_count<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fcrl_005fcount-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fcrl_005fcount"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fcrl_005fcount"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_crl_count</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fcrl_005fcount"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p>This function will return the number of certificates in the PKCS7
or RFC2630 crl set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fcrl_005fraw-1"><span>gnutls_pkcs7_get_crl_raw<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fcrl_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fcrl_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fcrl_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_crl_raw</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">indx</var>, void * <var class="var">crl</var>, size_t * <var class="var">crl_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fcrl_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">indx</var>: contains the index of the crl to extract
</p>
<p><var class="var">crl</var>: the contents of the crl will be copied there (may be null)
</p>
<p><var class="var">crl_size</var>: should hold the size of the crl
</p>
<p>This function will return a crl of the PKCS7 or RFC2630 crl set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. If the provided buffer is not long enough,
then <code class="code">crl_size</code> is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is
returned. After the last crl has been read
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fcrl_005fraw2-1"><span>gnutls_pkcs7_get_crl_raw2<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fcrl_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fcrl_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fcrl_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_crl_raw2</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fcrl_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">indx</var>: contains the index of the crl to extract
</p>
<p><var class="var">crl</var>: will contain the contents of the CRL in an allocated buffer
</p>
<p>This function will return a DER encoded CRL of the PKCS7 or RFC2630 crl set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. After the last crl has been read
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fcrt_005fcount-1"><span>gnutls_pkcs7_get_crt_count<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fcrt_005fcount-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fcrt_005fcount"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fcrt_005fcount"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_crt_count</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fcrt_005fcount"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a <code class="code">gnutls_pkcs7_t</code> type
</p>
<p>This function will return the number of certificates in the PKCS7
or RFC2630 certificate set.
</p>
<p><strong class="strong">Returns:</strong> On success, a positive number is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fcrt_005fraw-1"><span>gnutls_pkcs7_get_crt_raw<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fcrt_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fcrt_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fcrt_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_crt_raw</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">indx</var>, void * <var class="var">certificate</var>, size_t * <var class="var">certificate_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fcrt_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a gnutls_pkcs7_t type
</p>
<p><var class="var">indx</var>: contains the index of the certificate to extract
</p>
<p><var class="var">certificate</var>: the contents of the certificate will be copied
there (may be null)
</p>
<p><var class="var">certificate_size</var>: should hold the size of the certificate
</p>
<p>This function will return a certificate of the PKCS7 or RFC2630
certificate set.
</p>
<p>After the last certificate has been read
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. If the provided buffer is not long enough,
then <code class="code">certificate_size</code> is updated and
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fcrt_005fraw2-1"><span>gnutls_pkcs7_get_crt_raw2<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fcrt_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fcrt_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fcrt_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_crt_raw2</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fcrt_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a gnutls_pkcs7_t type
</p>
<p><var class="var">indx</var>: contains the index of the certificate to extract
</p>
<p><var class="var">cert</var>: will hold the contents of the certificate; must be deallocated with <code class="code">gnutls_free()</code>
</p>
<p>This function will return a certificate of the PKCS7 or RFC2630
certificate set.
</p>
<p>After the last certificate has been read
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. If the provided buffer is not long enough,
then <code class="code">certificate_size</code> is updated and
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> is returned.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fembedded_005fdata-1"><span>gnutls_pkcs7_get_embedded_data<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fembedded_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fembedded_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fembedded_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_embedded_data</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">flags</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fembedded_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a gnutls_pkcs7_t type
</p>
<p><var class="var">flags</var>: must be zero or <code class="code">GNUTLS_PKCS7_EDATA_GET_RAW</code>
</p>
<p><var class="var">data</var>: will hold the embedded data in the provided structure
</p>
<p>This function will return the data embedded in the signature of
the PKCS7 structure. If no data are available then
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p>The returned data must be de-allocated using <code class="code">gnutls_free()</code> .
</p>
<p>Note, that this function returns the exact same data that are
authenticated. If the <code class="code">GNUTLS_PKCS7_EDATA_GET_RAW</code> flag is provided,
the returned data will be including the wrapping tag/value as
they are encoded in the structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fembedded_005fdata_005foid-1"><span>gnutls_pkcs7_get_embedded_data_oid<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fembedded_005fdata_005foid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fembedded_005fdata_005foid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fembedded_005fdata_005foid"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_pkcs7_get_embedded_data_oid</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fembedded_005fdata_005foid"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a gnutls_pkcs7_t type
</p>
<p>This function will return the OID of the data embedded in the signature of
the PKCS7 structure. If no data are available then <code class="code">NULL</code> will be
returned. The returned value will be valid during the lifetime
of the <code class="code">pkcs7</code> structure.
</p>
<p><strong class="strong">Returns:</strong> On success, a pointer to an OID string, <code class="code">NULL</code> on error.
</p>
<p><strong class="strong">Since:</strong> 3.5.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fsignature_005fcount-1"><span>gnutls_pkcs7_get_signature_count<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fsignature_005fcount-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fsignature_005fcount"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fsignature_005fcount"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_signature_count</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fsignature_005fcount"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a <code class="code">gnutls_pkcs7_t</code> type
</p>
<p>This function will return the number of signatures in the PKCS7
structure.
</p>
<p><strong class="strong">Returns:</strong> On success, a positive number is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fget_005fsignature_005finfo-1"><span>gnutls_pkcs7_get_signature_info<a class="copiable-link" href="#gnutls_005fpkcs7_005fget_005fsignature_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fget_005fsignature_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fget_005fsignature_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_get_signature_info</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, unsigned <var class="var">idx</var>, gnutls_pkcs7_signature_info_st * <var class="var">info</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fget_005fsignature_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a <code class="code">gnutls_pkcs7_t</code> type
</p>
<p><var class="var">idx</var>: the index of the signature info to check
</p>
<p><var class="var">info</var>: will contain the output signature
</p>
<p>This function will return information about the signature identified
by idx in the provided PKCS <code class="code">7</code> structure. The information should be
deinitialized using <code class="code">gnutls_pkcs7_signature_info_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fimport-1"><span>gnutls_pkcs7_import<a class="copiable-link" href="#gnutls_005fpkcs7_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_import</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The data to store the parsed PKCS7.
</p>
<p><var class="var">data</var>: The DER or PEM encoded PKCS7.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p>This function will convert the given DER or PEM encoded PKCS7 to
the native <code class="code">gnutls_pkcs7_t</code> format. The output will be stored in
<code class="code">pkcs7</code> . Any signed data that may be present inside the <code class="code">pkcs7</code> structure, like certificates set by <code class="code">gnutls_pkcs7_set_crt()</code> , will
be freed and overwritten by this function.
</p>
<p>If the PKCS7 is PEM encoded it should have a header of "PKCS7".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005finit-1"><span>gnutls_pkcs7_init<a class="copiable-link" href="#gnutls_005fpkcs7_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_init</strong> <code class="def-code-arguments">(gnutls_pkcs7_t * <var class="var">pkcs7</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005finit"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a PKCS7 structure. PKCS7 structures
usually contain lists of X.509 Certificates and X.509 Certificate
revocation lists.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fprint-1"><span>gnutls_pkcs7_print<a class="copiable-link" href="#gnutls_005fpkcs7_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_print</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The PKCS7 struct to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with null terminated string.
</p>
<p>This function will pretty print a signed PKCS <code class="code">7</code> structure, suitable for
display to a human.
</p>
<p>Currently the supported formats are <code class="code">GNUTLS_CRT_PRINT_FULL</code> and
<code class="code">GNUTLS_CRT_PRINT_COMPACT</code> .
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fprint_005fsignature_005finfo-1"><span>gnutls_pkcs7_print_signature_info<a class="copiable-link" href="#gnutls_005fpkcs7_005fprint_005fsignature_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fprint_005fsignature_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fprint_005fsignature_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_print_signature_info</strong> <code class="def-code-arguments">(gnutls_pkcs7_signature_info_st * <var class="var">info</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fprint_005fsignature_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">info</var>: The PKCS7 signature info struct to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with null terminated string.
</p>
<p>This function will pretty print a PKCS <code class="code">7</code> signature info structure, suitable
for display to a human.
</p>
<p>Currently the supported formats are <code class="code">GNUTLS_CRT_PRINT_FULL</code> and
<code class="code">GNUTLS_CRT_PRINT_COMPACT</code> .
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.14
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fset_005fcrl-1"><span>gnutls_pkcs7_set_crl<a class="copiable-link" href="#gnutls_005fpkcs7_005fset_005fcrl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fset_005fcrl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fset_005fcrl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_set_crl</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fset_005fcrl"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">crl</var>: the DER encoded crl to be added
</p>
<p>This function will add a parsed CRL to the PKCS7 or RFC2630 crl
set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fset_005fcrl_005fraw-1"><span>gnutls_pkcs7_set_crl_raw<a class="copiable-link" href="#gnutls_005fpkcs7_005fset_005fcrl_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fset_005fcrl_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fset_005fcrl_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_set_crl_raw</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, const gnutls_datum_t * <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fset_005fcrl_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">crl</var>: the DER encoded crl to be added
</p>
<p>This function will add a crl to the PKCS7 or RFC2630 crl set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fset_005fcrt-1"><span>gnutls_pkcs7_set_crt<a class="copiable-link" href="#gnutls_005fpkcs7_005fset_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fset_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fset_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_set_crt</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_t <var class="var">crt</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fset_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">crt</var>: the certificate to be copied.
</p>
<p>This function will add a parsed certificate to the PKCS7 or
RFC2630 certificate set. This is a wrapper function over
<code class="code">gnutls_pkcs7_set_crt_raw()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fset_005fcrt_005fraw-1"><span>gnutls_pkcs7_set_crt_raw<a class="copiable-link" href="#gnutls_005fpkcs7_005fset_005fcrt_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fset_005fcrt_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fset_005fcrt_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_set_crt_raw</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, const gnutls_datum_t * <var class="var">crt</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fset_005fcrt_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: The pkcs7 type
</p>
<p><var class="var">crt</var>: the DER encoded certificate to be added
</p>
<p>This function will add a certificate to the PKCS7 or RFC2630
certificate set.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fsign-1"><span>gnutls_pkcs7_sign<a class="copiable-link" href="#gnutls_005fpkcs7_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fsign-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_sign</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_t <var class="var">signer</var>, gnutls_privkey_t <var class="var">signer_key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_pkcs7_attrs_t <var class="var">signed_attrs</var>, gnutls_pkcs7_attrs_t <var class="var">unsigned_attrs</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fsign-1"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a <code class="code">gnutls_pkcs7_t</code> type
</p>
<p><var class="var">signer</var>: the certificate to sign the structure
</p>
<p><var class="var">signer_key</var>: the key to sign the structure
</p>
<p><var class="var">data</var>: The data to be signed or <code class="code">NULL</code> if the data are already embedded
</p>
<p><var class="var">signed_attrs</var>: Any additional attributes to be included in the signed ones (or <code class="code">NULL</code> )
</p>
<p><var class="var">unsigned_attrs</var>: Any additional attributes to be included in the unsigned ones (or <code class="code">NULL</code> )
</p>
<p><var class="var">dig</var>: The digest algorithm to use for signing
</p>
<p><var class="var">flags</var>: Should be zero or one of <code class="code">GNUTLS_PKCS7</code> flags
</p>
<p>This function will add a signature in the provided PKCS <code class="code">7</code> structure
for the provided data. Multiple signatures can be made with different
signers.
</p>
<p>The available flags are:
<code class="code">GNUTLS_PKCS7_EMBED_DATA</code> , <code class="code">GNUTLS_PKCS7_INCLUDE_TIME</code> , <code class="code">GNUTLS_PKCS7_INCLUDE_CERT</code> ,
and <code class="code">GNUTLS_PKCS7_WRITE_SPKI</code> . They are explained in the <code class="code">gnutls_pkcs7_sign_flags</code>
definition.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fsignature_005finfo_005fdeinit-1"><span>gnutls_pkcs7_signature_info_deinit<a class="copiable-link" href="#gnutls_005fpkcs7_005fsignature_005finfo_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fsignature_005finfo_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fsignature_005finfo_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs7_signature_info_deinit</strong> <code class="def-code-arguments">(gnutls_pkcs7_signature_info_st * <var class="var">info</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fsignature_005finfo_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">info</var>: should point to a <code class="code">gnutls_pkcs7_signature_info_st</code> structure
</p>
<p>This function will deinitialize any allocated value in the
provided <code class="code">gnutls_pkcs7_signature_info_st</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fverify-1"><span>gnutls_pkcs7_verify<a class="copiable-link" href="#gnutls_005fpkcs7_005fverify-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fverify"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fverify"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_verify</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_trust_list_t <var class="var">tl</var>, gnutls_typed_vdata_st * <var class="var">vdata</var>, unsigned int <var class="var">vdata_size</var>, unsigned <var class="var">idx</var>, const gnutls_datum_t * <var class="var">data</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fverify"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a <code class="code">gnutls_pkcs7_t</code> type
</p>
<p><var class="var">tl</var>: A list of trusted certificates
</p>
<p><var class="var">vdata</var>: an array of typed data
</p>
<p><var class="var">vdata_size</var>: the number of data elements
</p>
<p><var class="var">idx</var>: the index of the signature info to check
</p>
<p><var class="var">data</var>: The data to be verified or <code class="code">NULL</code>
</p>
<p><var class="var">flags</var>: Zero or an OR list of <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p>This function will verify the provided data against the signature
present in the SignedData of the PKCS <code class="code">7</code> structure. If the data
provided are NULL then the data in the encapsulatedContent field
will be used instead.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. A verification error results to a
<code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code> and the lack of encapsulated data
to verify to a <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs7_005fverify_005fdirect-1"><span>gnutls_pkcs7_verify_direct<a class="copiable-link" href="#gnutls_005fpkcs7_005fverify_005fdirect-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs7_005fverify_005fdirect"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs7_005fverify_005fdirect"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs7_verify_direct</strong> <code class="def-code-arguments">(gnutls_pkcs7_t <var class="var">pkcs7</var>, gnutls_x509_crt_t <var class="var">signer</var>, unsigned <var class="var">idx</var>, const gnutls_datum_t * <var class="var">data</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs7_005fverify_005fdirect"> ¶</a></span></dt>
<dd><p><var class="var">pkcs7</var>: should contain a <code class="code">gnutls_pkcs7_t</code> type
</p>
<p><var class="var">signer</var>: the certificate believed to have signed the structure
</p>
<p><var class="var">idx</var>: the index of the signature info to check
</p>
<p><var class="var">data</var>: The data to be verified or <code class="code">NULL</code>
</p>
<p><var class="var">flags</var>: Zero or an OR list of <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p>This function will verify the provided data against the signature
present in the SignedData of the PKCS <code class="code">7</code> structure. If the data
provided are NULL then the data in the encapsulatedContent field
will be used instead.
</p>
<p>Note that, unlike <code class="code">gnutls_pkcs7_verify()</code> this function does not
verify the key purpose of the signer. It is expected for the caller
to verify the intended purpose of the <code class="code">signer</code> -e.g., via <code class="code">gnutls_x509_crt_get_key_purpose_oid()</code> ,
or <code class="code">gnutls_x509_crt_check_key_purpose()</code> .
</p>
<p>Note also, that since GnuTLS 3.5.6 this function introduces checks in the
end certificate ( <code class="code">signer</code> ), including time checks and key usage checks.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. A verification error results to a
<code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code> and the lack of encapsulated data
to verify to a <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="OCSP-API">
<div class="nav-panel">
<p>
Next: <a href="#PKCS-12-API" accesskey="n" rel="next">PKCS 12 API</a>, Previous: <a href="#PKCS-7-API" accesskey="p" rel="prev"><abbr class="acronym">PKCS</abbr> 7 API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="OCSP-API-1"><span>E.5 <abbr class="acronym">OCSP</abbr> API<a class="copiable-link" href="#OCSP-API-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-OCSP-Functions"></a>
<p>The following functions are for <abbr class="acronym">OCSP</abbr> certificate status
checking. Their prototypes lie in <samp class="file">gnutls/ocsp.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fadd_005fcert-1"><span>gnutls_ocsp_req_add_cert<a class="copiable-link" href="#gnutls_005focsp_005freq_005fadd_005fcert-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fadd_005fcert"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fadd_005fcert"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_add_cert</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t <var class="var">req</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_x509_crt_t <var class="var">cert</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fadd_005fcert"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p><var class="var">digest</var>: hash algorithm, a <code class="code">gnutls_digest_algorithm_t</code> value
</p>
<p><var class="var">issuer</var>: issuer of <code class="code">subject</code> certificate
</p>
<p><var class="var">cert</var>: certificate to request status for
</p>
<p>This function will add another request to the OCSP request for a
particular certificate. The issuer name hash, issuer key hash, and
serial number fields is populated as follows. The issuer name and
the serial number is taken from <code class="code">cert</code> . The issuer key is taken
from <code class="code">issuer</code> . The hashed values will be hashed using the <code class="code">digest</code> algorithm, normally <code class="code">GNUTLS_DIG_SHA1</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fadd_005fcert_005fid-1"><span>gnutls_ocsp_req_add_cert_id<a class="copiable-link" href="#gnutls_005focsp_005freq_005fadd_005fcert_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fadd_005fcert_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fadd_005fcert_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_add_cert_id</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t <var class="var">req</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, const gnutls_datum_t * <var class="var">issuer_name_hash</var>, const gnutls_datum_t * <var class="var">issuer_key_hash</var>, const gnutls_datum_t * <var class="var">serial_number</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fadd_005fcert_005fid"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p><var class="var">digest</var>: hash algorithm, a <code class="code">gnutls_digest_algorithm_t</code> value
</p>
<p><var class="var">issuer_name_hash</var>: hash of issuer’s DN
</p>
<p><var class="var">issuer_key_hash</var>: hash of issuer’s public key
</p>
<p><var class="var">serial_number</var>: serial number of certificate to check
</p>
<p>This function will add another request to the OCSP request for a
particular certificate having the issuer name hash of
<code class="code">issuer_name_hash</code> and issuer key hash of <code class="code">issuer_key_hash</code> (both
hashed using <code class="code">digest</code> ) and serial number <code class="code">serial_number</code> .
</p>
<p>The information needed corresponds to the CertID structure:
</p>
<p><informalexample><programlisting>
CertID ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
issuerNameHash OCTET STRING, – Hash of Issuer’s DN
issuerKeyHash OCTET STRING, – Hash of Issuers public key
serialNumber CertificateSerialNumber }
</programlisting></informalexample>
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fdeinit-1"><span>gnutls_ocsp_req_deinit<a class="copiable-link" href="#gnutls_005focsp_005freq_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_ocsp_req_deinit</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t <var class="var">req</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: The data to be deinitialized
</p>
<p>This function will deinitialize a OCSP request structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fexport-1"><span>gnutls_ocsp_req_export<a class="copiable-link" href="#gnutls_005focsp_005freq_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_export</strong> <code class="def-code-arguments">(gnutls_ocsp_req_const_t <var class="var">req</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: Holds the OCSP request
</p>
<p><var class="var">data</var>: newly allocate buffer holding DER encoded OCSP request
</p>
<p>This function will export the OCSP request to DER format.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fget_005fcert_005fid-1"><span>gnutls_ocsp_req_get_cert_id<a class="copiable-link" href="#gnutls_005focsp_005freq_005fget_005fcert_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fget_005fcert_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fget_005fcert_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_get_cert_id</strong> <code class="def-code-arguments">(gnutls_ocsp_req_const_t <var class="var">req</var>, unsigned <var class="var">indx</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_datum_t * <var class="var">issuer_name_hash</var>, gnutls_datum_t * <var class="var">issuer_key_hash</var>, gnutls_datum_t * <var class="var">serial_number</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fget_005fcert_005fid"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to get. Use (0) to get the first one.
</p>
<p><var class="var">digest</var>: output variable with <code class="code">gnutls_digest_algorithm_t</code> hash algorithm
</p>
<p><var class="var">issuer_name_hash</var>: output buffer with hash of issuer’s DN
</p>
<p><var class="var">issuer_key_hash</var>: output buffer with hash of issuer’s public key
</p>
<p><var class="var">serial_number</var>: output buffer with serial number of certificate to check
</p>
<p>This function will return the certificate information of the
<code class="code">indx</code> ’ed request in the OCSP request. The information returned
corresponds to the CertID structure:
</p>
<p><informalexample><programlisting>
CertID ::= SEQUENCE {
hashAlgorithm AlgorithmIdentifier,
issuerNameHash OCTET STRING, – Hash of Issuer’s DN
issuerKeyHash OCTET STRING, – Hash of Issuers public key
serialNumber CertificateSerialNumber }
</programlisting></informalexample>
</p>
<p>Each of the pointers to output variables may be NULL to indicate
that the caller is not interested in that value.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned. If you have reached the last
CertID available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fget_005fextension-1"><span>gnutls_ocsp_req_get_extension<a class="copiable-link" href="#gnutls_005focsp_005freq_005fget_005fextension-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fget_005fextension"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fget_005fextension"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_get_extension</strong> <code class="def-code-arguments">(gnutls_ocsp_req_const_t <var class="var">req</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">oid</var>, unsigned int * <var class="var">critical</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fget_005fextension"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to get. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: will hold newly allocated buffer with OID of extension, may be NULL
</p>
<p><var class="var">critical</var>: output variable with critical flag, may be NULL.
</p>
<p><var class="var">data</var>: will hold newly allocated buffer with extension data, may be NULL
</p>
<p>This function will return all information about the requested
extension in the OCSP request. The information returned is the
OID, the critical flag, and the data itself. The extension OID
will be stored as a string. Any of <code class="code">oid</code> , <code class="code">critical</code> , and <code class="code">data</code> may
be NULL which means that the caller is not interested in getting
that information back.
</p>
<p>The caller needs to deallocate memory by calling <code class="code">gnutls_free()</code> on
<code class="code">oid</code> ->data and <code class="code">data</code> ->data.
</p>
<p>Since 3.7.0 <code class="code">oid</code> ->size does not account for the terminating null byte.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned. If you have reached the last
extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will
be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fget_005fnonce-1"><span>gnutls_ocsp_req_get_nonce<a class="copiable-link" href="#gnutls_005focsp_005freq_005fget_005fnonce-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fget_005fnonce"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fget_005fnonce"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_get_nonce</strong> <code class="def-code-arguments">(gnutls_ocsp_req_const_t <var class="var">req</var>, unsigned int * <var class="var">critical</var>, gnutls_datum_t * <var class="var">nonce</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fget_005fnonce"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p><var class="var">critical</var>: whether nonce extension is marked critical, or NULL
</p>
<p><var class="var">nonce</var>: will hold newly allocated buffer with nonce data
</p>
<p>This function will return the OCSP request nonce extension data.
</p>
<p>The caller needs to deallocate memory by calling <code class="code">gnutls_free()</code> on
<code class="code">nonce</code> ->data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fget_005fversion-1"><span>gnutls_ocsp_req_get_version<a class="copiable-link" href="#gnutls_005focsp_005freq_005fget_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fget_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fget_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_get_version</strong> <code class="def-code-arguments">(gnutls_ocsp_req_const_t <var class="var">req</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fget_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p>This function will return the version of the OCSP request.
Typically this is always 1 indicating version 1.
</p>
<p><strong class="strong">Returns:</strong> version of OCSP request, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fimport-1"><span>gnutls_ocsp_req_import<a class="copiable-link" href="#gnutls_005focsp_005freq_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_import</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t <var class="var">req</var>, const gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: The data to store the parsed request.
</p>
<p><var class="var">data</var>: DER encoded OCSP request.
</p>
<p>This function will convert the given DER encoded OCSP request to
the native <code class="code">gnutls_ocsp_req_t</code> format. The output will be stored in
<code class="code">req</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005finit-1"><span>gnutls_ocsp_req_init<a class="copiable-link" href="#gnutls_005focsp_005freq_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_init</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t * <var class="var">req</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005finit"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize an OCSP request structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fprint-1"><span>gnutls_ocsp_req_print<a class="copiable-link" href="#gnutls_005focsp_005freq_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_print</strong> <code class="def-code-arguments">(gnutls_ocsp_req_const_t <var class="var">req</var>, gnutls_ocsp_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: The data to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with (0) terminated string.
</p>
<p>This function will pretty print a OCSP request, suitable for
display to a human.
</p>
<p>If the format is <code class="code">GNUTLS_OCSP_PRINT_FULL</code> then all fields of the
request will be output, on multiple lines.
</p>
<p>The output <code class="code">out</code> ->data needs to be deallocate using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005frandomize_005fnonce-1"><span>gnutls_ocsp_req_randomize_nonce<a class="copiable-link" href="#gnutls_005focsp_005freq_005frandomize_005fnonce-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005frandomize_005fnonce"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005frandomize_005fnonce"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_randomize_nonce</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t <var class="var">req</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005frandomize_005fnonce"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p>This function will add or update an nonce extension to the OCSP
request with a newly generated random value.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fset_005fextension-1"><span>gnutls_ocsp_req_set_extension<a class="copiable-link" href="#gnutls_005focsp_005freq_005fset_005fextension-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fset_005fextension"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fset_005fextension"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_set_extension</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t <var class="var">req</var>, const char * <var class="var">oid</var>, unsigned int <var class="var">critical</var>, const gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fset_005fextension"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p><var class="var">oid</var>: buffer with OID of extension as a string.
</p>
<p><var class="var">critical</var>: critical flag, normally false.
</p>
<p><var class="var">data</var>: the extension data
</p>
<p>This function will add an extension to the OCSP request. Calling
this function multiple times for the same OID will overwrite values
from earlier calls.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005freq_005fset_005fnonce-1"><span>gnutls_ocsp_req_set_nonce<a class="copiable-link" href="#gnutls_005focsp_005freq_005fset_005fnonce-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005freq_005fset_005fnonce"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005freq_005fset_005fnonce"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_req_set_nonce</strong> <code class="def-code-arguments">(gnutls_ocsp_req_t <var class="var">req</var>, unsigned int <var class="var">critical</var>, const gnutls_datum_t * <var class="var">nonce</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005freq_005fset_005fnonce"> ¶</a></span></dt>
<dd><p><var class="var">req</var>: should contain a <code class="code">gnutls_ocsp_req_t</code> type
</p>
<p><var class="var">critical</var>: critical flag, normally false.
</p>
<p><var class="var">nonce</var>: the nonce data
</p>
<p>This function will add an nonce extension to the OCSP request.
Calling this function multiple times will overwrite values from
earlier calls.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fcheck_005fcrt-1"><span>gnutls_ocsp_resp_check_crt<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fcheck_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fcheck_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fcheck_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_check_crt</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, unsigned int <var class="var">indx</var>, gnutls_x509_crt_t <var class="var">crt</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fcheck_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">indx</var>: Specifies response number to get. Use (0) to get the first one.
</p>
<p><var class="var">crt</var>: The certificate to check
</p>
<p>This function will check whether the OCSP response
is about the provided certificate.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fdeinit-1"><span>gnutls_ocsp_resp_deinit<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_ocsp_resp_deinit</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_t <var class="var">resp</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: The data to be deinitialized
</p>
<p>This function will deinitialize a OCSP response structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fexport-1"><span>gnutls_ocsp_resp_export<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_export</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: Holds the OCSP response
</p>
<p><var class="var">data</var>: newly allocate buffer holding DER encoded OCSP response
</p>
<p>This function will export the OCSP response to DER format.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fexport2-1"><span>gnutls_ocsp_resp_export2<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_export2</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: Holds the OCSP response
</p>
<p><var class="var">data</var>: newly allocate buffer holding DER or PEM encoded OCSP response
</p>
<p><var class="var">fmt</var>: DER or PEM
</p>
<p>This function will export the OCSP response to DER or PEM format.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fcerts-1"><span>gnutls_ocsp_resp_get_certs<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fcerts-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fcerts"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fcerts"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_certs</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_x509_crt_t ** <var class="var">certs</var>, size_t * <var class="var">ncerts</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fcerts"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">certs</var>: newly allocated array with <code class="code">gnutls_x509_crt_t</code> certificates
</p>
<p><var class="var">ncerts</var>: output variable with number of allocated certs.
</p>
<p>This function will extract the X.509 certificates found in the
Basic OCSP Response. The <code class="code">certs</code> output variable will hold a newly
allocated zero-terminated array with X.509 certificates.
</p>
<p>Every certificate in the array needs to be de-allocated with
<code class="code">gnutls_x509_crt_deinit()</code> and the array itself must be freed using
<code class="code">gnutls_free()</code> .
</p>
<p>Both the <code class="code">certs</code> and <code class="code">ncerts</code> variables may be NULL. Then the
function will work as normal but will not return the NULL:d
information. This can be used to get the number of certificates
only, or to just get the certificate array without its size.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fextension-1"><span>gnutls_ocsp_resp_get_extension<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fextension-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fextension"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fextension"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_extension</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">oid</var>, unsigned int * <var class="var">critical</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fextension"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">indx</var>: Specifies which extension OID to get. Use (0) to get the first one.
</p>
<p><var class="var">oid</var>: will hold newly allocated buffer with OID of extension, may be NULL
</p>
<p><var class="var">critical</var>: output variable with critical flag, may be NULL.
</p>
<p><var class="var">data</var>: will hold newly allocated buffer with extension data, may be NULL
</p>
<p>This function will return all information about the requested
extension in the OCSP response. The information returned is the
OID, the critical flag, and the data itself. The extension OID
will be stored as a string. Any of <code class="code">oid</code> , <code class="code">critical</code> , and <code class="code">data</code> may
be NULL which means that the caller is not interested in getting
that information back.
</p>
<p>The caller needs to deallocate memory by calling <code class="code">gnutls_free()</code> on
<code class="code">oid</code> ->data and <code class="code">data</code> ->data.
</p>
<p>Since 3.7.0 <code class="code">oid</code> ->size does not account for the terminating null byte.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned. If you have reached the last
extension available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will
be returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fnonce-1"><span>gnutls_ocsp_resp_get_nonce<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fnonce-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fnonce"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fnonce"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_nonce</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, unsigned int * <var class="var">critical</var>, gnutls_datum_t * <var class="var">nonce</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fnonce"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">critical</var>: whether nonce extension is marked critical
</p>
<p><var class="var">nonce</var>: will hold newly allocated buffer with nonce data
</p>
<p>This function will return the Basic OCSP Response nonce extension
data.
</p>
<p>The caller needs to deallocate memory by calling <code class="code">gnutls_free()</code> on
<code class="code">nonce</code> ->data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fproduced-1"><span>gnutls_ocsp_resp_get_produced<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fproduced-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fproduced"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fproduced"><span class="category-def">Function: </span><span><code class="def-type">time_t</code> <strong class="def-name">gnutls_ocsp_resp_get_produced</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fproduced"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p>This function will return the time when the OCSP response was
signed.
</p>
<p><strong class="strong">Returns:</strong> signing time, or (time_t)-1 on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fresponder-1"><span>gnutls_ocsp_resp_get_responder<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fresponder-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fresponder"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fresponder"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_responder</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_datum_t * <var class="var">dn</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fresponder"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">dn</var>: newly allocated buffer with name
</p>
<p>This function will extract the name of the Basic OCSP Response in
the provided buffer. The name will be in the form
"C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string
will be ASCII or UTF-8 encoded, depending on the certificate data.
</p>
<p>If the responder ID is not a name but a hash, this function
will return zero and the <code class="code">dn</code> elements will be set to <code class="code">NULL</code> .
</p>
<p>The caller needs to deallocate memory by calling <code class="code">gnutls_free()</code> on
<code class="code">dn</code> ->data.
</p>
<p>This function does not output a fully RFC4514 compliant string, if
that is required see <code class="code">gnutls_ocsp_resp_get_responder2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned. When no data exist it will
return success and set <code class="code">dn</code> elements to zero.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fresponder2-1"><span>gnutls_ocsp_resp_get_responder2<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fresponder2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fresponder2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fresponder2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_responder2</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_datum_t * <var class="var">dn</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fresponder2"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">dn</var>: newly allocated buffer with name
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code>
</p>
<p>This function will extract the name of the Basic OCSP Response in
the provided buffer. The name will be in the form
"C=xxxx,O=yyyy,CN=zzzz" as described in RFC2253. The output string
will be ASCII or UTF-8 encoded, depending on the certificate data.
</p>
<p>If the responder ID is not a name but a hash, this function
will return zero and the <code class="code">dn</code> elements will be set to <code class="code">NULL</code> .
</p>
<p>The caller needs to deallocate memory by calling <code class="code">gnutls_free()</code> on
<code class="code">dn</code> ->data.
</p>
<p>When the flag <code class="code">GNUTLS_X509_DN_FLAG_COMPAT</code> is specified, the output
format will match the format output by previous to 3.5.6 versions of GnuTLS
which was not not fully RFC4514-compliant.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned. When no data exist it will return
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid-1"><span>gnutls_ocsp_resp_get_responder_raw_id<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_responder_raw_id</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, unsigned <var class="var">type</var>, gnutls_datum_t * <var class="var">raw</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">type</var>: should be <code class="code">GNUTLS_OCSP_RESP_ID_KEY</code> or <code class="code">GNUTLS_OCSP_RESP_ID_DN</code>
</p>
<p><var class="var">raw</var>: newly allocated buffer with the raw ID
</p>
<p>This function will extract the raw key (or DN) ID of the Basic OCSP Response in
the provided buffer. If the responder ID is not a key ID then
this function will return <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> .
</p>
<p>The caller needs to deallocate memory by calling <code class="code">gnutls_free()</code> on
<code class="code">dn</code> ->data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fresponse-1"><span>gnutls_ocsp_resp_get_response<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fresponse-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fresponse"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fresponse"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_response</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_datum_t * <var class="var">response_type_oid</var>, gnutls_datum_t * <var class="var">response</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fresponse"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">response_type_oid</var>: newly allocated output buffer with response type OID
</p>
<p><var class="var">response</var>: newly allocated output buffer with DER encoded response
</p>
<p>This function will extract the response type OID in and the
response data from an OCSP response. Normally the
<code class="code">response_type_oid</code> is always "1.3.6.1.5.5.7.48.1.1" which means the
<code class="code">response</code> should be decoded as a Basic OCSP Response, but
technically other response types could be used.
</p>
<p>This function is typically only useful when you want to extract the
response type OID of an response for diagnostic purposes.
Otherwise <code class="code">gnutls_ocsp_resp_import()</code> will decode the basic OCSP
response part and the caller need not worry about that aspect.
</p>
<p>Since 3.7.0 <code class="code">response_type_oid</code> ->size does not account for the terminating
null byte.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fsignature-1"><span>gnutls_ocsp_resp_get_signature<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fsignature-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fsignature"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fsignature"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_signature</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_datum_t * <var class="var">sig</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fsignature"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">sig</var>: newly allocated output buffer with signature data
</p>
<p>This function will extract the signature field of a OCSP response.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm-1"><span>gnutls_ocsp_resp_get_signature_algorithm<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_signature_algorithm</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p>This function will return a value of the <code class="code">gnutls_sign_algorithm_t</code>
enumeration that is the signature algorithm that has been used to
sign the OCSP response.
</p>
<p><strong class="strong">Returns:</strong> a <code class="code">gnutls_sign_algorithm_t</code> value, or a negative error code
on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fsingle-1"><span>gnutls_ocsp_resp_get_single<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fsingle-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fsingle"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fsingle-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_single</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, unsigned <var class="var">indx</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_datum_t * <var class="var">issuer_name_hash</var>, gnutls_datum_t * <var class="var">issuer_key_hash</var>, gnutls_datum_t * <var class="var">serial_number</var>, unsigned int * <var class="var">cert_status</var>, time_t * <var class="var">this_update</var>, time_t * <var class="var">next_update</var>, time_t * <var class="var">revocation_time</var>, unsigned int * <var class="var">revocation_reason</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fsingle-1"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">indx</var>: Specifies response number to get. Use (0) to get the first one.
</p>
<p><var class="var">digest</var>: output variable with <code class="code">gnutls_digest_algorithm_t</code> hash algorithm
</p>
<p><var class="var">issuer_name_hash</var>: output buffer with hash of issuer’s DN
</p>
<p><var class="var">issuer_key_hash</var>: output buffer with hash of issuer’s public key
</p>
<p><var class="var">serial_number</var>: output buffer with serial number of certificate to check
</p>
<p><var class="var">cert_status</var>: a certificate status, a <code class="code">gnutls_ocsp_cert_status_t</code> enum.
</p>
<p><var class="var">this_update</var>: time at which the status is known to be correct.
</p>
<p><var class="var">next_update</var>: when newer information will be available, or (time_t)-1 if unspecified
</p>
<p><var class="var">revocation_time</var>: when <code class="code">cert_status</code> is <code class="code">GNUTLS_OCSP_CERT_REVOKED</code> , holds time of revocation.
</p>
<p><var class="var">revocation_reason</var>: revocation reason, a <code class="code">gnutls_x509_crl_reason_t</code> enum.
</p>
<p>This function will return the certificate information of the
<code class="code">indx</code> ’ed response in the Basic OCSP Response <code class="code">resp</code> . The
information returned corresponds to the OCSP SingleResponse structure
except the final singleExtensions.
</p>
<p>Each of the pointers to output variables may be NULL to indicate
that the caller is not interested in that value.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error code is returned. If you have reached the last
CertID available <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be
returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fstatus-1"><span>gnutls_ocsp_resp_get_status<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_status</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p>This function will return the status of a OCSP response, an
<code class="code">gnutls_ocsp_resp_status_t</code> enumeration.
</p>
<p><strong class="strong">Returns:</strong> status of OCSP request as a <code class="code">gnutls_ocsp_resp_status_t</code> , or
a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fget_005fversion-1"><span>gnutls_ocsp_resp_get_version<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fget_005fversion-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fget_005fversion"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fget_005fversion"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_get_version</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fget_005fversion"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p>This function will return the version of the Basic OCSP Response.
Typically this is always 1 indicating version 1.
</p>
<p><strong class="strong">Returns:</strong> version of Basic OCSP response, or a negative error code
on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fimport-1"><span>gnutls_ocsp_resp_import<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_import</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_t <var class="var">resp</var>, const gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: The data to store the parsed response.
</p>
<p><var class="var">data</var>: DER encoded OCSP response.
</p>
<p>This function will convert the given DER encoded OCSP response to
the native <code class="code">gnutls_ocsp_resp_t</code> format. It also decodes the Basic
OCSP Response part, if any. The output will be stored in <code class="code">resp</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fimport2-1"><span>gnutls_ocsp_resp_import2<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fimport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fimport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fimport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_import2</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_t <var class="var">resp</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fimport2"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: The data to store the parsed response.
</p>
<p><var class="var">data</var>: DER or PEM encoded OCSP response.
</p>
<p><var class="var">fmt</var>: DER or PEM
</p>
<p>This function will convert the given OCSP response to
the native <code class="code">gnutls_ocsp_resp_t</code> format. It also decodes the Basic
OCSP Response part, if any. The output will be stored in <code class="code">resp</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005finit-1"><span>gnutls_ocsp_resp_init<a class="copiable-link" href="#gnutls_005focsp_005fresp_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_init</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_t * <var class="var">resp</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005finit"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize an OCSP response structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005flist_005fimport2-1"><span>gnutls_ocsp_resp_list_import2<a class="copiable-link" href="#gnutls_005focsp_005fresp_005flist_005fimport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005flist_005fimport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005flist_005fimport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_list_import2</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_t ** <var class="var">ocsps</var>, unsigned int * <var class="var">size</var>, const gnutls_datum_t * <var class="var">resp_data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005flist_005fimport2"> ¶</a></span></dt>
<dd><p><var class="var">ocsps</var>: Will hold the parsed OCSP response list.
</p>
<p><var class="var">size</var>: It will contain the size of the list.
</p>
<p><var class="var">resp_data</var>: The PEM encoded OCSP list.
</p>
<p><var class="var">format</var>: One of <code class="code">GNUTLS_X509_FMT_PEM</code> or <code class="code">GNUTLS_X509_FMT_DER</code>
</p>
<p><var class="var">flags</var>: must be (0) or an OR’d sequence of gnutls_certificate_import_flags.
</p>
<p>This function will convert the given PEM encoded OCSP response list
to the native gnutls_ocsp_resp_t format. The output will be stored
in <code class="code">ocsps</code> which will be allocated and initialized.
</p>
<p>The OCSP responses should have a header of "OCSP RESPONSE".
</p>
<p>To deinitialize responses, you need to deinitialize each <code class="code">gnutls_ocsp_resp_t</code>
structure independently, and use <code class="code">gnutls_free()</code> at <code class="code">ocsps</code> .
</p>
<p>In PEM files, when no OCSP responses are detected
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Returns:</strong> the number of responses read or a negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fprint-1"><span>gnutls_ocsp_resp_print<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_print</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_ocsp_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: The data to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with (0) terminated string.
</p>
<p>This function will pretty print a OCSP response, suitable for
display to a human.
</p>
<p>If the format is <code class="code">GNUTLS_OCSP_PRINT_FULL</code> then all fields of the
response will be output, on multiple lines.
</p>
<p>The output <code class="code">out</code> ->data needs to be deallocate using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fverify-1"><span>gnutls_ocsp_resp_verify<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fverify-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fverify"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fverify"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_verify</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_x509_trust_list_t <var class="var">trustlist</var>, unsigned int * <var class="var">verify</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fverify"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">trustlist</var>: trust anchors as a <code class="code">gnutls_x509_trust_list_t</code> type
</p>
<p><var class="var">verify</var>: output variable with verification status, an <code class="code">gnutls_ocsp_verify_reason_t</code>
</p>
<p><var class="var">flags</var>: verification flags from <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p>Verify signature of the Basic OCSP Response against the public key
in the certificate of a trusted signer. The <code class="code">trustlist</code> should be
populated with trust anchors. The function will extract the signer
certificate from the Basic OCSP Response and will verify it against
the <code class="code">trustlist</code> . A trusted signer is a certificate that is either
in <code class="code">trustlist</code> , or it is signed directly by a certificate in
<code class="code">trustlist</code> and has the id-ad-ocspSigning Extended Key Usage bit
set.
</p>
<p>The output <code class="code">verify</code> variable will hold verification status codes
(e.g., <code class="code">GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND</code> ,
<code class="code">GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM</code> ) which are only valid if the
function returned <code class="code">GNUTLS_E_SUCCESS</code> .
</p>
<p>Note that the function returns <code class="code">GNUTLS_E_SUCCESS</code> even when
verification failed. The caller must always inspect the <code class="code">verify</code> variable to find out the verification status.
</p>
<p>The <code class="code">flags</code> variable should be 0 for now.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005focsp_005fresp_005fverify_005fdirect-1"><span>gnutls_ocsp_resp_verify_direct<a class="copiable-link" href="#gnutls_005focsp_005fresp_005fverify_005fdirect-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005focsp_005fresp_005fverify_005fdirect"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005focsp_005fresp_005fverify_005fdirect"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_ocsp_resp_verify_direct</strong> <code class="def-code-arguments">(gnutls_ocsp_resp_const_t <var class="var">resp</var>, gnutls_x509_crt_t <var class="var">issuer</var>, unsigned int * <var class="var">verify</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005focsp_005fresp_005fverify_005fdirect"> ¶</a></span></dt>
<dd><p><var class="var">resp</var>: should contain a <code class="code">gnutls_ocsp_resp_t</code> type
</p>
<p><var class="var">issuer</var>: certificate believed to have signed the response
</p>
<p><var class="var">verify</var>: output variable with verification status, an <code class="code">gnutls_ocsp_verify_reason_t</code>
</p>
<p><var class="var">flags</var>: verification flags from <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p>Verify signature of the Basic OCSP Response against the public key
in the <code class="code">issuer</code> certificate.
</p>
<p>The output <code class="code">verify</code> variable will hold verification status codes
(e.g., <code class="code">GNUTLS_OCSP_VERIFY_SIGNER_NOT_FOUND</code> ,
<code class="code">GNUTLS_OCSP_VERIFY_INSECURE_ALGORITHM</code> ) which are only valid if the
function returned <code class="code">GNUTLS_E_SUCCESS</code> .
</p>
<p>Note that the function returns <code class="code">GNUTLS_E_SUCCESS</code> even when
verification failed. The caller must always inspect the <code class="code">verify</code> variable to find out the verification status.
</p>
<p>The <code class="code">flags</code> variable should be 0 for now.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="PKCS-12-API">
<div class="nav-panel">
<p>
Next: <a href="#PKCS-11-API" accesskey="n" rel="next">Hardware token via PKCS 11 API</a>, Previous: <a href="#OCSP-API" accesskey="p" rel="prev"><abbr class="acronym">OCSP</abbr> API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="PKCS-12-API-1"><span>E.6 PKCS 12 API<a class="copiable-link" href="#PKCS-12-API-1"> ¶</a></span></h3>
<p>The following functions are to be used for PKCS 12 handling.
Their prototypes lie in <samp class="file">gnutls/pkcs12.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fdecrypt-1"><span>gnutls_pkcs12_bag_decrypt<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fdecrypt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fdecrypt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fdecrypt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_decrypt</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, const char * <var class="var">pass</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fdecrypt"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">pass</var>: The password used for encryption, must be ASCII.
</p>
<p>This function will decrypt the given encrypted bag and return 0 on
success.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fdeinit-1"><span>gnutls_pkcs12_bag_deinit<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs12_bag_deinit</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: A pointer to the type to be initialized
</p>
<p>This function will deinitialize a PKCS12 Bag structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fenc_005finfo-1"><span>gnutls_pkcs12_bag_enc_info<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fenc_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fenc_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fenc_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_enc_info</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned int * <var class="var">schema</var>, unsigned int * <var class="var">cipher</var>, void * <var class="var">salt</var>, unsigned int * <var class="var">salt_size</var>, unsigned int * <var class="var">iter_count</var>, char ** <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fenc_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">schema</var>: indicate the schema as one of <code class="code">gnutls_pkcs_encrypt_flags_t</code>
</p>
<p><var class="var">cipher</var>: the cipher used as <code class="code">gnutls_cipher_algorithm_t</code>
</p>
<p><var class="var">salt</var>: PBKDF2 salt (if non-NULL then <code class="code">salt_size</code> initially holds its size)
</p>
<p><var class="var">salt_size</var>: PBKDF2 salt size
</p>
<p><var class="var">iter_count</var>: PBKDF2 iteration count
</p>
<p><var class="var">oid</var>: if non-NULL it will contain an allocated null-terminated variable with the OID
</p>
<p>This function will provide information on the encryption algorithms used
in an encrypted bag. If the structure algorithms
are unknown the code <code class="code">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code> will be returned,
and only <code class="code">oid</code> , will be set. That is, <code class="code">oid</code> will be set on encrypted bags
whether supported or not. It must be deinitialized using <code class="code">gnutls_free()</code> .
The other variables are only set on supported structures.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_INVALID_REQUEST</code> if the provided bag isn’t encrypted,
<code class="code">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code> if the structure’s encryption isn’t supported, or
another negative error code in case of a failure. Zero on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fencrypt-1"><span>gnutls_pkcs12_bag_encrypt<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fencrypt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fencrypt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fencrypt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_encrypt</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fencrypt"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">pass</var>: The password used for encryption, must be ASCII
</p>
<p><var class="var">flags</var>: should be one of <code class="code">gnutls_pkcs_encrypt_flags_t</code> elements bitwise or’d
</p>
<p>This function will encrypt the given bag.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
otherwise a negative error code is returned.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fget_005fcount-1"><span>gnutls_pkcs12_bag_get_count<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fget_005fcount-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fget_005fcount"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fget_005fcount"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_get_count</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fget_005fcount"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p>This function will return the number of the elements within the bag.
</p>
<p><strong class="strong">Returns:</strong> Number of elements in bag, or an negative error code on
error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fget_005fdata-1"><span>gnutls_pkcs12_bag_get_data<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fget_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fget_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fget_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_get_data</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fget_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">indx</var>: The element of the bag to get the data from
</p>
<p><var class="var">data</var>: where the bag’s data will be. Should be treated as constant.
</p>
<p>This function will return the bag’s data. The data is a constant
that is stored into the bag. Should not be accessed after the bag
is deleted.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fget_005ffriendly_005fname-1"><span>gnutls_pkcs12_bag_get_friendly_name<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fget_005ffriendly_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fget_005ffriendly_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fget_005ffriendly_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_get_friendly_name</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, char ** <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fget_005ffriendly_005fname"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">indx</var>: The bag’s element to add the id
</p>
<p><var class="var">name</var>: will hold a pointer to the name (to be treated as const)
</p>
<p>This function will return the friendly name, of the specified bag
element. The key ID is usually used to distinguish the local
private key and the certificate pair.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fget_005fkey_005fid-1"><span>gnutls_pkcs12_bag_get_key_id<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fget_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fget_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fget_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_get_key_id</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, gnutls_datum_t * <var class="var">id</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fget_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">indx</var>: The bag’s element to add the id
</p>
<p><var class="var">id</var>: where the ID will be copied (to be treated as const)
</p>
<p>This function will return the key ID, of the specified bag element.
The key ID is usually used to distinguish the local private key and
the certificate pair.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fget_005ftype-1"><span>gnutls_pkcs12_bag_get_type<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fget_005ftype-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fget_005ftype"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fget_005ftype"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_get_type</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fget_005ftype"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">indx</var>: The element of the bag to get the type
</p>
<p>This function will return the bag’s type.
</p>
<p><strong class="strong">Returns:</strong> On error a negative error value or one of the <code class="code">gnutls_pkcs12_bag_type_t</code> enumerations.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005finit-1"><span>gnutls_pkcs12_bag_init<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_init</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t * <var class="var">bag</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005finit"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a PKCS12 bag structure. PKCS12 Bags
usually contain private keys, lists of X.509 Certificates and X.509
Certificate revocation lists.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fset_005fcrl-1"><span>gnutls_pkcs12_bag_set_crl<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fset_005fcrl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fset_005fcrl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fset_005fcrl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_set_crl</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, gnutls_x509_crl_t <var class="var">crl</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fset_005fcrl"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">crl</var>: the CRL to be copied.
</p>
<p>This function will insert the given CRL into the
bag. This is just a wrapper over <code class="code">gnutls_pkcs12_bag_set_data()</code> .
</p>
<p><strong class="strong">Returns:</strong> the index of the added bag on success, or a negative error code
on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fset_005fcrt-1"><span>gnutls_pkcs12_bag_set_crt<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fset_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fset_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fset_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_set_crt</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, gnutls_x509_crt_t <var class="var">crt</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fset_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">crt</var>: the certificate to be copied.
</p>
<p>This function will insert the given certificate into the
bag. This is just a wrapper over <code class="code">gnutls_pkcs12_bag_set_data()</code> .
</p>
<p><strong class="strong">Returns:</strong> the index of the added bag on success, or a negative
value on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fset_005fdata-1"><span>gnutls_pkcs12_bag_set_data<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fset_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fset_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fset_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_set_data</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, gnutls_pkcs12_bag_type_t <var class="var">type</var>, const gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fset_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">type</var>: The data’s type
</p>
<p><var class="var">data</var>: the data to be copied.
</p>
<p>This function will insert the given data of the given type into
the bag.
</p>
<p><strong class="strong">Returns:</strong> the index of the added bag on success, or a negative
value on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fset_005ffriendly_005fname-1"><span>gnutls_pkcs12_bag_set_friendly_name<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fset_005ffriendly_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fset_005ffriendly_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fset_005ffriendly_005fname"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_set_friendly_name</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fset_005ffriendly_005fname"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">indx</var>: The bag’s element to add the id
</p>
<p><var class="var">name</var>: the name
</p>
<p>This function will add the given key friendly name, to the
specified, by the index, bag element. The name will be encoded as
a ’Friendly name’ bag attribute, which is usually used to set a
user name to the local private key and the certificate pair.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fset_005fkey_005fid-1"><span>gnutls_pkcs12_bag_set_key_id<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fset_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fset_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fset_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_set_key_id</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, unsigned <var class="var">indx</var>, const gnutls_datum_t * <var class="var">id</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fset_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">indx</var>: The bag’s element to add the id
</p>
<p><var class="var">id</var>: the ID
</p>
<p>This function will add the given key ID, to the specified, by the
index, bag element. The key ID will be encoded as a ’Local key
identifier’ bag attribute, which is usually used to distinguish
the local private key and the certificate pair.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value. or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fbag_005fset_005fprivkey-1"><span>gnutls_pkcs12_bag_set_privkey<a class="copiable-link" href="#gnutls_005fpkcs12_005fbag_005fset_005fprivkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fbag_005fset_005fprivkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fbag_005fset_005fprivkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_bag_set_privkey</strong> <code class="def-code-arguments">(gnutls_pkcs12_bag_t <var class="var">bag</var>, gnutls_x509_privkey_t <var class="var">privkey</var>, const char * <var class="var">password</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fbag_005fset_005fprivkey"> ¶</a></span></dt>
<dd><p><var class="var">bag</var>: The bag
</p>
<p><var class="var">privkey</var>: the private key to be copied.
</p>
<p><var class="var">password</var>: the password to protect the key with (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: should be one of <code class="code">gnutls_pkcs_encrypt_flags_t</code> elements bitwise or’d
</p>
<p>This function will insert the given private key into the
bag. This is just a wrapper over <code class="code">gnutls_pkcs12_bag_set_data()</code> .
</p>
<p><strong class="strong">Returns:</strong> the index of the added bag on success, or a negative
value on failure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fdeinit-1"><span>gnutls_pkcs12_deinit<a class="copiable-link" href="#gnutls_005fpkcs12_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs12_deinit</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: The type to be initialized
</p>
<p>This function will deinitialize a PKCS12 type.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fexport-1"><span>gnutls_pkcs12_export<a class="copiable-link" href="#gnutls_005fpkcs12_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_export</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pkcs12 type
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a structure PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the pkcs12 structure to DER or PEM format.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size will be updated and GNUTLS_E_SHORT_MEMORY_BUFFER
will be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN PKCS12".
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fexport2-1"><span>gnutls_pkcs12_export2<a class="copiable-link" href="#gnutls_005fpkcs12_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_export2</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pkcs12 type
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a structure PEM or DER encoded
</p>
<p>This function will export the pkcs12 structure to DER or PEM format.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN PKCS12".
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fgenerate_005fmac-1"><span>gnutls_pkcs12_generate_mac<a class="copiable-link" href="#gnutls_005fpkcs12_005fgenerate_005fmac-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fgenerate_005fmac"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fgenerate_005fmac"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_generate_mac</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, const char * <var class="var">pass</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fgenerate_005fmac"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pkcs12 type
</p>
<p><var class="var">pass</var>: The password for the MAC
</p>
<p>This function will generate a MAC for the PKCS12 structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fgenerate_005fmac2-1"><span>gnutls_pkcs12_generate_mac2<a class="copiable-link" href="#gnutls_005fpkcs12_005fgenerate_005fmac2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fgenerate_005fmac2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fgenerate_005fmac2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_generate_mac2</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, gnutls_mac_algorithm_t <var class="var">mac</var>, const char * <var class="var">pass</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fgenerate_005fmac2"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pkcs12 type
</p>
<p><var class="var">mac</var>: the MAC algorithm to use
</p>
<p><var class="var">pass</var>: The password for the MAC
</p>
<p>This function will generate a MAC for the PKCS12 structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fgenerate_005fmac3-1"><span>gnutls_pkcs12_generate_mac3<a class="copiable-link" href="#gnutls_005fpkcs12_005fgenerate_005fmac3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fgenerate_005fmac3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fgenerate_005fmac3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_generate_mac3</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, gnutls_mac_algorithm_t <var class="var">mac</var>, const char * <var class="var">pass</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fgenerate_005fmac3"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pkcs12 type
</p>
<p><var class="var">mac</var>: the MAC algorithm to use
</p>
<p><var class="var">pass</var>: The password for the MAC
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs12_flags_t
</p>
<p>This function will generate a MAC for the PKCS12 structure.
</p>
<p>If <code class="code">flags</code> contains <code class="code">GNUTLS_PKCS12_USE_PBMAC1</code> , it uses PBMAC1 key
derivation function instead of the PKCS<code class="code">12</code> one.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fget_005fbag-1"><span>gnutls_pkcs12_get_bag<a class="copiable-link" href="#gnutls_005fpkcs12_005fget_005fbag-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fget_005fbag"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fget_005fbag"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_get_bag</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, int <var class="var">indx</var>, gnutls_pkcs12_bag_t <var class="var">bag</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fget_005fbag"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pkcs12 type
</p>
<p><var class="var">indx</var>: contains the index of the bag to extract
</p>
<p><var class="var">bag</var>: An initialized bag, where the contents of the bag will be copied
</p>
<p>This function will return a Bag from the PKCS12 structure.
</p>
<p>After the last Bag has been read
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> will be returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fimport-1"><span>gnutls_pkcs12_import<a class="copiable-link" href="#gnutls_005fpkcs12_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_import</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: The data to store the parsed PKCS12.
</p>
<p><var class="var">data</var>: The DER or PEM encoded PKCS12.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_privkey_pkcs8_flags
</p>
<p>This function will convert the given DER or PEM encoded PKCS12
to the native gnutls_pkcs12_t format. The output will be stored in ’pkcs12’.
</p>
<p>If the PKCS12 is PEM encoded it should have a header of "PKCS12".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005finit-1"><span>gnutls_pkcs12_init<a class="copiable-link" href="#gnutls_005fpkcs12_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_init</strong> <code class="def-code-arguments">(gnutls_pkcs12_t * <var class="var">pkcs12</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005finit"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a PKCS12 type. PKCS12 structures
usually contain lists of X.509 Certificates and X.509 Certificate
revocation lists.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fmac_005finfo-1"><span>gnutls_pkcs12_mac_info<a class="copiable-link" href="#gnutls_005fpkcs12_005fmac_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fmac_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fmac_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_mac_info</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, unsigned int * <var class="var">mac</var>, void * <var class="var">salt</var>, unsigned int * <var class="var">salt_size</var>, unsigned int * <var class="var">iter_count</var>, char ** <var class="var">oid</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fmac_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: A pkcs12 type
</p>
<p><var class="var">mac</var>: the MAC algorithm used as <code class="code">gnutls_mac_algorithm_t</code>
</p>
<p><var class="var">salt</var>: the salt used for string to key (if non-NULL then <code class="code">salt_size</code> initially holds its size)
</p>
<p><var class="var">salt_size</var>: string to key salt size
</p>
<p><var class="var">iter_count</var>: string to key iteration count
</p>
<p><var class="var">oid</var>: if non-NULL it will contain an allocated null-terminated variable with the OID
</p>
<p>This function will provide information on the MAC algorithm used
in a PKCS <code class="code">12</code> structure. If the structure algorithms
are unknown the code <code class="code">GNUTLS_E_UNKNOWN_HASH_ALGORITHM</code> will be returned,
and only <code class="code">oid</code> , will be set. That is, <code class="code">oid</code> will be set on structures
with a MAC whether supported or not. It must be deinitialized using <code class="code">gnutls_free()</code> .
The other variables are only set on supported structures.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_INVALID_REQUEST</code> if the provided structure doesn’t contain a MAC,
<code class="code">GNUTLS_E_UNKNOWN_HASH_ALGORITHM</code> if the structure’s MAC isn’t supported, or
another negative error code in case of a failure. Zero on success.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fset_005fbag-1"><span>gnutls_pkcs12_set_bag<a class="copiable-link" href="#gnutls_005fpkcs12_005fset_005fbag-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fset_005fbag"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fset_005fbag"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_set_bag</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, gnutls_pkcs12_bag_t <var class="var">bag</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fset_005fbag"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: should contain a gnutls_pkcs12_t type
</p>
<p><var class="var">bag</var>: An initialized bag
</p>
<p>This function will insert a Bag into the PKCS12 structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fsimple_005fparse-1"><span>gnutls_pkcs12_simple_parse<a class="copiable-link" href="#gnutls_005fpkcs12_005fsimple_005fparse-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fsimple_005fparse"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fsimple_005fparse-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_simple_parse</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">p12</var>, const char * <var class="var">password</var>, gnutls_x509_privkey_t * <var class="var">key</var>, gnutls_x509_crt_t ** <var class="var">chain</var>, unsigned int * <var class="var">chain_len</var>, gnutls_x509_crt_t ** <var class="var">extra_certs</var>, unsigned int * <var class="var">extra_certs_len</var>, gnutls_x509_crl_t * <var class="var">crl</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fsimple_005fparse-1"> ¶</a></span></dt>
<dd><p><var class="var">p12</var>: A pkcs12 type
</p>
<p><var class="var">password</var>: optional password used to decrypt the structure, bags and keys.
</p>
<p><var class="var">key</var>: a structure to store the parsed private key.
</p>
<p><var class="var">chain</var>: the corresponding to key certificate chain (may be <code class="code">NULL</code> )
</p>
<p><var class="var">chain_len</var>: will be updated with the number of additional (may be <code class="code">NULL</code> )
</p>
<p><var class="var">extra_certs</var>: optional pointer to receive an array of additional
certificates found in the PKCS12 structure (may be <code class="code">NULL</code> ).
</p>
<p><var class="var">extra_certs_len</var>: will be updated with the number of additional
certs (may be <code class="code">NULL</code> ).
</p>
<p><var class="var">crl</var>: an optional structure to store the parsed CRL (may be <code class="code">NULL</code> ).
</p>
<p><var class="var">flags</var>: should be zero or one of GNUTLS_PKCS12_SP_*
</p>
<p>This function parses a PKCS12 structure in <code class="code">pkcs12</code> and extracts the
private key, the corresponding certificate chain, any additional
certificates and a CRL. The structures in <code class="code">key</code> , <code class="code">chain</code> <code class="code">crl</code> , and <code class="code">extra_certs</code> must not be initialized.
</p>
<p>The <code class="code">extra_certs</code> and <code class="code">extra_certs_len</code> parameters are optional
and both may be set to <code class="code">NULL</code> . If either is non-<code class="code">NULL</code> , then both must
be set. The value for <code class="code">extra_certs</code> is allocated
using <code class="code">gnutls_malloc()</code> .
</p>
<p>Encrypted PKCS12 bags and PKCS8 private keys are supported, but
only with password based security and the same password for all
operations.
</p>
<p>Note that a PKCS12 structure may contain many keys and/or certificates,
and there is no way to identify which key/certificate pair you want.
For this reason this function is useful for PKCS12 files that contain
only one key/certificate pair and/or one CRL.
</p>
<p>If the provided structure has encrypted fields but no password
is provided then this function returns <code class="code">GNUTLS_E_DECRYPTION_FAILED</code> .
</p>
<p>Note that normally the chain constructed does not include self signed
certificates, to comply with TLS’ requirements. If, however, the flag
<code class="code">GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</code> is specified then
self signed certificates will be included in the chain.
</p>
<p>Prior to using this function the PKCS <code class="code">12</code> structure integrity must
be verified using <code class="code">gnutls_pkcs12_verify_mac()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs12_005fverify_005fmac-1"><span>gnutls_pkcs12_verify_mac<a class="copiable-link" href="#gnutls_005fpkcs12_005fverify_005fmac-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs12_005fverify_005fmac"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs12_005fverify_005fmac"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs12_verify_mac</strong> <code class="def-code-arguments">(gnutls_pkcs12_t <var class="var">pkcs12</var>, const char * <var class="var">pass</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs12_005fverify_005fmac"> ¶</a></span></dt>
<dd><p><var class="var">pkcs12</var>: should contain a gnutls_pkcs12_t type
</p>
<p><var class="var">pass</var>: The password for the MAC
</p>
<p>This function will verify the MAC for the PKCS12 structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="PKCS-11-API">
<div class="nav-panel">
<p>
Next: <a href="#TPM-API" accesskey="n" rel="next">TPM API</a>, Previous: <a href="#PKCS-12-API" accesskey="p" rel="prev">PKCS 12 API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Hardware-token-via-PKCS-11-API"><span>E.7 Hardware token via PKCS 11 API<a class="copiable-link" href="#Hardware-token-via-PKCS-11-API"> ¶</a></span></h3>
<p>The following functions are to be used for PKCS 11 handling.
Their prototypes lie in <samp class="file">gnutls/pkcs11.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005fpkcs11_005fadd_005fprovider-1"><span>gnutls_pkcs11_add_provider<a class="copiable-link" href="#gnutls_005fpkcs11_005fadd_005fprovider-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fadd_005fprovider"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fadd_005fprovider-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_add_provider</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>, const char * <var class="var">params</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fadd_005fprovider-1"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: The filename of the module
</p>
<p><var class="var">params</var>: should be NULL or a known string (see description)
</p>
<p>This function will load and add a PKCS 11 module to the module
list used in gnutls. After this function is called the module will
be used for PKCS 11 operations.
</p>
<p>When loading a module to be used for certificate verification,
use the string ’trusted’ as <code class="code">params</code> .
</p>
<p>Note that this function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcopy_005fattached_005fextension-1"><span>gnutls_pkcs11_copy_attached_extension<a class="copiable-link" href="#gnutls_005fpkcs11_005fcopy_005fattached_005fextension-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcopy_005fattached_005fextension"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fattached_005fextension"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_attached_extension</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_x509_crt_t <var class="var">crt</var>, gnutls_datum_t * <var class="var">data</var>, const char * <var class="var">label</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fattached_005fextension"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">crt</var>: An X.509 certificate object
</p>
<p><var class="var">data</var>: the attached extension
</p>
<p><var class="var">label</var>: A name to be used for the attached extension (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_FLAG_*
</p>
<p>This function will copy an the attached extension in <code class="code">data</code> for
the certificate provided in <code class="code">crt</code> in the PKCS <code class="code">11</code> token specified
by the URL (typically a trust module). The extension must be in
RFC5280 Extension format.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcopy_005fpubkey-1"><span>gnutls_pkcs11_copy_pubkey<a class="copiable-link" href="#gnutls_005fpkcs11_005fcopy_005fpubkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcopy_005fpubkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fpubkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_pubkey</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_pubkey_t <var class="var">pubkey</var>, const char * <var class="var">label</var>, const gnutls_datum_t * <var class="var">cid</var>, unsigned int <var class="var">key_usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fpubkey"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">pubkey</var>: The public key to copy
</p>
<p><var class="var">label</var>: The name to be used for the stored data
</p>
<p><var class="var">cid</var>: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
</p>
<p><var class="var">key_usage</var>: One of GNUTLS_KEY_*
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_FLAG_*
</p>
<p>This function will copy a public key object into a PKCS <code class="code">11</code> token specified by
a URL. Valid flags to mark the key: <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_CA</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_ALWAYS_AUTH</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcopy_005fsecret_005fkey-1"><span>gnutls_pkcs11_copy_secret_key<a class="copiable-link" href="#gnutls_005fpkcs11_005fcopy_005fsecret_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcopy_005fsecret_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fsecret_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_secret_key</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_datum_t * <var class="var">key</var>, const char * <var class="var">label</var>, unsigned int <var class="var">key_usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fsecret_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">key</var>: The raw key
</p>
<p><var class="var">label</var>: A name to be used for the stored data
</p>
<p><var class="var">key_usage</var>: One of GNUTLS_KEY_*
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_FLAG_*
</p>
<p>This function will copy a raw secret (symmetric) key into a PKCS <code class="code">11</code>
token specified by a URL. The key can be marked as sensitive or not.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcopy_005fx509_005fcrt-1"><span>gnutls_pkcs11_copy_x509_crt<a class="copiable-link" href="#gnutls_005fpkcs11_005fcopy_005fx509_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcopy_005fx509_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_x509_crt</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">label</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">crt</var>: A certificate
</p>
<p><var class="var">label</var>: A name to be used for the stored data
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_FLAG_*
</p>
<p>This function will copy a certificate into a PKCS <code class="code">11</code> token specified by
a URL. The certificate can be marked as trusted or not.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2-1"><span>gnutls_pkcs11_copy_x509_crt2<a class="copiable-link" href="#gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_x509_crt2</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_x509_crt_t <var class="var">crt</var>, const char * <var class="var">label</var>, const gnutls_datum_t * <var class="var">cid</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2-1"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">crt</var>: The certificate to copy
</p>
<p><var class="var">label</var>: The name to be used for the stored data
</p>
<p><var class="var">cid</var>: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_FLAG_*
</p>
<p>This function will copy a certificate into a PKCS <code class="code">11</code> token specified by
a URL. Valid flags to mark the certificate: <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_CA</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_ALWAYS_AUTH</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey-1"><span>gnutls_pkcs11_copy_x509_privkey<a class="copiable-link" href="#gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_x509_privkey</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_x509_privkey_t <var class="var">key</var>, const char * <var class="var">label</var>, unsigned int <var class="var">key_usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">key</var>: A private key
</p>
<p><var class="var">label</var>: A name to be used for the stored data
</p>
<p><var class="var">key_usage</var>: One of GNUTLS_KEY_*
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will copy a private key into a PKCS <code class="code">11</code> token specified by
a URL.
</p>
<p>Since 3.6.3 the objects are marked as sensitive by default unless
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_SENSITIVE</code> is specified.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2-1"><span>gnutls_pkcs11_copy_x509_privkey2<a class="copiable-link" href="#gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_copy_x509_privkey2</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, gnutls_x509_privkey_t <var class="var">key</var>, const char * <var class="var">label</var>, const gnutls_datum_t * <var class="var">cid</var>, unsigned int <var class="var">key_usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2-1"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">key</var>: A private key
</p>
<p><var class="var">label</var>: A name to be used for the stored data
</p>
<p><var class="var">cid</var>: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
</p>
<p><var class="var">key_usage</var>: One of GNUTLS_KEY_*
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will copy a private key into a PKCS <code class="code">11</code> token specified by
a URL.
</p>
<p>Since 3.6.3 the objects are marked as sensitive by default unless
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_SENSITIVE</code> is specified.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fcrt_005fis_005fknown-1"><span>gnutls_pkcs11_crt_is_known<a class="copiable-link" href="#gnutls_005fpkcs11_005fcrt_005fis_005fknown-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fcrt_005fis_005fknown"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fcrt_005fis_005fknown"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_pkcs11_crt_is_known</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, gnutls_x509_crt_t <var class="var">cert</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fcrt_005fis_005fknown"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: A PKCS 11 url identifying a token
</p>
<p><var class="var">cert</var>: is the certificate to find issuer for
</p>
<p><var class="var">flags</var>: Use zero or flags from <code class="code">GNUTLS_PKCS11_OBJ_FLAG</code> .
</p>
<p>This function will check whether the provided certificate is stored
in the specified token. This is useful in combination with
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_TRUSTED</code> or
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED</code> ,
to check whether a CA is present or a certificate is distrusted in
a trust PKCS <code class="code">11</code> module.
</p>
<p>This function can be used with a <code class="code">url</code> of "pkcs11:", and in that case all modules
will be searched. To restrict the modules to the marked as trusted in p11-kit
use the <code class="code">GNUTLS_PKCS11_OBJ_FLAG_PRESENT_IN_TRUSTED_MODULE</code> flag.
</p>
<p>Note that the flag <code class="code">GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED</code> is
specific to p11-kit trust modules.
</p>
<p><strong class="strong">Returns:</strong> If the certificate exists non-zero is returned, otherwise zero.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fdeinit-1"><span>gnutls_pkcs11_deinit<a class="copiable-link" href="#gnutls_005fpkcs11_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs11_deinit</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fdeinit"> ¶</a></span></dt>
<dd>
<p>This function will deinitialize the PKCS 11 subsystem in gnutls.
This function is only needed if you need to deinitialize the
subsystem without calling <code class="code">gnutls_global_deinit()</code> .
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fdelete_005furl-1"><span>gnutls_pkcs11_delete_url<a class="copiable-link" href="#gnutls_005fpkcs11_005fdelete_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fdelete_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fdelete_005furl-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_delete_url</strong> <code class="def-code-arguments">(const char * <var class="var">object_url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fdelete_005furl-1"> ¶</a></span></dt>
<dd><p><var class="var">object_url</var>: The URL of the object to delete.
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will delete objects matching the given URL.
Note that not all tokens support the delete operation.
</p>
<p><strong class="strong">Returns:</strong> On success, the number of objects deleted is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fget_005fpin_005ffunction-1"><span>gnutls_pkcs11_get_pin_function<a class="copiable-link" href="#gnutls_005fpkcs11_005fget_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fget_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fget_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">gnutls_pin_callback_t</code> <strong class="def-name">gnutls_pkcs11_get_pin_function</strong> <code class="def-code-arguments">(void ** <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fget_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">userdata</var>: data to be supplied to callback
</p>
<p>This function will return the callback function set using
<code class="code">gnutls_pkcs11_set_pin_function()</code> .
</p>
<p><strong class="strong">Returns:</strong> The function set or NULL otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fget_005fraw_005fissuer-1"><span>gnutls_pkcs11_get_raw_issuer<a class="copiable-link" href="#gnutls_005fpkcs11_005fget_005fraw_005fissuer-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fget_005fraw_005fissuer"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fget_005fraw_005fissuer"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_get_raw_issuer</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, gnutls_x509_crt_t <var class="var">cert</var>, gnutls_datum_t * <var class="var">issuer</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fget_005fraw_005fissuer"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: A PKCS 11 url identifying a token
</p>
<p><var class="var">cert</var>: is the certificate to find issuer for
</p>
<p><var class="var">issuer</var>: Will hold the issuer if any in an allocated buffer.
</p>
<p><var class="var">fmt</var>: The format of the exported issuer.
</p>
<p><var class="var">flags</var>: Use zero or flags from <code class="code">GNUTLS_PKCS11_OBJ_FLAG</code> .
</p>
<p>This function will return the issuer of a given certificate, if it
is stored in the token. By default only marked as trusted issuers
are returned. If any issuer should be returned specify
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_ANY</code> in <code class="code">flags</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.2.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fdn-1"><span>gnutls_pkcs11_get_raw_issuer_by_dn<a class="copiable-link" href="#gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fdn-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fdn"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fdn"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_get_raw_issuer_by_dn</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, const gnutls_datum_t * <var class="var">dn</var>, gnutls_datum_t * <var class="var">issuer</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fdn"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: A PKCS 11 url identifying a token
</p>
<p><var class="var">dn</var>: is the DN to search for
</p>
<p><var class="var">issuer</var>: Will hold the issuer if any in an allocated buffer.
</p>
<p><var class="var">fmt</var>: The format of the exported issuer.
</p>
<p><var class="var">flags</var>: Use zero or flags from <code class="code">GNUTLS_PKCS11_OBJ_FLAG</code> .
</p>
<p>This function will return the certificate with the given DN, if it
is stored in the token. By default only marked as trusted issuers
are returned. If any issuer should be returned specify
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_ANY</code> in <code class="code">flags</code> .
</p>
<p>The name of the function includes issuer because it can
be used to discover issuers of certificates.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fsubject_005fkey_005fid-1"><span>gnutls_pkcs11_get_raw_issuer_by_subject_key_id<a class="copiable-link" href="#gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fsubject_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fsubject_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fsubject_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_get_raw_issuer_by_subject_key_id</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, const gnutls_datum_t * <var class="var">dn</var>, const gnutls_datum_t * <var class="var">spki</var>, gnutls_datum_t * <var class="var">issuer</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fsubject_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: A PKCS 11 url identifying a token
</p>
<p><var class="var">dn</var>: is the DN to search for (may be <code class="code">NULL</code> )
</p>
<p><var class="var">spki</var>: is the subject key ID to search for
</p>
<p><var class="var">issuer</var>: Will hold the issuer if any in an allocated buffer.
</p>
<p><var class="var">fmt</var>: The format of the exported issuer.
</p>
<p><var class="var">flags</var>: Use zero or flags from <code class="code">GNUTLS_PKCS11_OBJ_FLAG</code> .
</p>
<p>This function will return the certificate with the given DN and <code class="code">spki</code> , if it
is stored in the token. By default only marked as trusted issuers
are returned. If any issuer should be returned specify
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_ANY</code> in <code class="code">flags</code> .
</p>
<p>The name of the function includes issuer because it can
be used to discover issuers of certificates.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005finit-1"><span>gnutls_pkcs11_init<a class="copiable-link" href="#gnutls_005fpkcs11_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005finit-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_init</strong> <code class="def-code-arguments">(unsigned int <var class="var">flags</var>, const char * <var class="var">deprecated_config_file</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005finit-1"> ¶</a></span></dt>
<dd><p><var class="var">flags</var>: An ORed sequence of <code class="code">GNUTLS_PKCS11_FLAG_</code> *
</p>
<p><var class="var">deprecated_config_file</var>: either NULL or the location of a deprecated
configuration file
</p>
<p>This function will initialize the PKCS 11 subsystem in gnutls. It will
read configuration files if <code class="code">GNUTLS_PKCS11_FLAG_AUTO</code> is used or allow
you to independently load PKCS 11 modules using <code class="code">gnutls_pkcs11_add_provider()</code>
if <code class="code">GNUTLS_PKCS11_FLAG_MANUAL</code> is specified.
</p>
<p>You don’t need to call this function since GnuTLS 3.3.0 because it is being called
during the first request PKCS 11 operation. That call will assume the <code class="code">GNUTLS_PKCS11_FLAG_AUTO</code>
flag. If another flags are required then it must be called independently
prior to any PKCS 11 operation.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fdeinit-1"><span>gnutls_pkcs11_obj_deinit<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs11_obj_deinit</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: The type to be deinitialized
</p>
<p>This function will deinitialize a certificate structure.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fexport-1"><span>gnutls_pkcs11_obj_export<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_export</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: Holds the object
</p>
<p><var class="var">output_data</var>: will contain the object data
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the PKCS11 object data. It is normal for
data to be inaccessible and in that case <code class="code">GNUTLS_E_INVALID_REQUEST</code>
will be returned.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fexport2-1"><span>gnutls_pkcs11_obj_export2<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fexport2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_export2</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fexport2"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: Holds the object
</p>
<p><var class="var">out</var>: will contain the object data
</p>
<p>This function will export the PKCS11 object data. It is normal for
data to be inaccessible and in that case <code class="code">GNUTLS_E_INVALID_REQUEST</code>
will be returned.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fexport3-1"><span>gnutls_pkcs11_obj_export3<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fexport3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fexport3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fexport3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_export3</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fexport3"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: Holds the object
</p>
<p><var class="var">fmt</var>: The format of the exported data
</p>
<p><var class="var">out</var>: will contain the object data
</p>
<p>This function will export the PKCS11 object data. It is normal for
data to be inaccessible and in that case <code class="code">GNUTLS_E_INVALID_REQUEST</code>
will be returned.
</p>
<p>The output buffer is allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and <code class="code">GNUTLS_E_SUCCESS</code> (0) on success.
</p>
<p><strong class="strong">Since:</strong> 3.2.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fexport_005furl-1"><span>gnutls_pkcs11_obj_export_url<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fexport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fexport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fexport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_export_url</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_pkcs11_url_type_t <var class="var">detailed</var>, char ** <var class="var">url</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fexport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: Holds the PKCS 11 certificate
</p>
<p><var class="var">detailed</var>: non zero if a detailed URL is required
</p>
<p><var class="var">url</var>: will contain an allocated url
</p>
<p>This function will export a URL identifying the given object.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fflags_005fget_005fstr-1"><span>gnutls_pkcs11_obj_flags_get_str<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fflags_005fget_005fstr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fflags_005fget_005fstr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fflags_005fget_005fstr"><span class="category-def">Function: </span><span><code class="def-type">char *</code> <strong class="def-name">gnutls_pkcs11_obj_flags_get_str</strong> <code class="def-code-arguments">(unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fflags_005fget_005fstr"> ¶</a></span></dt>
<dd><p><var class="var">flags</var>: holds the flags
</p>
<p>This function given an or-sequence of <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK</code> ,
will return an allocated string with its description. The string
needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> If flags is zero <code class="code">NULL</code> is returned, otherwise an allocated string.
</p>
<p><strong class="strong">Since:</strong> 3.3.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fget_005fexts-1"><span>gnutls_pkcs11_obj_get_exts<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fget_005fexts-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fget_005fexts"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fget_005fexts"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_get_exts</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_x509_ext_st ** <var class="var">exts</var>, unsigned int * <var class="var">exts_size</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fget_005fexts"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: should contain a <code class="code">gnutls_pkcs11_obj_t</code> type
</p>
<p><var class="var">exts</var>: a pointer to a <code class="code">gnutls_x509_ext_st</code> pointer
</p>
<p><var class="var">exts_size</var>: will be updated with the number of <code class="code">exts</code>
</p>
<p><var class="var">flags</var>: Or sequence of <code class="code">GNUTLS_PKCS11_OBJ_</code> * flags
</p>
<p>This function will return information about attached extensions
that associate to the provided object (which should be a certificate).
The extensions are the attached p11-kit trust module extensions.
</p>
<p>Each element of <code class="code">exts</code> must be deinitialized using <code class="code">gnutls_x509_ext_deinit()</code>
while <code class="code">exts</code> should be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.3.8
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fget_005fflags-1"><span>gnutls_pkcs11_obj_get_flags<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fget_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fget_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fget_005fflags"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_get_flags</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, unsigned int * <var class="var">oflags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fget_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: The pkcs11 object
</p>
<p><var class="var">oflags</var>: Will hold the output flags
</p>
<p>This function will return the flags of the object.
The <code class="code">oflags</code> will be flags from <code class="code">gnutls_pkcs11_obj_flags</code> . That is,
the <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_</code> * flags.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fget_005finfo-1"><span>gnutls_pkcs11_obj_get_info<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fget_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fget_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fget_005finfo-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_get_info</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_pkcs11_obj_info_t <var class="var">itype</var>, void * <var class="var">output</var>, size_t * <var class="var">output_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fget_005finfo-1"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: should contain a <code class="code">gnutls_pkcs11_obj_t</code> type
</p>
<p><var class="var">itype</var>: Denotes the type of information requested
</p>
<p><var class="var">output</var>: where output will be stored
</p>
<p><var class="var">output_size</var>: contains the maximum size of the output buffer and will be
overwritten with the actual size.
</p>
<p>This function will return information about the PKCS11 certificate
such as the label, id as well as token information where the key is
stored.
</p>
<p>When output is text, a null terminated string is written to <code class="code">output</code> and its
string length is written to <code class="code">output_size</code> (without null terminator). If the
buffer is too small, <code class="code">output_size</code> will contain the expected buffer size
(with null terminator for text) and return <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> .
</p>
<p>In versions previously to 3.6.0 this function included the null terminator
to <code class="code">output_size</code> . After 3.6.0 the output size doesn’t include the terminator character.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fget_005fptr-1"><span>gnutls_pkcs11_obj_get_ptr<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fget_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fget_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fget_005fptr-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_get_ptr</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, void ** <var class="var">ptr</var>, void ** <var class="var">session</var>, void ** <var class="var">ohandle</var>, unsigned long * <var class="var">slot_id</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fget_005fptr-1"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: should contain a <code class="code">gnutls_pkcs11_obj_t</code> type
</p>
<p><var class="var">ptr</var>: will contain the CK_FUNCTION_LIST_PTR pointer (may be <code class="code">NULL</code> )
</p>
<p><var class="var">session</var>: will contain the CK_SESSION_HANDLE of the object
</p>
<p><var class="var">ohandle</var>: will contain the CK_OBJECT_HANDLE of the object
</p>
<p><var class="var">slot_id</var>: the identifier of the slot (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: Or sequence of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>Obtains the PKCS<code class="code">11</code> session handles of an object. <code class="code">session</code> and <code class="code">ohandle</code> must be deinitialized by the caller. The returned pointers are
independent of the <code class="code">obj</code> lifetime.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fget_005ftype-1"><span>gnutls_pkcs11_obj_get_type<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fget_005ftype-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fget_005ftype"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fget_005ftype"><span class="category-def">Function: </span><span><code class="def-type">gnutls_pkcs11_obj_type_t</code> <strong class="def-name">gnutls_pkcs11_obj_get_type</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fget_005ftype"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: Holds the PKCS 11 object
</p>
<p>This function will return the type of the object being
stored in the structure.
</p>
<p><strong class="strong">Returns:</strong> The type of the object
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fimport_005furl-1"><span>gnutls_pkcs11_obj_import_url<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fimport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fimport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fimport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_import_url</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fimport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: The structure to store the object
</p>
<p><var class="var">url</var>: a PKCS 11 url identifying the key
</p>
<p><var class="var">flags</var>: Or sequence of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will "import" a PKCS 11 URL identifying an object (e.g. certificate)
to the <code class="code">gnutls_pkcs11_obj_t</code> type. This does not involve any
parsing (such as X.509 or OpenPGP) since the <code class="code">gnutls_pkcs11_obj_t</code> is
format agnostic. Only data are transferred.
</p>
<p>If the flag <code class="code">GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT</code> is specified
any certificate read, will have its extensions overwritten by any
stapled extensions in the trust module.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005finit-1"><span>gnutls_pkcs11_obj_init<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_init</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t * <var class="var">obj</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005finit"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a pkcs11 certificate structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl3-1"><span>gnutls_pkcs11_obj_list_import_url3<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_list_import_url3</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t * <var class="var">p_list</var>, unsigned int * <var class="var">n_list</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl3"> ¶</a></span></dt>
<dd><p><var class="var">p_list</var>: An uninitialized object list (may be <code class="code">NULL</code> )
</p>
<p><var class="var">n_list</var>: Initially should hold the maximum size of the list. Will contain the actual size.
</p>
<p><var class="var">url</var>: A PKCS 11 url identifying a set of objects
</p>
<p><var class="var">flags</var>: Or sequence of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will initialize and set values to an object list
by using all objects identified by a PKCS 11 URL.
</p>
<p>This function will enumerate all the objects specified by the PKCS<code class="code">11</code> URL
provided. It expects an already allocated <code class="code">p_list</code> which has * <code class="code">n_list</code> elements,
and that value will be updated to the actual number of present objects. The
<code class="code">p_list</code> objects will be initialized and set by this function.
To obtain a list of all available objects use a <code class="code">url</code> of ’pkcs11:’.
</p>
<p>All returned objects must be deinitialized using <code class="code">gnutls_pkcs11_obj_deinit()</code> .
</p>
<p>The supported in this function <code class="code">flags</code> are <code class="code">GNUTLS_PKCS11_OBJ_FLAG_LOGIN</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_PRESENT_IN_TRUSTED_MODULE</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_CRT</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_PUBKEY</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_WITH_PRIVKEY</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_CA</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED</code> , and since 3.5.1 the <code class="code">GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT</code> .
</p>
<p>On versions of GnuTLS prior to 3.4.0 the equivalent function was
<code class="code">gnutls_pkcs11_obj_list_import_url()</code> . That is also available on this version
as a macro which maps to this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl4-1"><span>gnutls_pkcs11_obj_list_import_url4<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl4-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl4"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl4"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_list_import_url4</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t ** <var class="var">p_list</var>, unsigned int * <var class="var">n_list</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl4"> ¶</a></span></dt>
<dd><p><var class="var">p_list</var>: An uninitialized object list (may be NULL)
</p>
<p><var class="var">n_list</var>: It will contain the size of the list.
</p>
<p><var class="var">url</var>: A PKCS 11 url identifying a set of objects
</p>
<p><var class="var">flags</var>: Or sequence of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will enumerate all the objects specified by the PKCS<code class="code">11</code> URL
provided. It will initialize and set values to the object pointer list ( <code class="code">p_list</code> )
provided. To obtain a list of all available objects use a <code class="code">url</code> of ’pkcs11:’.
</p>
<p>All returned objects must be deinitialized using <code class="code">gnutls_pkcs11_obj_deinit()</code> ,
and <code class="code">p_list</code> must be deinitialized using <code class="code">gnutls_free()</code> .
</p>
<p>The supported in this function <code class="code">flags</code> are <code class="code">GNUTLS_PKCS11_OBJ_FLAG_LOGIN</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_PRESENT_IN_TRUSTED_MODULE</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_CRT</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_PUBKEY</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_WITH_PRIVKEY</code> , <code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_CA</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED</code> , and since 3.5.1 the <code class="code">GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT</code> .
</p>
<p>On versions of GnuTLS prior to 3.4.0 the equivalent function was
<code class="code">gnutls_pkcs11_obj_list_import_url2()</code> . That is also available on this version
as a macro which maps to this function.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fset_005finfo-1"><span>gnutls_pkcs11_obj_set_info<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fset_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fset_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fset_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_obj_set_info</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_pkcs11_obj_info_t <var class="var">itype</var>, const void * <var class="var">data</var>, size_t <var class="var">data_size</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fset_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: should contain a <code class="code">gnutls_pkcs11_obj_t</code> type
</p>
<p><var class="var">itype</var>: Denotes the type of information to be set
</p>
<p><var class="var">data</var>: the data to set
</p>
<p><var class="var">data_size</var>: the size of data
</p>
<p><var class="var">flags</var>: Or sequence of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will set attributes on the provided object.
Available options for <code class="code">itype</code> are <code class="code">GNUTLS_PKCS11_OBJ_LABEL</code> ,
<code class="code">GNUTLS_PKCS11_OBJ_ID_HEX</code> , and <code class="code">GNUTLS_PKCS11_OBJ_ID</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fobj_005fset_005fpin_005ffunction-1"><span>gnutls_pkcs11_obj_set_pin_function<a class="copiable-link" href="#gnutls_005fpkcs11_005fobj_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fobj_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fobj_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs11_obj_set_pin_function</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_t <var class="var">obj</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fobj_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">obj</var>: The object structure
</p>
<p><var class="var">fn</var>: the callback
</p>
<p><var class="var">userdata</var>: data associated with the callback
</p>
<p>This function will set a callback function to be used when
required to access the object. This function overrides the global
set using <code class="code">gnutls_pkcs11_set_pin_function()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fcpy-1"><span>gnutls_pkcs11_privkey_cpy<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fcpy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fcpy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fcpy"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_cpy</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">dst</var>, gnutls_pkcs11_privkey_t <var class="var">src</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fcpy"> ¶</a></span></dt>
<dd><p><var class="var">dst</var>: The destination key, which should be initialized.
</p>
<p><var class="var">src</var>: The source key
</p>
<p>This function will copy a private key from source to destination
key. Destination has to be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fdeinit-1"><span>gnutls_pkcs11_privkey_deinit<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs11_privkey_deinit</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: the key to be deinitialized
</p>
<p>This function will deinitialize a private key structure.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fexport_005fpubkey-1"><span>gnutls_pkcs11_privkey_export_pubkey<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fexport_005fpubkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fexport_005fpubkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fexport_005fpubkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_export_pubkey</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">pkey</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>, gnutls_datum_t * <var class="var">data</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fexport_005fpubkey"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">fmt</var>: the format of output params. PEM or DER.
</p>
<p><var class="var">data</var>: will hold the public key
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will extract the public key (modulus and public
exponent) from the private key specified by the <code class="code">url</code> private key.
This public key will be stored in <code class="code">pubkey</code> in the format specified
by <code class="code">fmt</code> . <code class="code">pubkey</code> should be deinitialized using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fexport_005furl-1"><span>gnutls_pkcs11_privkey_export_url<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fexport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fexport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fexport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_export_url</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">key</var>, gnutls_pkcs11_url_type_t <var class="var">detailed</var>, char ** <var class="var">url</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fexport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the PKCS 11 key
</p>
<p><var class="var">detailed</var>: non zero if a detailed URL is required
</p>
<p><var class="var">url</var>: will contain an allocated url
</p>
<p>This function will export a URL identifying the given key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fgenerate-1"><span>gnutls_pkcs11_privkey_generate<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fgenerate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fgenerate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fgenerate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_generate</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, gnutls_pk_algorithm_t <var class="var">pk</var>, unsigned int <var class="var">bits</var>, const char * <var class="var">label</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fgenerate"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: a token URL
</p>
<p><var class="var">pk</var>: the public key algorithm
</p>
<p><var class="var">bits</var>: the security bits
</p>
<p><var class="var">label</var>: a label
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will generate a private key in the specified
by the <code class="code">url</code> token. The private key will be generate within
the token and will not be exportable.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fgenerate2-1"><span>gnutls_pkcs11_privkey_generate2<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fgenerate2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fgenerate2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fgenerate2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_generate2</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, gnutls_pk_algorithm_t <var class="var">pk</var>, unsigned int <var class="var">bits</var>, const char * <var class="var">label</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>, gnutls_datum_t * <var class="var">pubkey</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fgenerate2"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: a token URL
</p>
<p><var class="var">pk</var>: the public key algorithm
</p>
<p><var class="var">bits</var>: the security bits
</p>
<p><var class="var">label</var>: a label
</p>
<p><var class="var">fmt</var>: the format of output params. PEM or DER
</p>
<p><var class="var">pubkey</var>: will hold the public key (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: zero or an OR’ed sequence of <code class="code">GNUTLS_PKCS11_OBJ_FLAGs</code>
</p>
<p>This function will generate a private key in the specified
by the <code class="code">url</code> token. The private key will be generate within
the token and will not be exportable. This function will
store the DER-encoded public key in the SubjectPublicKeyInfo format
in <code class="code">pubkey</code> . The <code class="code">pubkey</code> should be deinitialized using <code class="code">gnutls_free()</code> .
</p>
<p>Note that when generating an elliptic curve key, the curve
can be substituted in the place of the bits parameter using the
<code class="code">GNUTLS_CURVE_TO_BITS()</code> macro.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fgenerate3-1"><span>gnutls_pkcs11_privkey_generate3<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fgenerate3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fgenerate3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fgenerate3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_generate3</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, gnutls_pk_algorithm_t <var class="var">pk</var>, unsigned int <var class="var">bits</var>, const char * <var class="var">label</var>, const gnutls_datum_t * <var class="var">cid</var>, gnutls_x509_crt_fmt_t <var class="var">fmt</var>, gnutls_datum_t * <var class="var">pubkey</var>, unsigned int <var class="var">key_usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fgenerate3"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: a token URL
</p>
<p><var class="var">pk</var>: the public key algorithm
</p>
<p><var class="var">bits</var>: the security bits
</p>
<p><var class="var">label</var>: a label
</p>
<p><var class="var">cid</var>: The CKA_ID to use for the new object
</p>
<p><var class="var">fmt</var>: the format of output params. PEM or DER
</p>
<p><var class="var">pubkey</var>: will hold the public key (may be <code class="code">NULL</code> )
</p>
<p><var class="var">key_usage</var>: One of GNUTLS_KEY_*
</p>
<p><var class="var">flags</var>: zero or an OR’ed sequence of <code class="code">GNUTLS_PKCS11_OBJ_FLAGs</code>
</p>
<p>This function will generate a private key in the specified
by the <code class="code">url</code> token. The private key will be generate within
the token and will not be exportable. This function will
store the DER-encoded public key in the SubjectPublicKeyInfo format
in <code class="code">pubkey</code> . The <code class="code">pubkey</code> should be deinitialized using <code class="code">gnutls_free()</code> .
</p>
<p>Note that when generating an elliptic curve key, the curve
can be substituted in the place of the bits parameter using the
<code class="code">GNUTLS_CURVE_TO_BITS()</code> macro.
</p>
<p>Since 3.6.3 the objects are marked as sensitive by default unless
<code class="code">GNUTLS_PKCS11_OBJ_FLAG_MARK_NOT_SENSITIVE</code> is specified.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fget_005finfo-1"><span>gnutls_pkcs11_privkey_get_info<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fget_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fget_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fget_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_get_info</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">pkey</var>, gnutls_pkcs11_obj_info_t <var class="var">itype</var>, void * <var class="var">output</var>, size_t * <var class="var">output_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fget_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: should contain a <code class="code">gnutls_pkcs11_privkey_t</code> type
</p>
<p><var class="var">itype</var>: Denotes the type of information requested
</p>
<p><var class="var">output</var>: where output will be stored
</p>
<p><var class="var">output_size</var>: contains the maximum size of the output and will be overwritten with actual
</p>
<p>This function will return information about the PKCS 11 private key such
as the label, id as well as token information where the key is stored. When
output is text it returns null terminated string although <code class="code">output_size</code> contains
the size of the actual data only.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fget_005fpk_005falgorithm-1"><span>gnutls_pkcs11_privkey_get_pk_algorithm<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fget_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fget_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fget_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_get_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">key</var>, unsigned int * <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fget_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_pkcs11_privkey_t</code> type
</p>
<p><var class="var">bits</var>: if bits is non null it will hold the size of the parameters’ in bits
</p>
<p>This function will return the public key algorithm of a private
key.
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_pk_algorithm_t</code> enumeration on
success, or a negative error code on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fimport_005furl-1"><span>gnutls_pkcs11_privkey_import_url<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fimport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fimport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fimport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_import_url</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">pkey</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fimport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">url</var>: a PKCS 11 url identifying the key
</p>
<p><var class="var">flags</var>: Or sequence of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will "import" a PKCS 11 URL identifying a private
key to the <code class="code">gnutls_pkcs11_privkey_t</code> type. In reality since
in most cases keys cannot be exported, the private key structure
is being associated with the available operations on the token.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005finit-1"><span>gnutls_pkcs11_privkey_init<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_privkey_init</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005finit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize an private key structure. This
structure can be used for accessing an underlying PKCS<code class="code">11</code> object.
</p>
<p>In versions of GnuTLS later than 3.5.11 the object is protected
using locks and a single <code class="code">gnutls_pkcs11_privkey_t</code> can be re-used
by many threads. However, for performance it is recommended to utilize
one object per key per thread.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fset_005fpin_005ffunction-1"><span>gnutls_pkcs11_privkey_set_pin_function<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs11_privkey_set_pin_function</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">key</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The private key
</p>
<p><var class="var">fn</var>: the callback
</p>
<p><var class="var">userdata</var>: data associated with the callback
</p>
<p>This function will set a callback function to be used when
required to access the object. This function overrides the global
set using <code class="code">gnutls_pkcs11_set_pin_function()</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fprivkey_005fstatus-1"><span>gnutls_pkcs11_privkey_status<a class="copiable-link" href="#gnutls_005fpkcs11_005fprivkey_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fprivkey_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fprivkey_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_pkcs11_privkey_status</strong> <code class="def-code-arguments">(gnutls_pkcs11_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fprivkey_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p>Checks the status of the private key token.
</p>
<p><strong class="strong">Returns:</strong> this function will return non-zero if the token
holding the private key is still available (inserted), and zero otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.1.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005freinit-1"><span>gnutls_pkcs11_reinit<a class="copiable-link" href="#gnutls_005fpkcs11_005freinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005freinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005freinit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_reinit</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005freinit"> ¶</a></span></dt>
<dd>
<p>This function will reinitialize the PKCS 11 subsystem in gnutls.
This is required by PKCS 11 when an application uses <code class="code">fork()</code> . The
reinitialization function must be called on the child.
</p>
<p>Note that since GnuTLS 3.3.0, the reinitialization of the PKCS <code class="code">11</code>
subsystem occurs automatically after fork.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fset_005fpin_005ffunction-1"><span>gnutls_pkcs11_set_pin_function<a class="copiable-link" href="#gnutls_005fpkcs11_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs11_set_pin_function</strong> <code class="def-code-arguments">(gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">fn</var>: The PIN callback, a <code class="code">gnutls_pin_callback_t()</code> function.
</p>
<p><var class="var">userdata</var>: data to be supplied to callback
</p>
<p>This function will set a callback function to be used when a PIN is
required for PKCS 11 operations. See
<code class="code">gnutls_pin_callback_t()</code> on how the callback should behave.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005fset_005ftoken_005ffunction-1"><span>gnutls_pkcs11_set_token_function<a class="copiable-link" href="#gnutls_005fpkcs11_005fset_005ftoken_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005fset_005ftoken_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005fset_005ftoken_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pkcs11_set_token_function</strong> <code class="def-code-arguments">(gnutls_pkcs11_token_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005fset_005ftoken_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">fn</var>: The token callback
</p>
<p><var class="var">userdata</var>: data to be supplied to callback
</p>
<p>This function will set a callback function to be used when a token
needs to be inserted to continue PKCS 11 operations.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fcheck_005fmechanism-1"><span>gnutls_pkcs11_token_check_mechanism<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fcheck_005fmechanism-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fcheck_005fmechanism"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fcheck_005fmechanism"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_pkcs11_token_check_mechanism</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, unsigned long <var class="var">mechanism</var>, void * <var class="var">ptr</var>, unsigned <var class="var">psize</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fcheck_005fmechanism"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: should contain a PKCS 11 URL
</p>
<p><var class="var">mechanism</var>: The PKCS <code class="code">11</code> mechanism ID
</p>
<p><var class="var">ptr</var>: if set it should point to a CK_MECHANISM_INFO struct
</p>
<p><var class="var">psize</var>: the size of CK_MECHANISM_INFO struct (for safety)
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return whether a mechanism is supported
by the given token. If the mechanism is supported and
<code class="code">ptr</code> is set, it will be updated with the token information.
</p>
<p><strong class="strong">Returns:</strong> Non-zero if the mechanism is supported or zero otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fget_005fflags-1"><span>gnutls_pkcs11_token_get_flags<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fget_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fget_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fget_005fflags"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_get_flags</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, unsigned int * <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: should contain a PKCS 11 URL
</p>
<p><var class="var">flags</var>: The output flags (GNUTLS_PKCS11_TOKEN_*)
</p>
<p>This function will return information about the PKCS 11 token flags.
</p>
<p>The supported flags are: <code class="code">GNUTLS_PKCS11_TOKEN_HW</code> and <code class="code">GNUTLS_PKCS11_TOKEN_TRUSTED</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fget_005finfo-1"><span>gnutls_pkcs11_token_get_info<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fget_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fget_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fget_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_get_info</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, gnutls_pkcs11_token_info_t <var class="var">ttype</var>, void * <var class="var">output</var>, size_t * <var class="var">output_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fget_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: should contain a PKCS 11 URL
</p>
<p><var class="var">ttype</var>: Denotes the type of information requested
</p>
<p><var class="var">output</var>: where output will be stored
</p>
<p><var class="var">output_size</var>: contains the maximum size of the output buffer and will be
overwritten with the actual size.
</p>
<p>This function will return information about the PKCS 11 token such
as the label, id, etc.
</p>
<p>When output is text, a null terminated string is written to <code class="code">output</code> and its
string length is written to <code class="code">output_size</code> (without null terminator). If the
buffer is too small, <code class="code">output_size</code> will contain the expected buffer size
(with null terminator for text) and return <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fget_005fmechanism-1"><span>gnutls_pkcs11_token_get_mechanism<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fget_005fmechanism-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fget_005fmechanism"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fget_005fmechanism"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_get_mechanism</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, unsigned int <var class="var">idx</var>, unsigned long * <var class="var">mechanism</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fmechanism"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: should contain a PKCS 11 URL
</p>
<p><var class="var">idx</var>: The index of the mechanism
</p>
<p><var class="var">mechanism</var>: The PKCS <code class="code">11</code> mechanism ID
</p>
<p>This function will return the names of the supported mechanisms
by the token. It should be called with an increasing index until
it return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fget_005fptr-1"><span>gnutls_pkcs11_token_get_ptr<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fget_005fptr-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fget_005fptr"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fget_005fptr-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_get_ptr</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, void ** <var class="var">ptr</var>, unsigned long * <var class="var">slot_id</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fptr-1"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: should contain a PKCS<code class="code">11</code> URL identifying a token
</p>
<p><var class="var">ptr</var>: will contain the CK_FUNCTION_LIST_PTR pointer
</p>
<p><var class="var">slot_id</var>: will contain the slot_id (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will return the function pointer of the specified
token by the URL. The returned pointers are valid until
gnutls is deinitialized, c.f. <code class="code">_global_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success or a negative error code
on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fget_005frandom-1"><span>gnutls_pkcs11_token_get_random<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fget_005frandom-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fget_005frandom"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fget_005frandom"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_get_random</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, void * <var class="var">rnddata</var>, size_t <var class="var">len</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fget_005frandom"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">rnddata</var>: A pointer to the memory area to be filled with random data
</p>
<p><var class="var">len</var>: The number of bytes of randomness to request
</p>
<p>This function will get random data from the given token.
It will store rnddata and fill the memory pointed to by rnddata with
len random bytes from the token.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fget_005furl-1"><span>gnutls_pkcs11_token_get_url<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fget_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fget_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fget_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_get_url</strong> <code class="def-code-arguments">(unsigned int <var class="var">seq</var>, gnutls_pkcs11_url_type_t <var class="var">detailed</var>, char ** <var class="var">url</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fget_005furl"> ¶</a></span></dt>
<dd><p><var class="var">seq</var>: sequence number starting from 0
</p>
<p><var class="var">detailed</var>: non zero if a detailed URL is required
</p>
<p><var class="var">url</var>: will contain an allocated url
</p>
<p>This function will return the URL for each token available
in system. The url has to be released using <code class="code">gnutls_free()</code>
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned,
<code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> if the sequence number
exceeds the available tokens, otherwise a negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005finit-1"><span>gnutls_pkcs11_token_init<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_init</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, const char * <var class="var">so_pin</var>, const char * <var class="var">label</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005finit"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">so_pin</var>: Security Officer’s PIN
</p>
<p><var class="var">label</var>: A name to be used for the token, at most 32 characters
</p>
<p>This function will initialize (format) a token. If the token is
at a factory defaults state the security officer’s PIN given will be
set to be the default. Otherwise it should match the officer’s PIN.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftoken_005fset_005fpin-1"><span>gnutls_pkcs11_token_set_pin<a class="copiable-link" href="#gnutls_005fpkcs11_005ftoken_005fset_005fpin-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftoken_005fset_005fpin"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftoken_005fset_005fpin"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pkcs11_token_set_pin</strong> <code class="def-code-arguments">(const char * <var class="var">token_url</var>, const char * <var class="var">oldpin</var>, const char * <var class="var">newpin</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftoken_005fset_005fpin"> ¶</a></span></dt>
<dd><p><var class="var">token_url</var>: A PKCS <code class="code">11</code> URL specifying a token
</p>
<p><var class="var">oldpin</var>: old user’s PIN
</p>
<p><var class="var">newpin</var>: new user’s PIN
</p>
<p><var class="var">flags</var>: one of <code class="code">gnutls_pin_flag_t</code> .
</p>
<p>This function will modify or set a user or administrator’s PIN for
the given token. If it is called to set a PIN for first time
the oldpin must be <code class="code">NULL</code> . When setting the admin’s PIN with the
<code class="code">GNUTLS_PIN_SO</code> flag, the <code class="code">oldpin</code> value must be provided (this requirement
is relaxed after GnuTLS 3.6.5 since which the PIN will be requested if missing).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpkcs11_005ftype_005fget_005fname-1"><span>gnutls_pkcs11_type_get_name<a class="copiable-link" href="#gnutls_005fpkcs11_005ftype_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpkcs11_005ftype_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpkcs11_005ftype_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_pkcs11_type_get_name</strong> <code class="def-code-arguments">(gnutls_pkcs11_obj_type_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-gnutls_005fpkcs11_005ftype_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">type</var>: Holds the PKCS 11 object type, a <code class="code">gnutls_pkcs11_obj_type_t</code> .
</p>
<p>This function will return a human readable description of the
PKCS11 object type <code class="code">obj</code> . It will return "Unknown" for unknown
types.
</p>
<p><strong class="strong">Returns:</strong> human readable string labeling the PKCS11 object type
<code class="code">type</code> .
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fimport_005fpkcs11-1"><span>gnutls_x509_crt_import_pkcs11<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fimport_005fpkcs11-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fimport_005fpkcs11"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fimport_005fpkcs11"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_import_pkcs11</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_pkcs11_obj_t <var class="var">pkcs11_crt</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fimport_005fpkcs11"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: A certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">pkcs11_crt</var>: A PKCS 11 object that contains a certificate
</p>
<p>This function will import a PKCS 11 certificate to a <code class="code">gnutls_x509_crt_t</code>
structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005flist_005fimport_005fpkcs11-1"><span>gnutls_x509_crt_list_import_pkcs11<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005flist_005fimport_005fpkcs11-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005flist_005fimport_005fpkcs11"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005flist_005fimport_005fpkcs11"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_list_import_pkcs11</strong> <code class="def-code-arguments">(gnutls_x509_crt_t * <var class="var">certs</var>, unsigned int <var class="var">cert_max</var>, gnutls_pkcs11_obj_t *const <var class="var">objs</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005flist_005fimport_005fpkcs11"> ¶</a></span></dt>
<dd><p><var class="var">certs</var>: A list of certificates of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">cert_max</var>: The maximum size of the list
</p>
<p><var class="var">objs</var>: A list of PKCS 11 objects
</p>
<p><var class="var">flags</var>: 0 for now
</p>
<p>This function will import a PKCS 11 certificate list to a list of
<code class="code">gnutls_x509_crt_t</code> type. These must not be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="TPM-API">
<div class="nav-panel">
<p>
Next: <a href="#Abstract-key-API" accesskey="n" rel="next">Abstract key API</a>, Previous: <a href="#PKCS-11-API" accesskey="p" rel="prev">Hardware token via PKCS 11 API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="TPM-API-1"><span>E.8 TPM API<a class="copiable-link" href="#TPM-API-1"> ¶</a></span></h3>
<p>The following functions are to be used for TPM handling.
Their prototypes lie in <samp class="file">gnutls/tpm.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005ftpm_005fget_005fregistered-1"><span>gnutls_tpm_get_registered<a class="copiable-link" href="#gnutls_005ftpm_005fget_005fregistered-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftpm_005fget_005fregistered"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fget_005fregistered"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tpm_get_registered</strong> <code class="def-code-arguments">(gnutls_tpm_key_list_t * <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fget_005fregistered"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: a list to store the keys
</p>
<p>This function will get a list of stored keys in the TPM. The uuid
of those keys
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftpm_005fkey_005flist_005fdeinit-1"><span>gnutls_tpm_key_list_deinit<a class="copiable-link" href="#gnutls_005ftpm_005fkey_005flist_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftpm_005fkey_005flist_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fkey_005flist_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_tpm_key_list_deinit</strong> <code class="def-code-arguments">(gnutls_tpm_key_list_t <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fkey_005flist_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: a list of the keys
</p>
<p>This function will deinitialize the list of stored keys in the TPM.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftpm_005fkey_005flist_005fget_005furl-1"><span>gnutls_tpm_key_list_get_url<a class="copiable-link" href="#gnutls_005ftpm_005fkey_005flist_005fget_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftpm_005fkey_005flist_005fget_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fkey_005flist_005fget_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tpm_key_list_get_url</strong> <code class="def-code-arguments">(gnutls_tpm_key_list_t <var class="var">list</var>, unsigned int <var class="var">idx</var>, char ** <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fkey_005flist_005fget_005furl"> ¶</a></span></dt>
<dd><p><var class="var">list</var>: a list of the keys
</p>
<p><var class="var">idx</var>: The index of the key (starting from zero)
</p>
<p><var class="var">url</var>: The URL to be returned
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will return for each given index a URL of
the corresponding key.
If the provided index is out of bounds then <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code>
is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftpm_005fprivkey_005fdelete-1"><span>gnutls_tpm_privkey_delete<a class="copiable-link" href="#gnutls_005ftpm_005fprivkey_005fdelete-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftpm_005fprivkey_005fdelete"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fprivkey_005fdelete-2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tpm_privkey_delete</strong> <code class="def-code-arguments">(const char * <var class="var">url</var>, const char * <var class="var">srk_password</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fprivkey_005fdelete-2"> ¶</a></span></dt>
<dd><p><var class="var">url</var>: the URL describing the key
</p>
<p><var class="var">srk_password</var>: a password for the SRK key
</p>
<p>This function will unregister the private key from the TPM
chip.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005ftpm_005fprivkey_005fgenerate-1"><span>gnutls_tpm_privkey_generate<a class="copiable-link" href="#gnutls_005ftpm_005fprivkey_005fgenerate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftpm_005fprivkey_005fgenerate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftpm_005fprivkey_005fgenerate-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_tpm_privkey_generate</strong> <code class="def-code-arguments">(gnutls_pk_algorithm_t <var class="var">pk</var>, unsigned int <var class="var">bits</var>, const char * <var class="var">srk_password</var>, const char * <var class="var">key_password</var>, gnutls_tpmkey_fmt_t <var class="var">format</var>, gnutls_x509_crt_fmt_t <var class="var">pub_format</var>, gnutls_datum_t * <var class="var">privkey</var>, gnutls_datum_t * <var class="var">pubkey</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005ftpm_005fprivkey_005fgenerate-1"> ¶</a></span></dt>
<dd><p><var class="var">pk</var>: the public key algorithm
</p>
<p><var class="var">bits</var>: the security bits
</p>
<p><var class="var">srk_password</var>: a password to protect the exported key (optional)
</p>
<p><var class="var">key_password</var>: the password for the TPM (optional)
</p>
<p><var class="var">format</var>: the format of the private key
</p>
<p><var class="var">pub_format</var>: the format of the public key
</p>
<p><var class="var">privkey</var>: the generated key
</p>
<p><var class="var">pubkey</var>: the corresponding public key (may be null)
</p>
<p><var class="var">flags</var>: should be a list of GNUTLS_TPM_* flags
</p>
<p>This function will generate a private key in the TPM
chip. The private key will be generated within the chip
and will be exported in a wrapped with TPM’s master key
form. Furthermore the wrapped key can be protected with
the provided <code class="code">password</code> .
</p>
<p>Note that bits in TPM is quantized value. If the input value
is not one of the allowed values, then it will be quantized to
one of 512, 1024, 2048, 4096, 8192 and 16384.
</p>
<p>Allowed flags are:
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Abstract-key-API">
<div class="nav-panel">
<p>
Next: <a href="#Socket-specific-API" accesskey="n" rel="next">Socket specific API</a>, Previous: <a href="#TPM-API" accesskey="p" rel="prev">TPM API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Abstract-key-API-1"><span>E.9 Abstract key API<a class="copiable-link" href="#Abstract-key-API-1"> ¶</a></span></h3>
<p>The following functions are to be used for abstract key handling.
Their prototypes lie in <samp class="file">gnutls/abstract.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fkey-1"><span>gnutls_certificate_set_key<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fkey-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_certificate_set_key</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">res</var>, const char ** <var class="var">names</var>, int <var class="var">names_size</var>, gnutls_pcert_st * <var class="var">pcert_list</var>, int <var class="var">pcert_list_size</var>, gnutls_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fkey-1"> ¶</a></span></dt>
<dd><p><var class="var">res</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">names</var>: is an array of DNS names belonging to the public-key (NULL if none)
</p>
<p><var class="var">names_size</var>: holds the size of the names list
</p>
<p><var class="var">pcert_list</var>: contains a certificate list (chain) or raw public-key
</p>
<p><var class="var">pcert_list_size</var>: holds the size of the certificate list
</p>
<p><var class="var">key</var>: is a <code class="code">gnutls_privkey_t</code> key corresponding to the first public-key in pcert_list
</p>
<p>This function sets a public/private key pair in the
gnutls_certificate_credentials_t type. The given public key may be encapsulated
in a certificate or can be given as a raw key. This function may be
called more than once, in case multiple key pairs exist for
the server. For clients that want to send more than their own end-
entity certificate (e.g., also an intermediate CA cert), the full
certificate chain must be provided in <code class="code">pcert_list</code> .
</p>
<p>Note that the <code class="code">key</code> will become part of the credentials structure and must
not be deallocated. It will be automatically deallocated when the <code class="code">res</code> structure
is deinitialized.
</p>
<p>If this function fails, the <code class="code">res</code> structure is at an undefined state and it must
not be reused to load other keys or certificates.
</p>
<p>Note that, this function by default returns zero on success and a negative value on error.
Since 3.5.6, when the flag <code class="code">GNUTLS_CERTIFICATE_API_V2</code> is set using <code class="code">gnutls_certificate_set_flags()</code>
it returns an index (greater or equal to zero). That index can be used for other functions to refer to the added key-pair.
</p>
<p>Since GnuTLS 3.6.6 this function also handles raw public keys.
</p>
<p><strong class="strong">Returns:</strong> On success this functions returns zero, and otherwise a negative value on error (see above for modifying that behavior).
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fretrieve_005ffunction2-1"><span>gnutls_certificate_set_retrieve_function2<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fretrieve_005ffunction2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction2"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_retrieve_function2</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function2 * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction2"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function sets a callback to be called in order to retrieve the
certificate to be used in the handshake. The callback will take control
only if a certificate is requested by the peer.
</p>
<p>The callback’s function prototype is:
int (*callback)(gnutls_session_t, const gnutls_datum_t* req_ca_dn, int nreqs,
const gnutls_pk_algorithm_t* pk_algos, int pk_algos_length, gnutls_pcert_st** pcert,
unsigned int *pcert_length, gnutls_privkey_t * pkey);
</p>
<p><code class="code">req_ca_dn</code> is only used in X.509 certificates.
Contains a list with the CA names that the server considers trusted.
This is a hint and typically the client should send a certificate that is signed
by one of these CAs. These names, when available, are DER encoded. To get a more
meaningful value use the function <code class="code">gnutls_x509_rdn_get()</code> .
</p>
<p><code class="code">pk_algos</code> contains a list with server’s acceptable public key algorithms.
The certificate returned should support the server’s given algorithms.
</p>
<p><code class="code">pcert</code> should contain a single certificate and public key or a list of them.
</p>
<p><code class="code">pcert_length</code> is the size of the previous list.
</p>
<p><code class="code">pkey</code> is the private key.
</p>
<p>If the callback function is provided then gnutls will call it, in the
handshake, after the certificate request message has been received.
All the provided by the callback values will not be released or
modified by gnutls.
</p>
<p>In server side pk_algos and req_ca_dn are NULL.
</p>
<p>The callback function should set the certificate list to be sent,
and return 0 on success. If no certificate was selected then the
number of certificates should be set to zero. The value (-1)
indicates error and the handshake will be terminated. If both certificates
are set in the credentials and a callback is available, the callback
takes predence.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcertificate_005fset_005fretrieve_005ffunction3-1"><span>gnutls_certificate_set_retrieve_function3<a class="copiable-link" href="#gnutls_005fcertificate_005fset_005fretrieve_005ffunction3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcertificate_005fset_005fretrieve_005ffunction3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction3"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_certificate_set_retrieve_function3</strong> <code class="def-code-arguments">(gnutls_certificate_credentials_t <var class="var">cred</var>, gnutls_certificate_retrieve_function3 * <var class="var">func</var>)</code><a class="copiable-link" href="#index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction3"> ¶</a></span></dt>
<dd><p><var class="var">cred</var>: is a <code class="code">gnutls_certificate_credentials_t</code> type.
</p>
<p><var class="var">func</var>: is the callback function
</p>
<p>This function sets a callback to be called in order to retrieve the
certificate and OCSP responses to be used in the handshake. <code class="code">func</code> will
be called only if the peer requests a certificate either during handshake
or during post-handshake authentication.
</p>
<p>The callback’s function prototype is defined in ‘abstract.h’:
</p>
<p>int gnutls_certificate_retrieve_function3(
gnutls_session_t,
const struct gnutls_cert_retr_st *info,
gnutls_pcert_st **certs,
unsigned int *certs_length,
gnutls_ocsp_data_st **ocsp,
unsigned int *ocsp_length,
gnutls_privkey_t *privkey,
unsigned int *flags);
</p>
<p>The info field of the callback contains:
<code class="code">req_ca_dn</code> which is a list with the CA names that the server considers trusted.
This is a hint and typically the client should send a certificate that is signed
by one of these CAs. These names, when available, are DER encoded. To get a more
meaningful value use the function <code class="code">gnutls_x509_rdn_get()</code> .
<code class="code">pk_algos</code> contains a list with server’s acceptable public key algorithms.
The certificate returned should support the server’s given algorithms.
</p>
<p>The callback should fill-in the following values:
</p>
<p><code class="code">certs</code> should contain an allocated list of certificates and public keys.
<code class="code">certs_length</code> is the size of the previous list.
<code class="code">ocsp</code> should contain an allocated list of OCSP responses.
<code class="code">ocsp_length</code> is the size of the previous list.
<code class="code">privkey</code> is the private key.
</p>
<p>If flags in the callback are set to <code class="code">GNUTLS_CERT_RETR_DEINIT_ALL</code> then
all provided values must be allocated using <code class="code">gnutls_malloc()</code> , and will
be released by gnutls; otherwise they will not be touched by gnutls.
</p>
<p>The callback function should set the certificate and OCSP response
list to be sent, and return 0 on success. If no certificates are available,
the <code class="code">certs_length</code> and <code class="code">ocsp_length</code> should be set to zero. The return
value (-1) indicates error and the handshake will be terminated. If both
certificates are set in the credentials and a callback is available, the
callback takes predence.
</p>
<p>Raw public-keys:
In case raw public-keys are negotiated as certificate type, certificates
that would normally hold the public-key material are not available. In that case,
<code class="code">certs</code> contains an allocated list with only the public key. Since there is no
certificate, there is also no certificate status. Therefore, OCSP information
should not be set.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fdeinit-1"><span>gnutls_pcert_deinit<a class="copiable-link" href="#gnutls_005fpcert_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pcert_deinit</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The structure to be deinitialized
</p>
<p>This function will deinitialize a pcert structure.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fexport_005fopenpgp-1"><span>gnutls_pcert_export_openpgp<a class="copiable-link" href="#gnutls_005fpcert_005fexport_005fopenpgp-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fexport_005fopenpgp"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fexport_005fopenpgp"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_export_openpgp</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, gnutls_openpgp_crt_t * <var class="var">crt</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fexport_005fopenpgp"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure.
</p>
<p><var class="var">crt</var>: An initialized <code class="code">gnutls_openpgp_crt_t</code> .
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fexport_005fx509-1"><span>gnutls_pcert_export_x509<a class="copiable-link" href="#gnutls_005fpcert_005fexport_005fx509-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fexport_005fx509"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fexport_005fx509"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_export_x509</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, gnutls_x509_crt_t * <var class="var">crt</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fexport_005fx509"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure.
</p>
<p><var class="var">crt</var>: An initialized <code class="code">gnutls_x509_crt_t</code> .
</p>
<p>Converts the given <code class="code">gnutls_pcert_t</code> type into a <code class="code">gnutls_x509_crt_t</code> .
This function only works if the type of <code class="code">pcert</code> is <code class="code">GNUTLS_CRT_X509</code> .
When successful, the value written to <code class="code">crt</code> must be freed with
<code class="code">gnutls_x509_crt_deinit()</code> when no longer needed.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fimport_005fopenpgp-1"><span>gnutls_pcert_import_openpgp<a class="copiable-link" href="#gnutls_005fpcert_005fimport_005fopenpgp-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fimport_005fopenpgp"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fimport_005fopenpgp"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_import_openpgp</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, gnutls_openpgp_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fimport_005fopenpgp"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure
</p>
<p><var class="var">crt</var>: The raw certificate to be imported
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fimport_005fopenpgp_005fraw-1"><span>gnutls_pcert_import_openpgp_raw<a class="copiable-link" href="#gnutls_005fpcert_005fimport_005fopenpgp_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fimport_005fopenpgp_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fimport_005fopenpgp_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_import_openpgp_raw</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, const gnutls_datum_t * <var class="var">cert</var>, gnutls_openpgp_crt_fmt_t <var class="var">format</var>, gnutls_openpgp_keyid_t <var class="var">keyid</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fimport_005fopenpgp_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure
</p>
<p><var class="var">cert</var>: The raw certificate to be imported
</p>
<p><var class="var">format</var>: The format of the certificate
</p>
<p><var class="var">keyid</var>: The key ID to use (NULL for the master key)
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fimport_005frawpk-1"><span>gnutls_pcert_import_rawpk<a class="copiable-link" href="#gnutls_005fpcert_005fimport_005frawpk-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fimport_005frawpk"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fimport_005frawpk"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_import_rawpk</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, gnutls_pubkey_t <var class="var">pubkey</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fimport_005frawpk"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure to import the data into.
</p>
<p><var class="var">pubkey</var>: The raw public-key in <code class="code">gnutls_pubkey_t</code> format to be imported
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p>This convenience function will import (i.e. convert) the given raw
public key <code class="code">pubkey</code> into a <code class="code">gnutls_pcert_st</code> structure. The structure
must be deinitialized afterwards using <code class="code">gnutls_pcert_deinit()</code> . The
given <code class="code">pubkey</code> must not be deinitialized because it will be associated
with the given <code class="code">pcert</code> structure and will be deinitialized with it.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fimport_005frawpk_005fraw-1"><span>gnutls_pcert_import_rawpk_raw<a class="copiable-link" href="#gnutls_005fpcert_005fimport_005frawpk_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fimport_005frawpk_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fimport_005frawpk_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_import_rawpk_raw</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, const gnutls_datum_t * <var class="var">rawpubkey</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">key_usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fimport_005frawpk_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure to import the data into.
</p>
<p><var class="var">rawpubkey</var>: The raw public-key in <code class="code">gnutls_datum_t</code> format to be imported.
</p>
<p><var class="var">format</var>: The format of the raw public-key. DER or PEM.
</p>
<p><var class="var">key_usage</var>: An ORed sequence of <code class="code">GNUTLS_KEY_</code> * flags.
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p>This convenience function will import (i.e. convert) the given raw
public key <code class="code">rawpubkey</code> into a <code class="code">gnutls_pcert_st</code> structure. The structure
must be deinitialized afterwards using <code class="code">gnutls_pcert_deinit()</code> .
Note that the caller is responsible for freeing <code class="code">rawpubkey</code> . All necessary
values will be copied into <code class="code">pcert</code> .
</p>
<p>Key usage (as defined by X.509 extension (2.5.29.15)) can be explicitly
set because there is no certificate structure around the key to define
this value. See for more info <code class="code">gnutls_x509_crt_get_key_usage()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fimport_005fx509-1"><span>gnutls_pcert_import_x509<a class="copiable-link" href="#gnutls_005fpcert_005fimport_005fx509-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fimport_005fx509"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fimport_005fx509"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_import_x509</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fimport_005fx509"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure
</p>
<p><var class="var">crt</var>: The certificate to be imported
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p>This convenience function will import the given certificate to a
<code class="code">gnutls_pcert_st</code> structure. The structure must be deinitialized
afterwards using <code class="code">gnutls_pcert_deinit()</code> ;
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fimport_005fx509_005flist-1"><span>gnutls_pcert_import_x509_list<a class="copiable-link" href="#gnutls_005fpcert_005fimport_005fx509_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fimport_005fx509_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fimport_005fx509_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_import_x509_list</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert_list</var>, gnutls_x509_crt_t * <var class="var">crt</var>, unsigned * <var class="var">ncrt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fimport_005fx509_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcert_list</var>: The structures to store the certificates; must not contain initialized <code class="code">gnutls_pcert_st</code> structures.
</p>
<p><var class="var">crt</var>: The certificates to be imported
</p>
<p><var class="var">ncrt</var>: The number of certificates in <code class="code">crt</code> ; will be updated if necessary
</p>
<p><var class="var">flags</var>: zero or <code class="code">GNUTLS_X509_CRT_LIST_SORT</code>
</p>
<p>This convenience function will import the given certificates to an
already allocated set of <code class="code">gnutls_pcert_st</code> structures. The structures must
be deinitialized afterwards using <code class="code">gnutls_pcert_deinit()</code> . <code class="code">pcert_list</code> should contain space for at least <code class="code">ncrt</code> elements.
</p>
<p>In the case <code class="code">GNUTLS_X509_CRT_LIST_SORT</code> is specified and that
function cannot sort the list, <code class="code">GNUTLS_E_CERTIFICATE_LIST_UNSORTED</code>
will be returned. Currently sorting can fail if the list size
exceeds an internal constraint (16).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005fimport_005fx509_005fraw-1"><span>gnutls_pcert_import_x509_raw<a class="copiable-link" href="#gnutls_005fpcert_005fimport_005fx509_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005fimport_005fx509_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005fimport_005fx509_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_import_x509_raw</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert</var>, const gnutls_datum_t * <var class="var">cert</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005fimport_005fx509_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pcert</var>: The pcert structure
</p>
<p><var class="var">cert</var>: The raw certificate to be imported
</p>
<p><var class="var">format</var>: The format of the certificate
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p>This convenience function will import the given certificate to a
<code class="code">gnutls_pcert_st</code> structure. The structure must be deinitialized
afterwards using <code class="code">gnutls_pcert_deinit()</code> ;
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005flist_005fimport_005fx509_005ffile-1"><span>gnutls_pcert_list_import_x509_file<a class="copiable-link" href="#gnutls_005fpcert_005flist_005fimport_005fx509_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005flist_005fimport_005fx509_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005flist_005fimport_005fx509_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_list_import_x509_file</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert_list</var>, unsigned * <var class="var">pcert_list_size</var>, const char * <var class="var">file</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_pin_callback_t <var class="var">pin_fn</var>, void * <var class="var">pin_fn_userdata</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005flist_005fimport_005fx509_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">pcert_list</var>: The structures to store the certificates; must not contain initialized <code class="code">gnutls_pcert_st</code> structures.
</p>
<p><var class="var">pcert_list_size</var>: Initially must hold the maximum number of certs. It will be updated with the number of certs available.
</p>
<p><var class="var">file</var>: A file or supported URI with the certificates to load
</p>
<p><var class="var">format</var>: <code class="code">GNUTLS_X509_FMT_DER</code> or <code class="code">GNUTLS_X509_FMT_PEM</code> if a file is given
</p>
<p><var class="var">pin_fn</var>: a PIN callback if not globally set
</p>
<p><var class="var">pin_fn_userdata</var>: parameter for the PIN callback
</p>
<p><var class="var">flags</var>: zero or flags from <code class="code">gnutls_certificate_import_flags</code>
</p>
<p>This convenience function will import a certificate chain from the given
file or supported URI to <code class="code">gnutls_pcert_st</code> structures. The structures
must be deinitialized afterwards using <code class="code">gnutls_pcert_deinit()</code> .
</p>
<p>This function will always return a sorted certificate chain.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value; if the <code class="code">pcert</code> list doesn’t have enough space
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpcert_005flist_005fimport_005fx509_005fraw-1"><span>gnutls_pcert_list_import_x509_raw<a class="copiable-link" href="#gnutls_005fpcert_005flist_005fimport_005fx509_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpcert_005flist_005fimport_005fx509_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpcert_005flist_005fimport_005fx509_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pcert_list_import_x509_raw</strong> <code class="def-code-arguments">(gnutls_pcert_st * <var class="var">pcert_list</var>, unsigned int * <var class="var">pcert_list_size</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpcert_005flist_005fimport_005fx509_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pcert_list</var>: The structures to store the certificates; must not contain initialized <code class="code">gnutls_pcert_st</code> structures.
</p>
<p><var class="var">pcert_list_size</var>: Initially must hold the maximum number of certs. It will be updated with the number of certs available.
</p>
<p><var class="var">data</var>: The certificates.
</p>
<p><var class="var">format</var>: One of DER or PEM.
</p>
<p><var class="var">flags</var>: must be (0) or an OR’d sequence of gnutls_certificate_import_flags.
</p>
<p>This function will import the provided DER or PEM encoded certificates to an
already allocated set of <code class="code">gnutls_pcert_st</code> structures. The structures must
be deinitialized afterwards using <code class="code">gnutls_pcert_deinit()</code> . <code class="code">pcert_list</code> should contain space for at least <code class="code">pcert_list_size</code> elements.
</p>
<p>If the Certificate is PEM encoded it should have a header of "X509
CERTIFICATE", or "CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value; if the <code class="code">pcert</code> list doesn’t have enough space
<code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will be returned.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fdecrypt_005fdata-1"><span>gnutls_privkey_decrypt_data<a class="copiable-link" href="#gnutls_005fprivkey_005fdecrypt_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fdecrypt_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fdecrypt_005fdata-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_decrypt_data</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">ciphertext</var>, gnutls_datum_t * <var class="var">plaintext</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fdecrypt_005fdata-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p><var class="var">ciphertext</var>: holds the data to be decrypted
</p>
<p><var class="var">plaintext</var>: will contain the decrypted data, allocated with <code class="code">gnutls_malloc()</code>
</p>
<p>This function will decrypt the given data using the algorithm
supported by the private key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fdecrypt_005fdata2-1"><span>gnutls_privkey_decrypt_data2<a class="copiable-link" href="#gnutls_005fprivkey_005fdecrypt_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fdecrypt_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fdecrypt_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_decrypt_data2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">ciphertext</var>, unsigned char * <var class="var">plaintext</var>, size_t <var class="var">plaintext_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fdecrypt_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">flags</var>: zero for now
</p>
<p><var class="var">ciphertext</var>: holds the data to be decrypted
</p>
<p><var class="var">plaintext</var>: a preallocated buffer that will be filled with the plaintext
</p>
<p><var class="var">plaintext_size</var>: in/out size of the plaintext
</p>
<p>This function will decrypt the given data using the algorithm
supported by the private key. Unlike with <code class="code">gnutls_privkey_decrypt_data()</code>
this function operates in constant time and constant memory access.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fdeinit-1"><span>gnutls_privkey_deinit<a class="copiable-link" href="#gnutls_005fprivkey_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_privkey_deinit</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The key to be deinitialized
</p>
<p>This function will deinitialize a private key structure.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fderive_005fsecret-1"><span>gnutls_privkey_derive_secret<a class="copiable-link" href="#gnutls_005fprivkey_005fderive_005fsecret-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fderive_005fsecret"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fderive_005fsecret"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_derive_secret</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">privkey</var>, gnutls_pubkey_t <var class="var">pubkey</var>, const gnutls_datum_t * <var class="var">nonce</var>, gnutls_datum_t * <var class="var">secret</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fderive_005fsecret"> ¶</a></span></dt>
<dd><p><var class="var">privkey</var>: a private key of type <code class="code">gnutls_privkey_t</code>
</p>
<p><var class="var">pubkey</var>: a public key of type <code class="code">gnutls_pubkey_t</code>
</p>
<p><var class="var">nonce</var>: an optional nonce value
</p>
<p><var class="var">secret</var>: where shared secret will be stored
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will calculate a shared secret from our <code class="code">privkey</code> and
peer’s <code class="code">pubkey</code> . The result will be stored in <code class="code">secret</code> , whose data
member should be freed after use using <code class="code">gnutls_free()</code> . <code class="code">privkey</code> and
<code class="code">pubkey</code> must be backed by the X.509 keys.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.8.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fdh_005fraw-1"><span>gnutls_privkey_export_dh_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fdh_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fdh_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fdh_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_dh_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_dh_params_t <var class="var">params</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">x</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fdh_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the private key
</p>
<p><var class="var">params</var>: will hold the Diffie-Hellman parameters (optional), must be initialized
</p>
<p><var class="var">y</var>: will hold the y (optional)
</p>
<p><var class="var">x</var>: will hold the x
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the Diffie-Hellman private key parameter
found in the given <code class="code">gnutls_privkey_t</code> structure. The new parameter
will be allocated using <code class="code">gnutls_malloc()</code> and will be stored in the
appropriate datum.
</p>
<p>To retrieve other parameters common in both public key and private
key, use <code class="code">gnutls_dh_params_export_raw()</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.8.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fdsa_005fraw-1"><span>gnutls_privkey_export_dsa_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fdsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fdsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fdsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_dsa_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">x</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fdsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">p</var>: will hold the p
</p>
<p><var class="var">q</var>: will hold the q
</p>
<p><var class="var">g</var>: will hold the g
</p>
<p><var class="var">y</var>: will hold the y
</p>
<p><var class="var">x</var>: will hold the x
</p>
<p>This function will export the DSA private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fdsa_005fraw2-1"><span>gnutls_privkey_export_dsa_raw2<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fdsa_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fdsa_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fdsa_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_dsa_raw2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">x</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fdsa_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">p</var>: will hold the p
</p>
<p><var class="var">q</var>: will hold the q
</p>
<p><var class="var">g</var>: will hold the g
</p>
<p><var class="var">y</var>: will hold the y
</p>
<p><var class="var">x</var>: will hold the x
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the DSA private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fecc_005fraw-1"><span>gnutls_privkey_export_ecc_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fecc_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fecc_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fecc_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_ecc_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">k</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fecc_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">curve</var>: will hold the curve
</p>
<p><var class="var">x</var>: will hold the x-coordinate
</p>
<p><var class="var">y</var>: will hold the y-coordinate
</p>
<p><var class="var">k</var>: will hold the private key
</p>
<p>This function will export the ECC private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter will be <code class="code">NULL</code> and the other parameters
will be in the native format for the curve.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fecc_005fraw2-1"><span>gnutls_privkey_export_ecc_raw2<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fecc_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fecc_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fecc_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_ecc_raw2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">k</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fecc_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">curve</var>: will hold the curve
</p>
<p><var class="var">x</var>: will hold the x-coordinate
</p>
<p><var class="var">y</var>: will hold the y-coordinate
</p>
<p><var class="var">k</var>: will hold the private key
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the ECC private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter will be <code class="code">NULL</code> and the other parameters
will be in the native format for the curve.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fgost_005fraw2-1"><span>gnutls_privkey_export_gost_raw2<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fgost_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fgost_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fgost_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_gost_raw2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_gost_paramset_t * <var class="var">paramset</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, gnutls_datum_t * <var class="var">k</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fgost_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">curve</var>: will hold the curve
</p>
<p><var class="var">digest</var>: will hold the digest
</p>
<p><var class="var">paramset</var>: will hold the GOST parameter set ID
</p>
<p><var class="var">x</var>: will hold the x-coordinate
</p>
<p><var class="var">y</var>: will hold the y-coordinate
</p>
<p><var class="var">k</var>: will hold the private key
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the GOST private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Note:</strong> parameters will be stored with least significant byte first. On
version 3.6.3 this was incorrectly returned in big-endian format.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fopenpgp-1"><span>gnutls_privkey_export_openpgp<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fopenpgp-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fopenpgp"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fopenpgp"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_openpgp</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_openpgp_privkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fopenpgp"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">key</var>: Location for the key to be exported.
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fpkcs11-1"><span>gnutls_privkey_export_pkcs11<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fpkcs11-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fpkcs11"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fpkcs11"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_pkcs11</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_pkcs11_privkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fpkcs11"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">key</var>: Location for the key to be exported.
</p>
<p>Converts the given abstract private key to a <code class="code">gnutls_pkcs11_privkey_t</code>
type. The key must be of type <code class="code">GNUTLS_PRIVKEY_PKCS11</code> . The key
returned in <code class="code">key</code> must be deinitialized with
<code class="code">gnutls_pkcs11_privkey_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005frsa_005fraw-1"><span>gnutls_privkey_export_rsa_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_rsa_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, gnutls_datum_t * <var class="var">d</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">u</var>, gnutls_datum_t * <var class="var">e1</var>, gnutls_datum_t * <var class="var">e2</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">m</var>: will hold the modulus
</p>
<p><var class="var">e</var>: will hold the public exponent
</p>
<p><var class="var">d</var>: will hold the private exponent
</p>
<p><var class="var">p</var>: will hold the first prime (p)
</p>
<p><var class="var">q</var>: will hold the second prime (q)
</p>
<p><var class="var">u</var>: will hold the coefficient
</p>
<p><var class="var">e1</var>: will hold e1 = d mod (p-1)
</p>
<p><var class="var">e2</var>: will hold e2 = d mod (q-1)
</p>
<p>This function will export the RSA private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum. For
EdDSA keys, the <code class="code">y</code> value should be <code class="code">NULL</code> .
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005frsa_005fraw2-1"><span>gnutls_privkey_export_rsa_raw2<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005frsa_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005frsa_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005frsa_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_rsa_raw2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, gnutls_datum_t * <var class="var">d</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">u</var>, gnutls_datum_t * <var class="var">e1</var>, gnutls_datum_t * <var class="var">e2</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005frsa_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">m</var>: will hold the modulus
</p>
<p><var class="var">e</var>: will hold the public exponent
</p>
<p><var class="var">d</var>: will hold the private exponent
</p>
<p><var class="var">p</var>: will hold the first prime (p)
</p>
<p><var class="var">q</var>: will hold the second prime (q)
</p>
<p><var class="var">u</var>: will hold the coefficient
</p>
<p><var class="var">e1</var>: will hold e1 = d mod (p-1)
</p>
<p><var class="var">e2</var>: will hold e2 = d mod (q-1)
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the RSA private key’s parameters found
in the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fexport_005fx509-1"><span>gnutls_privkey_export_x509<a class="copiable-link" href="#gnutls_005fprivkey_005fexport_005fx509-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fexport_005fx509"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fexport_005fx509"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_export_x509</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_x509_privkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fexport_005fx509"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">key</var>: Location for the key to be exported.
</p>
<p>Converts the given abstract private key to a <code class="code">gnutls_x509_privkey_t</code>
type. The abstract key must be of type <code class="code">GNUTLS_PRIVKEY_X509</code> . The input
<code class="code">key</code> must not be initialized. The key returned in <code class="code">key</code> should be deinitialized
using <code class="code">gnutls_x509_privkey_deinit()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fgenerate-1"><span>gnutls_privkey_generate<a class="copiable-link" href="#gnutls_005fprivkey_005fgenerate-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fgenerate"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fgenerate"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_generate</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_pk_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">bits</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fgenerate"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: An initialized private key
</p>
<p><var class="var">algo</var>: is one of the algorithms in <code class="code">gnutls_pk_algorithm_t</code> .
</p>
<p><var class="var">bits</var>: the size of the parameters to generate
</p>
<p><var class="var">flags</var>: Must be zero or flags from <code class="code">gnutls_privkey_flags_t</code> .
</p>
<p>This function will generate a random private key. Note that this
function must be called on an initialized private key.
</p>
<p>The flag <code class="code">GNUTLS_PRIVKEY_FLAG_PROVABLE</code>
instructs the key generation process to use algorithms like Shawe-Taylor
(from FIPS PUB186-4) which generate provable parameters out of a seed
for RSA and DSA keys. See <code class="code">gnutls_privkey_generate2()</code> for more
information.
</p>
<p>Note that when generating an elliptic curve key, the curve
can be substituted in the place of the bits parameter using the
<code class="code">GNUTLS_CURVE_TO_BITS()</code> macro. The input to the macro is any curve from
<code class="code">gnutls_ecc_curve_t</code> .
</p>
<p>For DSA keys, if the subgroup size needs to be specified check
the <code class="code">GNUTLS_SUBGROUP_TO_BITS()</code> macro.
</p>
<p>It is recommended to do not set the number of <code class="code">bits</code> directly, use <code class="code">gnutls_sec_param_to_pk_bits()</code> instead .
</p>
<p>See also <code class="code">gnutls_privkey_generate2()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fgenerate2-1"><span>gnutls_privkey_generate2<a class="copiable-link" href="#gnutls_005fprivkey_005fgenerate2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fgenerate2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fgenerate2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_generate2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_pk_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">bits</var>, unsigned int <var class="var">flags</var>, const gnutls_keygen_data_st * <var class="var">data</var>, unsigned <var class="var">data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fgenerate2-1"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">algo</var>: is one of the algorithms in <code class="code">gnutls_pk_algorithm_t</code> .
</p>
<p><var class="var">bits</var>: the size of the modulus
</p>
<p><var class="var">flags</var>: Must be zero or flags from <code class="code">gnutls_privkey_flags_t</code> .
</p>
<p><var class="var">data</var>: Allow specifying <code class="code">gnutls_keygen_data_st</code> types such as the seed to be used.
</p>
<p><var class="var">data_size</var>: The number of <code class="code">data</code> available.
</p>
<p>This function will generate a random private key. Note that this
function must be called on an initialized private key.
</p>
<p>The flag <code class="code">GNUTLS_PRIVKEY_FLAG_PROVABLE</code>
instructs the key generation process to use algorithms like Shawe-Taylor
(from FIPS PUB186-4) which generate provable parameters out of a seed
for RSA and DSA keys. On DSA keys the PQG parameters are generated using the
seed, while on RSA the two primes. To specify an explicit seed
(by default a random seed is used), use the <code class="code">data</code> with a <code class="code">GNUTLS_KEYGEN_SEED</code>
type.
</p>
<p>Note that when generating an elliptic curve key, the curve
can be substituted in the place of the bits parameter using the
<code class="code">GNUTLS_CURVE_TO_BITS()</code> macro.
</p>
<p>To export the generated keys in memory or in files it is recommended to use the
PKCS<code class="code">8</code> form as it can handle all key types, and can store additional parameters
such as the seed, in case of provable RSA or DSA keys.
Generated keys can be exported in memory using <code class="code">gnutls_privkey_export_x509()</code> ,
and then with <code class="code">gnutls_x509_privkey_export2_pkcs8()</code> .
</p>
<p>If key generation is part of your application, avoid setting the number
of bits directly, and instead use <code class="code">gnutls_sec_param_to_pk_bits()</code> .
That way the generated keys will adapt to the security levels
of the underlying GnuTLS library.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fget_005fpk_005falgorithm-1"><span>gnutls_privkey_get_pk_algorithm<a class="copiable-link" href="#gnutls_005fprivkey_005fget_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fget_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fget_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_get_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, unsigned int * <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fget_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_privkey_t</code> type
</p>
<p><var class="var">bits</var>: If set will return the number of bits of the parameters (may be NULL)
</p>
<p>This function will return the public key algorithm of a private
key and if possible will return a number of bits that indicates
the security parameter of the key.
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_pk_algorithm_t</code> enumeration on
success, or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fget_005fseed-1"><span>gnutls_privkey_get_seed<a class="copiable-link" href="#gnutls_005fprivkey_005fget_005fseed-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fget_005fseed"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fget_005fseed"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_get_seed</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, void * <var class="var">seed</var>, size_t * <var class="var">seed_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fget_005fseed"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_privkey_t</code> type
</p>
<p><var class="var">digest</var>: if non-NULL it will contain the digest algorithm used for key generation (if applicable)
</p>
<p><var class="var">seed</var>: where seed will be copied to
</p>
<p><var class="var">seed_size</var>: originally holds the size of <code class="code">seed</code> , will be updated with actual size
</p>
<p>This function will return the seed that was used to generate the
given private key. That function will succeed only if the key was generated
as a provable key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fget_005fspki-1"><span>gnutls_privkey_get_spki<a class="copiable-link" href="#gnutls_005fprivkey_005fget_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fget_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fget_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_get_spki</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">privkey</var>, gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fget_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">privkey</var>: a public key of type <code class="code">gnutls_privkey_t</code>
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_privkey_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return the public key information if available.
The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fget_005ftype-1"><span>gnutls_privkey_get_type<a class="copiable-link" href="#gnutls_005fprivkey_005fget_005ftype-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fget_005ftype"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fget_005ftype"><span class="category-def">Function: </span><span><code class="def-type">gnutls_privkey_type_t</code> <strong class="def-name">gnutls_privkey_get_type</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fget_005ftype"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_privkey_t</code> type
</p>
<p>This function will return the type of the private key. This is
actually the type of the subsystem used to set this private key.
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_privkey_type_t</code> enumeration on
success, or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fdh_005fraw-1"><span>gnutls_privkey_import_dh_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fdh_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fdh_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fdh_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_dh_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, const gnutls_dh_params_t <var class="var">params</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">x</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fdh_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">params</var>: holds the <code class="code">gnutls_dh_params_t</code>
</p>
<p><var class="var">y</var>: holds the y (optional)
</p>
<p><var class="var">x</var>: holds the x
</p>
<p>This function will convert the given Diffie-Hellman raw parameters
to the native <code class="code">gnutls_privkey_t</code> format. The output will be stored
in <code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.8.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fdsa_005fraw-1"><span>gnutls_privkey_import_dsa_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fdsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fdsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fdsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_dsa_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">p</var>, const gnutls_datum_t * <var class="var">q</var>, const gnutls_datum_t * <var class="var">g</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">x</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fdsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">p</var>: holds the p
</p>
<p><var class="var">q</var>: holds the q
</p>
<p><var class="var">g</var>: holds the g
</p>
<p><var class="var">y</var>: holds the y (optional)
</p>
<p><var class="var">x</var>: holds the x
</p>
<p>This function will convert the given DSA raw parameters to the
native <code class="code">gnutls_privkey_t</code> format. The output will be stored
in <code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fecc_005fraw-1"><span>gnutls_privkey_import_ecc_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fecc_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fecc_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fecc_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_ecc_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t <var class="var">curve</var>, const gnutls_datum_t * <var class="var">x</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">k</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fecc_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The key
</p>
<p><var class="var">curve</var>: holds the curve
</p>
<p><var class="var">x</var>: holds the x-coordinate
</p>
<p><var class="var">y</var>: holds the y-coordinate
</p>
<p><var class="var">k</var>: holds the k (private key)
</p>
<p>This function will convert the given elliptic curve parameters to the
native <code class="code">gnutls_privkey_t</code> format. The output will be stored
in <code class="code">key</code> .
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter should be <code class="code">NULL</code> and the <code class="code">x</code> and <code class="code">k</code> parameters
must be in the native format for the curve.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fext-1"><span>gnutls_privkey_import_ext<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fext-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fext"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fext"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_ext</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_pk_algorithm_t <var class="var">pk</var>, void * <var class="var">userdata</var>, gnutls_privkey_sign_func <var class="var">sign_func</var>, gnutls_privkey_decrypt_func <var class="var">decrypt_func</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fext"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">pk</var>: The public key algorithm
</p>
<p><var class="var">userdata</var>: private data to be provided to the callbacks
</p>
<p><var class="var">sign_func</var>: callback for signature operations
</p>
<p><var class="var">decrypt_func</var>: callback for decryption operations
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function will associate the given callbacks with the
<code class="code">gnutls_privkey_t</code> type. At least one of the two callbacks
must be non-null.
</p>
<p>Note that the signing function is supposed to "raw" sign data, i.e.,
without any hashing or preprocessing. In case of RSA the DigestInfo
will be provided, and the signing function is expected to do the PKCS <code class="code">1</code>
1.5 padding and the exponentiation.
</p>
<p>See also <code class="code">gnutls_privkey_import_ext3()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fext2-1"><span>gnutls_privkey_import_ext2<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fext2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fext2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fext2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_ext2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_pk_algorithm_t <var class="var">pk</var>, void * <var class="var">userdata</var>, gnutls_privkey_sign_func <var class="var">sign_fn</var>, gnutls_privkey_decrypt_func <var class="var">decrypt_fn</var>, gnutls_privkey_deinit_func <var class="var">deinit_fn</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fext2"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">pk</var>: The public key algorithm
</p>
<p><var class="var">userdata</var>: private data to be provided to the callbacks
</p>
<p><var class="var">sign_fn</var>: callback for signature operations
</p>
<p><var class="var">decrypt_fn</var>: callback for decryption operations
</p>
<p><var class="var">deinit_fn</var>: a deinitialization function
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function will associate the given callbacks with the
<code class="code">gnutls_privkey_t</code> type. At least one of the two callbacks
must be non-null. If a deinitialization function is provided
then flags is assumed to contain <code class="code">GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE</code> .
</p>
<p>Note that the signing function is supposed to "raw" sign data, i.e.,
without any hashing or preprocessing. In case of RSA the DigestInfo
will be provided, and the signing function is expected to do the PKCS <code class="code">1</code>
1.5 padding and the exponentiation.
</p>
<p>See also <code class="code">gnutls_privkey_import_ext3()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fext3-1"><span>gnutls_privkey_import_ext3<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fext3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fext3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fext3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_ext3</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, void * <var class="var">userdata</var>, gnutls_privkey_sign_func <var class="var">sign_fn</var>, gnutls_privkey_decrypt_func <var class="var">decrypt_fn</var>, gnutls_privkey_deinit_func <var class="var">deinit_fn</var>, gnutls_privkey_info_func <var class="var">info_fn</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fext3"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">userdata</var>: private data to be provided to the callbacks
</p>
<p><var class="var">sign_fn</var>: callback for signature operations
</p>
<p><var class="var">decrypt_fn</var>: callback for decryption operations
</p>
<p><var class="var">deinit_fn</var>: a deinitialization function
</p>
<p><var class="var">info_fn</var>: returns info about the public key algorithm (should not be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function will associate the given callbacks with the
<code class="code">gnutls_privkey_t</code> type. At least one of the two callbacks
must be non-null. If a deinitialization function is provided
then flags is assumed to contain <code class="code">GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE</code> .
</p>
<p>Note that the signing function is supposed to "raw" sign data, i.e.,
without any hashing or preprocessing. In case of RSA the DigestInfo
will be provided, and the signing function is expected to do the PKCS <code class="code">1</code>
1.5 padding and the exponentiation.
</p>
<p>The <code class="code">info_fn</code> must provide information on the algorithms supported by
this private key, and should support the flags <code class="code">GNUTLS_PRIVKEY_INFO_PK_ALGO</code> and
<code class="code">GNUTLS_PRIVKEY_INFO_SIGN_ALGO</code> . It must return -1 on unknown flags.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fext4-1"><span>gnutls_privkey_import_ext4<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fext4-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fext4"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fext4-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_ext4</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, void * <var class="var">userdata</var>, gnutls_privkey_sign_data_func <var class="var">sign_data_fn</var>, gnutls_privkey_sign_hash_func <var class="var">sign_hash_fn</var>, gnutls_privkey_decrypt_func <var class="var">decrypt_fn</var>, gnutls_privkey_deinit_func <var class="var">deinit_fn</var>, gnutls_privkey_info_func <var class="var">info_fn</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fext4-1"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">userdata</var>: private data to be provided to the callbacks
</p>
<p><var class="var">sign_data_fn</var>: callback for signature operations (may be <code class="code">NULL</code> )
</p>
<p><var class="var">sign_hash_fn</var>: callback for signature operations (may be <code class="code">NULL</code> )
</p>
<p><var class="var">decrypt_fn</var>: callback for decryption operations (may be <code class="code">NULL</code> )
</p>
<p><var class="var">deinit_fn</var>: a deinitialization function
</p>
<p><var class="var">info_fn</var>: returns info about the public key algorithm (should not be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function will associate the given callbacks with the
<code class="code">gnutls_privkey_t</code> type. At least one of the callbacks
must be non-null. If a deinitialization function is provided
then flags is assumed to contain <code class="code">GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE</code> .
</p>
<p>Note that in contrast with the signing function of
<code class="code">gnutls_privkey_import_ext3()</code> , the signing functions provided to this
function take explicitly the signature algorithm as parameter and
different functions are provided to sign the data and hashes.
</p>
<p>The <code class="code">sign_hash_fn</code> is to be called to sign pre-hashed data. The input
to the callback is the output of the hash (such as SHA256) corresponding
to the signature algorithm. For RSA PKCS<code class="code">1</code> signatures, the signature
algorithm can be set to <code class="code">GNUTLS_SIGN_RSA_RAW</code> , and in that case the data
should be handled as if they were an RSA PKCS<code class="code">1</code> DigestInfo structure.
</p>
<p>The <code class="code">sign_data_fn</code> is to be called to sign data. The input data will be
he data to be signed (and hashed), with the provided signature
algorithm. This function is to be used for signature algorithms like
Ed25519 which cannot take pre-hashed data as input.
</p>
<p>When both <code class="code">sign_data_fn</code> and <code class="code">sign_hash_fn</code> functions are provided they
must be able to operate on all the supported signature algorithms,
unless prohibited by the type of the algorithm (e.g., as with Ed25519).
</p>
<p>The <code class="code">info_fn</code> must provide information on the signature algorithms supported by
this private key, and should support the flags <code class="code">GNUTLS_PRIVKEY_INFO_PK_ALGO</code> ,
<code class="code">GNUTLS_PRIVKEY_INFO_HAVE_SIGN_ALGO</code> and <code class="code">GNUTLS_PRIVKEY_INFO_PK_ALGO_BITS</code> .
It must return -1 on unknown flags.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fgost_005fraw-1"><span>gnutls_privkey_import_gost_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fgost_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fgost_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fgost_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_gost_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_ecc_curve_t <var class="var">curve</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, gnutls_gost_paramset_t <var class="var">paramset</var>, const gnutls_datum_t * <var class="var">x</var>, const gnutls_datum_t * <var class="var">y</var>, const gnutls_datum_t * <var class="var">k</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fgost_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The key
</p>
<p><var class="var">curve</var>: holds the curve
</p>
<p><var class="var">digest</var>: holds the digest
</p>
<p><var class="var">paramset</var>: holds the GOST parameter set ID
</p>
<p><var class="var">x</var>: holds the x-coordinate
</p>
<p><var class="var">y</var>: holds the y-coordinate
</p>
<p><var class="var">k</var>: holds the k (private key)
</p>
<p>This function will convert the given GOST private key’s parameters to the
native <code class="code">gnutls_privkey_t</code> format. The output will be stored
in <code class="code">key</code> . <code class="code">digest</code> should be one of GNUTLS_DIG_GOSR_94,
GNUTLS_DIG_STREEBOG_256 or GNUTLS_DIG_STREEBOG_512. If <code class="code">paramset</code> is set to
GNUTLS_GOST_PARAMSET_UNKNOWN default one will be selected depending on
<code class="code">digest</code> .
</p>
<p><strong class="strong">Note:</strong> parameters should be stored with least significant byte first. On
version 3.6.3 big-endian format was used incorrectly.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fopenpgp-1"><span>gnutls_privkey_import_openpgp<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fopenpgp-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fopenpgp"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fopenpgp"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_openpgp</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_openpgp_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fopenpgp"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">key</var>: The private key to be imported
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fopenpgp_005fraw-1"><span>gnutls_privkey_import_openpgp_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fopenpgp_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fopenpgp_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fopenpgp_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_openpgp_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_openpgp_crt_fmt_t <var class="var">format</var>, const gnutls_openpgp_keyid_t <var class="var">keyid</var>, const char * <var class="var">password</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fopenpgp_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">data</var>: The private key data to be imported
</p>
<p><var class="var">format</var>: The format of the private key
</p>
<p><var class="var">keyid</var>: The key id to use (optional)
</p>
<p><var class="var">password</var>: A password (optional)
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fpkcs11-1"><span>gnutls_privkey_import_pkcs11<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fpkcs11-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fpkcs11"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fpkcs11"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_pkcs11</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_pkcs11_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fpkcs11"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">key</var>: The private key to be imported
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>The <code class="code">gnutls_pkcs11_privkey_t</code> object must not be deallocated
during the lifetime of this structure.
</p>
<p><code class="code">flags</code> might be zero or one of <code class="code">GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE</code>
and <code class="code">GNUTLS_PRIVKEY_IMPORT_COPY</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fpkcs11_005furl-1"><span>gnutls_privkey_import_pkcs11_url<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fpkcs11_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fpkcs11_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fpkcs11_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_pkcs11_url</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, const char * <var class="var">url</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fpkcs11_005furl"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_pubkey_t</code>
</p>
<p><var class="var">url</var>: A PKCS 11 url
</p>
<p>This function will import a PKCS 11 private key to a <code class="code">gnutls_privkey_t</code>
type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005frsa_005fraw-1"><span>gnutls_privkey_import_rsa_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_rsa_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">m</var>, const gnutls_datum_t * <var class="var">e</var>, const gnutls_datum_t * <var class="var">d</var>, const gnutls_datum_t * <var class="var">p</var>, const gnutls_datum_t * <var class="var">q</var>, const gnutls_datum_t * <var class="var">u</var>, const gnutls_datum_t * <var class="var">e1</var>, const gnutls_datum_t * <var class="var">e2</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">m</var>: holds the modulus
</p>
<p><var class="var">e</var>: holds the public exponent
</p>
<p><var class="var">d</var>: holds the private exponent (optional)
</p>
<p><var class="var">p</var>: holds the first prime (p)
</p>
<p><var class="var">q</var>: holds the second prime (q)
</p>
<p><var class="var">u</var>: holds the coefficient (optional)
</p>
<p><var class="var">e1</var>: holds e1 = d mod (p-1) (optional)
</p>
<p><var class="var">e2</var>: holds e2 = d mod (q-1) (optional)
</p>
<p>This function will convert the given RSA raw parameters to the
native <code class="code">gnutls_privkey_t</code> format. The output will be stored in
<code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005ftpm_005fraw-1"><span>gnutls_privkey_import_tpm_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005ftpm_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005ftpm_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005ftpm_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_tpm_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">fdata</var>, gnutls_tpmkey_fmt_t <var class="var">format</var>, const char * <var class="var">srk_password</var>, const char * <var class="var">key_password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005ftpm_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">fdata</var>: The TPM key to be imported
</p>
<p><var class="var">format</var>: The format of the private key
</p>
<p><var class="var">srk_password</var>: The password for the SRK key (optional)
</p>
<p><var class="var">key_password</var>: A password for the key (optional)
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>With respect to passwords the same as in <code class="code">gnutls_privkey_import_tpm_url()</code> apply.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005ftpm_005furl-1"><span>gnutls_privkey_import_tpm_url<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005ftpm_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005ftpm_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005ftpm_005furl-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_tpm_url</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, const char * <var class="var">url</var>, const char * <var class="var">srk_password</var>, const char * <var class="var">key_password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005ftpm_005furl-1"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">url</var>: The URL of the TPM key to be imported
</p>
<p><var class="var">srk_password</var>: The password for the SRK key (optional)
</p>
<p><var class="var">key_password</var>: A password for the key (optional)
</p>
<p><var class="var">flags</var>: One of the GNUTLS_PRIVKEY_* flags
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>Note that unless <code class="code">GNUTLS_PRIVKEY_DISABLE_CALLBACKS</code>
is specified, if incorrect (or NULL) passwords are given
the PKCS11 callback functions will be used to obtain the
correct passwords. Otherwise if the SRK password is wrong
<code class="code">GNUTLS_E_TPM_SRK_PASSWORD_ERROR</code> is returned and if the key password
is wrong or not provided then <code class="code">GNUTLS_E_TPM_KEY_PASSWORD_ERROR</code>
is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005furl-1"><span>gnutls_privkey_import_url<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005furl-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_url</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005furl-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_privkey_t</code>
</p>
<p><var class="var">url</var>: A PKCS 11 url
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import a PKCS11 or TPM URL as a
private key. The supported URL types can be checked
using <code class="code">gnutls_url_is_supported()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fx509-1"><span>gnutls_privkey_import_x509<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fx509-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fx509"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fx509"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_x509</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, gnutls_x509_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fx509"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">key</var>: The private key to be imported
</p>
<p><var class="var">flags</var>: Flags for the import
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>The <code class="code">gnutls_x509_privkey_t</code> object must not be deallocated
during the lifetime of this structure.
</p>
<p><code class="code">flags</code> might be zero or one of <code class="code">GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE</code>
and <code class="code">GNUTLS_PRIVKEY_IMPORT_COPY</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fimport_005fx509_005fraw-1"><span>gnutls_privkey_import_x509_raw<a class="copiable-link" href="#gnutls_005fprivkey_005fimport_005fx509_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fimport_005fx509_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fimport_005fx509_005fraw-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_import_x509_raw</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, const char * <var class="var">password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fimport_005fx509_005fraw-1"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">data</var>: The private key data to be imported
</p>
<p><var class="var">format</var>: The format of the private key
</p>
<p><var class="var">password</var>: A password (optional)
</p>
<p><var class="var">flags</var>: an ORed sequence of gnutls_pkcs_encrypt_flags_t
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>The supported formats are basic unencrypted key, PKCS8, PKCS12,
TSS2, and the openssl format.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005finit-1"><span>gnutls_privkey_init<a class="copiable-link" href="#gnutls_005fprivkey_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_init</strong> <code class="def-code-arguments">(gnutls_privkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005finit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a private key object. The object can
be used to generate, import, and perform cryptographic operations
on the associated private key.
</p>
<p>Note that when the underlying private key is a PKCS<code class="code">11</code> key (i.e.,
when imported with a PKCS<code class="code">11</code> URI), the limitations of <code class="code">gnutls_pkcs11_privkey_init()</code>
apply to this object as well. In versions of GnuTLS later than 3.5.11 the object
is protected using locks and a single <code class="code">gnutls_privkey_t</code> can be re-used
by many threads. However, for performance it is recommended to utilize
one object per key per thread.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fset_005fflags-1"><span>gnutls_privkey_set_flags<a class="copiable-link" href="#gnutls_005fprivkey_005fset_005fflags-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fset_005fflags"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fset_005fflags"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_privkey_set_flags</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fset_005fflags"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_privkey_t</code>
</p>
<p><var class="var">flags</var>: flags from the <code class="code">gnutls_privkey_flags</code>
</p>
<p>This function will set flags for the specified private key, after
it is generated. Currently this is useful for the <code class="code">GNUTLS_PRIVKEY_FLAG_EXPORT_COMPAT</code>
to allow exporting a "provable" private key in backwards compatible way.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fset_005fpin_005ffunction-1"><span>gnutls_privkey_set_pin_function<a class="copiable-link" href="#gnutls_005fprivkey_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_privkey_set_pin_function</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_privkey_t</code>
</p>
<p><var class="var">fn</var>: the callback
</p>
<p><var class="var">userdata</var>: data associated with the callback
</p>
<p>This function will set a callback function to be used when
required to access the object. This function overrides any other
global PIN functions.
</p>
<p>Note that this function must be called right after initialization
to have effect.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fset_005fspki-1"><span>gnutls_privkey_set_spki<a class="copiable-link" href="#gnutls_005fprivkey_005fset_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fset_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fset_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_set_spki</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">privkey</var>, const gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fset_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">privkey</var>: a public key of type <code class="code">gnutls_privkey_t</code>
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_privkey_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will set the public key information.
The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fsign_005fdata-1"><span>gnutls_privkey_sign_data<a class="copiable-link" href="#gnutls_005fprivkey_005fsign_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fsign_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fsign_005fdata-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_sign_data</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">signer</var>, gnutls_digest_algorithm_t <var class="var">hash</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fsign_005fdata-1"> ¶</a></span></dt>
<dd><p><var class="var">signer</var>: Holds the key
</p>
<p><var class="var">hash</var>: should be a digest algorithm
</p>
<p><var class="var">flags</var>: Zero or one of <code class="code">gnutls_privkey_flags_t</code>
</p>
<p><var class="var">data</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain the signature allocated with <code class="code">gnutls_malloc()</code>
</p>
<p>This function will sign the given data using a signature algorithm
supported by the private key. Signature algorithms are always used
together with a hash functions. Different hash functions may be
used for the RSA algorithm, but only the SHA family for the DSA keys.
</p>
<p>You may use <code class="code">gnutls_pubkey_get_preferred_hash_algorithm()</code> to determine
the hash algorithm.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fsign_005fdata2-1"><span>gnutls_privkey_sign_data2<a class="copiable-link" href="#gnutls_005fprivkey_005fsign_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fsign_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fsign_005fdata2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_sign_data2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">signer</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fsign_005fdata2"> ¶</a></span></dt>
<dd><p><var class="var">signer</var>: Holds the key
</p>
<p><var class="var">algo</var>: The signature algorithm used
</p>
<p><var class="var">flags</var>: Zero or one of <code class="code">gnutls_privkey_flags_t</code>
</p>
<p><var class="var">data</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain the signature allocated with <code class="code">gnutls_malloc()</code>
</p>
<p>This function will sign the given data using the specified signature
algorithm. This function is an enhancement of <code class="code">gnutls_privkey_sign_data()</code> ,
as it allows utilizing a alternative signature algorithm where possible
(e.g, use an RSA key with RSA-PSS).
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fsign_005fhash-1"><span>gnutls_privkey_sign_hash<a class="copiable-link" href="#gnutls_005fprivkey_005fsign_005fhash-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fsign_005fhash"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fsign_005fhash-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_sign_hash</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">signer</var>, gnutls_digest_algorithm_t <var class="var">hash_algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">hash_data</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fsign_005fhash-1"> ¶</a></span></dt>
<dd><p><var class="var">signer</var>: Holds the signer’s key
</p>
<p><var class="var">hash_algo</var>: The hash algorithm used
</p>
<p><var class="var">flags</var>: Zero or one of <code class="code">gnutls_privkey_flags_t</code>
</p>
<p><var class="var">hash_data</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain newly allocated signature
</p>
<p>This function will sign the given hashed data using a signature algorithm
supported by the private key. Signature algorithms are always used
together with a hash functions. Different hash functions may be
used for the RSA algorithm, but only SHA-XXX for the DSA keys.
</p>
<p>You may use <code class="code">gnutls_pubkey_get_preferred_hash_algorithm()</code> to determine
the hash algorithm.
</p>
<p>The flags may be <code class="code">GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA</code> or <code class="code">GNUTLS_PRIVKEY_SIGN_FLAG_RSA_PSS</code> .
In the former case this function will ignore <code class="code">hash_algo</code> and perform a raw PKCS1 signature,
and in the latter an RSA-PSS signature will be generated.
</p>
<p>Note that, not all algorithm support signing already hashed data. When
signing with Ed25519, <code class="code">gnutls_privkey_sign_data()</code> should be used.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fsign_005fhash2-1"><span>gnutls_privkey_sign_hash2<a class="copiable-link" href="#gnutls_005fprivkey_005fsign_005fhash2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fsign_005fhash2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fsign_005fhash2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_sign_hash2</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">signer</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">hash_data</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fsign_005fhash2"> ¶</a></span></dt>
<dd><p><var class="var">signer</var>: Holds the signer’s key
</p>
<p><var class="var">algo</var>: The signature algorithm used
</p>
<p><var class="var">flags</var>: Zero or one of <code class="code">gnutls_privkey_flags_t</code>
</p>
<p><var class="var">hash_data</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain newly allocated signature
</p>
<p>This function will sign the given hashed data using the specified signature
algorithm. This function is an enhancement of <code class="code">gnutls_privkey_sign_hash()</code> ,
as it allows utilizing a alternative signature algorithm where possible
(e.g, use an RSA key with RSA-PSS).
</p>
<p>The flags may be <code class="code">GNUTLS_PRIVKEY_SIGN_FLAG_TLS1_RSA</code> .
In that case this function will ignore <code class="code">hash_algo</code> and perform a raw PKCS1 signature.
Note that this flag is supported since 3.6.9.
</p>
<p>Note also that, not all algorithm support signing already hashed data. When
signing with Ed25519, <code class="code">gnutls_privkey_sign_data2()</code> should be used instead.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fstatus-1"><span>gnutls_privkey_status<a class="copiable-link" href="#gnutls_005fprivkey_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_status</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p>Checks the status of the private key token. This function
is an actual wrapper over <code class="code">gnutls_pkcs11_privkey_status()</code> , and
if the private key is a PKCS <code class="code">11</code> token it will check whether
it is inserted or not.
</p>
<p><strong class="strong">Returns:</strong> this function will return non-zero if the token
holding the private key is still available (inserted), and zero otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.1.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fverify_005fparams-1"><span>gnutls_privkey_verify_params<a class="copiable-link" href="#gnutls_005fprivkey_005fverify_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fverify_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fverify_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_verify_params</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fverify_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_privkey_t</code> type
</p>
<p>This function will verify the private key parameters.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fprivkey_005fverify_005fseed-1"><span>gnutls_privkey_verify_seed<a class="copiable-link" href="#gnutls_005fprivkey_005fverify_005fseed-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fprivkey_005fverify_005fseed"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fprivkey_005fverify_005fseed"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_privkey_verify_seed</strong> <code class="def-code-arguments">(gnutls_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, const void * <var class="var">seed</var>, size_t <var class="var">seed_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fprivkey_005fverify_005fseed"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_privkey_t</code> type
</p>
<p><var class="var">digest</var>: it contains the digest algorithm used for key generation (if applicable)
</p>
<p><var class="var">seed</var>: the seed of the key to be checked with
</p>
<p><var class="var">seed_size</var>: holds the size of <code class="code">seed</code>
</p>
<p>This function will verify that the given private key was generated from
the provided seed.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PRIVKEY_VERIFICATION_ERROR</code>
is returned, and zero or positive code on success.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fdeinit-1"><span>gnutls_pubkey_deinit<a class="copiable-link" href="#gnutls_005fpubkey_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pubkey_deinit</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The key to be deinitialized
</p>
<p>This function will deinitialize a public key structure.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fencrypt_005fdata-1"><span>gnutls_pubkey_encrypt_data<a class="copiable-link" href="#gnutls_005fpubkey_005fencrypt_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fencrypt_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fencrypt_005fdata-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_encrypt_data</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">plaintext</var>, gnutls_datum_t * <var class="var">ciphertext</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fencrypt_005fdata-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">flags</var>: should be 0 for now
</p>
<p><var class="var">plaintext</var>: The data to be encrypted
</p>
<p><var class="var">ciphertext</var>: contains the encrypted data
</p>
<p>This function will encrypt the given data, using the public
key. On success the <code class="code">ciphertext</code> will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport-1"><span>gnutls_pubkey_export<a class="copiable-link" href="#gnutls_005fpubkey_005fexport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, void * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">output_data</var>: will contain a certificate PEM or DER encoded
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will export the public key to DER or PEM format.
The contents of the exported data is the SubjectPublicKeyInfo
X.509 structure.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will
be returned.
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport2-1"><span>gnutls_pubkey_export2<a class="copiable-link" href="#gnutls_005fpubkey_005fexport2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport2-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">format</var>: the format of output params. One of PEM or DER.
</p>
<p><var class="var">out</var>: will contain a certificate PEM or DER encoded
</p>
<p>This function will export the public key to DER or PEM format.
The contents of the exported data is the SubjectPublicKeyInfo
X.509 structure.
</p>
<p>The output buffer will be allocated using <code class="code">gnutls_malloc()</code> .
</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN CERTIFICATE".
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005fdh_005fraw-1"><span>gnutls_pubkey_export_dh_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005fdh_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005fdh_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005fdh_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_dh_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_dh_params_t <var class="var">params</var>, gnutls_datum_t * <var class="var">y</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005fdh_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">params</var>: will hold the Diffie-Hellman parameter (optional), must be initialized
</p>
<p><var class="var">y</var>: will hold the y
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the Diffie-Hellman public key parameter
found in the given public key. The new parameter will be allocated
using <code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>To retrieve other parameters common in both public key and private
key, use <code class="code">gnutls_dh_params_export_raw()</code> .
</p>
<p>This function allows for <code class="code">NULL</code> parameters since 3.4.1.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.8.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005fdsa_005fraw-1"><span>gnutls_pubkey_export_dsa_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005fdsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005fdsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005fdsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_dsa_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005fdsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">p</var>: will hold the p (may be <code class="code">NULL</code> )
</p>
<p><var class="var">q</var>: will hold the q (may be <code class="code">NULL</code> )
</p>
<p><var class="var">g</var>: will hold the g (may be <code class="code">NULL</code> )
</p>
<p><var class="var">y</var>: will hold the y (may be <code class="code">NULL</code> )
</p>
<p>This function will export the DSA public key’s parameters found in
the given certificate. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>This function allows for <code class="code">NULL</code> parameters since 3.4.1.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005fdsa_005fraw2-1"><span>gnutls_pubkey_export_dsa_raw2<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005fdsa_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005fdsa_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005fdsa_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_dsa_raw2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">p</var>, gnutls_datum_t * <var class="var">q</var>, gnutls_datum_t * <var class="var">g</var>, gnutls_datum_t * <var class="var">y</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005fdsa_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">p</var>: will hold the p (may be <code class="code">NULL</code> )
</p>
<p><var class="var">q</var>: will hold the q (may be <code class="code">NULL</code> )
</p>
<p><var class="var">g</var>: will hold the g (may be <code class="code">NULL</code> )
</p>
<p><var class="var">y</var>: will hold the y (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the DSA public key’s parameters found in
the given certificate. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>This function allows for <code class="code">NULL</code> parameters since 3.4.1.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005fecc_005fraw-1"><span>gnutls_pubkey_export_ecc_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005fecc_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005fecc_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005fecc_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_ecc_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005fecc_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">curve</var>: will hold the curve (may be <code class="code">NULL</code> )
</p>
<p><var class="var">x</var>: will hold x-coordinate (may be <code class="code">NULL</code> )
</p>
<p><var class="var">y</var>: will hold y-coordinate (may be <code class="code">NULL</code> )
</p>
<p>This function will export the ECC public key’s parameters found in
the given key. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter will be <code class="code">NULL</code> and the other parameters
will be in the native format for the curve.
</p>
<p>This function allows for <code class="code">NULL</code> parameters since 3.4.1.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005fecc_005fraw2-1"><span>gnutls_pubkey_export_ecc_raw2<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005fecc_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005fecc_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005fecc_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_ecc_raw2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005fecc_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">curve</var>: will hold the curve (may be <code class="code">NULL</code> )
</p>
<p><var class="var">x</var>: will hold x-coordinate (may be <code class="code">NULL</code> )
</p>
<p><var class="var">y</var>: will hold y-coordinate (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the ECC public key’s parameters found in
the given key. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter will be <code class="code">NULL</code> and the other parameters
will be in the native format for the curve.
</p>
<p>This function allows for <code class="code">NULL</code> parameters since 3.4.1.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005fecc_005fx962-1"><span>gnutls_pubkey_export_ecc_x962<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005fecc_005fx962-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005fecc_005fx962"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005fecc_005fx962"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_ecc_x962</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">parameters</var>, gnutls_datum_t * <var class="var">ecpoint</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005fecc_005fx962"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">parameters</var>: DER encoding of an ANSI X9.62 parameters
</p>
<p><var class="var">ecpoint</var>: DER encoding of ANSI X9.62 ECPoint
</p>
<p>This function will export the ECC public key’s parameters found in
the given certificate. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005fgost_005fraw2-1"><span>gnutls_pubkey_export_gost_raw2<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005fgost_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005fgost_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005fgost_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_gost_raw2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_ecc_curve_t * <var class="var">curve</var>, gnutls_digest_algorithm_t * <var class="var">digest</var>, gnutls_gost_paramset_t * <var class="var">paramset</var>, gnutls_datum_t * <var class="var">x</var>, gnutls_datum_t * <var class="var">y</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005fgost_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">curve</var>: will hold the curve (may be <code class="code">NULL</code> )
</p>
<p><var class="var">digest</var>: will hold the curve (may be <code class="code">NULL</code> )
</p>
<p><var class="var">paramset</var>: will hold the parameters id (may be <code class="code">NULL</code> )
</p>
<p><var class="var">x</var>: will hold the x-coordinate (may be <code class="code">NULL</code> )
</p>
<p><var class="var">y</var>: will hold the y-coordinate (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the GOST public key’s parameters found in
the given key. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p><strong class="strong">Note:</strong> parameters will be stored with least significant byte first. On
version 3.6.3 this was incorrectly returned in big-endian format.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005frsa_005fraw-1"><span>gnutls_pubkey_export_rsa_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_rsa_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">m</var>: will hold the modulus (may be <code class="code">NULL</code> )
</p>
<p><var class="var">e</var>: will hold the public exponent (may be <code class="code">NULL</code> )
</p>
<p>This function will export the RSA public key’s parameters found in
the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>This function allows for <code class="code">NULL</code> parameters since 3.4.1.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fexport_005frsa_005fraw2-1"><span>gnutls_pubkey_export_rsa_raw2<a class="copiable-link" href="#gnutls_005fpubkey_005fexport_005frsa_005fraw2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fexport_005frsa_005fraw2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fexport_005frsa_005fraw2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_export_rsa_raw2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_datum_t * <var class="var">m</var>, gnutls_datum_t * <var class="var">e</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fexport_005frsa_005fraw2"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">m</var>: will hold the modulus (may be <code class="code">NULL</code> )
</p>
<p><var class="var">e</var>: will hold the public exponent (may be <code class="code">NULL</code> )
</p>
<p><var class="var">flags</var>: flags from <code class="code">gnutls_abstract_export_flags_t</code>
</p>
<p>This function will export the RSA public key’s parameters found in
the given structure. The new parameters will be allocated using
<code class="code">gnutls_malloc()</code> and will be stored in the appropriate datum.
</p>
<p>This function allows for <code class="code">NULL</code> parameters since 3.4.1.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fget_005fkey_005fid-1"><span>gnutls_pubkey_get_key_id<a class="copiable-link" href="#gnutls_005fpubkey_005fget_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fget_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fget_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_get_key_id</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fget_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">flags</var>: should be one of the flags from <code class="code">gnutls_keyid_flags_t</code>
</p>
<p><var class="var">output_data</var>: will contain the key ID
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p>This function will return a unique ID that depends on the public
key parameters. This ID can be used in checking whether a
certificate corresponds to the given public key.
</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and <code class="code">GNUTLS_E_SHORT_MEMORY_BUFFER</code> will
be returned. The output will normally be a SHA-1 hash output,
which is 20 bytes.
</p>
<p><strong class="strong">Returns:</strong> In case of failure a negative error code will be
returned, and 0 on success.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fget_005fkey_005fusage-1"><span>gnutls_pubkey_get_key_usage<a class="copiable-link" href="#gnutls_005fpubkey_005fget_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fget_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fget_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_get_key_usage</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, unsigned int * <var class="var">usage</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fget_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_pubkey_t</code> type
</p>
<p><var class="var">usage</var>: If set will return the number of bits of the parameters (may be NULL)
</p>
<p>This function will return the key usage of the public key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fget_005fopenpgp_005fkey_005fid-1"><span>gnutls_pubkey_get_openpgp_key_id<a class="copiable-link" href="#gnutls_005fpubkey_005fget_005fopenpgp_005fkey_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fget_005fopenpgp_005fkey_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fget_005fopenpgp_005fkey_005fid"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_get_openpgp_key_id</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, unsigned int <var class="var">flags</var>, unsigned char * <var class="var">output_data</var>, size_t * <var class="var">output_data_size</var>, unsigned int * <var class="var">subkey</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fget_005fopenpgp_005fkey_005fid"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">flags</var>: should be one of the flags from <code class="code">gnutls_keyid_flags_t</code>
</p>
<p><var class="var">output_data</var>: will contain the key ID
</p>
<p><var class="var">output_data_size</var>: holds the size of output_data (and will be
replaced by the actual size of parameters)
</p>
<p><var class="var">subkey</var>: ignored
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fget_005fpk_005falgorithm-1"><span>gnutls_pubkey_get_pk_algorithm<a class="copiable-link" href="#gnutls_005fpubkey_005fget_005fpk_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fget_005fpk_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fget_005fpk_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_get_pk_algorithm</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, unsigned int * <var class="var">bits</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fget_005fpk_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_pubkey_t</code> type
</p>
<p><var class="var">bits</var>: If set will return the number of bits of the parameters (may be NULL)
</p>
<p>This function will return the public key algorithm of a public
key and if possible will return a number of bits that indicates
the security parameter of the key.
</p>
<p><strong class="strong">Returns:</strong> a member of the <code class="code">gnutls_pk_algorithm_t</code> enumeration on
success, or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm-1"><span>gnutls_pubkey_get_preferred_hash_algorithm<a class="copiable-link" href="#gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_get_preferred_hash_algorithm</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_digest_algorithm_t * <var class="var">hash</var>, unsigned int * <var class="var">mand</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the certificate
</p>
<p><var class="var">hash</var>: The result of the call with the hash algorithm used for signature
</p>
<p><var class="var">mand</var>: If non zero it means that the algorithm MUST use this hash. May be NULL.
</p>
<p>This function will read the certificate and return the appropriate digest
algorithm to use for signing with this certificate. Some certificates (i.e.
DSA might not be able to sign without the preferred algorithm).
</p>
<p>To get the signature algorithm instead of just the hash use <code class="code">gnutls_pk_to_sign()</code>
with the algorithm of the certificate/key and the provided <code class="code">hash</code> .
</p>
<p><strong class="strong">Returns:</strong> the 0 if the hash algorithm is found. A negative error code is
returned on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fget_005fspki-1"><span>gnutls_pubkey_get_spki<a class="copiable-link" href="#gnutls_005fpubkey_005fget_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fget_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fget_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_get_spki</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pubkey</var>, gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fget_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">pubkey</var>: a public key of type <code class="code">gnutls_pubkey_t</code>
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_pubkey_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will return the public key information if available.
The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport-1"><span>gnutls_pubkey_import<a class="copiable-link" href="#gnutls_005fpubkey_005fimport-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The public key.
</p>
<p><var class="var">data</var>: The DER or PEM encoded certificate.
</p>
<p><var class="var">format</var>: One of DER or PEM
</p>
<p>This function will import the provided public key in
a SubjectPublicKeyInfo X.509 structure to a native
<code class="code">gnutls_pubkey_t</code> type. The output will be stored
in <code class="code">key</code> . If the public key is PEM encoded it should have a header
of "PUBLIC KEY".
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fdh_005fraw-1"><span>gnutls_pubkey_import_dh_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fdh_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fdh_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fdh_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_dh_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, const gnutls_dh_params_t <var class="var">params</var>, const gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fdh_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">params</var>: holds the <code class="code">gnutls_dh_params_t</code>
</p>
<p><var class="var">y</var>: holds the y
</p>
<p>This function will convert the given Diffie-Hellman raw parameters
to the native <code class="code">gnutls_pubkey_t</code> format. The output will be stored
in <code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.8.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fdsa_005fraw-1"><span>gnutls_pubkey_import_dsa_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fdsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fdsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fdsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_dsa_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">p</var>, const gnutls_datum_t * <var class="var">q</var>, const gnutls_datum_t * <var class="var">g</var>, const gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fdsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">p</var>: holds the p
</p>
<p><var class="var">q</var>: holds the q
</p>
<p><var class="var">g</var>: holds the g
</p>
<p><var class="var">y</var>: holds the y
</p>
<p>This function will convert the given DSA raw parameters to the
native <code class="code">gnutls_pubkey_t</code> format. The output will be stored
in <code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fecc_005fraw-1"><span>gnutls_pubkey_import_ecc_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fecc_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fecc_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fecc_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_ecc_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_ecc_curve_t <var class="var">curve</var>, const gnutls_datum_t * <var class="var">x</var>, const gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fecc_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">curve</var>: holds the curve
</p>
<p><var class="var">x</var>: holds the x-coordinate
</p>
<p><var class="var">y</var>: holds the y-coordinate
</p>
<p>This function will convert the given elliptic curve parameters to a
<code class="code">gnutls_pubkey_t</code> . The output will be stored in <code class="code">key</code> .
</p>
<p>In EdDSA curves the <code class="code">y</code> parameter should be <code class="code">NULL</code> and the <code class="code">x</code> parameter must
be the value in the native format for the curve.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fecc_005fx962-1"><span>gnutls_pubkey_import_ecc_x962<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fecc_005fx962-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fecc_005fx962"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fecc_005fx962"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_ecc_x962</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">parameters</var>, const gnutls_datum_t * <var class="var">ecpoint</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fecc_005fx962"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">parameters</var>: DER encoding of an ANSI X9.62 parameters
</p>
<p><var class="var">ecpoint</var>: DER encoding of ANSI X9.62 ECPoint
</p>
<p>This function will convert the given elliptic curve parameters to a
<code class="code">gnutls_pubkey_t</code> . The output will be stored in <code class="code">key</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fgost_005fraw-1"><span>gnutls_pubkey_import_gost_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fgost_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fgost_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fgost_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_gost_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_ecc_curve_t <var class="var">curve</var>, gnutls_digest_algorithm_t <var class="var">digest</var>, gnutls_gost_paramset_t <var class="var">paramset</var>, const gnutls_datum_t * <var class="var">x</var>, const gnutls_datum_t * <var class="var">y</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fgost_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The structure to store the parsed key
</p>
<p><var class="var">curve</var>: holds the curve
</p>
<p><var class="var">digest</var>: holds the digest
</p>
<p><var class="var">paramset</var>: holds the parameters id
</p>
<p><var class="var">x</var>: holds the x-coordinate
</p>
<p><var class="var">y</var>: holds the y-coordinate
</p>
<p>This function will convert the given GOST public key’s parameters to a
<code class="code">gnutls_pubkey_t</code> . The output will be stored in <code class="code">key</code> . <code class="code">digest</code> should be
one of GNUTLS_DIG_GOSR_94, GNUTLS_DIG_STREEBOG_256 or
GNUTLS_DIG_STREEBOG_512. If <code class="code">paramset</code> is set to GNUTLS_GOST_PARAMSET_UNKNOWN
default one will be selected depending on <code class="code">digest</code> .
</p>
<p><strong class="strong">Note:</strong> parameters should be stored with least significant byte first. On
version 3.6.3 big-endian format was used incorrectly.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fopenpgp-1"><span>gnutls_pubkey_import_openpgp<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fopenpgp-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fopenpgp"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fopenpgp"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_openpgp</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_openpgp_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fopenpgp"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The public key
</p>
<p><var class="var">crt</var>: The certificate to be imported
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fopenpgp_005fraw-1"><span>gnutls_pubkey_import_openpgp_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fopenpgp_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fopenpgp_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fopenpgp_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_openpgp_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_openpgp_crt_fmt_t <var class="var">format</var>, const gnutls_openpgp_keyid_t <var class="var">keyid</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fopenpgp_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The public key
</p>
<p><var class="var">data</var>: The public key data to be imported
</p>
<p><var class="var">format</var>: The format of the public key
</p>
<p><var class="var">keyid</var>: The key id to use (optional)
</p>
<p><var class="var">flags</var>: Should be zero
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fpkcs11-1"><span>gnutls_pubkey_import_pkcs11<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fpkcs11-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fpkcs11"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fpkcs11"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_pkcs11</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_pkcs11_obj_t <var class="var">obj</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fpkcs11"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The public key
</p>
<p><var class="var">obj</var>: The parameters to be imported
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>Imports a public key from a pkcs11 key. This function will import
the given public key to the abstract <code class="code">gnutls_pubkey_t</code> type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fprivkey-1"><span>gnutls_pubkey_import_privkey<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fprivkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fprivkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fprivkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_privkey</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_privkey_t <var class="var">pkey</var>, unsigned int <var class="var">usage</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fprivkey"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The public key
</p>
<p><var class="var">pkey</var>: The private key
</p>
<p><var class="var">usage</var>: GNUTLS_KEY_* key usage flags.
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>Imports the public key from a private. This function will import
the given public key to the abstract <code class="code">gnutls_pubkey_t</code> type.
</p>
<p>Note that in certain keys this operation may not be possible, e.g.,
in other than RSA PKCS<code class="code">11</code> keys.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005frsa_005fraw-1"><span>gnutls_pubkey_import_rsa_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005frsa_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005frsa_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005frsa_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_rsa_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">m</var>, const gnutls_datum_t * <var class="var">e</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005frsa_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The key
</p>
<p><var class="var">m</var>: holds the modulus
</p>
<p><var class="var">e</var>: holds the public exponent
</p>
<p>This function will replace the parameters in the given structure.
The new parameters should be stored in the appropriate
gnutls_datum.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, or an negative error code.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005ftpm_005fraw-1"><span>gnutls_pubkey_import_tpm_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005ftpm_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005ftpm_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005ftpm_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_tpm_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">fdata</var>, gnutls_tpmkey_fmt_t <var class="var">format</var>, const char * <var class="var">srk_password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005ftpm_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The public key
</p>
<p><var class="var">fdata</var>: The TPM key to be imported
</p>
<p><var class="var">format</var>: The format of the private key
</p>
<p><var class="var">srk_password</var>: The password for the SRK key (optional)
</p>
<p><var class="var">flags</var>: One of the GNUTLS_PUBKEY_* flags
</p>
<p>This function will import the public key from the provided TPM key
structure.
</p>
<p>With respect to passwords the same as in
<code class="code">gnutls_pubkey_import_tpm_url()</code> apply.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005ftpm_005furl-1"><span>gnutls_pubkey_import_tpm_url<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005ftpm_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005ftpm_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005ftpm_005furl-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_tpm_url</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pkey</var>, const char * <var class="var">url</var>, const char * <var class="var">srk_password</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005ftpm_005furl-1"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The public key
</p>
<p><var class="var">url</var>: The URL of the TPM key to be imported
</p>
<p><var class="var">srk_password</var>: The password for the SRK key (optional)
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import the given private key to the abstract
<code class="code">gnutls_privkey_t</code> type.
</p>
<p>Note that unless <code class="code">GNUTLS_PUBKEY_DISABLE_CALLBACKS</code>
is specified, if incorrect (or NULL) passwords are given
the PKCS11 callback functions will be used to obtain the
correct passwords. Otherwise if the SRK password is wrong
<code class="code">GNUTLS_E_TPM_SRK_PASSWORD_ERROR</code> is returned.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005furl-1"><span>gnutls_pubkey_import_url<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005furl"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_url</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, const char * <var class="var">url</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005furl"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_pubkey_t</code>
</p>
<p><var class="var">url</var>: A PKCS 11 url
</p>
<p><var class="var">flags</var>: One of GNUTLS_PKCS11_OBJ_* flags
</p>
<p>This function will import a public key from the provided URL.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fx509-1"><span>gnutls_pubkey_import_x509<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fx509-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fx509"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fx509"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_x509</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crt_t <var class="var">crt</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fx509"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The public key
</p>
<p><var class="var">crt</var>: The certificate to be imported
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import the given public key to the abstract
<code class="code">gnutls_pubkey_t</code> type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fx509_005fcrq-1"><span>gnutls_pubkey_import_x509_crq<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fx509_005fcrq-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fx509_005fcrq"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fx509_005fcrq"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_x509_crq</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_x509_crq_t <var class="var">crq</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fx509_005fcrq"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: The public key
</p>
<p><var class="var">crq</var>: The certificate to be imported
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import the given public key to the abstract
<code class="code">gnutls_pubkey_t</code> type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fimport_005fx509_005fraw-1"><span>gnutls_pubkey_import_x509_raw<a class="copiable-link" href="#gnutls_005fpubkey_005fimport_005fx509_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fimport_005fx509_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fimport_005fx509_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_import_x509_raw</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pkey</var>, const gnutls_datum_t * <var class="var">data</var>, gnutls_x509_crt_fmt_t <var class="var">format</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fimport_005fx509_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">pkey</var>: The public key
</p>
<p><var class="var">data</var>: The public key data to be imported
</p>
<p><var class="var">format</var>: The format of the public key
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will import the given public key to the abstract
<code class="code">gnutls_pubkey_t</code> type.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005finit-1"><span>gnutls_pubkey_init<a class="copiable-link" href="#gnutls_005fpubkey_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_init</strong> <code class="def-code-arguments">(gnutls_pubkey_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005finit"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A pointer to the type to be initialized
</p>
<p>This function will initialize a public key.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fprint-1"><span>gnutls_pubkey_print<a class="copiable-link" href="#gnutls_005fpubkey_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_print</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pubkey</var>, gnutls_certificate_print_formats_t <var class="var">format</var>, gnutls_datum_t * <var class="var">out</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">pubkey</var>: The data to be printed
</p>
<p><var class="var">format</var>: Indicate the format to use
</p>
<p><var class="var">out</var>: Newly allocated datum with null terminated string.
</p>
<p>This function will pretty print public key information, suitable for
display to a human.
</p>
<p>Only <code class="code">GNUTLS_CRT_PRINT_FULL</code> and <code class="code">GNUTLS_CRT_PRINT_FULL_NUMBERS</code>
are implemented.
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.1.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fset_005fkey_005fusage-1"><span>gnutls_pubkey_set_key_usage<a class="copiable-link" href="#gnutls_005fpubkey_005fset_005fkey_005fusage-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fset_005fkey_005fusage"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fset_005fkey_005fusage"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_set_key_usage</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, unsigned int <var class="var">usage</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fset_005fkey_005fusage"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">usage</var>: an ORed sequence of the GNUTLS_KEY_* elements.
</p>
<p>This function will set the key usage flags of the public key. This
is only useful if the key is to be exported to a certificate or
certificate request.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fset_005fpin_005ffunction-1"><span>gnutls_pubkey_set_pin_function<a class="copiable-link" href="#gnutls_005fpubkey_005fset_005fpin_005ffunction-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fset_005fpin_005ffunction"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fset_005fpin_005ffunction"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_pubkey_set_pin_function</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_pin_callback_t <var class="var">fn</var>, void * <var class="var">userdata</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fset_005fpin_005ffunction"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: A key of type <code class="code">gnutls_pubkey_t</code>
</p>
<p><var class="var">fn</var>: the callback
</p>
<p><var class="var">userdata</var>: data associated with the callback
</p>
<p>This function will set a callback function to be used when
required to access the object. This function overrides any other
global PIN functions.
</p>
<p>Note that this function must be called right after initialization
to have effect.
</p>
<p><strong class="strong">Since:</strong> 3.1.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fset_005fspki-1"><span>gnutls_pubkey_set_spki<a class="copiable-link" href="#gnutls_005fpubkey_005fset_005fspki-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fset_005fspki"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fset_005fspki"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_set_spki</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pubkey</var>, const gnutls_x509_spki_t <var class="var">spki</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fset_005fspki"> ¶</a></span></dt>
<dd><p><var class="var">pubkey</var>: a public key of type <code class="code">gnutls_pubkey_t</code>
</p>
<p><var class="var">spki</var>: a SubjectPublicKeyInfo structure of type <code class="code">gnutls_pubkey_spki_t</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>This function will set the public key information.
The provided <code class="code">spki</code> must be initialized.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fverify_005fdata2-1"><span>gnutls_pubkey_verify_data2<a class="copiable-link" href="#gnutls_005fpubkey_005fverify_005fdata2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fverify_005fdata2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fverify_005fdata2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_verify_data2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">pubkey</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">data</var>, const gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fverify_005fdata2-1"> ¶</a></span></dt>
<dd><p><var class="var">pubkey</var>: Holds the public key
</p>
<p><var class="var">algo</var>: The signature algorithm used
</p>
<p><var class="var">flags</var>: Zero or an OR list of <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p><var class="var">data</var>: holds the signed data
</p>
<p><var class="var">signature</var>: contains the signature
</p>
<p>This function will verify the given signed data, using the
parameters from the certificate.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code>
is returned, and zero or positive code on success. For known to be insecure
signatures this function will return <code class="code">GNUTLS_E_INSUFFICIENT_SECURITY</code> unless
the flag <code class="code">GNUTLS_VERIFY_ALLOW_BROKEN</code> is specified.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fverify_005fhash2-1"><span>gnutls_pubkey_verify_hash2<a class="copiable-link" href="#gnutls_005fpubkey_005fverify_005fhash2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fverify_005fhash2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fverify_005fhash2-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_verify_hash2</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>, gnutls_sign_algorithm_t <var class="var">algo</var>, unsigned int <var class="var">flags</var>, const gnutls_datum_t * <var class="var">hash</var>, const gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fverify_005fhash2-1"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the public key
</p>
<p><var class="var">algo</var>: The signature algorithm used
</p>
<p><var class="var">flags</var>: Zero or an OR list of <code class="code">gnutls_certificate_verify_flags</code>
</p>
<p><var class="var">hash</var>: holds the hash digest to be verified
</p>
<p><var class="var">signature</var>: contains the signature
</p>
<p>This function will verify the given signed digest, using the
parameters from the public key. Note that unlike <code class="code">gnutls_privkey_sign_hash()</code> ,
this function accepts a signature algorithm instead of a digest algorithm.
You can use <code class="code">gnutls_pk_to_sign()</code> to get the appropriate value.
</p>
<p><strong class="strong">Returns:</strong> In case of a verification failure <code class="code">GNUTLS_E_PK_SIG_VERIFY_FAILED</code>
is returned, and zero or positive code on success. For known to be insecure
signatures this function will return <code class="code">GNUTLS_E_INSUFFICIENT_SECURITY</code> unless
the flag <code class="code">GNUTLS_VERIFY_ALLOW_BROKEN</code> is specified.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpubkey_005fverify_005fparams-1"><span>gnutls_pubkey_verify_params<a class="copiable-link" href="#gnutls_005fpubkey_005fverify_005fparams-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpubkey_005fverify_005fparams"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpubkey_005fverify_005fparams"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pubkey_verify_params</strong> <code class="def-code-arguments">(gnutls_pubkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fpubkey_005fverify_005fparams"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: should contain a <code class="code">gnutls_pubkey_t</code> type
</p>
<p>This function will verify the public key parameters.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fregister_005fcustom_005furl-1"><span>gnutls_register_custom_url<a class="copiable-link" href="#gnutls_005fregister_005fcustom_005furl-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fregister_005fcustom_005furl"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fregister_005fcustom_005furl-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_register_custom_url</strong> <code class="def-code-arguments">(const gnutls_custom_url_st * <var class="var">st</var>)</code><a class="copiable-link" href="#index-gnutls_005fregister_005fcustom_005furl-1"> ¶</a></span></dt>
<dd><p><var class="var">st</var>: A <code class="code">gnutls_custom_url_st</code> structure
</p>
<p>Register a custom URL. This will affect the following functions:
<code class="code">gnutls_url_is_supported()</code> , <code class="code">gnutls_privkey_import_url()</code> ,
gnutls_pubkey_import_url, <code class="code">gnutls_x509_crt_import_url()</code>
and all functions that depend on
them, e.g., <code class="code">gnutls_certificate_set_x509_key_file2()</code> .
</p>
<p>The provided structure and callback functions must be valid throughout
the lifetime of the process. The registration of an existing URL type
will fail with <code class="code">GNUTLS_E_INVALID_REQUEST</code> . Since GnuTLS 3.5.0 this function
can be used to override the builtin URLs.
</p>
<p>This function is not thread safe.
</p>
<p><strong class="strong">Returns:</strong> returns zero if the given structure was imported or a negative value otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsystem_005fkey_005fadd_005fx509-1"><span>gnutls_system_key_add_x509<a class="copiable-link" href="#gnutls_005fsystem_005fkey_005fadd_005fx509-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsystem_005fkey_005fadd_005fx509"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsystem_005fkey_005fadd_005fx509"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_system_key_add_x509</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_privkey_t <var class="var">privkey</var>, const char * <var class="var">label</var>, char ** <var class="var">cert_url</var>, char ** <var class="var">key_url</var>)</code><a class="copiable-link" href="#index-gnutls_005fsystem_005fkey_005fadd_005fx509"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: the certificate to be added
</p>
<p><var class="var">privkey</var>: the key to be added
</p>
<p><var class="var">label</var>: the friendly name to describe the key
</p>
<p><var class="var">cert_url</var>: if non-NULL it will contain an allocated value with the certificate URL
</p>
<p><var class="var">key_url</var>: if non-NULL it will contain an allocated value with the key URL
</p>
<p>This function will added the given key and certificate pair,
to the system list.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsystem_005fkey_005fdelete-1"><span>gnutls_system_key_delete<a class="copiable-link" href="#gnutls_005fsystem_005fkey_005fdelete-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsystem_005fkey_005fdelete"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsystem_005fkey_005fdelete"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_system_key_delete</strong> <code class="def-code-arguments">(const char * <var class="var">cert_url</var>, const char * <var class="var">key_url</var>)</code><a class="copiable-link" href="#index-gnutls_005fsystem_005fkey_005fdelete"> ¶</a></span></dt>
<dd><p><var class="var">cert_url</var>: the URL of the certificate
</p>
<p><var class="var">key_url</var>: the URL of the key
</p>
<p>This function will delete the key and certificate pair.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsystem_005fkey_005fiter_005fdeinit-1"><span>gnutls_system_key_iter_deinit<a class="copiable-link" href="#gnutls_005fsystem_005fkey_005fiter_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsystem_005fkey_005fiter_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsystem_005fkey_005fiter_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_system_key_iter_deinit</strong> <code class="def-code-arguments">(gnutls_system_key_iter_t <var class="var">iter</var>)</code><a class="copiable-link" href="#index-gnutls_005fsystem_005fkey_005fiter_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">iter</var>: an iterator of system keys
</p>
<p>This function will deinitialize the iterator.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fsystem_005fkey_005fiter_005fget_005finfo-1"><span>gnutls_system_key_iter_get_info<a class="copiable-link" href="#gnutls_005fsystem_005fkey_005fiter_005fget_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fsystem_005fkey_005fiter_005fget_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fsystem_005fkey_005fiter_005fget_005finfo-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_system_key_iter_get_info</strong> <code class="def-code-arguments">(gnutls_system_key_iter_t * <var class="var">iter</var>, unsigned <var class="var">cert_type</var>, char ** <var class="var">cert_url</var>, char ** <var class="var">key_url</var>, char ** <var class="var">label</var>, gnutls_datum_t * <var class="var">der</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fsystem_005fkey_005fiter_005fget_005finfo-1"> ¶</a></span></dt>
<dd><p><var class="var">iter</var>: an iterator of the system keys (must be set to <code class="code">NULL</code> initially)
</p>
<p><var class="var">cert_type</var>: A value of gnutls_certificate_type_t which indicates the type of certificate to look for
</p>
<p><var class="var">cert_url</var>: The certificate URL of the pair (may be <code class="code">NULL</code> )
</p>
<p><var class="var">key_url</var>: The key URL of the pair (may be <code class="code">NULL</code> )
</p>
<p><var class="var">label</var>: The friendly name (if any) of the pair (may be <code class="code">NULL</code> )
</p>
<p><var class="var">der</var>: if non-NULL the DER data of the certificate
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will return on each call a certificate
and key pair URLs, as well as a label associated with them,
and the DER-encoded certificate. When the iteration is complete it will
return <code class="code">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code> .
</p>
<p>Typically <code class="code">cert_type</code> should be <code class="code">GNUTLS_CRT_X509</code> .
</p>
<p>All values set are allocated and must be cleared using <code class="code">gnutls_free()</code> ,
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrl_005fprivkey_005fsign-1"><span>gnutls_x509_crl_privkey_sign<a class="copiable-link" href="#gnutls_005fx509_005fcrl_005fprivkey_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrl_005fprivkey_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrl_005fprivkey_005fsign-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crl_privkey_sign</strong> <code class="def-code-arguments">(gnutls_x509_crl_t <var class="var">crl</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrl_005fprivkey_005fsign-1"> ¶</a></span></dt>
<dd><p><var class="var">crl</var>: should contain a gnutls_x509_crl_t type
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p><var class="var">dig</var>: The message digest to use. GNUTLS_DIG_SHA256 is the safe choice unless you know what you’re doing.
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the CRL with the issuer’s private key, and
will copy the issuer’s information into the CRL.
</p>
<p>This must be the last step in a certificate CRL since all
the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed CRL will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p>Since 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fprivkey_005fsign-1"><span>gnutls_x509_crq_privkey_sign<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fprivkey_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fprivkey_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fprivkey_005fsign"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_privkey_sign</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_privkey_t <var class="var">key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fprivkey_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a private key
</p>
<p><var class="var">dig</var>: The message digest to use, i.e., <code class="code">GNUTLS_DIG_SHA1</code>
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the certificate request with a private key.
This must be the same key as the one used in
<code class="code">gnutls_x509_crt_set_key()</code> since a certificate request is self
signed.
</p>
<p>This must be the last step in a certificate request generation
since all the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed request will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
<code class="code">GNUTLS_E_ASN1_VALUE_NOT_FOUND</code> is returned if you didn’t set all
information in the certificate request (e.g., the version using
<code class="code">gnutls_x509_crq_set_version()</code> ).
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrq_005fset_005fpubkey-1"><span>gnutls_x509_crq_set_pubkey<a class="copiable-link" href="#gnutls_005fx509_005fcrq_005fset_005fpubkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrq_005fset_005fpubkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrq_005fset_005fpubkey-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crq_set_pubkey</strong> <code class="def-code-arguments">(gnutls_x509_crq_t <var class="var">crq</var>, gnutls_pubkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrq_005fset_005fpubkey-1"> ¶</a></span></dt>
<dd><p><var class="var">crq</var>: should contain a <code class="code">gnutls_x509_crq_t</code> type
</p>
<p><var class="var">key</var>: holds a public key
</p>
<p>This function will set the public parameters from the given public
key to the request. The <code class="code">key</code> can be deallocated after that.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fprivkey_005fsign-1"><span>gnutls_x509_crt_privkey_sign<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fprivkey_005fsign-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fprivkey_005fsign"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fprivkey_005fsign"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_privkey_sign</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_x509_crt_t <var class="var">issuer</var>, gnutls_privkey_t <var class="var">issuer_key</var>, gnutls_digest_algorithm_t <var class="var">dig</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fprivkey_005fsign"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: a certificate of type <code class="code">gnutls_x509_crt_t</code>
</p>
<p><var class="var">issuer</var>: is the certificate of the certificate issuer
</p>
<p><var class="var">issuer_key</var>: holds the issuer’s private key
</p>
<p><var class="var">dig</var>: The message digest to use, <code class="code">GNUTLS_DIG_SHA256</code> is a safe choice
</p>
<p><var class="var">flags</var>: must be 0
</p>
<p>This function will sign the certificate with the issuer’s private key, and
will copy the issuer’s information into the certificate.
</p>
<p>This must be the last step in a certificate generation since all
the previously set parameters are now signed.
</p>
<p>A known limitation of this function is, that a newly-signed certificate will not
be fully functional (e.g., for signature verification), until it
is exported an re-imported.
</p>
<p>After GnuTLS 3.6.1 the value of <code class="code">dig</code> may be <code class="code">GNUTLS_DIG_UNKNOWN</code> ,
and in that case, a suitable but reasonable for the key algorithm will be selected.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fset_005fpubkey-1"><span>gnutls_x509_crt_set_pubkey<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fset_005fpubkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fset_005fpubkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fset_005fpubkey-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_set_pubkey</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_pubkey_t <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fset_005fpubkey-1"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: should contain a <code class="code">gnutls_x509_crt_t</code> type
</p>
<p><var class="var">key</var>: holds a public key
</p>
<p>This function will set the public parameters from the given public
key to the certificate. The <code class="code">key</code> can be deallocated after that.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Socket-specific-API">
<div class="nav-panel">
<p>
Next: <a href="#DANE-API" accesskey="n" rel="next">DANE API</a>, Previous: <a href="#Abstract-key-API" accesskey="p" rel="prev">Abstract key API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Socket-specific-API-1"><span>E.10 Socket specific API<a class="copiable-link" href="#Socket-specific-API-1"> ¶</a></span></h3>
<p>The prototypes for the following functions lie in
<samp class="file">gnutls/socket.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005ftransport_005fset_005ffastopen-1"><span>gnutls_transport_set_fastopen<a class="copiable-link" href="#gnutls_005ftransport_005fset_005ffastopen-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005ftransport_005fset_005ffastopen"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005ftransport_005fset_005ffastopen-1"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_transport_set_fastopen</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>, int <var class="var">fd</var>, struct sockaddr * <var class="var">connect_addr</var>, socklen_t <var class="var">connect_addrlen</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005ftransport_005fset_005ffastopen-1"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p><var class="var">fd</var>: is the session’s socket descriptor
</p>
<p><var class="var">connect_addr</var>: is the address we want to connect to
</p>
<p><var class="var">connect_addrlen</var>: is the length of <code class="code">connect_addr</code>
</p>
<p><var class="var">flags</var>: must be zero
</p>
<p>Enables TCP Fast Open (TFO) for the specified TLS client session.
That means that TCP connection establishment and the transmission
of the first TLS client hello packet are combined. The
peer’s address must be specified in <code class="code">connect_addr</code> and <code class="code">connect_addrlen</code> ,
and the socket specified by <code class="code">fd</code> should not be connected.
</p>
<p>TFO only works for TCP sockets of type AF_INET and AF_INET6.
If the OS doesn’t support TCP fast open this function will result
to gnutls using <code class="code">connect()</code> transparently during the first write.
</p>
<p><strong class="strong">Note:</strong> This function overrides all the transport callback functions.
If this is undesirable, TCP Fast Open must be implemented on the user
callback functions without calling this function. When using
this function, transport callbacks must not be set, and
<code class="code">gnutls_transport_set_ptr()</code> or <code class="code">gnutls_transport_set_int()</code>
must not be called.
</p>
<p>On GNU/Linux TFO has to be enabled at the system layer, that is
in /proc/sys/net/ipv4/tcp_fastopen, bit 0 has to be set.
</p>
<p>This function has no effect on server sessions.
</p>
<p><strong class="strong">Since:</strong> 3.5.3
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="DANE-API">
<div class="nav-panel">
<p>
Next: <a href="#Cryptographic-API" accesskey="n" rel="next">Cryptographic API</a>, Previous: <a href="#Socket-specific-API" accesskey="p" rel="prev">Socket specific API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="DANE-API-1"><span>E.11 DANE API<a class="copiable-link" href="#DANE-API-1"> ¶</a></span></h3>
<p>The following functions are to be used for DANE certificate verification.
Their prototypes lie in <samp class="file">gnutls/dane.h</samp>. Note that you need to link
with the <code class="code">libgnutls-dane</code> library to use them.
</p>
<h4 class="subheading" id="dane_005fcert_005ftype_005fname-1"><span>dane_cert_type_name<a class="copiable-link" href="#dane_005fcert_005ftype_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fcert_005ftype_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fcert_005ftype_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">dane_cert_type_name</strong> <code class="def-code-arguments">(dane_cert_type_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-dane_005fcert_005ftype_005fname"> ¶</a></span></dt>
<dd><p><var class="var">type</var>: is a DANE match type
</p>
<p>Convert a <code class="code">dane_cert_type_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified
type, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="dane_005fcert_005fusage_005fname-1"><span>dane_cert_usage_name<a class="copiable-link" href="#dane_005fcert_005fusage_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fcert_005fusage_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fcert_005fusage_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">dane_cert_usage_name</strong> <code class="def-code-arguments">(dane_cert_usage_t <var class="var">usage</var>)</code><a class="copiable-link" href="#index-dane_005fcert_005fusage_005fname"> ¶</a></span></dt>
<dd><p><var class="var">usage</var>: is a DANE certificate usage
</p>
<p>Convert a <code class="code">dane_cert_usage_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified
type, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="dane_005fmatch_005ftype_005fname-1"><span>dane_match_type_name<a class="copiable-link" href="#dane_005fmatch_005ftype_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fmatch_005ftype_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fmatch_005ftype_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">dane_match_type_name</strong> <code class="def-code-arguments">(dane_match_type_t <var class="var">type</var>)</code><a class="copiable-link" href="#index-dane_005fmatch_005ftype_005fname"> ¶</a></span></dt>
<dd><p><var class="var">type</var>: is a DANE match type
</p>
<p>Convert a <code class="code">dane_match_type_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a string that contains the name of the specified
type, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="dane_005fquery_005fdata-1"><span>dane_query_data<a class="copiable-link" href="#dane_005fquery_005fdata-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fquery_005fdata"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fquery_005fdata"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_query_data</strong> <code class="def-code-arguments">(dane_query_t <var class="var">q</var>, unsigned int <var class="var">idx</var>, unsigned int * <var class="var">usage</var>, unsigned int * <var class="var">type</var>, unsigned int * <var class="var">match</var>, gnutls_datum_t * <var class="var">data</var>)</code><a class="copiable-link" href="#index-dane_005fquery_005fdata"> ¶</a></span></dt>
<dd><p><var class="var">q</var>: The query result structure
</p>
<p><var class="var">idx</var>: The index of the query response.
</p>
<p><var class="var">usage</var>: The certificate usage (see <code class="code">dane_cert_usage_t</code> )
</p>
<p><var class="var">type</var>: The certificate type (see <code class="code">dane_cert_type_t</code> )
</p>
<p><var class="var">match</var>: The DANE matching type (see <code class="code">dane_match_type_t</code> )
</p>
<p><var class="var">data</var>: The DANE data.
</p>
<p>This function will provide the DANE data from the query
response.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">DANE_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="dane_005fquery_005fdeinit-1"><span>dane_query_deinit<a class="copiable-link" href="#dane_005fquery_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fquery_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fquery_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">dane_query_deinit</strong> <code class="def-code-arguments">(dane_query_t <var class="var">q</var>)</code><a class="copiable-link" href="#index-dane_005fquery_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">q</var>: The structure to be deinitialized
</p>
<p>This function will deinitialize a DANE query result structure.
</p></dd></dl>
<h4 class="subheading" id="dane_005fquery_005fentries-1"><span>dane_query_entries<a class="copiable-link" href="#dane_005fquery_005fentries-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fquery_005fentries"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fquery_005fentries"><span class="category-def">Function: </span><span><code class="def-type">unsigned int</code> <strong class="def-name">dane_query_entries</strong> <code class="def-code-arguments">(dane_query_t <var class="var">q</var>)</code><a class="copiable-link" href="#index-dane_005fquery_005fentries"> ¶</a></span></dt>
<dd><p><var class="var">q</var>: The query result structure
</p>
<p>This function will return the number of entries in a query.
</p>
<p><strong class="strong">Returns:</strong> The number of entries.
</p></dd></dl>
<h4 class="subheading" id="dane_005fquery_005fstatus-1"><span>dane_query_status<a class="copiable-link" href="#dane_005fquery_005fstatus-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fquery_005fstatus"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fquery_005fstatus"><span class="category-def">Function: </span><span><code class="def-type">dane_query_status_t</code> <strong class="def-name">dane_query_status</strong> <code class="def-code-arguments">(dane_query_t <var class="var">q</var>)</code><a class="copiable-link" href="#index-dane_005fquery_005fstatus"> ¶</a></span></dt>
<dd><p><var class="var">q</var>: The query result structure
</p>
<p>This function will return the status of the query response.
See <code class="code">dane_query_status_t</code> for the possible types.
</p>
<p><strong class="strong">Returns:</strong> The status type.
</p></dd></dl>
<h4 class="subheading" id="dane_005fquery_005ftlsa-1"><span>dane_query_tlsa<a class="copiable-link" href="#dane_005fquery_005ftlsa-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fquery_005ftlsa"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fquery_005ftlsa"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_query_tlsa</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>, dane_query_t * <var class="var">r</var>, const char * <var class="var">host</var>, const char * <var class="var">proto</var>, unsigned int <var class="var">port</var>)</code><a class="copiable-link" href="#index-dane_005fquery_005ftlsa"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: The DANE state structure
</p>
<p><var class="var">r</var>: A structure to place the result
</p>
<p><var class="var">host</var>: The host name to resolve.
</p>
<p><var class="var">proto</var>: The protocol type (tcp, udp, etc.)
</p>
<p><var class="var">port</var>: The service port number (eg. 443).
</p>
<p>This function will query the DNS server for the TLSA (DANE)
data for the given host.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">DANE_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="dane_005fquery_005fto_005fraw_005ftlsa-1"><span>dane_query_to_raw_tlsa<a class="copiable-link" href="#dane_005fquery_005fto_005fraw_005ftlsa-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fquery_005fto_005fraw_005ftlsa"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fquery_005fto_005fraw_005ftlsa"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_query_to_raw_tlsa</strong> <code class="def-code-arguments">(dane_query_t <var class="var">q</var>, unsigned int * <var class="var">data_entries</var>, char *** <var class="var">dane_data</var>, int ** <var class="var">dane_data_len</var>, int * <var class="var">secure</var>, int * <var class="var">bogus</var>)</code><a class="copiable-link" href="#index-dane_005fquery_005fto_005fraw_005ftlsa"> ¶</a></span></dt>
<dd><p><var class="var">q</var>: The query result structure
</p>
<p><var class="var">data_entries</var>: Pointer set to the number of entries in the query
</p>
<p><var class="var">dane_data</var>: Pointer to contain an array of DNS rdata items, terminated with a NULL pointer;
caller must guarantee that the referenced data remains
valid until <code class="code">dane_query_deinit()</code> is called.
</p>
<p><var class="var">dane_data_len</var>: Pointer to contain the length n bytes of the dane_data items
</p>
<p><var class="var">secure</var>: Pointer set true if the result is validated securely, false if
validation failed or the domain queried has no security info
</p>
<p><var class="var">bogus</var>: Pointer set true if the result was not secure due to a security failure
</p>
<p>This function will provide the DANE data from the query
response.
</p>
<p>The pointers dane_data and dane_data_len are allocated with <code class="code">gnutls_malloc()</code>
to contain the data from the query result structure (individual
<code class="code">dane_data</code> items simply point to the original data and are not allocated separately).
The returned <code class="code">dane_data</code> are only valid during the lifetime of <code class="code">q</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">DANE_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="dane_005fraw_005ftlsa-1"><span>dane_raw_tlsa<a class="copiable-link" href="#dane_005fraw_005ftlsa-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fraw_005ftlsa"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fraw_005ftlsa"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_raw_tlsa</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>, dane_query_t * <var class="var">r</var>, char *const * <var class="var">dane_data</var>, const int * <var class="var">dane_data_len</var>, int <var class="var">secure</var>, int <var class="var">bogus</var>)</code><a class="copiable-link" href="#index-dane_005fraw_005ftlsa"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: The DANE state structure
</p>
<p><var class="var">r</var>: A structure to place the result
</p>
<p><var class="var">dane_data</var>: array of DNS rdata items, terminated with a NULL pointer;
caller must guarantee that the referenced data remains
valid until <code class="code">dane_query_deinit()</code> is called.
</p>
<p><var class="var">dane_data_len</var>: the length n bytes of the dane_data items
</p>
<p><var class="var">secure</var>: true if the result is validated securely, false if
validation failed or the domain queried has no security info
</p>
<p><var class="var">bogus</var>: if the result was not secure (secure = 0) due to a security failure,
and the result is due to a security failure, bogus is true.
</p>
<p>This function will fill in the TLSA (DANE) structure from
the given raw DNS record data. The <code class="code">dane_data</code> must be valid
during the lifetime of the query.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">DANE_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="dane_005fstate_005fdeinit-1"><span>dane_state_deinit<a class="copiable-link" href="#dane_005fstate_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fstate_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fstate_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">dane_state_deinit</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>)</code><a class="copiable-link" href="#index-dane_005fstate_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: The structure to be deinitialized
</p>
<p>This function will deinitialize a DANE query structure.
</p></dd></dl>
<h4 class="subheading" id="dane_005fstate_005finit-1"><span>dane_state_init<a class="copiable-link" href="#dane_005fstate_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fstate_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fstate_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_state_init</strong> <code class="def-code-arguments">(dane_state_t * <var class="var">s</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-dane_005fstate_005finit"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: The structure to be initialized
</p>
<p><var class="var">flags</var>: flags from the <code class="code">dane_state_flags</code> enumeration
</p>
<p>This function will initialize the backend resolver. It is
intended to be used in scenarios where multiple resolvings
occur, to optimize against multiple re-initializations.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">DANE_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="dane_005fstate_005fset_005fdlv_005ffile-1"><span>dane_state_set_dlv_file<a class="copiable-link" href="#dane_005fstate_005fset_005fdlv_005ffile-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fstate_005fset_005fdlv_005ffile"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fstate_005fset_005fdlv_005ffile"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_state_set_dlv_file</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>, const char * <var class="var">file</var>)</code><a class="copiable-link" href="#index-dane_005fstate_005fset_005fdlv_005ffile"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: The structure to be deinitialized
</p>
<p><var class="var">file</var>: The file holding the DLV keys.
</p>
<p>This function will set a file with trusted keys
for DLV (DNSSEC Lookaside Validation).
</p></dd></dl>
<h4 class="subheading" id="dane_005fstrerror-1"><span>dane_strerror<a class="copiable-link" href="#dane_005fstrerror-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fstrerror"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fstrerror"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">dane_strerror</strong> <code class="def-code-arguments">(int <var class="var">error</var>)</code><a class="copiable-link" href="#index-dane_005fstrerror"> ¶</a></span></dt>
<dd><p><var class="var">error</var>: is a DANE error code, a negative error code
</p>
<p>This function is similar to strerror. The difference is that it
accepts an error number returned by a gnutls function; In case of
an unknown error a descriptive string is sent instead of <code class="code">NULL</code> .
</p>
<p>Error codes are always a negative error code.
</p>
<p><strong class="strong">Returns:</strong> A string explaining the DANE error message.
</p></dd></dl>
<h4 class="subheading" id="dane_005fverification_005fstatus_005fprint-1"><span>dane_verification_status_print<a class="copiable-link" href="#dane_005fverification_005fstatus_005fprint-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fverification_005fstatus_005fprint"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fverification_005fstatus_005fprint"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_verification_status_print</strong> <code class="def-code-arguments">(unsigned int <var class="var">status</var>, gnutls_datum_t * <var class="var">out</var>, unsigned int <var class="var">flags</var>)</code><a class="copiable-link" href="#index-dane_005fverification_005fstatus_005fprint"> ¶</a></span></dt>
<dd><p><var class="var">status</var>: The status flags to be printed
</p>
<p><var class="var">out</var>: Newly allocated datum with (0) terminated string.
</p>
<p><var class="var">flags</var>: should be zero
</p>
<p>This function will pretty print the status of a verification
process – eg. the one obtained by <code class="code">dane_verify_crt()</code> .
</p>
<p>The output <code class="code">out</code> needs to be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p></dd></dl>
<h4 class="subheading" id="dane_005fverify_005fcrt-1"><span>dane_verify_crt<a class="copiable-link" href="#dane_005fverify_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fverify_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fverify_005fcrt-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_verify_crt</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>, const gnutls_datum_t * <var class="var">chain</var>, unsigned <var class="var">chain_size</var>, gnutls_certificate_type_t <var class="var">chain_type</var>, const char * <var class="var">hostname</var>, const char * <var class="var">proto</var>, unsigned int <var class="var">port</var>, unsigned int <var class="var">sflags</var>, unsigned int <var class="var">vflags</var>, unsigned int * <var class="var">verify</var>)</code><a class="copiable-link" href="#index-dane_005fverify_005fcrt-1"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: A DANE state structure (may be NULL)
</p>
<p><var class="var">chain</var>: A certificate chain
</p>
<p><var class="var">chain_size</var>: The size of the chain
</p>
<p><var class="var">chain_type</var>: The type of the certificate chain
</p>
<p><var class="var">hostname</var>: The hostname associated with the chain
</p>
<p><var class="var">proto</var>: The protocol of the service connecting (e.g. tcp)
</p>
<p><var class="var">port</var>: The port of the service connecting (e.g. 443)
</p>
<p><var class="var">sflags</var>: Flags for the initialization of <code class="code">s</code> (if NULL)
</p>
<p><var class="var">vflags</var>: Verification flags; an OR’ed list of <code class="code">dane_verify_flags_t</code> .
</p>
<p><var class="var">verify</var>: An OR’ed list of <code class="code">dane_verify_status_t</code> .
</p>
<p>This function will verify the given certificate chain against the
CA constrains and/or the certificate available via DANE.
If no information via DANE can be obtained the flag <code class="code">DANE_VERIFY_NO_DANE_INFO</code>
is set. If a DNSSEC signature is not available for the DANE
record then the verify flag <code class="code">DANE_VERIFY_NO_DNSSEC_DATA</code> is set.
</p>
<p>Due to the many possible options of DANE, there is no single threat
model countered. When notifying the user about DANE verification results
it may be better to mention: DANE verification did not reject the certificate,
rather than mentioning a successful DANE verification.
</p>
<p>Note that this function is designed to be run in addition to
PKIX - certificate chain - verification. To be run independently
the <code class="code">DANE_VFLAG_ONLY_CHECK_EE_USAGE</code> flag should be specified;
then the function will check whether the key of the peer matches the
key advertised in the DANE entry.
</p>
<p><strong class="strong">Returns:</strong> a negative error code on error and <code class="code">DANE_E_SUCCESS</code> (0)
when the DANE entries were successfully parsed, irrespective of
whether they were verified (see <code class="code">verify</code> for that information). If
no usable entries were encountered <code class="code">DANE_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<h4 class="subheading" id="dane_005fverify_005fcrt_005fraw-1"><span>dane_verify_crt_raw<a class="copiable-link" href="#dane_005fverify_005fcrt_005fraw-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fverify_005fcrt_005fraw"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fverify_005fcrt_005fraw"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_verify_crt_raw</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>, const gnutls_datum_t * <var class="var">chain</var>, unsigned <var class="var">chain_size</var>, gnutls_certificate_type_t <var class="var">chain_type</var>, dane_query_t <var class="var">r</var>, unsigned int <var class="var">sflags</var>, unsigned int <var class="var">vflags</var>, unsigned int * <var class="var">verify</var>)</code><a class="copiable-link" href="#index-dane_005fverify_005fcrt_005fraw"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: A DANE state structure (may be NULL)
</p>
<p><var class="var">chain</var>: A certificate chain
</p>
<p><var class="var">chain_size</var>: The size of the chain
</p>
<p><var class="var">chain_type</var>: The type of the certificate chain
</p>
<p><var class="var">r</var>: DANE data to check against
</p>
<p><var class="var">sflags</var>: Flags for the initialization of <code class="code">s</code> (if NULL)
</p>
<p><var class="var">vflags</var>: Verification flags; an OR’ed list of <code class="code">dane_verify_flags_t</code> .
</p>
<p><var class="var">verify</var>: An OR’ed list of <code class="code">dane_verify_status_t</code> .
</p>
<p>This is the low-level function of <code class="code">dane_verify_crt()</code> . See the
high level function for documentation.
</p>
<p>This function does not perform any resolving, it utilizes
cached entries from <code class="code">r</code> .
</p>
<p><strong class="strong">Returns:</strong> a negative error code on error and <code class="code">DANE_E_SUCCESS</code> (0)
when the DANE entries were successfully parsed, irrespective of
whether they were verified (see <code class="code">verify</code> for that information). If
no usable entries were encountered <code class="code">DANE_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<h4 class="subheading" id="dane_005fverify_005fsession_005fcrt-1"><span>dane_verify_session_crt<a class="copiable-link" href="#dane_005fverify_005fsession_005fcrt-1"> ¶</a></span></h4>
<a class="anchor" id="dane_005fverify_005fsession_005fcrt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-dane_005fverify_005fsession_005fcrt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">dane_verify_session_crt</strong> <code class="def-code-arguments">(dane_state_t <var class="var">s</var>, gnutls_session_t <var class="var">session</var>, const char * <var class="var">hostname</var>, const char * <var class="var">proto</var>, unsigned int <var class="var">port</var>, unsigned int <var class="var">sflags</var>, unsigned int <var class="var">vflags</var>, unsigned int * <var class="var">verify</var>)</code><a class="copiable-link" href="#index-dane_005fverify_005fsession_005fcrt"> ¶</a></span></dt>
<dd><p><var class="var">s</var>: A DANE state structure (may be NULL)
</p>
<p><var class="var">session</var>: A gnutls session
</p>
<p><var class="var">hostname</var>: The hostname associated with the chain
</p>
<p><var class="var">proto</var>: The protocol of the service connecting (e.g. tcp)
</p>
<p><var class="var">port</var>: The port of the service connecting (e.g. 443)
</p>
<p><var class="var">sflags</var>: Flags for the initialization of <code class="code">s</code> (if NULL)
</p>
<p><var class="var">vflags</var>: Verification flags; an OR’ed list of <code class="code">dane_verify_flags_t</code> .
</p>
<p><var class="var">verify</var>: An OR’ed list of <code class="code">dane_verify_status_t</code> .
</p>
<p>This function will verify session’s certificate chain against the
CA constrains and/or the certificate available via DANE.
See <code class="code">dane_verify_crt()</code> for more information.
</p>
<p>This will not verify the chain for validity; unless the DANE
verification is restricted to end certificates, this must be
be performed separately using <code class="code">gnutls_certificate_verify_peers3()</code> .
</p>
<p><strong class="strong">Returns:</strong> a negative error code on error and <code class="code">DANE_E_SUCCESS</code> (0)
when the DANE entries were successfully parsed, irrespective of
whether they were verified (see <code class="code">verify</code> for that information). If
no usable entries were encountered <code class="code">DANE_E_REQUESTED_DATA_NOT_AVAILABLE</code>
will be returned.
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Cryptographic-API">
<div class="nav-panel">
<p>
Next: <a href="#Compatibility-API" accesskey="n" rel="next">Compatibility API</a>, Previous: <a href="#DANE-API" accesskey="p" rel="prev">DANE API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Cryptographic-API-1"><span>E.12 Cryptographic API<a class="copiable-link" href="#Cryptographic-API-1"> ¶</a></span></h3>
<p>The following functions are to be used for low-level cryptographic operations.
Their prototypes lie in <samp class="file">gnutls/crypto.h</samp>.
</p>
<p>Note that due to historic reasons several functions, (e.g.
<a class="ref" href="#gnutls_005fmac_005flist">gnutls_mac_list</a>, <a class="ref" href="#gnutls_005fmac_005fget_005fname">gnutls_mac_get_name</a>) of this API are part
of the <a class="ref" href="#Core-TLS-API">Core TLS API</a>.
</p>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005fdecrypt-1"><span>gnutls_aead_cipher_decrypt<a class="copiable-link" href="#gnutls_005faead_005fcipher_005fdecrypt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005fdecrypt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fdecrypt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_decrypt</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const void * <var class="var">auth</var>, size_t <var class="var">auth_len</var>, size_t <var class="var">tag_size</var>, const void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>, void * <var class="var">ptext</var>, size_t * <var class="var">ptext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fdecrypt"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">nonce</var>: the nonce to set
</p>
<p><var class="var">nonce_len</var>: The length of the nonce
</p>
<p><var class="var">auth</var>: additional data to be authenticated
</p>
<p><var class="var">auth_len</var>: The length of the data
</p>
<p><var class="var">tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p><var class="var">ctext</var>: the data to decrypt (including the authentication tag)
</p>
<p><var class="var">ctext_len</var>: the length of data to decrypt (includes tag size)
</p>
<p><var class="var">ptext</var>: the decrypted data
</p>
<p><var class="var">ptext_len</var>: the length of decrypted data (initially must hold the maximum available size)
</p>
<p>This function will decrypt the given data using the algorithm
specified by the context. This function must be provided the complete
data to be decrypted, including the authentication tag. On several
AEAD ciphers, the authentication tag is appended to the ciphertext,
though this is not a general rule. This function will fail if
the tag verification fails.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on verification failure or other error.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005fdecryptv2-1"><span>gnutls_aead_cipher_decryptv2<a class="copiable-link" href="#gnutls_005faead_005fcipher_005fdecryptv2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005fdecryptv2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fdecryptv2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_decryptv2</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const giovec_t * <var class="var">auth_iov</var>, int <var class="var">auth_iovcnt</var>, const giovec_t * <var class="var">iov</var>, int <var class="var">iovcnt</var>, void * <var class="var">tag</var>, size_t <var class="var">tag_size</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fdecryptv2"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">nonce</var>: the nonce to set
</p>
<p><var class="var">nonce_len</var>: The length of the nonce
</p>
<p><var class="var">auth_iov</var>: additional data to be authenticated
</p>
<p><var class="var">auth_iovcnt</var>: The number of buffers in <code class="code">auth_iov</code>
</p>
<p><var class="var">iov</var>: the data to decrypt
</p>
<p><var class="var">iovcnt</var>: The number of buffers in <code class="code">iov</code>
</p>
<p><var class="var">tag</var>: The authentication tag
</p>
<p><var class="var">tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p>This is similar to <code class="code">gnutls_aead_cipher_decrypt()</code> , but it performs
in-place encryption on the provided data buffers.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005fdeinit-1"><span>gnutls_aead_cipher_deinit<a class="copiable-link" href="#gnutls_005faead_005fcipher_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_aead_cipher_deinit</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p>This function will deinitialize all resources occupied by the given
authenticated-encryption context.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005fencrypt-1"><span>gnutls_aead_cipher_encrypt<a class="copiable-link" href="#gnutls_005faead_005fcipher_005fencrypt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005fencrypt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fencrypt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_encrypt</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const void * <var class="var">auth</var>, size_t <var class="var">auth_len</var>, size_t <var class="var">tag_size</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">ctext</var>, size_t * <var class="var">ctext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fencrypt"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">nonce</var>: the nonce to set
</p>
<p><var class="var">nonce_len</var>: The length of the nonce
</p>
<p><var class="var">auth</var>: additional data to be authenticated
</p>
<p><var class="var">auth_len</var>: The length of the data
</p>
<p><var class="var">tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p><var class="var">ptext</var>: the data to encrypt
</p>
<p><var class="var">ptext_len</var>: The length of data to encrypt
</p>
<p><var class="var">ctext</var>: the encrypted data including authentication tag
</p>
<p><var class="var">ctext_len</var>: the length of encrypted data (initially must hold the maximum available size, including space for tag)
</p>
<p>This function will encrypt the given data using the algorithm
specified by the context. The output data will contain the
authentication tag.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005fencryptv-1"><span>gnutls_aead_cipher_encryptv<a class="copiable-link" href="#gnutls_005faead_005fcipher_005fencryptv-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005fencryptv"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fencryptv-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_encryptv</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const giovec_t * <var class="var">auth_iov</var>, int <var class="var">auth_iovcnt</var>, size_t <var class="var">tag_size</var>, const giovec_t * <var class="var">iov</var>, int <var class="var">iovcnt</var>, void * <var class="var">ctext</var>, size_t * <var class="var">ctext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fencryptv-1"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">nonce</var>: the nonce to set
</p>
<p><var class="var">nonce_len</var>: The length of the nonce
</p>
<p><var class="var">auth_iov</var>: additional data to be authenticated
</p>
<p><var class="var">auth_iovcnt</var>: The number of buffers in <code class="code">auth_iov</code>
</p>
<p><var class="var">tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p><var class="var">iov</var>: the data to be encrypted
</p>
<p><var class="var">iovcnt</var>: The number of buffers in <code class="code">iov</code>
</p>
<p><var class="var">ctext</var>: the encrypted data including authentication tag
</p>
<p><var class="var">ctext_len</var>: the length of encrypted data (initially must hold the maximum available size, including space for tag)
</p>
<p>This function will encrypt the provided data buffers using the algorithm
specified by the context. The output data will contain the
authentication tag.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.3
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005fencryptv2-1"><span>gnutls_aead_cipher_encryptv2<a class="copiable-link" href="#gnutls_005faead_005fcipher_005fencryptv2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005fencryptv2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fencryptv2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_encryptv2</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>, const giovec_t * <var class="var">auth_iov</var>, int <var class="var">auth_iovcnt</var>, const giovec_t * <var class="var">iov</var>, int <var class="var">iovcnt</var>, void * <var class="var">tag</var>, size_t * <var class="var">tag_size</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fencryptv2"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">nonce</var>: the nonce to set
</p>
<p><var class="var">nonce_len</var>: The length of the nonce
</p>
<p><var class="var">auth_iov</var>: additional data to be authenticated
</p>
<p><var class="var">auth_iovcnt</var>: The number of buffers in <code class="code">auth_iov</code>
</p>
<p><var class="var">iov</var>: the data to be encrypted
</p>
<p><var class="var">iovcnt</var>: The number of buffers in <code class="code">iov</code>
</p>
<p><var class="var">tag</var>: The authentication tag
</p>
<p><var class="var">tag_size</var>: The size of the tag to use (use zero for the default)
</p>
<p>This is similar to <code class="code">gnutls_aead_cipher_encrypt()</code> , but it performs
in-place encryption on the provided data buffers.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.10
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005finit-1"><span>gnutls_aead_cipher_init<a class="copiable-link" href="#gnutls_005faead_005fcipher_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_init</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t * <var class="var">handle</var>, gnutls_cipher_algorithm_t <var class="var">cipher</var>, const gnutls_datum_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005finit"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">cipher</var>: the authenticated-encryption algorithm to use
</p>
<p><var class="var">key</var>: The key to be used for encryption
</p>
<p>This function will initialize an context that can be used for
encryption/decryption of data. This will effectively use the
current crypto backend in use by gnutls or the cryptographic
accelerator in use.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005faead_005fcipher_005fset_005fkey-1"><span>gnutls_aead_cipher_set_key<a class="copiable-link" href="#gnutls_005faead_005fcipher_005fset_005fkey-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005faead_005fcipher_005fset_005fkey"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005faead_005fcipher_005fset_005fkey"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_aead_cipher_set_key</strong> <code class="def-code-arguments">(gnutls_aead_cipher_hd_t <var class="var">handle</var>, const gnutls_datum_t * <var class="var">key</var>)</code><a class="copiable-link" href="#index-gnutls_005faead_005fcipher_005fset_005fkey"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_aead_cipher_hd_t</code> type.
</p>
<p><var class="var">key</var>: The key to be used for encryption
</p>
<p>This function will set a new key without re-initializing the
context.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.7.5
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fadd_005fauth-1"><span>gnutls_cipher_add_auth<a class="copiable-link" href="#gnutls_005fcipher_005fadd_005fauth-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fadd_005fauth"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fadd_005fauth"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_add_auth</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fadd_005fauth"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">ptext</var>: the data to be authenticated
</p>
<p><var class="var">ptext_size</var>: the length of the data
</p>
<p>This function operates on authenticated encryption with
associated data (AEAD) ciphers and authenticate the
input data. This function can only be called once
and before any encryption operations.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fdecrypt-1"><span>gnutls_cipher_decrypt<a class="copiable-link" href="#gnutls_005fcipher_005fdecrypt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fdecrypt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fdecrypt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_decrypt</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fdecrypt"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">ctext</var>: the data to decrypt
</p>
<p><var class="var">ctext_len</var>: the length of data to decrypt
</p>
<p>This function will decrypt the given data using the algorithm
specified by the context.
</p>
<p>Note that in AEAD ciphers, this will not check the tag. You will
need to compare the tag sent with the value returned from <code class="code">gnutls_cipher_tag()</code> .
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fdecrypt2-1"><span>gnutls_cipher_decrypt2<a class="copiable-link" href="#gnutls_005fcipher_005fdecrypt2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fdecrypt2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fdecrypt2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_decrypt2</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>, void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fdecrypt2"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">ctext</var>: the data to decrypt
</p>
<p><var class="var">ctext_len</var>: the length of data to decrypt
</p>
<p><var class="var">ptext</var>: the decrypted data
</p>
<p><var class="var">ptext_len</var>: the available length for decrypted data
</p>
<p>This function will decrypt the given data using the algorithm
specified by the context. For block ciphers the <code class="code">ctext_len</code> must be
a multiple of the block size. For the supported ciphers the plaintext
data length will equal the ciphertext size.
</p>
<p>Note that in AEAD ciphers, this will not check the tag. You will
need to compare the tag sent with the value returned from <code class="code">gnutls_cipher_tag()</code> .
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fdecrypt3-1"><span>gnutls_cipher_decrypt3<a class="copiable-link" href="#gnutls_005fcipher_005fdecrypt3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fdecrypt3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fdecrypt3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_decrypt3</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>, void * <var class="var">ptext</var>, size_t * <var class="var">ptext_len</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fdecrypt3"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">ctext</var>: the data to decrypt
</p>
<p><var class="var">ctext_len</var>: the length of data to decrypt
</p>
<p><var class="var">ptext</var>: the decrypted data
</p>
<p><var class="var">ptext_len</var>: the available length for decrypted data
</p>
<p><var class="var">flags</var>: flags for padding
</p>
<p>This function will decrypt the given data using the algorithm
specified by the context. If <code class="code">flags</code> is specified, padding for the
decrypted data will be removed accordingly and <code class="code">ptext_len</code> will be
updated.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.7.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fdeinit-1"><span>gnutls_cipher_deinit<a class="copiable-link" href="#gnutls_005fcipher_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_cipher_deinit</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p>This function will deinitialize all resources occupied by the given
encryption context.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fencrypt-1"><span>gnutls_cipher_encrypt<a class="copiable-link" href="#gnutls_005fcipher_005fencrypt-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fencrypt"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fencrypt"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_encrypt</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fencrypt"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">ptext</var>: the data to encrypt
</p>
<p><var class="var">ptext_len</var>: the length of data to encrypt
</p>
<p>This function will encrypt the given data using the algorithm
specified by the context.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fencrypt2-1"><span>gnutls_cipher_encrypt2<a class="copiable-link" href="#gnutls_005fcipher_005fencrypt2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fencrypt2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fencrypt2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_encrypt2</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">ctext</var>, size_t <var class="var">ctext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fencrypt2"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">ptext</var>: the data to encrypt
</p>
<p><var class="var">ptext_len</var>: the length of data to encrypt
</p>
<p><var class="var">ctext</var>: the encrypted data
</p>
<p><var class="var">ctext_len</var>: the available length for encrypted data
</p>
<p>This function will encrypt the given data using the algorithm
specified by the context. For block ciphers the <code class="code">ptext_len</code> must be
a multiple of the block size. For the supported ciphers the encrypted
data length will equal the plaintext size.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fencrypt3-1"><span>gnutls_cipher_encrypt3<a class="copiable-link" href="#gnutls_005fcipher_005fencrypt3-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fencrypt3"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fencrypt3"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_encrypt3</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">ctext</var>, size_t * <var class="var">ctext_len</var>, unsigned <var class="var">flags</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fencrypt3"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">ptext</var>: the data to encrypt
</p>
<p><var class="var">ptext_len</var>: the length of data to encrypt
</p>
<p><var class="var">ctext</var>: the encrypted data
</p>
<p><var class="var">ctext_len</var>: the length of encrypted data (initially must hold the maximum available size)
</p>
<p><var class="var">flags</var>: flags for padding
</p>
<p>This function will encrypt the given data using the algorithm
specified by the context. For block ciphers, <code class="code">ptext_len</code> is
typically a multiple of the block size. If not, the caller can
instruct the function to pad the last block according to <code class="code">flags</code> .
Currently, the only available padding scheme is
<code class="code">GNUTLS_CIPHER_PADDING_PKCS7</code> .
</p>
<p>If <code class="code">ctext</code> is not <code class="code">NULL</code> , it must hold enough space to store
resulting cipher text. To check the required size, this function
can be called with <code class="code">ctext</code> set to <code class="code">NULL</code> . Then <code class="code">ctext_len</code> will be
updated without performing actual encryption.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.7.7
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fget_005fblock_005fsize-1"><span>gnutls_cipher_get_block_size<a class="copiable-link" href="#gnutls_005fcipher_005fget_005fblock_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fget_005fblock_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fget_005fblock_005fsize"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_cipher_get_block_size</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fget_005fblock_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is an encryption algorithm
</p>
<p><strong class="strong">Returns:</strong> the block size of the encryption algorithm.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fget_005fiv_005fsize-1"><span>gnutls_cipher_get_iv_size<a class="copiable-link" href="#gnutls_005fcipher_005fget_005fiv_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fget_005fiv_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fget_005fiv_005fsize"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_cipher_get_iv_size</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fget_005fiv_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is an encryption algorithm
</p>
<p>This function returns the size of the initialization vector (IV) for the
provided algorithm. For algorithms with variable size IV (e.g., AES-CCM),
the returned size will be the one used by TLS.
</p>
<p><strong class="strong">Returns:</strong> block size for encryption algorithm.
</p>
<p><strong class="strong">Since:</strong> 3.2.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fget_005ftag_005fsize-1"><span>gnutls_cipher_get_tag_size<a class="copiable-link" href="#gnutls_005fcipher_005fget_005ftag_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fget_005ftag_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fget_005ftag_005fsize"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_cipher_get_tag_size</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fget_005ftag_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is an encryption algorithm
</p>
<p>This function returns the tag size of an authenticated encryption
algorithm. For non-AEAD algorithms, it returns zero.
</p>
<p><strong class="strong">Returns:</strong> the tag size of the authenticated encryption algorithm.
</p>
<p><strong class="strong">Since:</strong> 3.2.2
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005finit-1"><span>gnutls_cipher_init<a class="copiable-link" href="#gnutls_005fcipher_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_init</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t * <var class="var">handle</var>, gnutls_cipher_algorithm_t <var class="var">cipher</var>, const gnutls_datum_t * <var class="var">key</var>, const gnutls_datum_t * <var class="var">iv</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005finit"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">cipher</var>: the encryption algorithm to use
</p>
<p><var class="var">key</var>: the key to be used for encryption/decryption
</p>
<p><var class="var">iv</var>: the IV to use (if not applicable set NULL)
</p>
<p>This function will initialize the <code class="code">handle</code> context to be usable
for encryption/decryption of data. This will effectively use the
current crypto backend in use by gnutls or the cryptographic
accelerator in use.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005fset_005fiv-1"><span>gnutls_cipher_set_iv<a class="copiable-link" href="#gnutls_005fcipher_005fset_005fiv-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005fset_005fiv"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005fset_005fiv"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_cipher_set_iv</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, void * <var class="var">iv</var>, size_t <var class="var">ivlen</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005fset_005fiv"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">iv</var>: the IV to set
</p>
<p><var class="var">ivlen</var>: the length of the IV
</p>
<p>This function will set the IV to be used for the next
encryption block.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcipher_005ftag-1"><span>gnutls_cipher_tag<a class="copiable-link" href="#gnutls_005fcipher_005ftag-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcipher_005ftag"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcipher_005ftag"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_cipher_tag</strong> <code class="def-code-arguments">(gnutls_cipher_hd_t <var class="var">handle</var>, void * <var class="var">tag</var>, size_t <var class="var">tag_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fcipher_005ftag"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_cipher_hd_t</code> type
</p>
<p><var class="var">tag</var>: will hold the tag
</p>
<p><var class="var">tag_size</var>: the length of the tag to return
</p>
<p>This function operates on authenticated encryption with
associated data (AEAD) ciphers and will return the
output tag.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcrypto_005fregister_005faead_005fcipher-1"><span>gnutls_crypto_register_aead_cipher<a class="copiable-link" href="#gnutls_005fcrypto_005fregister_005faead_005fcipher-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcrypto_005fregister_005faead_005fcipher"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005faead_005fcipher-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_aead_cipher</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_cipher_init_func <var class="var">init</var>, gnutls_cipher_setkey_func <var class="var">setkey</var>, gnutls_cipher_aead_encrypt_func <var class="var">aead_encrypt</var>, gnutls_cipher_aead_decrypt_func <var class="var">aead_decrypt</var>, gnutls_cipher_deinit_func <var class="var">deinit</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005faead_005fcipher-1"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls AEAD cipher identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the cipher
</p>
<p><var class="var">setkey</var>: A function which sets the key of the cipher
</p>
<p><var class="var">aead_encrypt</var>: Perform the AEAD encryption
</p>
<p><var class="var">aead_decrypt</var>: Perform the AEAD decryption
</p>
<p><var class="var">deinit</var>: A function which deinitializes the cipher
</p>
<p>This function will register a cipher algorithm to be used by
gnutls. Any algorithm registered will override the included
algorithms and by convention kernel implemented algorithms have
priority of 90 and CPU-assisted of 80. The algorithm with the lowest priority will be
used by gnutls.
</p>
<p>In the case the registered init or setkey functions return <code class="code">GNUTLS_E_NEED_FALLBACK</code> ,
GnuTLS will attempt to use the next in priority registered cipher.
</p>
<p>The functions registered will be used with the new AEAD API introduced in
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcrypto_005fregister_005fcipher-1"><span>gnutls_crypto_register_cipher<a class="copiable-link" href="#gnutls_005fcrypto_005fregister_005fcipher-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcrypto_005fregister_005fcipher"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005fcipher-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_cipher</strong> <code class="def-code-arguments">(gnutls_cipher_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_cipher_init_func <var class="var">init</var>, gnutls_cipher_setkey_func <var class="var">setkey</var>, gnutls_cipher_setiv_func <var class="var">setiv</var>, gnutls_cipher_encrypt_func <var class="var">encrypt</var>, gnutls_cipher_decrypt_func <var class="var">decrypt</var>, gnutls_cipher_deinit_func <var class="var">deinit</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005fcipher-1"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls algorithm identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the cipher
</p>
<p><var class="var">setkey</var>: A function which sets the key of the cipher
</p>
<p><var class="var">setiv</var>: A function which sets the nonce/IV of the cipher (non-AEAD)
</p>
<p><var class="var">encrypt</var>: A function which performs encryption (non-AEAD)
</p>
<p><var class="var">decrypt</var>: A function which performs decryption (non-AEAD)
</p>
<p><var class="var">deinit</var>: A function which deinitializes the cipher
</p>
<p>This function will register a cipher algorithm to be used by
gnutls. Any algorithm registered will override the included
algorithms and by convention kernel implemented algorithms have
priority of 90 and CPU-assisted of 80. The algorithm with the lowest priority will be
used by gnutls.
</p>
<p>In the case the registered init or setkey functions return <code class="code">GNUTLS_E_NEED_FALLBACK</code> ,
GnuTLS will attempt to use the next in priority registered cipher.
</p>
<p>The functions which are marked as non-AEAD they are not required when
registering a cipher to be used with the new AEAD API introduced in
GnuTLS 3.4.0. Internally GnuTLS uses the new AEAD API.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcrypto_005fregister_005fdigest-1"><span>gnutls_crypto_register_digest<a class="copiable-link" href="#gnutls_005fcrypto_005fregister_005fdigest-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcrypto_005fregister_005fdigest"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005fdigest-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_digest</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_digest_init_func <var class="var">init</var>, gnutls_digest_hash_func <var class="var">hash</var>, gnutls_digest_output_func <var class="var">output</var>, gnutls_digest_deinit_func <var class="var">deinit</var>, gnutls_digest_fast_func <var class="var">hash_fast</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005fdigest-1"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls digest identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the digest
</p>
<p><var class="var">hash</var>: Perform the hash operation
</p>
<p><var class="var">output</var>: Provide the output of the digest
</p>
<p><var class="var">deinit</var>: A function which deinitializes the digest
</p>
<p><var class="var">hash_fast</var>: Perform the digest operation in one go
</p>
<p>This function will register a digest algorithm to be used by gnutls.
Any algorithm registered will override the included algorithms and
by convention kernel implemented algorithms have priority of 90
and CPU-assisted of 80.
The algorithm with the lowest priority will be used by gnutls.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcrypto_005fregister_005fmac-1"><span>gnutls_crypto_register_mac<a class="copiable-link" href="#gnutls_005fcrypto_005fregister_005fmac-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcrypto_005fregister_005fmac"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcrypto_005fregister_005fmac-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_crypto_register_mac</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>, int <var class="var">priority</var>, gnutls_mac_init_func <var class="var">init</var>, gnutls_mac_setkey_func <var class="var">setkey</var>, gnutls_mac_setnonce_func <var class="var">setnonce</var>, gnutls_mac_hash_func <var class="var">hash</var>, gnutls_mac_output_func <var class="var">output</var>, gnutls_mac_deinit_func <var class="var">deinit</var>, gnutls_mac_fast_func <var class="var">hash_fast</var>)</code><a class="copiable-link" href="#index-gnutls_005fcrypto_005fregister_005fmac-1"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is the gnutls MAC identifier
</p>
<p><var class="var">priority</var>: is the priority of the algorithm
</p>
<p><var class="var">init</var>: A function which initializes the MAC
</p>
<p><var class="var">setkey</var>: A function which sets the key of the MAC
</p>
<p><var class="var">setnonce</var>: A function which sets the nonce for the mac (may be <code class="code">NULL</code> for common MAC algorithms)
</p>
<p><var class="var">hash</var>: Perform the hash operation
</p>
<p><var class="var">output</var>: Provide the output of the MAC
</p>
<p><var class="var">deinit</var>: A function which deinitializes the MAC
</p>
<p><var class="var">hash_fast</var>: Perform the MAC operation in one go
</p>
<p>This function will register a MAC algorithm to be used by gnutls.
Any algorithm registered will override the included algorithms and
by convention kernel implemented algorithms have priority of 90
and CPU-assisted of 80.
The algorithm with the lowest priority will be used by gnutls.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.7.0 it is no longer possible to override cipher implementation
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> on success, otherwise a negative error code.
</p>
<p><strong class="strong">Since:</strong> 3.4.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdecode_005fber_005fdigest_005finfo-1"><span>gnutls_decode_ber_digest_info<a class="copiable-link" href="#gnutls_005fdecode_005fber_005fdigest_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdecode_005fber_005fdigest_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdecode_005fber_005fdigest_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_decode_ber_digest_info</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">info</var>, gnutls_digest_algorithm_t * <var class="var">hash</var>, unsigned char * <var class="var">digest</var>, unsigned int * <var class="var">digest_size</var>)</code><a class="copiable-link" href="#index-gnutls_005fdecode_005fber_005fdigest_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">info</var>: an RSA BER encoded DigestInfo structure
</p>
<p><var class="var">hash</var>: will contain the hash algorithm of the structure
</p>
<p><var class="var">digest</var>: will contain the hash output of the structure
</p>
<p><var class="var">digest_size</var>: will contain the hash size of the structure; initially must hold the maximum size of <code class="code">digest</code>
</p>
<p>This function will parse an RSA PKCS<code class="code">1</code> 1.5 DigestInfo structure
and report the hash algorithm used as well as the digest data.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdecode_005fgost_005frs_005fvalue-1"><span>gnutls_decode_gost_rs_value<a class="copiable-link" href="#gnutls_005fdecode_005fgost_005frs_005fvalue-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdecode_005fgost_005frs_005fvalue"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdecode_005fgost_005frs_005fvalue"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_decode_gost_rs_value</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">sig_value</var>, gnutls_datum_t * <var class="var">r</var>, gnutls_datum_t * <var class="var">s</var>)</code><a class="copiable-link" href="#index-gnutls_005fdecode_005fgost_005frs_005fvalue"> ¶</a></span></dt>
<dd><p><var class="var">sig_value</var>: will holds a GOST signature according to RFC 4491 section 2.2.2
</p>
<p><var class="var">r</var>: will contain the r value
</p>
<p><var class="var">s</var>: will contain the s value
</p>
<p>This function will decode the provided <code class="code">sig_value</code> , into <code class="code">r</code> and <code class="code">s</code> elements.
See RFC 4491 section 2.2.2 for the format of signature value.
</p>
<p>The output values may be padded with a zero byte to prevent them
from being interpreted as negative values. The value
should be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fdecode_005frs_005fvalue-1"><span>gnutls_decode_rs_value<a class="copiable-link" href="#gnutls_005fdecode_005frs_005fvalue-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fdecode_005frs_005fvalue"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fdecode_005frs_005fvalue"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_decode_rs_value</strong> <code class="def-code-arguments">(const gnutls_datum_t * <var class="var">sig_value</var>, gnutls_datum_t * <var class="var">r</var>, gnutls_datum_t * <var class="var">s</var>)</code><a class="copiable-link" href="#index-gnutls_005fdecode_005frs_005fvalue"> ¶</a></span></dt>
<dd><p><var class="var">sig_value</var>: holds a Dss-Sig-Value DER or BER encoded structure
</p>
<p><var class="var">r</var>: will contain the r value
</p>
<p><var class="var">s</var>: will contain the s value
</p>
<p>This function will decode the provided <code class="code">sig_value</code> ,
into <code class="code">r</code> and <code class="code">s</code> elements. The Dss-Sig-Value is used for DSA and ECDSA
signatures.
</p>
<p>The output values may be padded with a zero byte to prevent them
from being interpreted as negative values. The value
should be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fencode_005fber_005fdigest_005finfo-1"><span>gnutls_encode_ber_digest_info<a class="copiable-link" href="#gnutls_005fencode_005fber_005fdigest_005finfo-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fencode_005fber_005fdigest_005finfo"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fencode_005fber_005fdigest_005finfo"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_encode_ber_digest_info</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">hash</var>, const gnutls_datum_t * <var class="var">digest</var>, gnutls_datum_t * <var class="var">output</var>)</code><a class="copiable-link" href="#index-gnutls_005fencode_005fber_005fdigest_005finfo"> ¶</a></span></dt>
<dd><p><var class="var">hash</var>: the hash algorithm that was used to get the digest
</p>
<p><var class="var">digest</var>: must contain the digest data
</p>
<p><var class="var">output</var>: will contain the allocated DigestInfo BER encoded data
</p>
<p>This function will encode the provided digest data, and its
algorithm into an RSA PKCS<code class="code">1</code> 1.5 DigestInfo structure.
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.5.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fencode_005fgost_005frs_005fvalue-1"><span>gnutls_encode_gost_rs_value<a class="copiable-link" href="#gnutls_005fencode_005fgost_005frs_005fvalue-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fencode_005fgost_005frs_005fvalue"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fencode_005fgost_005frs_005fvalue"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_encode_gost_rs_value</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">sig_value</var>, const gnutls_datum_t * <var class="var">r</var>, const gnutls_datum_t * <var class="var">s</var>)</code><a class="copiable-link" href="#index-gnutls_005fencode_005fgost_005frs_005fvalue"> ¶</a></span></dt>
<dd><p><var class="var">sig_value</var>: will hold a GOST signature according to RFC 4491 section 2.2.2
</p>
<p><var class="var">r</var>: must contain the r value
</p>
<p><var class="var">s</var>: must contain the s value
</p>
<p>This function will encode the provided r and s values, into binary
representation according to RFC 4491 section 2.2.2, used for GOST R
34.10-2001 (and thus also for GOST R 34.10-2012) signatures.
</p>
<p>The output value should be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fencode_005frs_005fvalue-1"><span>gnutls_encode_rs_value<a class="copiable-link" href="#gnutls_005fencode_005frs_005fvalue-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fencode_005frs_005fvalue"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fencode_005frs_005fvalue"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_encode_rs_value</strong> <code class="def-code-arguments">(gnutls_datum_t * <var class="var">sig_value</var>, const gnutls_datum_t * <var class="var">r</var>, const gnutls_datum_t * <var class="var">s</var>)</code><a class="copiable-link" href="#index-gnutls_005fencode_005frs_005fvalue"> ¶</a></span></dt>
<dd><p><var class="var">sig_value</var>: will hold a Dss-Sig-Value DER encoded structure
</p>
<p><var class="var">r</var>: must contain the r value
</p>
<p><var class="var">s</var>: must contain the s value
</p>
<p>This function will encode the provided r and s values,
into a Dss-Sig-Value structure, used for DSA and ECDSA
signatures.
</p>
<p>The output value should be deallocated using <code class="code">gnutls_free()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise
an error code is returned.
</p>
<p><strong class="strong">Since:</strong> 3.6.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash-1"><span>gnutls_hash<a class="copiable-link" href="#gnutls_005fhash-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hash</strong> <code class="def-code-arguments">(gnutls_hash_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hash_hd_t</code> type
</p>
<p><var class="var">ptext</var>: the data to hash
</p>
<p><var class="var">ptext_len</var>: the length of data to hash
</p>
<p>This function will hash the given data using the algorithm
specified by the context.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash_005fcopy-1"><span>gnutls_hash_copy<a class="copiable-link" href="#gnutls_005fhash_005fcopy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash_005fcopy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash_005fcopy"><span class="category-def">Function: </span><span><code class="def-type">gnutls_hash_hd_t</code> <strong class="def-name">gnutls_hash_copy</strong> <code class="def-code-arguments">(gnutls_hash_hd_t <var class="var">handle</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash_005fcopy"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hash_hd_t</code> type
</p>
<p>This function will create a copy of Message Digest context, containing all
its current state. Copying contexts for Message Digests registered using
<code class="code">gnutls_crypto_register_digest()</code> is not supported and will always result in
an error. In addition to that, some of the Message Digest implementations do
not support this operation. Applications should check the return value and
provide a proper fallback.
</p>
<p><strong class="strong">Returns:</strong> new Message Digest context or NULL in case of an error.
</p>
<p><strong class="strong">Since:</strong> 3.6.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash_005fdeinit-1"><span>gnutls_hash_deinit<a class="copiable-link" href="#gnutls_005fhash_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_hash_deinit</strong> <code class="def-code-arguments">(gnutls_hash_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hash_hd_t</code> type
</p>
<p><var class="var">digest</var>: is the output value of the hash
</p>
<p>This function will deinitialize all resources occupied by
the given hash context.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash_005ffast-1"><span>gnutls_hash_fast<a class="copiable-link" href="#gnutls_005fhash_005ffast-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash_005ffast"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash_005ffast"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hash_fast</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">algorithm</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">digest</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash_005ffast"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: the hash algorithm to use
</p>
<p><var class="var">ptext</var>: the data to hash
</p>
<p><var class="var">ptext_len</var>: the length of data to hash
</p>
<p><var class="var">digest</var>: is the output value of the hash
</p>
<p>This convenience function will hash the given data and return output
on a single call.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash_005fget_005flen-1"><span>gnutls_hash_get_len<a class="copiable-link" href="#gnutls_005fhash_005fget_005flen-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash_005fget_005flen"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash_005fget_005flen"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_hash_get_len</strong> <code class="def-code-arguments">(gnutls_digest_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash_005fget_005flen"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: the hash algorithm to use
</p>
<p>This function will return the length of the output data
of the given hash algorithm.
</p>
<p><strong class="strong">Returns:</strong> The length or zero on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash_005finit-1"><span>gnutls_hash_init<a class="copiable-link" href="#gnutls_005fhash_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hash_init</strong> <code class="def-code-arguments">(gnutls_hash_hd_t * <var class="var">dig</var>, gnutls_digest_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash_005finit"> ¶</a></span></dt>
<dd><p><var class="var">dig</var>: is a <code class="code">gnutls_hash_hd_t</code> type
</p>
<p><var class="var">algorithm</var>: the hash algorithm to use
</p>
<p>This function will initialize an context that can be used to
produce a Message Digest of data. This will effectively use the
current crypto backend in use by gnutls or the cryptographic
accelerator in use.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash_005foutput-1"><span>gnutls_hash_output<a class="copiable-link" href="#gnutls_005fhash_005foutput-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash_005foutput"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash_005foutput"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_hash_output</strong> <code class="def-code-arguments">(gnutls_hash_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash_005foutput"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hash_hd_t</code> type
</p>
<p><var class="var">digest</var>: is the output value of the hash
</p>
<p>This function will output the current hash value and reset the
state of the hash. If <code class="code">digest</code> is <code class="code">NULL</code> , it only resets the state of
the hash.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhash_005fsqueeze-1"><span>gnutls_hash_squeeze<a class="copiable-link" href="#gnutls_005fhash_005fsqueeze-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhash_005fsqueeze"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhash_005fsqueeze"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hash_squeeze</strong> <code class="def-code-arguments">(gnutls_hash_hd_t <var class="var">handle</var>, void * <var class="var">output</var>, size_t <var class="var">length</var>)</code><a class="copiable-link" href="#index-gnutls_005fhash_005fsqueeze"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: a <code class="code">gnutls_hash_hd_t</code>
</p>
<p><var class="var">output</var>: destination to store the output; must be equal to or larger than <code class="code">length</code>
</p>
<p><var class="var">length</var>: length of <code class="code">output</code>
</p>
<p>This function will extract digest output of <code class="code">length</code> bytes. The <code class="code">handle</code> must
be initialized with <code class="code">gnutls_hash_init()</code> as an extended output function (XOF),
such as <code class="code">GNUTLS_DIG_SHAKE_128</code> or <code class="code">GNUTLS_DIG_SHAKE_256</code> .
</p>
<p>This function can be called multiple times. To reset the state of <code class="code">handle</code> ,
call <code class="code">gnutls_hash_deinit()</code> with <code class="code">NULL</code> as the digest argument.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_SUCCESS</code> (0) on success; negative error code otherwise.
</p>
<p><strong class="strong">Since:</strong> 3.8.6
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhkdf_005fexpand-1"><span>gnutls_hkdf_expand<a class="copiable-link" href="#gnutls_005fhkdf_005fexpand-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhkdf_005fexpand"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhkdf_005fexpand"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hkdf_expand</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">mac</var>, const gnutls_datum_t * <var class="var">key</var>, const gnutls_datum_t * <var class="var">info</var>, void * <var class="var">output</var>, size_t <var class="var">length</var>)</code><a class="copiable-link" href="#index-gnutls_005fhkdf_005fexpand"> ¶</a></span></dt>
<dd><p><var class="var">mac</var>: the mac algorithm used internally
</p>
<p><var class="var">key</var>: the pseudorandom key created with HKDF-Extract
</p>
<p><var class="var">info</var>: the optional informational data
</p>
<p><var class="var">output</var>: the output value of the expand operation
</p>
<p><var class="var">length</var>: the desired length of the output key
</p>
<p>This function will derive a variable length keying material from
the pseudorandom key using the HKDF-Expand function as defined in
RFC 5869.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.13
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhkdf_005fextract-1"><span>gnutls_hkdf_extract<a class="copiable-link" href="#gnutls_005fhkdf_005fextract-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhkdf_005fextract"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhkdf_005fextract"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hkdf_extract</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">mac</var>, const gnutls_datum_t * <var class="var">key</var>, const gnutls_datum_t * <var class="var">salt</var>, void * <var class="var">output</var>)</code><a class="copiable-link" href="#index-gnutls_005fhkdf_005fextract"> ¶</a></span></dt>
<dd><p><var class="var">mac</var>: the mac algorithm used internally
</p>
<p><var class="var">key</var>: the initial keying material
</p>
<p><var class="var">salt</var>: the optional salt
</p>
<p><var class="var">output</var>: the output value of the extract operation
</p>
<p>This function will derive a fixed-size key using the HKDF-Extract
function as defined in RFC 5869.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.13
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac-1"><span>gnutls_hmac<a class="copiable-link" href="#gnutls_005fhmac-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hmac</strong> <code class="def-code-arguments">(gnutls_hmac_hd_t <var class="var">handle</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hmac_hd_t</code> type
</p>
<p><var class="var">ptext</var>: the data to hash
</p>
<p><var class="var">ptext_len</var>: the length of data to hash
</p>
<p>This function will hash the given data using the algorithm
specified by the context.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005fcopy-1"><span>gnutls_hmac_copy<a class="copiable-link" href="#gnutls_005fhmac_005fcopy-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005fcopy"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005fcopy"><span class="category-def">Function: </span><span><code class="def-type">gnutls_hmac_hd_t</code> <strong class="def-name">gnutls_hmac_copy</strong> <code class="def-code-arguments">(gnutls_hmac_hd_t <var class="var">handle</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005fcopy"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hmac_hd_t</code> type
</p>
<p>This function will create a copy of MAC context, containing all its current
state. Copying contexts for MACs registered using
<code class="code">gnutls_crypto_register_mac()</code> is not supported and will always result in an
error. In addition to that, some of the MAC implementations do not support
this operation. Applications should check the return value and provide a
proper fallback.
</p>
<p><strong class="strong">Returns:</strong> new MAC context or NULL in case of an error.
</p>
<p><strong class="strong">Since:</strong> 3.6.9
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005fdeinit-1"><span>gnutls_hmac_deinit<a class="copiable-link" href="#gnutls_005fhmac_005fdeinit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005fdeinit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005fdeinit"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_hmac_deinit</strong> <code class="def-code-arguments">(gnutls_hmac_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005fdeinit"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hmac_hd_t</code> type
</p>
<p><var class="var">digest</var>: is the output value of the MAC
</p>
<p>This function will deinitialize all resources occupied by
the given hmac context.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005ffast-1"><span>gnutls_hmac_fast<a class="copiable-link" href="#gnutls_005fhmac_005ffast-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005ffast"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005ffast"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hmac_fast</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>, const void * <var class="var">key</var>, size_t <var class="var">keylen</var>, const void * <var class="var">ptext</var>, size_t <var class="var">ptext_len</var>, void * <var class="var">digest</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005ffast"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: the hash algorithm to use
</p>
<p><var class="var">key</var>: the key to use
</p>
<p><var class="var">keylen</var>: the length of the key
</p>
<p><var class="var">ptext</var>: the data to hash
</p>
<p><var class="var">ptext_len</var>: the length of data to hash
</p>
<p><var class="var">digest</var>: is the output value of the hash
</p>
<p>This convenience function will hash the given data and return output
on a single call. Note, this call will not work for MAC algorithms
that require nonce (like UMAC or GMAC).
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005fget_005fkey_005fsize-1"><span>gnutls_hmac_get_key_size<a class="copiable-link" href="#gnutls_005fhmac_005fget_005fkey_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005fget_005fkey_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005fget_005fkey_005fsize"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_hmac_get_key_size</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005fget_005fkey_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: the mac algorithm to use
</p>
<p>This function will return the size of the key to be used with this
algorithm. On the algorithms which may accept arbitrary key sizes,
the returned size is the MAC key size used in the TLS protocol.
</p>
<p><strong class="strong">Returns:</strong> The key size or zero on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.12
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005fget_005flen-1"><span>gnutls_hmac_get_len<a class="copiable-link" href="#gnutls_005fhmac_005fget_005flen-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005fget_005flen"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005fget_005flen"><span class="category-def">Function: </span><span><code class="def-type">unsigned</code> <strong class="def-name">gnutls_hmac_get_len</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005fget_005flen"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: the hmac algorithm to use
</p>
<p>This function will return the length of the output data
of the given hmac algorithm.
</p>
<p><strong class="strong">Returns:</strong> The length or zero on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005finit-1"><span>gnutls_hmac_init<a class="copiable-link" href="#gnutls_005fhmac_005finit-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005finit"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005finit"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_hmac_init</strong> <code class="def-code-arguments">(gnutls_hmac_hd_t * <var class="var">dig</var>, gnutls_mac_algorithm_t <var class="var">algorithm</var>, const void * <var class="var">key</var>, size_t <var class="var">keylen</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005finit"> ¶</a></span></dt>
<dd><p><var class="var">dig</var>: is a <code class="code">gnutls_hmac_hd_t</code> type
</p>
<p><var class="var">algorithm</var>: the HMAC algorithm to use
</p>
<p><var class="var">key</var>: the key to be used for encryption
</p>
<p><var class="var">keylen</var>: the length of the key
</p>
<p>This function will initialize an context that can be used to
produce a Message Authentication Code (MAC) of data. This will
effectively use the current crypto backend in use by gnutls or the
cryptographic accelerator in use.
</p>
<p>Note that despite the name of this function, it can be used
for other MAC algorithms than HMAC.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005foutput-1"><span>gnutls_hmac_output<a class="copiable-link" href="#gnutls_005fhmac_005foutput-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005foutput"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005foutput"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_hmac_output</strong> <code class="def-code-arguments">(gnutls_hmac_hd_t <var class="var">handle</var>, void * <var class="var">digest</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005foutput"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hmac_hd_t</code> type
</p>
<p><var class="var">digest</var>: is the output value of the MAC
</p>
<p>This function will output the current MAC value
and reset the state of the MAC.
</p>
<p><strong class="strong">Since:</strong> 2.10.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fhmac_005fset_005fnonce-1"><span>gnutls_hmac_set_nonce<a class="copiable-link" href="#gnutls_005fhmac_005fset_005fnonce-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fhmac_005fset_005fnonce"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fhmac_005fset_005fnonce"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_hmac_set_nonce</strong> <code class="def-code-arguments">(gnutls_hmac_hd_t <var class="var">handle</var>, const void * <var class="var">nonce</var>, size_t <var class="var">nonce_len</var>)</code><a class="copiable-link" href="#index-gnutls_005fhmac_005fset_005fnonce"> ¶</a></span></dt>
<dd><p><var class="var">handle</var>: is a <code class="code">gnutls_hmac_hd_t</code> type
</p>
<p><var class="var">nonce</var>: the data to set as nonce
</p>
<p><var class="var">nonce_len</var>: the length of data
</p>
<p>This function will set the nonce in the MAC algorithm.
</p>
<p><strong class="strong">Since:</strong> 3.2.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fmac_005fget_005fnonce_005fsize-1"><span>gnutls_mac_get_nonce_size<a class="copiable-link" href="#gnutls_005fmac_005fget_005fnonce_005fsize-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fmac_005fget_005fnonce_005fsize"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fmac_005fget_005fnonce_005fsize"><span class="category-def">Function: </span><span><code class="def-type">size_t</code> <strong class="def-name">gnutls_mac_get_nonce_size</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fmac_005fget_005fnonce_005fsize"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is an encryption algorithm
</p>
<p>Returns the size of the nonce used by the MAC in TLS.
</p>
<p><strong class="strong">Returns:</strong> length (in bytes) of the given MAC nonce size, or 0.
</p>
<p><strong class="strong">Since:</strong> 3.2.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpbkdf2-1"><span>gnutls_pbkdf2<a class="copiable-link" href="#gnutls_005fpbkdf2-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpbkdf2"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpbkdf2"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_pbkdf2</strong> <code class="def-code-arguments">(gnutls_mac_algorithm_t <var class="var">mac</var>, const gnutls_datum_t * <var class="var">key</var>, const gnutls_datum_t * <var class="var">salt</var>, unsigned <var class="var">iter_count</var>, void * <var class="var">output</var>, size_t <var class="var">length</var>)</code><a class="copiable-link" href="#index-gnutls_005fpbkdf2"> ¶</a></span></dt>
<dd><p><var class="var">mac</var>: the mac algorithm used internally
</p>
<p><var class="var">key</var>: the initial keying material
</p>
<p><var class="var">salt</var>: the salt
</p>
<p><var class="var">iter_count</var>: the iteration count
</p>
<p><var class="var">output</var>: the output value
</p>
<p><var class="var">length</var>: the desired length of the output key
</p>
<p>This function will derive a variable length keying material from
a password according to PKCS <code class="code">5</code> PBKDF2.
</p>
<p><strong class="strong">Returns:</strong> Zero or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 3.6.13
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frnd-1"><span>gnutls_rnd<a class="copiable-link" href="#gnutls_005frnd-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frnd"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frnd-1"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_rnd</strong> <code class="def-code-arguments">(gnutls_rnd_level_t <var class="var">level</var>, void * <var class="var">data</var>, size_t <var class="var">len</var>)</code><a class="copiable-link" href="#index-gnutls_005frnd-1"> ¶</a></span></dt>
<dd><p><var class="var">level</var>: a security level
</p>
<p><var class="var">data</var>: place to store random bytes
</p>
<p><var class="var">len</var>: The requested size
</p>
<p>This function will generate random data and store it to output
buffer. The value of <code class="code">level</code> should be one of <code class="code">GNUTLS_RND_NONCE</code> ,
<code class="code">GNUTLS_RND_RANDOM</code> and <code class="code">GNUTLS_RND_KEY</code> . See the manual and
<code class="code">gnutls_rnd_level_t</code> for detailed information.
</p>
<p>This function is thread-safe and also fork-safe.
</p>
<p><strong class="strong">Returns:</strong> Zero on success, or a negative error code on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005frnd_005frefresh-1"><span>gnutls_rnd_refresh<a class="copiable-link" href="#gnutls_005frnd_005frefresh-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005frnd_005frefresh"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005frnd_005frefresh"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_rnd_refresh</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005frnd_005frefresh"> ¶</a></span></dt>
<dd>
<p>This function refreshes the random generator state.
That is the current precise time, CPU usage, and
other values are input into its state.
</p>
<p>On a slower rate input from /dev/urandom is mixed too.
</p>
<p><strong class="strong">Since:</strong> 3.1.7
</p></dd></dl>
<hr>
</div>
<div class="section-level-extent" id="Compatibility-API">
<div class="nav-panel">
<p>
Previous: <a href="#Cryptographic-API" accesskey="p" rel="prev">Cryptographic API</a>, Up: <a href="#API-reference" accesskey="u" rel="up">API reference</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="Compatibility-API-1"><span>E.13 Compatibility API<a class="copiable-link" href="#Compatibility-API-1"> ¶</a></span></h3>
<p>The following functions are carried over from old GnuTLS released. They might be removed at a later version.
Their prototypes lie in <samp class="file">gnutls/compat.h</samp>.
</p>
<h4 class="subheading" id="gnutls_005fcompression_005fget-1"><span>gnutls_compression_get<a class="copiable-link" href="#gnutls_005fcompression_005fget-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcompression_005fget"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcompression_005fget"><span class="category-def">Function: </span><span><code class="def-type">gnutls_compression_method_t</code> <strong class="def-name">gnutls_compression_get</strong> <code class="def-code-arguments">(gnutls_session_t <var class="var">session</var>)</code><a class="copiable-link" href="#index-gnutls_005fcompression_005fget"> ¶</a></span></dt>
<dd><p><var class="var">session</var>: is a <code class="code">gnutls_session_t</code> type.
</p>
<p>Get the currently used compression algorithm.
</p>
<p><strong class="strong">Returns:</strong> the currently used compression method, a
<code class="code">gnutls_compression_method_t</code> value.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcompression_005fget_005fid-1"><span>gnutls_compression_get_id<a class="copiable-link" href="#gnutls_005fcompression_005fget_005fid-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcompression_005fget_005fid"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcompression_005fget_005fid"><span class="category-def">Function: </span><span><code class="def-type">gnutls_compression_method_t</code> <strong class="def-name">gnutls_compression_get_id</strong> <code class="def-code-arguments">(const char * <var class="var">name</var>)</code><a class="copiable-link" href="#index-gnutls_005fcompression_005fget_005fid"> ¶</a></span></dt>
<dd><p><var class="var">name</var>: is a compression method name
</p>
<p>The names are compared in a case insensitive way.
</p>
<p><strong class="strong">Returns:</strong> an id of the specified in a string compression method, or
<code class="code">GNUTLS_COMP_UNKNOWN</code> on error.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcompression_005fget_005fname-1"><span>gnutls_compression_get_name<a class="copiable-link" href="#gnutls_005fcompression_005fget_005fname-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcompression_005fget_005fname"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcompression_005fget_005fname"><span class="category-def">Function: </span><span><code class="def-type">const char *</code> <strong class="def-name">gnutls_compression_get_name</strong> <code class="def-code-arguments">(gnutls_compression_method_t <var class="var">algorithm</var>)</code><a class="copiable-link" href="#index-gnutls_005fcompression_005fget_005fname"> ¶</a></span></dt>
<dd><p><var class="var">algorithm</var>: is a Compression algorithm
</p>
<p>Convert a <code class="code">gnutls_compression_method_t</code> value to a string.
</p>
<p><strong class="strong">Returns:</strong> a pointer to a string that contains the name of the
specified compression algorithm, or <code class="code">NULL</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fcompression_005flist-1"><span>gnutls_compression_list<a class="copiable-link" href="#gnutls_005fcompression_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fcompression_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fcompression_005flist"><span class="category-def">Function: </span><span><code class="def-type">const gnutls_compression_method_t *</code> <strong class="def-name">gnutls_compression_list</strong> <code class="def-code-arguments">( <var class="var">void</var>)</code><a class="copiable-link" href="#index-gnutls_005fcompression_005flist"> ¶</a></span></dt>
<dd>
<p>Get a list of compression methods.
</p>
<p><strong class="strong">Returns:</strong> a zero-terminated list of <code class="code">gnutls_compression_method_t</code>
integers indicating the available compression methods.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fglobal_005fset_005fmem_005ffunctions-1"><span>gnutls_global_set_mem_functions<a class="copiable-link" href="#gnutls_005fglobal_005fset_005fmem_005ffunctions-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fglobal_005fset_005fmem_005ffunctions"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fglobal_005fset_005fmem_005ffunctions"><span class="category-def">Function: </span><span><code class="def-type">void</code> <strong class="def-name">gnutls_global_set_mem_functions</strong> <code class="def-code-arguments">(gnutls_alloc_function <var class="var">alloc_func</var>, gnutls_alloc_function <var class="var">secure_alloc_func</var>, gnutls_is_secure_function <var class="var">is_secure_func</var>, gnutls_realloc_function <var class="var">realloc_func</var>, gnutls_free_function <var class="var">free_func</var>)</code><a class="copiable-link" href="#index-gnutls_005fglobal_005fset_005fmem_005ffunctions"> ¶</a></span></dt>
<dd><p><var class="var">alloc_func</var>: it’s the default memory allocation function. Like <code class="code">malloc()</code> .
</p>
<p><var class="var">secure_alloc_func</var>: This is the memory allocation function that will be used for sensitive data.
</p>
<p><var class="var">is_secure_func</var>: a function that returns 0 if the memory given is not secure. May be NULL.
</p>
<p><var class="var">realloc_func</var>: A realloc function
</p>
<p><var class="var">free_func</var>: The function that frees allocated data. Must accept a NULL pointer.
</p>
<p><strong class="strong">Deprecated:</strong> since 3.3.0 it is no longer possible to replace the internally used
memory allocation functions
</p>
<p>This is the function where you set the memory allocation functions
gnutls is going to use. By default the libc’s allocation functions
(<code class="code">malloc()</code> , <code class="code">free()</code> ), are used by gnutls, to allocate both sensitive
and not sensitive data. This function is provided to set the
memory allocation functions to something other than the defaults
</p>
<p>This function must be called before <code class="code">gnutls_global_init()</code> is called.
This function is not thread safe.
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fopenpgp_005fprivkey_005fsign_005fhash-1"><span>gnutls_openpgp_privkey_sign_hash<a class="copiable-link" href="#gnutls_005fopenpgp_005fprivkey_005fsign_005fhash-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fopenpgp_005fprivkey_005fsign_005fhash"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fopenpgp_005fprivkey_005fsign_005fhash"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_openpgp_privkey_sign_hash</strong> <code class="def-code-arguments">(gnutls_openpgp_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">hash</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fopenpgp_005fprivkey_005fsign_005fhash"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: Holds the key
</p>
<p><var class="var">hash</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain newly allocated signature
</p>
<p>This function is no-op.
</p>
<p><strong class="strong">Returns:</strong> <code class="code">GNUTLS_E_UNIMPLEMENTED_FEATURE</code> .
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fpriority_005fcompression_005flist-1"><span>gnutls_priority_compression_list<a class="copiable-link" href="#gnutls_005fpriority_005fcompression_005flist-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fpriority_005fcompression_005flist"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fpriority_005fcompression_005flist"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_priority_compression_list</strong> <code class="def-code-arguments">(gnutls_priority_t <var class="var">pcache</var>, const unsigned int ** <var class="var">list</var>)</code><a class="copiable-link" href="#index-gnutls_005fpriority_005fcompression_005flist"> ¶</a></span></dt>
<dd><p><var class="var">pcache</var>: is a <code class="code">gnutls_priority_t</code> type.
</p>
<p><var class="var">list</var>: will point to an integer list
</p>
<p>Get a list of available compression method in the priority
structure.
</p>
<p><strong class="strong">Returns:</strong> the number of methods, or an error code.
</p>
<p><strong class="strong">Since:</strong> 3.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fcrt_005fget_005fpreferred_005fhash_005falgorithm-1"><span>gnutls_x509_crt_get_preferred_hash_algorithm<a class="copiable-link" href="#gnutls_005fx509_005fcrt_005fget_005fpreferred_005fhash_005falgorithm-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fcrt_005fget_005fpreferred_005fhash_005falgorithm"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fcrt_005fget_005fpreferred_005fhash_005falgorithm"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_crt_get_preferred_hash_algorithm</strong> <code class="def-code-arguments">(gnutls_x509_crt_t <var class="var">crt</var>, gnutls_digest_algorithm_t * <var class="var">hash</var>, unsigned int * <var class="var">mand</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fcrt_005fget_005fpreferred_005fhash_005falgorithm"> ¶</a></span></dt>
<dd><p><var class="var">crt</var>: Holds the certificate
</p>
<p><var class="var">hash</var>: The result of the call with the hash algorithm used for signature
</p>
<p><var class="var">mand</var>: If non-zero it means that the algorithm MUST use this hash. May be <code class="code">NULL</code> .
</p>
<p>This function will read the certificate and return the appropriate digest
algorithm to use for signing with this certificate. Some certificates (i.e.
DSA might not be able to sign without the preferred algorithm).
</p>
<p><strong class="strong">Deprecated:</strong> Please use <code class="code">gnutls_pubkey_get_preferred_hash_algorithm()</code> .
</p>
<p><strong class="strong">Returns:</strong> the 0 if the hash algorithm is found. A negative error code is
returned on error.
</p>
<p><strong class="strong">Since:</strong> 2.12.0
</p></dd></dl>
<h4 class="subheading" id="gnutls_005fx509_005fprivkey_005fsign_005fhash-1"><span>gnutls_x509_privkey_sign_hash<a class="copiable-link" href="#gnutls_005fx509_005fprivkey_005fsign_005fhash-1"> ¶</a></span></h4>
<a class="anchor" id="gnutls_005fx509_005fprivkey_005fsign_005fhash"></a><dl class="first-deftypefn first-deftypefun-alias-first-deftypefn def-block">
<dt class="deftypefn deftypefun-alias-deftypefn def-line" id="index-gnutls_005fx509_005fprivkey_005fsign_005fhash"><span class="category-def">Function: </span><span><code class="def-type">int</code> <strong class="def-name">gnutls_x509_privkey_sign_hash</strong> <code class="def-code-arguments">(gnutls_x509_privkey_t <var class="var">key</var>, const gnutls_datum_t * <var class="var">hash</var>, gnutls_datum_t * <var class="var">signature</var>)</code><a class="copiable-link" href="#index-gnutls_005fx509_005fprivkey_005fsign_005fhash"> ¶</a></span></dt>
<dd><p><var class="var">key</var>: a key
</p>
<p><var class="var">hash</var>: holds the data to be signed
</p>
<p><var class="var">signature</var>: will contain newly allocated signature
</p>
<p>This function will sign the given hash using the private key. Do not
use this function directly unless you know what it is. Typical signing
requires the data to be hashed and stored in special formats
(e.g. BER Digest-Info for RSA).
</p>
<p>This API is provided only for backwards compatibility, and thus
restricted to RSA, DSA and ECDSA key types. For other key types please
use <code class="code">gnutls_privkey_sign_hash()</code> and <code class="code">gnutls_privkey_sign_data()</code> .
</p>
<p><strong class="strong">Returns:</strong> On success, <code class="code">GNUTLS_E_SUCCESS</code> (0) is returned, otherwise a
negative error value.
</p>
<p>Deprecated in: 2.12.0
</p></dd></dl>
<hr>
</div>
</div>
<div class="appendix-level-extent" id="Copying-Information">
<div class="nav-panel">
<p>
Next: <a href="#Additional-Features" accesskey="n" rel="next">Additional Features</a>, Previous: <a href="#API-reference" accesskey="p" rel="prev">API reference</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="appendix" id="Copying-Information-1"><span>Appendix F Copying Information<a class="copiable-link" href="#Copying-Information-1"> ¶</a></span></h2>
<a class="index-entry-id" id="index-FDL_002c-GNU-Free-Documentation-License"></a>
<h3 class="heading" id="GNU-Free-Documentation-License"><span>GNU Free Documentation License<a class="copiable-link" href="#GNU-Free-Documentation-License"> ¶</a></span></h3>
<div class="center">Version 1.3, 3 November 2008
</div>
<div class="display">
<pre class="display-preformatted">Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
<a class="uref" href="https://fsf.org/">https://fsf.org/</a>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
</pre></div>
<ol class="enumerate" start="0">
<li> PREAMBLE
<p>The purpose of this License is to make a manual, textbook, or other
functional and useful document <em class="dfn">free</em> in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
</p>
<p>This License is a kind of “copyleft”, which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
</p>
<p>We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
</p>
</li><li> APPLICABILITY AND DEFINITIONS
<p>This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The “Document”, below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as “you”. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
</p>
<p>A “Modified Version” of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
</p>
<p>A “Secondary Section” is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document’s overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
</p>
<p>The “Invariant Sections” are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
</p>
<p>The “Cover Texts” are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
</p>
<p>A “Transparent” copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not “Transparent” is called “Opaque”.
</p>
<p>Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input
format, SGML or XML using a publicly available
DTD, and standard-conforming simple HTML,
PostScript or PDF designed for human modification. Examples
of transparent image formats include PNG, XCF and
JPG. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, SGML or
XML for which the DTD and/or processing tools are
not generally available, and the machine-generated HTML,
PostScript or PDF produced by some word processors for
output purposes only.
</p>
<p>The “Title Page” means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, “Title Page” means
the text near the most prominent appearance of the work’s title,
preceding the beginning of the body of the text.
</p>
<p>The “publisher” means any person or entity that distributes copies
of the Document to the public.
</p>
<p>A section “Entitled XYZ” means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as “Acknowledgements”,
“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title”
of such a section when you modify the Document means that it remains a
section “Entitled XYZ” according to this definition.
</p>
<p>The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
</p>
</li><li> VERBATIM COPYING
<p>You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
</p>
<p>You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
</p>
</li><li> COPYING IN QUANTITY
<p>If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document’s license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
</p>
<p>If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
</p>
<p>If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
</p>
<p>It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
</p>
</li><li> MODIFICATIONS
<p>You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
</p>
<ol class="enumerate" type="A" start="1">
<li> Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
</li><li> List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
</li><li> State on the Title page the name of the publisher of the
Modified Version, as the publisher.
</li><li> Preserve all the copyright notices of the Document.
</li><li> Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
</li><li> Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
</li><li> Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document’s license notice.
</li><li> Include an unaltered copy of this License.
</li><li> Preserve the section Entitled “History”, Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled “History” in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
</li><li> Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the “History” section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
</li><li> For any section Entitled “Acknowledgements” or “Dedications”, Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
</li><li> Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
</li><li> Delete any section Entitled “Endorsements”. Such a section
may not be included in the Modified Version.
</li><li> Do not retitle any existing section to be Entitled “Endorsements” or
to conflict in title with any Invariant Section.
</li><li> Preserve any Warranty Disclaimers.
</li></ol>
<p>If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version’s license notice.
These titles must be distinct from any other section titles.
</p>
<p>You may add a section Entitled “Endorsements”, provided it contains
nothing but endorsements of your Modified Version by various
parties—for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
</p>
<p>You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
</p>
<p>The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
</p>
</li><li> COMBINING DOCUMENTS
<p>You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
</p>
<p>The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
</p>
<p>In the combination, you must combine any sections Entitled “History”
in the various original documents, forming one section Entitled
“History”; likewise combine any sections Entitled “Acknowledgements”,
and any sections Entitled “Dedications”. You must delete all
sections Entitled “Endorsements.”
</p>
</li><li> COLLECTIONS OF DOCUMENTS
<p>You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
</p>
<p>You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
</p>
</li><li> AGGREGATION WITH INDEPENDENT WORKS
<p>A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an “aggregate” if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation’s users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
</p>
<p>If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document’s Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
</p>
</li><li> TRANSLATION
<p>Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
</p>
<p>If a section in the Document is Entitled “Acknowledgements”,
“Dedications”, or “History”, the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
</p>
</li><li> TERMINATION
<p>You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
</p>
<p>However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
</p>
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
</p>
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
</p>
</li><li> FUTURE REVISIONS OF THIS LICENSE
<p>The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
<a class="uref" href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.
</p>
<p>Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy’s public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
</p>
</li><li> RELICENSING
<p>“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
“Massive Multiauthor Collaboration” (or “MMC”) contained in the
site means any set of copyrightable works thus published on the MMC
site.
</p>
<p>“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
</p>
<p>“Incorporate” means to publish or republish a Document, in whole or
in part, as part of another Document.
</p>
<p>An MMC is “eligible for relicensing” if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
</p>
<p>The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
</p>
</li></ol>
<h3 class="heading" id="ADDENDUM_003a-How-to-use-this-License-for-your-documents"><span>ADDENDUM: How to use this License for your documents<a class="copiable-link" href="#ADDENDUM_003a-How-to-use-this-License-for-your-documents"> ¶</a></span></h3>
<p>To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
</p>
<div class="example smallexample">
<div class="group"><pre class="example-preformatted"> Copyright (C) <var class="var">year</var> <var class="var">your name</var>.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
</pre></div></div>
<p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the “with…Texts.” line with this:
</p>
<div class="example smallexample">
<div class="group"><pre class="example-preformatted"> with the Invariant Sections being <var class="var">list their titles</var>, with
the Front-Cover Texts being <var class="var">list</var>, and with the Back-Cover Texts
being <var class="var">list</var>.
</pre></div></div>
<p>If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
</p>
<p>If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
</p>
<hr>
</div>
<div class="appendix-level-extent" id="Additional-Features">
<div class="nav-panel">
<p>
Next: <a href="#Bibliography" accesskey="n" rel="next">Bibliography</a>, Previous: <a href="#Copying-Information" accesskey="p" rel="prev">Copying Information</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="appendix" id="Additional-Features-1"><span>Appendix G Additional Features<a class="copiable-link" href="#Additional-Features-1"> ¶</a></span></h2>
<ul class="mini-toc">
<li><a href="#kTLS-_0028Kernel-TLS_0029" accesskey="1">kTLS (Kernel TLS)</a></li>
</ul>
<hr>
<div class="section-level-extent" id="kTLS-_0028Kernel-TLS_0029">
<div class="nav-panel">
<p>
Up: <a href="#Additional-Features" accesskey="u" rel="up">Additional Features</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h3 class="section" id="kTLS-_0028Kernel-TLS_0029-1"><span>G.1 kTLS (Kernel TLS)<a class="copiable-link" href="#kTLS-_0028Kernel-TLS_0029-1"> ¶</a></span></h3>
<a class="index-entry-id" id="index-kTLS-_0028Kernel-TLS_0029"></a>
<p>kTLS (Kernel TLS) is a Linux kernel feature that offloads TLS encryption and decryption operations to the kernel space, improving performance and reducing CPU overhead. It allows applications to leverage zero-copy data transmission, reducing context switches between user space and kernel space.
</p>
<p>The following table shows how to enable kTLS support on Linux and FreeBSD systems.
</p><div class="float" id="tab_003aktls_005fsupport">
<table class="multitable">
<thead><tr><th width="40%">Description</th><th width="30%">Linux</th><th width="30%">FreeBSD</th></tr></thead>
<tbody><tr><td width="40%">Load kernel module</td><td width="30%"><code class="code">modprobe tls</code></td><td width="30%"><code class="code">kldload tls</code></td></tr>
<tr><td width="40%">Check if module is loaded</td><td width="30%"><code class="code">lsmod | grep tls</code></td><td width="30%"><code class="code">kldstat | grep tls</code></td></tr>
<tr><td width="40%">kTLS rekey support</td><td width="30%">v6.14</td><td width="30%">not yet supported</td></tr>
</tbody>
</table>
<div class="caption"><p><strong class="strong">Table G.1: </strong>kTLS system enable</p></div></div>
<p>To enable ktls in GnuTLS <a class="ref" href="#Enabling-kTLS">Enabling kTLS</a>.
</p>
<hr>
</div>
</div>
<div class="unnumbered-level-extent" id="Bibliography">
<div class="nav-panel">
<p>
Next: <a href="#Function-and-Data-Index" accesskey="n" rel="next">Function and Data Index</a>, Previous: <a href="#Additional-Features" accesskey="p" rel="prev">Additional Features</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="unnumbered" id="Bibliography-1"><span>Bibliography<a class="copiable-link" href="#Bibliography-1"> ¶</a></span></h2>
<dl class="table">
<dt><a class="anchor" id="CBCATT"></a>[CBCATT]</dt>
<dd><p>Bodo Moeller, "Security of CBC Ciphersuites in SSL/TLS: Problems and
Countermeasures", 2002, available from
<a class="url" href="https://www.openssl.org/~bodo/tls-cbc.txt">https://www.openssl.org/~bodo/tls-cbc.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="GPGH"></a>[GPGH]</dt>
<dd><p>Mike Ashley, "The GNU Privacy Handbook", 2002, available from
<a class="url" href="https://www.gnupg.org/gph/en/manual.pdf">https://www.gnupg.org/gph/en/manual.pdf</a>.
</p>
</dd>
<dt><a class="anchor" id="GUTPKI"></a>[GUTPKI]</dt>
<dd><p>Peter Gutmann, "Everything you never wanted to know about PKI but were
forced to find out", Available from
<a class="url" href="https://www.cs.auckland.ac.nz/~pgut001/">https://www.cs.auckland.ac.nz/~pgut001/</a>.
</p>
</dd>
<dt><a class="anchor" id="PRNGATTACKS"></a>[PRNGATTACKS]</dt>
<dd><p>John Kelsey and Bruce Schneier, "Cryptanalytic Attacks on Pseudorandom Number Generators",
Available from <a class="url" href="https://www.schneier.com/academic/paperfiles/paper-prngs.pdf">https://www.schneier.com/academic/paperfiles/paper-prngs.pdf</a>.
</p>
</dd>
<dt><a class="anchor" id="KEYPIN"></a>[KEYPIN]</dt>
<dd><p>Chris Evans and Chris Palmer, "Public Key Pinning Extension for HTTP",
Available from <a class="url" href="https://tools.ietf.org/html/draft-ietf-websec-key-pinning-01">https://tools.ietf.org/html/draft-ietf-websec-key-pinning-01</a>.
</p>
</dd>
<dt><a class="anchor" id="NISTSP80057"></a>[NISTSP80057]</dt>
<dd><p>NIST Special Publication 800-57, "Recommendation for Key Management -
Part 1: General (Revised)", March 2007, available from
<a class="url" href="https://csrc.nist.gov/publications/nistpubs/800-57/sp800-57-Part1-revised2_Mar08-2007.pdf">https://csrc.nist.gov/publications/nistpubs/800-57/sp800-57-Part1-revised2_Mar08-2007.pdf</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC7413"></a>[RFC7413]</dt>
<dd><p>Y. Cheng and J. Chu and S. Radhakrishnan and A. Jain, "TCP Fast Open",
December 2014, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc7413.txt">https://www.ietf.org/rfc/rfc7413.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC7918"></a>[RFC7918]</dt>
<dd><p>A. Langley, N. Modadugu, B. Moeller, "Transport Layer Security (TLS) False Start",
August 2016, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc7918.txt">https://www.ietf.org/rfc/rfc7918.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC6125"></a>[RFC6125]</dt>
<dd><p>Peter Saint-Andre and Jeff Hodges, "Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)",
March 2011, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc6125.txt">https://www.ietf.org/rfc/rfc6125.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC7685"></a>[RFC7685]</dt>
<dd><p>Adam Langley, "A Transport Layer Security (TLS) ClientHello Padding Extension",
October 2015, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc7685.txt">https://www.ietf.org/rfc/rfc7685.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC7613"></a>[RFC7613]</dt>
<dd><p>Peter Saint-Andre and Alexey Melnikov, "Preparation, Enforcement, and Comparison of Internationalized Strings Representing Usernames and Passwords",
August 2015, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc7613.txt">https://www.ietf.org/rfc/rfc7613.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC2246"></a>[RFC2246]</dt>
<dd><p>Tim Dierks and Christopher Allen, "The TLS Protocol Version 1.0",
January 1999, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc2246.txt">https://www.ietf.org/rfc/rfc2246.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC6083"></a>[RFC6083]</dt>
<dd><p>M. Tuexen and R. Seggelmann and E. Rescorla, "Datagram Transport Layer Security (DTLS) for Stream Control Transmission Protocol (SCTP)",
January 2011, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc6083.txt">https://www.ietf.org/rfc/rfc6083.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC4418"></a>[RFC4418]</dt>
<dd><p>Ted Krovetz, "UMAC: Message Authentication Code using Universal Hashing",
March 2006, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc4418.txt">https://www.ietf.org/rfc/rfc4418.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC4680"></a>[RFC4680]</dt>
<dd><p>S. Santesson, "TLS Handshake Message for Supplemental Data",
September 2006, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc4680.txt">https://www.ietf.org/rfc/rfc4680.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC7633"></a>[RFC7633]</dt>
<dd><p>P. Hallam-Baker, "X.509v3 Transport Layer Security (TLS) Feature Extension",
October 2015, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc7633.txt">https://www.ietf.org/rfc/rfc7633.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC7919"></a>[RFC7919]</dt>
<dd><p>D. Gillmor, "Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for Transport Layer Security (TLS)",
August 2016, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc7919.txt">https://www.ietf.org/rfc/rfc7919.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC4514"></a>[RFC4514]</dt>
<dd><p>Kurt D. Zeilenga, "Lightweight Directory Access Protocol (LDAP): String Representation of Distinguished Names",
June 2006, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc4513.txt">https://www.ietf.org/rfc/rfc4513.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC4346"></a>[RFC4346]</dt>
<dd><p>Tim Dierks and Eric Rescorla, "The TLS Protocol Version 1.1", Match
2006, Available from <a class="url" href="https://www.ietf.org/rfc/rfc4346.txt">https://www.ietf.org/rfc/rfc4346.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC4347"></a>[RFC4347]</dt>
<dd><p>Eric Rescorla and Nagendra Modadugu, "Datagram Transport Layer Security", April
2006, Available from <a class="url" href="https://www.ietf.org/rfc/rfc4347.txt">https://www.ietf.org/rfc/rfc4347.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC5246"></a>[RFC5246]</dt>
<dd><p>Tim Dierks and Eric Rescorla, "The TLS Protocol Version 1.2", August
2008, Available from <a class="url" href="https://www.ietf.org/rfc/rfc5246.txt">https://www.ietf.org/rfc/rfc5246.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC2440"></a>[RFC2440]</dt>
<dd><p>Jon Callas, Lutz Donnerhacke, Hal Finney and Rodney Thayer, "OpenPGP
Message Format", November 1998, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc2440.txt">https://www.ietf.org/rfc/rfc2440.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC4880"></a>[RFC4880]</dt>
<dd><p>Jon Callas, Lutz Donnerhacke, Hal Finney, David Shaw and Rodney
Thayer, "OpenPGP Message Format", November 2007, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc4880.txt">https://www.ietf.org/rfc/rfc4880.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC4211"></a>[RFC4211]</dt>
<dd><p>J. Schaad, "Internet X.509 Public Key Infrastructure Certificate
Request Message Format (CRMF)", September 2005, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc4211.txt">https://www.ietf.org/rfc/rfc4211.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC2817"></a>[RFC2817]</dt>
<dd><p>Rohit Khare and Scott Lawrence, "Upgrading to TLS Within HTTP/1.1",
May 2000, Available from <a class="url" href="https://www.ietf.org/rfc/rfc2817.txt">https://www.ietf.org/rfc/rfc2817.txt</a>
</p>
</dd>
<dt><a class="anchor" id="RFC2818"></a>[RFC2818]</dt>
<dd><p>Eric Rescorla, "HTTP Over TLS", May 2000, Available from
<a class="url" href="https://www.ietf/rfc/rfc2818.txt">https://www.ietf/rfc/rfc2818.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC2945"></a>[RFC2945]</dt>
<dd><p>Tom Wu, "The SRP Authentication and Key Exchange System", September
2000, Available from <a class="url" href="https://www.ietf.org/rfc/rfc2945.txt">https://www.ietf.org/rfc/rfc2945.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC7301"></a>[RFC7301]</dt>
<dd><p>S. Friedl, A. Popov, A. Langley, E. Stephan, "Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension",
July 2014, Available from <a class="url" href="https://www.ietf.org/rfc/rfc7301.txt">https://www.ietf.org/rfc/rfc7301.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC2986"></a>[RFC2986]</dt>
<dd><p>Magnus Nystrom and Burt Kaliski, "PKCS 10 v1.7: Certification Request
Syntax Specification", November 2000, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc2986.txt">https://www.ietf.org/rfc/rfc2986.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="PKIX"></a>[PKIX]</dt>
<dd><p>D. Cooper, S. Santesson, S. Farrel, S. Boeyen, R. Housley, W. Polk,
"Internet X.509 Public Key Infrastructure Certificate and Certificate
Revocation List (CRL) Profile", May 2008, available from
<a class="url" href="https://www.ietf.org/rfc/rfc5280.txt">https://www.ietf.org/rfc/rfc5280.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC3749"></a>[RFC3749]</dt>
<dd><p>Scott Hollenbeck, "Transport Layer Security Protocol Compression
Methods", May 2004, available from
<a class="url" href="https://www.ietf.org/rfc/rfc3749.txt">https://www.ietf.org/rfc/rfc3749.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC3820"></a>[RFC3820]</dt>
<dd><p>Steven Tuecke, Von Welch, Doug Engert, Laura Pearlman, and Mary
Thompson, "Internet X.509 Public Key Infrastructure (PKI) Proxy
Certificate Profile", June 2004, available from
<a class="url" href="https://www.ietf.org/rfc/rfc3820">https://www.ietf.org/rfc/rfc3820</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC6520"></a>[RFC6520]</dt>
<dd><p>R. Seggelmann, M. Tuexen, and M. Williams, "Transport Layer Security (TLS) and
Datagram Transport Layer Security (DTLS) Heartbeat Extension", February 2012, available from
<a class="url" href="https://www.ietf.org/rfc/rfc6520">https://www.ietf.org/rfc/rfc6520</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC5746"></a>[RFC5746]</dt>
<dd><p>E. Rescorla, M. Ray, S. Dispensa, and N. Oskov, "Transport Layer
Security (TLS) Renegotiation Indication Extension", February 2010,
available from <a class="url" href="https://www.ietf.org/rfc/rfc5746">https://www.ietf.org/rfc/rfc5746</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC5280"></a>[RFC5280]</dt>
<dd><p>D. Cooper, S. Santesson, S. Farrell, S. Boeyen, R. Housley, and
W. Polk, "Internet X.509 Public Key Infrastructure Certificate and
Certificate Revocation List (CRL) Profile", May 2008, available from
<a class="url" href="https://www.ietf.org/rfc/rfc5280">https://www.ietf.org/rfc/rfc5280</a>.
</p>
</dd>
<dt><a class="anchor" id="TLSTKT"></a>[TLSTKT]</dt>
<dd><p>Joseph Salowey, Hao Zhou, Pasi Eronen, Hannes Tschofenig, "Transport
Layer Security (TLS) Session Resumption without Server-Side State",
January 2008, available from <a class="url" href="https://www.ietf.org/rfc/rfc5077">https://www.ietf.org/rfc/rfc5077</a>.
</p>
</dd>
<dt><a class="anchor" id="PKCS12"></a>[PKCS12]</dt>
<dd><p>RSA Laboratories, "PKCS 12 v1.0: Personal Information Exchange
Syntax", June 1999, Available from <a class="url" href="https://www.rsa.com">https://www.rsa.com</a>.
</p>
</dd>
<dt><a class="anchor" id="PKCS11"></a>[PKCS11]</dt>
<dd><p>RSA Laboratories, "PKCS #11 Base Functionality v2.30: Cryptoki – Draft 4",
July 2009, Available from <a class="url" href="https://www.rsa.com">https://www.rsa.com</a>.
</p>
</dd>
<dt><a class="anchor" id="RESCORLA"></a>[RESCORLA]</dt>
<dd><p>Eric Rescorla, "SSL and TLS: Designing and Building Secure Systems",
2001
</p>
</dd>
<dt><a class="anchor" id="SELKEY"></a>[SELKEY]</dt>
<dd><p>Arjen Lenstra and Eric Verheul, "Selecting Cryptographic Key Sizes",
2003, available from <a class="url" href="https://www.win.tue.nl/~klenstra/key.pdf">https://www.win.tue.nl/~klenstra/key.pdf</a>.
</p>
</dd>
<dt><a class="anchor" id="SSL3"></a>[SSL3]</dt>
<dd><p>Alan Freier, Philip Karlton and Paul Kocher, "The Secure Sockets Layer (SSL) Protocol Version 3.0",
August 2011, Available from <a class="url" href="https://www.ietf.org/rfc/rfc6101.txt">https://www.ietf.org/rfc/rfc6101.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="STEVENS"></a>[STEVENS]</dt>
<dd><p>Richard Stevens, "UNIX Network Programming, Volume 1", Prentice Hall
PTR, January 1998
</p>
</dd>
<dt><a class="anchor" id="TLSEXT"></a>[TLSEXT]</dt>
<dd><p>Simon Blake-Wilson, Magnus Nystrom, David Hopwood, Jan Mikkelsen and
Tim Wright, "Transport Layer Security (TLS) Extensions", June 2003,
Available from <a class="url" href="https://www.ietf.org/rfc/rfc3546.txt">https://www.ietf.org/rfc/rfc3546.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="TLSPGP"></a>[TLSPGP]</dt>
<dd><p>Nikos Mavrogiannopoulos, "Using OpenPGP keys for TLS authentication",
January 2011. Available from
<a class="url" href="https://www.ietf.org/rfc/rfc6091.txt">https://www.ietf.org/rfc/rfc6091.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="TLSSRP"></a>[TLSSRP]</dt>
<dd><p>David Taylor, Trevor Perrin, Tom Wu and Nikos Mavrogiannopoulos,
"Using SRP for TLS Authentication", November 2007. Available from
<a class="url" href="https://www.ietf.org/rfc/rfc5054.txt">https://www.ietf.org/rfc/rfc5054.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="TLSPSK"></a>[TLSPSK]</dt>
<dd><p>Pasi Eronen and Hannes Tschofenig, "Pre-shared key Ciphersuites for
TLS", December 2005, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc4279.txt">https://www.ietf.org/rfc/rfc4279.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="TOMSRP"></a>[TOMSRP]</dt>
<dd><p>Tom Wu, "The Stanford SRP Authentication Project", Available at
<a class="url" href="https://srp.stanford.edu/">https://srp.stanford.edu/</a>.
</p>
</dd>
<dt><a class="anchor" id="WEGER"></a>[WEGER]</dt>
<dd><p>Arjen Lenstra and Xiaoyun Wang and Benne de Weger, "Colliding X.509
Certificates", Cryptology ePrint Archive, Report 2005/067, Available
at <a class="url" href="https://eprint.iacr.org/">https://eprint.iacr.org/</a>.
</p>
</dd>
<dt><a class="anchor" id="ECRYPT"></a>[ECRYPT]</dt>
<dd><p>European Network of Excellence in Cryptology II, "ECRYPT II Yearly
Report on Algorithms and Keysizes (2009-2010)", Available
at <a class="url" href="https://www.ecrypt.eu.org/documents/D.SPA.13.pdf">https://www.ecrypt.eu.org/documents/D.SPA.13.pdf</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC5056"></a>[RFC5056]</dt>
<dd><p>N. Williams, "On the Use of Channel Bindings to Secure Channels",
November 2007, available from <a class="url" href="https://www.ietf.org/rfc/rfc5056">https://www.ietf.org/rfc/rfc5056</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC5764"></a>[RFC5764]</dt>
<dd><p>D. McGrew, E. Rescorla, "Datagram Transport Layer Security (DTLS) Extension to Establish Keys for the Secure Real-time Transport Protocol (SRTP)On the Use of Channel Bindings to Secure Channels",
May 2010, available from <a class="url" href="https://www.ietf.org/rfc/rfc5764">https://www.ietf.org/rfc/rfc5764</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC5929"></a>[RFC5929]</dt>
<dd><p>J. Altman, N. Williams, L. Zhu, "Channel Bindings for TLS", July 2010,
available from <a class="url" href="https://www.ietf.org/rfc/rfc5929">https://www.ietf.org/rfc/rfc5929</a>.
</p>
</dd>
<dt><a class="anchor" id="PKCS11URI"></a>[PKCS11URI]</dt>
<dd><p>J. Pechanec, D. Moffat, "The PKCS#11 URI Scheme", April 2015,
available from <a class="url" href="https://www.ietf.org/rfc/rfc7512">https://www.ietf.org/rfc/rfc7512</a>.
</p>
</dd>
<dt><a class="anchor" id="TPMURI"></a>[TPMURI]</dt>
<dd><p>C. Latze, N. Mavrogiannopoulos, "The TPMKEY URI Scheme", January 2013,
Work in progress, available from <a class="url" href="https://tools.ietf.org/html/draft-mavrogiannopoulos-tpmuri-01">https://tools.ietf.org/html/draft-mavrogiannopoulos-tpmuri-01</a>.
</p>
</dd>
<dt><a class="anchor" id="ANDERSON"></a>[ANDERSON]</dt>
<dd><p>R. J. Anderson, "Security Engineering: A Guide to Building Dependable Distributed Systems",
John Wiley \& Sons, Inc., 2001.
</p>
</dd>
<dt><a class="anchor" id="RFC4821"></a>[RFC4821]</dt>
<dd><p>M. Mathis, J. Heffner, "Packetization Layer Path MTU Discovery", March 2007,
available from <a class="url" href="https://www.ietf.org/rfc/rfc4821.txt">https://www.ietf.org/rfc/rfc4821.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC2560"></a>[RFC2560]</dt>
<dd><p>M. Myers et al, "X.509 Internet Public Key Infrastructure Online
Certificate Status Protocol - OCSP", June 1999, Available from
<a class="url" href="https://www.ietf.org/rfc/rfc2560.txt">https://www.ietf.org/rfc/rfc2560.txt</a>.
</p>
</dd>
<dt><a class="anchor" id="RIVESTCRL"></a>[RIVESTCRL]</dt>
<dd><p>R. L. Rivest, "Can We Eliminate Certificate Revocation Lists?",
Proceedings of Financial Cryptography ’98; Springer Lecture Notes in
Computer Science No. 1465 (Rafael Hirschfeld, ed.), February 1998),
pages 178–183, available from
<a class="url" href="https://people.csail.mit.edu/rivest/Rivest-CanWeEliminateCertificateRevocationLists.pdf">https://people.csail.mit.edu/rivest/Rivest-CanWeEliminateCertificateRevocationLists.pdf</a>.
</p>
</dd>
<dt><a class="anchor" id="RFC9266"></a>[RFC9266]</dt>
<dd><p>S. Whited, "Channel Bindings for TLS 1.3",
July 2022, available from <a class="url" href="https://www.ietf.org/rfc/rfc9266.txt">https://www.ietf.org/rfc/rfc9266.txt</a>.
</p>
</dd>
</dl>
<hr>
</div>
<div class="unnumbered-level-extent" id="Function-and-Data-Index">
<div class="nav-panel">
<p>
Next: <a href="#Concept-Index" accesskey="n" rel="next">Concept Index</a>, Previous: <a href="#Bibliography" accesskey="p" rel="prev">Bibliography</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="unnumbered" id="Function-and-Data-Index-1"><span>Function and Data Index<a class="copiable-link" href="#Function-and-Data-Index-1"> ¶</a></span></h2>
<div class="printindex fn-printindex">
<table class="fn-letters-header-printindex"><tr><th>Jump to: </th><td><a class="summary-letter-printindex" href="#Function-and-Data-Index_fn_letter-D"><b>D</b></a>
<a class="summary-letter-printindex" href="#Function-and-Data-Index_fn_letter-G"><b>G</b></a>
</td></tr></table>
<table class="fn-entries-printindex">
<tr><td></td><th class="entries-header-printindex">Index Entry</th><th class="sections-header-printindex">Section</th></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Function-and-Data-Index_fn_letter-D">D</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fcert_005ftype_005fname"><code>dane_cert_type_name</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fcert_005fusage_005fname"><code>dane_cert_usage_name</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fmatch_005ftype_005fname"><code>dane_match_type_name</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fquery_005fdata"><code>dane_query_data</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fquery_005fdeinit"><code>dane_query_deinit</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fquery_005fentries"><code>dane_query_entries</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fquery_005fstatus"><code>dane_query_status</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fquery_005ftlsa"><code>dane_query_tlsa</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fquery_005fto_005fraw_005ftlsa"><code>dane_query_to_raw_tlsa</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fraw_005ftlsa"><code>dane_raw_tlsa</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fstate_005fdeinit"><code>dane_state_deinit</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fstate_005finit"><code>dane_state_init</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fstate_005fset_005fdlv_005ffile"><code>dane_state_set_dlv_file</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fstrerror"><code>dane_strerror</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fverification_005fstatus_005fprint"><code>dane_verification_status_print</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fverify_005fcrt"><code>dane_verify_crt</code></a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fverify_005fcrt-1"><code>dane_verify_crt</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fverify_005fcrt_005fraw"><code>dane_verify_crt_raw</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-dane_005fverify_005fsession_005fcrt"><code>dane_verify_session_crt</code></a></td><td class="printindex-index-section"><a href="#DANE-API">DANE API</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Function-and-Data-Index_fn_letter-G">G</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fdecrypt"><code>gnutls_aead_cipher_decrypt</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fdecryptv2"><code>gnutls_aead_cipher_decryptv2</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fdeinit"><code>gnutls_aead_cipher_deinit</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fencrypt"><code>gnutls_aead_cipher_encrypt</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fencryptv"><code>gnutls_aead_cipher_encryptv</code></a></td><td class="printindex-index-section"><a href="#Symmetric-algorithms">Symmetric algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fencryptv-1"><code>gnutls_aead_cipher_encryptv</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fencryptv2"><code>gnutls_aead_cipher_encryptv2</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005finit"><code>gnutls_aead_cipher_init</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faead_005fcipher_005fset_005fkey"><code>gnutls_aead_cipher_set_key</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fget"><code>gnutls_alert_get</code></a></td><td class="printindex-index-section"><a href="#Handling-alerts">Handling alerts</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fget-1"><code>gnutls_alert_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fget_005fname"><code>gnutls_alert_get_name</code></a></td><td class="printindex-index-section"><a href="#Handling-alerts">Handling alerts</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fget_005fname-1"><code>gnutls_alert_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fget_005fstrname"><code>gnutls_alert_get_strname</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fsend"><code>gnutls_alert_send</code></a></td><td class="printindex-index-section"><a href="#Handling-alerts">Handling alerts</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fsend-1"><code>gnutls_alert_send</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fsend_005fappropriate"><code>gnutls_alert_send_appropriate</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falert_005fset_005fread_005ffunction"><code>gnutls_alert_set_read_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falpn_005fget_005fselected_005fprotocol"><code>gnutls_alpn_get_selected_protocol</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005falpn_005fset_005fprotocols"><code>gnutls_alpn_set_protocols</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005fallocate_005fclient_005fcredentials"><code>gnutls_anon_allocate_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005fallocate_005fserver_005fcredentials"><code>gnutls_anon_allocate_server_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005ffree_005fclient_005fcredentials"><code>gnutls_anon_free_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005ffree_005fserver_005fcredentials"><code>gnutls_anon_free_server_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005fset_005fparams_005ffunction"><code>gnutls_anon_set_params_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005fset_005fserver_005fdh_005fparams"><code>gnutls_anon_set_server_dh_params</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005fset_005fserver_005fknown_005fdh_005fparams"><code>gnutls_anon_set_server_known_dh_params</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanon_005fset_005fserver_005fparams_005ffunction"><code>gnutls_anon_set_server_params_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanti_005freplay_005fdeinit"><code>gnutls_anti_replay_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanti_005freplay_005fenable"><code>gnutls_anti_replay_enable</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanti_005freplay_005finit"><code>gnutls_anti_replay_init</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanti_005freplay_005fset_005fadd_005ffunction"><code>gnutls_anti_replay_set_add_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanti_005freplay_005fset_005fptr"><code>gnutls_anti_replay_set_ptr</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fanti_005freplay_005fset_005fwindow"><code>gnutls_anti_replay_set_window</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faudit_005fcurrent_005fcontext"><code>gnutls_audit_current_context</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faudit_005fpop_005fcontext"><code>gnutls_audit_pop_context</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005faudit_005fpush_005fcontext"><code>gnutls_audit_push_context</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fauth_005fclient_005fget_005ftype"><code>gnutls_auth_client_get_type</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fauth_005fget_005ftype"><code>gnutls_auth_get_type</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fauth_005fserver_005fget_005ftype"><code>gnutls_auth_server_get_type</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fbase64_005fdecode2"><code>gnutls_base64_decode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fbase64_005fencode2"><code>gnutls_base64_encode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fbuffer_005fappend_005fdata"><code>gnutls_buffer_append_data</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fbye"><code>gnutls_bye</code></a></td><td class="printindex-index-section"><a href="#Data-transfer-and-termination">Data transfer and termination</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fbye-1"><code>gnutls_bye</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005factivation_005ftime_005fpeers"><code>gnutls_certificate_activation_time_peers</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fallocate_005fcredentials"><code>gnutls_certificate_allocate_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fclient_005fget_005frequest_005fstatus"><code>gnutls_certificate_client_get_request_status</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fexpiration_005ftime_005fpeers"><code>gnutls_certificate_expiration_time_peers</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ffree_005fca_005fnames"><code>gnutls_certificate_free_ca_names</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ffree_005fcas"><code>gnutls_certificate_free_cas</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ffree_005fcredentials"><code>gnutls_certificate_free_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ffree_005fcrls"><code>gnutls_certificate_free_crls</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ffree_005fkeys"><code>gnutls_certificate_free_keys</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fcrt_005fraw"><code>gnutls_certificate_get_crt_raw</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fissuer"><code>gnutls_certificate_get_issuer</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005focsp_005fexpiration"><code>gnutls_certificate_get_ocsp_expiration</code></a></td><td class="printindex-index-section"><a href="#OCSP-stapling">OCSP stapling</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005focsp_005fexpiration-1"><code>gnutls_certificate_get_ocsp_expiration</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fours"><code>gnutls_certificate_get_ours</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fpeers"><code>gnutls_certificate_get_peers</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fpeers_005fsubkey_005fid"><code>gnutls_certificate_get_peers_subkey_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005ftrust_005flist"><code>gnutls_certificate_get_trust_list</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fverify_005fflags"><code>gnutls_certificate_get_verify_flags</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fx509_005fcrt"><code>gnutls_certificate_get_x509_crt</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fget_005fx509_005fkey"><code>gnutls_certificate_get_x509_key</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence"><code>gnutls_certificate_send_x509_rdn_sequence</code></a></td><td class="printindex-index-section"><a href="#Certificate-credentials">Certificate credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fsend_005fx509_005frdn_005fsequence-1"><code>gnutls_certificate_send_x509_rdn_sequence</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fserver_005fset_005frequest"><code>gnutls_certificate_server_set_request</code></a></td><td class="printindex-index-section"><a href="#Certificate-credentials">Certificate credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fserver_005fset_005frequest-1"><code>gnutls_certificate_server_set_request</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fdh_005fparams"><code>gnutls_certificate_set_dh_params</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fflags"><code>gnutls_certificate_set_flags</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fkey"><code>gnutls_certificate_set_key</code></a></td><td class="printindex-index-section"><a href="#Certificate-credentials">Certificate credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fkey-1"><code>gnutls_certificate_set_key</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fknown_005fdh_005fparams"><code>gnutls_certificate_set_known_dh_params</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile"><code>gnutls_certificate_set_ocsp_status_request_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffile2"><code>gnutls_certificate_set_ocsp_status_request_file2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction"><code>gnutls_certificate_set_ocsp_status_request_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005ffunction2"><code>gnutls_certificate_set_ocsp_status_request_function2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005focsp_005fstatus_005frequest_005fmem"><code>gnutls_certificate_set_ocsp_status_request_mem</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fparams_005ffunction"><code>gnutls_certificate_set_params_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fpin_005ffunction"><code>gnutls_certificate_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#Certificate-credentials">Certificate credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fpin_005ffunction-1"><code>gnutls_certificate_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005frawpk_005fkey_005ffile"><code>gnutls_certificate_set_rawpk_key_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005frawpk_005fkey_005fmem"><code>gnutls_certificate_set_rawpk_key_mem</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction"><code>gnutls_certificate_set_retrieve_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction2"><code>gnutls_certificate_set_retrieve_function2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fretrieve_005ffunction3"><code>gnutls_certificate_set_retrieve_function3</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005ftrust_005flist"><code>gnutls_certificate_set_trust_list</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fverify_005fflags"><code>gnutls_certificate_set_verify_flags</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fverify_005ffunction"><code>gnutls_certificate_set_verify_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fverify_005flimits"><code>gnutls_certificate_set_verify_limits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fcrl"><code>gnutls_certificate_set_x509_crl</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fcrl_005ffile"><code>gnutls_certificate_set_x509_crl_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fcrl_005fmem"><code>gnutls_certificate_set_x509_crl_mem</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey"><code>gnutls_certificate_set_x509_key</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile"><code>gnutls_certificate_set_x509_key_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005ffile2"><code>gnutls_certificate_set_x509_key_file2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem"><code>gnutls_certificate_set_x509_key_mem</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fkey_005fmem2"><code>gnutls_certificate_set_x509_key_mem2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005ffile"><code>gnutls_certificate_set_x509_simple_pkcs12_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fsimple_005fpkcs12_005fmem"><code>gnutls_certificate_set_x509_simple_pkcs12_mem</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust"><code>gnutls_certificate_set_x509_system_trust</code></a></td><td class="printindex-index-section"><a href="#Certificate-credentials">Certificate credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005fsystem_005ftrust-1"><code>gnutls_certificate_set_x509_system_trust</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust"><code>gnutls_certificate_set_x509_trust</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005fdir"><code>gnutls_certificate_set_x509_trust_dir</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005ffile"><code>gnutls_certificate_set_x509_trust_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fset_005fx509_005ftrust_005fmem"><code>gnutls_certificate_set_x509_trust_mem</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ftype_005fget"><code>gnutls_certificate_type_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ftype_005fget_005fid"><code>gnutls_certificate_type_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ftype_005fget_005fname"><code>gnutls_certificate_type_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ftype_005fget2"><code>gnutls_certificate_type_get2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005ftype_005flist"><code>gnutls_certificate_type_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverification_005fprofile_005fget_005fid"><code>gnutls_certificate_verification_profile_get_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverification_005fprofile_005fget_005fname"><code>gnutls_certificate_verification_profile_get_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverification_005fstatus_005fprint"><code>gnutls_certificate_verification_status_print</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverify_005fflags"><code>gnutls_certificate_verify_flags</code></a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-in-the-context-of-TLS-session">Verifying a certificate in the context of TLS session</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverify_005fflags-1"><code>gnutls_certificate_verify_flags</code></a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverify_005fpeers"><code>gnutls_certificate_verify_peers</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverify_005fpeers2"><code>gnutls_certificate_verify_peers2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcertificate_005fverify_005fpeers3"><code>gnutls_certificate_verify_peers3</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcheck_005fversion"><code>gnutls_check_version</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fadd_005fauth"><code>gnutls_cipher_add_auth</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fdecrypt"><code>gnutls_cipher_decrypt</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fdecrypt2"><code>gnutls_cipher_decrypt2</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fdecrypt3"><code>gnutls_cipher_decrypt3</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fdeinit"><code>gnutls_cipher_deinit</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fencrypt"><code>gnutls_cipher_encrypt</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fencrypt2"><code>gnutls_cipher_encrypt2</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fencrypt3"><code>gnutls_cipher_encrypt3</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fget"><code>gnutls_cipher_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fget_005fblock_005fsize"><code>gnutls_cipher_get_block_size</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fget_005fid"><code>gnutls_cipher_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fget_005fiv_005fsize"><code>gnutls_cipher_get_iv_size</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fget_005fkey_005fsize"><code>gnutls_cipher_get_key_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fget_005fname"><code>gnutls_cipher_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fget_005ftag_005fsize"><code>gnutls_cipher_get_tag_size</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005finit"><code>gnutls_cipher_init</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005flist"><code>gnutls_cipher_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fset_005fiv"><code>gnutls_cipher_set_iv</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fsuite_005fget_005fname"><code>gnutls_cipher_suite_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005fsuite_005finfo"><code>gnutls_cipher_suite_info</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcipher_005ftag"><code>gnutls_cipher_tag</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fciphersuite_005fget"><code>gnutls_ciphersuite_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcompress_005fcertificate_005fget_005fselected_005fmethod"><code>gnutls_compress_certificate_get_selected_method</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcompress_005fcertificate_005fset_005fmethods"><code>gnutls_compress_certificate_set_methods</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcompression_005fget"><code>gnutls_compression_get</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcompression_005fget_005fid"><code>gnutls_compression_get_id</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcompression_005fget_005fname"><code>gnutls_compression_get_name</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcompression_005flist"><code>gnutls_compression_list</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcredentials_005fclear"><code>gnutls_credentials_clear</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcredentials_005fget"><code>gnutls_credentials_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcredentials_005fset"><code>gnutls_credentials_set</code></a></td><td class="printindex-index-section"><a href="#Session-initialization">Session initialization</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcredentials_005fset-1"><code>gnutls_credentials_set</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005faead_005fcipher"><code>gnutls_crypto_register_aead_cipher</code></a></td><td class="printindex-index-section"><a href="#Overriding-algorithms">Overriding algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005faead_005fcipher-1"><code>gnutls_crypto_register_aead_cipher</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005fcipher"><code>gnutls_crypto_register_cipher</code></a></td><td class="printindex-index-section"><a href="#Overriding-algorithms">Overriding algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005fcipher-1"><code>gnutls_crypto_register_cipher</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005fdigest"><code>gnutls_crypto_register_digest</code></a></td><td class="printindex-index-section"><a href="#Overriding-algorithms">Overriding algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005fdigest-1"><code>gnutls_crypto_register_digest</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005fmac"><code>gnutls_crypto_register_mac</code></a></td><td class="printindex-index-section"><a href="#Overriding-algorithms">Overriding algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fcrypto_005fregister_005fmac-1"><code>gnutls_crypto_register_mac</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fcheck_005fentry"><code>gnutls_db_check_entry</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fcheck_005fentry_005fexpire_005ftime"><code>gnutls_db_check_entry_expire_time</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fcheck_005fentry_005ftime"><code>gnutls_db_check_entry_time</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fget_005fdefault_005fcache_005fexpiration"><code>gnutls_db_get_default_cache_expiration</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fget_005fptr"><code>gnutls_db_get_ptr</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fremove_005fsession"><code>gnutls_db_remove_session</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fset_005fcache_005fexpiration"><code>gnutls_db_set_cache_expiration</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fset_005fptr"><code>gnutls_db_set_ptr</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fset_005fremove_005ffunction"><code>gnutls_db_set_remove_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fset_005fretrieve_005ffunction"><code>gnutls_db_set_retrieve_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdb_005fset_005fstore_005ffunction"><code>gnutls_db_set_store_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdecode_005fber_005fdigest_005finfo"><code>gnutls_decode_ber_digest_info</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdecode_005fgost_005frs_005fvalue"><code>gnutls_decode_gost_rs_value</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdecode_005frs_005fvalue"><code>gnutls_decode_rs_value</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdeinit"><code>gnutls_deinit</code></a></td><td class="printindex-index-section"><a href="#Data-transfer-and-termination">Data transfer and termination</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdeinit-1"><code>gnutls_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fget_005fgroup"><code>gnutls_dh_get_group</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fget_005fpeers_005fpublic_005fbits"><code>gnutls_dh_get_peers_public_bits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fget_005fprime_005fbits"><code>gnutls_dh_get_prime_bits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fget_005fpubkey"><code>gnutls_dh_get_pubkey</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fget_005fsecret_005fbits"><code>gnutls_dh_get_secret_bits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fcpy"><code>gnutls_dh_params_cpy</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fdeinit"><code>gnutls_dh_params_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fexport_005fpkcs3"><code>gnutls_dh_params_export_pkcs3</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fexport_005fraw"><code>gnutls_dh_params_export_raw</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fexport2_005fpkcs3"><code>gnutls_dh_params_export2_pkcs3</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fgenerate2"><code>gnutls_dh_params_generate2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fimport_005fdsa"><code>gnutls_dh_params_import_dsa</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fimport_005fpkcs3"><code>gnutls_dh_params_import_pkcs3</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fimport_005fraw"><code>gnutls_dh_params_import_raw</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fimport_005fraw2"><code>gnutls_dh_params_import_raw2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005fimport_005fraw3"><code>gnutls_dh_params_import_raw3</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fparams_005finit"><code>gnutls_dh_params_init</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdh_005fset_005fprime_005fbits"><code>gnutls_dh_set_prime_bits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdigest_005fget_005fid"><code>gnutls_digest_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdigest_005fget_005fname"><code>gnutls_digest_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdigest_005fget_005foid"><code>gnutls_digest_get_oid</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdigest_005flist"><code>gnutls_digest_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdigest_005fset_005fsecure"><code>gnutls_digest_set_secure</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fcookie_005fsend"><code>gnutls_dtls_cookie_send</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fcookie_005fverify"><code>gnutls_dtls_cookie_verify</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fget_005fdata_005fmtu"><code>gnutls_dtls_get_data_mtu</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fget_005fmtu"><code>gnutls_dtls_get_mtu</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fget_005ftimeout"><code>gnutls_dtls_get_timeout</code></a></td><td class="printindex-index-section"><a href="#Setting-up-the-transport-layer">Setting up the transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fget_005ftimeout-1"><code>gnutls_dtls_get_timeout</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fprestate_005fset"><code>gnutls_dtls_prestate_set</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fset_005fdata_005fmtu"><code>gnutls_dtls_set_data_mtu</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fset_005fmtu"><code>gnutls_dtls_set_mtu</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdtls_005fset_005ftimeouts"><code>gnutls_dtls_set_timeouts</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fearly_005fcipher_005fget"><code>gnutls_early_cipher_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fearly_005fprf_005fhash_005fget"><code>gnutls_early_prf_hash_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005fget"><code>gnutls_ecc_curve_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005fget_005fid"><code>gnutls_ecc_curve_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005fget_005fname"><code>gnutls_ecc_curve_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005fget_005foid"><code>gnutls_ecc_curve_get_oid</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005fget_005fpk"><code>gnutls_ecc_curve_get_pk</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005fget_005fsize"><code>gnutls_ecc_curve_get_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005flist"><code>gnutls_ecc_curve_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fecc_005fcurve_005fset_005fenabled"><code>gnutls_ecc_curve_set_enabled</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fencode_005fber_005fdigest_005finfo"><code>gnutls_encode_ber_digest_info</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fencode_005fgost_005frs_005fvalue"><code>gnutls_encode_gost_rs_value</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fencode_005frs_005fvalue"><code>gnutls_encode_rs_value</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ferror_005fis_005ffatal"><code>gnutls_error_is_fatal</code></a></td><td class="printindex-index-section"><a href="#Data-transfer-and-termination">Data transfer and termination</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ferror_005fis_005ffatal-1"><code>gnutls_error_is_fatal</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ferror_005fto_005falert"><code>gnutls_error_to_alert</code></a></td><td class="printindex-index-section"><a href="#Handling-alerts">Handling alerts</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ferror_005fto_005falert-1"><code>gnutls_error_to_alert</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fest_005frecord_005foverhead_005fsize"><code>gnutls_est_record_overhead_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fext_005fget_005fcurrent_005fmsg"><code>gnutls_ext_get_current_msg</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fext_005fget_005fdata"><code>gnutls_ext_get_data</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fext_005fget_005fname"><code>gnutls_ext_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fext_005fget_005fname2"><code>gnutls_ext_get_name2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fext_005fraw_005fparse"><code>gnutls_ext_raw_parse</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fext_005fregister"><code>gnutls_ext_register</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fext_005fset_005fdata"><code>gnutls_ext_set_data</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffingerprint"><code>gnutls_fingerprint</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fcontext_005fdeinit"><code>gnutls_fips140_context_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fcontext_005finit"><code>gnutls_fips140_context_init</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fget_005foperation_005fstate"><code>gnutls_fips140_get_operation_state</code></a></td><td class="printindex-index-section"><a href="#FIPS140_002d2-mode">FIPS140-2 mode</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fget_005foperation_005fstate-1"><code>gnutls_fips140_get_operation_state</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fmode_005fenabled"><code>gnutls_fips140_mode_enabled</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fpop_005fcontext"><code>gnutls_fips140_pop_context</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fpush_005fcontext"><code>gnutls_fips140_push_context</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005frun_005fself_005ftests"><code>gnutls_fips140_run_self_tests</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ffips140_005fset_005fmode"><code>gnutls_fips140_set_mode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fget_005flibrary_005fconfig"><code>gnutls_get_library_config</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fget_005fsystem_005fconfig_005ffile"><code>gnutls_get_system_config_file</code></a></td><td class="printindex-index-section"><a href="#System_002dwide-configuration-of-the-library">System-wide configuration of the library</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fget_005fsystem_005fconfig_005ffile-1"><code>gnutls_get_system_config_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fdeinit"><code>gnutls_global_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005finit"><code>gnutls_global_init</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fset_005faudit_005flog_005ffunction"><code>gnutls_global_set_audit_log_function</code></a></td><td class="printindex-index-section"><a href="#Debugging-and-auditing">Debugging and auditing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fset_005faudit_005flog_005ffunction-1"><code>gnutls_global_set_audit_log_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fset_005flog_005ffunction"><code>gnutls_global_set_log_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fset_005flog_005flevel"><code>gnutls_global_set_log_level</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fset_005fmem_005ffunctions"><code>gnutls_global_set_mem_functions</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fset_005fmutex"><code>gnutls_global_set_mutex</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fglobal_005fset_005ftime_005ffunction"><code>gnutls_global_set_time_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fgost_005fparamset_005fget_005fname"><code>gnutls_gost_paramset_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fgost_005fparamset_005fget_005foid"><code>gnutls_gost_paramset_get_oid</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fgroup_005fget"><code>gnutls_group_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fgroup_005fget_005fid"><code>gnutls_group_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fgroup_005fget_005fname"><code>gnutls_group_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fgroup_005flist"><code>gnutls_group_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake"><code>gnutls_handshake</code></a></td><td class="printindex-index-section"><a href="#TLS-handshake">TLS handshake</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake-1"><code>gnutls_handshake</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fdescription_005fget_005fname"><code>gnutls_handshake_description_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fget_005flast_005fin"><code>gnutls_handshake_get_last_in</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fget_005flast_005fout"><code>gnutls_handshake_get_last_out</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005fhook_005ffunction"><code>gnutls_handshake_set_hook_function</code></a></td><td class="printindex-index-section"><a href="#Virtual-hosts-and-credentials">Virtual hosts and credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005fhook_005ffunction-1"><code>gnutls_handshake_set_hook_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005fmax_005fpacket_005flength"><code>gnutls_handshake_set_max_packet_length</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005fpost_005fclient_005fhello_005ffunction"><code>gnutls_handshake_set_post_client_hello_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005fprivate_005fextensions"><code>gnutls_handshake_set_private_extensions</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005frandom"><code>gnutls_handshake_set_random</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005fread_005ffunction"><code>gnutls_handshake_set_read_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005fsecret_005ffunction"><code>gnutls_handshake_set_secret_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005ftimeout"><code>gnutls_handshake_set_timeout</code></a></td><td class="printindex-index-section"><a href="#TLS-handshake">TLS handshake</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fset_005ftimeout-1"><code>gnutls_handshake_set_timeout</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fupdate_005freceiving_005fkey"><code>gnutls_handshake_update_receiving_key</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhandshake_005fwrite"><code>gnutls_handshake_write</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash"><code>gnutls_hash</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash_005fcopy"><code>gnutls_hash_copy</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash_005fdeinit"><code>gnutls_hash_deinit</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash_005ffast"><code>gnutls_hash_fast</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash_005fget_005flen"><code>gnutls_hash_get_len</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash_005finit"><code>gnutls_hash_init</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash_005foutput"><code>gnutls_hash_output</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhash_005fsqueeze"><code>gnutls_hash_squeeze</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fheartbeat_005fallowed"><code>gnutls_heartbeat_allowed</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fheartbeat_005fenable"><code>gnutls_heartbeat_enable</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fheartbeat_005fget_005ftimeout"><code>gnutls_heartbeat_get_timeout</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fheartbeat_005fping"><code>gnutls_heartbeat_ping</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fheartbeat_005fpong"><code>gnutls_heartbeat_pong</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fheartbeat_005fset_005ftimeouts"><code>gnutls_heartbeat_set_timeouts</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhex_005fdecode"><code>gnutls_hex_decode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhex_005fdecode2"><code>gnutls_hex_decode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhex_005fencode"><code>gnutls_hex_encode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhex_005fencode2"><code>gnutls_hex_encode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhex2bin"><code>gnutls_hex2bin</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhkdf_005fexpand"><code>gnutls_hkdf_expand</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhkdf_005fextract"><code>gnutls_hkdf_extract</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac"><code>gnutls_hmac</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005fcopy"><code>gnutls_hmac_copy</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005fdeinit"><code>gnutls_hmac_deinit</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005ffast"><code>gnutls_hmac_fast</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005fget_005fkey_005fsize"><code>gnutls_hmac_get_key_size</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005fget_005flen"><code>gnutls_hmac_get_len</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005finit"><code>gnutls_hmac_init</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005foutput"><code>gnutls_hmac_output</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fhmac_005fset_005fnonce"><code>gnutls_hmac_set_nonce</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fidna_005fmap"><code>gnutls_idna_map</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fidna_005freverse_005fmap"><code>gnutls_idna_reverse_map</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005finit"><code>gnutls_init</code></a></td><td class="printindex-index-section"><a href="#Session-initialization">Session initialization</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005finit-1"><code>gnutls_init</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fkey_005fgenerate"><code>gnutls_key_generate</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fkx_005fget"><code>gnutls_kx_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fkx_005fget_005fid"><code>gnutls_kx_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fkx_005fget_005fname"><code>gnutls_kx_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fkx_005flist"><code>gnutls_kx_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fload_005ffile"><code>gnutls_load_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmac_005fget"><code>gnutls_mac_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmac_005fget_005fid"><code>gnutls_mac_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmac_005fget_005fkey_005fsize"><code>gnutls_mac_get_key_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmac_005fget_005fname"><code>gnutls_mac_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmac_005fget_005fnonce_005fsize"><code>gnutls_mac_get_nonce_size</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmac_005flist"><code>gnutls_mac_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmemcmp"><code>gnutls_memcmp</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fmemset"><code>gnutls_memset</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fadd_005fcert"><code>gnutls_ocsp_req_add_cert</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fadd_005fcert_005fid"><code>gnutls_ocsp_req_add_cert_id</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fdeinit"><code>gnutls_ocsp_req_deinit</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fexport"><code>gnutls_ocsp_req_export</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fget_005fcert_005fid"><code>gnutls_ocsp_req_get_cert_id</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fget_005fextension"><code>gnutls_ocsp_req_get_extension</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fget_005fnonce"><code>gnutls_ocsp_req_get_nonce</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fget_005fversion"><code>gnutls_ocsp_req_get_version</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fimport"><code>gnutls_ocsp_req_import</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005finit"><code>gnutls_ocsp_req_init</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fprint"><code>gnutls_ocsp_req_print</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005frandomize_005fnonce"><code>gnutls_ocsp_req_randomize_nonce</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fset_005fextension"><code>gnutls_ocsp_req_set_extension</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005freq_005fset_005fnonce"><code>gnutls_ocsp_req_set_nonce</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fcheck_005fcrt"><code>gnutls_ocsp_resp_check_crt</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fdeinit"><code>gnutls_ocsp_resp_deinit</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fexport"><code>gnutls_ocsp_resp_export</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fexport2"><code>gnutls_ocsp_resp_export2</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fcerts"><code>gnutls_ocsp_resp_get_certs</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fextension"><code>gnutls_ocsp_resp_get_extension</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fnonce"><code>gnutls_ocsp_resp_get_nonce</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fproduced"><code>gnutls_ocsp_resp_get_produced</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fresponder"><code>gnutls_ocsp_resp_get_responder</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fresponder_005fraw_005fid"><code>gnutls_ocsp_resp_get_responder_raw_id</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fresponder2"><code>gnutls_ocsp_resp_get_responder2</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fresponse"><code>gnutls_ocsp_resp_get_response</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fsignature"><code>gnutls_ocsp_resp_get_signature</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fsignature_005falgorithm"><code>gnutls_ocsp_resp_get_signature_algorithm</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fsingle"><code>gnutls_ocsp_resp_get_single</code></a></td><td class="printindex-index-section"><a href="#OCSP-certificate-status-checking">OCSP certificate status checking</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fsingle-1"><code>gnutls_ocsp_resp_get_single</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fstatus"><code>gnutls_ocsp_resp_get_status</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fget_005fversion"><code>gnutls_ocsp_resp_get_version</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fimport"><code>gnutls_ocsp_resp_import</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fimport2"><code>gnutls_ocsp_resp_import2</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005finit"><code>gnutls_ocsp_resp_init</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005flist_005fimport2"><code>gnutls_ocsp_resp_list_import2</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fprint"><code>gnutls_ocsp_resp_print</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fverify"><code>gnutls_ocsp_resp_verify</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fresp_005fverify_005fdirect"><code>gnutls_ocsp_resp_verify_direct</code></a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fstatus_005frequest_005fenable_005fclient"><code>gnutls_ocsp_status_request_enable_client</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fstatus_005frequest_005fget"><code>gnutls_ocsp_status_request_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fstatus_005frequest_005fget2"><code>gnutls_ocsp_status_request_get2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005focsp_005fstatus_005frequest_005fis_005fchecked"><code>gnutls_ocsp_status_request_is_checked</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005foid_005fto_005fdigest"><code>gnutls_oid_to_digest</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005foid_005fto_005fecc_005fcurve"><code>gnutls_oid_to_ecc_curve</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005foid_005fto_005fgost_005fparamset"><code>gnutls_oid_to_gost_paramset</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005foid_005fto_005fmac"><code>gnutls_oid_to_mac</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005foid_005fto_005fpk"><code>gnutls_oid_to_pk</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005foid_005fto_005fsign"><code>gnutls_oid_to_sign</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fopenpgp_005fprivkey_005fsign_005fhash"><code>gnutls_openpgp_privkey_sign_hash</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fopenpgp_005fsend_005fcert"><code>gnutls_openpgp_send_cert</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpacket_005fdeinit"><code>gnutls_packet_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpacket_005fget"><code>gnutls_packet_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpbkdf2"><code>gnutls_pbkdf2</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fdeinit"><code>gnutls_pcert_deinit</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fexport_005fopenpgp"><code>gnutls_pcert_export_openpgp</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fexport_005fx509"><code>gnutls_pcert_export_x509</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fimport_005fopenpgp"><code>gnutls_pcert_import_openpgp</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fimport_005fopenpgp_005fraw"><code>gnutls_pcert_import_openpgp_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fimport_005frawpk"><code>gnutls_pcert_import_rawpk</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fimport_005frawpk_005fraw"><code>gnutls_pcert_import_rawpk_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fimport_005fx509"><code>gnutls_pcert_import_x509</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fimport_005fx509_005flist"><code>gnutls_pcert_import_x509_list</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005fimport_005fx509_005fraw"><code>gnutls_pcert_import_x509_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005flist_005fimport_005fx509_005ffile"><code>gnutls_pcert_list_import_x509_file</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpcert_005flist_005fimport_005fx509_005fraw"><code>gnutls_pcert_list_import_x509_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpem_005fbase64_005fdecode"><code>gnutls_pem_base64_decode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpem_005fbase64_005fdecode2"><code>gnutls_pem_base64_decode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpem_005fbase64_005fencode"><code>gnutls_pem_base64_encode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpem_005fbase64_005fencode2"><code>gnutls_pem_base64_encode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fperror"><code>gnutls_perror</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005falgorithm_005fget_005fname"><code>gnutls_pk_algorithm_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005fbits_005fto_005fsec_005fparam"><code>gnutls_pk_bits_to_sec_param</code></a></td><td class="printindex-index-section"><a href="#Selecting-cryptographic-key-sizes">Selecting cryptographic key sizes</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005fbits_005fto_005fsec_005fparam-1"><code>gnutls_pk_bits_to_sec_param</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005fget_005fid"><code>gnutls_pk_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005fget_005fname"><code>gnutls_pk_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005fget_005foid"><code>gnutls_pk_get_oid</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005flist"><code>gnutls_pk_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpk_005fto_005fsign"><code>gnutls_pk_to_sign</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs_005fschema_005fget_005fname"><code>gnutls_pkcs_schema_get_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs_005fschema_005fget_005foid"><code>gnutls_pkcs_schema_get_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fadd_005fprovider"><code>gnutls_pkcs11_add_provider</code></a></td><td class="printindex-index-section"><a href="#PKCS11-Manual-Initialization">PKCS11 Manual Initialization</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fadd_005fprovider-1"><code>gnutls_pkcs11_add_provider</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fattached_005fextension"><code>gnutls_pkcs11_copy_attached_extension</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fpubkey"><code>gnutls_pkcs11_copy_pubkey</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fsecret_005fkey"><code>gnutls_pkcs11_copy_secret_key</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt"><code>gnutls_pkcs11_copy_x509_crt</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2"><code>gnutls_pkcs11_copy_x509_crt2</code></a></td><td class="printindex-index-section"><a href="#Writing-objects">Writing objects</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fcrt2-1"><code>gnutls_pkcs11_copy_x509_crt2</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey"><code>gnutls_pkcs11_copy_x509_privkey</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2"><code>gnutls_pkcs11_copy_x509_privkey2</code></a></td><td class="printindex-index-section"><a href="#Writing-objects">Writing objects</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcopy_005fx509_005fprivkey2-1"><code>gnutls_pkcs11_copy_x509_privkey2</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fcrt_005fis_005fknown"><code>gnutls_pkcs11_crt_is_known</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fdeinit"><code>gnutls_pkcs11_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fdelete_005furl"><code>gnutls_pkcs11_delete_url</code></a></td><td class="printindex-index-section"><a href="#Writing-objects">Writing objects</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fdelete_005furl-1"><code>gnutls_pkcs11_delete_url</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fget_005fpin_005ffunction"><code>gnutls_pkcs11_get_pin_function</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fget_005fraw_005fissuer"><code>gnutls_pkcs11_get_raw_issuer</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fdn"><code>gnutls_pkcs11_get_raw_issuer_by_dn</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fget_005fraw_005fissuer_005fby_005fsubject_005fkey_005fid"><code>gnutls_pkcs11_get_raw_issuer_by_subject_key_id</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005finit"><code>gnutls_pkcs11_init</code></a></td><td class="printindex-index-section"><a href="#PKCS11-Manual-Initialization">PKCS11 Manual Initialization</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005finit-1"><code>gnutls_pkcs11_init</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fdeinit"><code>gnutls_pkcs11_obj_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fexport"><code>gnutls_pkcs11_obj_export</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fexport_005furl"><code>gnutls_pkcs11_obj_export_url</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fexport2"><code>gnutls_pkcs11_obj_export2</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fexport3"><code>gnutls_pkcs11_obj_export3</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fflags_005fget_005fstr"><code>gnutls_pkcs11_obj_flags_get_str</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fget_005fexts"><code>gnutls_pkcs11_obj_get_exts</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fget_005fflags"><code>gnutls_pkcs11_obj_get_flags</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fget_005finfo"><code>gnutls_pkcs11_obj_get_info</code></a></td><td class="printindex-index-section"><a href="#Reading-objects">Reading objects</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fget_005finfo-1"><code>gnutls_pkcs11_obj_get_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fget_005fptr"><code>gnutls_pkcs11_obj_get_ptr</code></a></td><td class="printindex-index-section"><a href="#PKCS11-Low-Level-Access">PKCS11 Low Level Access</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fget_005fptr-1"><code>gnutls_pkcs11_obj_get_ptr</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fget_005ftype"><code>gnutls_pkcs11_obj_get_type</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fimport_005furl"><code>gnutls_pkcs11_obj_import_url</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005finit"><code>gnutls_pkcs11_obj_init</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl3"><code>gnutls_pkcs11_obj_list_import_url3</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005flist_005fimport_005furl4"><code>gnutls_pkcs11_obj_list_import_url4</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fset_005finfo"><code>gnutls_pkcs11_obj_set_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fobj_005fset_005fpin_005ffunction"><code>gnutls_pkcs11_obj_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fcpy"><code>gnutls_pkcs11_privkey_cpy</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fdeinit"><code>gnutls_pkcs11_privkey_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fexport_005fpubkey"><code>gnutls_pkcs11_privkey_export_pubkey</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fexport_005furl"><code>gnutls_pkcs11_privkey_export_url</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fgenerate"><code>gnutls_pkcs11_privkey_generate</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fgenerate2"><code>gnutls_pkcs11_privkey_generate2</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fgenerate3"><code>gnutls_pkcs11_privkey_generate3</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fget_005finfo"><code>gnutls_pkcs11_privkey_get_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fget_005fpk_005falgorithm"><code>gnutls_pkcs11_privkey_get_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fimport_005furl"><code>gnutls_pkcs11_privkey_import_url</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005finit"><code>gnutls_pkcs11_privkey_init</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fset_005fpin_005ffunction"><code>gnutls_pkcs11_privkey_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fprivkey_005fstatus"><code>gnutls_pkcs11_privkey_status</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005freinit"><code>gnutls_pkcs11_reinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fset_005fpin_005ffunction"><code>gnutls_pkcs11_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005fset_005ftoken_005ffunction"><code>gnutls_pkcs11_set_token_function</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fcheck_005fmechanism"><code>gnutls_pkcs11_token_check_mechanism</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fflags"><code>gnutls_pkcs11_token_get_flags</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fget_005finfo"><code>gnutls_pkcs11_token_get_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fmechanism"><code>gnutls_pkcs11_token_get_mechanism</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fptr"><code>gnutls_pkcs11_token_get_ptr</code></a></td><td class="printindex-index-section"><a href="#PKCS11-Low-Level-Access">PKCS11 Low Level Access</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fget_005fptr-1"><code>gnutls_pkcs11_token_get_ptr</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fget_005frandom"><code>gnutls_pkcs11_token_get_random</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fget_005furl"><code>gnutls_pkcs11_token_get_url</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005finit"><code>gnutls_pkcs11_token_init</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftoken_005fset_005fpin"><code>gnutls_pkcs11_token_set_pin</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs11_005ftype_005fget_005fname"><code>gnutls_pkcs11_type_get_name</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fdecrypt"><code>gnutls_pkcs12_bag_decrypt</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fdeinit"><code>gnutls_pkcs12_bag_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fenc_005finfo"><code>gnutls_pkcs12_bag_enc_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fencrypt"><code>gnutls_pkcs12_bag_encrypt</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fget_005fcount"><code>gnutls_pkcs12_bag_get_count</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fget_005fdata"><code>gnutls_pkcs12_bag_get_data</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fget_005ffriendly_005fname"><code>gnutls_pkcs12_bag_get_friendly_name</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fget_005fkey_005fid"><code>gnutls_pkcs12_bag_get_key_id</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fget_005ftype"><code>gnutls_pkcs12_bag_get_type</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005finit"><code>gnutls_pkcs12_bag_init</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fset_005fcrl"><code>gnutls_pkcs12_bag_set_crl</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fset_005fcrt"><code>gnutls_pkcs12_bag_set_crt</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fset_005fdata"><code>gnutls_pkcs12_bag_set_data</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fset_005ffriendly_005fname"><code>gnutls_pkcs12_bag_set_friendly_name</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fset_005fkey_005fid"><code>gnutls_pkcs12_bag_set_key_id</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fbag_005fset_005fprivkey"><code>gnutls_pkcs12_bag_set_privkey</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fdeinit"><code>gnutls_pkcs12_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fexport"><code>gnutls_pkcs12_export</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fexport2"><code>gnutls_pkcs12_export2</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fgenerate_005fmac"><code>gnutls_pkcs12_generate_mac</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fgenerate_005fmac2"><code>gnutls_pkcs12_generate_mac2</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fgenerate_005fmac3"><code>gnutls_pkcs12_generate_mac3</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fget_005fbag"><code>gnutls_pkcs12_get_bag</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fimport"><code>gnutls_pkcs12_import</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005finit"><code>gnutls_pkcs12_init</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fmac_005finfo"><code>gnutls_pkcs12_mac_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fset_005fbag"><code>gnutls_pkcs12_set_bag</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fsimple_005fparse"><code>gnutls_pkcs12_simple_parse</code></a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fsimple_005fparse-1"><code>gnutls_pkcs12_simple_parse</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs12_005fverify_005fmac"><code>gnutls_pkcs12_verify_mac</code></a></td><td class="printindex-index-section"><a href="#PKCS-12-API">PKCS 12 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fadd_005fattr"><code>gnutls_pkcs7_add_attr</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fattrs_005fdeinit"><code>gnutls_pkcs7_attrs_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fdeinit"><code>gnutls_pkcs7_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fdelete_005fcrl"><code>gnutls_pkcs7_delete_crl</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fdelete_005fcrt"><code>gnutls_pkcs7_delete_crt</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fexport"><code>gnutls_pkcs7_export</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fexport2"><code>gnutls_pkcs7_export2</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fattr"><code>gnutls_pkcs7_get_attr</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fcrl_005fcount"><code>gnutls_pkcs7_get_crl_count</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fcrl_005fraw"><code>gnutls_pkcs7_get_crl_raw</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fcrl_005fraw2"><code>gnutls_pkcs7_get_crl_raw2</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fcrt_005fcount"><code>gnutls_pkcs7_get_crt_count</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fcrt_005fraw"><code>gnutls_pkcs7_get_crt_raw</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fcrt_005fraw2"><code>gnutls_pkcs7_get_crt_raw2</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fembedded_005fdata"><code>gnutls_pkcs7_get_embedded_data</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fembedded_005fdata_005foid"><code>gnutls_pkcs7_get_embedded_data_oid</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fsignature_005fcount"><code>gnutls_pkcs7_get_signature_count</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fget_005fsignature_005finfo"><code>gnutls_pkcs7_get_signature_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fimport"><code>gnutls_pkcs7_import</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005finit"><code>gnutls_pkcs7_init</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fprint"><code>gnutls_pkcs7_print</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fprint_005fsignature_005finfo"><code>gnutls_pkcs7_print_signature_info</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fset_005fcrl"><code>gnutls_pkcs7_set_crl</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fset_005fcrl_005fraw"><code>gnutls_pkcs7_set_crl_raw</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fset_005fcrt"><code>gnutls_pkcs7_set_crt</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fset_005fcrt_005fraw"><code>gnutls_pkcs7_set_crt_raw</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fsign"><code>gnutls_pkcs7_sign</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-Message-Syntax-_002f-PKCS7">Cryptographic Message Syntax / PKCS7</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fsign-1"><code>gnutls_pkcs7_sign</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fsignature_005finfo_005fdeinit"><code>gnutls_pkcs7_signature_info_deinit</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fverify"><code>gnutls_pkcs7_verify</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs7_005fverify_005fdirect"><code>gnutls_pkcs7_verify_direct</code></a></td><td class="printindex-index-section"><a href="#PKCS-7-API">PKCS 7 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpkcs8_005finfo"><code>gnutls_pkcs8_info</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprf"><code>gnutls_prf</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprf_005fearly"><code>gnutls_prf_early</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprf_005fhash_005fget"><code>gnutls_prf_hash_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprf_005fraw"><code>gnutls_prf_raw</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprf_005frfc5705"><code>gnutls_prf_rfc5705</code></a></td><td class="printindex-index-section"><a href="#Deriving-keys-for-other-applications_002fprotocols">Deriving keys for other applications/protocols</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprf_005frfc5705-1"><code>gnutls_prf_rfc5705</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fcertificate_005ftype_005flist"><code>gnutls_priority_certificate_type_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fcertificate_005ftype_005flist2"><code>gnutls_priority_certificate_type_list2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fcipher_005flist"><code>gnutls_priority_cipher_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fcompression_005flist"><code>gnutls_priority_compression_list</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fdeinit"><code>gnutls_priority_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fecc_005fcurve_005flist"><code>gnutls_priority_ecc_curve_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fget_005fcipher_005fsuite_005findex"><code>gnutls_priority_get_cipher_suite_index</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fgroup_005flist"><code>gnutls_priority_group_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005finit"><code>gnutls_priority_init</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005finit2"><code>gnutls_priority_init2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fkx_005flist"><code>gnutls_priority_kx_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fmac_005flist"><code>gnutls_priority_mac_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fprotocol_005flist"><code>gnutls_priority_protocol_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fset"><code>gnutls_priority_set</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fset_005fdirect"><code>gnutls_priority_set_direct</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fsign_005flist"><code>gnutls_priority_sign_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpriority_005fstring_005flist"><code>gnutls_priority_string_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fdecrypt_005fdata"><code>gnutls_privkey_decrypt_data</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fdecrypt_005fdata-1"><code>gnutls_privkey_decrypt_data</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fdecrypt_005fdata2"><code>gnutls_privkey_decrypt_data2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fdeinit"><code>gnutls_privkey_deinit</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fderive_005fsecret"><code>gnutls_privkey_derive_secret</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fdh_005fraw"><code>gnutls_privkey_export_dh_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fdsa_005fraw"><code>gnutls_privkey_export_dsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fdsa_005fraw2"><code>gnutls_privkey_export_dsa_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fecc_005fraw"><code>gnutls_privkey_export_ecc_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fecc_005fraw2"><code>gnutls_privkey_export_ecc_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fgost_005fraw2"><code>gnutls_privkey_export_gost_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fopenpgp"><code>gnutls_privkey_export_openpgp</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fpkcs11"><code>gnutls_privkey_export_pkcs11</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005frsa_005fraw"><code>gnutls_privkey_export_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005frsa_005fraw2"><code>gnutls_privkey_export_rsa_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fexport_005fx509"><code>gnutls_privkey_export_x509</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fgenerate"><code>gnutls_privkey_generate</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fgenerate2"><code>gnutls_privkey_generate2</code></a></td><td class="printindex-index-section"><a href="#Public-key-algorithms">Public key algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fgenerate2-1"><code>gnutls_privkey_generate2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fget_005fpk_005falgorithm"><code>gnutls_privkey_get_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fget_005fseed"><code>gnutls_privkey_get_seed</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fget_005fspki"><code>gnutls_privkey_get_spki</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fget_005ftype"><code>gnutls_privkey_get_type</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fdh_005fraw"><code>gnutls_privkey_import_dh_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fdsa_005fraw"><code>gnutls_privkey_import_dsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fecc_005fraw"><code>gnutls_privkey_import_ecc_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fext"><code>gnutls_privkey_import_ext</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fext2"><code>gnutls_privkey_import_ext2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fext3"><code>gnutls_privkey_import_ext3</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fext4"><code>gnutls_privkey_import_ext4</code></a></td><td class="printindex-index-section"><a href="#Abstract-private-keys">Abstract private keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fext4-1"><code>gnutls_privkey_import_ext4</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fgost_005fraw"><code>gnutls_privkey_import_gost_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fopenpgp"><code>gnutls_privkey_import_openpgp</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fopenpgp_005fraw"><code>gnutls_privkey_import_openpgp_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fpkcs11"><code>gnutls_privkey_import_pkcs11</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fpkcs11_005furl"><code>gnutls_privkey_import_pkcs11_url</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005frsa_005fraw"><code>gnutls_privkey_import_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005ftpm_005fraw"><code>gnutls_privkey_import_tpm_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005ftpm_005furl"><code>gnutls_privkey_import_tpm_url</code></a></td><td class="printindex-index-section"><a href="#Using-keys">Using keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005ftpm_005furl-1"><code>gnutls_privkey_import_tpm_url</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005furl"><code>gnutls_privkey_import_url</code></a></td><td class="printindex-index-section"><a href="#Abstract-private-keys">Abstract private keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005furl-1"><code>gnutls_privkey_import_url</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fx509"><code>gnutls_privkey_import_x509</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fx509_005fraw"><code>gnutls_privkey_import_x509_raw</code></a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fimport_005fx509_005fraw-1"><code>gnutls_privkey_import_x509_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005finit"><code>gnutls_privkey_init</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fset_005fflags"><code>gnutls_privkey_set_flags</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fset_005fpin_005ffunction"><code>gnutls_privkey_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fset_005fspki"><code>gnutls_privkey_set_spki</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fsign_005fdata"><code>gnutls_privkey_sign_data</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fsign_005fdata-1"><code>gnutls_privkey_sign_data</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fsign_005fdata2"><code>gnutls_privkey_sign_data2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fsign_005fhash"><code>gnutls_privkey_sign_hash</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fsign_005fhash-1"><code>gnutls_privkey_sign_hash</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fsign_005fhash2"><code>gnutls_privkey_sign_hash2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fstatus"><code>gnutls_privkey_status</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fverify_005fparams"><code>gnutls_privkey_verify_params</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprivkey_005fverify_005fseed"><code>gnutls_privkey_verify_seed</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprotocol_005fget_005fid"><code>gnutls_protocol_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprotocol_005fget_005fname"><code>gnutls_protocol_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprotocol_005fget_005fversion"><code>gnutls_protocol_get_version</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprotocol_005flist"><code>gnutls_protocol_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fprotocol_005fset_005fenabled"><code>gnutls_protocol_set_enabled</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fallocate_005fclient_005fcredentials"><code>gnutls_psk_allocate_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fallocate_005fclient_005fcredentials2"><code>gnutls_psk_allocate_client_credentials2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fallocate_005fserver_005fcredentials"><code>gnutls_psk_allocate_server_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fallocate_005fserver_005fcredentials2"><code>gnutls_psk_allocate_server_credentials2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fclient_005fget_005fhint"><code>gnutls_psk_client_get_hint</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fformat_005fimported_005fidentity"><code>gnutls_psk_format_imported_identity</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005ffree_005fclient_005fcredentials"><code>gnutls_psk_free_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005ffree_005fserver_005fcredentials"><code>gnutls_psk_free_server_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fserver_005fget_005fusername"><code>gnutls_psk_server_get_username</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fserver_005fget_005fusername2"><code>gnutls_psk_server_get_username2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials"><code>gnutls_psk_set_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction"><code>gnutls_psk_set_client_credentials_function</code></a></td><td class="printindex-index-section"><a href="#PSK-credentials">PSK credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction-1"><code>gnutls_psk_set_client_credentials_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction2"><code>gnutls_psk_set_client_credentials_function2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials_005ffunction3"><code>gnutls_psk_set_client_credentials_function3</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fclient_005fcredentials2"><code>gnutls_psk_set_client_credentials2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fparams_005ffunction"><code>gnutls_psk_set_params_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile"><code>gnutls_psk_set_server_credentials_file</code></a></td><td class="printindex-index-section"><a href="#PSK-credentials">PSK credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffile-1"><code>gnutls_psk_set_server_credentials_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction"><code>gnutls_psk_set_server_credentials_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction2"><code>gnutls_psk_set_server_credentials_function2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005ffunction3"><code>gnutls_psk_set_server_credentials_function3</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fcredentials_005fhint"><code>gnutls_psk_set_server_credentials_hint</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fdh_005fparams"><code>gnutls_psk_set_server_dh_params</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fknown_005fdh_005fparams"><code>gnutls_psk_set_server_known_dh_params</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpsk_005fset_005fserver_005fparams_005ffunction"><code>gnutls_psk_set_server_params_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fdeinit"><code>gnutls_pubkey_deinit</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fencrypt_005fdata"><code>gnutls_pubkey_encrypt_data</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fencrypt_005fdata-1"><code>gnutls_pubkey_encrypt_data</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport"><code>gnutls_pubkey_export</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005fdh_005fraw"><code>gnutls_pubkey_export_dh_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005fdsa_005fraw"><code>gnutls_pubkey_export_dsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005fdsa_005fraw2"><code>gnutls_pubkey_export_dsa_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005fecc_005fraw"><code>gnutls_pubkey_export_ecc_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005fecc_005fraw2"><code>gnutls_pubkey_export_ecc_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005fecc_005fx962"><code>gnutls_pubkey_export_ecc_x962</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005fgost_005fraw2"><code>gnutls_pubkey_export_gost_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005frsa_005fraw"><code>gnutls_pubkey_export_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport_005frsa_005fraw2"><code>gnutls_pubkey_export_rsa_raw2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport2"><code>gnutls_pubkey_export2</code></a></td><td class="printindex-index-section"><a href="#Abstract-public-keys">Abstract public keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fexport2-1"><code>gnutls_pubkey_export2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fget_005fkey_005fid"><code>gnutls_pubkey_get_key_id</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fget_005fkey_005fusage"><code>gnutls_pubkey_get_key_usage</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fget_005fopenpgp_005fkey_005fid"><code>gnutls_pubkey_get_openpgp_key_id</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fget_005fpk_005falgorithm"><code>gnutls_pubkey_get_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fget_005fpreferred_005fhash_005falgorithm"><code>gnutls_pubkey_get_preferred_hash_algorithm</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fget_005fspki"><code>gnutls_pubkey_get_spki</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport"><code>gnutls_pubkey_import</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fdh_005fraw"><code>gnutls_pubkey_import_dh_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fdsa_005fraw"><code>gnutls_pubkey_import_dsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fecc_005fraw"><code>gnutls_pubkey_import_ecc_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fecc_005fx962"><code>gnutls_pubkey_import_ecc_x962</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fgost_005fraw"><code>gnutls_pubkey_import_gost_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fopenpgp"><code>gnutls_pubkey_import_openpgp</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fopenpgp_005fraw"><code>gnutls_pubkey_import_openpgp_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fpkcs11"><code>gnutls_pubkey_import_pkcs11</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fprivkey"><code>gnutls_pubkey_import_privkey</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005frsa_005fraw"><code>gnutls_pubkey_import_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005ftpm_005fraw"><code>gnutls_pubkey_import_tpm_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005ftpm_005furl"><code>gnutls_pubkey_import_tpm_url</code></a></td><td class="printindex-index-section"><a href="#Using-keys">Using keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005ftpm_005furl-1"><code>gnutls_pubkey_import_tpm_url</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005furl"><code>gnutls_pubkey_import_url</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fx509"><code>gnutls_pubkey_import_x509</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fx509_005fcrq"><code>gnutls_pubkey_import_x509_crq</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fimport_005fx509_005fraw"><code>gnutls_pubkey_import_x509_raw</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005finit"><code>gnutls_pubkey_init</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fprint"><code>gnutls_pubkey_print</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fset_005fkey_005fusage"><code>gnutls_pubkey_set_key_usage</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fset_005fpin_005ffunction"><code>gnutls_pubkey_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fset_005fspki"><code>gnutls_pubkey_set_spki</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fverify_005fdata2"><code>gnutls_pubkey_verify_data2</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fverify_005fdata2-1"><code>gnutls_pubkey_verify_data2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fverify_005fhash2"><code>gnutls_pubkey_verify_hash2</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fverify_005fhash2-1"><code>gnutls_pubkey_verify_hash2</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fpubkey_005fverify_005fparams"><code>gnutls_pubkey_verify_params</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frandom_005fart"><code>gnutls_random_art</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frange_005fsplit"><code>gnutls_range_split</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005freauth"><code>gnutls_reauth</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fcan_005fuse_005flength_005fhiding"><code>gnutls_record_can_use_length_hiding</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fcheck_005fcorked"><code>gnutls_record_check_corked</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fcheck_005fpending"><code>gnutls_record_check_pending</code></a></td><td class="printindex-index-section"><a href="#Data-transfer-and-termination">Data transfer and termination</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fcheck_005fpending-1"><code>gnutls_record_check_pending</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fcork"><code>gnutls_record_cork</code></a></td><td class="printindex-index-section"><a href="#Buffered-data-transfer">Buffered data transfer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fcork-1"><code>gnutls_record_cork</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fdisable_005fpadding"><code>gnutls_record_disable_padding</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fdiscard_005fqueued"><code>gnutls_record_discard_queued</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fget_005fdirection"><code>gnutls_record_get_direction</code></a></td><td class="printindex-index-section"><a href="#Asynchronous-operation">Asynchronous operation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fget_005fdirection-1"><code>gnutls_record_get_direction</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fget_005fdiscarded"><code>gnutls_record_get_discarded</code></a></td><td class="printindex-index-section"><a href="#Datagram-TLS-API">Datagram TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fget_005fmax_005fearly_005fdata_005fsize"><code>gnutls_record_get_max_early_data_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fget_005fmax_005fsend_005fsize"><code>gnutls_record_get_max_send_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fget_005fmax_005fsize"><code>gnutls_record_get_max_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fget_005fstate"><code>gnutls_record_get_state</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005foverhead_005fsize"><code>gnutls_record_overhead_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005frecv"><code>gnutls_record_recv</code></a></td><td class="printindex-index-section"><a href="#Data-transfer-and-termination">Data transfer and termination</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005frecv-1"><code>gnutls_record_recv</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005frecv_005fearly_005fdata"><code>gnutls_record_recv_early_data</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005frecv_005fpacket"><code>gnutls_record_recv_packet</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005frecv_005fseq"><code>gnutls_record_recv_seq</code></a></td><td class="printindex-index-section"><a href="#Data-transfer-and-termination">Data transfer and termination</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005frecv_005fseq-1"><code>gnutls_record_recv_seq</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fsend"><code>gnutls_record_send</code></a></td><td class="printindex-index-section"><a href="#Data-transfer-and-termination">Data transfer and termination</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fsend-1"><code>gnutls_record_send</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fsend_005fearly_005fdata"><code>gnutls_record_send_early_data</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fsend_005ffile"><code>gnutls_record_send_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fsend_005frange"><code>gnutls_record_send_range</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fsend2"><code>gnutls_record_send2</code></a></td><td class="printindex-index-section"><a href="#On-Record-Padding">On Record Padding</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fsend2-1"><code>gnutls_record_send2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fset_005fmax_005fearly_005fdata_005fsize"><code>gnutls_record_set_max_early_data_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fset_005fmax_005frecv_005fsize"><code>gnutls_record_set_max_recv_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fset_005fmax_005fsize"><code>gnutls_record_set_max_size</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fset_005fstate"><code>gnutls_record_set_state</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005fset_005ftimeout"><code>gnutls_record_set_timeout</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005funcork"><code>gnutls_record_uncork</code></a></td><td class="printindex-index-section"><a href="#Buffered-data-transfer">Buffered data transfer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frecord_005funcork-1"><code>gnutls_record_uncork</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fregister_005fcustom_005furl"><code>gnutls_register_custom_url</code></a></td><td class="printindex-index-section"><a href="#Application_002dspecific-keys">Application-specific keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fregister_005fcustom_005furl-1"><code>gnutls_register_custom_url</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frehandshake"><code>gnutls_rehandshake</code></a></td><td class="printindex-index-section"><a href="#TLS-1_002e2-re_002dauthentication">TLS 1.2 re-authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frehandshake-1"><code>gnutls_rehandshake</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frnd"><code>gnutls_rnd</code></a></td><td class="printindex-index-section"><a href="#Random-number-generation">Random number generation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frnd-1"><code>gnutls_rnd</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005frnd_005frefresh"><code>gnutls_rnd_refresh</code></a></td><td class="printindex-index-section"><a href="#Cryptographic-API">Cryptographic API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsafe_005frenegotiation_005fstatus"><code>gnutls_safe_renegotiation_status</code></a></td><td class="printindex-index-section"><a href="#TLS-1_002e2-re_002dauthentication">TLS 1.2 re-authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsafe_005frenegotiation_005fstatus-1"><code>gnutls_safe_renegotiation_status</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsec_005fparam_005fget_005fname"><code>gnutls_sec_param_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsec_005fparam_005fto_005fpk_005fbits"><code>gnutls_sec_param_to_pk_bits</code></a></td><td class="printindex-index-section"><a href="#Selecting-cryptographic-key-sizes">Selecting cryptographic key sizes</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsec_005fparam_005fto_005fpk_005fbits-1"><code>gnutls_sec_param_to_pk_bits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsec_005fparam_005fto_005fsymmetric_005fbits"><code>gnutls_sec_param_to_symmetric_bits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fserver_005fname_005fget"><code>gnutls_server_name_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fserver_005fname_005fset"><code>gnutls_server_name_set</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fchannel_005fbinding"><code>gnutls_session_channel_binding</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fenable_005fcompatibility_005fmode"><code>gnutls_session_enable_compatibility_mode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fetm_005fstatus"><code>gnutls_session_etm_status</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fext_005fmaster_005fsecret_005fstatus"><code>gnutls_session_ext_master_secret_status</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fext_005fregister"><code>gnutls_session_ext_register</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fforce_005fvalid"><code>gnutls_session_force_valid</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fdata"><code>gnutls_session_get_data</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fdata2"><code>gnutls_session_get_data2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fdesc"><code>gnutls_session_get_desc</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fflags"><code>gnutls_session_get_flags</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fid"><code>gnutls_session_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fid2"><code>gnutls_session_get_id2</code></a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fid2-1"><code>gnutls_session_get_id2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fkeylog_005ffunction"><code>gnutls_session_get_keylog_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fmaster_005fsecret"><code>gnutls_session_get_master_secret</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fptr"><code>gnutls_session_get_ptr</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005frandom"><code>gnutls_session_get_random</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fget_005fverify_005fcert_005fstatus"><code>gnutls_session_get_verify_cert_status</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fis_005fresumed"><code>gnutls_session_is_resumed</code></a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fis_005fresumed-1"><code>gnutls_session_is_resumed</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fkey_005fupdate"><code>gnutls_session_key_update</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fresumption_005frequested"><code>gnutls_session_resumption_requested</code></a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fresumption_005frequested-1"><code>gnutls_session_resumption_requested</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fdata"><code>gnutls_session_set_data</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fid"><code>gnutls_session_set_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fkeylog_005ffunction"><code>gnutls_session_set_keylog_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fpremaster"><code>gnutls_session_set_premaster</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fptr"><code>gnutls_session_set_ptr</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fverify_005fcert"><code>gnutls_session_set_verify_cert</code></a></td><td class="printindex-index-section"><a href="#Certificate-credentials">Certificate credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fverify_005fcert-1"><code>gnutls_session_set_verify_cert</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fverify_005fcert2"><code>gnutls_session_set_verify_cert2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fverify_005ffunction"><code>gnutls_session_set_verify_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fset_005fverify_005foutput_005ffunction"><code>gnutls_session_set_verify_output_function</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fsupplemental_005fregister"><code>gnutls_session_supplemental_register</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fticket_005fenable_005fclient"><code>gnutls_session_ticket_enable_client</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fticket_005fenable_005fserver"><code>gnutls_session_ticket_enable_server</code></a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fticket_005fenable_005fserver-1"><code>gnutls_session_ticket_enable_server</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fticket_005fkey_005fgenerate"><code>gnutls_session_ticket_key_generate</code></a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fticket_005fkey_005fgenerate-1"><code>gnutls_session_ticket_key_generate</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fticket_005fsend"><code>gnutls_session_ticket_send</code></a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsession_005fticket_005fsend-1"><code>gnutls_session_ticket_send</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fset_005fdefault_005fpriority"><code>gnutls_set_default_priority</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fset_005fdefault_005fpriority_005fappend"><code>gnutls_set_default_priority_append</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005falgorithm_005fget"><code>gnutls_sign_algorithm_get</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005falgorithm_005fget_005fclient"><code>gnutls_sign_algorithm_get_client</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005falgorithm_005fget_005frequested"><code>gnutls_sign_algorithm_get_requested</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fget_005fhash_005falgorithm"><code>gnutls_sign_get_hash_algorithm</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fget_005fid"><code>gnutls_sign_get_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fget_005fname"><code>gnutls_sign_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fget_005foid"><code>gnutls_sign_get_oid</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fget_005fpk_005falgorithm"><code>gnutls_sign_get_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fis_005fsecure"><code>gnutls_sign_is_secure</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fis_005fsecure2"><code>gnutls_sign_is_secure2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005flist"><code>gnutls_sign_list</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fset_005fsecure"><code>gnutls_sign_set_secure</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fset_005fsecure_005ffor_005fcerts"><code>gnutls_sign_set_secure_for_certs</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsign_005fsupports_005fpk_005falgorithm"><code>gnutls_sign_supports_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fallocate_005fclient_005fcredentials"><code>gnutls_srp_allocate_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fallocate_005fserver_005fcredentials"><code>gnutls_srp_allocate_server_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fbase64_005fdecode"><code>gnutls_srp_base64_decode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fbase64_005fdecode2"><code>gnutls_srp_base64_decode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fbase64_005fencode"><code>gnutls_srp_base64_encode</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fbase64_005fencode2"><code>gnutls_srp_base64_encode2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005ffree_005fclient_005fcredentials"><code>gnutls_srp_free_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005ffree_005fserver_005fcredentials"><code>gnutls_srp_free_server_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fserver_005fget_005fusername"><code>gnutls_srp_server_get_username</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fclient_005fcredentials"><code>gnutls_srp_set_client_credentials</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction"><code>gnutls_srp_set_client_credentials_function</code></a></td><td class="printindex-index-section"><a href="#SRP-credentials">SRP credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fclient_005fcredentials_005ffunction-1"><code>gnutls_srp_set_client_credentials_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fprime_005fbits"><code>gnutls_srp_set_prime_bits</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile"><code>gnutls_srp_set_server_credentials_file</code></a></td><td class="printindex-index-section"><a href="#SRP-credentials">SRP credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffile-1"><code>gnutls_srp_set_server_credentials_file</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction"><code>gnutls_srp_set_server_credentials_function</code></a></td><td class="printindex-index-section"><a href="#SRP-credentials">SRP credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fserver_005fcredentials_005ffunction-1"><code>gnutls_srp_set_server_credentials_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fset_005fserver_005ffake_005fsalt_005fseed"><code>gnutls_srp_set_server_fake_salt_seed</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fverifier"><code>gnutls_srp_verifier</code></a></td><td class="printindex-index-section"><a href="#Authentication-using-SRP">Authentication using SRP</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrp_005fverifier-1"><code>gnutls_srp_verifier</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fget_005fkeys"><code>gnutls_srtp_get_keys</code></a></td><td class="printindex-index-section"><a href="#SRTP">SRTP</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fget_005fkeys-1"><code>gnutls_srtp_get_keys</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fget_005fmki"><code>gnutls_srtp_get_mki</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fget_005fprofile_005fid"><code>gnutls_srtp_get_profile_id</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fget_005fprofile_005fname"><code>gnutls_srtp_get_profile_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fget_005fselected_005fprofile"><code>gnutls_srtp_get_selected_profile</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fset_005fmki"><code>gnutls_srtp_set_mki</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fset_005fprofile"><code>gnutls_srtp_set_profile</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsrtp_005fset_005fprofile_005fdirect"><code>gnutls_srtp_set_profile_direct</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fstore_005fcommitment"><code>gnutls_store_commitment</code></a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fstore_005fcommitment-1"><code>gnutls_store_commitment</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fstore_005fpubkey"><code>gnutls_store_pubkey</code></a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fstore_005fpubkey-1"><code>gnutls_store_pubkey</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fstrerror"><code>gnutls_strerror</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fstrerror_005fname"><code>gnutls_strerror_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsubject_005falt_005fnames_005fdeinit"><code>gnutls_subject_alt_names_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsubject_005falt_005fnames_005fget"><code>gnutls_subject_alt_names_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsubject_005falt_005fnames_005finit"><code>gnutls_subject_alt_names_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsubject_005falt_005fnames_005fset"><code>gnutls_subject_alt_names_set</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsupplemental_005fget_005fname"><code>gnutls_supplemental_get_name</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsupplemental_005frecv"><code>gnutls_supplemental_recv</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsupplemental_005fregister"><code>gnutls_supplemental_register</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsupplemental_005fsend"><code>gnutls_supplemental_send</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsystem_005fkey_005fadd_005fx509"><code>gnutls_system_key_add_x509</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsystem_005fkey_005fdelete"><code>gnutls_system_key_delete</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsystem_005fkey_005fiter_005fdeinit"><code>gnutls_system_key_iter_deinit</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsystem_005fkey_005fiter_005fget_005finfo"><code>gnutls_system_key_iter_get_info</code></a></td><td class="printindex-index-section"><a href="#Application_002dspecific-keys">Application-specific keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsystem_005fkey_005fiter_005fget_005finfo-1"><code>gnutls_system_key_iter_get_info</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fsystem_005frecv_005ftimeout"><code>gnutls_system_recv_timeout</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftdb_005fdeinit"><code>gnutls_tdb_deinit</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftdb_005finit"><code>gnutls_tdb_init</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftdb_005fset_005fstore_005fcommitment_005ffunc"><code>gnutls_tdb_set_store_commitment_func</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftdb_005fset_005fstore_005ffunc"><code>gnutls_tdb_set_store_func</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftdb_005fset_005fverify_005ffunc"><code>gnutls_tdb_set_verify_func</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fget_005fregistered"><code>gnutls_tpm_get_registered</code></a></td><td class="printindex-index-section"><a href="#TPM-API">TPM API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fkey_005flist_005fdeinit"><code>gnutls_tpm_key_list_deinit</code></a></td><td class="printindex-index-section"><a href="#TPM-API">TPM API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fkey_005flist_005fget_005furl"><code>gnutls_tpm_key_list_get_url</code></a></td><td class="printindex-index-section"><a href="#TPM-API">TPM API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fprivkey_005fdelete"><code>gnutls_tpm_privkey_delete</code></a></td><td class="printindex-index-section"><a href="#Key-generation">Key generation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fprivkey_005fdelete-1"><code>gnutls_tpm_privkey_delete</code></a></td><td class="printindex-index-section"><a href="#Using-keys">Using keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fprivkey_005fdelete-2"><code>gnutls_tpm_privkey_delete</code></a></td><td class="printindex-index-section"><a href="#TPM-API">TPM API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fprivkey_005fgenerate"><code>gnutls_tpm_privkey_generate</code></a></td><td class="printindex-index-section"><a href="#Key-generation">Key generation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftpm_005fprivkey_005fgenerate-1"><code>gnutls_tpm_privkey_generate</code></a></td><td class="printindex-index-section"><a href="#TPM-API">TPM API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fget_005fint"><code>gnutls_transport_get_int</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fget_005fint2"><code>gnutls_transport_get_int2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fget_005fptr"><code>gnutls_transport_get_ptr</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fget_005fptr2"><code>gnutls_transport_get_ptr2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fis_005fktls_005fenabled"><code>gnutls_transport_is_ktls_enabled</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005ferrno"><code>gnutls_transport_set_errno</code></a></td><td class="printindex-index-section"><a href="#Setting-up-the-transport-layer">Setting up the transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005ferrno-1"><code>gnutls_transport_set_errno</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005ferrno_005ffunction"><code>gnutls_transport_set_errno_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005ffastopen"><code>gnutls_transport_set_fastopen</code></a></td><td class="printindex-index-section"><a href="#Reducing-round_002dtrips">Reducing round-trips</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005ffastopen-1"><code>gnutls_transport_set_fastopen</code></a></td><td class="printindex-index-section"><a href="#Socket-specific-API">Socket specific API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fint"><code>gnutls_transport_set_int</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fint2"><code>gnutls_transport_set_int2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fptr"><code>gnutls_transport_set_ptr</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fptr2"><code>gnutls_transport_set_ptr2</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fpull_005ffunction"><code>gnutls_transport_set_pull_function</code></a></td><td class="printindex-index-section"><a href="#Setting-up-the-transport-layer">Setting up the transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fpull_005ffunction-1"><code>gnutls_transport_set_pull_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction"><code>gnutls_transport_set_pull_timeout_function</code></a></td><td class="printindex-index-section"><a href="#Setting-up-the-transport-layer">Setting up the transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-1"><code>gnutls_transport_set_pull_timeout_function</code></a></td><td class="printindex-index-section"><a href="#Setting-up-the-transport-layer">Setting up the transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fpull_005ftimeout_005ffunction-2"><code>gnutls_transport_set_pull_timeout_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fpush_005ffunction"><code>gnutls_transport_set_push_function</code></a></td><td class="printindex-index-section"><a href="#Setting-up-the-transport-layer">Setting up the transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fpush_005ffunction-1"><code>gnutls_transport_set_push_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction"><code>gnutls_transport_set_vec_push_function</code></a></td><td class="printindex-index-section"><a href="#Setting-up-the-transport-layer">Setting up the transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005ftransport_005fset_005fvec_005fpush_005ffunction-1"><code>gnutls_transport_set_vec_push_function</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005furl_005fis_005fsupported"><code>gnutls_url_is_supported</code></a></td><td class="printindex-index-section"><a href="#Abstract-public-keys">Abstract public keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005furl_005fis_005fsupported-1"><code>gnutls_url_is_supported</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005futf8_005fpassword_005fnormalize"><code>gnutls_utf8_password_normalize</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fverify_005fstored_005fpubkey"><code>gnutls_verify_stored_pubkey</code></a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fverify_005fstored_005fpubkey-1"><code>gnutls_verify_stored_pubkey</code></a></td><td class="printindex-index-section"><a href="#Core-TLS-API">Core TLS API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faia_005fdeinit"><code>gnutls_x509_aia_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faia_005fget"><code>gnutls_x509_aia_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faia_005finit"><code>gnutls_x509_aia_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faia_005fset"><code>gnutls_x509_aia_set</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faki_005fdeinit"><code>gnutls_x509_aki_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faki_005fget_005fcert_005fissuer"><code>gnutls_x509_aki_get_cert_issuer</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faki_005fget_005fid"><code>gnutls_x509_aki_get_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faki_005finit"><code>gnutls_x509_aki_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faki_005fset_005fcert_005fissuer"><code>gnutls_x509_aki_set_cert_issuer</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005faki_005fset_005fid"><code>gnutls_x509_aki_set_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcidr_005fto_005frfc5280"><code>gnutls_x509_cidr_to_rfc5280</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fcheck_005fissuer"><code>gnutls_x509_crl_check_issuer</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fdeinit"><code>gnutls_x509_crl_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fdeinit"><code>gnutls_x509_crl_dist_points_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fget"><code>gnutls_x509_crl_dist_points_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005finit"><code>gnutls_x509_crl_dist_points_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fdist_005fpoints_005fset"><code>gnutls_x509_crl_dist_points_set</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fexport"><code>gnutls_x509_crl_export</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fexport2"><code>gnutls_x509_crl_export2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fgn_005fserial"><code>gnutls_x509_crl_get_authority_key_gn_serial</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fauthority_005fkey_005fid"><code>gnutls_x509_crl_get_authority_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fcount"><code>gnutls_x509_crl_get_crt_count</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial"><code>gnutls_x509_crl_get_crt_serial</code></a></td><td class="printindex-index-section"><a href="#PKIX-certificate-revocation-lists">PKIX certificate revocation lists</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fcrt_005fserial-1"><code>gnutls_x509_crl_get_crt_serial</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fdn_005foid"><code>gnutls_x509_crl_get_dn_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005fdata"><code>gnutls_x509_crl_get_extension_data</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005fdata2"><code>gnutls_x509_crl_get_extension_data2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005finfo"><code>gnutls_x509_crl_get_extension_info</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fextension_005foid"><code>gnutls_x509_crl_get_extension_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn"><code>gnutls_x509_crl_get_issuer_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn_005fby_005foid"><code>gnutls_x509_crl_get_issuer_dn_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn2"><code>gnutls_x509_crl_get_issuer_dn2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fissuer_005fdn3"><code>gnutls_x509_crl_get_issuer_dn3</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fnext_005fupdate"><code>gnutls_x509_crl_get_next_update</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fnumber"><code>gnutls_x509_crl_get_number</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fraw_005fissuer_005fdn"><code>gnutls_x509_crl_get_raw_issuer_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fsignature"><code>gnutls_x509_crl_get_signature</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fsignature_005falgorithm"><code>gnutls_x509_crl_get_signature_algorithm</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fsignature_005foid"><code>gnutls_x509_crl_get_signature_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fthis_005fupdate"><code>gnutls_x509_crl_get_this_update</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fget_005fversion"><code>gnutls_x509_crl_get_version</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fimport"><code>gnutls_x509_crl_import</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005finit"><code>gnutls_x509_crl_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fiter_005fcrt_005fserial"><code>gnutls_x509_crl_iter_crt_serial</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fiter_005fdeinit"><code>gnutls_x509_crl_iter_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005flist_005fimport"><code>gnutls_x509_crl_list_import</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005flist_005fimport2"><code>gnutls_x509_crl_list_import2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fprint"><code>gnutls_x509_crl_print</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fprivkey_005fsign"><code>gnutls_x509_crl_privkey_sign</code></a></td><td class="printindex-index-section"><a href="#PKIX-certificate-revocation-lists">PKIX certificate revocation lists</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fprivkey_005fsign-1"><code>gnutls_x509_crl_privkey_sign</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fset_005fauthority_005fkey_005fid"><code>gnutls_x509_crl_set_authority_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fset_005fcrt"><code>gnutls_x509_crl_set_crt</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fset_005fcrt_005fserial"><code>gnutls_x509_crl_set_crt_serial</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fset_005fnext_005fupdate"><code>gnutls_x509_crl_set_next_update</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fset_005fnumber"><code>gnutls_x509_crl_set_number</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fset_005fthis_005fupdate"><code>gnutls_x509_crl_set_this_update</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fset_005fversion"><code>gnutls_x509_crl_set_version</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fsign"><code>gnutls_x509_crl_sign</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fsign2"><code>gnutls_x509_crl_sign2</code></a></td><td class="printindex-index-section"><a href="#PKIX-certificate-revocation-lists">PKIX certificate revocation lists</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fsign2-1"><code>gnutls_x509_crl_sign2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrl_005fverify"><code>gnutls_x509_crl_verify</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fdeinit"><code>gnutls_x509_crq_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fexport"><code>gnutls_x509_crq_export</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fexport2"><code>gnutls_x509_crq_export2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fattribute_005fby_005foid"><code>gnutls_x509_crq_get_attribute_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fattribute_005fdata"><code>gnutls_x509_crq_get_attribute_data</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fattribute_005finfo"><code>gnutls_x509_crq_get_attribute_info</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fbasic_005fconstraints"><code>gnutls_x509_crq_get_basic_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fchallenge_005fpassword"><code>gnutls_x509_crq_get_challenge_password</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fdn"><code>gnutls_x509_crq_get_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fdn_005fby_005foid"><code>gnutls_x509_crq_get_dn_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fdn_005foid"><code>gnutls_x509_crq_get_dn_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fdn2"><code>gnutls_x509_crq_get_dn2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fdn3"><code>gnutls_x509_crq_get_dn3</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid"><code>gnutls_x509_crq_get_extension_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fby_005foid2"><code>gnutls_x509_crq_get_extension_by_oid2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fdata"><code>gnutls_x509_crq_get_extension_data</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005fdata2"><code>gnutls_x509_crq_get_extension_data2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fextension_005finfo"><code>gnutls_x509_crq_get_extension_info</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005fid"><code>gnutls_x509_crq_get_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005fpurpose_005foid"><code>gnutls_x509_crq_get_key_purpose_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005frsa_005fraw"><code>gnutls_x509_crq_get_key_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fkey_005fusage"><code>gnutls_x509_crq_get_key_usage</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fpk_005falgorithm"><code>gnutls_x509_crq_get_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fpk_005foid"><code>gnutls_x509_crq_get_pk_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fprivate_005fkey_005fusage_005fperiod"><code>gnutls_x509_crq_get_private_key_usage_period</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fsignature_005falgorithm"><code>gnutls_x509_crq_get_signature_algorithm</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fsignature_005foid"><code>gnutls_x509_crq_get_signature_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fspki"><code>gnutls_x509_crq_get_spki</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fname"><code>gnutls_x509_crq_get_subject_alt_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fsubject_005falt_005fothername_005foid"><code>gnutls_x509_crq_get_subject_alt_othername_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005ftlsfeatures"><code>gnutls_x509_crq_get_tlsfeatures</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fget_005fversion"><code>gnutls_x509_crq_get_version</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fimport"><code>gnutls_x509_crq_import</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005finit"><code>gnutls_x509_crq_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fprint"><code>gnutls_x509_crq_print</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fprivkey_005fsign"><code>gnutls_x509_crq_privkey_sign</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fattribute_005fby_005foid"><code>gnutls_x509_crq_set_attribute_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fbasic_005fconstraints"><code>gnutls_x509_crq_set_basic_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fchallenge_005fpassword"><code>gnutls_x509_crq_set_challenge_password</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fdn"><code>gnutls_x509_crq_set_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fdn_005fby_005foid"><code>gnutls_x509_crq_set_dn_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fextension_005fby_005foid"><code>gnutls_x509_crq_set_extension_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fkey"><code>gnutls_x509_crq_set_key</code></a></td><td class="printindex-index-section"><a href="#PKCS-10-certificate-requests">PKCS 10 certificate requests</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fkey-1"><code>gnutls_x509_crq_set_key</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fkey_005fpurpose_005foid"><code>gnutls_x509_crq_set_key_purpose_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fkey_005frsa_005fraw"><code>gnutls_x509_crq_set_key_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fkey_005fusage"><code>gnutls_x509_crq_set_key_usage</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fprivate_005fkey_005fusage_005fperiod"><code>gnutls_x509_crq_set_private_key_usage_period</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fpubkey"><code>gnutls_x509_crq_set_pubkey</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fpubkey-1"><code>gnutls_x509_crq_set_pubkey</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fspki"><code>gnutls_x509_crq_set_spki</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fname"><code>gnutls_x509_crq_set_subject_alt_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fsubject_005falt_005fothername"><code>gnutls_x509_crq_set_subject_alt_othername</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005ftlsfeatures"><code>gnutls_x509_crq_set_tlsfeatures</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fset_005fversion"><code>gnutls_x509_crq_set_version</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fsign"><code>gnutls_x509_crq_sign</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fsign2"><code>gnutls_x509_crq_sign2</code></a></td><td class="printindex-index-section"><a href="#PKCS-10-certificate-requests">PKCS 10 certificate requests</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fsign2-1"><code>gnutls_x509_crq_sign2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrq_005fverify"><code>gnutls_x509_crq_verify</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcheck_005femail"><code>gnutls_x509_crt_check_email</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcheck_005fhostname"><code>gnutls_x509_crt_check_hostname</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcheck_005fhostname2"><code>gnutls_x509_crt_check_hostname2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcheck_005fip"><code>gnutls_x509_crt_check_ip</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcheck_005fissuer"><code>gnutls_x509_crt_check_issuer</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcheck_005fkey_005fpurpose"><code>gnutls_x509_crt_check_key_purpose</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcheck_005frevocation"><code>gnutls_x509_crt_check_revocation</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fcpy_005fcrl_005fdist_005fpoints"><code>gnutls_x509_crt_cpy_crl_dist_points</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fdeinit"><code>gnutls_x509_crt_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fequals"><code>gnutls_x509_crt_equals</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fequals2"><code>gnutls_x509_crt_equals2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fexport"><code>gnutls_x509_crt_export</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fexport2"><code>gnutls_x509_crt_export2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005factivation_005ftime"><code>gnutls_x509_crt_get_activation_time</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fauthority_005finfo_005faccess"><code>gnutls_x509_crt_get_authority_info_access</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fgn_005fserial"><code>gnutls_x509_crt_get_authority_key_gn_serial</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fauthority_005fkey_005fid"><code>gnutls_x509_crt_get_authority_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fbasic_005fconstraints"><code>gnutls_x509_crt_get_basic_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fca_005fstatus"><code>gnutls_x509_crt_get_ca_status</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fcrl_005fdist_005fpoints"><code>gnutls_x509_crt_get_crl_dist_points</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fdn"><code>gnutls_x509_crt_get_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fdn_005fby_005foid"><code>gnutls_x509_crt_get_dn_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fdn_005foid"><code>gnutls_x509_crt_get_dn_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fdn2"><code>gnutls_x509_crt_get_dn2</code></a></td><td class="printindex-index-section"><a href="#X_002e509-distinguished-names">X.509 distinguished names</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fdn2-1"><code>gnutls_x509_crt_get_dn2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fdn3"><code>gnutls_x509_crt_get_dn3</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fexpiration_005ftime"><code>gnutls_x509_crt_get_expiration_time</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid"><code>gnutls_x509_crt_get_extension_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fby_005foid2"><code>gnutls_x509_crt_get_extension_by_oid2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fdata"><code>gnutls_x509_crt_get_extension_data</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005fdata2"><code>gnutls_x509_crt_get_extension_data2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005finfo"><code>gnutls_x509_crt_get_extension_info</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fextension_005foid"><code>gnutls_x509_crt_get_extension_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005ffingerprint"><code>gnutls_x509_crt_get_fingerprint</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005finhibit_005fanypolicy"><code>gnutls_x509_crt_get_inhibit_anypolicy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer"><code>gnutls_x509_crt_get_issuer</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname"><code>gnutls_x509_crt_get_issuer_alt_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fname2"><code>gnutls_x509_crt_get_issuer_alt_name2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005falt_005fothername_005foid"><code>gnutls_x509_crt_get_issuer_alt_othername_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn"><code>gnutls_x509_crt_get_issuer_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005fby_005foid"><code>gnutls_x509_crt_get_issuer_dn_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn_005foid"><code>gnutls_x509_crt_get_issuer_dn_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn2"><code>gnutls_x509_crt_get_issuer_dn2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005fdn3"><code>gnutls_x509_crt_get_issuer_dn3</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fissuer_005funique_005fid"><code>gnutls_x509_crt_get_issuer_unique_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fid"><code>gnutls_x509_crt_get_key_id</code></a></td><td class="printindex-index-section"><a href="#X_002e509-public-and-private-keys">X.509 public and private keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fid-1"><code>gnutls_x509_crt_get_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fpurpose_005foid"><code>gnutls_x509_crt_get_key_purpose_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fkey_005fusage"><code>gnutls_x509_crt_get_key_usage</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fname_005fconstraints"><code>gnutls_x509_crt_get_name_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005falgorithm"><code>gnutls_x509_crt_get_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005fdsa_005fraw"><code>gnutls_x509_crt_get_pk_dsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005fecc_005fraw"><code>gnutls_x509_crt_get_pk_ecc_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005fgost_005fraw"><code>gnutls_x509_crt_get_pk_gost_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005foid"><code>gnutls_x509_crt_get_pk_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpk_005frsa_005fraw"><code>gnutls_x509_crt_get_pk_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpolicy"><code>gnutls_x509_crt_get_policy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fpreferred_005fhash_005falgorithm"><code>gnutls_x509_crt_get_preferred_hash_algorithm</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fprivate_005fkey_005fusage_005fperiod"><code>gnutls_x509_crt_get_private_key_usage_period</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fproxy"><code>gnutls_x509_crt_get_proxy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fraw_005fdn"><code>gnutls_x509_crt_get_raw_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fraw_005fissuer_005fdn"><code>gnutls_x509_crt_get_raw_issuer_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fserial"><code>gnutls_x509_crt_get_serial</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsignature"><code>gnutls_x509_crt_get_signature</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsignature_005falgorithm"><code>gnutls_x509_crt_get_signature_algorithm</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsignature_005foid"><code>gnutls_x509_crt_get_signature_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fspki"><code>gnutls_x509_crt_get_spki</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject"><code>gnutls_x509_crt_get_subject</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname"><code>gnutls_x509_crt_get_subject_alt_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fname2"><code>gnutls_x509_crt_get_subject_alt_name2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005falt_005fothername_005foid"><code>gnutls_x509_crt_get_subject_alt_othername_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005fkey_005fid"><code>gnutls_x509_crt_get_subject_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fsubject_005funique_005fid"><code>gnutls_x509_crt_get_subject_unique_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005ftlsfeatures"><code>gnutls_x509_crt_get_tlsfeatures</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fget_005fversion"><code>gnutls_x509_crt_get_version</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fimport"><code>gnutls_x509_crt_import</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fimport_005fpkcs11"><code>gnutls_x509_crt_import_pkcs11</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fimport_005furl"><code>gnutls_x509_crt_import_url</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005finit"><code>gnutls_x509_crt_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005flist_005fimport"><code>gnutls_x509_crt_list_import</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005flist_005fimport_005fpkcs11"><code>gnutls_x509_crt_list_import_pkcs11</code></a></td><td class="printindex-index-section"><a href="#PKCS-11-API">PKCS 11 API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005flist_005fimport_005furl"><code>gnutls_x509_crt_list_import_url</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005flist_005fimport2"><code>gnutls_x509_crt_list_import2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005flist_005fverify"><code>gnutls_x509_crt_list_verify</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fprint"><code>gnutls_x509_crt_print</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fprivkey_005fsign"><code>gnutls_x509_crt_privkey_sign</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005factivation_005ftime"><code>gnutls_x509_crt_set_activation_time</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fauthority_005finfo_005faccess"><code>gnutls_x509_crt_set_authority_info_access</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fauthority_005fkey_005fid"><code>gnutls_x509_crt_set_authority_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fbasic_005fconstraints"><code>gnutls_x509_crt_set_basic_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fca_005fstatus"><code>gnutls_x509_crt_set_ca_status</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints"><code>gnutls_x509_crt_set_crl_dist_points</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fcrl_005fdist_005fpoints2"><code>gnutls_x509_crt_set_crl_dist_points2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fcrq"><code>gnutls_x509_crt_set_crq</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fcrq_005fextension_005fby_005foid"><code>gnutls_x509_crt_set_crq_extension_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fcrq_005fextensions"><code>gnutls_x509_crt_set_crq_extensions</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fdn"><code>gnutls_x509_crt_set_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fdn_005fby_005foid"><code>gnutls_x509_crt_set_dn_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fexpiration_005ftime"><code>gnutls_x509_crt_set_expiration_time</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fextension_005fby_005foid"><code>gnutls_x509_crt_set_extension_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fflags"><code>gnutls_x509_crt_set_flags</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005finhibit_005fanypolicy"><code>gnutls_x509_crt_set_inhibit_anypolicy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fname"><code>gnutls_x509_crt_set_issuer_alt_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005falt_005fothername"><code>gnutls_x509_crt_set_issuer_alt_othername</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn"><code>gnutls_x509_crt_set_issuer_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005fdn_005fby_005foid"><code>gnutls_x509_crt_set_issuer_dn_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fissuer_005funique_005fid"><code>gnutls_x509_crt_set_issuer_unique_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fkey"><code>gnutls_x509_crt_set_key</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fkey_005fpurpose_005foid"><code>gnutls_x509_crt_set_key_purpose_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fkey_005fusage"><code>gnutls_x509_crt_set_key_usage</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fname_005fconstraints"><code>gnutls_x509_crt_set_name_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fpin_005ffunction"><code>gnutls_x509_crt_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fpolicy"><code>gnutls_x509_crt_set_policy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fprivate_005fkey_005fusage_005fperiod"><code>gnutls_x509_crt_set_private_key_usage_period</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fproxy"><code>gnutls_x509_crt_set_proxy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fproxy_005fdn"><code>gnutls_x509_crt_set_proxy_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fpubkey"><code>gnutls_x509_crt_set_pubkey</code></a></td><td class="printindex-index-section"><a href="#Operations">Operations</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fpubkey-1"><code>gnutls_x509_crt_set_pubkey</code></a></td><td class="printindex-index-section"><a href="#Abstract-key-API">Abstract key API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fserial"><code>gnutls_x509_crt_set_serial</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fspki"><code>gnutls_x509_crt_set_spki</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fname"><code>gnutls_x509_crt_set_subject_alt_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falt_005fothername"><code>gnutls_x509_crt_set_subject_alt_othername</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005falternative_005fname"><code>gnutls_x509_crt_set_subject_alternative_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005fkey_005fid"><code>gnutls_x509_crt_set_subject_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fsubject_005funique_005fid"><code>gnutls_x509_crt_set_subject_unique_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005ftlsfeatures"><code>gnutls_x509_crt_set_tlsfeatures</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fset_005fversion"><code>gnutls_x509_crt_set_version</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fsign"><code>gnutls_x509_crt_sign</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fsign2"><code>gnutls_x509_crt_sign2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fverify"><code>gnutls_x509_crt_verify</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fcrt_005fverify_005fdata2"><code>gnutls_x509_crt_verify_data2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fct_005fsct_005fget"><code>gnutls_x509_ct_sct_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fct_005fsct_005fget_005fversion"><code>gnutls_x509_ct_sct_get_version</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fdeinit"><code>gnutls_x509_dn_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fexport"><code>gnutls_x509_dn_export</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fexport2"><code>gnutls_x509_dn_export2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fget_005frdn_005fava"><code>gnutls_x509_dn_get_rdn_ava</code></a></td><td class="printindex-index-section"><a href="#X_002e509-distinguished-names">X.509 distinguished names</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fget_005frdn_005fava-1"><code>gnutls_x509_dn_get_rdn_ava</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fget_005fstr"><code>gnutls_x509_dn_get_str</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fget_005fstr2"><code>gnutls_x509_dn_get_str2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fimport"><code>gnutls_x509_dn_import</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005finit"><code>gnutls_x509_dn_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005foid_005fknown"><code>gnutls_x509_dn_oid_known</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005foid_005fname"><code>gnutls_x509_dn_oid_name</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fdn_005fset_005fstr"><code>gnutls_x509_dn_set_str</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fct_005fexport_005fscts"><code>gnutls_x509_ext_ct_export_scts</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fct_005fimport_005fscts"><code>gnutls_x509_ext_ct_import_scts</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fct_005fscts_005fdeinit"><code>gnutls_x509_ext_ct_scts_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fct_005fscts_005finit"><code>gnutls_x509_ext_ct_scts_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fdeinit"><code>gnutls_x509_ext_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005faia"><code>gnutls_x509_ext_export_aia</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fauthority_005fkey_005fid"><code>gnutls_x509_ext_export_authority_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fbasic_005fconstraints"><code>gnutls_x509_ext_export_basic_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fcrl_005fdist_005fpoints"><code>gnutls_x509_ext_export_crl_dist_points</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005finhibit_005fanypolicy"><code>gnutls_x509_ext_export_inhibit_anypolicy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fkey_005fpurposes"><code>gnutls_x509_ext_export_key_purposes</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fkey_005fusage"><code>gnutls_x509_ext_export_key_usage</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fname_005fconstraints"><code>gnutls_x509_ext_export_name_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fpolicies"><code>gnutls_x509_ext_export_policies</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fprivate_005fkey_005fusage_005fperiod"><code>gnutls_x509_ext_export_private_key_usage_period</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fproxy"><code>gnutls_x509_ext_export_proxy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fsubject_005falt_005fnames"><code>gnutls_x509_ext_export_subject_alt_names</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005fsubject_005fkey_005fid"><code>gnutls_x509_ext_export_subject_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fexport_005ftlsfeatures"><code>gnutls_x509_ext_export_tlsfeatures</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005faia"><code>gnutls_x509_ext_import_aia</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fauthority_005fkey_005fid"><code>gnutls_x509_ext_import_authority_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fbasic_005fconstraints"><code>gnutls_x509_ext_import_basic_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fcrl_005fdist_005fpoints"><code>gnutls_x509_ext_import_crl_dist_points</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005finhibit_005fanypolicy"><code>gnutls_x509_ext_import_inhibit_anypolicy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fkey_005fpurposes"><code>gnutls_x509_ext_import_key_purposes</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fkey_005fusage"><code>gnutls_x509_ext_import_key_usage</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fname_005fconstraints"><code>gnutls_x509_ext_import_name_constraints</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fpolicies"><code>gnutls_x509_ext_import_policies</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fprivate_005fkey_005fusage_005fperiod"><code>gnutls_x509_ext_import_private_key_usage_period</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fproxy"><code>gnutls_x509_ext_import_proxy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fsubject_005falt_005fnames"><code>gnutls_x509_ext_import_subject_alt_names</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005fsubject_005fkey_005fid"><code>gnutls_x509_ext_import_subject_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fimport_005ftlsfeatures"><code>gnutls_x509_ext_import_tlsfeatures</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fext_005fprint"><code>gnutls_x509_ext_print</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fkey_005fpurpose_005fdeinit"><code>gnutls_x509_key_purpose_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fkey_005fpurpose_005fget"><code>gnutls_x509_key_purpose_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fkey_005fpurpose_005finit"><code>gnutls_x509_key_purpose_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fkey_005fpurpose_005fset"><code>gnutls_x509_key_purpose_set</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005fadd_005fexcluded"><code>gnutls_x509_name_constraints_add_excluded</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005fadd_005fpermitted"><code>gnutls_x509_name_constraints_add_permitted</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005fcheck"><code>gnutls_x509_name_constraints_check</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005fcheck_005fcrt"><code>gnutls_x509_name_constraints_check_crt</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005fdeinit"><code>gnutls_x509_name_constraints_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005fget_005fexcluded"><code>gnutls_x509_name_constraints_get_excluded</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005fget_005fpermitted"><code>gnutls_x509_name_constraints_get_permitted</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fname_005fconstraints_005finit"><code>gnutls_x509_name_constraints_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fothername_005fto_005fvirtual"><code>gnutls_x509_othername_to_virtual</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fpolicies_005fdeinit"><code>gnutls_x509_policies_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fpolicies_005fget"><code>gnutls_x509_policies_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fpolicies_005finit"><code>gnutls_x509_policies_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fpolicies_005fset"><code>gnutls_x509_policies_set</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fpolicy_005frelease"><code>gnutls_x509_policy_release</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fcpy"><code>gnutls_x509_privkey_cpy</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fdeinit"><code>gnutls_x509_privkey_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport"><code>gnutls_x509_privkey_export</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport_005fdsa_005fraw"><code>gnutls_x509_privkey_export_dsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport_005fecc_005fraw"><code>gnutls_x509_privkey_export_ecc_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport_005fgost_005fraw"><code>gnutls_x509_privkey_export_gost_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport_005fpkcs8"><code>gnutls_x509_privkey_export_pkcs8</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw"><code>gnutls_x509_privkey_export_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport_005frsa_005fraw2"><code>gnutls_x509_privkey_export_rsa_raw2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport2"><code>gnutls_x509_privkey_export2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fexport2_005fpkcs8"><code>gnutls_x509_privkey_export2_pkcs8</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005ffix"><code>gnutls_x509_privkey_fix</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fgenerate"><code>gnutls_x509_privkey_generate</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fgenerate2"><code>gnutls_x509_privkey_generate2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fget_005fkey_005fid"><code>gnutls_x509_privkey_get_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm"><code>gnutls_x509_privkey_get_pk_algorithm</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fget_005fpk_005falgorithm2"><code>gnutls_x509_privkey_get_pk_algorithm2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fget_005fseed"><code>gnutls_x509_privkey_get_seed</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fget_005fspki"><code>gnutls_x509_privkey_get_spki</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport"><code>gnutls_x509_privkey_import</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005fdh_005fraw"><code>gnutls_x509_privkey_import_dh_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005fdsa_005fraw"><code>gnutls_x509_privkey_import_dsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005fecc_005fraw"><code>gnutls_x509_privkey_import_ecc_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005fgost_005fraw"><code>gnutls_x509_privkey_import_gost_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005fopenssl"><code>gnutls_x509_privkey_import_openssl</code></a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005fopenssl-1"><code>gnutls_x509_privkey_import_openssl</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005fpkcs8"><code>gnutls_x509_privkey_import_pkcs8</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw"><code>gnutls_x509_privkey_import_rsa_raw</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport_005frsa_005fraw2"><code>gnutls_x509_privkey_import_rsa_raw2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport2"><code>gnutls_x509_privkey_import2</code></a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fimport2-1"><code>gnutls_x509_privkey_import2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005finit"><code>gnutls_x509_privkey_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fsec_005fparam"><code>gnutls_x509_privkey_sec_param</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fset_005fflags"><code>gnutls_x509_privkey_set_flags</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fset_005fpin_005ffunction"><code>gnutls_x509_privkey_set_pin_function</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fset_005fspki"><code>gnutls_x509_privkey_set_spki</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fsign_005fdata"><code>gnutls_x509_privkey_sign_data</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fsign_005fhash"><code>gnutls_x509_privkey_sign_hash</code></a></td><td class="printindex-index-section"><a href="#Compatibility-API">Compatibility API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fverify_005fparams"><code>gnutls_x509_privkey_verify_params</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fprivkey_005fverify_005fseed"><code>gnutls_x509_privkey_verify_seed</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005frdn_005fget"><code>gnutls_x509_rdn_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005frdn_005fget_005fby_005foid"><code>gnutls_x509_rdn_get_by_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005frdn_005fget_005foid"><code>gnutls_x509_rdn_get_oid</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005frdn_005fget2"><code>gnutls_x509_rdn_get2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fspki_005fdeinit"><code>gnutls_x509_spki_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fspki_005fget_005frsa_005foaep_005fparams"><code>gnutls_x509_spki_get_rsa_oaep_params</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fspki_005fget_005frsa_005fpss_005fparams"><code>gnutls_x509_spki_get_rsa_pss_params</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fspki_005finit"><code>gnutls_x509_spki_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fspki_005fset_005frsa_005foaep_005fparams"><code>gnutls_x509_spki_set_rsa_oaep_params</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005fspki_005fset_005frsa_005fpss_005fparams"><code>gnutls_x509_spki_set_rsa_pss_params</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftlsfeatures_005fadd"><code>gnutls_x509_tlsfeatures_add</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftlsfeatures_005fcheck_005fcrt"><code>gnutls_x509_tlsfeatures_check_crt</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftlsfeatures_005fdeinit"><code>gnutls_x509_tlsfeatures_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftlsfeatures_005fget"><code>gnutls_x509_tlsfeatures_get</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftlsfeatures_005finit"><code>gnutls_x509_tlsfeatures_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcas"><code>gnutls_x509_trust_list_add_cas</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcas-1"><code>gnutls_x509_trust_list_add_cas</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls"><code>gnutls_x509_trust_list_add_crls</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fcrls-1"><code>gnutls_x509_trust_list_add_crls</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt"><code>gnutls_x509_trust_list_add_named_crt</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fnamed_005fcrt-1"><code>gnutls_x509_trust_list_add_named_crt</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust"><code>gnutls_x509_trust_list_add_system_trust</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005fsystem_005ftrust-1"><code>gnutls_x509_trust_list_add_system_trust</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fdir"><code>gnutls_x509_trust_list_add_trust_dir</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile"><code>gnutls_x509_trust_list_add_trust_file</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005ffile-1"><code>gnutls_x509_trust_list_add_trust_file</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem"><code>gnutls_x509_trust_list_add_trust_mem</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fadd_005ftrust_005fmem-1"><code>gnutls_x509_trust_list_add_trust_mem</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fdeinit"><code>gnutls_x509_trust_list_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer"><code>gnutls_x509_trust_list_get_issuer</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fdn"><code>gnutls_x509_trust_list_get_issuer_by_dn</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fissuer_005fby_005fsubject_005fkey_005fid"><code>gnutls_x509_trust_list_get_issuer_by_subject_key_id</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fget_005fptr"><code>gnutls_x509_trust_list_get_ptr</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005finit"><code>gnutls_x509_trust_list_init</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fiter_005fdeinit"><code>gnutls_x509_trust_list_iter_deinit</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fiter_005fget_005fca"><code>gnutls_x509_trust_list_iter_get_ca</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fremove_005fcas"><code>gnutls_x509_trust_list_remove_cas</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005ffile"><code>gnutls_x509_trust_list_remove_trust_file</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fremove_005ftrust_005fmem"><code>gnutls_x509_trust_list_remove_trust_mem</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fset_005fgetissuer_005ffunction"><code>gnutls_x509_trust_list_set_getissuer_function</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fset_005fptr"><code>gnutls_x509_trust_list_set_ptr</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt"><code>gnutls_x509_trust_list_verify_crt</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt-1"><code>gnutls_x509_trust_list_verify_crt</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2"><code>gnutls_x509_trust_list_verify_crt2</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fcrt2-1"><code>gnutls_x509_trust_list_verify_crt2</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt"><code>gnutls_x509_trust_list_verify_named_crt</code></a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fx509_005ftrust_005flist_005fverify_005fnamed_005fcrt-1"><code>gnutls_x509_trust_list_verify_named_crt</code></a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
</table>
<table class="fn-letters-footer-printindex"><tr><th>Jump to: </th><td><a class="summary-letter-printindex" href="#Function-and-Data-Index_fn_letter-D"><b>D</b></a>
<a class="summary-letter-printindex" href="#Function-and-Data-Index_fn_letter-G"><b>G</b></a>
</td></tr></table>
</div>
<hr>
</div>
<div class="unnumbered-level-extent" id="Concept-Index">
<div class="nav-panel">
<p>
Previous: <a href="#Function-and-Data-Index" accesskey="p" rel="prev">Function and Data Index</a>, Up: <a href="#Top" accesskey="u" rel="up">GnuTLS</a> [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Function-and-Data-Index" title="Index" rel="index">Index</a>]</p>
</div>
<h2 class="unnumbered" id="Concept-Index-1"><span>Concept Index<a class="copiable-link" href="#Concept-Index-1"> ¶</a></span></h2>
<div class="printindex cp-printindex">
<table class="cp-letters-header-printindex"><tr><th>Jump to: </th><td><a class="summary-letter-printindex" href="#Concept-Index_cp_letter-A"><b>A</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-B"><b>B</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-C"><b>C</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-D"><b>D</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-E"><b>E</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-F"><b>F</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-G"><b>G</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-H"><b>H</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-I"><b>I</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-K"><b>K</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-M"><b>M</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-O"><b>O</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-P"><b>P</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-R"><b>R</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-S"><b>S</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-T"><b>T</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-U"><b>U</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-V"><b>V</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-X"><b>X</b></a>
</td></tr></table>
<table class="cp-entries-printindex">
<tr><td></td><th class="entries-header-printindex">Index Entry</th><th class="sections-header-printindex">Section</th></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-A">A</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-abstract-types">abstract types</a></td><td class="printindex-index-section"><a href="#Abstract-key-types">Abstract key types</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-alert-protocol">alert protocol</a></td><td class="printindex-index-section"><a href="#The-TLS-Alert-Protocol">The TLS Alert Protocol</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-ALPN">ALPN</a></td><td class="printindex-index-section"><a href="#Application-Layer-Protocol-Negotiation-_0028ALPN_0029">Application Layer Protocol Negotiation (ALPN)</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-anonymous-authentication">anonymous authentication</a></td><td class="printindex-index-section"><a href="#Anonymous-authentication">Anonymous authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-API-reference">API reference</a></td><td class="printindex-index-section"><a href="#API-reference">API reference</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Application-Layer-Protocol-Negotiation">Application Layer Protocol Negotiation</a></td><td class="printindex-index-section"><a href="#Application-Layer-Protocol-Negotiation-_0028ALPN_0029">Application Layer Protocol Negotiation (ALPN)</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Application_002dspecific-keys">Application-specific keys</a></td><td class="printindex-index-section"><a href="#Application_002dspecific-keys">Application-specific keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-authentication-methods">authentication methods</a></td><td class="printindex-index-section"><a href="#Authentication-methods">Authentication methods</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-B">B</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-bad_005frecord_005fmac">bad_record_mac</a></td><td class="printindex-index-section"><a href="#On-Record-Padding">On Record Padding</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-C">C</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-callback-functions">callback functions</a></td><td class="printindex-index-section"><a href="#Callback-functions">Callback functions</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certificate-authentication">certificate authentication</a></td><td class="printindex-index-section"><a href="#Certificate-authentication">Certificate authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certificate-authentication-1">certificate authentication</a></td><td class="printindex-index-section"><a href="#More-on-certificate-authentication">More on certificate authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certificate-requests">certificate requests</a></td><td class="printindex-index-section"><a href="#PKCS-10-certificate-requests">PKCS 10 certificate requests</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certificate-revocation-lists">certificate revocation lists</a></td><td class="printindex-index-section"><a href="#PKIX-certificate-revocation-lists">PKIX certificate revocation lists</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certificate-status">certificate status</a></td><td class="printindex-index-section"><a href="#OCSP-certificate-status-checking">OCSP certificate status checking</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certificate-status-1">certificate status</a></td><td class="printindex-index-section"><a href="#OCSP-stapling">OCSP stapling</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Certificate-status-request">Certificate status request</a></td><td class="printindex-index-section"><a href="#OCSP-status-request">OCSP status request</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Certificate-verification">Certificate verification</a></td><td class="printindex-index-section"><a href="#Advanced-certificate-verification">Advanced certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certification">certification</a></td><td class="printindex-index-section"><a href="#Certification">Certification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certtool"><code>certtool</code></a></td><td class="printindex-index-section"><a href="#certtool-Invocation">certtool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-certtool-help">certtool help</a></td><td class="printindex-index-section"><a href="#certtool-Invocation">certtool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-channel-bindings">channel bindings</a></td><td class="printindex-index-section"><a href="#Channel-Bindings">Channel Bindings</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-ciphersuites">ciphersuites</a></td><td class="printindex-index-section"><a href="#Supported-ciphersuites">Supported ciphersuites</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-client-certificate-authentication">client certificate authentication</a></td><td class="printindex-index-section"><a href="#Client-Authentication">Client Authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-CMS">CMS</a></td><td class="printindex-index-section"><a href="#Cryptographic-Message-Syntax-_002f-PKCS7">Cryptographic Message Syntax / PKCS7</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-compression-algorithms">compression algorithms</a></td><td class="printindex-index-section"><a href="#Compression-algorithms-and-the-record-layer">Compression algorithms and the record layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-contributing">contributing</a></td><td class="printindex-index-section"><a href="#Contributing">Contributing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-credentials">credentials</a></td><td class="printindex-index-section"><a href="#Virtual-hosts-and-credentials">Virtual hosts and credentials</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-CRL">CRL</a></td><td class="printindex-index-section"><a href="#PKIX-certificate-revocation-lists">PKIX certificate revocation lists</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-cryptographic-message-syntax">cryptographic message syntax</a></td><td class="printindex-index-section"><a href="#Cryptographic-Message-Syntax-_002f-PKCS7">Cryptographic Message Syntax / PKCS7</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-D">D</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-DANE">DANE</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-using-DANE">Verifying a certificate using DANE</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-DANE-1">DANE</a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-danetool"><code>danetool</code></a></td><td class="printindex-index-section"><a href="#danetool-Invocation">danetool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-danetool-help">danetool help</a></td><td class="printindex-index-section"><a href="#danetool-Invocation">danetool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-deriving-keys">deriving keys</a></td><td class="printindex-index-section"><a href="#Deriving-keys-for-other-applications_002fprotocols">Deriving keys for other applications/protocols</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-digital-signatures">digital signatures</a></td><td class="printindex-index-section"><a href="#Digital-signatures">Digital signatures</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-DNSSEC">DNSSEC</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-using-DANE">Verifying a certificate using DANE</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-DNSSEC-1">DNSSEC</a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-download">download</a></td><td class="printindex-index-section"><a href="#Downloading-and-installing">Downloading and installing</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-E">E</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Encrypted-keys">Encrypted keys</a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-error-codes">error codes</a></td><td class="printindex-index-section"><a href="#Error-codes">Error codes</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-example-programs">example programs</a></td><td class="printindex-index-section"><a href="#GnuTLS-application-examples">GnuTLS application examples</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-examples">examples</a></td><td class="printindex-index-section"><a href="#GnuTLS-application-examples">GnuTLS application examples</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-exporting-keying-material">exporting keying material</a></td><td class="printindex-index-section"><a href="#Deriving-keys-for-other-applications_002fprotocols">Deriving keys for other applications/protocols</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-F">F</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-False-Start">False Start</a></td><td class="printindex-index-section"><a href="#False-Start">False Start</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-FDL_002c-GNU-Free-Documentation-License">FDL, GNU Free Documentation License</a></td><td class="printindex-index-section"><a href="#Copying-Information">Copying Information</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-file-signing">file signing</a></td><td class="printindex-index-section"><a href="#Cryptographic-Message-Syntax-_002f-PKCS7">Cryptographic Message Syntax / PKCS7</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-fork">fork</a></td><td class="printindex-index-section"><a href="#Sessions-and-fork">Sessions and fork</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-G">G</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-generating-parameters">generating parameters</a></td><td class="printindex-index-section"><a href="#Parameter-generation">Parameter generation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-giovec_005ft">giovec_t</a></td><td class="printindex-index-section"><a href="#Common-types">Common types</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_005fdatum_005ft">gnutls_datum_t</a></td><td class="printindex-index-section"><a href="#Common-types">Common types</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_002dcli"><code>gnutls-cli</code></a></td><td class="printindex-index-section"><a href="#gnutls_002dcli-Invocation">gnutls-cli Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_002dcli-help">gnutls-cli help</a></td><td class="printindex-index-section"><a href="#gnutls_002dcli-Invocation">gnutls-cli Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_002dcli_002ddebug"><code>gnutls-cli-debug</code></a></td><td class="printindex-index-section"><a href="#gnutls_002dcli_002ddebug-Invocation">gnutls-cli-debug Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_002dcli_002ddebug-help">gnutls-cli-debug help</a></td><td class="printindex-index-section"><a href="#gnutls_002dcli_002ddebug-Invocation">gnutls-cli-debug Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_002dserv"><code>gnutls-serv</code></a></td><td class="printindex-index-section"><a href="#gnutls_002dserv-Invocation">gnutls-serv Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-gnutls_002dserv-help">gnutls-serv help</a></td><td class="printindex-index-section"><a href="#gnutls_002dserv-Invocation">gnutls-serv Invocation</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-H">H</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-hacking">hacking</a></td><td class="printindex-index-section"><a href="#Contributing">Contributing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-handshake-protocol">handshake protocol</a></td><td class="printindex-index-section"><a href="#The-TLS-Handshake-Protocol">The TLS Handshake Protocol</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-hardware-security-modules">hardware security modules</a></td><td class="printindex-index-section"><a href="#Smart-cards-and-HSMs">Smart cards and HSMs</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-hardware-tokens">hardware tokens</a></td><td class="printindex-index-section"><a href="#Smart-cards-and-HSMs">Smart cards and HSMs</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-hash-functions">hash functions</a></td><td class="printindex-index-section"><a href="#Hash-and-MAC-functions">Hash and MAC functions</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-heartbeat">heartbeat</a></td><td class="printindex-index-section"><a href="#HeartBeat">HeartBeat</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-HMAC-functions">HMAC functions</a></td><td class="printindex-index-section"><a href="#Hash-and-MAC-functions">Hash and MAC functions</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-I">I</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-installation">installation</a></td><td class="printindex-index-section"><a href="#Downloading-and-installing">Downloading and installing</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-installation-1">installation</a></td><td class="printindex-index-section"><a href="#Installing-for-a-software-distribution">Installing for a software distribution</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-internal-architecture">internal architecture</a></td><td class="printindex-index-section"><a href="#Internal-architecture-of-GnuTLS">Internal architecture of GnuTLS</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-isolated-mode">isolated mode</a></td><td class="printindex-index-section"><a href="#Running-in-a-sandbox">Running in a sandbox</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-K">K</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-key-extraction">key extraction</a></td><td class="printindex-index-section"><a href="#Deriving-keys-for-other-applications_002fprotocols">Deriving keys for other applications/protocols</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Key-pinning">Key pinning</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Key-pinning-1">Key pinning</a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-key-sizes">key sizes</a></td><td class="printindex-index-section"><a href="#Selecting-cryptographic-key-sizes">Selecting cryptographic key sizes</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-keying-material-exporters">keying material exporters</a></td><td class="printindex-index-section"><a href="#Deriving-keys-for-other-applications_002fprotocols">Deriving keys for other applications/protocols</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-kTLS-_0028Kernel-TLS_0029">kTLS (Kernel TLS)</a></td><td class="printindex-index-section"><a href="#kTLS-_0028Kernel-TLS_0029">kTLS (Kernel TLS)</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-M">M</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-MAC-functions">MAC functions</a></td><td class="printindex-index-section"><a href="#Hash-and-MAC-functions">Hash and MAC functions</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-maximum-fragment-length">maximum fragment length</a></td><td class="printindex-index-section"><a href="#Maximum-fragment-length-negotiation">Maximum fragment length negotiation</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-O">O</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OCSP">OCSP</a></td><td class="printindex-index-section"><a href="#OCSP-certificate-status-checking">OCSP certificate status checking</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OCSP-Functions">OCSP Functions</a></td><td class="printindex-index-section"><a href="#OCSP-API">OCSP API</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OCSP-stapling">OCSP stapling</a></td><td class="printindex-index-section"><a href="#OCSP-stapling">OCSP stapling</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OCSP-status-request">OCSP status request</a></td><td class="printindex-index-section"><a href="#OCSP-status-request">OCSP status request</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-ocsptool"><code>ocsptool</code></a></td><td class="printindex-index-section"><a href="#ocsptool-Invocation">ocsptool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-ocsptool-help">ocsptool help</a></td><td class="printindex-index-section"><a href="#ocsptool-Invocation">ocsptool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Online-Certificate-Status-Protocol">Online Certificate Status Protocol</a></td><td class="printindex-index-section"><a href="#OCSP-certificate-status-checking">OCSP certificate status checking</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Online-Certificate-Status-Protocol-1">Online Certificate Status Protocol</a></td><td class="printindex-index-section"><a href="#OCSP-stapling">OCSP stapling</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OpenPGP-certificates">OpenPGP certificates</a></td><td class="printindex-index-section"><a href="#OpenPGP-certificates">OpenPGP certificates</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OpenSSL">OpenSSL</a></td><td class="printindex-index-section"><a href="#Compatibility-with-the-OpenSSL-library">Compatibility with the OpenSSL library</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-OpenSSL-encrypted-keys">OpenSSL encrypted keys</a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-overriding-algorithms">overriding algorithms</a></td><td class="printindex-index-section"><a href="#Overriding-algorithms">Overriding algorithms</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-P">P</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-p11tool"><code>p11tool</code></a></td><td class="printindex-index-section"><a href="#p11tool-Invocation">p11tool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-p11tool-help">p11tool help</a></td><td class="printindex-index-section"><a href="#p11tool-Invocation">p11tool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-parameter-generation">parameter generation</a></td><td class="printindex-index-section"><a href="#Parameter-generation">Parameter generation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-PCT">PCT</a></td><td class="printindex-index-section"><a href="#On-SSL-2-and-older-protocols">On SSL 2 and older protocols</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-PKCS-_002310">PKCS #10</a></td><td class="printindex-index-section"><a href="#PKCS-10-certificate-requests">PKCS 10 certificate requests</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-PKCS-_002311-tokens">PKCS #11 tokens</a></td><td class="printindex-index-section"><a href="#Smart-cards-and-HSMs">Smart cards and HSMs</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-PKCS-_002312">PKCS #12</a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-PKCS-_00237">PKCS #7</a></td><td class="printindex-index-section"><a href="#Cryptographic-Message-Syntax-_002f-PKCS7">Cryptographic Message Syntax / PKCS7</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-PKCS-_00238">PKCS #8</a></td><td class="printindex-index-section"><a href="#Managing-encrypted-keys">Managing encrypted keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-post_002dhandshake-authentication">post-handshake authentication</a></td><td class="printindex-index-section"><a href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey">TLS 1.3 re-authentication and re-key</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Priority-strings">Priority strings</a></td><td class="printindex-index-section"><a href="#Priority-Strings">Priority Strings</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-PSK-authentication">PSK authentication</a></td><td class="printindex-index-section"><a href="#Authentication-using-PSK">Authentication using PSK</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-psktool"><code>psktool</code></a></td><td class="printindex-index-section"><a href="#psktool-Invocation">psktool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-psktool-help">psktool help</a></td><td class="printindex-index-section"><a href="#psktool-Invocation">psktool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-public-key-algorithms">public key algorithms</a></td><td class="printindex-index-section"><a href="#Public-key-algorithms">Public key algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-public-key-algorithms-1">public key algorithms</a></td><td class="printindex-index-section"><a href="#Cryptographic-Message-Syntax-_002f-PKCS7">Cryptographic Message Syntax / PKCS7</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-R">R</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-random-numbers">random numbers</a></td><td class="printindex-index-section"><a href="#Random-number-generation">Random number generation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Raw-public_002dkeys">Raw public-keys</a></td><td class="printindex-index-section"><a href="#Raw-public_002dkeys">Raw public-keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-re_002dauthentication">re-authentication</a></td><td class="printindex-index-section"><a href="#TLS-1_002e2-re_002dauthentication">TLS 1.2 re-authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-re_002dauthentication-1">re-authentication</a></td><td class="printindex-index-section"><a href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey">TLS 1.3 re-authentication and re-key</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-re_002dkey">re-key</a></td><td class="printindex-index-section"><a href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey">TLS 1.3 re-authentication and re-key</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-re_002dnegotiation">re-negotiation</a></td><td class="printindex-index-section"><a href="#TLS-1_002e2-re_002dauthentication">TLS 1.2 re-authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-re_002dnegotiation-1">re-negotiation</a></td><td class="printindex-index-section"><a href="#TLS-1_002e3-re_002dauthentication-and-re_002dkey">TLS 1.3 re-authentication and re-key</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-record-padding">record padding</a></td><td class="printindex-index-section"><a href="#On-Record-Padding">On Record Padding</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-record-protocol">record protocol</a></td><td class="printindex-index-section"><a href="#The-TLS-record-protocol">The TLS record protocol</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-renegotiation">renegotiation</a></td><td class="printindex-index-section"><a href="#Safe-renegotiation">Safe renegotiation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-reporting-bugs">reporting bugs</a></td><td class="printindex-index-section"><a href="#Bug-Reports">Bug Reports</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-resuming-sessions">resuming sessions</a></td><td class="printindex-index-section"><a href="#Resuming-Sessions">Resuming Sessions</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-resuming-sessions-1">resuming sessions</a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-S">S</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-safe-renegotiation">safe renegotiation</a></td><td class="printindex-index-section"><a href="#Safe-renegotiation">Safe renegotiation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-seccomp">seccomp</a></td><td class="printindex-index-section"><a href="#Running-in-a-sandbox">Running in a sandbox</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Secure-RTP">Secure RTP</a></td><td class="printindex-index-section"><a href="#SRTP">SRTP</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-server-name-indication">server name indication</a></td><td class="printindex-index-section"><a href="#Server-name-indication">Server name indication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-session-resumption">session resumption</a></td><td class="printindex-index-section"><a href="#Resuming-Sessions">Resuming Sessions</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-session-resumption-1">session resumption</a></td><td class="printindex-index-section"><a href="#Session-resumption">Session resumption</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-session-tickets">session tickets</a></td><td class="printindex-index-section"><a href="#Session-tickets">Session tickets</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Smart-card-example">Smart card example</a></td><td class="printindex-index-section"><a href="#Client-using-a-smart-card-with-TLS">Client using a smart card with TLS</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-smart-cards">smart cards</a></td><td class="printindex-index-section"><a href="#Smart-cards-and-HSMs">Smart cards and HSMs</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-SRP-authentication">SRP authentication</a></td><td class="printindex-index-section"><a href="#Authentication-using-SRP">Authentication using SRP</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-srptool"><code>srptool</code></a></td><td class="printindex-index-section"><a href="#srptool-Invocation">srptool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-srptool-help">srptool help</a></td><td class="printindex-index-section"><a href="#srptool-Invocation">srptool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-SRTP">SRTP</a></td><td class="printindex-index-section"><a href="#SRTP">SRTP</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-SSH_002dstyle-authentication">SSH-style authentication</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-SSH_002dstyle-authentication-1">SSH-style authentication</a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-SSL-2">SSL 2</a></td><td class="printindex-index-section"><a href="#On-SSL-2-and-older-protocols">On SSL 2 and older protocols</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Supplemental-data">Supplemental data</a></td><td class="printindex-index-section"><a href="#Extensions-and-Supplemental-Data">Extensions and Supplemental Data</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-symmetric-algorithms">symmetric algorithms</a></td><td class="printindex-index-section"><a href="#Symmetric-algorithms">Symmetric algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-symmetric-cryptography">symmetric cryptography</a></td><td class="printindex-index-section"><a href="#Symmetric-algorithms">Symmetric algorithms</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-symmetric-encryption-algorithms">symmetric encryption algorithms</a></td><td class="printindex-index-section"><a href="#Encryption-algorithms-used-in-the-record-layer">Encryption algorithms used in the record layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-System_002dspecific-keys">System-specific keys</a></td><td class="printindex-index-section"><a href="#Application_002dspecific-keys">Application-specific keys</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-System_002dwide-configuration">System-wide configuration</a></td><td class="printindex-index-section"><a href="#System_002dwide-configuration-of-the-library">System-wide configuration of the library</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-T">T</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-thread-safety">thread safety</a></td><td class="printindex-index-section"><a href="#Thread-safety">Thread safety</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-tickets">tickets</a></td><td class="printindex-index-section"><a href="#Session-tickets">Session tickets</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TLS-extensions">TLS extensions</a></td><td class="printindex-index-section"><a href="#TLS-Extensions">TLS Extensions</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TLS-extensions-1">TLS extensions</a></td><td class="printindex-index-section"><a href="#Maximum-fragment-length-negotiation">Maximum fragment length negotiation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TLS-extensions-2">TLS extensions</a></td><td class="printindex-index-section"><a href="#Server-name-indication">Server name indication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TLS-extensions-3">TLS extensions</a></td><td class="printindex-index-section"><a href="#Session-tickets">Session tickets</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TLS-extensions-4">TLS extensions</a></td><td class="printindex-index-section"><a href="#HeartBeat">HeartBeat</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TLS-False-Start">TLS False Start</a></td><td class="printindex-index-section"><a href="#False-Start">False Start</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TLS-layers">TLS layers</a></td><td class="printindex-index-section"><a href="#TLS-layers">TLS layers</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-TPM">TPM</a></td><td class="printindex-index-section"><a href="#Trusted-Platform-Module">Trusted Platform Module</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-tpmtool"><code>tpmtool</code></a></td><td class="printindex-index-section"><a href="#tpmtool-Invocation">tpmtool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-tpmtool-help">tpmtool help</a></td><td class="printindex-index-section"><a href="#tpmtool-Invocation">tpmtool Invocation</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-transport-layer">transport layer</a></td><td class="printindex-index-section"><a href="#The-transport-layer">The transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-transport-protocol">transport protocol</a></td><td class="printindex-index-section"><a href="#The-transport-layer">The transport layer</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Trust-on-first-use">Trust on first use</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-Trust-on-first-use-1">Trust on first use</a></td><td class="printindex-index-section"><a href="#Certificate-verification">Certificate verification</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-trusted-platform-module">trusted platform module</a></td><td class="printindex-index-section"><a href="#Trusted-Platform-Module">Trusted Platform Module</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-U">U</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-upgrading">upgrading</a></td><td class="printindex-index-section"><a href="#Upgrading-from-previous-versions">Upgrading from previous versions</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-V">V</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-verifying-certificate-paths">verifying certificate paths</a></td><td class="printindex-index-section"><a href="#Verifying-X_002e509-certificate-paths">Verifying X.509 certificate paths</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-verifying-certificate-paths-1">verifying certificate paths</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-in-the-context-of-TLS-session">Verifying a certificate in the context of TLS session</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-verifying-certificate-paths-2">verifying certificate paths</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-using-trust-on-first-use-authentication">Verifying a certificate using trust on first use authentication</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-verifying-certificate-paths-3">verifying certificate paths</a></td><td class="printindex-index-section"><a href="#Verifying-a-certificate-using-DANE">Verifying a certificate using DANE</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-verifying-certificate-with-pkcs11">verifying certificate with pkcs11</a></td><td class="printindex-index-section"><a href="#Verification-using-PKCS11">Verification using PKCS11</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-virtual-hosts">virtual hosts</a></td><td class="printindex-index-section"><a href="#Virtual-hosts-and-credentials">Virtual hosts and credentials</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
<tr><th id="Concept-Index_cp_letter-X">X</th></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-X_002e509-certificate-name">X.509 certificate name</a></td><td class="printindex-index-section"><a href="#X_002e509-certificate-names">X.509 certificate names</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-X_002e509-certificates">X.509 certificates</a></td><td class="printindex-index-section"><a href="#X_002e509-certificates">X.509 certificates</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-X_002e509-distinguished-name">X.509 distinguished name</a></td><td class="printindex-index-section"><a href="#X_002e509-distinguished-names">X.509 distinguished names</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-X_002e509-extensions">X.509 extensions</a></td><td class="printindex-index-section"><a href="#X_002e509-extensions">X.509 extensions</a></td></tr>
<tr><td></td><td class="printindex-index-entry"><a href="#index-X_002e509-Functions">X.509 Functions</a></td><td class="printindex-index-section"><a href="#X509-certificate-API">X509 certificate API</a></td></tr>
<tr><td colspan="3"><hr></td></tr>
</table>
<table class="cp-letters-footer-printindex"><tr><th>Jump to: </th><td><a class="summary-letter-printindex" href="#Concept-Index_cp_letter-A"><b>A</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-B"><b>B</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-C"><b>C</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-D"><b>D</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-E"><b>E</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-F"><b>F</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-G"><b>G</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-H"><b>H</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-I"><b>I</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-K"><b>K</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-M"><b>M</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-O"><b>O</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-P"><b>P</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-R"><b>R</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-S"><b>S</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-T"><b>T</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-U"><b>U</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-V"><b>V</b></a>
<a class="summary-letter-printindex" href="#Concept-Index_cp_letter-X"><b>X</b></a>
</td></tr></table>
</div>
</div>
</div>
<div class="footnotes-segment">
<hr>
<h4 class="footnotes-heading">Footnotes</h4>
<h5 class="footnote-body-heading"><a id="FOOT1" href="#DOCF1">(1)</a></h5>
<p>Needed
to use RFC6125 name comparison in internationalized domains.</p>
<h5 class="footnote-body-heading"><a id="FOOT2" href="#DOCF2">(2)</a></h5>
<p><a class="url" href="https://p11-glue.github.io/p11-glue/trust-module.html">https://p11-glue.github.io/p11-glue/trust-module.html</a></p>
<h5 class="footnote-body-heading"><a id="FOOT3" href="#DOCF3">(3)</a></h5>
<p>IETF, or Internet Engineering Task Force,
is a large open international community of network designers,
operators, vendors, and researchers concerned with the evolution of
the Internet architecture and the smooth operation of the Internet.
It is open to any interested individual.</p>
<h5 class="footnote-body-heading"><a id="FOOT4" href="#DOCF4">(4)</a></h5>
<p>In early versions of TLS compression was optionally
available as well. This is no longer the case in recent versions of the
protocol.</p>
<h5 class="footnote-body-heading"><a id="FOOT5" href="#DOCF5">(5)</a></h5>
<p>MAC stands for Message Authentication Code. It can be described as a keyed hash algorithm. See RFC2104.</p>
<h5 class="footnote-body-heading"><a id="FOOT6" href="#DOCF6">(6)</a></h5>
<p>See also the Server Name Indication extension on
<a class="ref" href="#serverind">serverind</a>.</p>
<h5 class="footnote-body-heading"><a id="FOOT7" href="#DOCF7">(7)</a></h5>
<p>See LDAP, IMAP etc.</p>
<h5 class="footnote-body-heading"><a id="FOOT8" href="#DOCF8">(8)</a></h5>
<p>see <a class="url" href="https://p11-glue.github.io/p11-glue/trust-module.html">https://p11-glue.github.io/p11-glue/trust-module.html</a>.</p>
<h5 class="footnote-body-heading"><a id="FOOT9" href="#DOCF9">(9)</a></h5>
<p>For example, OpenSC-supported cards.</p>
<h5 class="footnote-body-heading"><a id="FOOT10" href="#DOCF10">(10)</a></h5>
<p><a class="url" href="https://p11-glue.github.io/p11-glue/p11-kit.html">https://p11-glue.github.io/p11-glue/p11-kit.html</a></p>
<h5 class="footnote-body-heading"><a id="FOOT11" href="#DOCF11">(11)</a></h5>
<p>For
example when an open session is to be reinitialized, but the PIN is not available
to GnuTLS (e.g., it was entered at a pinpad).</p>
<h5 class="footnote-body-heading"><a id="FOOT12" href="#DOCF12">(12)</a></h5>
<p><a class="url" href="https://p11-glue.github.io/p11-glue/trust-module.html">https://p11-glue.github.io/p11-glue/trust-module.html</a></p>
<h5 class="footnote-body-heading"><a id="FOOT13" href="#DOCF13">(13)</a></h5>
<p>See
the ’Restricting the scope of CA certificates’ post at <a class="url" href="https://nmav.gnutls.org/2016/06/restricting-scope-of-ca-certificates.html">https://nmav.gnutls.org/2016/06/restricting-scope-of-ca-certificates.html</a></p>
<h5 class="footnote-body-heading"><a id="FOOT14" href="#DOCF14">(14)</a></h5>
<p><a class="url" href="https://github.com/google/chaps-linux">https://github.com/google/chaps-linux</a></p>
<h5 class="footnote-body-heading"><a id="FOOT15" href="#DOCF15">(15)</a></h5>
<p><a class="url" href="https://sourceforge.net/projects/opencryptoki/">https://sourceforge.net/projects/opencryptoki/</a></p>
<h5 class="footnote-body-heading"><a id="FOOT16" href="#DOCF16">(16)</a></h5>
<p>The first message in a <abbr class="acronym">TLS</abbr> handshake</p>
<h5 class="footnote-body-heading"><a id="FOOT17" href="#DOCF17">(17)</a></h5>
<p>On special systems
you could manually specify the locking system using
the function <a class="ref" href="#gnutls_005fglobal_005fset_005fmutex">gnutls_global_set_mutex</a> before calling any other
GnuTLS function. Setting mutexes manually is not recommended.</p>
<h5 class="footnote-body-heading"><a id="FOOT18" href="#DOCF18">(18)</a></h5>
<p>The original behavior of requiring explicit initialization can obtained by setting the
GNUTLS_NO_IMPLICIT_INIT environment variable to 1, or by using the macro GNUTLS_SKIP_GLOBAL_INIT
in a global section of your program –the latter works in systems with
support for weak symbols only.</p>
<h5 class="footnote-body-heading"><a id="FOOT19" href="#DOCF19">(19)</a></h5>
<p>A key of 128 bits or 16 bytes should be sufficient for this purpose.</p>
<h5 class="footnote-body-heading"><a id="FOOT20" href="#DOCF20">(20)</a></h5>
<p>It depends on the group in use. Groups with
less bits are always faster, but the number of bits ties with the security
parameter. See <a class="ref" href="#Selecting-cryptographic-key-sizes">Selecting cryptographic key sizes</a>
for the acceptable security levels.</p>
<h5 class="footnote-body-heading"><a id="FOOT21" href="#DOCF21">(21)</a></h5>
<p>See <a class="uref" href="https://www.lysator.liu.se/~nisse/nettle/">https://www.lysator.liu.se/~nisse/nettle/</a>.</p>
<h5 class="footnote-body-heading"><a id="FOOT22" href="#DOCF22">(22)</a></h5>
<p>See the nettle manual <a class="url" href="https://www.lysator.liu.se/~nisse/nettle/nettle.html">https://www.lysator.liu.se/~nisse/nettle/nettle.html</a></p>
<h5 class="footnote-body-heading"><a id="FOOT23" href="#DOCF23">(23)</a></h5>
<p>such as the
<code class="code">gnutls_certificate_credentials_t</code> structures</p>
<h5 class="footnote-body-heading"><a id="FOOT24" href="#DOCF24">(24)</a></h5>
<p>See
<a class="url" href="https://lists.gnu.org/archive/html/gnutls-devel/2011-02/msg00079.html">https://lists.gnu.org/archive/html/gnutls-devel/2011-02/msg00079.html</a>.</p>
<h5 class="footnote-body-heading"><a id="FOOT25" href="#DOCF25">(25)</a></h5>
<p>Check <a class="url" href="https://home.gna.org/cryptodev-linux/">https://home.gna.org/cryptodev-linux/</a>
for the Linux kernel implementation of <code class="code">/dev/crypto</code>.</p>
<h5 class="footnote-body-heading"><a id="FOOT26" href="#DOCF26">(26)</a></h5>
<p>see <a class="uref" href="https://www.kernel.org/doc/html/latest/process/coding-style.html">https://www.kernel.org/doc/html/latest/process/coding-style.html</a>.</p>
</div>
</body>
</html>
|