summaryrefslogtreecommitdiffstats
path: root/src/libkmip/kmip.h
blob: e4c9b3056fb93b056107611b50aad23884541e19 (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
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
/* Copyright (c) 2018 The Johns Hopkins University/Applied Physics Laboratory
 * All Rights Reserved.
 *
 * This file is dual licensed under the terms of the Apache 2.0 License and
 * the BSD 3-Clause License. See the LICENSE file in the root of this
 * repository for more information.
 */

#ifndef KMIP_H
#define KMIP_H

#include <stddef.h>
#include <stdint.h>

/*
Types and Constants
*/

typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
typedef int32 bool32;

typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;

typedef size_t memory_index;

typedef float real32;
typedef double real64;

#define KMIP_TRUE (1)
#define KMIP_FALSE (0)

#define KMIP_UNSET (-1)

#define KMIP_OK                      (0)
#define KMIP_NOT_IMPLEMENTED         (-1)
#define KMIP_ERROR_BUFFER_FULL       (-2)
#define KMIP_ERROR_ATTR_UNSUPPORTED  (-3)
#define KMIP_TAG_MISMATCH            (-4)
#define KMIP_TYPE_MISMATCH           (-5)
#define KMIP_LENGTH_MISMATCH         (-6)
#define KMIP_PADDING_MISMATCH        (-7)
#define KMIP_BOOLEAN_MISMATCH        (-8)
#define KMIP_ENUM_MISMATCH           (-9)
#define KMIP_ENUM_UNSUPPORTED        (-10)
#define KMIP_INVALID_FOR_VERSION     (-11)
#define KMIP_MEMORY_ALLOC_FAILED     (-12)
#define KMIP_IO_FAILURE              (-13)
#define KMIP_EXCEED_MAX_MESSAGE_SIZE (-14)
#define KMIP_MALFORMED_RESPONSE      (-15)
#define KMIP_OBJECT_MISMATCH         (-16)
#define KMIP_ARG_INVALID             (-17)
#define KMIP_ERROR_BUFFER_UNDERFULL  (-18)

/*
Enumerations
*/

enum attestation_type
{
    /* KMIP 1.2 */
    KMIP_ATTEST_TPM_QUOTE            = 0x01,
    KMIP_ATTEST_TCG_INTEGRITY_REPORT = 0x02,
    KMIP_ATTEST_SAML_ASSERTION       = 0x03
};

enum attribute_type
{
    /* KMIP 1.0 */
    KMIP_ATTR_UNIQUE_IDENTIFIER               = 0,
    KMIP_ATTR_NAME                            = 1,
    KMIP_ATTR_OBJECT_TYPE                     = 2,
    KMIP_ATTR_CRYPTOGRAPHIC_ALGORITHM         = 3,
    KMIP_ATTR_CRYPTOGRAPHIC_LENGTH            = 4,
    KMIP_ATTR_CRYPTOGRAPHIC_PARAMETERS        = 5,
    KMIP_ATTR_CRYPTOGRAPHIC_DOMAIN_PARAMETERS = 6,
    KMIP_ATTR_CERTIFICATE_TYPE                = 7,
    KMIP_ATTR_CERTIFICATE_LENGTH              = 8,
    KMIP_ATTR_X509_CERTIFICATE_IDENTIFIER     = 9,
    KMIP_ATTR_X509_CERTIFICATE_SUBJECT        = 10,
    KMIP_ATTR_X509_CERTIFICATE_ISSUER         = 11,
    KMIP_ATTR_CERTIFICATE_IDENTIFIER          = 12,
    KMIP_ATTR_CERTIFICATE_SUBJECT             = 13,
    KMIP_ATTR_CERTIFICATE_ISSUER              = 14,
    KMIP_ATTR_DIGITAL_SIGNATURE_ALGORITHM     = 15,
    KMIP_ATTR_DIGEST                          = 16,
    KMIP_ATTR_OPERATION_POLICY_NAME           = 17,
    KMIP_ATTR_CRYPTOGRAPHIC_USAGE_MASK        = 18,
    KMIP_ATTR_LEASE_TIME                      = 19,
    KMIP_ATTR_USAGE_LIMITS                    = 20,
    KMIP_ATTR_STATE                           = 21,
    KMIP_ATTR_INITIAL_DATE                    = 22,
    KMIP_ATTR_ACTIVATION_DATE                 = 23,
    KMIP_ATTR_PROCESS_START_DATE              = 24,
    KMIP_ATTR_PROTECT_STOP_DATE               = 25,
    KMIP_ATTR_DEACTIVATION_DATE               = 26,
    KMIP_ATTR_DESTROY_DATE                    = 27,
    KMIP_ATTR_COMPROMISE_OCCURRENCE_DATE      = 28,
    KMIP_ATTR_COMPROMISE_DATE                 = 29,
    KMIP_ATTR_REVOCATION_REASON               = 30,
    KMIP_ATTR_ARCHIVE_DATE                    = 31,
    KMIP_ATTR_OBJECT_GROUP                    = 32,
    KMIP_ATTR_FRESH                           = 33,
    KMIP_ATTR_LINK                            = 34,
    KMIP_ATTR_APPLICATION_SPECIFIC_INFORMATION = 35,
    KMIP_ATTR_CONTACT_INFORMATION             = 36,
    KMIP_ATTR_LAST_CHANGE_DATE                = 37,
    KMIP_ATTR_CUSTOM_ATTRIBUTE                = 38,
    KMIP_ATTR_ALTERNATIVE_NAME                = 39,
    KMIP_ATTR_KEY_VALUE_PRESENT               = 40,
    KMIP_ATTR_KEY_VALUE_LOCATION              = 41,
    KMIP_ATTR_ORIGINAL_CREATION_DATE          = 42,
    KMIP_ATTR_RANDOM_NUMBER_GENERATOR         = 43,
    KMIP_ATTR_PKCS_12_FRIENDLY_NAME           = 44,
    KMIP_ATTR_DESCRIPTION                     = 45,
    KMIP_ATTR_COMMENT                         = 46,
    KMIP_ATTR_SENSITIVE                       = 47,
    KMIP_ATTR_ALWAYS_SENSITIVE                = 48,
    KMIP_ATTR_EXTRACTABLE                     = 49,
    KMIP_ATTR_NEVER_EXTRACTABLE               = 50,
    KMIP_ATTR_KEY_FORMAT_TYPE                 = 51
};

enum batch_error_continuation_option
{
    /* KMIP 1.0 */
    KMIP_BATCH_CONTINUE = 0x01,
    KMIP_BATCH_STOP     = 0x02,
    KMIP_BATCH_UNDO     = 0x03
};

enum block_cipher_mode
{
    /* KMIP 1.0 */
    KMIP_BLOCK_CBC                  = 0x01,
    KMIP_BLOCK_ECB                  = 0x02,
    KMIP_BLOCK_PCBC                 = 0x03,
    KMIP_BLOCK_CFB                  = 0x04,
    KMIP_BLOCK_OFB                  = 0x05,
    KMIP_BLOCK_CTR                  = 0x06,
    KMIP_BLOCK_CMAC                 = 0x07,
    KMIP_BLOCK_CCM                  = 0x08,
    KMIP_BLOCK_GCM                  = 0x09,
    KMIP_BLOCK_CBC_MAC              = 0x0A,
    KMIP_BLOCK_XTS                  = 0x0B,
    KMIP_BLOCK_AES_KEY_WRAP_PADDING = 0x0C,
    KMIP_BLOCK_NIST_KEY_WRAP        = 0x0D,
    KMIP_BLOCK_X9102_AESKW          = 0x0E,
    KMIP_BLOCK_X9102_TDKW           = 0x0F,
    KMIP_BLOCK_X9102_AKW1           = 0x10,
    KMIP_BLOCK_X9102_AKW2           = 0x11,
    /* KMIP 1.4 */
    KMIP_BLOCK_AEAD                 = 0x12
};

enum certificate_type
{
    KMIP_CERT_X509                  = 1,
    KMIP_CERT_PGP                   = 2
};

enum credential_type
{
    /* KMIP 1.0 */
    KMIP_CRED_USERNAME_AND_PASSWORD = 0x01,
    /* KMIP 1.1 */
    KMIP_CRED_DEVICE                = 0x02,
    /* KMIP 1.2 */
    KMIP_CRED_ATTESTATION           = 0x03,
    /* KMIP 2.0 */
    KMIP_CRED_ONE_TIME_PASSWORD     = 0x04,
    KMIP_CRED_HASHED_PASSWORD       = 0x05,
    KMIP_CRED_TICKET                = 0x06
};

enum cryptographic_algorithm
{
    /* KMIP 1.0 */
    KMIP_CRYPTOALG_DES               = 0x01,
    KMIP_CRYPTOALG_TRIPLE_DES        = 0x02,
    KMIP_CRYPTOALG_AES               = 0x03,
    KMIP_CRYPTOALG_RSA               = 0x04,
    KMIP_CRYPTOALG_DSA               = 0x05,
    KMIP_CRYPTOALG_ECDSA             = 0x06,
    KMIP_CRYPTOALG_HMAC_SHA1         = 0x07,
    KMIP_CRYPTOALG_HMAC_SHA224       = 0x08,
    KMIP_CRYPTOALG_HMAC_SHA256       = 0x09,
    KMIP_CRYPTOALG_HMAC_SHA384       = 0x0A,
    KMIP_CRYPTOALG_HMAC_SHA512       = 0x0B,
    KMIP_CRYPTOALG_HMAC_MD5          = 0x0C,
    KMIP_CRYPTOALG_DH                = 0x0D,
    KMIP_CRYPTOALG_ECDH              = 0x0E,
    KMIP_CRYPTOALG_ECMQV             = 0x0F,
    KMIP_CRYPTOALG_BLOWFISH          = 0x10,
    KMIP_CRYPTOALG_CAMELLIA          = 0x11,
    KMIP_CRYPTOALG_CAST5             = 0x12,
    KMIP_CRYPTOALG_IDEA              = 0x13,
    KMIP_CRYPTOALG_MARS              = 0x14,
    KMIP_CRYPTOALG_RC2               = 0x15,
    KMIP_CRYPTOALG_RC4               = 0x16,
    KMIP_CRYPTOALG_RC5               = 0x17,
    KMIP_CRYPTOALG_SKIPJACK          = 0x18,
    KMIP_CRYPTOALG_TWOFISH           = 0x19,
    /* KMIP 1.2 */
    KMIP_CRYPTOALG_EC                = 0x1A,
    /* KMIP 1.3 */
    KMIP_CRYPTOALG_ONE_TIME_PAD      = 0x1B,
    /* KMIP 1.4 */
    KMIP_CRYPTOALG_CHACHA20          = 0x1C,
    KMIP_CRYPTOALG_POLY1305          = 0x1D,
    KMIP_CRYPTOALG_CHACHA20_POLY1305 = 0x1E,
    KMIP_CRYPTOALG_SHA3_224          = 0x1F,
    KMIP_CRYPTOALG_SHA3_256          = 0x20,
    KMIP_CRYPTOALG_SHA3_384          = 0x21,
    KMIP_CRYPTOALG_SHA3_512          = 0x22,
    KMIP_CRYPTOALG_HMAC_SHA3_224     = 0x23,
    KMIP_CRYPTOALG_HMAC_SHA3_256     = 0x24,
    KMIP_CRYPTOALG_HMAC_SHA3_384     = 0x25,
    KMIP_CRYPTOALG_HMAC_SHA3_512     = 0x26,
    KMIP_CRYPTOALG_SHAKE_128         = 0x27,
    KMIP_CRYPTOALG_SHAKE_256         = 0x28,
    /* KMIP 2.0 */
    KMIP_CRYPTOALG_ARIA              = 0x29,
    KMIP_CRYPTOALG_SEED              = 0x2A,
    KMIP_CRYPTOALG_SM2               = 0x2B,
    KMIP_CRYPTOALG_SM3               = 0x2C,
    KMIP_CRYPTOALG_SM4               = 0x2D,
    KMIP_CRYPTOALG_GOST_R_34_10_2012 = 0x2E,
    KMIP_CRYPTOALG_GOST_R_34_11_2012 = 0x2F,
    KMIP_CRYPTOALG_GOST_R_34_13_2015 = 0x30,
    KMIP_CRYPTOALG_GOST_28147_89     = 0x31,
    KMIP_CRYPTOALG_XMSS              = 0x32,
    KMIP_CRYPTOALG_SPHINCS_256       = 0x33,
    KMIP_CRYPTOALG_MCELIECE          = 0x34,
    KMIP_CRYPTOALG_MCELIECE_6960119  = 0x35,
    KMIP_CRYPTOALG_MCELIECE_8192128  = 0x36,
    KMIP_CRYPTOALG_ED25519           = 0x37,
    KMIP_CRYPTOALG_ED448             = 0x38
};

enum cryptographic_usage_mask
{
    /* KMIP 1.0 */
    KMIP_CRYPTOMASK_SIGN                = 0x00000001,
    KMIP_CRYPTOMASK_VERIFY              = 0x00000002,
    KMIP_CRYPTOMASK_ENCRYPT             = 0x00000004,
    KMIP_CRYPTOMASK_DECRYPT             = 0x00000008,
    KMIP_CRYPTOMASK_WRAP_KEY            = 0x00000010,
    KMIP_CRYPTOMASK_UNWRAP_KEY          = 0x00000020,
    KMIP_CRYPTOMASK_EXPORT              = 0x00000040,
    KMIP_CRYPTOMASK_MAC_GENERATE        = 0x00000080,
    KMIP_CRYPTOMASK_MAC_VERIFY          = 0x00000100,
    KMIP_CRYPTOMASK_DERIVE_KEY          = 0x00000200,
    KMIP_CRYPTOMASK_CONTENT_COMMITMENT  = 0x00000400,
    KMIP_CRYPTOMASK_KEY_AGREEMENT       = 0x00000800,
    KMIP_CRYPTOMASK_CERTIFICATE_SIGN    = 0x00001000,
    KMIP_CRYPTOMASK_CRL_SIGN            = 0x00002000,
    KMIP_CRYPTOMASK_GENERATE_CRYPTOGRAM = 0x00004000,
    KMIP_CRYPTOMASK_VALIDATE_CRYPTOGRAM = 0x00008000,
    KMIP_CRYPTOMASK_TRANSLATE_ENCRYPT   = 0x00010000,
    KMIP_CRYPTOMASK_TRANSLATE_DECRYPT   = 0x00020000,
    KMIP_CRYPTOMASK_TRANSLATE_WRAP      = 0x00040000,
    KMIP_CRYPTOMASK_TRANSLATE_UNWRAP    = 0x00080000,
    /* KMIP 2.0 */
    KMIP_CRYPTOMASK_AUTHENTICATE        = 0x00100000,
    KMIP_CRYPTOMASK_UNRESTRICTED        = 0x00200000,
    KMIP_CRYPTOMASK_FPE_ENCRYPT         = 0x00400000,
    KMIP_CRYPTOMASK_FPE_DECRYPT         = 0x00800000
};

enum digital_signature_algorithm
{
    /* KMIP 1.1 */
    KMIP_DIGITAL_MD2_WITH_RSA      = 0x01,
    KMIP_DIGITAL_MD5_WITH_RSA      = 0x02,
    KMIP_DIGITAL_SHA1_WITH_RSA     = 0x03,
    KMIP_DIGITAL_SHA224_WITH_RSA   = 0x04,
    KMIP_DIGITAL_SHA256_WITH_RSA   = 0x05,
    KMIP_DIGITAL_SHA384_WITH_RSA   = 0x06,
    KMIP_DIGITAL_SHA512_WITH_RSA   = 0x07,
    KMIP_DIGITAL_RSASSA_PSS        = 0x08,
    KMIP_DIGITAL_DSA_WITH_SHA1     = 0x09,
    KMIP_DIGITAL_DSA_WITH_SHA224   = 0x0A,
    KMIP_DIGITAL_DSA_WITH_SHA256   = 0x0B,
    KMIP_DIGITAL_ECDSA_WITH_SHA1   = 0x0C,
    KMIP_DIGITAL_ECDSA_WITH_SHA224 = 0x0D,
    KMIP_DIGITAL_ECDSA_WITH_SHA256 = 0x0E,
    KMIP_DIGITAL_ECDSA_WITH_SHA384 = 0x0F,
    KMIP_DIGITAL_ECDSA_WITH_SHA512 = 0x10,
    /* KMIP 1.4 */
    KMIP_DIGITAL_SHA3_256_WITH_RSA = 0x11,
    KMIP_DIGITAL_SHA3_384_WITH_RSA = 0x12,
    KMIP_DIGITAL_SHA3_512_WITH_RSA = 0x13
};

enum encoding_option
{
    /* KMIP 1.1 */
    KMIP_ENCODE_NO_ENCODING   = 0x01,
    KMIP_ENCODE_TTLV_ENCODING = 0x02
};

enum hashing_algorithm
{
    /* KMIP 1.0 */
    KMIP_HASH_MD2        = 0x01,
    KMIP_HASH_MD4        = 0x02,
    KMIP_HASH_MD5        = 0x03,
    KMIP_HASH_SHA1       = 0x04,
    KMIP_HASH_SHA224     = 0x05,
    KMIP_HASH_SHA256     = 0x06,
    KMIP_HASH_SHA384     = 0x07,
    KMIP_HASH_SHA512     = 0x08,
    KMIP_HASH_RIPEMD160  = 0x09,
    KMIP_HASH_TIGER      = 0x0A,
    KMIP_HASH_WHIRLPOOL  = 0x0B,
    /* KMIP 1.2 */
    KMIP_HASH_SHA512_224 = 0x0C,
    KMIP_HASH_SHA512_256 = 0x0D,
    /* KMIP 1.4 */
    KMIP_HASH_SHA3_224   = 0x0E,
    KMIP_HASH_SHA3_256   = 0x0F,
    KMIP_HASH_SHA3_384   = 0x10,
    KMIP_HASH_SHA3_512   = 0x11
};

enum key_compression_type
{
    /* KMIP 1.0 */
    KMIP_KEYCOMP_EC_PUB_UNCOMPRESSED          = 0x01,
    KMIP_KEYCOMP_EC_PUB_X962_COMPRESSED_PRIME = 0x02,
    KMIP_KEYCOMP_EC_PUB_X962_COMPRESSED_CHAR2 = 0x03,
    KMIP_KEYCOMP_EC_PUB_X962_HYBRID           = 0x04
};

enum key_format_type
{
    /* KMIP 1.0 */
    KMIP_KEYFORMAT_RAW                     = 0x01,
    KMIP_KEYFORMAT_OPAQUE                  = 0x02,
    KMIP_KEYFORMAT_PKCS1                   = 0x03,
    KMIP_KEYFORMAT_PKCS8                   = 0x04,
    KMIP_KEYFORMAT_X509                    = 0x05,
    KMIP_KEYFORMAT_EC_PRIVATE_KEY          = 0x06,
    KMIP_KEYFORMAT_TRANS_SYMMETRIC_KEY     = 0x07,
    KMIP_KEYFORMAT_TRANS_DSA_PRIVATE_KEY   = 0x08,
    KMIP_KEYFORMAT_TRANS_DSA_PUBLIC_KEY    = 0x09,
    KMIP_KEYFORMAT_TRANS_RSA_PRIVATE_KEY   = 0x0A,
    KMIP_KEYFORMAT_TRANS_RSA_PUBLIC_KEY    = 0x0B,
    KMIP_KEYFORMAT_TRANS_DH_PRIVATE_KEY    = 0x0C,
    KMIP_KEYFORMAT_TRANS_DH_PUBLIC_KEY     = 0x0D,
    KMIP_KEYFORMAT_TRANS_ECDSA_PRIVATE_KEY = 0x0E, /* Deprecated as of KMIP 1.3 */
    KMIP_KEYFORMAT_TRANS_ECDSA_PUBLIC_KEY  = 0x0F, /* Deprecated as of KMIP 1.3 */
    KMIP_KEYFORMAT_TRANS_ECDH_PRIVATE_KEY  = 0x10, /* Deprecated as of KMIP 1.3 */
    KMIP_KEYFORMAT_TRANS_ECDH_PUBLIC_KEY   = 0x11, /* Deprecated as of KMIP 1.3 */
    KMIP_KEYFORMAT_TRANS_ECMQV_PRIVATE_KEY = 0x12, /* Deprecated as of KMIP 1.3 */
    KMIP_KEYFORMAT_TRANS_ECMQV_PUBLIC_KEY  = 0x13, /* Deprecated as of KMIP 1.3 */
    /* KMIP 1.3 */
    KMIP_KEYFORMAT_TRANS_EC_PRIVATE_KEY    = 0x14,
    KMIP_KEYFORMAT_TRANS_EC_PUBLIC_KEY     = 0x15,
    /* KMIP 1.4 */
    KMIP_KEYFORMAT_PKCS12                  = 0x16,
    /* KMIP 2.0 */
    KMIP_KEYFORMAT_PKCS10                  = 0x17
};

enum key_role_type
{
    /* KMIP 1.0 */
    KMIP_ROLE_BDK      = 0x01,
    KMIP_ROLE_CVK      = 0x02,
    KMIP_ROLE_DEK      = 0x03,
    KMIP_ROLE_MKAC     = 0x04,
    KMIP_ROLE_MKSMC    = 0x05,
    KMIP_ROLE_MKSMI    = 0x06,
    KMIP_ROLE_MKDAC    = 0x07,
    KMIP_ROLE_MKDN     = 0x08,
    KMIP_ROLE_MKCP     = 0x09,
    KMIP_ROLE_MKOTH    = 0x0A,
    KMIP_ROLE_KEK      = 0x0B,
    KMIP_ROLE_MAC16609 = 0x0C,
    KMIP_ROLE_MAC97971 = 0x0D,
    KMIP_ROLE_MAC97972 = 0x0E,
    KMIP_ROLE_MAC97973 = 0x0F,
    KMIP_ROLE_MAC97974 = 0x10,
    KMIP_ROLE_MAC97975 = 0x11,
    KMIP_ROLE_ZPK      = 0x12,
    KMIP_ROLE_PVKIBM   = 0x13,
    KMIP_ROLE_PVKPVV   = 0x14,
    KMIP_ROLE_PVKOTH   = 0x15,
    /* KMIP 1.4 */
    KMIP_ROLE_DUKPT    = 0x16,
    KMIP_ROLE_IV       = 0x17,
    KMIP_ROLE_TRKBK    = 0x18
};

enum key_wrap_type
{
    /* KMIP 1.4 */
    KMIP_WRAPTYPE_NOT_WRAPPED   = 0x01,
    KMIP_WRAPTYPE_AS_REGISTERED = 0x02
};

enum kmip_version
{
    KMIP_1_0 = 0,
    KMIP_1_1 = 1,
    KMIP_1_2 = 2,
    KMIP_1_3 = 3,
    KMIP_1_4 = 4,
    KMIP_2_0 = 5
};

enum mask_generator
{
    /* KMIP 1.4 */
    KMIP_MASKGEN_MGF1 = 0x01
};

enum name_type
{
    /* KMIP 1.0 */
    KMIP_NAME_UNINTERPRETED_TEXT_STRING = 0x01,
    KMIP_NAME_URI                       = 0x02
};

enum object_type
{
    /* KMIP 1.0 */
    KMIP_OBJTYPE_CERTIFICATE         = 0x01,
    KMIP_OBJTYPE_SYMMETRIC_KEY       = 0x02,
    KMIP_OBJTYPE_PUBLIC_KEY          = 0x03,
    KMIP_OBJTYPE_PRIVATE_KEY         = 0x04,
    KMIP_OBJTYPE_SPLIT_KEY           = 0x05,
    KMIP_OBJTYPE_TEMPLATE            = 0x06, /* Deprecated as of KMIP 1.3 */
    KMIP_OBJTYPE_SECRET_DATA         = 0x07,
    KMIP_OBJTYPE_OPAQUE_OBJECT       = 0x08,
    /* KMIP 1.2 */
    KMIP_OBJTYPE_PGP_KEY             = 0x09,
    /* KMIP 2.0 */
    KMIP_OBJTYPE_CERTIFICATE_REQUEST = 0x0A
};

enum operation
{
    /* KMIP 1.0 */
    KMIP_OP_CREATE  = 0x01,
    KMIP_OP_CREATE_KEY_PAIR = 0x02,
    KMIP_OP_REGISTER = 0x03,
    KMIP_OP_REKEY   = 0x04,
    KMIP_OP_DERIVE_KEY = 0x05,
    KMIP_OP_CERTIFY = 0x06,
    KMIP_OP_RECERTIFY = 0x07,
    KMIP_OP_LOCATE  = 0x08,
    KMIP_OP_CHECK   = 0x09,
    KMIP_OP_GET     = 0x0A,
    KMIP_OP_GET_ATTRIBUTES = 0x0B,
    KMIP_OP_GET_ATTRIBUTE_LIST = 0x0C,
    KMIP_OP_ADD_ATTRIBUTE = 0x0D,
    KMIP_OP_MODIFY_ATTRIBUTE = 0x0E,
    KMIP_OP_DELETE_ATTRIBUTE = 0x0F,
    KMIP_OP_OBTAIN_LEASE = 0x10,
    KMIP_OP_GET_USAGE_ALLOCATION = 0x11,
    KMIP_OP_ACTIVATE = 0x12,
    KMIP_OP_REVOKE  = 0x13,
    KMIP_OP_DESTROY = 0x14,
    KMIP_OP_ARCHIVE = 0x15,
    KMIP_OP_RECOVER = 0x16,
    KMIP_OP_VALIDATE = 0x17,
    KMIP_OP_QUERY   = 0x18,
    KMIP_OP_CANCEL  = 0x19,
    KMIP_OP_POLL    = 0x1A,
    KMIP_OP_NOTIFY  = 0x1B,
    KMIP_OP_PUT     = 0x1C,
    /* KMIP 1.1 */
    KMIP_OP_REKEY_KEY_PAIR = 0x1D,
    KMIP_OP_DISCOVER_VERSIONS = 0x1E,
    /* KMIP 1.2 */
    KMIP_OP_ENCRYPT = 0x1F,
    KMIP_OP_DECRYPT = 0x20,
    KMIP_OP_SIGN    = 0x21,
    KMIP_OP_SIGNATURE_VERIFY = 0x22,
    KMIP_OP_MAC     = 0x23,
    KMIP_OP_MAC_VERIFY = 0x24,
    KMIP_OP_RNG_RETRIEVE = 0x25,
    KMIP_OP_RNG_SEED = 0x26,
    KMIP_OP_HASH    = 0x27,
    KMIP_OP_CREATE_SPLIT_KEY = 0x28,
    KMIP_OP_JOIN_SPLIT_KEY = 0x29,
    /* KMIP 1.4 */
    KMIP_OP_IMPORT  = 0x2A,
    KMIP_OP_EXPORT  = 0x2B
};

enum padding_method
{
    /* KMIP 1.0 */
    KMIP_PAD_NONE      = 0x01,
    KMIP_PAD_OAEP      = 0x02,
    KMIP_PAD_PKCS5     = 0x03,
    KMIP_PAD_SSL3      = 0x04,
    KMIP_PAD_ZEROS     = 0x05,
    KMIP_PAD_ANSI_X923 = 0x06,
    KMIP_PAD_ISO_10126 = 0x07,
    KMIP_PAD_PKCS1v15  = 0x08,
    KMIP_PAD_X931      = 0x09,
    KMIP_PAD_PSS       = 0x0A
};

enum protection_storage_mask
{
    /* KMIP 2.0 */
    KMIP_PROTECT_SOFTWARE          = 0x00000001,
    KMIP_PROTECT_HARDWARE          = 0x00000002,
    KMIP_PROTECT_ON_PROCESSOR      = 0x00000004,
    KMIP_PROTECT_ON_SYSTEM         = 0x00000008,
    KMIP_PROTECT_OFF_SYSTEM        = 0x00000010,
    KMIP_PROTECT_HYPERVISOR        = 0x00000020,
    KMIP_PROTECT_OPERATING_SYSTEM  = 0x00000040,
    KMIP_PROTECT_CONTAINER         = 0x00000080,
    KMIP_PROTECT_ON_PREMISES       = 0x00000100,
    KMIP_PROTECT_OFF_PREMISES      = 0x00000200,
    KMIP_PROTECT_SELF_MANAGED      = 0x00000400,
    KMIP_PROTECT_OUTSOURCED        = 0x00000800,
    KMIP_PROTECT_VALIDATED         = 0x00001000,
    KMIP_PROTECT_SAME_JURISDICTION = 0x00002000
};

enum result_reason
{
    /* KMIP 1.0 */
    KMIP_REASON_GENERAL_FAILURE                       = 0x0100,
    KMIP_REASON_ITEM_NOT_FOUND                        = 0x0001,
    KMIP_REASON_RESPONSE_TOO_LARGE                    = 0x0002,
    KMIP_REASON_AUTHENTICATION_NOT_SUCCESSFUL         = 0x0003,
    KMIP_REASON_INVALID_MESSAGE                       = 0x0004,
    KMIP_REASON_OPERATION_NOT_SUPPORTED               = 0x0005,
    KMIP_REASON_MISSING_DATA                          = 0x0006,
    KMIP_REASON_INVALID_FIELD                         = 0x0007,
    KMIP_REASON_FEATURE_NOT_SUPPORTED                 = 0x0008,
    KMIP_REASON_OPERATION_CANCELED_BY_REQUESTER       = 0x0009,
    KMIP_REASON_CRYPTOGRAPHIC_FAILURE                 = 0x000A,
    KMIP_REASON_ILLEGAL_OPERATION                     = 0x000B,
    KMIP_REASON_PERMISSION_DENIED                     = 0x000C,
    KMIP_REASON_OBJECT_ARCHIVED                       = 0x000D,
    KMIP_REASON_INDEX_OUT_OF_BOUNDS                   = 0x000E,
    KMIP_REASON_APPLICATION_NAMESPACE_NOT_SUPPORTED   = 0x000F,
    KMIP_REASON_KEY_FORMAT_TYPE_NOT_SUPPORTED         = 0x0010,
    KMIP_REASON_KEY_COMPRESSION_TYPE_NOT_SUPPORTED    = 0x0011,
    /* KMIP 1.1 */
    KMIP_REASON_ENCODING_OPTION_FAILURE               = 0x0012,
    /* KMIP 1.2 */
    KMIP_REASON_KEY_VALUE_NOT_PRESENT                 = 0x0013,
    KMIP_REASON_ATTESTATION_REQUIRED                  = 0x0014,
    KMIP_REASON_ATTESTATION_FAILED                    = 0x0015,
    /* KMIP 1.4 */
    KMIP_REASON_SENSITIVE                             = 0x0016,
    KMIP_REASON_NOT_EXTRACTABLE                       = 0x0017,
    KMIP_REASON_OBJECT_ALREADY_EXISTS                 = 0x0018,
    /* KMIP 2.0 */
    KMIP_REASON_INVALID_TICKET                        = 0x0019,
    KMIP_REASON_USAGE_LIMIT_EXCEEDED                  = 0x001A,
    KMIP_REASON_NUMERIC_RANGE                         = 0x001B,
    KMIP_REASON_INVALID_DATA_TYPE                     = 0x001C,
    KMIP_REASON_READ_ONLY_ATTRIBUTE                   = 0x001D,
    KMIP_REASON_MULTI_VALUED_ATTRIBUTE                = 0x001E,
    KMIP_REASON_UNSUPPORTED_ATTRIBUTE                 = 0x001F,
    KMIP_REASON_ATTRIBUTE_INSTANCE_NOT_FOUND          = 0x0020,
    KMIP_REASON_ATTRIBUTE_NOT_FOUND                   = 0x0021,
    KMIP_REASON_ATTRIBUTE_READ_ONLY                   = 0x0022,
    KMIP_REASON_ATTRIBUTE_SINGLE_VALUED               = 0x0023,
    KMIP_REASON_BAD_CRYPTOGRAPHIC_PARAMETERS          = 0x0024,
    KMIP_REASON_BAD_PASSWORD                          = 0x0025,
    KMIP_REASON_CODEC_ERROR                           = 0x0026,
    /* Reserved                                       = 0x0027, */
    KMIP_REASON_ILLEGAL_OBJECT_TYPE                   = 0x0028,
    KMIP_REASON_INCOMPATIBLE_CRYPTOGRAPHIC_USAGE_MASK = 0x0029,
    KMIP_REASON_INTERNAL_SERVER_ERROR                 = 0x002A,
    KMIP_REASON_INVALID_ASYNCHRONOUS_CORRELATION_VALUE = 0x002B,
    KMIP_REASON_INVALID_ATTRIBUTE                      = 0x002C,
    KMIP_REASON_INVALID_ATTRIBUTE_VALUE                = 0x002D,
    KMIP_REASON_INVALID_CORRELATION_VALUE              = 0x002E,
    KMIP_REASON_INVALID_CSR                            = 0x002F,
    KMIP_REASON_INVALID_OBJECT_TYPE                    = 0x0030,
    /* Reserved                                        = 0x0031, */
    KMIP_REASON_KEY_WRAP_TYPE_NOT_SUPPORTED            = 0x0032,
    /* Reserved                                        = 0x0033, */
    KMIP_REASON_MISSING_INITIALIZATION_VECTOR          = 0x0034,
    KMIP_REASON_NON_UNIQUE_NAME_ATTRIBUTE              = 0x0035,
    KMIP_REASON_OBJECT_DESTROYED                       = 0x0036,
    KMIP_REASON_OBJECT_NOT_FOUND                       = 0x0037,
    /* Reserved                                        = 0x0038, */
    KMIP_REASON_NOT_AUTHORISED                         = 0x0039,
    KMIP_REASON_SERVER_LIMIT_EXCEEDED                  = 0x003A,
    KMIP_REASON_UNKNOWN_ENUMERATION                    = 0x003B,
    KMIP_REASON_UNKNOWN_MESSAGE_EXTENSION              = 0x003C,
    KMIP_REASON_UNKNOWN_TAG                            = 0x003D,
    KMIP_REASON_UNSUPPORTED_CRYPTOGRAPHIC_PARAMETERS   = 0x003E,
    KMIP_REASON_UNSUPPORTED_PROTOCOL_VERSION           = 0x003F,
    KMIP_REASON_WRAPPING_OBJECT_ARCHIVED               = 0x0040,
    KMIP_REASON_WRAPPING_OBJECT_DESTROYED              = 0x0041,
    KMIP_REASON_WRAPPING_OBJECT_NOT_FOUND              = 0x0042,
    KMIP_REASON_WRONG_KEY_LIFECYCLE_STATE              = 0x0043,
    KMIP_REASON_PROTECTION_STORAGE_UNAVAILABLE         = 0x0044,
    KMIP_REASON_PKCS11_CODEC_ERROR                     = 0x0045,
    KMIP_REASON_PKCS11_INVALID_FUNCTION                = 0x0046,
    KMIP_REASON_PKCS11_INVALID_INTERFACE               = 0x0047,
    KMIP_REASON_PRIVATE_PROTECTION_STORAGE_UNAVAILABLE = 0x0048,
    KMIP_REASON_PUBLIC_PROTECTION_STORAGE_UNAVAILABLE  = 0x0049
};

enum result_status
{
    /* KMIP 1.0 */
    KMIP_STATUS_SUCCESS           = 0x00,
    KMIP_STATUS_OPERATION_FAILED  = 0x01,
    KMIP_STATUS_OPERATION_PENDING = 0x02,
    KMIP_STATUS_OPERATION_UNDONE  = 0x03
};

enum state
{
    /* KMIP 1.0 */
    KMIP_STATE_PRE_ACTIVE            = 0x01,
    KMIP_STATE_ACTIVE                = 0x02,
    KMIP_STATE_DEACTIVATED           = 0x03,
    KMIP_STATE_COMPROMISED           = 0x04,
    KMIP_STATE_DESTROYED             = 0x05,
    KMIP_STATE_DESTROYED_COMPROMISED = 0x06
};

enum tag
{
    KMIP_TAG_TAG                              = 0x000000,
    KMIP_TAG_TYPE                             = 0x000001,
    KMIP_TAG_DEFAULT                          = 0x420000,
    KMIP_TAG_ACTIVATION_DATE                  = 0x420001,
    KMIP_TAG_APPLICATION_DATA                 = 0x420002,
    KMIP_TAG_APPLICATION_NAMESPACE            = 0x420003,
    KMIP_TAG_APPLICATION_SPECIFIC_INFORMATION = 0x420004,
    KMIP_TAG_ARCHIVE_DATE                     = 0x420005,
    /* KMIP 1.0 */
    KMIP_TAG_ASYNCHRONOUS_CORRELATION_VALUE   = 0x420006,
    KMIP_TAG_ASYNCHRONOUS_INDICATOR           = 0x420007,
    KMIP_TAG_ATTRIBUTE                        = 0x420008,
    KMIP_TAG_ATTRIBUTE_INDEX                  = 0x420009,
    KMIP_TAG_ATTRIBUTE_NAME                   = 0x42000A,
    KMIP_TAG_ATTRIBUTE_VALUE                  = 0x42000B,
    KMIP_TAG_AUTHENTICATION                   = 0x42000C,
    KMIP_TAG_BATCH_COUNT                      = 0x42000D,
    KMIP_TAG_BATCH_ERROR_CONTINUATION_OPTION  = 0x42000E,
    KMIP_TAG_BATCH_ITEM                       = 0x42000F,
    KMIP_TAG_BATCH_ORDER_OPTION               = 0x420010,
    KMIP_TAG_BLOCK_CIPHER_MODE                = 0x420011,
    KMIP_TAG_CANCELLATION_RESULT              = 0x420012,
    KMIP_TAG_CERTIFICATE                      = 0x420013,
    KMIP_TAG_CERTIFICATE_IDENTIFIER           = 0x420014,
    KMIP_TAG_CERTIFICATE_ISSUER               = 0x420015,
    KMIP_TAG_CERTIFICATE_ISSUER_ALTERNATIVE_NAME = 0x420016,
    KMIP_TAG_CERTIFICATE_ISSUER_DISTINGUISHED_NAME = 0x420017,
    KMIP_TAG_CERTIFICATE_REQUEST              = 0x420018,
    KMIP_TAG_CERTIFICATE_REQUEST_TYPE         = 0x420019,
    KMIP_TAG_CERTIFICATE_SUBJECT              = 0x42001A,
    KMIP_TAG_CERTIFICATE_SUBJECT_ALTERNATIVE_NAME = 0x42001B,
    KMIP_TAG_CERTIFICATE_SUBJECT_DISTINGUISHED_NAME = 0x42001C,
    KMIP_TAG_CERTIFICATE_TYPE                 = 0x42001D,
    KMIP_TAG_CERTIFICATE_VALUE                = 0x42001E,
    KMIP_TAG_COMMON_TEMPLATE_ATTRIBUTE        = 0x42001F,
    KMIP_TAG_COMPROMISE_DATE                  = 0x420020,
    KMIP_TAG_COMPROMISE_OCCURRENCE_DATE       = 0x420021,
    KMIP_TAG_CONTACT_INFORMATION              = 0x420022,
    KMIP_TAG_CREDENTIAL                       = 0x420023,
    KMIP_TAG_CREDENTIAL_TYPE                  = 0x420024,
    KMIP_TAG_CREDENTIAL_VALUE                 = 0x420025,
    KMIP_TAG_CRITICALITY_INDICATOR            = 0x420026,
    KMIP_TAG_CRT_COEFFICIENT                  = 0x420027,
    KMIP_TAG_CRYPTOGRAPHIC_ALGORITHM          = 0x420028,
    KMIP_TAG_CRYPTOGRAPHIC_DOMAIN_PARAMETERS  = 0x420029,
    KMIP_TAG_CRYPTOGRAPHIC_LENGTH             = 0x42002A,
    KMIP_TAG_CRYPTOGRAPHIC_PARAMETERS         = 0x42002B,
    KMIP_TAG_CRYPTOGRAPHIC_USAGE_MASK         = 0x42002C,
    KMIP_TAG_CUSTOM_ATTRIBUTE                 = 0x42002D,
    KMIP_TAG_D                                = 0x42002E,
    KMIP_TAG_DEACTIVATION_DATE                = 0x42002F,
    KMIP_TAG_DERIVATION_DATA                  = 0x420030,
    KMIP_TAG_DERIVATION_METHOD                = 0x420031,
    KMIP_TAG_DERIVATION_PARAMETERS            = 0x420032,
    KMIP_TAG_DESTROY_DATE                     = 0x420033,
    KMIP_TAG_DIGEST                           = 0x420034,
    KMIP_TAG_DIGEST_VALUE                     = 0x420035,
    KMIP_TAG_ENCRYPTION_KEY_INFORMATION       = 0x420036,
    KMIP_TAG_G                                = 0x420037,
    KMIP_TAG_HASHING_ALGORITHM                = 0x420038,
    KMIP_TAG_INITIAL_DATE                     = 0x420039,
    KMIP_TAG_INITIALIZATION_VECTOR            = 0x42003A,
    KMIP_TAG_ISSUER                           = 0x42003B,
    KMIP_TAG_ITERATION_COUNT                  = 0x42003C,
    KMIP_TAG_IV_COUNTER_NONCE                 = 0x42003D,
    KMIP_TAG_J                                = 0x42003E,
    KMIP_TAG_KEY                              = 0x42003F,
    KMIP_TAG_KEY_BLOCK                        = 0x420040,
    KMIP_TAG_KEY_COMPRESSION_TYPE             = 0x420041,
    KMIP_TAG_KEY_FORMAT_TYPE                  = 0x420042,
    KMIP_TAG_KEY_MATERIAL                     = 0x420043,
    KMIP_TAG_KEY_PART_IDENTIFIER              = 0x420044,
    KMIP_TAG_KEY_VALUE                        = 0x420045,
    KMIP_TAG_KEY_WRAPPING_DATA                = 0x420046,
    KMIP_TAG_KEY_WRAPPING_SPECIFICATION       = 0x420047,
    KMIP_TAG_LAST_CHANGE_DATE                 = 0x420048,
    KMIP_TAG_LEASE_TIME                       = 0x420049,
    KMIP_TAG_LINK                             = 0x42004A,
    KMIP_TAG_LINK_TYPE                        = 0x42004B,
    KMIP_TAG_LINKED_OBJECT_IDENTIFIER         = 0x42004C,
    KMIP_TAG_MAC_SIGNATURE                    = 0x42004D,
    KMIP_TAG_MAC_SIGNATURE_KEY_INFORMATION    = 0x42004E,
    KMIP_TAG_MAXIMUM_ITEMS                    = 0x42004F,
    KMIP_TAG_MAXIMUM_RESPONSE_SIZE            = 0x420050,
    KMIP_TAG_MESSAGE_EXTENSION                = 0x420051,
    KMIP_TAG_MODULUS                          = 0x420052,
    KMIP_TAG_NAME                             = 0x420053,
    KMIP_TAG_NAME_TYPE                        = 0x420054,
    KMIP_TAG_NAME_VALUE                       = 0x420055,
    KMIP_TAG_OBJECT_GROUP                     = 0x420056,
    KMIP_TAG_OBJECT_TYPE                      = 0x420057,
    KMIP_TAG_OFFSET                           = 0x420058,
    KMIP_TAG_OPAQUE_DATA_TYPE                 = 0x420059,
    KMIP_TAG_OPAQUE_DATA_VALUE                = 0x42005A,
    KMIP_TAG_OPAQUE_OBJECT                    = 0x42005B,
    KMIP_TAG_OPERATION                        = 0x42005C,
    KMIP_TAG_OPERATION_POLICY_NAME            = 0x42005D,
    KMIP_TAG_P                                = 0x42005E,
    KMIP_TAG_PADDING_METHOD                   = 0x42005F,
    KMIP_TAG_PRIME_EXPONENT_P                 = 0x420060,
    KMIP_TAG_PRIME_EXPONENT_Q                 = 0x420061,
    KMIP_TAG_PRIME_FIELD_SIZE                 = 0x420062,
    KMIP_TAG_PRIVATE_EXPONENT                 = 0x420063,
    KMIP_TAG_PRIVATE_KEY                      = 0x420064,
    KMIP_TAG_PRIVATE_KEY_TEMPLATE_ATTRIBUTE   = 0x420065,
    KMIP_TAG_PRIVATE_KEY_UNIQUE_IDENTIFIER    = 0x420066,
    KMIP_TAG_PROCESS_START_DATE               = 0x420067,
    KMIP_TAG_PROTECT_STOP_DATE                = 0x420068,
    KMIP_TAG_PROTOCOL_VERSION                 = 0x420069,
    KMIP_TAG_PROTOCOL_VERSION_MAJOR           = 0x42006A,
    KMIP_TAG_PROTOCOL_VERSION_MINOR           = 0x42006B,
    KMIP_TAG_PUBLIC_EXPONENT                  = 0x42006C,
    KMIP_TAG_PUBLIC_KEY                       = 0x42006D,
    KMIP_TAG_PUBLIC_KEY_TEMPLATE_ATTRIBUTE    = 0x42006E,
    KMIP_TAG_PUBLIC_KEY_UNIQUE_IDENTIFIER     = 0x42006F,
    KMIP_TAG_PUT_FUNCTION                     = 0x420070,
    KMIP_TAG_Q                                = 0x420071,
    KMIP_TAG_Q_STRING                         = 0x420072,
    KMIP_TAG_QLENGTH                          = 0x420073,
    KMIP_TAG_QUERY_FUNCTION                   = 0x420074,
    KMIP_TAG_RECOMMENDED_CURVE                = 0x420075,
    KMIP_TAG_REPLACED_UNIQUE_IDENTIFIER       = 0x420076,
    KMIP_TAG_REQUEST_HEADER                   = 0x420077,
    KMIP_TAG_REQUEST_MESSAGE                  = 0x420078,
    KMIP_TAG_REQUEST_PAYLOAD                  = 0x420079,
    KMIP_TAG_RESPONSE_HEADER                  = 0x42007A,
    KMIP_TAG_RESPONSE_MESSAGE                 = 0x42007B,
    KMIP_TAG_RESPONSE_PAYLOAD                 = 0x42007C,
    KMIP_TAG_RESULT_MESSAGE                   = 0x42007D,
    KMIP_TAG_RESULT_REASON                    = 0x42007E,
    KMIP_TAG_RESULT_STATUS                    = 0x42007F,
    KMIP_TAG_REVOCATION_MESSAGE               = 0x420080,
    KMIP_TAG_REVOCATION_REASON                = 0x420081,
    KMIP_TAG_REVOCATION_REASON_CODE           = 0x420082,
    KMIP_TAG_KEY_ROLE_TYPE                    = 0x420083,
    KMIP_TAG_SALT                             = 0x420084,
    KMIP_TAG_SECRET_DATA                      = 0x420085,
    KMIP_TAG_SECRET_DATA_TYPE                 = 0x420086,
    KMIP_TAG_SERIAL_NUMBER                    = 0x420087,
    KMIP_TAG_SERVER_INFORMATION               = 0x420088,
    KMIP_TAG_SPLIT_KEY                        = 0x420089,
    KMIP_TAG_SPLIT_KEY_METHOD                 = 0x42008A,
    KMIP_TAG_SPLIT_KEY_PARTS                  = 0x42008B,
    KMIP_TAG_SPLIT_KEY_THRESHOLD              = 0x42008C,
    KMIP_TAG_STATE                            = 0x42008D,
    KMIP_TAG_STORAGE_STATUS_MASK              = 0x42008E,
    KMIP_TAG_SYMMETRIC_KEY                    = 0x42008F,
    KMIP_TAG_TEMPLATE                         = 0x420090,
    KMIP_TAG_TEMPLATE_ATTRIBUTE               = 0x420091,
    KMIP_TAG_TIME_STAMP                       = 0x420092,
    KMIP_TAG_UNIQUE_BATCH_ITEM_ID             = 0x420093,
    KMIP_TAG_UNIQUE_IDENTIFIER                = 0x420094,
    KMIP_TAG_USAGE_LIMITS                     = 0x420095,
    KMIP_TAG_USAGE_LIMITS_COUNT               = 0x420096,
    KMIP_TAG_USAGE_LIMITS_TOTAL               = 0x420097,
    KMIP_TAG_USAGE_LIMITS_UNIT                = 0x420098,
    KMIP_TAG_USERNAME                         = 0x420099,
    KMIP_TAG_VALIDITY_DATE                    = 0x42009A,
    KMIP_TAG_VALIDITY_INDICATOR               = 0x42009B,
    KMIP_TAG_VENDOR_EXTENSION                 = 0x42009C,
    KMIP_TAG_VENDOR_IDENTIFICATION            = 0x42009D,
    KMIP_TAG_WRAPPING_METHOD                  = 0x42009E,
    KMIP_TAG_X                                = 0x42009F,
    KMIP_TAG_Y                                = 0x4200A0,
    KMIP_TAG_PASSWORD                         = 0x4200A1,
    /* KMIP 1.1 */
    KMIP_TAG_DEVICE_IDENTIFIER                = 0x4200A2,
    KMIP_TAG_ENCODING_OPTION                  = 0x4200A3,
    KMIP_TAG_EXTENSION_INFORMATION            = 0x4200A4,
    KMIP_TAG_EXTENSION_NAME                   = 0x4200A5,
    KMIP_TAG_EXTENSION_TAG                    = 0x4200A6,
    KMIP_TAG_EXTENSION_TYPE                   = 0x4200A7,
    KMIP_TAG_FRESH                            = 0x4200A8,
    KMIP_TAG_MACHINE_IDENTIFIER               = 0x4200A9,
    KMIP_TAG_MEDIA_IDENTIFIER                 = 0x4200AA,
    KMIP_TAG_NETWORK_IDENTIFIER               = 0x4200AB,
    KMIP_TAG_OBJECT_GROUP_MEMBER              = 0x4200AC,
    KMIP_TAG_CERTIFICATE_LENGTH               = 0x4200AD,
    KMIP_TAG_DIGITAL_SIGNATURE_ALGORITHM      = 0x4200AE,
    KMIP_TAG_CERTIFICATE_SERIAL_NUMBER        = 0x4200AF,
    KMIP_TAG_DEVICE_SERIAL_NUMBER             = 0x4200B0,
    KMIP_TAG_ISSUER_ALTERNATIVE_NAME          = 0x4200B1,
    KMIP_TAG_ISSUER_DISTINGUISHED_NAME        = 0x4200B2,
    KMIP_TAG_SUBJECT_ALTERNATIVE_NAME         = 0x4200B3,
    KMIP_TAG_SUBJECT_DISTINGUISHED_NAME       = 0x4200B4,
    KMIP_TAG_X509_CERTIFICATE_IDENTIFIER      = 0x4200B5,
    KMIP_TAG_X509_CERTIFICATE_ISSUER          = 0x4200B6,
    KMIP_TAG_X509_CERTIFICATE_SUBJECT         = 0x4200B7,
    /* KMIP 1.2 */
    KMIP_TAG_KEY_VALUE_LOCATION               = 0x4200B8,
    KMIP_TAG_KEY_VALUE_LOCATION_VALUE         = 0x4200B9,
    KMIP_TAG_KEY_VALUE_LOCATION_TYPE          = 0x4200BA,
    KMIP_TAG_KEY_VALUE_PRESENT                = 0x4200BB,
    KMIP_TAG_ORIGINAL_CREATION_DATE           = 0x4200BC,
    KMIP_TAG_PGP_KEY                          = 0x4200BD,
    KMIP_TAG_PGP_KEY_VERSION                  = 0x4200BE,
    KMIP_TAG_ALTERNATIVE_NAME                 = 0x4200BF,
    KMIP_TAG_ALTERNATIVE_NAME_VALUE           = 0x4200C0,
    KMIP_TAG_ALTERNATIVE_NAME_TYPE            = 0x4200C1,
    KMIP_TAG_DATA                             = 0x4200C2,
    KMIP_TAG_SIGNATURE_DATA                   = 0x4200C3,
    KMIP_TAG_DATA_LENGTH                      = 0x4200C4,
    KMIP_TAG_RANDOM_IV                        = 0x4200C5,
    KMIP_TAG_MAC_DATA                         = 0x4200C6,
    KMIP_TAG_ATTESTATION_TYPE                 = 0x4200C7,
    KMIP_TAG_NONCE                            = 0x4200C8,
    KMIP_TAG_NONCE_ID                         = 0x4200C9,
    KMIP_TAG_NONCE_VALUE                      = 0x4200CA,
    KMIP_TAG_ATTESTATION_MEASUREMENT          = 0x4200CB,
    KMIP_TAG_ATTESTATION_ASSERTION            = 0x4200CC,
    KMIP_TAG_IV_LENGTH                        = 0x4200CD,
    KMIP_TAG_TAG_LENGTH                       = 0x4200CE,
    KMIP_TAG_FIXED_FIELD_LENGTH               = 0x4200CF,
    KMIP_TAG_COUNTER_LENGTH                   = 0x4200D0,
    KMIP_TAG_INITIAL_COUNTER_VALUE            = 0x4200D1,
    KMIP_TAG_INVOCATION_FIELD_LENGTH          = 0x4200D2,
    KMIP_TAG_ATTESTATION_CAPABLE_INDICATOR    = 0x4200D3,
    /* KMIP 1.3 */
    KMIP_TAG_OFFSET_ITEMS                     = 0x4200D4,
    KMIP_TAG_LOCATED_ITEMS                    = 0x4200D5,
    KMIP_TAG_CORRELATION_VALUE                = 0x4200D6,
    KMIP_TAG_INIT_INDICATOR                   = 0x4200D7,
    KMIP_TAG_FINAL_INDICATOR                  = 0x4200D8,
    KMIP_TAG_RNG_PARAMETERS                   = 0x4200D9,
    KMIP_TAG_RNG_ALGORITHM                    = 0x4200DA,
    KMIP_TAG_DRBG_ALGORITHM                   = 0x4200DB,
    KMIP_TAG_FIPS186_VARIATION                = 0x4200DC,
    KMIP_TAG_PREDICTION_RESISTANCE            = 0x4200DD,
    KMIP_TAG_RANDOM_NUMBER_GENERATOR          = 0x4200DE,
    KMIP_TAG_VALIDATION_INFORMATION           = 0x4200DF,
    KMIP_TAG_VALIDATION_AUTHORITY_TYPE        = 0x4200E0,
    KMIP_TAG_VALIDATION_AUTHORITY_COUNTRY     = 0x4200E1,
    KMIP_TAG_VALIDATION_AUTHORITY_URI         = 0x4200E2,
    KMIP_TAG_VALIDATION_VERSION_MAJOR         = 0x4200E3,
    KMIP_TAG_VALIDATION_VERSION_MINOR         = 0x4200E4,
    KMIP_TAG_VALIDATION_TYPE                  = 0x4200E5,
    KMIP_TAG_VALIDATION_LEVEL                 = 0x4200E6,
    KMIP_TAG_VALIDATION_CERTIFICATE_IDENTIFIER = 0x4200E7,
    KMIP_TAG_VALIDATION_CERTIFICATE_URI       = 0x4200E8,
    KMIP_TAG_VALIDATION_VENDOR_URI            = 0x4200E9,
    KMIP_TAG_VALIDATION_PROFILE               = 0x4200EA,
    KMIP_TAG_PROFILE_INFORMATION              = 0x4200EB,
    KMIP_TAG_PROFILE_NAME                     = 0x4200EC,
    KMIP_TAG_SERVER_URI                       = 0x4200ED,
    KMIP_TAG_SERVER_PORT                      = 0x4200EE,
    KMIP_TAG_STREAMING_CAPABILITY             = 0x4200EF,
    KMIP_TAG_ASYNCHRONOUS_CAPABILITY          = 0x4200F0,
    KMIP_TAG_ATTESTATION_CAPABILITY           = 0x4200F1,
    KMIP_TAG_UNWRAP_MODE                      = 0x4200F2,
    KMIP_TAG_DESTROY_ACTION                   = 0x4200F3,
    KMIP_TAG_SHREDDING_ALGORITHM              = 0x4200F4,
    KMIP_TAG_RNG_MODE                         = 0x4200F5,
    KMIP_TAG_CLIENT_REGISTRATION_METHOD       = 0x4200F6,
    KMIP_TAG_CAPABILITY_INFORMATION           = 0x4200F7,
    /* KMIP 1.4 */
    KMIP_TAG_KEY_WRAP_TYPE                    = 0x4200F8,
    KMIP_TAG_BATCH_UNDO_CAPABILITY            = 0x4200F9,
    KMIP_TAG_BATCH_CONTINUE_CAPABILITY        = 0x4200FA,
    KMIP_TAG_PKCS_12_FRIENDLY_NAME            = 0x4200FB,
    KMIP_TAG_DESCRIPTION                      = 0x4200FC,
    KMIP_TAG_COMMENT                          = 0x4200FD,
    KMIP_TAG_AUTHENTICATED_ENCRYPTION_ADDITIONAL_DATA = 0x4200FE,
    KMIP_TAG_AUTHENTICATED_ENCRYPTION_TAG     = 0x4200FF,
    KMIP_TAG_SALT_LENGTH                      = 0x420100,
    KMIP_TAG_MASK_GENERATOR                   = 0x420101,
    KMIP_TAG_MASK_GENERATOR_HASHING_ALGORITHM = 0x420102,
    KMIP_TAG_P_SOURCE                         = 0x420103,
    KMIP_TAG_TRAILER_FIELD                    = 0x420104,
    KMIP_TAG_CLIENT_CORRELATION_VALUE         = 0x420105,
    KMIP_TAG_SERVER_CORRELATION_VALUE         = 0x420106,
    KMIP_TAG_DIGESTED_DATA                    = 0x420107,
    KMIP_TAG_CERTIFICATE_SUBJECT_CN           = 0x420108,
    KMIP_TAG_CERTIFICATE_SUBJECT_O            = 0x420109,
    KMIP_TAG_CERTIFICATE_SUBJECT_OU           = 0x42010A,
    KMIP_TAG_CERTIFICATE_SUBJECT_EMAIL        = 0x42010B,
    KMIP_TAG_CERTIFICATE_SUBJECT_C            = 0x42010C,
    KMIP_TAG_CERTIFICATE_SUBJECT_ST           = 0x42010D,
    KMIP_TAG_CERTIFICATE_SUBJECT_L            = 0x42010E,
    KMIP_TAG_CERTIFICATE_SUBJECT_UID          = 0x42010F,
    KMIP_TAG_CERTIFICATE_SUBJECT_SERIAL_NUMBER = 0x420110,
    KMIP_TAG_CERTIFICATE_SUBJECT_TITLE        = 0x420111,
    KMIP_TAG_CERTIFICATE_SUBJECT_DC           = 0x420112,
    KMIP_TAG_CERTIFICATE_SUBJECT_DN_QUALIFIER = 0x420113,
    KMIP_TAG_CERTIFICATE_ISSUER_CN            = 0x420114,
    KMIP_TAG_CERTIFICATE_ISSUER_O             = 0x420115,
    KMIP_TAG_CERTIFICATE_ISSUER_OU            = 0x420116,
    KMIP_TAG_CERTIFICATE_ISSUER_EMAIL         = 0x420117,
    KMIP_TAG_CERTIFICATE_ISSUER_C             = 0x420118,
    KMIP_TAG_CERTIFICATE_ISSUER_ST            = 0x420119,
    KMIP_TAG_CERTIFICATE_ISSUER_L             = 0x42011A,
    KMIP_TAG_CERTIFICATE_ISSUER_UID           = 0x42011B,
    KMIP_TAG_CERTIFICATE_ISSUER_SERIAL_NUMBER = 0x42011C,
    KMIP_TAG_CERTIFICATE_ISSUER_TITLE         = 0x42011D,
    KMIP_TAG_CERTIFICATE_ISSUER_DC            = 0x42011E,
    KMIP_TAG_CERTIFICATE_ISSUER_DN_QUALIFIER  = 0x42011F,
    KMIP_TAG_SENSITIVE                        = 0x420120,
    KMIP_TAG_ALWAYS_SENSITIVE                 = 0x420121,
    KMIP_TAG_EXTRACTABLE                      = 0x420122,
    KMIP_TAG_NEVER_EXTRACTABLE                = 0x420123,
    KMIP_TAG_REPLACE_EXISTING                 = 0x420124,
    /* KMIP 2.0 */
    KMIP_TAG_ATTRIBUTES                       = 0x420125,
    KMIP_TAG_EPHEMERAL                        = 0x420154,
    KMIP_TAG_SERVER_HASHED_PASSWORD           = 0x420155,
    KMIP_TAG_PROTECTION_STORAGE_MASK          = 0x42015E,
    KMIP_TAG_PROTECTION_STORAGE_MASKS         = 0x42015F,
    KMIP_TAG_COMMON_PROTECTION_STORAGE_MASKS  = 0x420163,
    KMIP_TAG_PRIVATE_PROTECTION_STORAGE_MASKS = 0x420164,
    KMIP_TAG_PUBLIC_PROTECTION_STORAGE_MASKS  = 0x420165
};

enum type
{
    /* KMIP 1.0 */
    KMIP_TYPE_STRUCTURE          = 0x01,
    KMIP_TYPE_INTEGER            = 0x02,
    KMIP_TYPE_LONG_INTEGER       = 0x03,
    KMIP_TYPE_BIG_INTEGER        = 0x04,
    KMIP_TYPE_ENUMERATION        = 0x05,
    KMIP_TYPE_BOOLEAN            = 0x06,
    KMIP_TYPE_TEXT_STRING        = 0x07,
    KMIP_TYPE_BYTE_STRING        = 0x08,
    KMIP_TYPE_DATE_TIME          = 0x09,
    KMIP_TYPE_INTERVAL           = 0x0A,
    /* KMIP 2.0 */
    KMIP_TYPE_DATE_TIME_EXTENDED = 0x0B
};

enum wrapping_method
{
    /* KMIP 1.0 */
    KMIP_WRAP_ENCRYPT          = 0x01,
    KMIP_WRAP_MAC_SIGN         = 0x02,
    KMIP_WRAP_ENCRYPT_MAC_SIGN = 0x03,
    KMIP_WRAP_MAC_SIGN_ENCRYPT = 0x04,
    KMIP_WRAP_TR31             = 0x05
};

enum storage_status_mask
{
    /* KMIP 1.0 */
    KMIP_SSM_ONLINE_STORAGE = 0x1,
    KMIP_SSM_ARCHIVAL_STORAGE = 0x2,
    /* KMIP 2.0 */
    KMIP_SSM_DESTROYED_STORAGE = 0x4
};

enum object_group_member
{
    /* KMIP 1.1 */
    KMIP_OGM_GROUP_MEMBER_FRESH = 1,
    KMIP_OGM_GROUP_MEMBER_DEFAULT = 2
};

/*
Structures
*/

typedef struct linked_list_item
{
    struct linked_list_item *next;
    struct linked_list_item *prev;
    
    void *data;
} LinkedListItem;

typedef struct linked_list
{
    LinkedListItem *head;
    LinkedListItem *tail;

    size_t size;
} LinkedList;

typedef struct text_string
{
    char *value;
    size_t size;
} TextString;

typedef struct byte_string
{
    uint8 *value;
    size_t size;
} ByteString;

typedef struct error_frame
{
    char function[100];
    int line;
} ErrorFrame;

typedef struct kmip
{
    /* Encoding buffer */
    uint8 *buffer;
    uint8 *index;
    size_t size;
    
    /* KMIP message settings */
    enum kmip_version version;
    int max_message_size;
    LinkedList *credential_list;
    
    /* Error handling information */
    char *error_message;
    size_t error_message_size;
    /* TODO (ph) Switch the following to a LinkedList. */
    ErrorFrame errors[20];
    size_t error_frame_count;
    struct error_frame *frame_index;
    
    /* Memory management function pointers */
    void *(*calloc_func)(void *state, size_t num, size_t size);
    void *(*realloc_func)(void *state, void *ptr, size_t size);
    void (*free_func)(void *state, void *ptr);
    void *(*memcpy_func)(void *state, void *destination, const void* source, size_t size);
    void *(*memset_func)(void *ptr, int value, size_t size);
    void *state;
} KMIP;

typedef struct attribute
{
    enum attribute_type type;
    int32 index;
    void *value;
} Attribute;

typedef struct attributes
{
    LinkedList *attribute_list;
} Attributes;

typedef struct name
{
    struct text_string *value;
    enum name_type type;
} Name;

typedef struct template_attribute
{
    /* TODO (ph) Change these to linked lists */
    Name *names;
    size_t name_count;
    Attribute *attributes;
    size_t attribute_count;
} TemplateAttribute;

typedef struct protocol_version
{
    int32 major;
    int32 minor;
} ProtocolVersion;

typedef struct protection_storage_masks
{
    /* KMIP 2.0 */
    LinkedList *masks;
} ProtectionStorageMasks;

typedef struct cryptographic_parameters
{
    /* KMIP 1.0 */
    enum block_cipher_mode block_cipher_mode;
    enum padding_method padding_method;
    enum hashing_algorithm hashing_algorithm;
    enum key_role_type key_role_type;
    /* KMIP 1.2 */
    enum digital_signature_algorithm digital_signature_algorithm;
    enum cryptographic_algorithm cryptographic_algorithm;
    bool32 random_iv;
    int32 iv_length;
    int32 tag_length;
    int32 fixed_field_length;
    int32 invocation_field_length;
    int32 counter_length;
    int32 initial_counter_value;
    /* KMIP 1.4 */
    int32 salt_length;
    enum mask_generator mask_generator;
    enum hashing_algorithm mask_generator_hashing_algorithm;
    ByteString *p_source;
    int32 trailer_field;
} CryptographicParameters;

typedef struct digest
{
    enum hashing_algorithm hashing_algorithm;
    ByteString *digest_value;
    enum key_format_type key_format_type;
} Digest;

typedef struct encryption_key_information
{
    TextString *unique_identifier;
    CryptographicParameters *cryptographic_parameters;
} EncryptionKeyInformation;

typedef struct mac_signature_key_information
{
    TextString *unique_identifier;
    CryptographicParameters *cryptographic_parameters;
} MACSignatureKeyInformation;

typedef struct key_wrapping_data
{
    /* KMIP 1.0 */
    enum wrapping_method wrapping_method;
    EncryptionKeyInformation *encryption_key_info;
    MACSignatureKeyInformation *mac_signature_key_info;
    ByteString *mac_signature;
    ByteString *iv_counter_nonce;
    /* KMIP 1.1 */
    enum encoding_option encoding_option;
} KeyWrappingData;

typedef struct transparent_symmetric_key
{
    ByteString *key;
} TransparentSymmetricKey;

typedef struct key_value
{
    void *key_material;
    /* TODO (ph) Change this to a linked list */
    Attribute *attributes;
    size_t attribute_count;
} KeyValue;

typedef struct key_block
{
    enum key_format_type key_format_type;
    enum key_compression_type key_compression_type;
    void *key_value;
    enum type key_value_type;
    enum cryptographic_algorithm cryptographic_algorithm;
    int32 cryptographic_length;
    KeyWrappingData *key_wrapping_data;
} KeyBlock;

typedef struct symmetric_key
{
    KeyBlock *key_block;
} SymmetricKey;

typedef struct public_key
{
    KeyBlock *key_block;
} PublicKey;

typedef struct private_key
{
    KeyBlock *key_block;
} PrivateKey;

typedef struct key_wrapping_specification
{
    /* KMIP 1.0 */
    enum wrapping_method wrapping_method;
    EncryptionKeyInformation *encryption_key_info;
    MACSignatureKeyInformation *mac_signature_key_info;
    /* TODO (ph) Change this to a linked list */
    TextString *attribute_names;
    size_t attribute_name_count;
    /* KMIP 1.1 */
    enum encoding_option encoding_option;
} KeyWrappingSpecification;

typedef struct nonce
{
    ByteString *nonce_id;
    ByteString *nonce_value;
} Nonce;

/* Operation Payloads */

typedef struct create_request_payload
{
    /* KMIP 1.0 */
    enum object_type object_type;
    TemplateAttribute *template_attribute;
    /* KMIP 2.0 */
    Attributes *attributes;
    ProtectionStorageMasks *protection_storage_masks;
} CreateRequestPayload;

typedef struct create_response_payload
{
    /* KMIP 1.0 */
    enum object_type object_type;
    TextString *unique_identifier;
    TemplateAttribute *template_attribute;
} CreateResponsePayload;

typedef struct locate_request_payload
{
    /* KMIP 1.0 */
    size_t maximum_items;
    size_t offset_items;
    enum storage_status_mask storage_status_mask;
    enum object_group_member object_group_member;
    Attribute *attributes;
    int attribute_count;
} LocateRequestPayload;

typedef struct locate_response_payload
{
    /* KMIP 1.0 */
    size_t located_items;
    TextString *unique_identifiers;
    int unique_identifiers_count;
} LocateResponsePayload;

typedef struct get_request_payload
{
    /* KMIP 1.0 */
    TextString *unique_identifier;
    enum key_format_type key_format_type;
    enum key_compression_type key_compression_type;
    KeyWrappingSpecification *key_wrapping_spec;
    /* KMIP 1.4 */
    enum key_wrap_type key_wrap_type;
} GetRequestPayload;

typedef struct get_response_payload
{
    enum object_type object_type;
    TextString *unique_identifier;
    void *object;
} GetResponsePayload;

typedef struct get_attributes_request_payload
{
    /* KMIP 1.0 */
    TextString *unique_identifier;
    enum attribute_type *attribute_names;
    int attribute_count;
} GetAttributesRequestPayload;

typedef struct get_attributes_response_payload
{
    TextString *unique_identifier;
    Attribute *attributes;
    int attribute_count;
} GetAttributesResponsePayload;

typedef struct get_attribute_list_request_payload
{
    /* KMIP 1.0 */
    TextString *unique_identifier;
} GetAttributeListRequestPayload;

typedef struct get_attribute_list_response_payload
{
    TextString *unique_identifier;
    enum attribute_type *attribute_names;
    int attribute_names_count;
} GetAttributeListResponsePayload;

typedef struct destroy_request_payload
{
    TextString *unique_identifier;
} DestroyRequestPayload;

typedef struct destroy_response_payload
{
    TextString *unique_identifier;
} DestroyResponsePayload;

/* Authentication Structures */

typedef struct credential
{
    enum credential_type credential_type;
    void *credential_value;
} Credential;

typedef struct username_password_credential
{
    TextString *username;
    TextString *password;
} UsernamePasswordCredential;

typedef struct device_credential
{
    TextString *device_serial_number;
    TextString *password;
    TextString *device_identifier;
    TextString *network_identifier;
    TextString *machine_identifier;
    TextString *media_identifier;
} DeviceCredential;

typedef struct attestation_credential
{
    Nonce *nonce;
    enum attestation_type attestation_type;
    ByteString *attestation_measurement;
    ByteString *attestation_assertion;
} AttestationCredential;

typedef struct authentication
{
    /* NOTE (ph) KMIP 1.2+ supports multiple credentials here. */
    /* NOTE (ph) Polymorphism makes this tricky. Omitting for now. */
    /* TODO (ph) Credential structs are constant size, so no problem here. */
    /* TODO (ph) Change this to a linked list */
    Credential *credential;
} Authentication;

/* Message Structures */

typedef struct request_header
{
    /* KMIP 1.0 */
    ProtocolVersion *protocol_version;
    int32 maximum_response_size;
    bool32 asynchronous_indicator;
    Authentication *authentication;
    enum batch_error_continuation_option batch_error_continuation_option;
    bool32 batch_order_option;
    uint64 time_stamp;
    int32 batch_count;
    /* KMIP 1.2 */
    bool32 attestation_capable_indicator;
    enum attestation_type *attestation_types;
    size_t attestation_type_count;
    /* KMIP 1.4 */
    TextString *client_correlation_value;
    TextString *server_correlation_value;
} RequestHeader;

typedef struct response_header
{
    /* KMIP 1.0 */
    ProtocolVersion *protocol_version;
    uint64 time_stamp;
    int32 batch_count;
    /* KMIP 1.2 */
    Nonce *nonce;
    /* TODO (ph) Change this to a linked list */
    enum attestation_type *attestation_types;
    size_t attestation_type_count;
    /* KMIP 1.4 */
    TextString *client_correlation_value;
    TextString *server_correlation_value;
    /* KMIP 2.0 */
    ByteString *server_hashed_password;
} ResponseHeader;

typedef struct request_batch_item
{
    /* KMIP 1.0 */
    enum operation operation;
    ByteString *unique_batch_item_id;
    void *request_payload;
    /* KMIP 2.0 */
    bool32 ephemeral;
    /* NOTE (ph) Omitting the message extension field for now. */
} RequestBatchItem;

typedef struct response_batch_item
{
    enum operation operation;
    ByteString *unique_batch_item_id;
    enum result_status result_status;
    enum result_reason result_reason;
    TextString *result_message;
    ByteString *asynchronous_correlation_value;
    void *response_payload;
    /* NOTE (ph) Omitting the message extension field for now. */
} ResponseBatchItem;

typedef struct request_message
{
    RequestHeader *request_header;
    /* TODO (ph) Change this to a linked list */
    RequestBatchItem *batch_items;
    size_t batch_count;
} RequestMessage;

typedef struct response_message
{
    ResponseHeader *response_header;
    /* TODO (ph) Change this to a linked list */
    ResponseBatchItem *batch_items;
    size_t batch_count;
} ResponseMessage;

/*
Macros
*/

#define ARRAY_LENGTH(A) (sizeof((A)) / sizeof((A)[0]))

#define BUFFER_BYTES_LEFT(A) ((A)->size - ((A)->index - (A)->buffer))

#define CHECK_BUFFER_FULL(A, B) CHECK_BUFFER_SIZE((A), (B), KMIP_ERROR_BUFFER_FULL)

#define CHECK_BUFFER_SIZE(A, B, C)                      \
do                                                      \
{                                                       \
    if(BUFFER_BYTES_LEFT(A) < (B))                      \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return((C));                                    \
    }                                                   \
} while(0)

