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

◆ ExportKeyBlob()

static byte[] Internal.NativeCrypto.CapiHelper.ExportKeyBlob ( bool includePrivateParameters,
SafeKeyHandle safeKeyHandle )
inlinestaticpackage

Definition at line 1017 of file CapiHelper.cs.

1018 {
1019 VerifyValidHandle(safeKeyHandle);
1020 int dwDataLen = 0;
1021 int dwBlobType = (includePrivateParameters ? 7 : 6);
1022 if (!global::Interop.Advapi32.CryptExportKey(safeKeyHandle, SafeKeyHandle.InvalidHandle, dwBlobType, 0, null, ref dwDataLen))
1023 {
1024 throw GetErrorCode().ToCryptographicException();
1025 }
1026 byte[] array = new byte[dwDataLen];
1027 if (!global::Interop.Advapi32.CryptExportKey(safeKeyHandle, SafeKeyHandle.InvalidHandle, dwBlobType, 0, array, ref dwDataLen))
1028 {
1029 throw GetErrorCode().ToCryptographicException();
1030 }
1031 return array;
1032 }
static void VerifyValidHandle(SafeHandleZeroOrMinusOneIsInvalid handle)

References System.array, Internal.NativeCrypto.CapiHelper.GetErrorCode(), and Internal.NativeCrypto.CapiHelper.VerifyValidHandle().

Referenced by System.Security.Cryptography.DSACryptoServiceProvider.ExportCspBlob(), and System.Security.Cryptography.RSACryptoServiceProvider.ExportCspBlob().