summaryrefslogtreecommitdiffstats
path: root/doc/reference/html/gnutls-pkcs12.html
blob: 05974475fc4e2825629af5f5be4b729b2986597f (plain)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>pkcs12: GnuTLS API Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GnuTLS API Reference Manual">
<link rel="up" href="intro.html" title="GnuTLS API Reference Manual">
<link rel="prev" href="gnutls-pkcs11.html" title="pkcs11">
<link rel="next" href="gnutls-ocsp.html" title="ocsp">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#gnutls-pkcs12.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="intro.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gnutls-pkcs11.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gnutls-ocsp.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gnutls-pkcs12"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gnutls-pkcs12.top_of_page"></a>pkcs12</span></h2>
<p>pkcs12</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gnutls-pkcs12.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-init" title="gnutls_pkcs12_init ()">gnutls_pkcs12_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-deinit" title="gnutls_pkcs12_deinit ()">gnutls_pkcs12_deinit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-import" title="gnutls_pkcs12_import ()">gnutls_pkcs12_import</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-export" title="gnutls_pkcs12_export ()">gnutls_pkcs12_export</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-export2" title="gnutls_pkcs12_export2 ()">gnutls_pkcs12_export2</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-get-bag" title="gnutls_pkcs12_get_bag ()">gnutls_pkcs12_get_bag</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-set-bag" title="gnutls_pkcs12_set_bag ()">gnutls_pkcs12_set_bag</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-generate-mac" title="gnutls_pkcs12_generate_mac ()">gnutls_pkcs12_generate_mac</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-generate-mac2" title="gnutls_pkcs12_generate_mac2 ()">gnutls_pkcs12_generate_mac2</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-verify-mac" title="gnutls_pkcs12_verify_mac ()">gnutls_pkcs12_verify_mac</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-decrypt" title="gnutls_pkcs12_bag_decrypt ()">gnutls_pkcs12_bag_decrypt</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-encrypt" title="gnutls_pkcs12_bag_encrypt ()">gnutls_pkcs12_bag_encrypt</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-enc-info" title="gnutls_pkcs12_bag_enc_info ()">gnutls_pkcs12_bag_enc_info</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-mac-info" title="gnutls_pkcs12_mac_info ()">gnutls_pkcs12_mac_info</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-simple-parse" title="gnutls_pkcs12_simple_parse ()">gnutls_pkcs12_simple_parse</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-data" title="gnutls_pkcs12_bag_get_data ()">gnutls_pkcs12_bag_get_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()">gnutls_pkcs12_bag_set_data</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-crl" title="gnutls_pkcs12_bag_set_crl ()">gnutls_pkcs12_bag_set_crl</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-crt" title="gnutls_pkcs12_bag_set_crt ()">gnutls_pkcs12_bag_set_crt</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-privkey" title="gnutls_pkcs12_bag_set_privkey ()">gnutls_pkcs12_bag_set_privkey</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-init" title="gnutls_pkcs12_bag_init ()">gnutls_pkcs12_bag_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-deinit" title="gnutls_pkcs12_bag_deinit ()">gnutls_pkcs12_bag_deinit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-count" title="gnutls_pkcs12_bag_get_count ()">gnutls_pkcs12_bag_get_count</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-key-id" title="gnutls_pkcs12_bag_get_key_id ()">gnutls_pkcs12_bag_get_key_id</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-key-id" title="gnutls_pkcs12_bag_set_key_id ()">gnutls_pkcs12_bag_set_key_id</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-get-friendly-name" title="gnutls_pkcs12_bag_get_friendly_name ()">gnutls_pkcs12_bag_get_friendly_name</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-friendly-name" title="gnutls_pkcs12_bag_set_friendly_name ()">gnutls_pkcs12_bag_set_friendly_name</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gnutls-pkcs12.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody>
<tr>
<td class="typedef_keyword">typedef</td>
<td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t">gnutls_pkcs12_t</a></td>
</tr>
<tr>
<td class="typedef_keyword">typedef</td>
<td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t">gnutls_pkcs12_bag_t</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="gnutls-pkcs12.html#GNUTLS-PKCS12-SP-INCLUDE-SELF-SIGNED:CAPS" title="GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED">GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-type-t" title="enum gnutls_pkcs12_bag_type_t">gnutls_pkcs12_bag_type_t</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-int" title="gnutls_pkcs12_bag_int">gnutls_pkcs12_bag_int</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-int" title="gnutls_pkcs12_int">gnutls_pkcs12_int</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gnutls-pkcs12.description"></a><h2>Description</h2>
</div>
<div class="refsect1">
<a name="gnutls-pkcs12.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gnutls-pkcs12-init"></a><h3>gnutls_pkcs12_init ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_init (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> *pkcs12</code></em>);</pre>
<p>This function will initialize a PKCS12 type. PKCS12 structures
usually contain lists of X.509 Certificates and X.509 Certificate
revocation lists.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>A pointer to the type to be initialized</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-init.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-deinit"></a><h3>gnutls_pkcs12_deinit ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gnutls_pkcs12_deinit (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>);</pre>
<p>This function will deinitialize a PKCS12 type.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-deinit.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>The type to be initialized</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-import"></a><h3>gnutls_pkcs12_import ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_import (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                      <em class="parameter"><code>const <a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *data</code></em>,
                      <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-fmt-t" title="enum gnutls_x509_crt_fmt_t"><span class="type">gnutls_x509_crt_fmt_t</span></a> format</code></em>,
                      <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