#define CHECK_RESULT(A, B)                              \
do                                                      \
{                                                       \
    if((B) != KMIP_OK)                                  \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return((B));                                    \
    }                                                   \
} while(0)

#define HANDLE_FAILURE(A, B)                        \
do                                                  \
{                                                   \
    kmip_push_error_frame((A), __func__, __LINE__); \
    return((B));                                    \
} while(0)

#define TAG_TYPE(A, B) (((A) << 8) | (uint8)(B))

#define CHECK_TAG_TYPE(A, B, C, D)                      \
do                                                      \
{                                                       \
    if((int32)((B) >> 8) != (int32)(C))                 \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return(KMIP_TAG_MISMATCH);                      \
    }                                                   \
    else if((int32)(((B) << 24) >> 24) != (int32)(D))   \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return(KMIP_TYPE_MISMATCH);                     \
    }                                                   \
} while(0)

#define CHECK_LENGTH(A, B, C)                           \
do                                                      \
{                                                       \
    if((B) != (C))                                      \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return(KMIP_LENGTH_MISMATCH);                   \
    }                                                   \
} while(0)

#define CHECK_PADDING(A, B)                             \
do                                                      \
{                                                       \
    if((B) != 0)                                        \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return(KMIP_PADDING_MISMATCH);                  \
    }                                                   \
} while(0)

