Virtru SDK for C++  2.8.0
Virtru C++ SDK library - Create, Read, and Manage TDF3 Files
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
tdf_constants.h
Go to the documentation of this file.
1 /*
2 * Copyright 2019 Virtru Corporation
3 *
4 * SPDX - License Identifier: BSD-3-Clause-Clear
5 *
6 */
7 //
8 // TDF SDK
9 //
10 // Created by Sujan Reddy on 2019/03/25.
11 //
12 
13 #ifndef VIRTRU_CONSTANTS_H
14 #define VIRTRU_CONSTANTS_H
15 
16 #include <string_view>
17 #include <functional>
18 namespace virtru {
19 
20 #ifdef SWIG_JAVA
21  typedef int8_t VBYTE;
22 #else
23  typedef uint8_t VBYTE;
24 #endif
25 
26  enum class KeyType {
27  split
28  };
29 
30  enum class CipherType {
31  Aes256GCM
32  ,Aes265CBC
33  };
34 
35  enum class IntegrityAlgorithm {
36  HS256
37  ,GMAC
38  };
39 
40  enum class KeyAccessType {
41  Remote
42  ,Wrapped
43  };
44 
45  enum class Protocol {
46  Zip
47  ,Html
48  ,Xml
49  };
50 
52  enum class LogLevel {
53  Trace
54  ,Debug
55  ,Info
56  ,Warn
57  ,Error
58  ,Fatal
59  ,Current
60  };
61 
62  enum class Status {
63  Success
64  ,Failure
65  };
66 
67  struct BufferSpan{
68  const std::uint8_t* data;
69  std::size_t dataLength;
70  };
71 
72  using TDFDataSourceCb = std::function < BufferSpan(Status &) >;
73  using TDFDataSinkCb = std::function < Status(BufferSpan)>;
74 
75  enum class EllipticCurve : std::uint8_t {
76  SECP256R1 = 0x00,
77  SECP384R1 = 0x01,
78  SECP521R1 = 0x02,
79  SECP256K1 = 0x03
80  };
81 
82  enum class NanoTDFPolicyType : std::uint8_t {
83  REMOTE_POLICY = 0x00,
87  };
88 
89  enum class NanoTDFCipher : std::uint8_t {
90  AES_256_GCM_64_TAG = 0x00,
91  AES_256_GCM_96_TAG = 0x01,
92  AES_256_GCM_104_TAG = 0x02,
93  AES_256_GCM_112_TAG = 0x03,
94  AES_256_GCM_120_TAG = 0x04,
95  AES_256_GCM_128_TAG = 0x05,
97  };
98 
99  // Total unique IVs(2^24 -1) used for encrypting the nano tdf payloads
100  // IV starts from 1 since the 0 IV is reserved for policy encryption
101  const uint32_t kNTDFMaxKeyIterations = 8388606;
102 
103 } // namespace virtru
104 
105 #endif //VIRTRU_CONSTANTS_H
NanoTDFPolicyType
Definition: tdf_constants.h:82
std::function< BufferSpan(Status &) > TDFDataSourceCb
Definition: tdf_constants.h:72
NanoTDFCipher
Definition: tdf_constants.h:89
LogLevel
Defines a log level.
Definition: tdf_constants.h:52
Most detailed output.
The key is embedded in the TDF.
IntegrityAlgorithm
Definition: tdf_constants.h:35
KeyAccessType
Definition: tdf_constants.h:40
Operation did not complete successfully.
TDF format is zip.
const uint32_t kNTDFMaxKeyIterations
Definition: tdf_constants.h:101
KeyType
Definition: tdf_constants.h:26
uint8_t VBYTE
Definition: tdf_constants.h:23
Least detailed output.
Status
Definition: tdf_constants.h:62
Definition: tdf_constants.h:67
CipherType
Definition: tdf_constants.h:30
std::function< Status(BufferSpan)> TDFDataSinkCb
Definition: tdf_constants.h:73
std::size_t dataLength
Definition: tdf_constants.h:69
Operation completed successfully.
Protocol
Definition: tdf_constants.h:45
Default format is HTML.
no-op, value indicates current level should be retained
const std::uint8_t * data
Definition: tdf_constants.h:68
EllipticCurve
Definition: tdf_constants.h:75