Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The NCryptSetProperty function sets the value for a named property for a CNG key storage object.
Syntax
SECURITY_STATUS NCryptSetProperty(
[in] NCRYPT_HANDLE hObject,
[in] LPCWSTR pszProperty,
[in] PBYTE pbInput,
[in] DWORD cbInput,
[in] DWORD dwFlags
);
Parameters
[in] hObject
The handle of the key storage object to set the property for.
[in] pszProperty
A pointer to a null-terminated Unicode string that contains the name of the property to set. This can be one of the predefined Key Storage Property Identifiers or a custom property identifier.
[in] pbInput
The address of a buffer that contains the new property value. The cbInput parameter contains the size of this buffer.
[in] cbInput
The size, in bytes, of the pbInput buffer.
[in] dwFlags
Flags that modify function behavior. This can be zero or a combination of one or more of the following values.
For the NCRYPT_SECURITY_DESCR_PROPERTY property, this parameter must also contain one of the following values, which identifies the part of the security descriptor to set.
Value | Meaning |
---|---|
|
Set the security identifier (SID) of the object's owner. Use the SetSecurityDescriptorOwner function to set the owner SID in the SECURITY_DESCRIPTOR structure. |
|
Set the SID of the object's primary group. Use the SetSecurityDescriptorGroup function to set the group SID in the SECURITY_DESCRIPTOR structure. |
|
Set the discretionary access control list (DACL). Use the SetSecurityDescriptorDacl function to set the DACL in the SECURITY_DESCRIPTOR structure. |
|
Set the system access control list (SACL). Use the SetSecurityDescriptorSacl function to set the SACL in the SECURITY_DESCRIPTOR structure. |
|
Set the mandatory label access control entry in the SACL of the object. Use the SetSecurityDescriptorSacl function to set the SACL in the SECURITY_DESCRIPTOR structure. For more information about the mandatory label access control entry, see Windows Integrity Mechanism Design. |
Return value
Returns a status code that indicates the success or failure of the function.
Possible return codes include, but are not limited to, the following.
Return code | Description |
---|---|
|
The function was successful. |
|
The dwFlags parameter contains a value that is not valid. |
|
The hObject parameter is not valid. |
|
One or more parameters are not valid. |
|
A memory allocation failure occurred. |
|
The specified property is not supported for the object. |
Remarks
A service must not call this function from its StartService Function. If a service calls this function from its StartService function, a deadlock can occur, and the service may stop responding.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2008 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | ncrypt.h |
Library | Ncrypt.lib |
DLL | Ncrypt.dll |