#define CHECK_BOOLEAN(A, B)                             \
do                                                      \
{                                                       \
    if(((B) != KMIP_TRUE) && ((B) != KMIP_FALSE))       \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return(KMIP_BOOLEAN_MISMATCH);                  \
    }                                                   \
} while(0)

#define CHECK_ENUM(A, B, C)                                     \
do                                                              \
{                                                               \
    int result = kmip_check_enum_value((A)->version, (B), (C)); \
    if(result != KMIP_OK)                                       \
    {                                                           \
        kmip_set_enum_error_message((A), (B), (C), result);     \
        kmip_push_error_frame((A), __func__, __LINE__);         \
        return(result);                                         \
    }                                                           \
} while(0)

#define CHECK_NEW_MEMORY(A, B, C, D)                    \
do                                                      \
{                                                       \
    if((B) == NULL)                                     \
    {                                                   \
        kmip_set_alloc_error_message((A), (C), (D));    \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return(KMIP_MEMORY_ALLOC_FAILED);               \
    }                                                   \
} while(0)

#define HANDLE_FAILED_ALLOC(A, B, C)                \
do                                                  \
{                                                   \
    kmip_set_alloc_error_message((A), (B), (C));    \
    kmip_push_error_frame((A), __func__, __LINE__); \
    return(KMIP_MEMORY_ALLOC_FAILED);               \
} while(0)

