187 {
188 global::Interop.BCrypt.KeyBlobMagicNumber magic = (global::Interop.BCrypt.KeyBlobMagicNumber)BitConverter.ToInt32(ecBlob, 0);
190 if (ecBlob.Length < sizeof(global::Interop.BCrypt.BCRYPT_ECCFULLKEY_BLOB))
191 {
192 throw global::Interop.NCrypt.ErrorCode.E_FAIL.ToCryptographicException();
193 }
194 fixed (byte* ptr = &ecBlob[0])
195 {
196 global::Interop.BCrypt.BCRYPT_ECCFULLKEY_BLOB* ptr2 = (global::Interop.BCrypt.BCRYPT_ECCFULLKEY_BLOB*)ptr;
197 ECCurve curve = default(ECCurve);
200 int offset =
sizeof(global::Interop.BCrypt.BCRYPT_ECCFULLKEY_BLOB);
201 curve.Prime = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbFieldLength);
202 curve.A = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbFieldLength);
203 curve.B = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbFieldLength);
204 curve.G = new ECPoint
205 {
206 X = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbFieldLength),
207 Y = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbFieldLength)
208 };
209 curve.Order = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbSubgroupOrder);
210 curve.Cofactor = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbCofactor);
211 curve.Seed = ((ptr2->cbSeed == 0) ?
null : global::
Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbSeed));
212 ecParams.Q = new ECPoint
213 {
214 X = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbFieldLength),
215 Y = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbFieldLength)
216 };
217 if (includePrivateParameters)
218 {
219 ecParams.D = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbSubgroupOrder);
220 }
221 ecParams.Curve = curve;
222 }
223 }
static ? HashAlgorithmName GetHashAlgorithmName(global::Interop.BCrypt.ECC_CURVE_ALG_ID_ENUM hashId)
static void CheckMagicValueOfKey(global::Interop.BCrypt.KeyBlobMagicNumber magic, bool includePrivateParameters)
static global::Interop.BCrypt.ECC_CURVE_TYPE_ENUM ConvertToCurveTypeEnum(ECCurve.ECCurveType value)