This file is indexed.

/usr/lib/python2.7/dist-packages/gnutls/library/functions.py is in python-gnutls 3.0.0-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
import sys
from ctypes import *

from gnutls.library import libgnutls
from gnutls.library.types import *


# Functions
#

gnutls_alert_get = libgnutls.gnutls_alert_get
gnutls_alert_get.argtypes = [gnutls_session_t]
gnutls_alert_get.restype = gnutls_alert_description_t

gnutls_alert_get_name = libgnutls.gnutls_alert_get_name
gnutls_alert_get_name.argtypes = [gnutls_alert_description_t]
gnutls_alert_get_name.restype = c_char_p

gnutls_alert_send = libgnutls.gnutls_alert_send
gnutls_alert_send.argtypes = [gnutls_session_t, gnutls_alert_level_t, gnutls_alert_description_t]
gnutls_alert_send.restype = c_int

gnutls_alert_send_appropriate = libgnutls.gnutls_alert_send_appropriate
gnutls_alert_send_appropriate.argtypes = [gnutls_session_t, c_int]
gnutls_alert_send_appropriate.restype = c_int

gnutls_anon_allocate_client_credentials = libgnutls.gnutls_anon_allocate_client_credentials
gnutls_anon_allocate_client_credentials.argtypes = [POINTER(gnutls_anon_client_credentials_t)]
gnutls_anon_allocate_client_credentials.restype = c_int

gnutls_anon_allocate_server_credentials = libgnutls.gnutls_anon_allocate_server_credentials
gnutls_anon_allocate_server_credentials.argtypes = [POINTER(gnutls_anon_server_credentials_t)]
gnutls_anon_allocate_server_credentials.restype = c_int

gnutls_anon_free_client_credentials = libgnutls.gnutls_anon_free_client_credentials
gnutls_anon_free_client_credentials.argtypes = [gnutls_anon_client_credentials_t]
gnutls_anon_free_client_credentials.restype = None

gnutls_anon_free_server_credentials = libgnutls.gnutls_anon_free_server_credentials
gnutls_anon_free_server_credentials.argtypes = [gnutls_anon_server_credentials_t]
gnutls_anon_free_server_credentials.restype = None

gnutls_anon_set_params_function = libgnutls.gnutls_anon_set_params_function
gnutls_anon_set_params_function.argtypes = [gnutls_anon_server_credentials_t, gnutls_params_function]
gnutls_anon_set_params_function.restype = None

gnutls_anon_set_server_dh_params = libgnutls.gnutls_anon_set_server_dh_params
gnutls_anon_set_server_dh_params.argtypes = [gnutls_anon_server_credentials_t, gnutls_dh_params_t]
gnutls_anon_set_server_dh_params.restype = None

gnutls_anon_set_server_params_function = libgnutls.gnutls_anon_set_server_params_function
gnutls_anon_set_server_params_function.argtypes = [gnutls_anon_server_credentials_t, gnutls_params_function]
gnutls_anon_set_server_params_function.restype = None

gnutls_auth_client_get_type = libgnutls.gnutls_auth_client_get_type
gnutls_auth_client_get_type.argtypes = [gnutls_session_t]
gnutls_auth_client_get_type.restype = gnutls_credentials_type_t

gnutls_auth_get_type = libgnutls.gnutls_auth_get_type
gnutls_auth_get_type.argtypes = [gnutls_session_t]
gnutls_auth_get_type.restype = gnutls_credentials_type_t

gnutls_auth_server_get_type = libgnutls.gnutls_auth_server_get_type
gnutls_auth_server_get_type.argtypes = [gnutls_session_t]
gnutls_auth_server_get_type.restype = gnutls_credentials_type_t

gnutls_bye = libgnutls.gnutls_bye
gnutls_bye.argtypes = [gnutls_session_t, gnutls_close_request_t]
gnutls_bye.restype = c_int

gnutls_certificate_activation_time_peers = libgnutls.gnutls_certificate_activation_time_peers
gnutls_certificate_activation_time_peers.argtypes = [gnutls_session_t]
gnutls_certificate_activation_time_peers.restype = time_t
gnutls_certificate_activation_time_peers.errmsg = "cannot get certificate activation time"

gnutls_certificate_allocate_credentials = libgnutls.gnutls_certificate_allocate_credentials
gnutls_certificate_allocate_credentials.argtypes = [POINTER(gnutls_certificate_credentials_t)]
gnutls_certificate_allocate_credentials.restype = c_int

gnutls_certificate_client_get_request_status = libgnutls.gnutls_certificate_client_get_request_status
gnutls_certificate_client_get_request_status.argtypes = [gnutls_session_t]
gnutls_certificate_client_get_request_status.restype = c_int

gnutls_certificate_set_retrieve_function = libgnutls.gnutls_certificate_set_retrieve_function
gnutls_certificate_set_retrieve_function.argtypes = [gnutls_certificate_credentials_t, gnutls_certificate_retrieve_function]
gnutls_certificate_set_retrieve_function.restype = None

gnutls_certificate_expiration_time_peers = libgnutls.gnutls_certificate_expiration_time_peers
gnutls_certificate_expiration_time_peers.argtypes = [gnutls_session_t]
gnutls_certificate_expiration_time_peers.restype = time_t
gnutls_certificate_expiration_time_peers.errmsg = "cannot get certificate expiration time"

gnutls_certificate_free_ca_names = libgnutls.gnutls_certificate_free_ca_names
gnutls_certificate_free_ca_names.argtypes = [gnutls_certificate_credentials_t]
gnutls_certificate_free_ca_names.restype = None

gnutls_certificate_free_cas = libgnutls.gnutls_certificate_free_cas
gnutls_certificate_free_cas.argtypes = [gnutls_certificate_credentials_t]
gnutls_certificate_free_cas.restype = None

gnutls_certificate_free_credentials = libgnutls.gnutls_certificate_free_credentials
gnutls_certificate_free_credentials.argtypes = [gnutls_certificate_credentials_t]
gnutls_certificate_free_credentials.restype = None

gnutls_certificate_free_crls = libgnutls.gnutls_certificate_free_crls
gnutls_certificate_free_crls.argtypes = [gnutls_certificate_credentials_t]
gnutls_certificate_free_crls.restype = None

gnutls_certificate_free_keys = libgnutls.gnutls_certificate_free_keys
gnutls_certificate_free_keys.argtypes = [gnutls_certificate_credentials_t]
gnutls_certificate_free_keys.restype = None

gnutls_certificate_get_ours = libgnutls.gnutls_certificate_get_ours
gnutls_certificate_get_ours.argtypes = [gnutls_session_t]
gnutls_certificate_get_ours.restype = POINTER(gnutls_datum_t)

gnutls_certificate_get_peers = libgnutls.gnutls_certificate_get_peers
gnutls_certificate_get_peers.argtypes = [gnutls_session_t, POINTER(c_uint)]
gnutls_certificate_get_peers.restype = POINTER(gnutls_datum_t)

gnutls_certificate_send_x509_rdn_sequence = libgnutls.gnutls_certificate_send_x509_rdn_sequence
gnutls_certificate_send_x509_rdn_sequence.argtypes = [gnutls_session_t, c_int]
gnutls_certificate_send_x509_rdn_sequence.restype = None

gnutls_certificate_server_set_request = libgnutls.gnutls_certificate_server_set_request
gnutls_certificate_server_set_request.argtypes = [gnutls_session_t, gnutls_certificate_request_t]
gnutls_certificate_server_set_request.restype = None

gnutls_certificate_set_dh_params = libgnutls.gnutls_certificate_set_dh_params
gnutls_certificate_set_dh_params.argtypes = [gnutls_certificate_credentials_t, gnutls_dh_params_t]
gnutls_certificate_set_dh_params.restype = None

gnutls_certificate_set_params_function = libgnutls.gnutls_certificate_set_params_function
gnutls_certificate_set_params_function.argtypes = [gnutls_certificate_credentials_t, gnutls_params_function]
gnutls_certificate_set_params_function.restype = None

gnutls_certificate_set_verify_flags = libgnutls.gnutls_certificate_set_verify_flags
gnutls_certificate_set_verify_flags.argtypes = [gnutls_certificate_credentials_t, c_uint]
gnutls_certificate_set_verify_flags.restype = None

gnutls_certificate_set_verify_limits = libgnutls.gnutls_certificate_set_verify_limits
gnutls_certificate_set_verify_limits.argtypes = [gnutls_certificate_credentials_t, c_uint, c_uint]
gnutls_certificate_set_verify_limits.restype = None

gnutls_certificate_set_x509_crl = libgnutls.gnutls_certificate_set_x509_crl
gnutls_certificate_set_x509_crl.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_x509_crl_t), c_int]
gnutls_certificate_set_x509_crl.restype = c_int

gnutls_certificate_set_x509_crl_file = libgnutls.gnutls_certificate_set_x509_crl_file
gnutls_certificate_set_x509_crl_file.argtypes = [gnutls_certificate_credentials_t, c_char_p, gnutls_x509_crt_fmt_t]
gnutls_certificate_set_x509_crl_file.restype = c_int

gnutls_certificate_set_x509_crl_mem = libgnutls.gnutls_certificate_set_x509_crl_mem
gnutls_certificate_set_x509_crl_mem.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_certificate_set_x509_crl_mem.restype = c_int

gnutls_certificate_set_x509_key = libgnutls.gnutls_certificate_set_x509_key
gnutls_certificate_set_x509_key.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_x509_crt_t), c_int, gnutls_x509_privkey_t]
gnutls_certificate_set_x509_key.restype = c_int

gnutls_certificate_set_x509_key_file = libgnutls.gnutls_certificate_set_x509_key_file
gnutls_certificate_set_x509_key_file.argtypes = [gnutls_certificate_credentials_t, c_char_p, c_char_p, gnutls_x509_crt_fmt_t]
gnutls_certificate_set_x509_key_file.restype = c_int

gnutls_certificate_set_x509_key_mem = libgnutls.gnutls_certificate_set_x509_key_mem
gnutls_certificate_set_x509_key_mem.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_certificate_set_x509_key_mem.restype = c_int

gnutls_certificate_set_x509_simple_pkcs12_file = libgnutls.gnutls_certificate_set_x509_simple_pkcs12_file
gnutls_certificate_set_x509_simple_pkcs12_file.argtypes = [gnutls_certificate_credentials_t, c_char_p, gnutls_x509_crt_fmt_t, c_char_p]
gnutls_certificate_set_x509_simple_pkcs12_file.restype = c_int

gnutls_certificate_set_x509_trust = libgnutls.gnutls_certificate_set_x509_trust
gnutls_certificate_set_x509_trust.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_x509_crt_t), c_int]
gnutls_certificate_set_x509_trust.restype = c_int

gnutls_certificate_set_x509_trust_file = libgnutls.gnutls_certificate_set_x509_trust_file
gnutls_certificate_set_x509_trust_file.argtypes = [gnutls_certificate_credentials_t, c_char_p, gnutls_x509_crt_fmt_t]
gnutls_certificate_set_x509_trust_file.restype = c_int

gnutls_certificate_set_x509_trust_mem = libgnutls.gnutls_certificate_set_x509_trust_mem
gnutls_certificate_set_x509_trust_mem.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_certificate_set_x509_trust_mem.restype = c_int

gnutls_certificate_type_get = libgnutls.gnutls_certificate_type_get
gnutls_certificate_type_get.argtypes = [gnutls_session_t]
gnutls_certificate_type_get.restype = gnutls_certificate_type_t

gnutls_certificate_type_get_id = libgnutls.gnutls_certificate_type_get_id
gnutls_certificate_type_get_id.argtypes = [c_char_p]
gnutls_certificate_type_get_id.restype = gnutls_certificate_type_t

gnutls_certificate_type_get_name = libgnutls.gnutls_certificate_type_get_name
gnutls_certificate_type_get_name.argtypes = [gnutls_certificate_type_t]
gnutls_certificate_type_get_name.restype = c_char_p

gnutls_certificate_type_list = libgnutls.gnutls_certificate_type_list
gnutls_certificate_type_list.argtypes = []
gnutls_certificate_type_list.restype = POINTER(gnutls_certificate_type_t)

gnutls_certificate_verify_peers2 = libgnutls.gnutls_certificate_verify_peers2
gnutls_certificate_verify_peers2.argtypes = [gnutls_session_t, POINTER(c_uint)]
gnutls_certificate_verify_peers2.restype = c_int

gnutls_certificate_verify_peers3 = libgnutls.gnutls_certificate_verify_peers3
gnutls_certificate_verify_peers3.argtypes = [gnutls_session_t, c_char_p, POINTER(c_uint)]
gnutls_certificate_verify_peers3.restype = c_int

gnutls_check_version = libgnutls.gnutls_check_version
gnutls_check_version.argtypes = [c_char_p]
gnutls_check_version.restype = c_char_p

gnutls_cipher_get = libgnutls.gnutls_cipher_get
gnutls_cipher_get.argtypes = [gnutls_session_t]
gnutls_cipher_get.restype = gnutls_cipher_algorithm_t

gnutls_cipher_get_id = libgnutls.gnutls_cipher_get_id
gnutls_cipher_get_id.argtypes = [c_char_p]
gnutls_cipher_get_id.restype = gnutls_cipher_algorithm_t

gnutls_cipher_get_key_size = libgnutls.gnutls_cipher_get_key_size
gnutls_cipher_get_key_size.argtypes = [gnutls_cipher_algorithm_t]
gnutls_cipher_get_key_size.restype = size_t

gnutls_cipher_get_name = libgnutls.gnutls_cipher_get_name
gnutls_cipher_get_name.argtypes = [gnutls_cipher_algorithm_t]
gnutls_cipher_get_name.restype = c_char_p

gnutls_cipher_list = libgnutls.gnutls_cipher_list
gnutls_cipher_list.argtypes = []
gnutls_cipher_list.restype = POINTER(gnutls_cipher_algorithm_t)

