CppSecurity 1.0.6.0
C++ Security Library
Loading...
Searching...
No Matches
CppSecurity::PasswordGenerator Class Reference

Password generator. More...

#include <password_generator.h>

Public Member Functions

 PasswordGenerator (size_t length=12, PasswordFlags flags=PasswordFlags::lower|PasswordFlags::upper|PasswordFlags::digits)
 Initialize password generator with required parameters.
 PasswordGenerator (const PasswordGenerator &)=default
 PasswordGenerator (PasswordGenerator &&)=default
virtual ~PasswordGenerator ()=default
PasswordGeneratoroperator= (const PasswordGenerator &)=default
PasswordGeneratoroperator= (PasswordGenerator &&)=default
size_t length () const noexcept
 Get the password length.
PasswordFlags flags () const noexcept
 Get the password flags.
virtual std::password Generate () const
 Generate the strong password with the current password requirements.
virtual bool Validate (std::string_view password) const
 Validate the given password with the current password requirements.

Detailed Description

Password generator.

Password generator allows to generate and validate secure passwords for other security components.

Thread-safe.

Examples
password_generator.cpp.

Definition at line 51 of file password_generator.h.

Constructor & Destructor Documentation

◆ PasswordGenerator() [1/3]

CppSecurity::PasswordGenerator::PasswordGenerator ( size_t length = 12,
PasswordFlags flags = PasswordFlags::lower | PasswordFlags::upper | PasswordFlags::digits )

Initialize password generator with required parameters.

Parameters
length- Password length (default is 12)
flags- Password flags (default is lower | upper | digits)

Definition at line 19 of file password_generator.cpp.

◆ PasswordGenerator() [2/3]

CppSecurity::PasswordGenerator::PasswordGenerator ( const PasswordGenerator & )
default

◆ PasswordGenerator() [3/3]

CppSecurity::PasswordGenerator::PasswordGenerator ( PasswordGenerator && )
default

◆ ~PasswordGenerator()

virtual CppSecurity::PasswordGenerator::~PasswordGenerator ( )
virtualdefault

Member Function Documentation

◆ flags()

PasswordFlags CppSecurity::PasswordGenerator::flags ( ) const
inlinenoexcept

Get the password flags.

Examples
password_generator.cpp.

Definition at line 70 of file password_generator.h.

◆ Generate()

std::password CppSecurity::PasswordGenerator::Generate ( ) const
virtual

Generate the strong password with the current password requirements.

Returns
Strong password
Examples
password_generator.cpp.

Definition at line 27 of file password_generator.cpp.

◆ length()

size_t CppSecurity::PasswordGenerator::length ( ) const
inlinenoexcept

Get the password length.

Definition at line 68 of file password_generator.h.

◆ operator=() [1/2]

PasswordGenerator & CppSecurity::PasswordGenerator::operator= ( const PasswordGenerator & )
default

◆ operator=() [2/2]

PasswordGenerator & CppSecurity::PasswordGenerator::operator= ( PasswordGenerator && )
default

◆ Validate()

bool CppSecurity::PasswordGenerator::Validate ( std::string_view password) const
virtual

Validate the given password with the current password requirements.

Parameters
password- Strong password
Returns
'true' if the given user password is valid, 'false' if the given user password is invalid
Examples
password_generator.cpp.

Definition at line 63 of file password_generator.cpp.


The documentation for this class was generated from the following files: