Virgil Security Crypto library  1.8.2
Static Public Member Functions | List of all members
virgil::crypto::VirgilByteArrayUtils Class Reference

This class contains conversion utils for byte sequence. More...

#include <VirgilByteArrayUtils.h>

Static Public Member Functions

static VirgilByteArray jsonToBytes (const std::string &json)
 Represents given JSON object as byte array in canonical form. More...
 
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.
 
static VirgilByteArray hexToBytes (const std::string &hexStr)
 Translate given HEX string to the byte array. More...
 
static std::string bytesToHex (const VirgilByteArray &array, bool formatted=false)
 Translate given byte array to the HEX string. More...
 
static void zeroize (VirgilByteArray &array)
 Make all bytes zero. More...
 

Detailed Description

This class contains conversion utils for byte sequence.

Member Function Documentation

static std::string virgil::crypto::VirgilByteArrayUtils::bytesToHex ( const VirgilByteArray &  array,
bool  formatted = false 
)
static

Translate given byte array to the HEX string.

Parameters
array- byte array.
formatted- if true, endline will be inserted every 16 bytes, and all bytes will be separated with whitespaces.
Returns
HEX string.
static VirgilByteArray virgil::crypto::VirgilByteArrayUtils::hexToBytes ( const std::string &  hexStr)
static

Translate given HEX string to the byte array.

Parameters
hexStr- HEX string.
Returns
Byte array.
static VirgilByteArray virgil::crypto::VirgilByteArrayUtils::jsonToBytes ( const std::string &  json)
static

Represents given JSON object as byte array in canonical form.

Note
Conversion it to canonical form, ensure the same digest of JSON object, that can be differently formatted.
This method SHOULD be used before sign of JSON data object.
Underlying canonical representation is ASN.1, but it can be changed in future.
static void virgil::crypto::VirgilByteArrayUtils::zeroize ( VirgilByteArray &  array)
static

Make all bytes zero.

This method SHOULD be used to securely delete sensitive data.


The documentation for this class was generated from the following file: