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

◆ TryEncryptOrDecrypt() [2/2]

unsafe bool System.Security.Cryptography.RSACng.TryEncryptOrDecrypt ( SafeNCryptKeyHandle key,
ReadOnlySpan< byte > input,
Span< byte > output,
global::Interop::NCrypt::AsymmetricPaddingMode paddingMode,
void * paddingInfo,
bool encrypt,
out int bytesWritten )
inlineprivate

Definition at line 342 of file RSACng.cs.

343 {
344 for (int i = 0; i <= 1; i++)
345 {
346 int bytesNeeded;
347 global::Interop.NCrypt.ErrorCode errorCode = EncryptOrDecrypt(key, input, output, paddingMode, paddingInfo, encrypt, out bytesNeeded);
348 switch (errorCode)
349 {
350 case global::Interop.NCrypt.ErrorCode.ERROR_SUCCESS:
352 return true;
353 case global::Interop.NCrypt.ErrorCode.NTE_BUFFER_TOO_SMALL:
354 bytesWritten = 0;
355 return false;
356 default:
357 throw errorCode.ToCryptographicException();
358 case global::Interop.NCrypt.ErrorCode.STATUS_UNSUCCESSFUL:
359 break;
360 }
361 }
362 throw global::Interop.NCrypt.ErrorCode.STATUS_UNSUCCESSFUL.ToCryptographicException();
363 }
unsafe byte[] EncryptOrDecrypt(byte[] data, RSAEncryptionPadding padding, bool encrypt)
Definition RSACng.cs:160

References System.Security.Cryptography.RSACng.EncryptOrDecrypt(), System.input, and System.key.