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

◆ ImportParameters()

override void System.Security.Cryptography.ECDiffieHellmanImplementation.ECDiffieHellmanCng.ImportParameters ( ECParameters parameters)
inlinevirtual

Reimplemented from System.Security.Cryptography.ECDiffieHellman.

Definition at line 225 of file ECDiffieHellmanImplementation.cs.

226 {
227 parameters.Validate();
229 ECCurve curve = parameters.Curve;
230 bool flag = parameters.D != null;
231 bool flag2 = parameters.Q.X != null && parameters.Q.Y != null;
232 if (curve.IsPrime)
233 {
234 if (!flag2 && flag)
235 {
236 byte[] array = new byte[parameters.D.Length];
237 ECParameters parameters2 = parameters;
238 parameters2.Q.X = array;
239 parameters2.Q.Y = array;
240 byte[] primeCurveBlob = ECCng.GetPrimeCurveBlob(ref parameters2, ecdh: true);
241 ImportFullKeyBlob(primeCurveBlob, includePrivateParameters: true);
242 }
243 else
244 {
245 byte[] primeCurveBlob2 = ECCng.GetPrimeCurveBlob(ref parameters, ecdh: true);
246 ImportFullKeyBlob(primeCurveBlob2, flag);
247 }
248 return;
249 }
250 if (curve.IsNamed)
251 {
252 if (string.IsNullOrEmpty(curve.Oid.FriendlyName))
253 {
254 throw new PlatformNotSupportedException(System.SR.Format(System.SR.Cryptography_InvalidCurveOid, curve.Oid.Value));
255 }
256 if (!flag2 && flag)
257 {
258 byte[] array2 = new byte[parameters.D.Length];
259 ECParameters parameters3 = parameters;
260 parameters3.Q.X = array2;
261 parameters3.Q.Y = array2;
262 byte[] namedCurveBlob = ECCng.GetNamedCurveBlob(ref parameters3, ecdh: true);
263 ImportKeyBlob(namedCurveBlob, curve.Oid.FriendlyName, includePrivateParameters: true);
264 }
265 else
266 {
267 byte[] namedCurveBlob2 = ECCng.GetNamedCurveBlob(ref parameters, ecdh: true);
268 ImportKeyBlob(namedCurveBlob2, curve.Oid.FriendlyName, flag);
269 }
270 return;
271 }
272 throw new PlatformNotSupportedException(System.SR.Format(System.SR.Cryptography_CurveNotSupported, curve.CurveType.ToString()));
273 }
static string Cryptography_CurveNotSupported
Definition SR.cs:64
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Cryptography_InvalidCurveOid
Definition SR.cs:66
Definition SR.cs:7
void ImportKeyBlob(byte[] ecKeyBlob, string curveName, bool includePrivateParameters)

References System.array, System.SR.Cryptography_CurveNotSupported, System.SR.Cryptography_InvalidCurveOid, System.Security.Cryptography.ECParameters.Curve, System.Security.Cryptography.ECCurve.CurveType, System.Security.Cryptography.ECParameters.D, System.SR.Format(), System.Security.Cryptography.Oid.FriendlyName, System.Security.Cryptography.ECCng.GetNamedCurveBlob(), System.Security.Cryptography.ECCng.GetPrimeCurveBlob(), System.Security.Cryptography.ECDiffieHellmanImplementation.ECDiffieHellmanCng.ImportFullKeyBlob(), System.Security.Cryptography.ECDiffieHellmanImplementation.ECDiffieHellmanCng.ImportKeyBlob(), System.Security.Cryptography.ECCurve.IsNamed, System.Security.Cryptography.ECCurve.IsPrime, System.Security.Cryptography.ECCurve.Oid, System.Security.Cryptography.ECDiffieHellmanImplementation.ECDiffieHellmanCng.ThrowIfDisposed(), System.Security.Cryptography.ECParameters.Validate(), and System.Security.Cryptography.Oid.Value.