|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Definitions for cryptography functions. More...
Typedefs | |
| using | crypto::asn1_string_t = util::safe_ptr<ASN1_STRING, ASN1_STRING_free> |
| OpenSSL ASN.1 string pointer with automatic release. | |
| using | crypto::x509_name_t = util::safe_ptr<X509_NAME, &X509_NAME_free> |
| OpenSSL X.509 subject/issuer name pointer with automatic release. | |
Functions | |
| aes_t | crypto::gen_aes_key (const std::array< uint8_t, 16 > &salt, const std::string_view &pin) |
| Derive the AES key used by the pairing protocol. | |
| creds_t | crypto::gen_creds (const std::string_view &cn, std::uint32_t key_bits) |
| Generate a self-signed certificate and private key for Sunshine pairing. | |
| sha256_t | crypto::hash (const std::string_view &plaintext) |
| Hashes the given plaintext using SHA-256. | |
| void | crypto::md_ctx_destroy (EVP_MD_CTX *ctx) |
| Destroy an OpenSSL message digest context. | |
| std::string | crypto::pem (pkey_t &pkey) |
| Serialize an OpenSSL object to PEM text. | |
| std::string | crypto::pem (x509_t &x509) |
| Serialize an OpenSSL object to PEM text. | |
| pkey_t | crypto::pkey (const std::string_view &k) |
| Parse PEM text into an OpenSSL private key object. | |
| std::string | crypto::rand (std::size_t bytes) |
| Generate cryptographically secure random bytes. | |
| std::string | crypto::rand_alphabet (std::size_t bytes, const std::string_view &alphabet) |
| Generate random text from the supplied alphabet. | |
| std::vector< uint8_t > | crypto::sign (const pkey_t &pkey, const std::string_view &data, const EVP_MD *md) |
| Sign data with the requested OpenSSL digest. | |
| std::vector< uint8_t > | crypto::sign256 (const pkey_t &pkey, const std::string_view &data) |
| Sign data with SHA-256. | |
| std::string_view | crypto::signature (const x509_t &x) |
| Return the certificate signature bytes. | |
| bool | crypto::verify (const x509_t &x509, const std::string_view &data, const std::string_view &signature, const EVP_MD *md) |
| Verify a signature against certificate public key data. | |
| bool | crypto::verify256 (const x509_t &x509, const std::string_view &data, const std::string_view &signature) |
| Verify a SHA-256 signature with the certificate public key. | |
| x509_t | crypto::x509 (const std::string_view &x) |
| Parse PEM text into an X.509 certificate object. | |
Definitions for cryptography functions.
| aes_t crypto::gen_aes_key | ( | const std::array< uint8_t, 16 > & | salt, |
| const std::string_view & | pin ) |
Derive the AES key used by the pairing protocol.
| salt | Random salt used when deriving the pairing secret. |
| pin | PIN supplied by the client during pairing. |
| creds_t crypto::gen_creds | ( | const std::string_view & | cn, |
| std::uint32_t | key_bits ) |
Generate a self-signed certificate and private key for Sunshine pairing.
| cn | Common name to place in the generated certificate. |
| key_bits | Size in bits of the generated RSA key. |
| sha256_t crypto::hash | ( | const std::string_view & | plaintext | ) |
Hashes the given plaintext using SHA-256.
| plaintext |
| void crypto::md_ctx_destroy | ( | EVP_MD_CTX * | ctx | ) |
Destroy an OpenSSL message digest context.
| ctx | Message digest context. |
| std::string crypto::pem | ( | pkey_t & | pkey | ) |
Serialize an OpenSSL object to PEM text.
| pkey | Private key PEM data or private key file path. |
| std::string crypto::pem | ( | x509_t & | x509 | ) |
Serialize an OpenSSL object to PEM text.
| x509 | X.509 certificate object or PEM data. |
| pkey_t crypto::pkey | ( | const std::string_view & | k | ) |
Parse PEM text into an OpenSSL private key object.
| k | PEM text containing a private key. |
| std::string crypto::rand | ( | std::size_t | bytes | ) |
Generate cryptographically secure random bytes.
| bytes | Number of random bytes to generate. |
| std::string crypto::rand_alphabet | ( | std::size_t | bytes, |
| const std::string_view & | alphabet = std::string_view {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!%&()=-"} ) |
Generate random text from the supplied alphabet.
| bytes | Number of random bytes to generate. |
| alphabet | Allowed characters used for random string generation. |
| std::vector< uint8_t > crypto::sign | ( | const pkey_t & | pkey, |
| const std::string_view & | data, | ||
| const EVP_MD * | md ) |
Sign data with the requested OpenSSL digest.
| pkey | Private key PEM data or private key file path. |
| data | Payload or state data to serialize, deserialize, or forward. |
| md | OpenSSL message digest algorithm used for signing or verification. |
| std::vector< uint8_t > crypto::sign256 | ( | const pkey_t & | pkey, |
| const std::string_view & | data ) |
Sign data with SHA-256.
| pkey | Private key PEM data or private key file path. |
| data | Payload or state data to serialize, deserialize, or forward. |
| std::string_view crypto::signature | ( | const x509_t & | x | ) |
Return the certificate signature bytes.
| x | Certificate object or PEM text, depending on the overload. |
| bool crypto::verify | ( | const x509_t & | x509, |
| const std::string_view & | data, | ||
| const std::string_view & | signature, | ||
| const EVP_MD * | md ) |
Verify a signature against certificate public key data.
| x509 | X.509 certificate object or PEM data. |
| data | Payload or state data to serialize, deserialize, or forward. |
| signature | Signature bytes to verify or encode. |
| md | OpenSSL message digest algorithm used for signing or verification. |
| bool crypto::verify256 | ( | const x509_t & | x509, |
| const std::string_view & | data, | ||
| const std::string_view & | signature ) |
Verify a SHA-256 signature with the certificate public key.
| x509 | X.509 certificate object or PEM data. |
| data | Payload or state data to serialize, deserialize, or forward. |
| signature | Signature bytes to verify or encode. |
| x509_t crypto::x509 | ( | const std::string_view & | x | ) |
Parse PEM text into an X.509 certificate object.
| x | Certificate object or PEM text, depending on the overload. |