Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SafeKeyHandle.cs
Go to the documentation of this file.
1
using
Microsoft.Win32.SafeHandles
;
2
3
namespace
System.Security.Cryptography
;
4
5
internal
sealed
class
SafeKeyHandle
:
SafeHandleZeroOrMinusOneIsInvalid
6
{
7
private
int
_keySpec
;
8
9
private
bool
_fPublicOnly
;
10
11
private
SafeProvHandle
_parent
;
12
13
internal
int
KeySpec
14
{
15
set
16
{
17
_keySpec
=
value
;
18
}
19
}
20
21
internal
bool
PublicOnly
22
{
23
get
24
{
25
return
_fPublicOnly
;
26
}
27
set
28
{
29
_fPublicOnly
=
value
;
30
}
31
}
32
33
internal
static
SafeKeyHandle
InvalidHandle
=>
SafeHandleCache<SafeKeyHandle>
.
GetInvalidHandle
(() =>
new
SafeKeyHandle
());
34
35
public
SafeKeyHandle
()
36
: base(ownsHandle: true)
37
{
38
SetHandle
(
IntPtr
.
Zero
);
39
_keySpec
= 0;
40
_fPublicOnly
=
false
;
41
}
42
43
internal
void
SetParent
(
SafeProvHandle
parent)
44
{
45
if
(!
IsInvalid
&& !base.IsClosed)
46
{
47
_parent
= parent;
48
bool
success =
false
;
49
_parent
.
DangerousAddRef
(ref success);
50
}
51
}
52
53
protected
override
void
Dispose
(
bool
disposing)
54
{
55
if
(!
SafeHandleCache<SafeKeyHandle>
.IsCachedInvalidHandle(
this
))
56
{
57
base.Dispose(disposing);
58
}
59
}
60
61
protected
override
bool
ReleaseHandle
()
62
{
63
bool
result = global::Interop.Advapi32.CryptDestroyKey(
handle
);
64
SafeProvHandle
parent =
_parent
;
65
_parent
=
null
;
66
parent?.
DangerousRelease
();
67
return
result;
68
}
69
}
Microsoft.Win32.SafeHandles.SafeHandleCache.GetInvalidHandle
static T GetInvalidHandle(Func< T > invalidHandleFactory)
Definition
SafeHandleCache.cs:11
Microsoft.Win32.SafeHandles.SafeHandleCache
Definition
SafeHandleCache.cs:8
Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid.IsInvalid
override bool IsInvalid
Definition
SafeHandleZeroOrMinusOneIsInvalid.cs:9
Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
Definition
SafeHandleZeroOrMinusOneIsInvalid.cs:7
System.Runtime.InteropServices.SafeHandle.DangerousAddRef
void DangerousAddRef(ref bool success)
Definition
SafeHandle.cs:76
System.Runtime.InteropServices.SafeHandle.DangerousRelease
void DangerousRelease()
Definition
SafeHandle.cs:93
System.Runtime.InteropServices.SafeHandle.SetHandle
void SetHandle(IntPtr handle)
Definition
SafeHandle.cs:42
System.Runtime.InteropServices.SafeHandle.handle
IntPtr handle
Definition
SafeHandle.cs:8
System.Security.Cryptography.SafeKeyHandle.KeySpec
int KeySpec
Definition
SafeKeyHandle.cs:14
System.Security.Cryptography.SafeKeyHandle.InvalidHandle
static SafeKeyHandle InvalidHandle
Definition
SafeKeyHandle.cs:33
System.Security.Cryptography.SafeKeyHandle.Dispose
override void Dispose(bool disposing)
Definition
SafeKeyHandle.cs:53
System.Security.Cryptography.SafeKeyHandle._fPublicOnly
bool _fPublicOnly
Definition
SafeKeyHandle.cs:9
System.Security.Cryptography.SafeKeyHandle._parent
SafeProvHandle _parent
Definition
SafeKeyHandle.cs:11
System.Security.Cryptography.SafeKeyHandle.ReleaseHandle
override bool ReleaseHandle()
Definition
SafeKeyHandle.cs:61
System.Security.Cryptography.SafeKeyHandle.SetParent
void SetParent(SafeProvHandle parent)
Definition
SafeKeyHandle.cs:43
System.Security.Cryptography.SafeKeyHandle._keySpec
int _keySpec
Definition
SafeKeyHandle.cs:7
System.Security.Cryptography.SafeKeyHandle.PublicOnly
bool PublicOnly
Definition
SafeKeyHandle.cs:22
System.Security.Cryptography.SafeKeyHandle.SafeKeyHandle
SafeKeyHandle()
Definition
SafeKeyHandle.cs:35
System.Security.Cryptography.SafeKeyHandle
Definition
SafeKeyHandle.cs:6
System.Security.Cryptography.SafeProvHandle
Definition
SafeProvHandle.cs:6
Microsoft.Win32.SafeHandles
Definition
SafeProcessHandle.cs:3
System.Security.Cryptography
Definition
CryptoPool.cs:3
System.ExceptionArgument.value
@ value
System.IntPtr.Zero
static readonly IntPtr Zero
Definition
IntPtr.cs:18
System.IntPtr
Definition
IntPtr.cs:14
source
System.Security.Cryptography.Csp
System.Security.Cryptography
SafeKeyHandle.cs
Generated by
1.10.0