#define CHECK_ENCODE_ARGS(A, B)   \
do                                \
{                                 \
    if((A) == NULL)               \
    {                             \
        return(KMIP_ARG_INVALID); \
    }                             \
    if((B) == NULL)               \
    {                             \
        return(KMIP_OK);          \
    }                             \
} while(0)

#define CHECK_DECODE_ARGS(A, B)    \
do                                 \
{                                  \
    if((A) == NULL || (B) == NULL) \
    {                              \
        return(KMIP_ARG_INVALID);  \
    }                              \
} while(0)

#define CHECK_KMIP_VERSION(A, B)                        \
do                                                      \
{                                                       \
    if((A)->version < (B))                              \
    {                                                   \
        kmip_push_error_frame((A), __func__, __LINE__); \
        return(KMIP_INVALID_FOR_VERSION);               \
    }                                                   \
} while(0)

#define CALCULATE_PADDING(A) ((8 - ((A) % 8)) % 8)

/*
Miscellaneous Utilities
*/

size_t kmip_strnlen_s(const char *, size_t);
LinkedListItem *kmip_linked_list_pop(LinkedList *);
void kmip_linked_list_push(LinkedList *, LinkedListItem *);
void kmip_linked_list_enqueue(LinkedList *, LinkedListItem *);

/*
Memory Handlers
*/