gnutls_cipher_suite_get_name = libgnutls.gnutls_cipher_suite_get_name
gnutls_cipher_suite_get_name.argtypes = [gnutls_kx_algorithm_t, gnutls_cipher_algorithm_t, gnutls_mac_algorithm_t]
gnutls_cipher_suite_get_name.restype = c_char_p

gnutls_cipher_suite_info = libgnutls.gnutls_cipher_suite_info
gnutls_cipher_suite_info.argtypes = [size_t, c_char_p, POINTER(gnutls_kx_algorithm_t), POINTER(gnutls_cipher_algorithm_t), POINTER(gnutls_mac_algorithm_t), POINTER(gnutls_protocol_t)]
gnutls_cipher_suite_info.restype = c_char_p

gnutls_compression_get = libgnutls.gnutls_compression_get
gnutls_compression_get.argtypes = [gnutls_session_t]
gnutls_compression_get.restype = gnutls_compression_method_t

gnutls_compression_get_id = libgnutls.gnutls_compression_get_id
gnutls_compression_get_id.argtypes = [c_char_p]
gnutls_compression_get_id.restype = gnutls_compression_method_t

gnutls_compression_get_name = libgnutls.gnutls_compression_get_name
gnutls_compression_get_name.argtypes = [gnutls_compression_method_t]
gnutls_compression_get_name.restype = c_char_p

gnutls_compression_list = libgnutls.gnutls_compression_list
gnutls_compression_list.argtypes = []
gnutls_compression_list.restype = POINTER(gnutls_compression_method_t)

gnutls_credentials_clear = libgnutls.gnutls_credentials_clear
gnutls_credentials_clear.argtypes = [gnutls_session_t]
gnutls_credentials_clear.restype = None

gnutls_credentials_set = libgnutls.gnutls_credentials_set
gnutls_credentials_set.argtypes = [gnutls_session_t, gnutls_credentials_type_t, c_void_p]
gnutls_credentials_set.restype = c_int

gnutls_db_check_entry = libgnutls.gnutls_db_check_entry
gnutls_db_check_entry.argtypes = [gnutls_session_t, gnutls_datum_t]
gnutls_db_check_entry.restype = c_int

gnutls_db_get_ptr = libgnutls.gnutls_db_get_ptr
gnutls_db_get_ptr.argtypes = [gnutls_session_t]
gnutls_db_get_ptr.restype = c_void_p

gnutls_db_remove_session = libgnutls.gnutls_db_remove_session
gnutls_db_remove_session.argtypes = [gnutls_session_t]
gnutls_db_remove_session.restype = None

gnutls_db_set_cache_expiration = libgnutls.gnutls_db_set_cache_expiration
gnutls_db_set_cache_expiration.argtypes = [gnutls_session_t, c_int]
gnutls_db_set_cache_expiration.restype = None

gnutls_db_set_ptr = libgnutls.gnutls_db_set_ptr
gnutls_db_set_ptr.argtypes = [gnutls_session_t, c_void_p]
gnutls_db_set_ptr.restype = None

gnutls_db_set_remove_function = libgnutls.gnutls_db_set_remove_function
gnutls_db_set_remove_function.argtypes = [gnutls_session_t, gnutls_db_remove_func]
gnutls_db_set_remove_function.restype = None

gnutls_db_set_retrieve_function = libgnutls.gnutls_db_set_retrieve_function
gnutls_db_set_retrieve_function.argtypes = [gnutls_session_t, gnutls_db_retr_func]
gnutls_db_set_retrieve_function.restype = None

gnutls_db_set_store_function = libgnutls.gnutls_db_set_store_function
gnutls_db_set_store_function.argtypes = [gnutls_session_t, gnutls_db_store_func]
gnutls_db_set_store_function.restype = None

gnutls_deinit = libgnutls.gnutls_deinit
gnutls_deinit.argtypes = [gnutls_session_t]
gnutls_deinit.restype = None

