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

◆ Export()

byte[] System.Security.Cryptography.CngKey.Export ( CngKeyBlobFormat format)
inline

Definition at line 622 of file CngKey.cs.

623 {
624 if (format == null)
625 {
626 throw new ArgumentNullException("format");
627 }
628 global::Interop.NCrypt.ErrorCode errorCode = global::Interop.NCrypt.NCryptExportKey(_keyHandle, IntPtr.Zero, format.Format, IntPtr.Zero, null, 0, out var pcbResult, 0);
629 if (errorCode != 0)
630 {
631 throw errorCode.ToCryptographicException();
632 }
633 byte[] array = new byte[pcbResult];
634 errorCode = global::Interop.NCrypt.NCryptExportKey(_keyHandle, IntPtr.Zero, format.Format, IntPtr.Zero, array, array.Length, out pcbResult, 0);
635 if (errorCode != 0)
636 {
637 throw errorCode.ToCryptographicException();
638 }
639 Array.Resize(ref array, pcbResult);
640 return array;
641 }
readonly SafeNCryptKeyHandle _keyHandle
Definition CngKey.cs:11

References System.Security.Cryptography.CngKey._keyHandle, System.array, System.format, and System.IntPtr.Zero.

Referenced by System.Security.Cryptography.DSACng.ExportKeyBlob(), System.Security.Cryptography.RSACng.ExportKeyBlob(), and Internal.Cryptography.SymmetricImportExportExtensions.GetSymmetricKeyDataIfExportable().