163 {
164 global::Interop.BCrypt.KeyBlobMagicNumber magic = (global::Interop.BCrypt.KeyBlobMagicNumber)BitConverter.ToInt32(ecBlob, 0);
166 if (ecBlob.Length < sizeof(global::Interop.BCrypt.BCRYPT_ECCKEY_BLOB))
167 {
168 throw global::Interop.NCrypt.ErrorCode.E_FAIL.ToCryptographicException();
169 }
170 fixed (byte* ptr = &ecBlob[0])
171 {
172 global::Interop.BCrypt.BCRYPT_ECCKEY_BLOB* ptr2 = (global::Interop.BCrypt.BCRYPT_ECCKEY_BLOB*)ptr;
173 int offset =
sizeof(global::Interop.BCrypt.BCRYPT_ECCKEY_BLOB);
174 ecParams.Q = new ECPoint
175 {
176 X = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbKey),
177 Y = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbKey)
178 };
179 if (includePrivateParameters)
180 {
181 ecParams.D = global::Interop.BCrypt.Consume(ecBlob, ref
offset, ptr2->cbKey);
182 }
183 }
184 }
static void CheckMagicValueOfKey(global::Interop.BCrypt.KeyBlobMagicNumber magic, bool includePrivateParameters)