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

◆ GetDuplicatedKeyHandle()

SafeNCryptKeyHandle System.Security.Cryptography.ECCngKey.GetDuplicatedKeyHandle ( int callerKeySizeProperty)
inlinepackage

Definition at line 39 of file ECCngKey.cs.

40 {
42 if (ECCng.IsECNamedCurve(_lastAlgorithm))
43 {
45 }
46 if (_lastKeySize != callerKeySizeProperty)
47 {
48 bool flag = _algorithmGroup == "ECDSA";
49 string text = callerKeySizeProperty switch
50 {
51 256 => flag ? "ECDSA_P256" : "ECDH_P256",
52 384 => flag ? "ECDSA_P384" : "ECDH_P384",
53 521 => flag ? "ECDSA_P521" : "ECDH_P521",
55 };
56 if (_keyHandle != null)
57 {
58 DisposeKey();
59 }
60 _keyHandle = CngKeyLite.GenerateNewExportableKey(text, callerKeySizeProperty);
61 _lastKeySize = callerKeySizeProperty;
63 KeySize = callerKeySizeProperty;
64 }
66 }
static string Cryptography_InvalidKeySize
Definition SR.cs:92
Definition SR.cs:7
SafeNCryptKeyHandle _keyHandle
Definition ECCngKey.cs:7

References System.Security.Cryptography.ECCngKey._algorithmGroup, System.Security.Cryptography.ECCngKey._keyHandle, System.Security.Cryptography.ECCngKey._lastAlgorithm, System.Security.Cryptography.ECCngKey._lastKeySize, System.SR.Cryptography_InvalidKeySize, System.Security.Cryptography.ECCngKey.DisposeKey(), System.Security.Cryptography.CngKeyLite.GenerateNewExportableKey(), System.Security.Cryptography.ECCng.IsECNamedCurve(), System.Security.Cryptography.ECCngKey.KeySize, System.text, and System.Security.Cryptography.ECCngKey.ThrowIfDisposed().

Referenced by System.Security.Cryptography.ECCngKey.GetCurveName(), System.Security.Cryptography.ECDiffieHellmanImplementation.ECDiffieHellmanCng.GetDuplicatedKeyHandle(), and System.Security.Cryptography.ECDsaImplementation.ECDsaCng.GetDuplicatedKeyHandle().