module

XMPP::SCRAM

Cryptographic and validation primitives shared by SASL1 and SASL2 SCRAM.

Constants

MAX_ITERATIONS = 1000000
MIN_ITERATIONS = 4096

Class methods

calculate_response(password : String, initial_message : String, server_first_message : String, challenge : Hash(String, String), algorithm : OpenSSL::Algorithm, gs2_header : String, channel_binding_data : Bytes | Nil) : Response
Source
decode_base64!(value : String, label : String) : Bytes
Source
decode_base64_string!(value : String, label : String) : String
Source
nonce(bytes : Int32 = 18) : String
Source
parse_server_first(encoded : String, client_nonce : String, min_iterations : Int32 = MIN_ITERATIONS, max_iterations : Int32 = MAX_ITERATIONS) : ServerFirst

ameba:disable Metrics/CyclomaticComplexity

Source
prepare(value : String, label : String) : String

RFC 4013 requires SASLprep for SCRAM strings. NFKC normalization and the prohibited output classes that can be represented by Crystal strings are enforced here. XMPP JID preparation handles the username before this step.

Source
secure_compare(left : Bytes, right : Bytes) : Bool
Source
verify_server_final!(encoded : String, expected_signature : String) : Nil
Source

Nested types