S2OPC OPCUA Toolkit
Macros | Functions
sopc_askpass.h File Reference

A platform independent API to ask for passwords. More...

#include <stdbool.h>

Go to the source code of this file.

Macros

#define SOPC_PASSWORD_MAX_LENGTH   128
 

Functions

bool SOPC_AskPass_FromTerminal (char **outPassword)
 Ask for a password in an interactive and secure way from a console. The prompt is "Password:\n". More...
 
bool SOPC_AskPass_CustomPromptFromTerminal (const char *prompt, char **outPassword)
 Ask for a password in an interactive and secure way from a console. Same as SOPC_AskPass_FromTerminal with a custom prompt. More...
 

Detailed Description

A platform independent API to ask for passwords.

Note
only implemented for Linux and Windows platforms

Macro Definition Documentation

◆ SOPC_PASSWORD_MAX_LENGTH

#define SOPC_PASSWORD_MAX_LENGTH   128

Function Documentation

◆ SOPC_AskPass_FromTerminal()

bool SOPC_AskPass_FromTerminal ( char **  outPassword)

Ask for a password in an interactive and secure way from a console. The prompt is "Password:\n".

Parameters
outPasswordThe newly allocated password, you should free it.
Returns
true in case of success, otherwise false.
Note
stdin is not used (linux)
This function is useful to configure the client/server callback to retrieve the password of the private key. It can be passed directly as input argument to SOPC_ClientConfigHelper_SetClientKeyPasswordCallback, SOPC_ServerConfigHelper_SetKeyPasswordCallback

◆ SOPC_AskPass_CustomPromptFromTerminal()

bool SOPC_AskPass_CustomPromptFromTerminal ( const char *  prompt,
char **  outPassword 
)

Ask for a password in an interactive and secure way from a console. Same as SOPC_AskPass_FromTerminal with a custom prompt.

Parameters
promptThe custom prompt to display waiting for password input
outPasswordThe newly allocated password, you should free it.
Returns
true in case of success, otherwise false.