<p>This function will convert the given DER or PEM encoded PKCS12
to the native gnutls_pkcs12_t format. The output will be stored in 'pkcs12'.</p>
<p>If the PKCS12 is PEM encoded it should have a header of "PKCS12".</p>
<div class="refsect3">
<a name="gnutls-pkcs12-import.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>The data to store the parsed PKCS12.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>The DER or PEM encoded PKCS12.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>One of DER or PEM</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>an ORed sequence of gnutls_privkey_pkcs8_flags</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-import.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-export"></a><h3>gnutls_pkcs12_export ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_export (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                      <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-fmt-t" title="enum gnutls_x509_crt_fmt_t"><span class="type">gnutls_x509_crt_fmt_t</span></a> format</code></em>,
                      <em class="parameter"><code><span class="type">void</span> *output_data</code></em>,
                      <em class="parameter"><code><span class="type">size_t</span> *output_data_size</code></em>);</pre>
<p>This function will export the pkcs12 structure to DER or PEM format.</p>
<p>If the buffer provided is not long enough to hold the output, then
*output_data_size will be updated and GNUTLS_E_SHORT_MEMORY_BUFFER
will be returned.</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN PKCS12".</p>
<div class="refsect3">
<a name="gnutls-pkcs12-export.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>A pkcs12 type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>the format of output params. One of PEM or DER.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>output_data</p></td>
<td class="parameter_description"><p>will contain a structure PEM or DER encoded</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>output_data_size</p></td>
<td class="parameter_description"><p>holds the size of output_data (and will be
replaced by the actual size of parameters)</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-export.returns"></a><h4>Returns</h4>
<p> In case of failure a negative error code will be
returned, and 0 on success.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-export2"></a><h3>gnutls_pkcs12_export2 ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_export2 (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                       <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-fmt-t" title="enum gnutls_x509_crt_fmt_t"><span class="type">gnutls_x509_crt_fmt_t</span></a> format</code></em>,
                       <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *out</code></em>);</pre>
<p>This function will export the pkcs12 structure to DER or PEM format.</p>
<p>The output buffer is allocated using <code class="function">gnutls_malloc()</code>.</p>
<p>If the structure is PEM encoded, it will have a header
of "BEGIN PKCS12".</p>
<div class="refsect3">
<a name="gnutls-pkcs12-export2.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>A pkcs12 type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>format</p></td>
<td class="parameter_description"><p>the format of output params. One of PEM or DER.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out</p></td>
<td class="parameter_description"><p>will contain a structure PEM or DER encoded</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-export2.returns"></a><h4>Returns</h4>
<p> In case of failure a negative error code will be
returned, and 0 on success.</p>
</div>
<p class="since">Since: 3.1.3</p>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-get-bag"></a><h3>gnutls_pkcs12_get_bag ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_get_bag (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                       <em class="parameter"><code><span class="type">int</span> indx</code></em>,
                       <em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
