libQuotient
A Qt library for building matrix clients
cryptoutils.h File Reference
#include "e2ee_common.h"
#include "../expected.h"
#include "../quotient_export.h"
#include <QtCore/QByteArray>
#include <QtCore/QString>
Include dependency graph for cryptoutils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Quotient::HkdfKeys
 
struct  Quotient::Curve25519Encrypted
 

Namespaces

 Quotient
 

Typedefs

using Quotient::SslErrorCode = unsigned long
 
template<size_t Size = DefaultPbkdf2KeyLength>
using Quotient::key_material_t = std::array< byte_t, Size >
 
using Quotient::key_view_t = byte_view_t< DefaultPbkdf2KeyLength >
 
template<typename T >
using Quotient::SslExpected = Expected< T, SslErrorCode >
 Same as QOlmExpected but for wrapping OpenSSL instead of Olm calls. More...
 

Enumerations

enum  Quotient::SslErrorCodes : SslErrorCode { Quotient::SslErrorUserOffset = 128 , Quotient::WrongDerivedKeyLength = SslErrorUserOffset + 1 , Quotient::SslPayloadTooLong = SslErrorUserOffset + 2 }
 

Functions

QByteArray Quotient::zeroedByteArray (QByteArray::size_type n=32)
 
template<size_t N, typename T = uint8_t>
consteval std::array< T, N > Quotient::zeroes ()
 
template<size_t Size = DefaultPbkdf2KeyLength>
QUOTIENT_API SslExpected< key_material_t< Size > > Quotient::pbkdf2HmacSha512 (const QByteArray &passphrase, const QByteArray &salt, int iterations)
 Generate a key out of the given passphrase. More...
 
QUOTIENT_API SslExpected< HkdfKeys > Quotient::hkdfSha256 (key_view_t key, byte_view_t< 32 > salt, byte_view_t<> info)
 Derive a key from the input data using HKDF-SHA256. More...
 
QUOTIENT_API SslExpected< QByteArray > Quotient::hmacSha256 (byte_view_t< HmacKeySize > hmacKey, const QByteArray &data)
 Calculate a MAC from the given key and data. More...
 
QUOTIENT_API QOlmExpected< QByteArray > Quotient::curve25519AesSha2Decrypt (QByteArray ciphertext, const QByteArray &privateKey, const QByteArray &ephemeral, const QByteArray &mac)
 Decrypt the data using Curve25519-AES-Sha256. More...
 
QUOTIENT_API QOlmExpected< Curve25519Encrypted > Quotient::curve25519AesSha2Encrypt (const QByteArray &plaintext, const QByteArray &publicKey)
 Encrypt the data using Curve25519-AES-Sha256. More...
 
QUOTIENT_API SslExpected< QByteArray > Quotient::aesCtr256Encrypt (const QByteArray &plaintext, byte_view_t< Aes256KeySize > key, byte_view_t< AesBlockSize > iv)
 Encrypt data using AES-CTR-256. More...
 
QUOTIENT_API SslExpected< QByteArray > Quotient::aesCtr256Decrypt (const QByteArray &ciphertext, byte_view_t< Aes256KeySize > key, byte_view_t< AesBlockSize > iv)
 Decrypt data using AES-CTR-256. More...
 
QUOTIENT_API std::vector< byte_t > Quotient::base58Decode (const QByteArray &encoded)
 
QUOTIENT_API QByteArray Quotient::sign (const QByteArray &key, const QByteArray &data)
 

Variables

constexpr auto Quotient::DefaultPbkdf2KeyLength = 32u
 
constexpr auto Quotient::Aes256KeySize = 32u
 
constexpr auto Quotient::AesBlockSize = 16u
 
constexpr auto Quotient::HmacKeySize = 32u