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

◆ TrySignHash() [2/2]

static unsafe bool Internal.Cryptography.CngCommon.TrySignHash ( this SafeNCryptKeyHandle keyHandle,
ReadOnlySpan< byte > hash,
Span< byte > signature,
global::Interop::NCrypt::AsymmetricPaddingMode paddingMode,
void * pPaddingInfo,
out int bytesWritten )
inlinestatic

Definition at line 67 of file CngCommon.cs.

68 {
69 for (int i = 0; i <= 1; i++)
70 {
71 int pcbResult;
72 global::Interop.NCrypt.ErrorCode errorCode = global::Interop.NCrypt.NCryptSignHash(keyHandle, pPaddingInfo, hash, hash.Length, signature, signature.Length, out pcbResult, paddingMode);
73 switch (errorCode)
74 {
75 case global::Interop.NCrypt.ErrorCode.ERROR_SUCCESS:
76 bytesWritten = pcbResult;
77 return true;
78 case global::Interop.NCrypt.ErrorCode.NTE_BUFFER_TOO_SMALL:
79 bytesWritten = 0;
80 return false;
81 default:
82 throw errorCode.ToCryptographicException();
83 case global::Interop.NCrypt.ErrorCode.STATUS_UNSUCCESSFUL:
84 break;
85 }
86 }
87 throw global::Interop.NCrypt.ErrorCode.STATUS_UNSUCCESSFUL.ToCryptographicException();
88 }
int Length
Definition Span.cs:70

References System.ReadOnlySpan< T >.Length, and System.Span< T >.Length.