<p>This function will return a Bag from the PKCS12 structure.</p>
<p>After the last Bag has been read
<a class="link" href="gnutls-gnutls.html#GNUTLS-E-REQUESTED-DATA-NOT-AVAILABLE:CAPS" title="GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE"><code class="literal">GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE</code></a> will be returned.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-get-bag.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>A pkcs12 type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>indx</p></td>
<td class="parameter_description"><p>contains the index of the bag to extract</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>An initialized bag, where the contents of the bag will be copied</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-get-bag.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-set-bag"></a><h3>gnutls_pkcs12_set_bag ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_set_bag (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                       <em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
<p>This function will insert a Bag into the PKCS12 structure.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-set-bag.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>should contain a gnutls_pkcs12_t type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>An initialized bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-set-bag.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-generate-mac"></a><h3>gnutls_pkcs12_generate_mac ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_generate_mac (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                            <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
<p>This function will generate a MAC for the PKCS12 structure.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-generate-mac.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>A pkcs12 type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pass</p></td>
<td class="parameter_description"><p>The password for the MAC</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-generate-mac.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-generate-mac2"></a><h3>gnutls_pkcs12_generate_mac2 ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_generate_mac2 (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                             <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-mac-algorithm-t" title="enum gnutls_mac_algorithm_t"><span class="type">gnutls_mac_algorithm_t</span></a> mac</code></em>,
                             <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
<p>This function will generate a MAC for the PKCS12 structure.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-generate-mac2.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>A pkcs12 type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mac</p></td>
<td class="parameter_description"><p>the MAC algorithm to use</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pass</p></td>
<td class="parameter_description"><p>The password for the MAC</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-generate-mac2.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-verify-mac"></a><h3>gnutls_pkcs12_verify_mac ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_verify_mac (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                          <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
<p>This function will verify the MAC for the PKCS12 structure.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-verify-mac.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>should contain a gnutls_pkcs12_t type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pass</p></td>
<td class="parameter_description"><p>The password for the MAC</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-verify-mac.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-decrypt"></a><h3>gnutls_pkcs12_bag_decrypt ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_decrypt (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                           <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>);</pre>
<p>This function will decrypt the given encrypted bag and return 0 on
success.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-decrypt.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pass</p></td>
<td class="parameter_description"><p>The password used for encryption, must be ASCII.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-decrypt.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned,
otherwise a negative error code is returned.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-encrypt"></a><h3>gnutls_pkcs12_bag_encrypt ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_encrypt (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                           <em class="parameter"><code>const <span class="type">char</span> *pass</code></em>,
                           <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
<p>This function will encrypt the given bag.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-encrypt.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>pass</p></td>
<td class="parameter_description"><p>The password used for encryption, must be ASCII</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>should be one of <a class="link" href="gnutls-x509.html#gnutls-pkcs-encrypt-flags-t" title="enum gnutls_pkcs_encrypt_flags_t"><span class="type">gnutls_pkcs_encrypt_flags_t</span></a> elements bitwise or'd</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-encrypt.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned,
otherwise a negative error code is returned.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-enc-info"></a><h3>gnutls_pkcs12_bag_enc_info ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_enc_info (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                            <em class="parameter"><code>unsigned <span class="type">int</span> *schema</code></em>,
                            <em class="parameter"><code>unsigned <span class="type">int</span> *cipher</code></em>,
                            <em class="parameter"><code><span class="type">void</span> *salt</code></em>,
                            <em class="parameter"><code>unsigned <span class="type">int</span> *salt_size</code></em>,
                            <em class="parameter"><code>unsigned <span class="type">int</span> *iter_count</code></em>,
                            <em class="parameter"><code><span class="type">char</span> **oid</code></em>);</pre>
