module XMPP::SCRAM

Overview

Cryptographic and validation primitives shared by SASL1 and SASL2 SCRAM.

Defined in:

xmpp/scram.cr

Constant Summary

MAX_ITERATIONS = 1000000
MIN_ITERATIONS = 4096

Class Method Summary

Class Method Detail

def self.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 #

[View source]
def self.decode_base64!(value : String, label : String) : Bytes #

[View source]
def self.decode_base64_string!(value : String, label : String) : String #

[View source]
def self.nonce(bytes : Int32 = 18) : String #

[View source]
def self.parse_server_first(encoded : String, client_nonce : String, min_iterations : Int32 = MIN_ITERATIONS, max_iterations : Int32 = MAX_ITERATIONS) : ServerFirst #

ameba:disable Metrics/CyclomaticComplexity


[View source]
def self.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.


[View source]
def self.secure_compare(left : Bytes, right : Bytes) : Bool #

[View source]
def self.verify_server_final!(encoded : String, expected_signature : String) : Nil #

[View source]