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

◆ ImportParameters()

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

Reimplemented from System.Security.Cryptography.ECDsa.

Definition at line 263 of file ECDsaCng.cs.

264 {
265 parameters.Validate();
267 ECCurve curve = parameters.Curve;
268 bool flag = parameters.D != null;
269 bool flag2 = parameters.Q.X != null && parameters.Q.Y != null;
270 if (curve.IsPrime)
271 {
272 if (!flag2 && flag)
273 {
274 byte[] array = new byte[parameters.D.Length];
275 ECParameters parameters2 = parameters;
276 parameters2.Q.X = array;
277 parameters2.Q.Y = array;
278 byte[] primeCurveBlob = System.Security.Cryptography.ECCng.GetPrimeCurveBlob(ref parameters2, ecdh: false);
279 ImportFullKeyBlob(primeCurveBlob, includePrivateParameters: true);
280 }
281 else
282 {
283 byte[] primeCurveBlob2 = System.Security.Cryptography.ECCng.GetPrimeCurveBlob(ref parameters, ecdh: false);
284 ImportFullKeyBlob(primeCurveBlob2, flag);
285 }
286 return;
287 }
288 if (curve.IsNamed)
289 {
290 if (string.IsNullOrEmpty(curve.Oid.FriendlyName))
291 {
292 throw new PlatformNotSupportedException(System.SR.Format(System.SR.Cryptography_InvalidCurveOid, curve.Oid.Value.ToString()));
293 }
294 if (!flag2 && flag)
295 {
296 byte[] array2 = new byte[parameters.D.Length];
297 ECParameters parameters3 = parameters;
298 parameters3.Q.X = array2;
299 parameters3.Q.Y = array2;
300 byte[] namedCurveBlob = System.Security.Cryptography.ECCng.GetNamedCurveBlob(ref parameters3, ecdh: false);
301 ImportKeyBlob(namedCurveBlob, curve.Oid.FriendlyName, includePrivateParameters: true);
302 }
303 else
304 {
305 byte[] namedCurveBlob2 = System.Security.Cryptography.ECCng.GetNamedCurveBlob(ref parameters, ecdh: false);
306 ImportKeyBlob(namedCurveBlob2, curve.Oid.FriendlyName, flag);
307 }
308 return;
309 }
310 throw new PlatformNotSupportedException(System.SR.Format(System.SR.Cryptography_CurveNotSupported, curve.CurveType.ToString()));
311 }
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
static unsafe byte[] GetPrimeCurveBlob(ref ECParameters parameters, bool ecdh)
Definition ECCng.cs:88
static unsafe byte[] GetNamedCurveBlob(ref ECParameters parameters, bool ecdh)
Definition ECCng.cs:63
void ImportFullKeyBlob(byte[] ecfullKeyBlob, bool includePrivateParameters)
Definition ECDsaCng.cs:110
void ImportKeyBlob(byte[] ecfullKeyBlob, string curveName, bool includePrivateParameters)
Definition ECDsaCng.cs:115

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.ECDsaCng.ImportFullKeyBlob(), System.Security.Cryptography.ECDsaCng.ImportKeyBlob(), System.Security.Cryptography.ECCurve.IsNamed, System.Security.Cryptography.ECCurve.IsPrime, System.Security.Cryptography.ECCurve.Oid, System.Security.Cryptography.ECDsaCng.ThrowIfDisposed(), System.Security.Cryptography.ECParameters.Validate(), and System.Security.Cryptography.Oid.Value.

Referenced by Internal.Cryptography.Pal.X509Pal.DecodeECDsaPublicKey().