void *kmip_calloc(void *, size_t, size_t);
void *kmip_realloc(void *, void *, size_t);
void kmip_free(void *, void *);
void *kmip_memcpy(void *, void *, const void *, size_t);

/*
Enumeration Utilities
*/

int kmip_get_enum_string_index(enum tag);
int kmip_check_enum_value(enum kmip_version, enum tag, int);

/*
Context Utilities
*/

void kmip_clear_errors(KMIP *);
void kmip_init(KMIP *, void *, size_t, enum kmip_version);
void kmip_init_error_message(KMIP *);
int kmip_add_credential(KMIP *, Credential *);
void kmip_remove_credentials(KMIP *);
void kmip_reset(KMIP *);
void kmip_rewind(KMIP *);
void kmip_set_buffer(KMIP *, void *, size_t);
void kmip_destroy(KMIP *);
void kmip_push_error_frame(KMIP *, const char *, const int);
void kmip_set_enum_error_message(KMIP *, enum tag, int, int);
void kmip_set_alloc_error_message(KMIP *, size_t, const char *);
void kmip_set_error_message(KMIP *, const char *);
int kmip_is_tag_next(const KMIP *, enum tag);
int kmip_is_tag_type_next(const KMIP *, enum tag, enum type);
int kmip_get_num_items_next(KMIP *, enum tag);
uint32 kmip_peek_tag(KMIP *);
int kmip_is_attribute_tag(uint32);