<p>This function will provide information on the encryption algorithms used
in an encrypted bag. If the structure algorithms
are unknown the code <a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-CIPHER-TYPE:CAPS" title="GNUTLS_E_UNKNOWN_CIPHER_TYPE"><code class="literal">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code></a> will be returned,
and only <em class="parameter"><code>oid</code></em>
, will be set. That is, <em class="parameter"><code>oid</code></em>
 will be set on encrypted bags
whether supported or not. It must be deinitialized using <a class="link" href="gnutls-gnutls.html#gnutls-free" title="gnutls_free()"><code class="function">gnutls_free()</code></a>.
The other variables are only set on supported structures.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-enc-info.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>schema</p></td>
<td class="parameter_description"><p>indicate the schema as one of <a class="link" href="gnutls-x509.html#gnutls-pkcs-encrypt-flags-t" title="enum gnutls_pkcs_encrypt_flags_t"><code class="literal">gnutls_pkcs_encrypt_flags_t</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cipher</p></td>
<td class="parameter_description"><p>the cipher used as <a class="link" href="gnutls-gnutls.html#gnutls-cipher-algorithm-t" title="enum gnutls_cipher_algorithm_t"><code class="literal">gnutls_cipher_algorithm_t</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>salt</p></td>
<td class="parameter_description"><p>PBKDF2 salt (if non-NULL then <em class="parameter"><code>salt_size</code></em>
initially holds its size)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>salt_size</p></td>
<td class="parameter_description"><p>PBKDF2 salt size</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>iter_count</p></td>
<td class="parameter_description"><p>PBKDF2 iteration count</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>oid</p></td>
<td class="parameter_description"><p>if non-NULL it will contain an allocated null-terminated variable with the OID</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-enc-info.returns"></a><h4>Returns</h4>
<p> <a class="link" href="gnutls-gnutls.html#GNUTLS-E-INVALID-REQUEST:CAPS" title="GNUTLS_E_INVALID_REQUEST"><code class="literal">GNUTLS_E_INVALID_REQUEST</code></a> if the provided bag isn't encrypted,
<a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-CIPHER-TYPE:CAPS" title="GNUTLS_E_UNKNOWN_CIPHER_TYPE"><code class="literal">GNUTLS_E_UNKNOWN_CIPHER_TYPE</code></a> if the structure's encryption isn't supported, or
another negative error code in case of a failure. Zero on success.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-mac-info"></a><h3>gnutls_pkcs12_mac_info ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_mac_info (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> pkcs12</code></em>,
                        <em class="parameter"><code>unsigned <span class="type">int</span> *mac</code></em>,
                        <em class="parameter"><code><span class="type">void</span> *salt</code></em>,
                        <em class="parameter"><code>unsigned <span class="type">int</span> *salt_size</code></em>,
                        <em class="parameter"><code>unsigned <span class="type">int</span> *iter_count</code></em>,
                        <em class="parameter"><code><span class="type">char</span> **oid</code></em>);</pre>
<p>This function will provide information on the MAC algorithm used
in a PKCS <span class="type">12</span> structure. If the structure algorithms
are unknown the code <a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-HASH-ALGORITHM:CAPS" title="GNUTLS_E_UNKNOWN_HASH_ALGORITHM"><code class="literal">GNUTLS_E_UNKNOWN_HASH_ALGORITHM</code></a> will be returned,
and only <em class="parameter"><code>oid</code></em>
, will be set. That is, <em class="parameter"><code>oid</code></em>
 will be set on structures
