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

◆ TryExportKeyBlob()

bool System.Security.Cryptography.CngKey.TryExportKeyBlob ( string blobType,
Span< byte > destination,
out int bytesWritten )
inlinepackage

Definition at line 643 of file CngKey.cs.

644 {
645 Span<byte> span = default(Span<byte>);
646 global::Interop.NCrypt.ErrorCode errorCode = global::Interop.NCrypt.NCryptExportKey(_keyHandle, IntPtr.Zero, blobType, IntPtr.Zero, ref MemoryMarshal.GetReference(span), span.Length, out var pcbResult, 0);
647 if (errorCode != 0)
648 {
649 throw errorCode.ToCryptographicException();
650 }
651 if (pcbResult > destination.Length)
652 {
653 bytesWritten = 0;
654 return false;
655 }
656 errorCode = global::Interop.NCrypt.NCryptExportKey(_keyHandle, IntPtr.Zero, blobType, IntPtr.Zero, ref MemoryMarshal.GetReference(destination), destination.Length, out pcbResult, 0);
657 if (errorCode != 0)
658 {
659 throw errorCode.ToCryptographicException();
660 }
661 bytesWritten = pcbResult;
662 return true;
663 }
readonly SafeNCryptKeyHandle _keyHandle
Definition CngKey.cs:11

References System.Security.Cryptography.CngKey._keyHandle, System.destination, System.Span< T >.Length, and System.IntPtr.Zero.

Referenced by System.Security.Cryptography.DSACng.TryExportPkcs8PrivateKey(), System.Security.Cryptography.ECDiffieHellmanCng.TryExportPkcs8PrivateKey(), System.Security.Cryptography.ECDsaCng.TryExportPkcs8PrivateKey(), and System.Security.Cryptography.RSACng.TryExportPkcs8PrivateKey().