Add project
Basic formatting applied. Unnecessary comments have been removed. Suspicious code is covered by TODO.
This commit is contained in:
32
Hcs.Client/GostCryptography/Native/ISafeHandleProvider.cs
Normal file
32
Hcs.Client/GostCryptography/Native/ISafeHandleProvider.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace GostCryptography.Native
|
||||
{
|
||||
/// <summary>
|
||||
/// Провайдер дескрипторов криптографического объекта
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Тип безопасного дескриптора</typeparam>
|
||||
public interface ISafeHandleProvider<out T> where T : SafeHandle
|
||||
{
|
||||
/// <summary>
|
||||
/// Возвращает дескриптор объекта
|
||||
/// </summary>
|
||||
T SafeHandle { [SecurityCritical] get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Методы расширения для <see cref="ISafeHandleProvider{T}"/>
|
||||
/// </summary>
|
||||
public static class SafeHandleProviderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Возвращает дескриптор объекта
|
||||
/// </summary>
|
||||
[SecurityCritical]
|
||||
public static T GetSafeHandle<T>(this ISafeHandleProvider<T> provider) where T : SafeHandle
|
||||
{
|
||||
return provider.SafeHandle;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user