Sunshine master
Self-hosted game stream host for Moonlight.
crypto::cipher::ecb_t Class Reference

AES-ECB cipher helper used by pairing and stream encryption code. More...

#include <src/crypto.h>

Inheritance diagram for crypto::cipher::ecb_t:
[legend]
Collaboration diagram for crypto::cipher::ecb_t:
[legend]

Public Member Functions

int decrypt (const std::string_view &cipher, std::vector< std::uint8_t > &plaintext)
 Decrypt ciphertext into the supplied plaintext buffer.
 
 ecb_t (const aes_t &key, bool padding=true)
 Construct an AES-ECB cipher helper with key material.
 
 ecb_t (ecb_t &&) noexcept=default
 Construct an AES-ECB cipher helper with key material.
 
int encrypt (const std::string_view &plaintext, std::vector< std::uint8_t > &cipher)
 Encrypt plaintext into the supplied ciphertext buffer.
 
ecb_toperator= (ecb_t &&) noexcept=default
 Assign state from another instance while preserving ownership semantics.
 

Additional Inherited Members

- Public Attributes inherited from crypto::cipher::cipher_t
cipher_ctx_t decrypt_ctx
 Decrypt ctx.
 
cipher_ctx_t encrypt_ctx
 Encrypt ctx.
 
aes_t key
 AES key used by the cipher context.
 
bool padding
 Enables block padding for the cipher.
 

Detailed Description

AES-ECB cipher helper used by pairing and stream encryption code.

Constructor & Destructor Documentation

◆ ecb_t()

crypto::cipher::ecb_t::ecb_t ( const aes_t & key,
bool padding = true )

Construct an AES-ECB cipher helper with key material.

Parameters
keyAES key material used to initialize the cipher.
paddingWhether the cipher should use block padding.

Member Function Documentation

◆ decrypt()

int crypto::cipher::ecb_t::decrypt ( const std::string_view & cipher,
std::vector< std::uint8_t > & plaintext )

Decrypt ciphertext into the supplied plaintext buffer.

Parameters
cipherCiphertext bytes to decrypt or output buffer for encryption.
plaintextPlaintext bytes to encrypt.
Returns
Number of bytes written, signature bytes, or an error status depending on the overload.

◆ encrypt()

int crypto::cipher::ecb_t::encrypt ( const std::string_view & plaintext,
std::vector< std::uint8_t > & cipher )

Encrypt plaintext into the supplied ciphertext buffer.

Parameters
plaintextPlaintext bytes to encrypt.
cipherCiphertext bytes to decrypt or output buffer for encryption.
Returns
Number of bytes written, signature bytes, or an error status depending on the overload.

◆ operator=()

ecb_t & crypto::cipher::ecb_t::operator= ( ecb_t && )
defaultnoexcept

Assign state from another instance while preserving ownership semantics.

Returns
Reference or value produced by the operator.

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