/*
Initialization Functions
*/

void kmip_init_protocol_version(ProtocolVersion *, enum kmip_version);
void kmip_init_attribute(Attribute *);
void kmip_init_cryptographic_parameters(CryptographicParameters *);
void kmip_init_key_block(KeyBlock *);
void kmip_init_request_header(RequestHeader *);
void kmip_init_response_header(ResponseHeader *);
void kmip_init_request_batch_item(RequestBatchItem *);

/*
Printing Functions
*/

void kmip_print_buffer(void *, int);
void kmip_print_stack_trace(KMIP *);
void kmip_print_error_string(int);
void kmip_print_batch_error_continuation_option(enum batch_error_continuation_option);
void kmip_print_operation_enum(enum operation);
void kmip_print_result_status_enum(enum result_status);
void kmip_print_result_reason_enum(enum result_reason);
void kmip_print_object_type_enum(enum object_type);
void kmip_print_key_format_type_enum(enum key_format_type);
void kmip_print_key_compression_type_enum(enum key_compression_type);
void kmip_print_cryptographic_algorithm_enum(enum cryptographic_algorithm);
void kmip_print_name_type_enum(enum name_type);
void kmip_print_attribute_type_enum(enum attribute_type);
void kmip_print_state_enum(enum state);
void kmip_print_block_cipher_mode_enum(enum block_cipher_mode);
void kmip_print_certificate_type_mode_enum(enum certificate_type);
void kmip_print_padding_method_enum(enum padding_method);
void kmip_print_hashing_algorithm_enum(enum hashing_algorithm);
void kmip_print_key_role_type_enum(enum key_role_type);
void kmip_print_digital_signature_algorithm_enum(enum digital_signature_algorithm);
void kmip_print_mask_generator_enum(enum mask_generator);
void kmip_print_wrapping_method_enum(enum wrapping_method);
void kmip_print_encoding_option_enum(enum encoding_option);
void kmip_print_key_wrap_type_enum(enum key_wrap_type);
void kmip_print_credential_type_enum(enum credential_type);
void kmip_print_cryptographic_usage_mask_enums(int, int32);
void kmip_print_integer(int32);
void kmip_print_bool(int32);
void kmip_print_date_time(int64);
void kmip_print_text_string(int, const char *, TextString *);
void kmip_print_byte_string(int, const char *, ByteString *);
void kmip_print_protocol_version(int, ProtocolVersion *);
void kmip_print_name(int, Name *);
void kmip_print_nonce(int, Nonce *);
void kmip_print_storage_status_mask_enum(enum storage_status_mask);
void kmip_print_object_group_member_enum(enum object_group_member);
void kmip_print_protection_storage_masks_enum(int, int32);
void kmip_print_protection_storage_masks(int, ProtectionStorageMasks *);
void kmip_print_cryptographic_parameters(int, CryptographicParameters *);
void kmip_print_encryption_key_information(int, EncryptionKeyInformation *);
void kmip_print_mac_signature_key_information(int, MACSignatureKeyInformation *);
void kmip_print_key_wrapping_data(int, KeyWrappingData *);
void kmip_print_attribute_value(int, enum attribute_type, void *);
void kmip_print_attribute(int, Attribute *);
void kmip_print_attributes(int, Attributes *);
void kmip_print_key_material(int, enum key_format_type, void *);
void kmip_print_key_value(int, enum type, enum key_format_type, void *);
void kmip_print_key_block(int, KeyBlock *);
void kmip_print_symmetric_key(int, SymmetricKey *);
void kmip_print_object(int, enum object_type, void *);
void kmip_print_key_wrapping_specification(int, KeyWrappingSpecification *);
void kmip_print_template_attribute(int, TemplateAttribute *);
void kmip_print_create_request_payload(int, CreateRequestPayload *);
void kmip_print_create_response_payload(int, CreateResponsePayload *);
void kmip_print_locate_request_payload(int, LocateRequestPayload *);
void kmip_print_locate_response_payload(int, LocateResponsePayload *);
void kmip_print_get_request_payload(int, GetRequestPayload *);
void kmip_print_get_response_payload(int, GetResponsePayload *);
void kmip_print_get_attributes_request_payload(int, GetAttributesRequestPayload *);
void kmip_print_get_attributes_response_payload(int, GetAttributesResponsePayload *);
void kmip_print_get_attribute_list_request_payload(int, GetAttributeListRequestPayload *);
void kmip_print_get_attribute_list_response_payload(int, GetAttributeListResponsePayload *);
void kmip_print_destroy_request_payload(int, DestroyRequestPayload *);
void kmip_print_destroy_response_payload(int, DestroyResponsePayload *);
void kmip_print_request_payload(int, enum operation, void *);
void kmip_print_response_payload(int, enum operation, void *);
void kmip_print_username_password_credential(int, UsernamePasswordCredential *);
void kmip_print_device_credential(int, DeviceCredential *);
void kmip_print_attestation_credential(int, AttestationCredential *);
void kmip_print_credential_value(int, enum credential_type, void *);
void kmip_print_credential(int, Credential *);
void kmip_print_authentication(int, Authentication *);
void kmip_print_request_batch_item(int, RequestBatchItem *);
void kmip_print_response_batch_item(int, ResponseBatchItem *);
void kmip_print_request_header(int, RequestHeader *);
void kmip_print_response_header(int, ResponseHeader *);
void kmip_print_request_message(RequestMessage *);
void kmip_print_response_message(ResponseMessage *);

