FreeRDP
ncrypt.c File Reference
#include <winpr/assert.h>
#include <winpr/ncrypt.h>
#include <winpr/print.h>
#include "../log.h"
#include "ncrypt.h"

Macros

#define TAG   WINPR_TAG("ncrypt")
 
#define NTE_CASE(S)
 

Functions

SECURITY_STATUS checkNCryptHandle (NCRYPT_HANDLE handle, NCryptHandleType matchType)
 
void * ncrypt_new_handle (NCryptHandleType kind, size_t len, NCryptGetPropertyFn getProp, NCryptReleaseFn dtor)
 
SECURITY_STATUS winpr_NCryptDefault_dtor (NCRYPT_HANDLE handle)
 
SECURITY_STATUS NCryptEnumStorageProviders (DWORD *wProviderCount, NCryptProviderName **ppProviderList, DWORD dwFlags)
 
SECURITY_STATUS NCryptOpenStorageProvider (NCRYPT_PROV_HANDLE *phProvider, LPCWSTR pszProviderName, DWORD dwFlags)
 
SECURITY_STATUS winpr_NCryptOpenStorageProviderEx (NCRYPT_PROV_HANDLE *phProvider, LPCWSTR pszProviderName, DWORD dwFlags, LPCSTR *modulePaths)
 
SECURITY_STATUS NCryptEnumKeys (NCRYPT_PROV_HANDLE hProvider, LPCWSTR pszScope, NCryptKeyName **ppKeyName, PVOID *ppEnumState, DWORD dwFlags)
 
SECURITY_STATUS NCryptOpenKey (NCRYPT_PROV_HANDLE hProvider, NCRYPT_KEY_HANDLE *phKey, LPCWSTR pszKeyName, DWORD dwLegacyKeySpec, DWORD dwFlags)
 
static NCryptKeyGetPropertyEnum propertyStringToEnum (LPCWSTR pszProperty)
 
SECURITY_STATUS NCryptGetProperty (NCRYPT_HANDLE hObject, LPCWSTR pszProperty, PBYTE pbOutput, DWORD cbOutput, DWORD *pcbResult, DWORD dwFlags)
 
SECURITY_STATUS NCryptFreeObject (NCRYPT_HANDLE hObject)
 
SECURITY_STATUS NCryptFreeBuffer (PVOID pvInput)
 
const char * winpr_NCryptSecurityStatusError (SECURITY_STATUS status)
 
const char * winpr_NCryptGetModulePath (NCRYPT_PROV_HANDLE phProvider)
 

Variables

static const char NCRYPT_MAGIC [6] = { 'N', 'C', 'R', 'Y', 'P', 'T' }
 

Macro Definition Documentation

◆ NTE_CASE

#define NTE_CASE (   S)
Value:
case (SECURITY_STATUS)S: \
return #S
LONG SECURITY_STATUS
Definition: include/winpr/ncrypt.h:32

◆ TAG

#define TAG   WINPR_TAG("ncrypt")

WinPR: Windows Portable Runtime NCrypt library

Copyright 2021 David Fort conta.nosp@m.ct@h.nosp@m.arden.nosp@m.ing-.nosp@m.consu.nosp@m.ltin.nosp@m.g.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ checkNCryptHandle()

SECURITY_STATUS checkNCryptHandle ( NCRYPT_HANDLE  handle,
NCryptHandleType  matchType 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncrypt_new_handle()

void* ncrypt_new_handle ( NCryptHandleType  kind,
size_t  len,
NCryptGetPropertyFn  getProp,
NCryptReleaseFn  dtor 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCryptEnumKeys()

SECURITY_STATUS NCryptEnumKeys ( NCRYPT_PROV_HANDLE  hProvider,
LPCWSTR  pszScope,
NCryptKeyName **  ppKeyName,
PVOID *  ppEnumState,
DWORD  dwFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCryptEnumStorageProviders()

SECURITY_STATUS NCryptEnumStorageProviders ( DWORD *  wProviderCount,
NCryptProviderName **  ppProviderList,
DWORD  dwFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCryptFreeBuffer()

SECURITY_STATUS NCryptFreeBuffer ( PVOID  pvInput)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCryptFreeObject()

SECURITY_STATUS NCryptFreeObject ( NCRYPT_HANDLE  hObject)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCryptGetProperty()

SECURITY_STATUS NCryptGetProperty ( NCRYPT_HANDLE  hObject,
LPCWSTR  pszProperty,
PBYTE  pbOutput,
DWORD  cbOutput,
DWORD *  pcbResult,
DWORD  dwFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCryptOpenKey()

SECURITY_STATUS NCryptOpenKey ( NCRYPT_PROV_HANDLE  hProvider,
NCRYPT_KEY_HANDLE phKey,
LPCWSTR  pszKeyName,
DWORD  dwLegacyKeySpec,
DWORD  dwFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NCryptOpenStorageProvider()

SECURITY_STATUS NCryptOpenStorageProvider ( NCRYPT_PROV_HANDLE phProvider,
LPCWSTR  pszProviderName,
DWORD  dwFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propertyStringToEnum()

static NCryptKeyGetPropertyEnum propertyStringToEnum ( LPCWSTR  pszProperty)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_NCryptDefault_dtor()

SECURITY_STATUS winpr_NCryptDefault_dtor ( NCRYPT_HANDLE  handle)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_NCryptGetModulePath()

const char* winpr_NCryptGetModulePath ( NCRYPT_PROV_HANDLE  phProvider)

Gives a module path of provider handle

Parameters
phProvider[in] provider handle
Returns
module path
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_NCryptOpenStorageProviderEx()

SECURITY_STATUS winpr_NCryptOpenStorageProviderEx ( NCRYPT_PROV_HANDLE phProvider,
LPCWSTR  pszProviderName,
DWORD  dwFlags,
LPCSTR *  modulePaths 
)

custom NCryptOpenStorageProvider that allows to provide a list of modules to load

Parameters
phProvider[out] resulting provider handle
dwFlags[in] the flags to use
modulePaths[in] an array of library path to try to load ended with a NULL string
Returns
ERROR_SUCCESS or an NTE error code something failed
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_NCryptSecurityStatusError()

const char* winpr_NCryptSecurityStatusError ( SECURITY_STATUS  status)

Gives a string representation of a SECURITY_STATUS

Parameters
status[in] SECURITY_STATUS that we want as string
Returns
the string representation of status
Here is the caller graph for this function:

Variable Documentation

◆ NCRYPT_MAGIC

const char NCRYPT_MAGIC[6] = { 'N', 'C', 'R', 'Y', 'P', 'T' }
static