lacteApp
C++17 service for Lacte hardware
Loading...
Searching...
No Matches
lacte::vnc::des Namespace Reference

Namespaces

namespace  detail

Functions

auto encrypt_block (const std::uint64_t plaintext, const std::uint64_t key64) -> std::uint64_t
 Encrypts one 64-bit block with one 64-bit DES key (parity bits included but unchecked - PC1 drops them exactly as the algorithm always does).
auto bytes_to_u64 (const std::array< std::uint8_t, 8 > &bytes) -> std::uint64_t
auto u64_to_bytes (const std::uint64_t value) -> std::array< std::uint8_t, 8 >
auto vnc_encrypt_challenge (const std::array< std::uint8_t, 16 > &challenge, const std::string &password) -> std::array< std::uint8_t, 16 >
 RFB's classic "VNC Authentication" (security type 2) challenge response: the connection password becomes an 8-byte DES key (truncated to 8 bytes / zero-padded if shorter - a real, well-known VNC password length limit, not a bug), with each key BYTE's bits reversed before use.

Function Documentation

◆ bytes_to_u64()

auto lacte::vnc::des::bytes_to_u64 ( const std::array< std::uint8_t, 8 > & bytes) -> std::uint64_t
inline

Definition at line 190 of file Des.hpp.

Here is the caller graph for this function:

◆ encrypt_block()

auto lacte::vnc::des::encrypt_block ( const std::uint64_t plaintext,
const std::uint64_t key64 ) -> std::uint64_t
inlinenodiscard

Encrypts one 64-bit block with one 64-bit DES key (parity bits included but unchecked - PC1 drops them exactly as the algorithm always does).

Verified against the classic FIPS PUB 46 worked example in des_test.cpp; do not "simplify" the bit numbering here without re-checking against that vector - DES's MSB-first, 1-indexed table convention is easy to get silently backwards.

Definition at line 169 of file Des.hpp.

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

◆ u64_to_bytes()

auto lacte::vnc::des::u64_to_bytes ( const std::uint64_t value) -> std::array< std::uint8_t, 8 >
inline

Definition at line 199 of file Des.hpp.

Here is the caller graph for this function:

◆ vnc_encrypt_challenge()

auto lacte::vnc::des::vnc_encrypt_challenge ( const std::array< std::uint8_t, 16 > & challenge,
const std::string & password ) -> std::array< std::uint8_t, 16 >
inlinenodiscard

RFB's classic "VNC Authentication" (security type 2) challenge response: the connection password becomes an 8-byte DES key (truncated to 8 bytes / zero-padded if shorter - a real, well-known VNC password length limit, not a bug), with each key BYTE's bits reversed before use.

  • a historical quirk of the original AT&T/Olivetti VNC implementation that every RFB-compliant client and server has replicated ever since (see e.g. TigerVNC's/RealVNC's own d3des.c). The 16-byte challenge is then encrypted as two INDEPENDENT 8-byte ECB blocks (no chaining between them) with that key.

Definition at line 228 of file Des.hpp.

Here is the call graph for this function: