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

◆ Validate()

void System.Security.Cryptography.ECCurve.Validate ( )
inline

Definition at line 173 of file ECCurve.cs.

174 {
175 if (IsNamed)
176 {
178 {
179 throw new CryptographicException(System.SR.Cryptography_InvalidECNamedCurve);
180 }
181 if (Oid == null || (string.IsNullOrEmpty(Oid.FriendlyName) && string.IsNullOrEmpty(Oid.Value)))
182 {
183 throw new CryptographicException(System.SR.Cryptography_InvalidCurveOid);
184 }
185 }
186 else if (IsExplicit)
187 {
188 bool flag = false;
189 if (A == null || B == null || B.Length != A.Length || G.X == null || G.X.Length != A.Length || G.Y == null || G.Y.Length != A.Length || Order == null || Order.Length == 0 || Cofactor == null || Cofactor.Length == 0)
190 {
191 flag = true;
192 }
193 if (IsPrime)
194 {
195 if (!flag && (Prime == null || Prime.Length != A.Length))
196 {
197 flag = true;
198 }
199 if (flag)
200 {
201 throw new CryptographicException(System.SR.Cryptography_InvalidECPrimeCurve);
202 }
203 }
204 else if (IsCharacteristic2)
205 {
206 if (!flag && (Polynomial == null || Polynomial.Length == 0))
207 {
208 flag = true;
209 }
210 if (flag)
211 {
212 throw new CryptographicException(System.SR.Cryptography_InvalidECCharacteristic2Curve);
213 }
214 }
215 }
216 else if (HasAnyExplicitParameters() || Oid != null)
217 {
218 throw new CryptographicException(System.SR.Format(System.SR.Cryptography_CurveNotSupported, CurveType.ToString()));
219 }
220 }
static string Cryptography_CurveNotSupported
Definition SR.cs:64
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Cryptography_InvalidECPrimeCurve
Definition SR.cs:88
static string Cryptography_InvalidECCharacteristic2Curve
Definition SR.cs:86
static string Cryptography_InvalidECNamedCurve
Definition SR.cs:90
static string Cryptography_InvalidCurveOid
Definition SR.cs:66
Definition SR.cs:7

References System.Security.Cryptography.ECCurve.A, System.Security.Cryptography.ECCurve.B, System.Security.Cryptography.ECCurve.Cofactor, System.SR.Cryptography_CurveNotSupported, System.SR.Cryptography_InvalidCurveOid, System.SR.Cryptography_InvalidECCharacteristic2Curve, System.SR.Cryptography_InvalidECNamedCurve, System.SR.Cryptography_InvalidECPrimeCurve, System.Security.Cryptography.ECCurve.CurveType, System.SR.Format(), System.Security.Cryptography.Oid.FriendlyName, System.Security.Cryptography.ECCurve.G, System.Security.Cryptography.ECCurve.HasAnyExplicitParameters(), System.Security.Cryptography.ECCurve.IsCharacteristic2, System.Security.Cryptography.ECCurve.IsExplicit, System.Security.Cryptography.ECCurve.IsNamed, System.Security.Cryptography.ECCurve.IsPrime, System.Security.Cryptography.ECCurve.Order, System.Security.Cryptography.ECCurve.Polynomial, System.Security.Cryptography.ECCurve.Prime, System.Security.Cryptography.Oid.Value, System.Security.Cryptography.ECPoint.X, and System.Security.Cryptography.ECPoint.Y.

Referenced by System.Security.Cryptography.ECCngKey.GenerateKey(), System.Security.Cryptography.ECDiffieHellmanCng.GenerateKey(), System.Security.Cryptography.ECDsaCng.GenerateKey(), and System.Security.Cryptography.ECParameters.Validate().