curl-fuzzer C++ reference
Loading...
Searching...
No Matches
ws_accept_key.h File Reference

Minimal standalone SHA-1 + base64 for the WebSocket Sec-WebSocket-Accept computation (RFC 6455 §4.2.2). More...

Go to the source code of this file.

Functions

std::array< uint8_t, 20 > proto_fuzzer::detail::Sha1 (const uint8_t *data, std::size_t len)
 Minimal SHA-1 (FIPS 180-4) — not for security use; only for the WS accept key.
std::string proto_fuzzer::detail::Base64Encode (const uint8_t *data, std::size_t len)
 Minimal base64 encoder.
std::string proto_fuzzer::ComputeWebSocketAcceptKey (const std::string &key)
 Compute the RFC 6455 Sec-WebSocket-Accept value for a given client key.

Detailed Description

Minimal standalone SHA-1 + base64 for the WebSocket Sec-WebSocket-Accept computation (RFC 6455 §4.2.2).

This removes the hard OpenSSL dependency from the proto fuzzer — the only crypto it needs is a single SHA-1 hash of a handshake nonce which has no security implications inside a fuzzer.

Definition in file ws_accept_key.h.

Function Documentation

◆ Base64Encode()

std::string proto_fuzzer::detail::Base64Encode ( const uint8_t * data,
std::size_t len )
inline

Minimal base64 encoder.

Parameters
dataPointer to the input bytes to encode.
lenNumber of input bytes.
Returns
Base64-encoded string.

Definition at line 119 of file ws_accept_key.h.

◆ ComputeWebSocketAcceptKey()

std::string proto_fuzzer::ComputeWebSocketAcceptKey ( const std::string & key)
inline

Compute the RFC 6455 Sec-WebSocket-Accept value for a given client key.

Parameters
keyThe client-supplied Sec-WebSocket-Key header value.
Returns
The base64-encoded Sec-WebSocket-Accept string.

Definition at line 140 of file ws_accept_key.h.

◆ Sha1()

std::array< uint8_t, 20 > proto_fuzzer::detail::Sha1 ( const uint8_t * data,
std::size_t len )
inline

Minimal SHA-1 (FIPS 180-4) — not for security use; only for the WS accept key.

Parameters
dataPointer to the input bytes to hash.
lenNumber of input bytes.
Returns
20-byte SHA-1 digest.

Definition at line 29 of file ws_accept_key.h.