Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
CryptoUtil Namespace Reference

Functions

QByteArray randomBytes (int count)
quint64 randomUInt64 ()
QString 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 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.

Function Documentation

◆ decryptSecret()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ encryptSecret()

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).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomBytes()

QByteArray CryptoUtil::randomBytes ( int count)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ randomUInt64()

quint64 CryptoUtil::randomUInt64 ( )
Here is the call graph for this function:
Here is the caller graph for this function: