Virgil Security Crypto library  2.1.2
VirgilByteArrayUtils.h
1 
37 #ifndef VIRGIL_CRYPTO_BYTE_ARRAY_UTILS_H
38 #define VIRGIL_CRYPTO_BYTE_ARRAY_UTILS_H
39 
40 #include <string>
41 
42 #include <virgil/crypto/VirgilByteArray.h>
43 
44 namespace virgil { namespace crypto {
45 
50 public:
65  static VirgilByteArray jsonToBytes(const std::string& json);
66 
70  static VirgilByteArray stringToBytes(const std::string& str);
71 
75  static std::string bytesToString(const VirgilByteArray& array);
76 
82  static VirgilByteArray hexToBytes(const std::string& hexStr);
83 
91  static std::string bytesToHex(const VirgilByteArray& array, bool formatted = false);
92 
98  static void zeroize(VirgilByteArray& array);
99 
105  static void append(VirgilByteArray& dst, const VirgilByteArray& src);
106 
110  static VirgilByteArray popBytes(VirgilByteArray& src, size_t num);
111 
112 private:
117 };
118 
119 }}
120 
121 #endif /* VIRGIL_CRYPTO_BYTE_ARRAY_UTILS_H */
static void zeroize(VirgilByteArray &array)
Make all bytes zero.
static VirgilByteArray popBytes(VirgilByteArray &src, size_t num)
Return first num bytes and remove it from the src.
static std::string bytesToHex(const VirgilByteArray &array, bool formatted=false)
Translate given byte array to the HEX string.
static VirgilByteArray jsonToBytes(const std::string &json)
Represents given JSON object as byte array in canonical form.
static void append(VirgilByteArray &dst, const VirgilByteArray &src)
Append given bytes to the existing one.
static VirgilByteArray hexToBytes(const std::string &hexStr)
Translate given HEX string to the byte array.
Root namespace for all Virgil Security libraries.
Definition: VirgilAsn1Compatible.h:46
This class contains conversion utils for byte sequence.
Definition: VirgilByteArrayUtils.h:49
std::vector< unsigned char > VirgilByteArray
This type represents a sequence of bytes.
Definition: VirgilByteArray.h:53
static VirgilByteArray stringToBytes(const std::string &str)
Represents given string as byte array.
static std::string bytesToString(const VirgilByteArray &array)
Represent given byte array as string.