Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
cryptoutil.h File Reference
#include <QByteArray>
#include <QString>
#include <QtGlobal>
Include dependency graph for cryptoutil.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  CryptoUtil

Functions

QByteArray CryptoUtil::randomBytes (int count)
quint64 CryptoUtil::randomUInt64 ()
QString CryptoUtil::encryptSecret (const QByteArray &plaintext, const QByteArray &key, const QByteArray &aad={})
 Seal a secret with AES-256-GCM as "enc1:<b64 nonce>:<b64 ciphertext+tag>". Returns an empty string unless key is a valid 32-byte key and the cipher completes. aad is authenticated but not stored (bind the ciphertext to its context, e.g. the user name it belongs to).
QByteArray CryptoUtil::decryptSecret (const QString &sealed, const QByteArray &key, const QByteArray &aad={})
 Open a string produced by encryptSecret(). Returns an empty array on any failure: unknown format, malformed base64, wrong key, wrong aad, or tampering.