🔐 Radikant-SASL-C

Simple Authentication and Security Layer

NVS

Introduction

Radikant SASL is a minimal SASL driver only supporting SCRAM and uses Radikant Crypto as a backend for cryptographic operations. It was created soley to support the Radikant PostgreSQL driver. 

SCRAM Example

FileEditViewProject
SASL-Auth — auth_client.c
int Perform_Authentication()
{
// 1. Create a SASL context
sasl_context_t *ctx = sasl_context_create();
 
// 2. Configure the context
sasl_config_t config = {
.mechanism = SASL_MECH_SCRAM_SHA256,
.role = SASL_ROLE_CLIENT
};
sasl_error_t err = sasl_context_set_config(ctx, &config);
 
// 3. Set credentials
sasl_credentials_t creds = {
.username = "user",
.password = "pencil"
};
 
err = sasl_context_set_credentials(ctx, &creds);
 
// 4. Start the authentication process
sasl_buffer_t client_out = {0};
err = sasl_start(ctx, SASL_MECH_SCRAM_SHA256, NULL, &client_out);
 
return (err == SASL_OK) ? 0 : -1;
}
=== SASL SCRAM-SHA-256 Example === Step 1: Client First Message generated: n,,n=user,r=p/HZKoLI2P5DTZhVjOKzRxcR