Virgil Security Crypto library  2.6.3
Namespaces | Classes | Typedefs | Enumerations | Functions
virgil::crypto Namespace Reference

This namespace contains interfaces for high-level crypto operations, i.e. generate key pair, encrypt and decrypt data, sign and verify data. More...

Namespaces

 foundation
 This namespace contains interfaces for low-level crypto operations.
 
 pfs
 This namespace contains interfaces for Perfect Forward Secrecy data and algorithm.
 
 stream
 This namespace contains interfaces for stream data processing in crypto algorithms.
 

Classes

class  VirgilByteArrayUtils
 This class contains conversion utils for byte sequence. More...
 
class  VirgilChunkCipher
 This class provides high-level interface to encrypt / decrypt data splitted to chunks. More...
 
class  VirgilCipher
 This class provides high-level interface to encrypt / decrypt data using Virgil Security keys. More...
 
class  VirgilCipherBase
 This class provides configuration methods to all Virgil*Cipher classes. More...
 
class  VirgilContentInfo
 
class  VirgilCryptoErrorCategory
 This is specific error category that contains information about crypto library errors. More...
 
class  VirgilCryptoException
 This only exception that crypto library can produce. More...
 
class  VirgilCustomParams
 Data object that represent ASN.1 structure: VirgilCustomParams. More...
 
class  VirgilDataSink
 This is base class for output streams. More...
 
class  VirgilDataSource
 This is base class for input streams. More...
 
class  VirgilKeyPair
 This class handles information about Virgil Security key pair. More...
 
class  VirgilSeqCipher
 This class provides high-level interface to sequenctially encrypt / decrypt data using Virgil Security keys. More...
 
class  VirgilSeqSigner
 This class provides high-level interface to sign and verify data using Virgil Security keys. More...
 
class  VirgilSigner
 This class provides high-level interface to sign and verify data using Virgil Security keys. More...
 
class  VirgilSignerBase
 This class provides common functionality to sign and verify data using Virgil Security keys. More...
 
class  VirgilStreamCipher
 This class provides high-level interface to encrypt / decrypt streaming data using Virgil Security keys. More...
 
class  VirgilStreamSigner
 This class provides high-level interface to sign and verify data using Virgil Security keys. More...
 
class  VirgilTinyCipher
 This class aim is to minimize encryption output. More...
 
class  VirgilVersion
 Provides information about Virgil library version. More...
 

Typedefs

typedef std::vector< unsigned char > VirgilByteArray
 This type represents a sequence of bytes.
 

Enumerations

enum  VirgilCryptoError {
  VirgilCryptoError::Reserved = 0, VirgilCryptoError::EmptyParameter, VirgilCryptoError::ExceededMaxSize, VirgilCryptoError::InvalidArgument,
  VirgilCryptoError::InvalidFormat, VirgilCryptoError::InvalidPrivateKey, VirgilCryptoError::InvalidPrivateKeyPassword, VirgilCryptoError::InvalidPublicKey,
  VirgilCryptoError::InvalidSignature, VirgilCryptoError::InvalidState, VirgilCryptoError::InvalidAuth, VirgilCryptoError::MismatchSignature,
  VirgilCryptoError::NotFoundKeyRecipient, VirgilCryptoError::NotFoundPasswordRecipient, VirgilCryptoError::NotInitialized, VirgilCryptoError::NotSecure,
  VirgilCryptoError::UnsupportedAlgorithm, Undefined = std::numeric_limits<int>::max()
}
 Specific error codes for the crypto library. More...
 

Functions

VirgilByteArray str2bytes (const std::string &str)
 Represents given string as byte array.
 
std::string bytes2str (const VirgilByteArray &array)
 Represent given byte array as string.
 
VirgilByteArray hex2bytes (const std::string hexStr)
 Translate given HEX string to the byte array. More...
 
std::string bytes2hex (const VirgilByteArray &array, bool formatted=false)
 Translate given byte array to the HEX string. More...
 
VirgilByteArraybytes_append (VirgilByteArray &dst, const VirgilByteArray &src)
 Append given source bytes to the existing destination bytes. More...
 
std::tuple< VirgilByteArray, VirgilByteArraybytes_split (const VirgilByteArray &src, size_t pos)
 Split given bytes to two sequences. More...
 
std::tuple< VirgilByteArray, VirgilByteArraybytes_split_half (const VirgilByteArray &src)
 Split given bytes to two sequences of the same size. More...
 
std::vector< VirgilByteArraybytes_split_chunks (const VirgilByteArray &src, size_t chunkSize)
 Split given bytes to the chuns of the given size. More...
 
const VirgilCryptoErrorCategorycrypto_category () noexcept
 Return singleton instance of the crypto error category. More...
 
VirgilCryptoException make_error (VirgilCryptoError ev)
 Build exception with given error value and corresond error category. More...
 
VirgilCryptoException make_error (VirgilCryptoError ev, const std::string &what)
 Build exception with given error value and corresond error category. More...
 
VirgilCryptoException make_error (VirgilCryptoError ev, const char *what)
 Build exception with given error value and corresond error category. More...
 
std::string backtrace_exception (const std::exception &exception, size_t level=0)
 Unwind information about nested excpetions. More...
 
ByteArray security clear utilities
void bytes_zeroize (VirgilByteArray &array)
 Make all bytes zero.
 
void string_zeroize (std::string &str)
 Make all chars zero.
 

Detailed Description

This namespace contains interfaces for high-level crypto operations, i.e. generate key pair, encrypt and decrypt data, sign and verify data.

Function Documentation

std::string virgil::crypto::backtrace_exception ( const std::exception &  exception,
size_t  level = 0 
)

Unwind information about nested excpetions.

Parameters
exception- Top level exception.
level- initial identation level.
Returns
Formatted message of top level exception and all nested exceptions.
std::string virgil::crypto::bytes2hex ( const VirgilByteArray array,
bool  formatted = false 
)

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.
VirgilByteArray& virgil::crypto::bytes_append ( VirgilByteArray dst,
const VirgilByteArray src 
)

Append given source bytes to the existing destination bytes.

Parameters
dst- bytes append to.
src- bytes append from.
Returns
Reference to destination (dst).
std::tuple<VirgilByteArray, VirgilByteArray> virgil::crypto::bytes_split ( const VirgilByteArray src,
size_t  pos 
)

Split given bytes to two sequences.

Parameters
src- bytes to be splitted.
pos- splitting position.
Returns
Two sequences: src[0, pos), src[pos, src.size()).
std::vector<VirgilByteArray> virgil::crypto::bytes_split_chunks ( const VirgilByteArray src,
size_t  chunkSize 
)

Split given bytes to the chuns of the given size.

Parameters
src- bytes to be splitted.
chunkSize- size of the chunk.
Returns
Chunks, each of the chunkSize.
std::tuple<VirgilByteArray, VirgilByteArray> virgil::crypto::bytes_split_half ( const VirgilByteArray src)

Split given bytes to two sequences of the same size.

Parameters
src- bytes to be splitted.
Returns
Two sequences: src[0, src.size()/2), src[src.size()/2, src.size()).
VirgilByteArray virgil::crypto::hex2bytes ( const std::string  hexStr)

Translate given HEX string to the byte array.

Parameters
hexStr- HEX string.
Returns
Byte array.