Add project
Basic formatting applied. Unnecessary comments have been removed. Suspicious code is covered by TODO.
This commit is contained in:
31
Hcs.Client/GostCryptography/Native/SafeHashHandleImpl.cs
Normal file
31
Hcs.Client/GostCryptography/Native/SafeHashHandleImpl.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
using System;
|
||||
using System.Security;
|
||||
|
||||
namespace GostCryptography.Native
|
||||
{
|
||||
/// <summary>
|
||||
/// Дескриптор функции хэширования криптографического провайдера
|
||||
/// </summary>
|
||||
[SecurityCritical]
|
||||
public class SafeHashHandleImpl : SafeHandleZeroOrMinusOneIsInvalid
|
||||
{
|
||||
public static SafeHashHandleImpl InvalidHandle => new SafeHashHandleImpl(IntPtr.Zero);
|
||||
|
||||
public SafeHashHandleImpl() : base(true)
|
||||
{
|
||||
}
|
||||
|
||||
public SafeHashHandleImpl(IntPtr handle) : base(true)
|
||||
{
|
||||
SetHandle(handle);
|
||||
}
|
||||
|
||||
[SecurityCritical]
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
CryptoApi.CryptDestroyHash(handle);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user