with a MAC whether supported or not. It must be deinitialized using <a class="link" href="gnutls-gnutls.html#gnutls-free" title="gnutls_free()"><code class="function">gnutls_free()</code></a>.
The other variables are only set on supported structures.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-mac-info.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>pkcs12</p></td>
<td class="parameter_description"><p>A pkcs12 type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mac</p></td>
<td class="parameter_description"><p>the MAC algorithm used as <a class="link" href="gnutls-gnutls.html#gnutls-mac-algorithm-t" title="enum gnutls_mac_algorithm_t"><code class="literal">gnutls_mac_algorithm_t</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>salt</p></td>
<td class="parameter_description"><p>the salt used for string to key (if non-NULL then <em class="parameter"><code>salt_size</code></em>
initially holds its size)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>salt_size</p></td>
<td class="parameter_description"><p>string to key salt size</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>iter_count</p></td>
<td class="parameter_description"><p>string to key iteration count</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>oid</p></td>
<td class="parameter_description"><p>if non-NULL it will contain an allocated null-terminated variable with the OID</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-mac-info.returns"></a><h4>Returns</h4>
<p> <a class="link" href="gnutls-gnutls.html#GNUTLS-E-INVALID-REQUEST:CAPS" title="GNUTLS_E_INVALID_REQUEST"><code class="literal">GNUTLS_E_INVALID_REQUEST</code></a> if the provided structure doesn't contain a MAC,
<a class="link" href="gnutls-gnutls.html#GNUTLS-E-UNKNOWN-HASH-ALGORITHM:CAPS" title="GNUTLS_E_UNKNOWN_HASH_ALGORITHM"><code class="literal">GNUTLS_E_UNKNOWN_HASH_ALGORITHM</code></a> if the structure's MAC isn't supported, or
another negative error code in case of a failure. Zero on success.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-simple-parse"></a><h3>gnutls_pkcs12_simple_parse ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_simple_parse (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-t" title="gnutls_pkcs12_t"><span class="type">gnutls_pkcs12_t</span></a> p12</code></em>,
                            <em class="parameter"><code>const <span class="type">char</span> *password</code></em>,
                            <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-privkey-t" title="gnutls_x509_privkey_t"><span class="type">gnutls_x509_privkey_t</span></a> *key</code></em>,
                            <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-t" title="gnutls_x509_crt_t"><span class="type">gnutls_x509_crt_t</span></a> **chain</code></em>,
                            <em class="parameter"><code>unsigned <span class="type">int</span> *chain_len</code></em>,
                            <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-t" title="gnutls_x509_crt_t"><span class="type">gnutls_x509_crt_t</span></a> **extra_certs</code></em>,
                            <em class="parameter"><code>unsigned <span class="type">int</span> *extra_certs_len</code></em>,
                            <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crl-t" title="gnutls_x509_crl_t"><span class="type">gnutls_x509_crl_t</span></a> *crl</code></em>,
                            <em class="parameter"><code>unsigned <span class="type">int</span> flags</code></em>);</pre>
<p>This function parses a PKCS12 structure in <em class="parameter"><code>pkcs12</code></em>
 and extracts the
private key, the corresponding certificate chain, any additional
certificates and a CRL. The structures in <em class="parameter"><code>key</code></em>
, <em class="parameter"><code>chain</code></em>
 <em class="parameter"><code>crl</code></em>
, and <em class="parameter"><code>extra_certs</code></em>

must not be initialized.</p>
<p>The <em class="parameter"><code>extra_certs</code></em>
 and <em class="parameter"><code>extra_certs_len</code></em>
 parameters are optional
and both may be set to <code class="literal">NULL</code>. If either is non-<code class="literal">NULL</code>, then both must
be set. The value for <em class="parameter"><code>extra_certs</code></em>
 is allocated
