103 references to ErrorCode
System.Core (103)
System\Security\Cryptography\CngKey.cs (8)
217NCryptNative.ErrorCode errorCode = NCryptNative.GetPropertyAsInt( 225if (errorCode == NCryptNative.ErrorCode.Success) { 522NCryptNative.ErrorCode error = NCryptNative.UnsafeNativeMethods.NCryptOpenKey(kspHandle, 530bool keyNotFound = error == NCryptNative.ErrorCode.KeyDoesNotExist || 531error == NCryptNative.ErrorCode.NotFound; 533if (error != NCryptNative.ErrorCode.Success && !keyNotFound) { 537return error == NCryptNative.ErrorCode.Success; 650throw new CryptographicException((int)NCryptNative.ErrorCode.NotFound);
System\Security\Cryptography\NCryptNative.cs (95)
223internal static extern ErrorCode NCryptCreatePersistedKey(SafeNCryptProviderHandle hProvider, 234internal static extern ErrorCode NCryptDeleteKey(SafeNCryptKeyHandle hKey, int flags); 240internal static extern ErrorCode NCryptDeriveKey(SafeNCryptSecretHandle hSharedSecret, 252internal static extern ErrorCode NCryptExportKey(SafeNCryptKeyHandle hKey, 265internal static extern ErrorCode NCryptFinalizeKey(SafeNCryptKeyHandle hKey, int dwFlags); 271internal static extern ErrorCode NCryptGetProperty(SafeNCryptHandle hObject, 282internal static extern ErrorCode NCryptGetProperty(SafeNCryptHandle hObject, 294internal static extern ErrorCode NCryptGetProperty(SafeNCryptHandle hObject, 305internal static extern ErrorCode NCryptImportKey(SafeNCryptProviderHandle hProvider, 318internal static extern ErrorCode NCryptOpenKey(SafeNCryptProviderHandle hProvider, 328internal static extern ErrorCode NCryptOpenStorageProvider([Out] out SafeNCryptProviderHandle phProvider, 336internal static extern ErrorCode NCryptSecretAgreement(SafeNCryptKeyHandle hPrivKey, 345internal static extern ErrorCode NCryptSetProperty(SafeNCryptHandle hObject, 355internal static extern ErrorCode NCryptSetProperty(SafeNCryptHandle hObject, 366internal static extern ErrorCode NCryptSetProperty(SafeNCryptHandle hObject, 376internal static extern ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, 389internal static extern ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, 398internal static extern ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, 408internal static extern ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, 417internal static extern ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, 426internal static extern ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, 435internal static extern ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, 445internal static extern ErrorCode NCryptDecrypt(SafeNCryptKeyHandle hKey, 455internal static extern ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, 465internal static extern ErrorCode NCryptEncrypt(SafeNCryptKeyHandle hKey, 480private delegate ErrorCode NCryptDecryptor<T>(SafeNCryptKeyHandle hKey, 493private delegate ErrorCode NCryptEncryptor<T>(SafeNCryptKeyHandle hKey, 506private delegate ErrorCode NCryptHashSigner<T>(SafeNCryptKeyHandle hKey, 519private delegate ErrorCode NCryptSignatureVerifier<T>(SafeNCryptKeyHandle hKey, 551ErrorCode error = decryptor(key, 559if (error != ErrorCode.Success && error != ErrorCode.BufferTooSmall) { 573if (error != ErrorCode.Success) { 628private static ErrorCode Pkcs1PaddingDecryptionWrapper(SafeNCryptKeyHandle hKey, 664ErrorCode error = encryptor(key, 672if (error != ErrorCode.Success && error != ErrorCode.BufferTooSmall) { 686if (error != ErrorCode.Success) { 727private static ErrorCode Pkcs1PaddingEncryptionWrapper(SafeNCryptKeyHandle hKey, 762ErrorCode error = signer(key, 770if (error != ErrorCode.Success && error != ErrorCode.BufferTooSmall) { 784if (error != ErrorCode.Success) { 853ErrorCode error = verifier(key, 860return error == ErrorCode.Success; 986ErrorCode error = UnsafeNativeMethods.NCryptCreatePersistedKey(provider, 992if (error != ErrorCode.Success) { 1006ErrorCode error = UnsafeNativeMethods.NCryptDeleteKey(key, 0); 1007if (error != ErrorCode.Success) { 1121ErrorCode error = UnsafeNativeMethods.NCryptDeriveKey(secretAgreement, 1128if (error != ErrorCode.Success && error != ErrorCode.BufferTooSmall) { 1142if (error != ErrorCode.Success) { 1245ErrorCode error = UnsafeNativeMethods.NCryptSecretAgreement(privateKey, 1250if (error != ErrorCode.Success) { 1268ErrorCode error = UnsafeNativeMethods.NCryptExportKey(key, 1277if (error != ErrorCode.Success && error != ErrorCode.BufferTooSmall) { 1293if (error != ErrorCode.Success) { 1333ErrorCode error = UnsafeNativeMethods.NCryptFinalizeKey(key, 0); 1334if (error != ErrorCode.Success) { 1352ErrorCode error = UnsafeNativeMethods.NCryptGetProperty(ncryptObject, 1364if (error != ErrorCode.Success && error != ErrorCode.BufferTooSmall && error != ErrorCode.NotFound) { 1368foundProperty = error != ErrorCode.NotFound; 1372if (error != ErrorCode.NotFound && bufferSize > 0) { 1380if (error != ErrorCode.Success) { 1412internal static ErrorCode GetPropertyAsInt(SafeNCryptHandle ncryptObject, 1421ErrorCode errorCode = UnsafeNativeMethods.NCryptGetProperty( 1429if (errorCode == ErrorCode.Success) 1451ErrorCode error = UnsafeNativeMethods.NCryptGetProperty(ncryptObject, 1459if (error == ErrorCode.NotFound) { 1463if (error != ErrorCode.Success) { 1540ErrorCode error = UnsafeNativeMethods.NCryptImportKey(provider, 1549if (error != ErrorCode.Success) { 1569ErrorCode error = UnsafeNativeMethods.NCryptImportKey(provider, 1578if (error != ErrorCode.Success) 1597ErrorCode error = UnsafeNativeMethods.NCryptOpenKey(provider, out key, name, 0, options); 1599if (error != ErrorCode.Success) { 1617ErrorCode error = UnsafeNativeMethods.NCryptOpenStorageProvider(out providerHandle, 1621if (error != ErrorCode.Success) { 1695ErrorCode error = UnsafeNativeMethods.NCryptSetProperty(ncryptObject, 1701if (error != ErrorCode.Success) { 1755ErrorCode error = UnsafeNativeMethods.NCryptSetProperty(ncryptObject, 1761if (error != ErrorCode.Success) { 1777ErrorCode error = UnsafeNativeMethods.NCryptSignHash(key, 1786if (error != ErrorCode.Success && error != ErrorCode.BufferTooSmall) { 1803if (error != ErrorCode.Success) { 1827ErrorCode error = UnsafeNativeMethods.NCryptSignHash(key, 1836if (error == ErrorCode.BufferTooSmall) 1850if (error != ErrorCode.Success) 1893ErrorCode error = UnsafeNativeMethods.NCryptVerifySignature(key, 1901return error == ErrorCode.Success;