// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
bytebType=br.ReadByte();// BLOBHEADER.bType: Expected to be 0x6 (PUBLICKEYBLOB) or 0x7 (PRIVATEKEYBLOB), though there's no check for backward compat reasons.
bytebVersion=br.ReadByte();// BLOBHEADER.bVersion: Expected to be 0x2, though there's no check for backward compat reasons.
br.ReadUInt16();// BLOBHEADER.wReserved
uintalgId=br.ReadUInt32();// BLOBHEADER.aiKeyAlg
uintmagic=br.ReadUInt32();// RSAPubKey.magic: Expected to be 0x31415352 ('RSA1') or 0x32415352 ('RSA2')
varbitLen=br.ReadUInt32();// Bit Length for Modulus
varpubExp=br.ReadUInt32();// Exponent
varmodulusLength=(int)(bitLen/8);
if(blob.Length-s_offsetToKeyData<modulusLength)
{
bytebType=br.ReadByte();// BLOBHEADER.bType: Expected to be 0x6 (PUBLICKEYBLOB) or 0x7 (PRIVATEKEYBLOB), though there's no check for backward compat reasons.
bytebVersion=br.ReadByte();// BLOBHEADER.bVersion: Expected to be 0x2, though there's no check for backward compat reasons.
br.ReadUInt16();// BLOBHEADER.wReserved
uintalgId=br.ReadUInt32();// BLOBHEADER.aiKeyAlg
uintmagic=br.ReadUInt32();// RSAPubKey.magic: Expected to be 0x31415352 ('RSA1') or 0x32415352 ('RSA2')
varbitLen=br.ReadUInt32();// Bit Length for Modulus
@@ -248,9 +250,9 @@ public static bool TryParseKey(ImmutableArray<byte> blob, out ImmutableArray<byt
/// Helper for RsaCryptoServiceProvider.ExportParameters()
/// Copied from https://github.com/dotnet/corefx/blob/5fe5f9aae7b2987adc7082f90712b265bee5eefc/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Shared.cs
bytebType=br.ReadByte();// BLOBHEADER.bType: Expected to be 0x6 (PUBLICKEYBLOB) or 0x7 (PRIVATEKEYBLOB), though there's no check for backward compat reasons.
bytebVersion=br.ReadByte();// BLOBHEADER.bVersion: Expected to be 0x2, though there's no check for backward compat reasons.