using <code class="function">gnutls_malloc()</code>.</p>
<p>Encrypted PKCS12 bags and PKCS8 private keys are supported, but
only with password based security and the same password for all
operations.</p>
<p>Note that a PKCS12 structure may contain many keys and/or certificates,
and there is no way to identify which key/certificate pair you want.
For this reason this function is useful for PKCS12 files that contain 
only one key/certificate pair and/or one CRL.</p>
<p>If the provided structure has encrypted fields but no password
is provided then this function returns <a class="link" href="gnutls-gnutls.html#GNUTLS-E-DECRYPTION-FAILED:CAPS" title="GNUTLS_E_DECRYPTION_FAILED"><code class="literal">GNUTLS_E_DECRYPTION_FAILED</code></a>.</p>
<p>Note that normally the chain constructed does not include self signed
certificates, to comply with TLS' requirements. If, however, the flag 
<a class="link" href="gnutls-pkcs12.html#GNUTLS-PKCS12-SP-INCLUDE-SELF-SIGNED:CAPS" title="GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED"><code class="literal">GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</code></a> is specified then
self signed certificates will be included in the chain.</p>
<p>Prior to using this function the PKCS <span class="type">12</span> structure integrity must
be verified using <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-verify-mac" title="gnutls_pkcs12_verify_mac ()"><code class="function">gnutls_pkcs12_verify_mac()</code></a>.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-simple-parse.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>p12</p></td>
<td class="parameter_description"><p>A pkcs12 type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>password</p></td>
<td class="parameter_description"><p>optional password used to decrypt the structure, bags and keys.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>key</p></td>
<td class="parameter_description"><p>a structure to store the parsed private key.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>chain</p></td>
<td class="parameter_description"><p>the corresponding to key certificate chain (may be <code class="literal">NULL</code>)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>chain_len</p></td>
<td class="parameter_description"><p>will be updated with the number of additional (may be <code class="literal">NULL</code>)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>extra_certs</p></td>
<td class="parameter_description"><p>optional pointer to receive an array of additional
certificates found in the PKCS12 structure (may be <code class="literal">NULL</code>).</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>extra_certs_len</p></td>
<td class="parameter_description"><p>will be updated with the number of additional
certs (may be <code class="literal">NULL</code>).</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>crl</p></td>
<td class="parameter_description"><p>an optional structure to store the parsed CRL (may be <code class="literal">NULL</code>).</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>should be zero or one of GNUTLS_PKCS12_SP_*</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-simple-parse.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
<p class="since">Since: 3.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-get-data"></a><h3>gnutls_pkcs12_bag_get_data ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_get_data (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                            <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
                            <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *data</code></em>);</pre>
<p>This function will return the bag's data. The data is a constant
that is stored into the bag.  Should not be accessed after the bag
is deleted.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-data.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>indx</p></td>
<td class="parameter_description"><p>The element of the bag to get the data from</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>where the bag's data will be. Should be treated as constant.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-data.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-set-data"></a><h3>gnutls_pkcs12_bag_set_data ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_set_data (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                            <em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-type-t" title="enum gnutls_pkcs12_bag_type_t"><span class="type">gnutls_pkcs12_bag_type_t</span></a> type</code></em>,
                            <em class="parameter"><code>const <a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *data</code></em>);</pre>
<p>This function will insert the given data of the given type into
the bag.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-data.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>type</p></td>
<td class="parameter_description"><p>The data's type</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the data to be copied.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-data.returns"></a><h4>Returns</h4>
<p> the index of the added bag on success, or a negative
value on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-set-crl"></a><h3>gnutls_pkcs12_bag_set_crl ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_set_crl (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                           <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crl-t" title="gnutls_x509_crl_t"><span class="type">gnutls_x509_crl_t</span></a> crl</code></em>);</pre>
<p>This function will insert the given CRL into the
bag. This is just a wrapper over <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()"><code class="function">gnutls_pkcs12_bag_set_data()</code></a>.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-crl.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>crl</p></td>
<td class="parameter_description"><p>the CRL to be copied.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-crl.returns"></a><h4>Returns</h4>
<p> the index of the added bag on success, or a negative error code
on failure.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-set-crt"></a><h3>gnutls_pkcs12_bag_set_crt ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_set_crt (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                           <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-crt-t" title="gnutls_x509_crt_t"><span class="type">gnutls_x509_crt_t</span></a> crt</code></em>);</pre>
<p>This function will insert the given certificate into the
bag. This is just a wrapper over <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()"><code class="function">gnutls_pkcs12_bag_set_data()</code></a>.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-crt.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>crt</p></td>
<td class="parameter_description"><p>the certificate to be copied.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-crt.returns"></a><h4>Returns</h4>
<p> the index of the added bag on success, or a negative
value on failure.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-set-privkey"></a><h3>gnutls_pkcs12_bag_set_privkey ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_set_privkey (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                               <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-x509-privkey-t" title="gnutls_x509_privkey_t"><span class="type">gnutls_x509_privkey_t</span></a> privkey</code></em>,
                               <em class="parameter"><code>const <span class="type">char</span> *password</code></em>,
                               <em class="parameter"><code><span class="type">unsigned </span> flags</code></em>);</pre>
