CppSecurity
1.1.2.0
C++ Security Library
Loading...
Searching...
No Matches
include
security
password.h
Go to the documentation of this file.
1
9
#ifndef CPPSECURITY_STRING_PASSWORD_H
10
#define CPPSECURITY_STRING_PASSWORD_H
11
12
#include "memory/memory.h"
13
14
#include <string>
15
16
namespace
CppSecurity
{
17
19
template
<
class
T>
20
class
PasswordAllocator
:
public
std::allocator<T>
21
{
22
public
:
23
typedef
typename
std::allocator<T>::value_type
value_type
;
24
typedef
typename
std::allocator<T>::size_type
size_type
;
25
typedef
typename
std::allocator<T>::difference_type
difference_type
;
26
27
template
<
class
U>
struct
rebind
{
typedef
PasswordAllocator<U>
other
; };
28
29
PasswordAllocator
() throw() {}
30
PasswordAllocator
(
const
PasswordAllocator
&)
throw
() {}
31
template
<
class
U>
PasswordAllocator
(
const
PasswordAllocator<U>
&)
throw
() {}
32
33
void
deallocate
(T* p,
size_type
n)
34
{
35
CppCommon::Memory::ZeroFill(p, n *
sizeof
(T));
36
std::allocator<T>::deallocate(p, n);
37
}
38
};
39
40
}
// namespace CppSecurity
41
42
namespace
std
{
43
45
52
class
password
:
public
std::basic_string<char, std::char_traits<char>, CppSecurity::PasswordAllocator<char>>
53
{
54
public
:
55
using
basic_string::basic_string;
56
~password
() {
clear
(); }
57
void
clear
() noexcept { CppCommon::Memory::ZeroFill(data(), size()); }
58
};
59
60
}
// namespace std
61
62
#endif
// CPPSECURITY_STRING_PASSWORD_H
CppSecurity::PasswordAllocator
Password allocator.
Definition
password.h:21
CppSecurity::PasswordAllocator::PasswordAllocator
PasswordAllocator()
Definition
password.h:29
CppSecurity::PasswordAllocator::PasswordAllocator
PasswordAllocator(const PasswordAllocator< U > &)
Definition
password.h:31
CppSecurity::PasswordAllocator::size_type
std::allocator< T >::size_type size_type
Definition
password.h:24
CppSecurity::PasswordAllocator::value_type
std::allocator< T >::value_type value_type
Definition
password.h:23
CppSecurity::PasswordAllocator::PasswordAllocator
PasswordAllocator(const PasswordAllocator &)
Definition
password.h:30
CppSecurity::PasswordAllocator::difference_type
std::allocator< T >::difference_type difference_type
Definition
password.h:25
CppSecurity::PasswordAllocator::deallocate
void deallocate(T *p, size_type n)
Definition
password.h:33
std::password
Password string.
Definition
password.h:53
std::password::~password
~password()
Definition
password.h:56
std::password::clear
void clear() noexcept
Definition
password.h:57
CppSecurity
Definition
cipher.h:18
std
Definition
password.h:42
CppSecurity::PasswordAllocator::rebind
Definition
password.h:27
CppSecurity::PasswordAllocator::rebind::other
PasswordAllocator< U > other
Definition
password.h:27
Generated by
1.9.8