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