<p>This function will insert the given private key into the
bag. This is just a wrapper over <a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-set-data" title="gnutls_pkcs12_bag_set_data ()"><code class="function">gnutls_pkcs12_bag_set_data()</code></a>.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-privkey.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>privkey</p></td>
<td class="parameter_description"><p>the private key to be copied.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>password</p></td>
<td class="parameter_description"><p>the password to protect the key with (may be <code class="literal">NULL</code>)</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>should be one of <a class="link" href="gnutls-x509.html#gnutls-pkcs-encrypt-flags-t" title="enum gnutls_pkcs_encrypt_flags_t"><span class="type">gnutls_pkcs_encrypt_flags_t</span></a> elements bitwise or'd</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-privkey.returns"></a><h4>Returns</h4>
<p> the index of the added bag on success, or a negative
value on failure.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-init"></a><h3>gnutls_pkcs12_bag_init ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_init (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> *bag</code></em>);</pre>
<p>This function will initialize a PKCS12 bag structure. PKCS12 Bags
usually contain private keys, lists of X.509 Certificates and X.509
Certificate revocation lists.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>A pointer to the type to be initialized</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-init.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-deinit"></a><h3>gnutls_pkcs12_bag_deinit ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gnutls_pkcs12_bag_deinit (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
<p>This function will deinitialize a PKCS12 Bag structure.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-deinit.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>A pointer to the type to be initialized</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-get-count"></a><h3>gnutls_pkcs12_bag_get_count ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_get_count (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>);</pre>
<p>This function will return the number of the elements within the bag.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-count.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-count.returns"></a><h4>Returns</h4>
<p> Number of elements in bag, or an negative error code on
error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-get-key-id"></a><h3>gnutls_pkcs12_bag_get_key_id ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_get_key_id (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                              <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
                              <em class="parameter"><code><a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *id</code></em>);</pre>
<p>This function will return the key ID, of the specified bag element.
The key ID is usually used to distinguish the local private key and
the certificate pair.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-key-id.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>indx</p></td>
<td class="parameter_description"><p>The bag's element to add the id</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>where the ID will be copied (to be treated as const)</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-key-id.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value. or a negative error code on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-set-key-id"></a><h3>gnutls_pkcs12_bag_set_key_id ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_set_key_id (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                              <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
                              <em class="parameter"><code>const <a class="link" href="gnutls-gnutls.html#gnutls-datum-t" title="gnutls_datum_t"><span class="type">gnutls_datum_t</span></a> *id</code></em>);</pre>
<p>This function will add the given key ID, to the specified, by the
index, bag element. The key ID will be encoded as a 'Local key
identifier' bag attribute, which is usually used to distinguish
the local private key and the certificate pair.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-key-id.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>indx</p></td>
<td class="parameter_description"><p>The bag's element to add the id</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>id</p></td>
<td class="parameter_description"><p>the ID</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-key-id.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value. or a negative error code on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-get-friendly-name"></a><h3>gnutls_pkcs12_bag_get_friendly_name ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_get_friendly_name (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                                     <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
                                     <em class="parameter"><code><span class="type">char</span> **name</code></em>);</pre>
