# WinStd: Credentials API

Credentials API

## Classes

struct | winstd::CredFree_delete< _Ty >
| Deleter for unique_ptr using CredFree. More...
struct | winstd::CredFree_delete< _Ty[]>
| Deleter for unique_ptr to array of unknown size using CredFree. More...

## Functions

template<class _Traits , class _Ax >
static BOOL | CredProtectA (BOOL fAsSelf, LPCSTR pszCredentials, DWORD cchCredentials, std::basic_string< char, _Traits, _Ax > &sProtectedCredentials, CRED_PROTECTION_TYPE *ProtectionType)
| Encrypts the specified credentials so that only the current security context can decrypt them. More...
template<class _Traits , class _Ax >
static BOOL | CredProtectW (BOOL fAsSelf, LPCWSTR pszCredentials, DWORD cchCredentials, std::basic_string< wchar_t, _Traits, _Ax > &sProtectedCredentials, CRED_PROTECTION_TYPE *ProtectionType)
| Encrypts the specified credentials so that only the current security context can decrypt them. More...
template<class _Traits , class _Ax >
static BOOL | CredUnprotectA (BOOL fAsSelf, LPCSTR pszProtectedCredentials, DWORD cchCredentials, std::basic_string< char, _Traits, _Ax > &sCredentials)
| Decrypts credentials that were previously encrypted by using the CredProtect function. More...
template<class _Traits , class _Ax >
static BOOL | CredUnprotectW (BOOL fAsSelf, LPCWSTR pszProtectedCredentials, DWORD cchCredentials, std::basic_string< wchar_t, _Traits, _Ax > &sCredentials)
| Decrypts credentials that were previously encrypted by using the CredProtect function. More...
static BOOL | CredEnumerate (LPCTSTR Filter, DWORD Flags, DWORD *Count, std::unique_ptr< PCREDENTIAL[], winstd::CredFree_delete< PCREDENTIAL[]> > &cCredentials) noexcept
| Enumerates the credentials from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled. More...

## Detailed Description

## Function Documentation

## CredEnumerate()

static BOOL CredEnumerate | ( | LPCTSTR | Filter,
|  | DWORD | Flags,
|  | DWORD * | Count,
|  | std::unique_ptr< PCREDENTIAL[], winstd::CredFree_delete< PCREDENTIAL[]> > & | cCredentials
| ) |  |

staticnoexcept

Enumerates the credentials from the user's credential set. The credential set used is the one associated with the logon session of the current token. The token must not have the user's SID disabled.

See also
  CredEnumerate function

## CredProtectA()

template<class _Traits , class _Ax >

static BOOL CredProtectA | ( | BOOL | fAsSelf,
|  | LPCSTR | pszCredentials,
|  | DWORD | cchCredentials,
|  | std::basic_string< char, _Traits, _Ax > & | sProtectedCredentials,
|  | CRED_PROTECTION_TYPE * | ProtectionType
| ) |  |

static

Encrypts the specified credentials so that only the current security context can decrypt them.

See also
  CredProtect function

## CredProtectW()

template<class _Traits , class _Ax >

static BOOL CredProtectW | ( | BOOL | fAsSelf,
|  | LPCWSTR | pszCredentials,
|  | DWORD | cchCredentials,
|  | std::basic_string< wchar_t, _Traits, _Ax > & | sProtectedCredentials,
|  | CRED_PROTECTION_TYPE * | ProtectionType
| ) |  |

static

Encrypts the specified credentials so that only the current security context can decrypt them.

See also
  CredProtect function

## CredUnprotectA()

template<class _Traits , class _Ax >

static BOOL CredUnprotectA | ( | BOOL | fAsSelf,
|  | LPCSTR | pszProtectedCredentials,
|  | DWORD | cchCredentials,
|  | std::basic_string< char, _Traits, _Ax > & | sCredentials
| ) |  |

static

Decrypts credentials that were previously encrypted by using the CredProtect function.

See also
  CredUnprotect function

## CredUnprotectW()

template<class _Traits , class _Ax >

static BOOL CredUnprotectW | ( | BOOL | fAsSelf,
|  | LPCWSTR | pszProtectedCredentials,
|  | DWORD | cchCredentials,
|  | std::basic_string< wchar_t, _Traits, _Ax > & | sCredentials
| ) |  |

static

Decrypts credentials that were previously encrypted by using the CredProtect function.

See also
  CredUnprotect function