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

◆ GetOrGenerateKey() [2/2]

CngKey Internal.Cryptography.CngAlgorithmCore.GetOrGenerateKey ( int keySize,
CngAlgorithm algorithm )
inline

Definition at line 48 of file CngAlgorithmCore.cs.

49 {
51 if (_lazyKey != null && _lazyKey.KeySize != keySize)
52 {
53 DisposeKey();
54 }
55 if (_lazyKey == null)
56 {
57 CngKeyCreationParameters cngKeyCreationParameters = new CngKeyCreationParameters
58 {
59 ExportPolicy = CngExportPolicies.AllowPlaintextExport
60 };
62 cngKeyCreationParameters.Parameters.Add(item);
63 _lazyKey = CngKey.Create(algorithm, null, cngKeyCreationParameters);
64 }
65 return _lazyKey;
66 }
static byte[] GetBytes(bool value)
static CngKey Create(CngAlgorithm algorithm)
Definition CngKey.cs:278

References Internal.Cryptography.CngAlgorithmCore._lazyKey, System.Collections.ObjectModel.Collection< T >.Add(), System.Security.Cryptography.CngKey.Create(), Internal.Cryptography.CngAlgorithmCore.DisposeKey(), System.BitConverter.GetBytes(), System.item, System.Security.Cryptography.CngKey.KeySize, System.Security.Cryptography.CngKeyCreationParameters.Parameters, and Internal.Cryptography.CngAlgorithmCore.ThrowIfDisposed().

Referenced by System.Security.Cryptography.ECDiffieHellmanCng.GenerateKey(), System.Security.Cryptography.ECDsaCng.GenerateKey(), System.Security.Cryptography.ECDiffieHellmanCng.GetKey(), and System.Security.Cryptography.ECDsaCng.GetKey().