/*
Freeing Functions
*/

void kmip_free_buffer(KMIP *, void *, size_t);
void kmip_free_text_string(KMIP *, TextString *);
void kmip_free_byte_string(KMIP *, ByteString *);
void kmip_free_name(KMIP *, Name *);
void kmip_free_attribute(KMIP *, Attribute *);
void kmip_free_attributes(KMIP *, Attributes *);
void kmip_free_attributes_2(KMIP *, Attribute *, int);
void kmip_free_template_attribute(KMIP *, TemplateAttribute *);
void kmip_free_transparent_symmetric_key(KMIP *, TransparentSymmetricKey *);
void kmip_free_key_material(KMIP *, enum key_format_type, void **);
void kmip_free_key_value(KMIP *, enum key_format_type, KeyValue *);
void kmip_free_protection_storage_masks(KMIP *, ProtectionStorageMasks *);
void kmip_free_cryptographic_parameters(KMIP *, CryptographicParameters *);
void kmip_free_encryption_key_information(KMIP *, EncryptionKeyInformation *);
void kmip_free_mac_signature_key_information(KMIP *, MACSignatureKeyInformation *);
void kmip_free_key_wrapping_data(KMIP *, KeyWrappingData *);
void kmip_free_key_block(KMIP *, KeyBlock *);
void kmip_free_symmetric_key(KMIP *, SymmetricKey *);
void kmip_free_public_key(KMIP *, PublicKey *);
void kmip_free_private_key(KMIP *, PrivateKey *);
void kmip_free_key_wrapping_specification(KMIP *, KeyWrappingSpecification *);
void kmip_free_create_request_payload(KMIP *, CreateRequestPayload *);
void kmip_free_create_response_payload(KMIP *, CreateResponsePayload *);
void kmip_free_locate_request_payload(KMIP *, LocateRequestPayload *);
void kmip_free_locate_response_payload(KMIP *, LocateResponsePayload *);
void kmip_free_get_request_payload(KMIP *, GetRequestPayload *);
void kmip_free_get_response_payload(KMIP *, GetResponsePayload *);
void kmip_free_get_attributes_request_payload(KMIP *, GetAttributesRequestPayload *);
void kmip_free_get_attributes_response_payload(KMIP *, GetAttributesResponsePayload *);
void kmip_free_get_attribute_list_request_payload(KMIP *, GetAttributeListRequestPayload *);
void kmip_free_get_attribute_list_response_payload(KMIP *, GetAttributeListResponsePayload *);
void kmip_free_destroy_request_payload(KMIP *, DestroyRequestPayload *);
void kmip_free_destroy_response_payload(KMIP *, DestroyResponsePayload *);
void kmip_free_request_batch_item(KMIP *, RequestBatchItem *);
void kmip_free_response_batch_item(KMIP *, ResponseBatchItem *);
void kmip_free_nonce(KMIP *, Nonce *);
void kmip_free_username_password_credential(KMIP *, UsernamePasswordCredential *);
void kmip_free_device_credential(KMIP *, DeviceCredential *);
void kmip_free_attestation_credential(KMIP *, AttestationCredential *);
void kmip_free_credential_value(KMIP *, enum credential_type, void **);
void kmip_free_credential(KMIP *, Credential *);
void kmip_free_authentication(KMIP *, Authentication *);
void kmip_free_request_header(KMIP *, RequestHeader *);
void kmip_free_response_header(KMIP *, ResponseHeader *);
void kmip_free_request_message(KMIP *, RequestMessage *);
void kmip_free_response_message(KMIP *, ResponseMessage *);

/*
Copying Functions
*/

int32 * kmip_deep_copy_int32(KMIP *, const int32 *);
TextString * kmip_deep_copy_text_string(KMIP *, const TextString *);
Name * kmip_deep_copy_name(KMIP *, const Name *);
Attribute * kmip_deep_copy_attribute(KMIP *, const Attribute *);

/*
Comparison Functions
*/