gnutls_dh_get_group = libgnutls.gnutls_dh_get_group
gnutls_dh_get_group.argtypes = [gnutls_session_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_dh_get_group.restype = c_int

gnutls_dh_get_peers_public_bits = libgnutls.gnutls_dh_get_peers_public_bits
gnutls_dh_get_peers_public_bits.argtypes = [gnutls_session_t]
gnutls_dh_get_peers_public_bits.restype = c_int

gnutls_dh_get_prime_bits = libgnutls.gnutls_dh_get_prime_bits
gnutls_dh_get_prime_bits.argtypes = [gnutls_session_t]
gnutls_dh_get_prime_bits.restype = c_int

gnutls_dh_get_pubkey = libgnutls.gnutls_dh_get_pubkey
gnutls_dh_get_pubkey.argtypes = [gnutls_session_t, POINTER(gnutls_datum_t)]
gnutls_dh_get_pubkey.restype = c_int

gnutls_dh_get_secret_bits = libgnutls.gnutls_dh_get_secret_bits
gnutls_dh_get_secret_bits.argtypes = [gnutls_session_t]
gnutls_dh_get_secret_bits.restype = c_int

gnutls_dh_params_cpy = libgnutls.gnutls_dh_params_cpy
gnutls_dh_params_cpy.argtypes = [gnutls_dh_params_t, gnutls_dh_params_t]
gnutls_dh_params_cpy.restype = c_int

gnutls_dh_params_deinit = libgnutls.gnutls_dh_params_deinit
gnutls_dh_params_deinit.argtypes = [gnutls_dh_params_t]
gnutls_dh_params_deinit.restype = None

gnutls_dh_params_export_pkcs3 = libgnutls.gnutls_dh_params_export_pkcs3
gnutls_dh_params_export_pkcs3.argtypes = [gnutls_dh_params_t, gnutls_x509_crt_fmt_t, POINTER(c_ubyte), POINTER(size_t)]
gnutls_dh_params_export_pkcs3.restype = c_int

gnutls_dh_params_export_raw = libgnutls.gnutls_dh_params_export_raw
gnutls_dh_params_export_raw.argtypes = [gnutls_dh_params_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(c_uint)]
gnutls_dh_params_export_raw.restype = c_int

gnutls_dh_params_generate2 = libgnutls.gnutls_dh_params_generate2
gnutls_dh_params_generate2.argtypes = [gnutls_dh_params_t, c_uint]
gnutls_dh_params_generate2.restype = c_int

gnutls_dh_params_import_pkcs3 = libgnutls.gnutls_dh_params_import_pkcs3
gnutls_dh_params_import_pkcs3.argtypes = [gnutls_dh_params_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_dh_params_import_pkcs3.restype = c_int

gnutls_dh_params_import_raw = libgnutls.gnutls_dh_params_import_raw
gnutls_dh_params_import_raw.argtypes = [gnutls_dh_params_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_dh_params_import_raw.restype = c_int

gnutls_dh_params_init = libgnutls.gnutls_dh_params_init
gnutls_dh_params_init.argtypes = [POINTER(gnutls_dh_params_t)]
gnutls_dh_params_init.restype = c_int

gnutls_dh_set_prime_bits = libgnutls.gnutls_dh_set_prime_bits
gnutls_dh_set_prime_bits.argtypes = [gnutls_session_t, c_uint]
gnutls_dh_set_prime_bits.restype = None

gnutls_error_is_fatal = libgnutls.gnutls_error_is_fatal
gnutls_error_is_fatal.argtypes = [c_int]
gnutls_error_is_fatal.restype = c_int

gnutls_error_to_alert = libgnutls.gnutls_error_to_alert
gnutls_error_to_alert.argtypes = [c_int, POINTER(c_int)]
gnutls_error_to_alert.restype = c_int

gnutls_fingerprint = libgnutls.gnutls_fingerprint
gnutls_fingerprint.argtypes = [gnutls_digest_algorithm_t, POINTER(gnutls_datum_t), c_void_p, POINTER(size_t)]
gnutls_fingerprint.restype = c_int

gnutls_global_deinit = libgnutls.gnutls_global_deinit
gnutls_global_deinit.argtypes = []
gnutls_global_deinit.restype = None

gnutls_global_init = libgnutls.gnutls_global_init
gnutls_global_init.argtypes = []
gnutls_global_init.restype = c_int

gnutls_global_set_log_function = libgnutls.gnutls_global_set_log_function
gnutls_global_set_log_function.argtypes = [gnutls_log_func]
gnutls_global_set_log_function.restype = None

gnutls_global_set_log_level = libgnutls.gnutls_global_set_log_level
gnutls_global_set_log_level.argtypes = [c_int]
gnutls_global_set_log_level.restype = None

gnutls_global_set_mem_functions = libgnutls.gnutls_global_set_mem_functions
gnutls_global_set_mem_functions.argtypes = [gnutls_alloc_function, gnutls_alloc_function, gnutls_is_secure_function, gnutls_realloc_function, gnutls_free_function]
gnutls_global_set_mem_functions.restype = None

gnutls_handshake = libgnutls.gnutls_handshake
gnutls_handshake.argtypes = [gnutls_session_t]
gnutls_handshake.restype = c_int

gnutls_handshake_get_last_in = libgnutls.gnutls_handshake_get_last_in
gnutls_handshake_get_last_in.argtypes = [gnutls_session_t]
gnutls_handshake_get_last_in.restype = gnutls_handshake_description_t

gnutls_handshake_get_last_out = libgnutls.gnutls_handshake_get_last_out
gnutls_handshake_get_last_out.argtypes = [gnutls_session_t]
gnutls_handshake_get_last_out.restype = gnutls_handshake_description_t

gnutls_handshake_set_max_packet_length = libgnutls.gnutls_handshake_set_max_packet_length
gnutls_handshake_set_max_packet_length.argtypes = [gnutls_session_t, size_t]
gnutls_handshake_set_max_packet_length.restype = None

gnutls_handshake_set_post_client_hello_function = libgnutls.gnutls_handshake_set_post_client_hello_function
gnutls_handshake_set_post_client_hello_function.argtypes = [gnutls_session_t, gnutls_handshake_post_client_hello_func]
gnutls_handshake_set_post_client_hello_function.restype = None

gnutls_handshake_set_private_extensions = libgnutls.gnutls_handshake_set_private_extensions
gnutls_handshake_set_private_extensions.argtypes = [gnutls_session_t, c_int]
gnutls_handshake_set_private_extensions.restype = None

gnutls_hex2bin = libgnutls.gnutls_hex2bin
gnutls_hex2bin.argtypes = [c_char_p, size_t, c_char_p, POINTER(size_t)]
gnutls_hex2bin.restype = c_int

gnutls_hex_decode = libgnutls.gnutls_hex_decode
gnutls_hex_decode.argtypes = [POINTER(gnutls_datum_t), c_char_p, POINTER(size_t)]
gnutls_hex_decode.restype = c_int

gnutls_hex_encode = libgnutls.gnutls_hex_encode
gnutls_hex_encode.argtypes = [POINTER(gnutls_datum_t), c_char_p, POINTER(size_t)]
gnutls_hex_encode.restype = c_int

gnutls_init = libgnutls.gnutls_init
gnutls_init.argtypes = [POINTER(gnutls_session_t), gnutls_connection_end_t]
gnutls_init.restype = c_int

gnutls_kx_get = libgnutls.gnutls_kx_get
gnutls_kx_get.argtypes = [gnutls_session_t]
gnutls_kx_get.restype = gnutls_kx_algorithm_t

gnutls_kx_get_id = libgnutls.gnutls_kx_get_id
gnutls_kx_get_id.argtypes = [c_char_p]
gnutls_kx_get_id.restype = gnutls_kx_algorithm_t

gnutls_kx_get_name = libgnutls.gnutls_kx_get_name
gnutls_kx_get_name.argtypes = [gnutls_kx_algorithm_t]
gnutls_kx_get_name.restype = c_char_p

gnutls_kx_list = libgnutls.gnutls_kx_list
gnutls_kx_list.argtypes = []
gnutls_kx_list.restype = POINTER(gnutls_kx_algorithm_t)

gnutls_mac_get = libgnutls.gnutls_mac_get
gnutls_mac_get.argtypes = [gnutls_session_t]
gnutls_mac_get.restype = gnutls_mac_algorithm_t

gnutls_mac_get_id = libgnutls.gnutls_mac_get_id
gnutls_mac_get_id.argtypes = [c_char_p]
gnutls_mac_get_id.restype = gnutls_mac_algorithm_t

gnutls_mac_get_key_size = libgnutls.gnutls_mac_get_key_size
gnutls_mac_get_key_size.argtypes = [gnutls_mac_algorithm_t]
gnutls_mac_get_key_size.restype = size_t

gnutls_mac_get_name = libgnutls.gnutls_mac_get_name
gnutls_mac_get_name.argtypes = [gnutls_mac_algorithm_t]
gnutls_mac_get_name.restype = c_char_p

gnutls_mac_list = libgnutls.gnutls_mac_list
gnutls_mac_list.argtypes = []
gnutls_mac_list.restype = POINTER(gnutls_mac_algorithm_t)

gnutls_pem_base64_decode = libgnutls.gnutls_pem_base64_decode
gnutls_pem_base64_decode.argtypes = [c_char_p, POINTER(gnutls_datum_t), POINTER(c_ubyte), POINTER(size_t)]
gnutls_pem_base64_decode.restype = c_int

gnutls_pem_base64_encode = libgnutls.gnutls_pem_base64_encode
gnutls_pem_base64_encode.argtypes = [c_char_p, POINTER(gnutls_datum_t), c_char_p, POINTER(size_t)]
gnutls_pem_base64_encode.restype = c_int

gnutls_perror = libgnutls.gnutls_perror
gnutls_perror.argtypes = [c_int]
gnutls_perror.restype = None

gnutls_pk_algorithm_get_name = libgnutls.gnutls_pk_algorithm_get_name
gnutls_pk_algorithm_get_name.argtypes = [gnutls_pk_algorithm_t]
gnutls_pk_algorithm_get_name.restype = c_char_p

gnutls_pkcs7_deinit = libgnutls.gnutls_pkcs7_deinit
gnutls_pkcs7_deinit.argtypes = [gnutls_pkcs7_t]
gnutls_pkcs7_deinit.restype = None

gnutls_pkcs7_delete_crl = libgnutls.gnutls_pkcs7_delete_crl
gnutls_pkcs7_delete_crl.argtypes = [gnutls_pkcs7_t, c_int]
gnutls_pkcs7_delete_crl.restype = c_int

gnutls_pkcs7_delete_crt = libgnutls.gnutls_pkcs7_delete_crt
gnutls_pkcs7_delete_crt.argtypes = [gnutls_pkcs7_t, c_int]
gnutls_pkcs7_delete_crt.restype = c_int

gnutls_pkcs7_export = libgnutls.gnutls_pkcs7_export
gnutls_pkcs7_export.argtypes = [gnutls_pkcs7_t, gnutls_x509_crt_fmt_t, c_void_p, POINTER(size_t)]
gnutls_pkcs7_export.restype = c_int

gnutls_pkcs7_get_crl_count = libgnutls.gnutls_pkcs7_get_crl_count
gnutls_pkcs7_get_crl_count.argtypes = [gnutls_pkcs7_t]
gnutls_pkcs7_get_crl_count.restype = c_int

gnutls_pkcs7_get_crl_raw = libgnutls.gnutls_pkcs7_get_crl_raw
gnutls_pkcs7_get_crl_raw.argtypes = [gnutls_pkcs7_t, c_int, c_void_p, POINTER(size_t)]
gnutls_pkcs7_get_crl_raw.restype = c_int

gnutls_pkcs7_get_crt_count = libgnutls.gnutls_pkcs7_get_crt_count
gnutls_pkcs7_get_crt_count.argtypes = [gnutls_pkcs7_t]
gnutls_pkcs7_get_crt_count.restype = c_int

gnutls_pkcs7_get_crt_raw = libgnutls.gnutls_pkcs7_get_crt_raw
gnutls_pkcs7_get_crt_raw.argtypes = [gnutls_pkcs7_t, c_int, c_void_p, POINTER(size_t)]
gnutls_pkcs7_get_crt_raw.restype = c_int

gnutls_pkcs7_import = libgnutls.gnutls_pkcs7_import
gnutls_pkcs7_import.argtypes = [gnutls_pkcs7_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_pkcs7_import.restype = c_int

gnutls_pkcs7_init = libgnutls.gnutls_pkcs7_init
gnutls_pkcs7_init.argtypes = [POINTER(gnutls_pkcs7_t)]
gnutls_pkcs7_init.restype = c_int

gnutls_pkcs7_set_crl = libgnutls.gnutls_pkcs7_set_crl
gnutls_pkcs7_set_crl.argtypes = [gnutls_pkcs7_t, gnutls_x509_crl_t]
gnutls_pkcs7_set_crl.restype = c_int

gnutls_pkcs7_set_crl_raw = libgnutls.gnutls_pkcs7_set_crl_raw
gnutls_pkcs7_set_crl_raw.argtypes = [gnutls_pkcs7_t, POINTER(gnutls_datum_t)]
gnutls_pkcs7_set_crl_raw.restype = c_int

gnutls_pkcs7_set_crt = libgnutls.gnutls_pkcs7_set_crt
gnutls_pkcs7_set_crt.argtypes = [gnutls_pkcs7_t, gnutls_x509_crt_t]
gnutls_pkcs7_set_crt.restype = c_int

gnutls_pkcs7_set_crt_raw = libgnutls.gnutls_pkcs7_set_crt_raw
gnutls_pkcs7_set_crt_raw.argtypes = [gnutls_pkcs7_t, POINTER(gnutls_datum_t)]
gnutls_pkcs7_set_crt_raw.restype = c_int

gnutls_prf = libgnutls.gnutls_prf
gnutls_prf.argtypes = [gnutls_session_t, size_t, c_char_p, c_int, size_t, c_char_p, size_t, c_char_p]
gnutls_prf.restype = c_int

gnutls_prf_raw = libgnutls.gnutls_prf_raw
gnutls_prf_raw.argtypes = [gnutls_session_t, size_t, c_char_p, size_t, c_char_p, size_t, c_char_p]
gnutls_prf_raw.restype = c_int

gnutls_priority_deinit = libgnutls.gnutls_priority_deinit
gnutls_priority_deinit.argtypes = [gnutls_priority_t]
gnutls_priority_deinit.restype = None

gnutls_priority_init = libgnutls.gnutls_priority_init
gnutls_priority_init.argtypes = [POINTER(gnutls_priority_t), c_char_p, POINTER(c_char_p)]
gnutls_priority_init.restype = c_int

gnutls_priority_set = libgnutls.gnutls_priority_set
gnutls_priority_set.argtypes = [gnutls_session_t, gnutls_priority_t]
gnutls_priority_set.restype = c_int

gnutls_priority_set_direct = libgnutls.gnutls_priority_set_direct
gnutls_priority_set_direct.argtypes = [gnutls_session_t, c_char_p, POINTER(c_char_p)]
gnutls_priority_set_direct.restype = c_int

gnutls_protocol_get_id = libgnutls.gnutls_protocol_get_id
gnutls_protocol_get_id.argtypes = [c_char_p]
gnutls_protocol_get_id.restype = gnutls_protocol_t

gnutls_protocol_get_name = libgnutls.gnutls_protocol_get_name
gnutls_protocol_get_name.argtypes = [gnutls_protocol_t]
gnutls_protocol_get_name.restype = c_char_p

gnutls_protocol_get_version = libgnutls.gnutls_protocol_get_version
gnutls_protocol_get_version.argtypes = [gnutls_session_t]
gnutls_protocol_get_version.restype = gnutls_protocol_t

gnutls_protocol_list = libgnutls.gnutls_protocol_list
gnutls_protocol_list.argtypes = []
gnutls_protocol_list.restype = POINTER(gnutls_protocol_t)

gnutls_psk_allocate_client_credentials = libgnutls.gnutls_psk_allocate_client_credentials
gnutls_psk_allocate_client_credentials.argtypes = [POINTER(gnutls_psk_client_credentials_t)]
gnutls_psk_allocate_client_credentials.restype = c_int

gnutls_psk_allocate_server_credentials = libgnutls.gnutls_psk_allocate_server_credentials
gnutls_psk_allocate_server_credentials.argtypes = [POINTER(gnutls_psk_server_credentials_t)]
gnutls_psk_allocate_server_credentials.restype = c_int

gnutls_psk_client_get_hint = libgnutls.gnutls_psk_client_get_hint
gnutls_psk_client_get_hint.argtypes = [gnutls_session_t]
gnutls_psk_client_get_hint.restype = c_char_p

gnutls_psk_free_client_credentials = libgnutls.gnutls_psk_free_client_credentials
gnutls_psk_free_client_credentials.argtypes = [gnutls_psk_client_credentials_t]
gnutls_psk_free_client_credentials.restype = None

gnutls_psk_free_server_credentials = libgnutls.gnutls_psk_free_server_credentials
gnutls_psk_free_server_credentials.argtypes = [gnutls_psk_server_credentials_t]
gnutls_psk_free_server_credentials.restype = None

gnutls_psk_server_get_username = libgnutls.gnutls_psk_server_get_username
gnutls_psk_server_get_username.argtypes = [gnutls_session_t]
gnutls_psk_server_get_username.restype = c_char_p

gnutls_psk_set_client_credentials = libgnutls.gnutls_psk_set_client_credentials
gnutls_psk_set_client_credentials.argtypes = [gnutls_psk_client_credentials_t, c_char_p, POINTER(gnutls_datum_t), gnutls_psk_key_flags]
gnutls_psk_set_client_credentials.restype = c_int

gnutls_psk_set_client_credentials_function = libgnutls.gnutls_psk_set_client_credentials_function
gnutls_psk_set_client_credentials_function.argtypes = [gnutls_psk_client_credentials_t, gnutls_psk_client_credentials_function]
gnutls_psk_set_client_credentials_function.restype = None

gnutls_psk_set_params_function = libgnutls.gnutls_psk_set_params_function
gnutls_psk_set_params_function.argtypes = [gnutls_psk_server_credentials_t, gnutls_params_function]
gnutls_psk_set_params_function.restype = None

gnutls_psk_set_server_credentials_file = libgnutls.gnutls_psk_set_server_credentials_file
gnutls_psk_set_server_credentials_file.argtypes = [gnutls_psk_server_credentials_t, c_char_p]
gnutls_psk_set_server_credentials_file.restype = c_int

gnutls_psk_set_server_credentials_function = libgnutls.gnutls_psk_set_server_credentials_function
gnutls_psk_set_server_credentials_function.argtypes = [gnutls_psk_server_credentials_t, gnutls_psk_server_credentials_function]
gnutls_psk_set_server_credentials_function.restype = None

gnutls_psk_set_server_credentials_hint = libgnutls.gnutls_psk_set_server_credentials_hint
gnutls_psk_set_server_credentials_hint.argtypes = [gnutls_psk_server_credentials_t, c_char_p]
gnutls_psk_set_server_credentials_hint.restype = c_int

gnutls_psk_set_server_dh_params = libgnutls.gnutls_psk_set_server_dh_params
gnutls_psk_set_server_dh_params.argtypes = [gnutls_psk_server_credentials_t, gnutls_dh_params_t]
gnutls_psk_set_server_dh_params.restype = None

gnutls_psk_set_server_params_function = libgnutls.gnutls_psk_set_server_params_function
gnutls_psk_set_server_params_function.argtypes = [gnutls_psk_server_credentials_t, gnutls_params_function]
gnutls_psk_set_server_params_function.restype = None

gnutls_record_check_pending = libgnutls.gnutls_record_check_pending
gnutls_record_check_pending.argtypes = [gnutls_session_t]
gnutls_record_check_pending.restype = size_t

gnutls_record_disable_padding = libgnutls.gnutls_record_disable_padding
gnutls_record_disable_padding.argtypes = [gnutls_session_t]
gnutls_record_disable_padding.restype = None

gnutls_record_get_direction = libgnutls.gnutls_record_get_direction
gnutls_record_get_direction.argtypes = [gnutls_session_t]
gnutls_record_get_direction.restype = c_int

gnutls_record_get_max_size = libgnutls.gnutls_record_get_max_size
gnutls_record_get_max_size.argtypes = [gnutls_session_t]
gnutls_record_get_max_size.restype = size_t

gnutls_record_recv = libgnutls.gnutls_record_recv
gnutls_record_recv.argtypes = [gnutls_session_t, c_void_p, size_t]
gnutls_record_recv.restype = ssize_t

gnutls_record_send = libgnutls.gnutls_record_send
gnutls_record_send.argtypes = [gnutls_session_t, c_void_p, size_t]
gnutls_record_send.restype = ssize_t

gnutls_record_set_max_size = libgnutls.gnutls_record_set_max_size
gnutls_record_set_max_size.argtypes = [gnutls_session_t, size_t]
gnutls_record_set_max_size.restype = ssize_t

gnutls_rehandshake = libgnutls.gnutls_rehandshake
gnutls_rehandshake.argtypes = [gnutls_session_t]
gnutls_rehandshake.restype = c_int

gnutls_server_name_get = libgnutls.gnutls_server_name_get
gnutls_server_name_get.argtypes = [gnutls_session_t, c_void_p, POINTER(size_t), POINTER(c_uint), c_uint]
gnutls_server_name_get.restype = c_int

gnutls_server_name_set = libgnutls.gnutls_server_name_set
gnutls_server_name_set.argtypes = [gnutls_session_t, gnutls_server_name_type_t, c_void_p, size_t]
gnutls_server_name_set.restype = c_int

gnutls_session_enable_compatibility_mode = libgnutls.gnutls_session_enable_compatibility_mode
gnutls_session_enable_compatibility_mode.argtypes = [gnutls_session_t]
gnutls_session_enable_compatibility_mode.restype = None

gnutls_session_get_data = libgnutls.gnutls_session_get_data
gnutls_session_get_data.argtypes = [gnutls_session_t, c_void_p, POINTER(size_t)]
gnutls_session_get_data.restype = c_int

gnutls_session_get_data2 = libgnutls.gnutls_session_get_data2
gnutls_session_get_data2.argtypes = [gnutls_session_t, POINTER(gnutls_datum_t)]
gnutls_session_get_data2.restype = c_int

gnutls_session_get_id = libgnutls.gnutls_session_get_id
gnutls_session_get_id.argtypes = [gnutls_session_t, c_void_p, POINTER(size_t)]
gnutls_session_get_id.restype = c_int

gnutls_session_get_ptr = libgnutls.gnutls_session_get_ptr
gnutls_session_get_ptr.argtypes = [gnutls_session_t]
gnutls_session_get_ptr.restype = c_void_p

gnutls_session_is_resumed = libgnutls.gnutls_session_is_resumed
gnutls_session_is_resumed.argtypes = [gnutls_session_t]
gnutls_session_is_resumed.restype = c_int

gnutls_session_set_data = libgnutls.gnutls_session_set_data
gnutls_session_set_data.argtypes = [gnutls_session_t, c_void_p, size_t]
gnutls_session_set_data.restype = c_int

gnutls_session_set_ptr = libgnutls.gnutls_session_set_ptr
gnutls_session_set_ptr.argtypes = [gnutls_session_t, c_void_p]
gnutls_session_set_ptr.restype = None

gnutls_set_default_priority = libgnutls.gnutls_set_default_priority
gnutls_set_default_priority.argtypes = [gnutls_session_t]
gnutls_set_default_priority.restype = c_int

gnutls_sign_get_name = libgnutls.gnutls_sign_get_name
gnutls_sign_get_name.argtypes = [gnutls_sign_algorithm_t]
gnutls_sign_get_name.restype = c_char_p

gnutls_strerror = libgnutls.gnutls_strerror
gnutls_strerror.argtypes = [c_int]
gnutls_strerror.restype = c_char_p

gnutls_supplemental_get_name = libgnutls.gnutls_supplemental_get_name
gnutls_supplemental_get_name.argtypes = [gnutls_supplemental_data_format_type_t]
gnutls_supplemental_get_name.restype = c_char_p

gnutls_transport_get_ptr = libgnutls.gnutls_transport_get_ptr
gnutls_transport_get_ptr.argtypes = [gnutls_session_t]
gnutls_transport_get_ptr.restype = gnutls_transport_ptr_t

gnutls_transport_get_ptr2 = libgnutls.gnutls_transport_get_ptr2
gnutls_transport_get_ptr2.argtypes = [gnutls_session_t, POINTER(gnutls_transport_ptr_t), POINTER(gnutls_transport_ptr_t)]
gnutls_transport_get_ptr2.restype = None

gnutls_transport_set_errno = libgnutls.gnutls_transport_set_errno
gnutls_transport_set_errno.argtypes = [gnutls_session_t, c_int]
gnutls_transport_set_errno.restype = None

gnutls_transport_set_ptr = libgnutls.gnutls_transport_set_ptr
gnutls_transport_set_ptr.argtypes = [gnutls_session_t, gnutls_transport_ptr_t]
gnutls_transport_set_ptr.restype = None

gnutls_transport_set_ptr2 = libgnutls.gnutls_transport_set_ptr2
gnutls_transport_set_ptr2.argtypes = [gnutls_session_t, gnutls_transport_ptr_t, gnutls_transport_ptr_t]
gnutls_transport_set_ptr2.restype = None

gnutls_transport_set_pull_function = libgnutls.gnutls_transport_set_pull_function
gnutls_transport_set_pull_function.argtypes = [gnutls_session_t, gnutls_pull_func]
gnutls_transport_set_pull_function.restype = None

gnutls_transport_set_push_function = libgnutls.gnutls_transport_set_push_function
gnutls_transport_set_push_function.argtypes = [gnutls_session_t, gnutls_push_func]
gnutls_transport_set_push_function.restype = None

gnutls_x509_crl_check_issuer = libgnutls.gnutls_x509_crl_check_issuer
gnutls_x509_crl_check_issuer.argtypes = [gnutls_x509_crl_t, gnutls_x509_crt_t]
gnutls_x509_crl_check_issuer.restype = c_int

gnutls_x509_crl_deinit = libgnutls.gnutls_x509_crl_deinit
gnutls_x509_crl_deinit.argtypes = [gnutls_x509_crl_t]
gnutls_x509_crl_deinit.restype = None

gnutls_x509_crl_export = libgnutls.gnutls_x509_crl_export
gnutls_x509_crl_export.argtypes = [gnutls_x509_crl_t, gnutls_x509_crt_fmt_t, c_void_p, POINTER(size_t)]
gnutls_x509_crl_export.restype = c_int

gnutls_x509_crl_get_crt_count = libgnutls.gnutls_x509_crl_get_crt_count
gnutls_x509_crl_get_crt_count.argtypes = [gnutls_x509_crl_t]
gnutls_x509_crl_get_crt_count.restype = c_int

gnutls_x509_crl_get_crt_serial = libgnutls.gnutls_x509_crl_get_crt_serial
gnutls_x509_crl_get_crt_serial.argtypes = [gnutls_x509_crl_t, c_int, POINTER(c_ubyte), POINTER(size_t), POINTER(time_t)]
gnutls_x509_crl_get_crt_serial.restype = c_int

gnutls_x509_crl_get_dn_oid = libgnutls.gnutls_x509_crl_get_dn_oid
gnutls_x509_crl_get_dn_oid.argtypes = [gnutls_x509_crl_t, c_int, c_void_p, POINTER(size_t)]
gnutls_x509_crl_get_dn_oid.restype = c_int

gnutls_x509_crl_get_issuer_dn = libgnutls.gnutls_x509_crl_get_issuer_dn
gnutls_x509_crl_get_issuer_dn.argtypes = [gnutls_x509_crl_t, c_char_p, POINTER(size_t)]
gnutls_x509_crl_get_issuer_dn.restype = c_int

gnutls_x509_crl_get_issuer_dn_by_oid = libgnutls.gnutls_x509_crl_get_issuer_dn_by_oid
gnutls_x509_crl_get_issuer_dn_by_oid.argtypes = [gnutls_x509_crl_t, c_char_p, c_int, c_uint, c_void_p, POINTER(size_t)]
gnutls_x509_crl_get_issuer_dn_by_oid.restype = c_int

gnutls_x509_crl_get_next_update = libgnutls.gnutls_x509_crl_get_next_update
gnutls_x509_crl_get_next_update.argtypes = [gnutls_x509_crl_t]
gnutls_x509_crl_get_next_update.restype = time_t
gnutls_x509_crl_get_next_update.errmsg = "cannot get CRL's next update time"

gnutls_x509_crl_get_signature = libgnutls.gnutls_x509_crl_get_signature
gnutls_x509_crl_get_signature.argtypes = [gnutls_x509_crl_t, c_char_p, POINTER(size_t)]
gnutls_x509_crl_get_signature.restype = c_int

gnutls_x509_crl_get_signature_algorithm = libgnutls.gnutls_x509_crl_get_signature_algorithm
gnutls_x509_crl_get_signature_algorithm.argtypes = [gnutls_x509_crl_t]
gnutls_x509_crl_get_signature_algorithm.restype = c_int

gnutls_x509_crl_get_this_update = libgnutls.gnutls_x509_crl_get_this_update
gnutls_x509_crl_get_this_update.argtypes = [gnutls_x509_crl_t]
gnutls_x509_crl_get_this_update.restype = time_t
gnutls_x509_crl_get_this_update.errmsg = "cannot get CRL's issue time"

gnutls_x509_crl_get_version = libgnutls.gnutls_x509_crl_get_version
gnutls_x509_crl_get_version.argtypes = [gnutls_x509_crl_t]
gnutls_x509_crl_get_version.restype = c_int

gnutls_x509_crl_import = libgnutls.gnutls_x509_crl_import
gnutls_x509_crl_import.argtypes = [gnutls_x509_crl_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_x509_crl_import.restype = c_int

gnutls_x509_crl_init = libgnutls.gnutls_x509_crl_init
gnutls_x509_crl_init.argtypes = [POINTER(gnutls_x509_crl_t)]
gnutls_x509_crl_init.restype = c_int

gnutls_x509_crl_print = libgnutls.gnutls_x509_crl_print
gnutls_x509_crl_print.argtypes = [gnutls_x509_crl_t, gnutls_certificate_print_formats_t, POINTER(gnutls_datum_t)]
gnutls_x509_crl_print.restype = c_int

gnutls_x509_crl_set_crt = libgnutls.gnutls_x509_crl_set_crt
gnutls_x509_crl_set_crt.argtypes = [gnutls_x509_crl_t, gnutls_x509_crt_t, time_t]
gnutls_x509_crl_set_crt.restype = c_int

gnutls_x509_crl_set_crt_serial = libgnutls.gnutls_x509_crl_set_crt_serial
gnutls_x509_crl_set_crt_serial.argtypes = [gnutls_x509_crl_t, c_void_p, size_t, time_t]
gnutls_x509_crl_set_crt_serial.restype = c_int

gnutls_x509_crl_set_next_update = libgnutls.gnutls_x509_crl_set_next_update
gnutls_x509_crl_set_next_update.argtypes = [gnutls_x509_crl_t, time_t]
gnutls_x509_crl_set_next_update.restype = c_int

gnutls_x509_crl_set_this_update = libgnutls.gnutls_x509_crl_set_this_update
gnutls_x509_crl_set_this_update.argtypes = [gnutls_x509_crl_t, time_t]
gnutls_x509_crl_set_this_update.restype = c_int

gnutls_x509_crl_set_version = libgnutls.gnutls_x509_crl_set_version
gnutls_x509_crl_set_version.argtypes = [gnutls_x509_crl_t, c_uint]
gnutls_x509_crl_set_version.restype = c_int

gnutls_x509_crl_sign = libgnutls.gnutls_x509_crl_sign
gnutls_x509_crl_sign.argtypes = [gnutls_x509_crl_t, gnutls_x509_crt_t, gnutls_x509_privkey_t]
gnutls_x509_crl_sign.restype = c_int

gnutls_x509_crl_sign2 = libgnutls.gnutls_x509_crl_sign2
gnutls_x509_crl_sign2.argtypes = [gnutls_x509_crl_t, gnutls_x509_crt_t, gnutls_x509_privkey_t, gnutls_digest_algorithm_t, c_uint]
gnutls_x509_crl_sign2.restype = c_int

gnutls_x509_crl_verify = libgnutls.gnutls_x509_crl_verify
gnutls_x509_crl_verify.argtypes = [gnutls_x509_crl_t, POINTER(gnutls_x509_crt_t), c_int, c_uint, POINTER(c_uint)]
gnutls_x509_crl_verify.restype = c_int

gnutls_x509_crq_deinit = libgnutls.gnutls_x509_crq_deinit
gnutls_x509_crq_deinit.argtypes = [gnutls_x509_crq_t]
gnutls_x509_crq_deinit.restype = None

gnutls_x509_crq_export = libgnutls.gnutls_x509_crq_export
gnutls_x509_crq_export.argtypes = [gnutls_x509_crq_t, gnutls_x509_crt_fmt_t, c_void_p, POINTER(size_t)]
gnutls_x509_crq_export.restype = c_int

gnutls_x509_crq_get_attribute_by_oid = libgnutls.gnutls_x509_crq_get_attribute_by_oid
gnutls_x509_crq_get_attribute_by_oid.argtypes = [gnutls_x509_crq_t, c_char_p, c_int, c_void_p, POINTER(size_t)]
gnutls_x509_crq_get_attribute_by_oid.restype = c_int

gnutls_x509_crq_get_challenge_password = libgnutls.gnutls_x509_crq_get_challenge_password
gnutls_x509_crq_get_challenge_password.argtypes = [gnutls_x509_crq_t, c_char_p, POINTER(size_t)]
gnutls_x509_crq_get_challenge_password.restype = c_int

gnutls_x509_crq_get_dn = libgnutls.gnutls_x509_crq_get_dn
gnutls_x509_crq_get_dn.argtypes = [gnutls_x509_crq_t, c_char_p, POINTER(size_t)]
gnutls_x509_crq_get_dn.restype = c_int

gnutls_x509_crq_get_dn_by_oid = libgnutls.gnutls_x509_crq_get_dn_by_oid
gnutls_x509_crq_get_dn_by_oid.argtypes = [gnutls_x509_crq_t, c_char_p, c_int, c_uint, c_void_p, POINTER(size_t)]
gnutls_x509_crq_get_dn_by_oid.restype = c_int

gnutls_x509_crq_get_dn_oid = libgnutls.gnutls_x509_crq_get_dn_oid
gnutls_x509_crq_get_dn_oid.argtypes = [gnutls_x509_crq_t, c_int, c_void_p, POINTER(size_t)]
gnutls_x509_crq_get_dn_oid.restype = c_int

gnutls_x509_crq_get_pk_algorithm = libgnutls.gnutls_x509_crq_get_pk_algorithm
gnutls_x509_crq_get_pk_algorithm.argtypes = [gnutls_x509_crq_t, POINTER(c_uint)]
gnutls_x509_crq_get_pk_algorithm.restype = c_int

gnutls_x509_crq_import = libgnutls.gnutls_x509_crq_import
gnutls_x509_crq_import.argtypes = [gnutls_x509_crq_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_x509_crq_import.restype = c_int

gnutls_x509_crq_init = libgnutls.gnutls_x509_crq_init
gnutls_x509_crq_init.argtypes = [POINTER(gnutls_x509_crq_t)]
gnutls_x509_crq_init.restype = c_int

gnutls_x509_crq_set_attribute_by_oid = libgnutls.gnutls_x509_crq_set_attribute_by_oid
gnutls_x509_crq_set_attribute_by_oid.argtypes = [gnutls_x509_crq_t, c_char_p, c_void_p, size_t]
gnutls_x509_crq_set_attribute_by_oid.restype = c_int

gnutls_x509_crq_set_challenge_password = libgnutls.gnutls_x509_crq_set_challenge_password
gnutls_x509_crq_set_challenge_password.argtypes = [gnutls_x509_crq_t, c_char_p]
gnutls_x509_crq_set_challenge_password.restype = c_int

gnutls_x509_crq_set_dn_by_oid = libgnutls.gnutls_x509_crq_set_dn_by_oid
gnutls_x509_crq_set_dn_by_oid.argtypes = [gnutls_x509_crq_t, c_char_p, c_uint, c_void_p, c_uint]
gnutls_x509_crq_set_dn_by_oid.restype = c_int

gnutls_x509_crq_set_key = libgnutls.gnutls_x509_crq_set_key
gnutls_x509_crq_set_key.argtypes = [gnutls_x509_crq_t, gnutls_x509_privkey_t]
gnutls_x509_crq_set_key.restype = c_int

gnutls_x509_crq_set_version = libgnutls.gnutls_x509_crq_set_version
gnutls_x509_crq_set_version.argtypes = [gnutls_x509_crq_t, c_uint]
gnutls_x509_crq_set_version.restype = c_int

gnutls_x509_crq_sign = libgnutls.gnutls_x509_crq_sign
gnutls_x509_crq_sign.argtypes = [gnutls_x509_crq_t, gnutls_x509_privkey_t]
gnutls_x509_crq_sign.restype = c_int

gnutls_x509_crq_sign2 = libgnutls.gnutls_x509_crq_sign2
gnutls_x509_crq_sign2.argtypes = [gnutls_x509_crq_t, gnutls_x509_privkey_t, gnutls_digest_algorithm_t, c_uint]
gnutls_x509_crq_sign2.restype = c_int

gnutls_x509_crt_check_hostname = libgnutls.gnutls_x509_crt_check_hostname
gnutls_x509_crt_check_hostname.argtypes = [gnutls_x509_crt_t, c_char_p]
gnutls_x509_crt_check_hostname.restype = c_int

gnutls_x509_crt_check_issuer = libgnutls.gnutls_x509_crt_check_issuer
gnutls_x509_crt_check_issuer.argtypes = [gnutls_x509_crt_t, gnutls_x509_crt_t]
gnutls_x509_crt_check_issuer.restype = c_int

gnutls_x509_crt_check_revocation = libgnutls.gnutls_x509_crt_check_revocation
gnutls_x509_crt_check_revocation.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_x509_crl_t), c_int]
gnutls_x509_crt_check_revocation.restype = c_int

gnutls_x509_crt_cpy_crl_dist_points = libgnutls.gnutls_x509_crt_cpy_crl_dist_points
gnutls_x509_crt_cpy_crl_dist_points.argtypes = [gnutls_x509_crt_t, gnutls_x509_crt_t]
gnutls_x509_crt_cpy_crl_dist_points.restype = c_int

gnutls_x509_crt_deinit = libgnutls.gnutls_x509_crt_deinit
gnutls_x509_crt_deinit.argtypes = [gnutls_x509_crt_t]
gnutls_x509_crt_deinit.restype = None

gnutls_x509_crt_export = libgnutls.gnutls_x509_crt_export
gnutls_x509_crt_export.argtypes = [gnutls_x509_crt_t, gnutls_x509_crt_fmt_t, c_void_p, POINTER(size_t)]
gnutls_x509_crt_export.restype = c_int

gnutls_x509_crt_get_activation_time = libgnutls.gnutls_x509_crt_get_activation_time
gnutls_x509_crt_get_activation_time.argtypes = [gnutls_x509_crt_t]
gnutls_x509_crt_get_activation_time.restype = time_t
gnutls_x509_crt_get_activation_time.errmsg = "cannot get X509 certificate activation time"

gnutls_x509_crt_get_authority_key_id = libgnutls.gnutls_x509_crt_get_authority_key_id
gnutls_x509_crt_get_authority_key_id.argtypes = [gnutls_x509_crt_t, c_void_p, POINTER(size_t), POINTER(c_uint)]
gnutls_x509_crt_get_authority_key_id.restype = c_int

gnutls_x509_crt_get_basic_constraints = libgnutls.gnutls_x509_crt_get_basic_constraints
gnutls_x509_crt_get_basic_constraints.argtypes = [gnutls_x509_crt_t, POINTER(c_uint), POINTER(c_int), POINTER(c_int)]
gnutls_x509_crt_get_basic_constraints.restype = c_int

gnutls_x509_crt_get_ca_status = libgnutls.gnutls_x509_crt_get_ca_status
gnutls_x509_crt_get_ca_status.argtypes = [gnutls_x509_crt_t, POINTER(c_uint)]
gnutls_x509_crt_get_ca_status.restype = c_int

gnutls_x509_crt_get_crl_dist_points = libgnutls.gnutls_x509_crt_get_crl_dist_points
gnutls_x509_crt_get_crl_dist_points.argtypes = [gnutls_x509_crt_t, c_uint, c_void_p, POINTER(size_t), POINTER(c_uint), POINTER(c_uint)]
gnutls_x509_crt_get_crl_dist_points.restype = c_int

gnutls_x509_crt_get_dn = libgnutls.gnutls_x509_crt_get_dn
gnutls_x509_crt_get_dn.argtypes = [gnutls_x509_crt_t, c_char_p, POINTER(size_t)]
gnutls_x509_crt_get_dn.restype = c_int

gnutls_x509_crt_get_dn_by_oid = libgnutls.gnutls_x509_crt_get_dn_by_oid
gnutls_x509_crt_get_dn_by_oid.argtypes = [gnutls_x509_crt_t, c_char_p, c_int, c_uint, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_dn_by_oid.restype = c_int

gnutls_x509_crt_get_dn_oid = libgnutls.gnutls_x509_crt_get_dn_oid
gnutls_x509_crt_get_dn_oid.argtypes = [gnutls_x509_crt_t, c_int, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_dn_oid.restype = c_int

gnutls_x509_crt_get_expiration_time = libgnutls.gnutls_x509_crt_get_expiration_time
gnutls_x509_crt_get_expiration_time.argtypes = [gnutls_x509_crt_t]
gnutls_x509_crt_get_expiration_time.restype = time_t
gnutls_x509_crt_get_expiration_time.errmsg = "cannot get X509 certificate expiration time"

gnutls_x509_crt_get_extension_by_oid = libgnutls.gnutls_x509_crt_get_extension_by_oid
gnutls_x509_crt_get_extension_by_oid.argtypes = [gnutls_x509_crt_t, c_char_p, c_int, c_void_p, POINTER(size_t), POINTER(c_uint)]
gnutls_x509_crt_get_extension_by_oid.restype = c_int

gnutls_x509_crt_get_extension_data = libgnutls.gnutls_x509_crt_get_extension_data
gnutls_x509_crt_get_extension_data.argtypes = [gnutls_x509_crt_t, c_int, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_extension_data.restype = c_int

gnutls_x509_crt_get_extension_info = libgnutls.gnutls_x509_crt_get_extension_info
gnutls_x509_crt_get_extension_info.argtypes = [gnutls_x509_crt_t, c_int, c_void_p, POINTER(size_t), POINTER(c_int)]
gnutls_x509_crt_get_extension_info.restype = c_int

gnutls_x509_crt_get_extension_oid = libgnutls.gnutls_x509_crt_get_extension_oid
gnutls_x509_crt_get_extension_oid.argtypes = [gnutls_x509_crt_t, c_int, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_extension_oid.restype = c_int

gnutls_x509_crt_get_fingerprint = libgnutls.gnutls_x509_crt_get_fingerprint
gnutls_x509_crt_get_fingerprint.argtypes = [gnutls_x509_crt_t, gnutls_digest_algorithm_t, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_fingerprint.restype = c_int

gnutls_x509_crt_get_issuer = libgnutls.gnutls_x509_crt_get_issuer
gnutls_x509_crt_get_issuer.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_x509_dn_t)]
gnutls_x509_crt_get_issuer.restype = c_int

gnutls_x509_crt_get_issuer_dn = libgnutls.gnutls_x509_crt_get_issuer_dn
gnutls_x509_crt_get_issuer_dn.argtypes = [gnutls_x509_crt_t, c_char_p, POINTER(size_t)]
gnutls_x509_crt_get_issuer_dn.restype = c_int

gnutls_x509_crt_get_issuer_dn_by_oid = libgnutls.gnutls_x509_crt_get_issuer_dn_by_oid
gnutls_x509_crt_get_issuer_dn_by_oid.argtypes = [gnutls_x509_crt_t, c_char_p, c_int, c_uint, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_issuer_dn_by_oid.restype = c_int

gnutls_x509_crt_get_issuer_dn_oid = libgnutls.gnutls_x509_crt_get_issuer_dn_oid
gnutls_x509_crt_get_issuer_dn_oid.argtypes = [gnutls_x509_crt_t, c_int, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_issuer_dn_oid.restype = c_int

gnutls_x509_crt_get_key_id = libgnutls.gnutls_x509_crt_get_key_id
gnutls_x509_crt_get_key_id.argtypes = [gnutls_x509_crt_t, c_uint, POINTER(c_ubyte), POINTER(size_t)]
gnutls_x509_crt_get_key_id.restype = c_int

gnutls_x509_crt_get_key_purpose_oid = libgnutls.gnutls_x509_crt_get_key_purpose_oid
gnutls_x509_crt_get_key_purpose_oid.argtypes = [gnutls_x509_crt_t, c_int, c_void_p, POINTER(size_t), POINTER(c_uint)]
gnutls_x509_crt_get_key_purpose_oid.restype = c_int

gnutls_x509_crt_get_key_usage = libgnutls.gnutls_x509_crt_get_key_usage
gnutls_x509_crt_get_key_usage.argtypes = [gnutls_x509_crt_t, POINTER(c_uint), POINTER(c_uint)]
gnutls_x509_crt_get_key_usage.restype = c_int

gnutls_x509_crt_get_pk_algorithm = libgnutls.gnutls_x509_crt_get_pk_algorithm
gnutls_x509_crt_get_pk_algorithm.argtypes = [gnutls_x509_crt_t, POINTER(c_uint)]
gnutls_x509_crt_get_pk_algorithm.restype = c_int

gnutls_x509_crt_get_pk_dsa_raw = libgnutls.gnutls_x509_crt_get_pk_dsa_raw
gnutls_x509_crt_get_pk_dsa_raw.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_x509_crt_get_pk_dsa_raw.restype = c_int

gnutls_x509_crt_get_pk_rsa_raw = libgnutls.gnutls_x509_crt_get_pk_rsa_raw
gnutls_x509_crt_get_pk_rsa_raw.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_x509_crt_get_pk_rsa_raw.restype = c_int

gnutls_x509_crt_get_proxy = libgnutls.gnutls_x509_crt_get_proxy
gnutls_x509_crt_get_proxy.argtypes = [gnutls_x509_crt_t, POINTER(c_uint), POINTER(c_int), POINTER(c_char_p), POINTER(c_char_p), POINTER(size_t)]
gnutls_x509_crt_get_proxy.restype = c_int

gnutls_x509_crt_get_raw_dn = libgnutls.gnutls_x509_crt_get_raw_dn
gnutls_x509_crt_get_raw_dn.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_datum_t)]
gnutls_x509_crt_get_raw_dn.restype = c_int

gnutls_x509_crt_get_raw_issuer_dn = libgnutls.gnutls_x509_crt_get_raw_issuer_dn
gnutls_x509_crt_get_raw_issuer_dn.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_datum_t)]
gnutls_x509_crt_get_raw_issuer_dn.restype = c_int

gnutls_x509_crt_get_serial = libgnutls.gnutls_x509_crt_get_serial
gnutls_x509_crt_get_serial.argtypes = [gnutls_x509_crt_t, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_serial.restype = c_int

gnutls_x509_crt_get_signature = libgnutls.gnutls_x509_crt_get_signature
gnutls_x509_crt_get_signature.argtypes = [gnutls_x509_crt_t, c_char_p, POINTER(size_t)]
gnutls_x509_crt_get_signature.restype = c_int

gnutls_x509_crt_get_signature_algorithm = libgnutls.gnutls_x509_crt_get_signature_algorithm
gnutls_x509_crt_get_signature_algorithm.argtypes = [gnutls_x509_crt_t]
gnutls_x509_crt_get_signature_algorithm.restype = c_int

gnutls_x509_crt_get_subject = libgnutls.gnutls_x509_crt_get_subject
gnutls_x509_crt_get_subject.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_x509_dn_t)]
gnutls_x509_crt_get_subject.restype = c_int

gnutls_x509_crt_get_subject_alt_name = libgnutls.gnutls_x509_crt_get_subject_alt_name
gnutls_x509_crt_get_subject_alt_name.argtypes = [gnutls_x509_crt_t, c_uint, c_void_p, POINTER(size_t), POINTER(c_uint)]
gnutls_x509_crt_get_subject_alt_name.restype = c_int

gnutls_x509_crt_get_subject_alt_name2 = libgnutls.gnutls_x509_crt_get_subject_alt_name2
gnutls_x509_crt_get_subject_alt_name2.argtypes = [gnutls_x509_crt_t, c_uint, c_void_p, POINTER(size_t), POINTER(c_uint), POINTER(c_uint)]
gnutls_x509_crt_get_subject_alt_name2.restype = c_int

gnutls_x509_crt_get_subject_alt_othername_oid = libgnutls.gnutls_x509_crt_get_subject_alt_othername_oid
gnutls_x509_crt_get_subject_alt_othername_oid.argtypes = [gnutls_x509_crt_t, c_uint, c_void_p, POINTER(size_t)]
gnutls_x509_crt_get_subject_alt_othername_oid.restype = c_int

gnutls_x509_crt_get_subject_key_id = libgnutls.gnutls_x509_crt_get_subject_key_id
gnutls_x509_crt_get_subject_key_id.argtypes = [gnutls_x509_crt_t, c_void_p, POINTER(size_t), POINTER(c_uint)]
gnutls_x509_crt_get_subject_key_id.restype = c_int

gnutls_x509_crt_get_version = libgnutls.gnutls_x509_crt_get_version
gnutls_x509_crt_get_version.argtypes = [gnutls_x509_crt_t]
gnutls_x509_crt_get_version.restype = c_int

gnutls_x509_crt_import = libgnutls.gnutls_x509_crt_import
gnutls_x509_crt_import.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_x509_crt_import.restype = c_int

gnutls_x509_crt_init = libgnutls.gnutls_x509_crt_init
gnutls_x509_crt_init.argtypes = [POINTER(gnutls_x509_crt_t)]
gnutls_x509_crt_init.restype = c_int

gnutls_x509_crt_list_import = libgnutls.gnutls_x509_crt_list_import
gnutls_x509_crt_list_import.argtypes = [POINTER(gnutls_x509_crt_t), POINTER(c_uint), POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t, c_uint]
gnutls_x509_crt_list_import.restype = c_int

gnutls_x509_crt_list_verify = libgnutls.gnutls_x509_crt_list_verify
gnutls_x509_crt_list_verify.argtypes = [POINTER(gnutls_x509_crt_t), c_int, POINTER(gnutls_x509_crt_t), c_int, POINTER(gnutls_x509_crl_t), c_int, c_uint, POINTER(c_uint)]
gnutls_x509_crt_list_verify.restype = c_int

gnutls_x509_crt_print = libgnutls.gnutls_x509_crt_print
gnutls_x509_crt_print.argtypes = [gnutls_x509_crt_t, gnutls_certificate_print_formats_t, POINTER(gnutls_datum_t)]
gnutls_x509_crt_print.restype = c_int

gnutls_x509_crt_set_activation_time = libgnutls.gnutls_x509_crt_set_activation_time
gnutls_x509_crt_set_activation_time.argtypes = [gnutls_x509_crt_t, time_t]
gnutls_x509_crt_set_activation_time.restype = c_int

gnutls_x509_crt_set_authority_key_id = libgnutls.gnutls_x509_crt_set_authority_key_id
gnutls_x509_crt_set_authority_key_id.argtypes = [gnutls_x509_crt_t, c_void_p, size_t]
gnutls_x509_crt_set_authority_key_id.restype = c_int

gnutls_x509_crt_set_basic_constraints = libgnutls.gnutls_x509_crt_set_basic_constraints
gnutls_x509_crt_set_basic_constraints.argtypes = [gnutls_x509_crt_t, c_uint, c_int]
gnutls_x509_crt_set_basic_constraints.restype = c_int

gnutls_x509_crt_set_ca_status = libgnutls.gnutls_x509_crt_set_ca_status
gnutls_x509_crt_set_ca_status.argtypes = [gnutls_x509_crt_t, c_uint]
gnutls_x509_crt_set_ca_status.restype = c_int

gnutls_x509_crt_set_crl_dist_points = libgnutls.gnutls_x509_crt_set_crl_dist_points
gnutls_x509_crt_set_crl_dist_points.argtypes = [gnutls_x509_crt_t, gnutls_x509_subject_alt_name_t, c_void_p, c_uint]
gnutls_x509_crt_set_crl_dist_points.restype = c_int

gnutls_x509_crt_set_crq = libgnutls.gnutls_x509_crt_set_crq
gnutls_x509_crt_set_crq.argtypes = [gnutls_x509_crt_t, gnutls_x509_crq_t]
gnutls_x509_crt_set_crq.restype = c_int

gnutls_x509_crt_set_dn_by_oid = libgnutls.gnutls_x509_crt_set_dn_by_oid
gnutls_x509_crt_set_dn_by_oid.argtypes = [gnutls_x509_crt_t, c_char_p, c_uint, c_void_p, c_uint]
gnutls_x509_crt_set_dn_by_oid.restype = c_int

gnutls_x509_crt_set_expiration_time = libgnutls.gnutls_x509_crt_set_expiration_time
gnutls_x509_crt_set_expiration_time.argtypes = [gnutls_x509_crt_t, time_t]
gnutls_x509_crt_set_expiration_time.restype = c_int

gnutls_x509_crt_set_extension_by_oid = libgnutls.gnutls_x509_crt_set_extension_by_oid
gnutls_x509_crt_set_extension_by_oid.argtypes = [gnutls_x509_crt_t, c_char_p, c_void_p, size_t, c_uint]
gnutls_x509_crt_set_extension_by_oid.restype = c_int

gnutls_x509_crt_set_issuer_dn_by_oid = libgnutls.gnutls_x509_crt_set_issuer_dn_by_oid
gnutls_x509_crt_set_issuer_dn_by_oid.argtypes = [gnutls_x509_crt_t, c_char_p, c_uint, c_void_p, c_uint]
gnutls_x509_crt_set_issuer_dn_by_oid.restype = c_int

gnutls_x509_crt_set_key = libgnutls.gnutls_x509_crt_set_key
gnutls_x509_crt_set_key.argtypes = [gnutls_x509_crt_t, gnutls_x509_privkey_t]
gnutls_x509_crt_set_key.restype = c_int

gnutls_x509_crt_set_key_purpose_oid = libgnutls.gnutls_x509_crt_set_key_purpose_oid
gnutls_x509_crt_set_key_purpose_oid.argtypes = [gnutls_x509_crt_t, c_void_p, c_uint]
gnutls_x509_crt_set_key_purpose_oid.restype = c_int

gnutls_x509_crt_set_key_usage = libgnutls.gnutls_x509_crt_set_key_usage
gnutls_x509_crt_set_key_usage.argtypes = [gnutls_x509_crt_t, c_uint]
gnutls_x509_crt_set_key_usage.restype = c_int

gnutls_x509_crt_set_proxy = libgnutls.gnutls_x509_crt_set_proxy
gnutls_x509_crt_set_proxy.argtypes = [gnutls_x509_crt_t, c_int, c_char_p, c_char_p, size_t]
gnutls_x509_crt_set_proxy.restype = c_int

gnutls_x509_crt_set_proxy_dn = libgnutls.gnutls_x509_crt_set_proxy_dn
gnutls_x509_crt_set_proxy_dn.argtypes = [gnutls_x509_crt_t, gnutls_x509_crt_t, c_uint, c_void_p, c_uint]
gnutls_x509_crt_set_proxy_dn.restype = c_int

gnutls_x509_crt_set_serial = libgnutls.gnutls_x509_crt_set_serial
gnutls_x509_crt_set_serial.argtypes = [gnutls_x509_crt_t, c_void_p, size_t]
gnutls_x509_crt_set_serial.restype = c_int

gnutls_x509_crt_set_subject_alternative_name = libgnutls.gnutls_x509_crt_set_subject_alternative_name
gnutls_x509_crt_set_subject_alternative_name.argtypes = [gnutls_x509_crt_t, gnutls_x509_subject_alt_name_t, c_char_p]
gnutls_x509_crt_set_subject_alternative_name.restype = c_int

gnutls_x509_crt_set_subject_key_id = libgnutls.gnutls_x509_crt_set_subject_key_id
gnutls_x509_crt_set_subject_key_id.argtypes = [gnutls_x509_crt_t, c_void_p, size_t]
gnutls_x509_crt_set_subject_key_id.restype = c_int

gnutls_x509_crt_set_version = libgnutls.gnutls_x509_crt_set_version
gnutls_x509_crt_set_version.argtypes = [gnutls_x509_crt_t, c_uint]
gnutls_x509_crt_set_version.restype = c_int

gnutls_x509_crt_sign = libgnutls.gnutls_x509_crt_sign
gnutls_x509_crt_sign.argtypes = [gnutls_x509_crt_t, gnutls_x509_crt_t, gnutls_x509_privkey_t]
gnutls_x509_crt_sign.restype = c_int

gnutls_x509_crt_sign2 = libgnutls.gnutls_x509_crt_sign2
gnutls_x509_crt_sign2.argtypes = [gnutls_x509_crt_t, gnutls_x509_crt_t, gnutls_x509_privkey_t, gnutls_digest_algorithm_t, c_uint]
gnutls_x509_crt_sign2.restype = c_int

gnutls_x509_crt_verify = libgnutls.gnutls_x509_crt_verify
gnutls_x509_crt_verify.argtypes = [gnutls_x509_crt_t, POINTER(gnutls_x509_crt_t), c_int, c_uint, POINTER(c_uint)]
gnutls_x509_crt_verify.restype = c_int

gnutls_x509_dn_deinit = libgnutls.gnutls_x509_dn_deinit
gnutls_x509_dn_deinit.argtypes = [gnutls_x509_dn_t]
gnutls_x509_dn_deinit.restype = None

gnutls_x509_dn_export = libgnutls.gnutls_x509_dn_export
gnutls_x509_dn_export.argtypes = [gnutls_x509_dn_t, gnutls_x509_crt_fmt_t, c_void_p, POINTER(size_t)]
gnutls_x509_dn_export.restype = c_int

gnutls_x509_dn_get_rdn_ava = libgnutls.gnutls_x509_dn_get_rdn_ava
gnutls_x509_dn_get_rdn_ava.argtypes = [gnutls_x509_dn_t, c_int, c_int, POINTER(gnutls_x509_ava_st)]
gnutls_x509_dn_get_rdn_ava.restype = c_int

gnutls_x509_dn_import = libgnutls.gnutls_x509_dn_import
gnutls_x509_dn_import.argtypes = [gnutls_x509_dn_t, POINTER(gnutls_datum_t)]
gnutls_x509_dn_import.restype = c_int

gnutls_x509_dn_init = libgnutls.gnutls_x509_dn_init
gnutls_x509_dn_init.argtypes = [POINTER(gnutls_x509_dn_t)]
gnutls_x509_dn_init.restype = c_int

gnutls_x509_dn_oid_known = libgnutls.gnutls_x509_dn_oid_known
gnutls_x509_dn_oid_known.argtypes = [c_char_p]
gnutls_x509_dn_oid_known.restype = c_int

gnutls_x509_privkey_cpy = libgnutls.gnutls_x509_privkey_cpy
gnutls_x509_privkey_cpy.argtypes = [gnutls_x509_privkey_t, gnutls_x509_privkey_t]
gnutls_x509_privkey_cpy.restype = c_int

gnutls_x509_privkey_deinit = libgnutls.gnutls_x509_privkey_deinit
gnutls_x509_privkey_deinit.argtypes = [gnutls_x509_privkey_t]
gnutls_x509_privkey_deinit.restype = None

gnutls_x509_privkey_export = libgnutls.gnutls_x509_privkey_export
gnutls_x509_privkey_export.argtypes = [gnutls_x509_privkey_t, gnutls_x509_crt_fmt_t, c_void_p, POINTER(size_t)]
gnutls_x509_privkey_export.restype = c_int

gnutls_x509_privkey_export_dsa_raw = libgnutls.gnutls_x509_privkey_export_dsa_raw
gnutls_x509_privkey_export_dsa_raw.argtypes = [gnutls_x509_privkey_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_x509_privkey_export_dsa_raw.restype = c_int

gnutls_x509_privkey_export_pkcs8 = libgnutls.gnutls_x509_privkey_export_pkcs8
gnutls_x509_privkey_export_pkcs8.argtypes = [gnutls_x509_privkey_t, gnutls_x509_crt_fmt_t, c_char_p, c_uint, c_void_p, POINTER(size_t)]
gnutls_x509_privkey_export_pkcs8.restype = c_int

gnutls_x509_privkey_export_rsa_raw = libgnutls.gnutls_x509_privkey_export_rsa_raw
gnutls_x509_privkey_export_rsa_raw.argtypes = [gnutls_x509_privkey_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_x509_privkey_export_rsa_raw.restype = c_int

gnutls_x509_privkey_fix = libgnutls.gnutls_x509_privkey_fix
gnutls_x509_privkey_fix.argtypes = [gnutls_x509_privkey_t]
gnutls_x509_privkey_fix.restype = c_int

gnutls_x509_privkey_generate = libgnutls.gnutls_x509_privkey_generate
gnutls_x509_privkey_generate.argtypes = [gnutls_x509_privkey_t, gnutls_pk_algorithm_t, c_uint, c_uint]
gnutls_x509_privkey_generate.restype = c_int

gnutls_x509_privkey_get_key_id = libgnutls.gnutls_x509_privkey_get_key_id
gnutls_x509_privkey_get_key_id.argtypes = [gnutls_x509_privkey_t, c_uint, POINTER(c_ubyte), POINTER(size_t)]
gnutls_x509_privkey_get_key_id.restype = c_int

gnutls_x509_privkey_get_pk_algorithm = libgnutls.gnutls_x509_privkey_get_pk_algorithm
gnutls_x509_privkey_get_pk_algorithm.argtypes = [gnutls_x509_privkey_t]
gnutls_x509_privkey_get_pk_algorithm.restype = c_int

gnutls_x509_privkey_import = libgnutls.gnutls_x509_privkey_import
gnutls_x509_privkey_import.argtypes = [gnutls_x509_privkey_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t]
gnutls_x509_privkey_import.restype = c_int

gnutls_x509_privkey_import_dsa_raw = libgnutls.gnutls_x509_privkey_import_dsa_raw
gnutls_x509_privkey_import_dsa_raw.argtypes = [gnutls_x509_privkey_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_x509_privkey_import_dsa_raw.restype = c_int

gnutls_x509_privkey_import_pkcs8 = libgnutls.gnutls_x509_privkey_import_pkcs8
gnutls_x509_privkey_import_pkcs8.argtypes = [gnutls_x509_privkey_t, POINTER(gnutls_datum_t), gnutls_x509_crt_fmt_t, c_char_p, c_uint]
gnutls_x509_privkey_import_pkcs8.restype = c_int

gnutls_x509_privkey_import_rsa_raw = libgnutls.gnutls_x509_privkey_import_rsa_raw
gnutls_x509_privkey_import_rsa_raw.argtypes = [gnutls_x509_privkey_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_x509_privkey_import_rsa_raw.restype = c_int

gnutls_x509_privkey_init = libgnutls.gnutls_x509_privkey_init
gnutls_x509_privkey_init.argtypes = [POINTER(gnutls_x509_privkey_t)]
gnutls_x509_privkey_init.restype = c_int

gnutls_x509_privkey_sign_data = libgnutls.gnutls_x509_privkey_sign_data
gnutls_x509_privkey_sign_data.argtypes = [gnutls_x509_privkey_t, gnutls_digest_algorithm_t, c_uint, POINTER(gnutls_datum_t), c_void_p, POINTER(size_t)]
gnutls_x509_privkey_sign_data.restype = c_int

gnutls_x509_privkey_sign_hash = libgnutls.gnutls_x509_privkey_sign_hash
gnutls_x509_privkey_sign_hash.argtypes = [gnutls_x509_privkey_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
gnutls_x509_privkey_sign_hash.restype = c_int

gnutls_x509_rdn_get = libgnutls.gnutls_x509_rdn_get
gnutls_x509_rdn_get.argtypes = [POINTER(gnutls_datum_t), c_char_p, POINTER(size_t)]
gnutls_x509_rdn_get.restype = c_int

gnutls_x509_rdn_get_by_oid = libgnutls.gnutls_x509_rdn_get_by_oid
gnutls_x509_rdn_get_by_oid.argtypes = [POINTER(gnutls_datum_t), c_char_p, c_int, c_uint, c_void_p, POINTER(size_t)]
gnutls_x509_rdn_get_by_oid.restype = c_int

gnutls_x509_rdn_get_oid = libgnutls.gnutls_x509_rdn_get_oid
gnutls_x509_rdn_get_oid.argtypes = [POINTER(gnutls_datum_t), c_int, c_void_p, POINTER(size_t)]
gnutls_x509_rdn_get_oid.restype = c_int


# The openpgp related functions are not always present (on windows for example they are missing)
#

try:
    gnutls_certificate_set_openpgp_key = libgnutls.gnutls_certificate_set_openpgp_key
except AttributeError:
    pass
else:
    gnutls_certificate_set_openpgp_key = libgnutls.gnutls_certificate_set_openpgp_key
    gnutls_certificate_set_openpgp_key.argtypes = [gnutls_certificate_credentials_t, gnutls_openpgp_crt_t, gnutls_openpgp_privkey_t]
    gnutls_certificate_set_openpgp_key.restype = c_int

    gnutls_certificate_set_openpgp_key_file = libgnutls.gnutls_certificate_set_openpgp_key_file
    gnutls_certificate_set_openpgp_key_file.argtypes = [gnutls_certificate_credentials_t, c_char_p, c_char_p, gnutls_openpgp_crt_fmt_t]
    gnutls_certificate_set_openpgp_key_file.restype = c_int

    gnutls_certificate_set_openpgp_key_file2 = libgnutls.gnutls_certificate_set_openpgp_key_file2
    gnutls_certificate_set_openpgp_key_file2.argtypes = [gnutls_certificate_credentials_t, c_char_p, c_char_p, c_char_p, gnutls_openpgp_crt_fmt_t]
    gnutls_certificate_set_openpgp_key_file2.restype = c_int

    gnutls_certificate_set_openpgp_key_mem = libgnutls.gnutls_certificate_set_openpgp_key_mem
    gnutls_certificate_set_openpgp_key_mem.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), gnutls_openpgp_crt_fmt_t]
    gnutls_certificate_set_openpgp_key_mem.restype = c_int

    gnutls_certificate_set_openpgp_key_mem2 = libgnutls.gnutls_certificate_set_openpgp_key_mem2
    gnutls_certificate_set_openpgp_key_mem2.argtypes = [gnutls_certificate_credentials_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), c_char_p, gnutls_openpgp_crt_fmt_t]
    gnutls_certificate_set_openpgp_key_mem2.restype = c_int

    gnutls_certificate_set_openpgp_keyring_file = libgnutls.gnutls_certificate_set_openpgp_keyring_file
    gnutls_certificate_set_openpgp_keyring_file.argtypes = [gnutls_certificate_credentials_t, c_char_p, gnutls_openpgp_crt_fmt_t]
    gnutls_certificate_set_openpgp_keyring_file.restype = c_int

    gnutls_certificate_set_openpgp_keyring_mem = libgnutls.gnutls_certificate_set_openpgp_keyring_mem
    gnutls_certificate_set_openpgp_keyring_mem.argtypes = [gnutls_certificate_credentials_t, POINTER(c_ubyte), size_t, gnutls_openpgp_crt_fmt_t]
    gnutls_certificate_set_openpgp_keyring_mem.restype = c_int

    gnutls_openpgp_crt_check_hostname = libgnutls.gnutls_openpgp_crt_check_hostname
    gnutls_openpgp_crt_check_hostname.argtypes = [gnutls_openpgp_crt_t, c_char_p]
    gnutls_openpgp_crt_check_hostname.restype = c_int

    gnutls_openpgp_crt_deinit = libgnutls.gnutls_openpgp_crt_deinit
    gnutls_openpgp_crt_deinit.argtypes = [gnutls_openpgp_crt_t]
    gnutls_openpgp_crt_deinit.restype = None

    gnutls_openpgp_crt_export = libgnutls.gnutls_openpgp_crt_export
    gnutls_openpgp_crt_export.argtypes = [gnutls_openpgp_crt_t, gnutls_openpgp_crt_fmt_t, c_void_p, POINTER(size_t)]
    gnutls_openpgp_crt_export.restype = c_int

    gnutls_openpgp_crt_get_auth_subkey = libgnutls.gnutls_openpgp_crt_get_auth_subkey
    gnutls_openpgp_crt_get_auth_subkey.argtypes = [gnutls_openpgp_crt_t, POINTER(c_ubyte), c_uint]
    gnutls_openpgp_crt_get_auth_subkey.restype = c_int

    gnutls_openpgp_crt_get_creation_time = libgnutls.gnutls_openpgp_crt_get_creation_time
    gnutls_openpgp_crt_get_creation_time.argtypes = [gnutls_openpgp_crt_t]
    gnutls_openpgp_crt_get_creation_time.restype = time_t
    gnutls_openpgp_crt_get_creation_time.errmsg = "cannot get OpenPGP key creation time"

    gnutls_openpgp_crt_get_expiration_time = libgnutls.gnutls_openpgp_crt_get_expiration_time
    gnutls_openpgp_crt_get_expiration_time.argtypes = [gnutls_openpgp_crt_t]
    gnutls_openpgp_crt_get_expiration_time.restype = time_t
    gnutls_openpgp_crt_get_expiration_time.errmsg = "cannot get OpenPGP key expiration time"

    gnutls_openpgp_crt_get_fingerprint = libgnutls.gnutls_openpgp_crt_get_fingerprint
    gnutls_openpgp_crt_get_fingerprint.argtypes = [gnutls_openpgp_crt_t, c_void_p, POINTER(size_t)]
    gnutls_openpgp_crt_get_fingerprint.restype = c_int

    gnutls_openpgp_crt_get_key_id = libgnutls.gnutls_openpgp_crt_get_key_id
    gnutls_openpgp_crt_get_key_id.argtypes = [gnutls_openpgp_crt_t, POINTER(c_ubyte)]
    gnutls_openpgp_crt_get_key_id.restype = c_int

    gnutls_openpgp_crt_get_key_usage = libgnutls.gnutls_openpgp_crt_get_key_usage
    gnutls_openpgp_crt_get_key_usage.argtypes = [gnutls_openpgp_crt_t, POINTER(c_uint)]
    gnutls_openpgp_crt_get_key_usage.restype = c_int

    gnutls_openpgp_crt_get_name = libgnutls.gnutls_openpgp_crt_get_name
    gnutls_openpgp_crt_get_name.argtypes = [gnutls_openpgp_crt_t, c_int, c_char_p, POINTER(size_t)]
    gnutls_openpgp_crt_get_name.restype = c_int

    gnutls_openpgp_crt_get_pk_algorithm = libgnutls.gnutls_openpgp_crt_get_pk_algorithm
    gnutls_openpgp_crt_get_pk_algorithm.argtypes = [gnutls_openpgp_crt_t, POINTER(c_uint)]
    gnutls_openpgp_crt_get_pk_algorithm.restype = gnutls_pk_algorithm_t

    gnutls_openpgp_crt_get_pk_dsa_raw = libgnutls.gnutls_openpgp_crt_get_pk_dsa_raw
    gnutls_openpgp_crt_get_pk_dsa_raw.argtypes = [gnutls_openpgp_crt_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_crt_get_pk_dsa_raw.restype = c_int

    gnutls_openpgp_crt_get_pk_rsa_raw = libgnutls.gnutls_openpgp_crt_get_pk_rsa_raw
    gnutls_openpgp_crt_get_pk_rsa_raw.argtypes = [gnutls_openpgp_crt_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_crt_get_pk_rsa_raw.restype = c_int

    gnutls_openpgp_crt_get_preferred_key_id = libgnutls.gnutls_openpgp_crt_get_preferred_key_id
    gnutls_openpgp_crt_get_preferred_key_id.argtypes = [gnutls_openpgp_crt_t, POINTER(c_ubyte)]
    gnutls_openpgp_crt_get_preferred_key_id.restype = c_int

    gnutls_openpgp_crt_get_revoked_status = libgnutls.gnutls_openpgp_crt_get_revoked_status
    gnutls_openpgp_crt_get_revoked_status.argtypes = [gnutls_openpgp_crt_t]
    gnutls_openpgp_crt_get_revoked_status.restype = c_int

    gnutls_openpgp_crt_get_subkey_count = libgnutls.gnutls_openpgp_crt_get_subkey_count
    gnutls_openpgp_crt_get_subkey_count.argtypes = [gnutls_openpgp_crt_t]
    gnutls_openpgp_crt_get_subkey_count.restype = c_int

    gnutls_openpgp_crt_get_subkey_creation_time = libgnutls.gnutls_openpgp_crt_get_subkey_creation_time
    gnutls_openpgp_crt_get_subkey_creation_time.argtypes = [gnutls_openpgp_crt_t, c_uint]
    gnutls_openpgp_crt_get_subkey_creation_time.restype = time_t
    gnutls_openpgp_crt_get_subkey_creation_time.errmsg = "cannot get OpenPGP subkey creation time"

    gnutls_openpgp_crt_get_subkey_expiration_time = libgnutls.gnutls_openpgp_crt_get_subkey_expiration_time
    gnutls_openpgp_crt_get_subkey_expiration_time.argtypes = [gnutls_openpgp_crt_t, c_uint]
    gnutls_openpgp_crt_get_subkey_expiration_time.restype = time_t
    gnutls_openpgp_crt_get_subkey_expiration_time.errmsg = "cannot get OpenPGP subkey expiration time"

    gnutls_openpgp_crt_get_subkey_fingerprint = libgnutls.gnutls_openpgp_crt_get_subkey_fingerprint
    gnutls_openpgp_crt_get_subkey_fingerprint.argtypes = [gnutls_openpgp_crt_t, c_uint, c_void_p, POINTER(size_t)]
    gnutls_openpgp_crt_get_subkey_fingerprint.restype = c_int

    gnutls_openpgp_crt_get_subkey_id = libgnutls.gnutls_openpgp_crt_get_subkey_id
    gnutls_openpgp_crt_get_subkey_id.argtypes = [gnutls_openpgp_crt_t, c_uint, POINTER(c_ubyte)]
    gnutls_openpgp_crt_get_subkey_id.restype = c_int

    gnutls_openpgp_crt_get_subkey_idx = libgnutls.gnutls_openpgp_crt_get_subkey_idx
    gnutls_openpgp_crt_get_subkey_idx.argtypes = [gnutls_openpgp_crt_t, POINTER(c_ubyte)]
    gnutls_openpgp_crt_get_subkey_idx.restype = c_int

    gnutls_openpgp_crt_get_subkey_pk_algorithm = libgnutls.gnutls_openpgp_crt_get_subkey_pk_algorithm
    gnutls_openpgp_crt_get_subkey_pk_algorithm.argtypes = [gnutls_openpgp_crt_t, c_uint, POINTER(c_uint)]
    gnutls_openpgp_crt_get_subkey_pk_algorithm.restype = gnutls_pk_algorithm_t

    gnutls_openpgp_crt_get_subkey_pk_dsa_raw = libgnutls.gnutls_openpgp_crt_get_subkey_pk_dsa_raw
    gnutls_openpgp_crt_get_subkey_pk_dsa_raw.argtypes = [gnutls_openpgp_crt_t, c_uint, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_crt_get_subkey_pk_dsa_raw.restype = c_int

    gnutls_openpgp_crt_get_subkey_pk_rsa_raw = libgnutls.gnutls_openpgp_crt_get_subkey_pk_rsa_raw
    gnutls_openpgp_crt_get_subkey_pk_rsa_raw.argtypes = [gnutls_openpgp_crt_t, c_uint, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_crt_get_subkey_pk_rsa_raw.restype = c_int

    gnutls_openpgp_crt_get_subkey_revoked_status = libgnutls.gnutls_openpgp_crt_get_subkey_revoked_status
    gnutls_openpgp_crt_get_subkey_revoked_status.argtypes = [gnutls_openpgp_crt_t, c_uint]
    gnutls_openpgp_crt_get_subkey_revoked_status.restype = c_int

    gnutls_openpgp_crt_get_subkey_usage = libgnutls.gnutls_openpgp_crt_get_subkey_usage
    gnutls_openpgp_crt_get_subkey_usage.argtypes = [gnutls_openpgp_crt_t, c_uint, POINTER(c_uint)]
    gnutls_openpgp_crt_get_subkey_usage.restype = c_int

    gnutls_openpgp_crt_get_version = libgnutls.gnutls_openpgp_crt_get_version
    gnutls_openpgp_crt_get_version.argtypes = [gnutls_openpgp_crt_t]
    gnutls_openpgp_crt_get_version.restype = c_int

    gnutls_openpgp_crt_import = libgnutls.gnutls_openpgp_crt_import
    gnutls_openpgp_crt_import.argtypes = [gnutls_openpgp_crt_t, POINTER(gnutls_datum_t), gnutls_openpgp_crt_fmt_t]
    gnutls_openpgp_crt_import.restype = c_int

    gnutls_openpgp_crt_init = libgnutls.gnutls_openpgp_crt_init
    gnutls_openpgp_crt_init.argtypes = [POINTER(gnutls_openpgp_crt_t)]
    gnutls_openpgp_crt_init.restype = c_int

    gnutls_openpgp_crt_print = libgnutls.gnutls_openpgp_crt_print
    gnutls_openpgp_crt_print.argtypes = [gnutls_openpgp_crt_t, gnutls_certificate_print_formats_t, POINTER(gnutls_datum_t)]
    gnutls_openpgp_crt_print.restype = c_int

    gnutls_openpgp_crt_set_preferred_key_id = libgnutls.gnutls_openpgp_crt_set_preferred_key_id
    gnutls_openpgp_crt_set_preferred_key_id.argtypes = [gnutls_openpgp_crt_t, POINTER(c_ubyte)]
    gnutls_openpgp_crt_set_preferred_key_id.restype = c_int

    gnutls_openpgp_crt_verify_ring = libgnutls.gnutls_openpgp_crt_verify_ring
    gnutls_openpgp_crt_verify_ring.argtypes = [gnutls_openpgp_crt_t, gnutls_openpgp_keyring_t, c_uint, POINTER(c_uint)]
    gnutls_openpgp_crt_verify_ring.restype = c_int

    gnutls_openpgp_crt_verify_self = libgnutls.gnutls_openpgp_crt_verify_self
    gnutls_openpgp_crt_verify_self.argtypes = [gnutls_openpgp_crt_t, c_uint, POINTER(c_uint)]
    gnutls_openpgp_crt_verify_self.restype = c_int

    gnutls_openpgp_keyring_check_id = libgnutls.gnutls_openpgp_keyring_check_id
    gnutls_openpgp_keyring_check_id.argtypes = [gnutls_openpgp_keyring_t, POINTER(c_ubyte), c_uint]
    gnutls_openpgp_keyring_check_id.restype = c_int

    gnutls_openpgp_keyring_deinit = libgnutls.gnutls_openpgp_keyring_deinit
    gnutls_openpgp_keyring_deinit.argtypes = [gnutls_openpgp_keyring_t]
    gnutls_openpgp_keyring_deinit.restype = None

    gnutls_openpgp_keyring_get_crt = libgnutls.gnutls_openpgp_keyring_get_crt
    gnutls_openpgp_keyring_get_crt.argtypes = [gnutls_openpgp_keyring_t, c_uint, POINTER(gnutls_openpgp_crt_t)]
    gnutls_openpgp_keyring_get_crt.restype = c_int

    gnutls_openpgp_keyring_get_crt_count = libgnutls.gnutls_openpgp_keyring_get_crt_count
    gnutls_openpgp_keyring_get_crt_count.argtypes = [gnutls_openpgp_keyring_t]
    gnutls_openpgp_keyring_get_crt_count.restype = c_int

    gnutls_openpgp_keyring_import = libgnutls.gnutls_openpgp_keyring_import
    gnutls_openpgp_keyring_import.argtypes = [gnutls_openpgp_keyring_t, POINTER(gnutls_datum_t), gnutls_openpgp_crt_fmt_t]
    gnutls_openpgp_keyring_import.restype = c_int

    gnutls_openpgp_keyring_init = libgnutls.gnutls_openpgp_keyring_init
    gnutls_openpgp_keyring_init.argtypes = [POINTER(gnutls_openpgp_keyring_t)]
    gnutls_openpgp_keyring_init.restype = c_int

    gnutls_openpgp_privkey_deinit = libgnutls.gnutls_openpgp_privkey_deinit
    gnutls_openpgp_privkey_deinit.argtypes = [gnutls_openpgp_privkey_t]
    gnutls_openpgp_privkey_deinit.restype = None

    gnutls_openpgp_privkey_export = libgnutls.gnutls_openpgp_privkey_export
    gnutls_openpgp_privkey_export.argtypes = [gnutls_openpgp_privkey_t, gnutls_openpgp_crt_fmt_t, c_char_p, c_uint, c_void_p, POINTER(size_t)]
    gnutls_openpgp_privkey_export.restype = c_int

    gnutls_openpgp_privkey_export_dsa_raw = libgnutls.gnutls_openpgp_privkey_export_dsa_raw
    gnutls_openpgp_privkey_export_dsa_raw.argtypes = [gnutls_openpgp_privkey_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_privkey_export_dsa_raw.restype = c_int

    gnutls_openpgp_privkey_export_rsa_raw = libgnutls.gnutls_openpgp_privkey_export_rsa_raw
    gnutls_openpgp_privkey_export_rsa_raw.argtypes = [gnutls_openpgp_privkey_t, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_privkey_export_rsa_raw.restype = c_int

    gnutls_openpgp_privkey_export_subkey_dsa_raw = libgnutls.gnutls_openpgp_privkey_export_subkey_dsa_raw
    gnutls_openpgp_privkey_export_subkey_dsa_raw.argtypes = [gnutls_openpgp_privkey_t, c_uint, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_privkey_export_subkey_dsa_raw.restype = c_int

    gnutls_openpgp_privkey_export_subkey_rsa_raw = libgnutls.gnutls_openpgp_privkey_export_subkey_rsa_raw
    gnutls_openpgp_privkey_export_subkey_rsa_raw.argtypes = [gnutls_openpgp_privkey_t, c_uint, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_openpgp_privkey_export_subkey_rsa_raw.restype = c_int

    gnutls_openpgp_privkey_get_fingerprint = libgnutls.gnutls_openpgp_privkey_get_fingerprint
    gnutls_openpgp_privkey_get_fingerprint.argtypes = [gnutls_openpgp_privkey_t, c_void_p, POINTER(size_t)]
    gnutls_openpgp_privkey_get_fingerprint.restype = c_int

    gnutls_openpgp_privkey_get_key_id = libgnutls.gnutls_openpgp_privkey_get_key_id
    gnutls_openpgp_privkey_get_key_id.argtypes = [gnutls_openpgp_privkey_t, POINTER(c_ubyte)]
    gnutls_openpgp_privkey_get_key_id.restype = c_int

    gnutls_openpgp_privkey_get_pk_algorithm = libgnutls.gnutls_openpgp_privkey_get_pk_algorithm
    gnutls_openpgp_privkey_get_pk_algorithm.argtypes = [gnutls_openpgp_privkey_t, POINTER(c_uint)]
    gnutls_openpgp_privkey_get_pk_algorithm.restype = gnutls_pk_algorithm_t

    gnutls_openpgp_privkey_get_preferred_key_id = libgnutls.gnutls_openpgp_privkey_get_preferred_key_id
    gnutls_openpgp_privkey_get_preferred_key_id.argtypes = [gnutls_openpgp_privkey_t, POINTER(c_ubyte)]
    gnutls_openpgp_privkey_get_preferred_key_id.restype = c_int

    gnutls_openpgp_privkey_get_revoked_status = libgnutls.gnutls_openpgp_privkey_get_revoked_status
    gnutls_openpgp_privkey_get_revoked_status.argtypes = [gnutls_openpgp_privkey_t]
    gnutls_openpgp_privkey_get_revoked_status.restype = c_int

    gnutls_openpgp_privkey_get_subkey_count = libgnutls.gnutls_openpgp_privkey_get_subkey_count
    gnutls_openpgp_privkey_get_subkey_count.argtypes = [gnutls_openpgp_privkey_t]
    gnutls_openpgp_privkey_get_subkey_count.restype = c_int

    gnutls_openpgp_privkey_get_subkey_creation_time = libgnutls.gnutls_openpgp_privkey_get_subkey_creation_time
    gnutls_openpgp_privkey_get_subkey_creation_time.argtypes = [gnutls_openpgp_privkey_t, c_uint]
    gnutls_openpgp_privkey_get_subkey_creation_time.restype = time_t
    gnutls_openpgp_privkey_get_subkey_creation_time.errmsg = "cannot get OpenPGP subkey creation time"

    gnutls_openpgp_privkey_get_subkey_expiration_time = libgnutls.gnutls_openpgp_privkey_get_subkey_expiration_time
    gnutls_openpgp_privkey_get_subkey_expiration_time.argtypes = [gnutls_openpgp_privkey_t, c_uint]
    gnutls_openpgp_privkey_get_subkey_expiration_time.restype = time_t
    gnutls_openpgp_privkey_get_subkey_expiration_time.errmsg = "cannot get OpenPGP subkey expiration time"

    gnutls_openpgp_privkey_get_subkey_fingerprint = libgnutls.gnutls_openpgp_privkey_get_subkey_fingerprint
    gnutls_openpgp_privkey_get_subkey_fingerprint.argtypes = [gnutls_openpgp_privkey_t, c_uint, c_void_p, POINTER(size_t)]
    gnutls_openpgp_privkey_get_subkey_fingerprint.restype = c_int

    gnutls_openpgp_privkey_get_subkey_id = libgnutls.gnutls_openpgp_privkey_get_subkey_id
    gnutls_openpgp_privkey_get_subkey_id.argtypes = [gnutls_openpgp_privkey_t, c_uint, POINTER(c_ubyte)]
    gnutls_openpgp_privkey_get_subkey_id.restype = c_int

    gnutls_openpgp_privkey_get_subkey_idx = libgnutls.gnutls_openpgp_privkey_get_subkey_idx
    gnutls_openpgp_privkey_get_subkey_idx.argtypes = [gnutls_openpgp_privkey_t, POINTER(c_ubyte)]
    gnutls_openpgp_privkey_get_subkey_idx.restype = c_int

    gnutls_openpgp_privkey_get_subkey_pk_algorithm = libgnutls.gnutls_openpgp_privkey_get_subkey_pk_algorithm
    gnutls_openpgp_privkey_get_subkey_pk_algorithm.argtypes = [gnutls_openpgp_privkey_t, c_uint, POINTER(c_uint)]
    gnutls_openpgp_privkey_get_subkey_pk_algorithm.restype = gnutls_pk_algorithm_t

    gnutls_openpgp_privkey_get_subkey_revoked_status = libgnutls.gnutls_openpgp_privkey_get_subkey_revoked_status
    gnutls_openpgp_privkey_get_subkey_revoked_status.argtypes = [gnutls_openpgp_privkey_t, c_uint]
    gnutls_openpgp_privkey_get_subkey_revoked_status.restype = c_int

    gnutls_openpgp_privkey_import = libgnutls.gnutls_openpgp_privkey_import
    gnutls_openpgp_privkey_import.argtypes = [gnutls_openpgp_privkey_t, POINTER(gnutls_datum_t), gnutls_openpgp_crt_fmt_t, c_char_p, c_uint]
    gnutls_openpgp_privkey_import.restype = c_int

    gnutls_openpgp_privkey_init = libgnutls.gnutls_openpgp_privkey_init
    gnutls_openpgp_privkey_init.argtypes = [POINTER(gnutls_openpgp_privkey_t)]
    gnutls_openpgp_privkey_init.restype = c_int

    gnutls_openpgp_privkey_set_preferred_key_id = libgnutls.gnutls_openpgp_privkey_set_preferred_key_id
    gnutls_openpgp_privkey_set_preferred_key_id.argtypes = [gnutls_openpgp_privkey_t, POINTER(c_ubyte)]
    gnutls_openpgp_privkey_set_preferred_key_id.restype = c_int

    gnutls_openpgp_send_cert = libgnutls.gnutls_openpgp_send_cert
    gnutls_openpgp_send_cert.argtypes = [gnutls_session_t, gnutls_openpgp_crt_status_t]
    gnutls_openpgp_send_cert.restype = None

    gnutls_openpgp_set_recv_key_function = libgnutls.gnutls_openpgp_set_recv_key_function
    gnutls_openpgp_set_recv_key_function.argtypes = [gnutls_session_t, gnutls_openpgp_recv_key_func]
    gnutls_openpgp_set_recv_key_function.restype = None

# The SRP related functions are not always present (some distributions do not compile SRP support into libgnutls)
#

try:
    gnutls_srp_allocate_client_credentials = libgnutls.gnutls_srp_allocate_client_credentials
except AttributeError:
    pass
else:
    gnutls_srp_allocate_client_credentials = libgnutls.gnutls_srp_allocate_client_credentials
    gnutls_srp_allocate_client_credentials.argtypes = [POINTER(gnutls_srp_client_credentials_t)]
    gnutls_srp_allocate_client_credentials.restype = c_int

    gnutls_srp_allocate_server_credentials = libgnutls.gnutls_srp_allocate_server_credentials
    gnutls_srp_allocate_server_credentials.argtypes = [POINTER(gnutls_srp_server_credentials_t)]
    gnutls_srp_allocate_server_credentials.restype = c_int

    gnutls_srp_base64_decode = libgnutls.gnutls_srp_base64_decode
    gnutls_srp_base64_decode.argtypes = [POINTER(gnutls_datum_t), c_char_p, POINTER(size_t)]
    gnutls_srp_base64_decode.restype = c_int

    gnutls_srp_base64_encode = libgnutls.gnutls_srp_base64_encode
    gnutls_srp_base64_encode.argtypes = [POINTER(gnutls_datum_t), c_char_p, POINTER(size_t)]
    gnutls_srp_base64_encode.restype = c_int

    gnutls_srp_free_client_credentials = libgnutls.gnutls_srp_free_client_credentials
    gnutls_srp_free_client_credentials.argtypes = [gnutls_srp_client_credentials_t]
    gnutls_srp_free_client_credentials.restype = None

    gnutls_srp_free_server_credentials = libgnutls.gnutls_srp_free_server_credentials
    gnutls_srp_free_server_credentials.argtypes = [gnutls_srp_server_credentials_t]
    gnutls_srp_free_server_credentials.restype = None

    gnutls_srp_server_get_username = libgnutls.gnutls_srp_server_get_username
    gnutls_srp_server_get_username.argtypes = [gnutls_session_t]
    gnutls_srp_server_get_username.restype = c_char_p

    gnutls_srp_set_client_credentials = libgnutls.gnutls_srp_set_client_credentials
    gnutls_srp_set_client_credentials.argtypes = [gnutls_srp_client_credentials_t, c_char_p, c_char_p]
    gnutls_srp_set_client_credentials.restype = c_int

    gnutls_srp_set_client_credentials_function = libgnutls.gnutls_srp_set_client_credentials_function
    gnutls_srp_set_client_credentials_function.argtypes = [gnutls_srp_client_credentials_t, gnutls_srp_client_credentials_function]
    gnutls_srp_set_client_credentials_function.restype = None

    gnutls_srp_set_server_credentials_file = libgnutls.gnutls_srp_set_server_credentials_file
    gnutls_srp_set_server_credentials_file.argtypes = [gnutls_srp_server_credentials_t, c_char_p, c_char_p]
    gnutls_srp_set_server_credentials_file.restype = c_int

    gnutls_srp_set_server_credentials_function = libgnutls.gnutls_srp_set_server_credentials_function
    gnutls_srp_set_server_credentials_function.argtypes = [gnutls_srp_server_credentials_t, gnutls_srp_server_credentials_function]
    gnutls_srp_set_server_credentials_function.restype = None

    gnutls_srp_verifier = libgnutls.gnutls_srp_verifier
    gnutls_srp_verifier.argtypes = [c_char_p, c_char_p, POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t), POINTER(gnutls_datum_t)]
    gnutls_srp_verifier.restype = c_int


__all__ = sorted(name for name, obj in sys.modules[__name__].__dict__.iteritems() if name.startswith('gnutls_') and hasattr(obj, 'restype'))