Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GenerateNewExportableKey() [3/3]

static SafeNCryptKeyHandle System.Security.Cryptography.CngKeyLite.GenerateNewExportableKey ( string algorithm,
string curveName )
inlinestaticpackage

Definition at line 187 of file CngKeyLite.cs.

188 {
189 global::Interop.NCrypt.ErrorCode errorCode = global::Interop.NCrypt.NCryptCreatePersistedKey(s_microsoftSoftwareProviderHandle, out var phKey, algorithm, null, 0, CngKeyCreationOptions.None);
190 if (errorCode != 0)
191 {
192 throw errorCode.ToCryptographicException();
193 }
194 SetExportable(phKey);
195 SetCurveName(phKey, curveName);
196 errorCode = global::Interop.NCrypt.NCryptFinalizeKey(phKey, 0);
197 if (errorCode != 0)
198 {
199 throw errorCode.ToCryptographicException();
200 }
201 return phKey;
202 }
static void SetCurveName(SafeNCryptHandle keyHandle, string curveName)
static readonly SafeNCryptProviderHandle s_microsoftSoftwareProviderHandle
Definition CngKeyLite.cs:10
static unsafe void SetExportable(SafeNCryptKeyHandle keyHandle)

References System.Security.Cryptography.CngKeyLite.s_microsoftSoftwareProviderHandle, System.Security.Cryptography.CngKeyLite.SetCurveName(), and System.Security.Cryptography.CngKeyLite.SetExportable().