Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RC2BCryptModes.cs
Go to the documentation of this file.
1
using
System
;
2
using
System.Security.Cryptography
;
3
using
Internal.NativeCrypto
;
4
5
namespace
Internal.Cryptography
;
6
7
internal
static
class
RC2BCryptModes
8
{
9
internal
static
SafeAlgorithmHandle
GetHandle
(
CipherMode
cipherMode,
int
effectiveKeyLength)
10
{
11
return
cipherMode
switch
12
{
13
CipherMode.CBC =>
OpenRC2Algorithm
(
"ChainingModeCBC"
, effectiveKeyLength),
14
CipherMode.ECB =>
OpenRC2Algorithm
(
"ChainingModeECB"
, effectiveKeyLength),
15
_ =>
throw
new
NotSupportedException
(),
16
};
17
}
18
19
private
static
SafeAlgorithmHandle
OpenRC2Algorithm
(
string
cipherMode,
int
effectiveKeyLength)
20
{
21
SafeAlgorithmHandle
safeAlgorithmHandle =
Cng
.
BCryptOpenAlgorithmProvider
(
"RC2"
,
null
,
Cng
.
OpenAlgorithmProviderFlags
.NONE);
22
safeAlgorithmHandle.SetCipherMode(cipherMode);
23
if
(effectiveKeyLength != 0)
24
{
25
safeAlgorithmHandle.SetEffectiveKeyLength(effectiveKeyLength);
26
}
27
return
safeAlgorithmHandle;
28
}
29
}
Internal.Cryptography.RC2BCryptModes.GetHandle
static SafeAlgorithmHandle GetHandle(CipherMode cipherMode, int effectiveKeyLength)
Definition
RC2BCryptModes.cs:9
Internal.Cryptography.RC2BCryptModes.OpenRC2Algorithm
static SafeAlgorithmHandle OpenRC2Algorithm(string cipherMode, int effectiveKeyLength)
Definition
RC2BCryptModes.cs:19
Internal.Cryptography.RC2BCryptModes
Definition
RC2BCryptModes.cs:8
Internal.NativeCrypto.Cng.BCryptOpenAlgorithmProvider
static SafeAlgorithmHandle BCryptOpenAlgorithmProvider(string pszAlgId, string pszImplementation, OpenAlgorithmProviderFlags dwFlags)
Definition
Cng.cs:34
Internal.NativeCrypto.Cng.OpenAlgorithmProviderFlags
OpenAlgorithmProviderFlags
Definition
Cng.cs:12
Internal.NativeCrypto.Cng
Definition
Cng.cs:9
Internal.NativeCrypto.SafeAlgorithmHandle
Definition
SafeAlgorithmHandle.cs:8
System.NotSupportedException
Definition
NotSupportedException.cs:9
Internal.Cryptography
Definition
AesBCryptModes.cs:5
Internal.NativeCrypto
Definition
Cng.cs:6
System.Security.Cryptography.CipherMode
CipherMode
Definition
CipherMode.cs:6
System.Security.Cryptography
Definition
CryptoPool.cs:3
System
Definition
BlockingCollection.cs:8
source
System.Security.Cryptography.Algorithms
Internal.Cryptography
RC2BCryptModes.cs
Generated by
1.10.0