<p>This function will return the friendly name, of the specified bag
element.  The key ID is usually used to distinguish the local
private key and the certificate pair.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-friendly-name.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>indx</p></td>
<td class="parameter_description"><p>The bag's element to add the id</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>will hold a pointer to the name (to be treated as const)</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-get-friendly-name.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value. or a negative error code on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-set-friendly-name"></a><h3>gnutls_pkcs12_bag_set_friendly_name ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
gnutls_pkcs12_bag_set_friendly_name (<em class="parameter"><code><a class="link" href="gnutls-pkcs12.html#gnutls-pkcs12-bag-t" title="gnutls_pkcs12_bag_t"><span class="type">gnutls_pkcs12_bag_t</span></a> bag</code></em>,
                                     <em class="parameter"><code><span class="type">unsigned </span> indx</code></em>,
                                     <em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre>
<p>This function will add the given key friendly name, to the
specified, by the index, bag element. The name will be encoded as
a 'Friendly name' bag attribute, which is usually used to set a
user name to the local private key and the certificate pair.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-friendly-name.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>bag</p></td>
<td class="parameter_description"><p>The bag</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>indx</p></td>
<td class="parameter_description"><p>The bag's element to add the id</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>the name</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-set-friendly-name.returns"></a><h4>Returns</h4>
<p> On success, <a class="link" href="gnutls-gnutls.html#GNUTLS-E-SUCCESS:CAPS" title="GNUTLS_E_SUCCESS"><code class="literal">GNUTLS_E_SUCCESS</code></a> (0) is returned, otherwise a
negative error value. or a negative error code on error.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="gnutls-pkcs12.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="gnutls-pkcs12-t"></a><h3>gnutls_pkcs12_t</h3>
<pre class="programlisting">typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t;
</pre>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-t"></a><h3>gnutls_pkcs12_bag_t</h3>
<pre class="programlisting">typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t;
</pre>
</div>
<hr>
<div class="refsect2">
<a name="GNUTLS-PKCS12-SP-INCLUDE-SELF-SIGNED:CAPS"></a><h3>GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED</h3>
<pre class="programlisting">#define GNUTLS_PKCS12_SP_INCLUDE_SELF_SIGNED 1
</pre>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-type-t"></a><h3>enum gnutls_pkcs12_bag_type_t</h3>
<p>Enumeration of different PKCS 12 bag types.</p>
<div class="refsect3">
<a name="gnutls-pkcs12-bag-type-t.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-EMPTY:CAPS"></a>GNUTLS_BAG_EMPTY</p></td>
<td class="enum_member_description">
<p>Empty PKCS-12 bag.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-PKCS8-ENCRYPTED-KEY:CAPS"></a>GNUTLS_BAG_PKCS8_ENCRYPTED_KEY</p></td>
<td class="enum_member_description">
<p>PKCS-12 bag with PKCS-8 encrypted key.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-PKCS8-KEY:CAPS"></a>GNUTLS_BAG_PKCS8_KEY</p></td>
<td class="enum_member_description">
<p>PKCS-12 bag with PKCS-8 key.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-CERTIFICATE:CAPS"></a>GNUTLS_BAG_CERTIFICATE</p></td>
<td class="enum_member_description">
<p>PKCS-12 bag with certificate.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-CRL:CAPS"></a>GNUTLS_BAG_CRL</p></td>
<td class="enum_member_description">
<p>PKCS-12 bag with CRL.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-SECRET:CAPS"></a>GNUTLS_BAG_SECRET</p></td>
<td class="enum_member_description">
<p>PKCS-12 bag with secret PKCS-9 keys.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-ENCRYPTED:CAPS"></a>GNUTLS_BAG_ENCRYPTED</p></td>
<td class="enum_member_description">
<p>Encrypted PKCS-12 bag.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="GNUTLS-BAG-UNKNOWN:CAPS"></a>GNUTLS_BAG_UNKNOWN</p></td>
<td class="enum_member_description">
<p>Unknown PKCS-12 bag.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-bag-int"></a><h3>gnutls_pkcs12_bag_int</h3>
<pre class="programlisting">typedef struct {
	struct bag_element element[MAX_BAG_ELEMENTS];
	unsigned bag_elements;
} gnutls_pkcs12_bag_int;
</pre>
</div>
<hr>
<div class="refsect2">
<a name="gnutls-pkcs12-int"></a><h3>gnutls_pkcs12_int</h3>
<pre class="programlisting">typedef struct {
	asn1_node pkcs12;
	unsigned expanded;
} gnutls_pkcs12_int;
</pre>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>