int kmip_compare_text_string(const TextString *, const TextString *);
int kmip_compare_byte_string(const ByteString *, const ByteString *);
int kmip_compare_name(const Name *, const Name *);
int kmip_compare_attribute(const Attribute *, const Attribute *);
int kmip_compare_attributes(const Attributes *, const Attributes *);
int kmip_compare_template_attribute(const TemplateAttribute *, const TemplateAttribute *);
int kmip_compare_protocol_version(const ProtocolVersion *, const ProtocolVersion *);
int kmip_compare_transparent_symmetric_key(const TransparentSymmetricKey *, const TransparentSymmetricKey *);
int kmip_compare_key_material(enum key_format_type, void **, void **);
int kmip_compare_key_value(enum key_format_type, const KeyValue *, const KeyValue *);
int kmip_compare_protection_storage_masks(const ProtectionStorageMasks *, const ProtectionStorageMasks *);
int kmip_compare_cryptographic_parameters(const CryptographicParameters *, const CryptographicParameters *);
int kmip_compare_encryption_key_information(const EncryptionKeyInformation *, const EncryptionKeyInformation *);
int kmip_compare_mac_signature_key_information(const MACSignatureKeyInformation *, const MACSignatureKeyInformation *);
int kmip_compare_key_wrapping_data(const KeyWrappingData *, const KeyWrappingData *);
int kmip_compare_key_block(const KeyBlock *, const KeyBlock *);
int kmip_compare_symmetric_key(const SymmetricKey *, const SymmetricKey *);
int kmip_compare_public_key(const PublicKey *, const PublicKey *);
int kmip_compare_private_key(const PrivateKey *, const PrivateKey *);
int kmip_compare_key_wrapping_specification(const KeyWrappingSpecification *, const KeyWrappingSpecification *);
int kmip_compare_create_request_payload(const CreateRequestPayload *, const CreateRequestPayload *);
int kmip_compare_create_response_payload(const CreateResponsePayload *, const CreateResponsePayload *);
int kmip_compare_locate_request_payload(const LocateRequestPayload *, const LocateRequestPayload *);
int kmip_compare_locate_response_payload(const LocateResponsePayload *, const LocateResponsePayload *);
int kmip_compare_get_request_payload(const GetRequestPayload *, const GetRequestPayload *);
int kmip_compare_get_response_payload(const GetResponsePayload *, const GetResponsePayload *);
int kmip_compare_get_attributes_request_payload(const GetAttributesRequestPayload *, const GetAttributesRequestPayload *);
int kmip_compare_get_attributes_response_payload(const GetAttributesResponsePayload *, const GetAttributesResponsePayload *);
int kmip_compare_get_attribute_list_request_payload(const GetAttributeListRequestPayload *, const GetAttributeListRequestPayload *);
int kmip_compare_get_attribute_list_response_payload(const GetAttributeListResponsePayload *, const GetAttributeListResponsePayload *);
int kmip_compare_destroy_request_payload(const DestroyRequestPayload *, const DestroyRequestPayload *);
int kmip_compare_destroy_response_payload(const DestroyResponsePayload *, const DestroyResponsePayload *);
int kmip_compare_request_batch_item(const RequestBatchItem *, const RequestBatchItem *);
int kmip_compare_response_batch_item(const ResponseBatchItem *, const ResponseBatchItem *);
int kmip_compare_nonce(const Nonce *, const Nonce *);
int kmip_compare_username_password_credential(const UsernamePasswordCredential *, const UsernamePasswordCredential *);
int kmip_compare_device_credential(const DeviceCredential *, const DeviceCredential *);
int kmip_compare_attestation_credential(const AttestationCredential *, const AttestationCredential *);
int kmip_compare_credential_value(enum credential_type, void **, void **);
int kmip_compare_credential(const Credential *, const Credential *);
int kmip_compare_authentication(const Authentication *, const Authentication *);
int kmip_compare_request_header(const RequestHeader *, const RequestHeader *);
int kmip_compare_response_header(const ResponseHeader *, const ResponseHeader *);
int kmip_compare_request_message(const RequestMessage *, const RequestMessage *);
int kmip_compare_response_message(const ResponseMessage *, const ResponseMessage *);

/*
Encoding Functions
*/

int kmip_encode_int8_be(KMIP *, int8);
int kmip_encode_int32_be(KMIP *, int32);
int kmip_encode_int64_be(KMIP *, int64);
int kmip_encode_integer(KMIP *, enum tag, int32);
int kmip_encode_long(KMIP *, enum tag, int64);
int kmip_encode_enum(KMIP *, enum tag, int32);
int kmip_encode_bool(KMIP *, enum tag, bool32);
int kmip_encode_text_string(KMIP *, enum tag, const TextString *);
int kmip_encode_byte_string(KMIP *, enum tag, const ByteString *);
int kmip_encode_date_time(KMIP *, enum tag, uint64);
int kmip_encode_interval(KMIP *, enum tag, uint32);
int kmip_encode_name(KMIP *, const Name *);
int kmip_encode_attribute_name(KMIP *, enum attribute_type);
int kmip_encode_attribute_v1(KMIP *, const Attribute *);
int kmip_encode_attribute_v2(KMIP *, const Attribute *);
int kmip_encode_attribute(KMIP *, const Attribute *);
int kmip_encode_attributes(KMIP *, const Attributes *);
int kmip_encode_attributes_2(KMIP *, const Attribute *, int count);
int kmip_encode_template_attribute(KMIP *, const TemplateAttribute *);
int kmip_encode_protocol_version(KMIP *, const ProtocolVersion *);
int kmip_encode_protection_storage_masks(KMIP *, const ProtectionStorageMasks *);
int kmip_encode_cryptographic_parameters(KMIP *, const CryptographicParameters *);
int kmip_encode_encryption_key_information(KMIP *, const EncryptionKeyInformation *);
int kmip_encode_mac_signature_key_information(KMIP *, const MACSignatureKeyInformation *);
int kmip_encode_key_wrapping_data(KMIP *, const KeyWrappingData *);
int kmip_encode_transparent_symmetric_key(KMIP *, const TransparentSymmetricKey *);
int kmip_encode_key_material(KMIP *, enum key_format_type, const void *);
int kmip_encode_key_value(KMIP *, enum key_format_type, const KeyValue *);
int kmip_encode_key_block(KMIP *, const KeyBlock *);
int kmip_encode_symmetric_key(KMIP *, const SymmetricKey *);
int kmip_encode_public_key(KMIP *, const PublicKey *);
int kmip_encode_private_key(KMIP *, const PrivateKey *);
int kmip_encode_key_wrapping_specification(KMIP *, const KeyWrappingSpecification *);
int kmip_encode_create_request_payload(KMIP *, const CreateRequestPayload *);
int kmip_encode_create_response_payload(KMIP *, const CreateResponsePayload *);
int kmip_encode_locate_request_payload(KMIP *, const LocateRequestPayload *);
int kmip_encode_locate_response_payload(KMIP *, const LocateResponsePayload *);
int kmip_encode_get_request_payload(KMIP *, const GetRequestPayload *);
int kmip_encode_get_response_payload(KMIP *, const GetResponsePayload *);
int kmip_encode_get_attributes_request_payload(KMIP *, const GetAttributesRequestPayload *);
int kmip_encode_get_attributes_response_payload(KMIP *, const GetAttributesResponsePayload *);
int kmip_encode_get_attribute_list_request_payload(KMIP *, const GetAttributeListRequestPayload *);
int kmip_encode_get_attribute_list_response_payload(KMIP *, const GetAttributeListResponsePayload *);
int kmip_encode_destroy_request_payload(KMIP *, const DestroyRequestPayload *);
int kmip_encode_destroy_response_payload(KMIP *, const DestroyResponsePayload *);
int kmip_encode_nonce(KMIP *, const Nonce *);
int kmip_encode_username_password_credential(KMIP *, const UsernamePasswordCredential *);
int kmip_encode_device_credential(KMIP *, const DeviceCredential *);
int kmip_encode_attestation_credential(KMIP *, const AttestationCredential *);
int kmip_encode_credential_value(KMIP *, enum credential_type, void *);
int kmip_encode_credential(KMIP *, const Credential *);
int kmip_encode_authentication(KMIP *, const Authentication *);
int kmip_encode_request_header(KMIP *, const RequestHeader *);
int kmip_encode_response_header(KMIP *, const ResponseHeader *);
int kmip_encode_request_batch_item(KMIP *, const RequestBatchItem *);
int kmip_encode_response_batch_item(KMIP *, const ResponseBatchItem *);
int kmip_encode_request_message(KMIP *, const RequestMessage *);
int kmip_encode_response_message(KMIP *, const ResponseMessage *);

/*
Decoding Functions
*/

int kmip_decode_int8_be(KMIP *, void *);
int kmip_decode_int32_be(KMIP *, void *);
int kmip_decode_int64_be(KMIP *, void *);
int kmip_decode_integer(KMIP *, enum tag, int32 *);
int kmip_decode_long(KMIP *, enum tag, int64 *);
int kmip_decode_enum(KMIP *, enum tag, void *);
int kmip_decode_bool(KMIP *, enum tag, bool32 *);
int kmip_decode_text_string(KMIP *, enum tag, TextString *);
int kmip_decode_byte_string(KMIP *, enum tag, ByteString *);
int kmip_decode_date_time(KMIP *, enum tag, uint64 *);
int kmip_decode_interval(KMIP *, enum tag, uint32 *);
int kmip_decode_name(KMIP *, Name *);
int kmip_decode_attribute_name(KMIP *, enum attribute_type *);
int kmip_decode_attribute_v1(KMIP *, Attribute *);
int kmip_decode_attribute_v2(KMIP *, Attribute *);
int kmip_decode_attribute(KMIP *, Attribute *);
int kmip_decode_attributes(KMIP *, Attributes *);
int kmip_decode_attributes_2(KMIP *, Attribute **, int *);
int kmip_decode_template_attribute(KMIP *, TemplateAttribute *);
int kmip_decode_protocol_version(KMIP *, ProtocolVersion *);
int kmip_decode_transparent_symmetric_key(KMIP *, TransparentSymmetricKey *);
int kmip_decode_key_material(KMIP *, enum key_format_type, void **);
int kmip_decode_key_value(KMIP *, enum key_format_type, KeyValue *);
int kmip_decode_protection_storage_masks(KMIP *, ProtectionStorageMasks *);
int kmip_decode_cryptographic_parameters(KMIP *, CryptographicParameters *);
int kmip_decode_encryption_key_information(KMIP *, EncryptionKeyInformation *);
int kmip_decode_mac_signature_key_information(KMIP *, MACSignatureKeyInformation *);
int kmip_decode_key_wrapping_data(KMIP *, KeyWrappingData *);
int kmip_decode_key_block(KMIP *, KeyBlock *);
int kmip_decode_symmetric_key(KMIP *, SymmetricKey *);
int kmip_decode_public_key(KMIP *, PublicKey *);
int kmip_decode_private_key(KMIP *, PrivateKey *);
int kmip_decode_key_wrapping_specification(KMIP *, KeyWrappingSpecification *);
int kmip_decode_create_request_payload(KMIP *, CreateRequestPayload *);
int kmip_decode_create_response_payload(KMIP *, CreateResponsePayload *);
int kmip_decode_locate_request_payload(KMIP *, LocateRequestPayload *);
int kmip_decode_locate_response_payload(KMIP *, LocateResponsePayload *);
int kmip_decode_get_request_payload(KMIP *, GetRequestPayload *);
int kmip_decode_get_response_payload(KMIP *, GetResponsePayload *);
int kmip_decode_get_attributes_request_payload(KMIP *, GetAttributesRequestPayload *);
int kmip_decode_get_attributes_response_payload(KMIP *, GetAttributesResponsePayload *);
int kmip_decode_get_attribute_list_request_payload(KMIP *, GetAttributeListRequestPayload *);
int kmip_decode_get_attribute_list_response_payload(KMIP *, GetAttributeListResponsePayload *);
int kmip_decode_destroy_request_payload(KMIP *, DestroyRequestPayload *);
int kmip_decode_destroy_response_payload(KMIP *, DestroyResponsePayload *);
int kmip_decode_request_batch_item(KMIP *, RequestBatchItem *);
int kmip_decode_response_batch_item(KMIP *, ResponseBatchItem *);
int kmip_decode_nonce(KMIP *, Nonce *);
int kmip_decode_username_password_credential(KMIP *, UsernamePasswordCredential *);
int kmip_decode_device_credential(KMIP *, DeviceCredential *);
int kmip_decode_attestation_credential(KMIP *, AttestationCredential *);
int kmip_decode_credential_value(KMIP *, enum credential_type, void **);
int kmip_decode_credential(KMIP *, Credential *);
int kmip_decode_authentication(KMIP *, Authentication *);
int kmip_decode_request_header(KMIP *, RequestHeader *);
int kmip_decode_response_header(KMIP *, ResponseHeader *);
int kmip_decode_request_message(KMIP *, RequestMessage *);
int kmip_decode_response_message(KMIP *, ResponseMessage *);

#endif  /* KMIP_H */