System.Security.Cryptography.CngProvider


The CngProviderExtensionMethods type provides several extension methods for the System.Security.Cryptography.CngProvider class. This type is in the Security.Cryptography namespace (not the System.Security.Cryptography namespace), so in order to use these extension methods, you will need to make sure you include this namespace as well as a reference to Security.Cryptography.dll

CngProvider uses the NCrypt layer of CNG, and requires Windows Vista and the .NET Framework 3.5.

APIs

System.Collections.Generic.IEnumerable<System.Security.Cryptography.CngKey> GetKeys()

GetKeys provides an enumerator over all of the keys that are stored in the key storage provider.

System.Collections.Generic.IEnumerable<System.Security.Cryptography.CngKey> GetKeys(System.Security.Cryptography.CngKeyOpenOptions openOptions)

GetKeys provides an enumerator over all of the keys that are stored in the key storage provider. This overload of GetKeys allows you to enumerate over only the user keys in the KSP or only the machine keys.

Parameters:
openOptions options to use when opening the CNG keys


System.Collections.Generic.IEnumerable<System.Security.Cryptography.CngKey> GetKeys(System.Security.Cryptography.CngKeyOpenOptions openOptions, System.Security.Cryptography.CngAlgorithm algorithm)

GetKeys provides an enumerator over all of the keys that are stored in the key storage provider. This overload of GetKeys allows you to enumerate over only the user keys in the KSP or only the machine keys. It also allows you to return only keys that are usable with a specified algorithm.

Parameters:
openOptions options to use when opening the CNG keys
algorithm algorithm that the returned keys should support


Exceptions:
System.ArgumentNullException if algorithm is null


System.Collections.Generic.IEnumerable<System.Security.Cryptography.CngAlgorithm> GetSupportedAlgorithms()

GetSupportedAlgorithms provides an enumerator over all of the algorithms that the NCrypt provider supports.

System.Collections.Generic.IEnumerable<System.Security.Cryptography.CngAlgorithm> GetSupportedAlgorithms(Security.Cryptography.NCryptAlgorithmOperations operations)

GetSupportedAlgorithms provides an enumerator over all of the algorithms that the NCrypt provider supports. Each of the returned algortihms will support at least one of the cryptographic operations specified by the operations parameter.

Parameters:
operations operations that the returned algorithms should support


Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle OpenProvider()

Gets a SafeHandle for the NCrypt provider. This handle can be used for P/Invoking to other APIs which expect an NCRYPT_PROV_HANDLE parameter.

Permission Requirements:
System.Security.Permissions.SecurityPermission SecurityPermission/UnmanagedCode is required of the immediate caller to this API



Last edited Jun 4, 2009 at 12:50 AM by shawnfa, version 2

Comments

No comments yet.