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

◆ GetPrimeCurveParameterBlob() [2/2]

static unsafe byte[] System.Security.Cryptography.ECCng.GetPrimeCurveParameterBlob ( ref ECCurve curve)
inlinestaticpackage

Definition at line 225 of file ECCng.cs.

226 {
227 int num = sizeof(global::Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER) + curve.Prime.Length + curve.A.Length + curve.B.Length + curve.G.X.Length + curve.G.Y.Length + curve.Order.Length + curve.Cofactor.Length + ((curve.Seed != null) ? curve.Seed.Length : 0);
228 byte[] array = new byte[num];
229 fixed (byte* ptr = &array[0])
230 {
231 global::Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER* ptr2 = (global::Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER*)ptr;
232 ptr2->Version = 1;
233 ptr2->cbCofactor = curve.Cofactor.Length;
234 ptr2->cbFieldLength = curve.A.Length;
235 ptr2->cbSeed = ((curve.Seed != null) ? curve.Seed.Length : 0);
236 ptr2->cbSubgroupOrder = curve.Order.Length;
237 ptr2->CurveGenerationAlgId = GetHashAlgorithmId(curve.Hash);
238 ptr2->CurveType = ConvertToCurveTypeEnum(curve.CurveType);
239 int offset = sizeof(global::Interop.BCrypt.BCRYPT_ECC_PARAMETER_HEADER);
240 global::Interop.BCrypt.Emit(array, ref offset, curve.Prime);
241 global::Interop.BCrypt.Emit(array, ref offset, curve.A);
242 global::Interop.BCrypt.Emit(array, ref offset, curve.B);
243 global::Interop.BCrypt.Emit(array, ref offset, curve.G.X);
244 global::Interop.BCrypt.Emit(array, ref offset, curve.G.Y);
245 global::Interop.BCrypt.Emit(array, ref offset, curve.Order);
246 global::Interop.BCrypt.Emit(array, ref offset, curve.Cofactor);
247 if (curve.Seed != null)
248 {
249 global::Interop.BCrypt.Emit(array, ref offset, curve.Seed);
250 }
251 }
252 return array;
253 }
static global::Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM GetHashAlgorithmId(HashAlgorithmName? name)
Definition ECCng.cs:9
static global::Interop.BCrypt.ECC_CURVE_TYPE_ENUM ConvertToCurveTypeEnum(ECCurve.ECCurveType value)
Definition ECCng.cs:297

References System.array, System.Security.Cryptography.ECCng.ConvertToCurveTypeEnum(), System.Security.Cryptography.ECCng.GetHashAlgorithmId(), and System.offset.