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

◆ ImportParameters()

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

Reimplemented from System.Security.Cryptography.ECDsa.

Definition at line 154 of file ECDsaImplementation.cs.

155 {
156 parameters.Validate();
158 ECCurve curve = parameters.Curve;
159 bool flag = parameters.D != null;
160 bool flag2 = parameters.Q.X != null && parameters.Q.Y != null;
161 if (curve.IsPrime)
162 {
163 if (!flag2 && flag)
164 {
165 byte[] array = new byte[parameters.D.Length];
166 ECParameters parameters2 = parameters;
167 parameters2.Q.X = array;
168 parameters2.Q.Y = array;
169 byte[] primeCurveBlob = ECCng.GetPrimeCurveBlob(ref parameters2, ecdh: false);
170 ImportFullKeyBlob(primeCurveBlob, includePrivateParameters: true);
171 }
172 else
173 {
174 byte[] primeCurveBlob2 = ECCng.GetPrimeCurveBlob(ref parameters, ecdh: false);
175 ImportFullKeyBlob(primeCurveBlob2, flag);
176 }
177 return;
178 }
179 if (curve.IsNamed)
180 {
181 if (string.IsNullOrEmpty(curve.Oid.FriendlyName))
182 {
183 throw new PlatformNotSupportedException(System.SR.Format(System.SR.Cryptography_InvalidCurveOid, curve.Oid.Value.ToString()));
184 }
185 if (!flag2 && flag)
186 {
187 byte[] array2 = new byte[parameters.D.Length];
188 ECParameters parameters3 = parameters;
189 parameters3.Q.X = array2;
190 parameters3.Q.Y = array2;
191 byte[] namedCurveBlob = ECCng.GetNamedCurveBlob(ref parameters3, ecdh: false);
192 ImportKeyBlob(namedCurveBlob, curve.Oid.FriendlyName, includePrivateParameters: true);
193 }
194 else
195 {
196 byte[] namedCurveBlob2 = ECCng.GetNamedCurveBlob(ref parameters, ecdh: false);
197 ImportKeyBlob(namedCurveBlob2, curve.Oid.FriendlyName, flag);
198 }
199 return;
200 }
201 throw new PlatformNotSupportedException(System.SR.Format(System.SR.Cryptography_CurveNotSupported, curve.CurveType.ToString()));
202 }
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)
void ImportFullKeyBlob(byte[] ecfullKeyBlob, 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.ECDsaImplementation.ECDsaCng.ImportFullKeyBlob(), System.Security.Cryptography.ECDsaImplementation.ECDsaCng.ImportKeyBlob(), System.Security.Cryptography.ECCurve.IsNamed, System.Security.Cryptography.ECCurve.IsPrime, System.Security.Cryptography.ECCurve.Oid, System.Security.Cryptography.ECDsaImplementation.ECDsaCng.ThrowIfDisposed(), System.Security.Cryptography.ECParameters.Validate(), and System.Security.Cryptography.Oid.Value.