private static ImmutableArray <byte> CreateSnPublicKeyBlob( byte type, byte version, uint algId, uint magic, uint bitLen, uint pubExp, byte[] pubKeyData) { var w = new BlobWriter(3 * sizeof(uint) + s_offsetToKeyData + pubKeyData.Length); w.WriteUInt32(AlgorithmId.RsaSign); w.WriteUInt32(AlgorithmId.Sha); w.WriteUInt32((uint)(s_offsetToKeyData + pubKeyData.Length)); w.WriteByte(type); w.WriteByte(version); w.WriteUInt16(0 /* 16 bits of reserved space in the spec */); w.WriteUInt32(algId); w.WriteUInt32(magic); w.WriteUInt32(bitLen); // re-add padding for exponent w.WriteUInt32(pubExp); w.WriteBytes(pubKeyData); return(w.ToImmutableArray()); }
private static ImmutableArray <byte> CreateSnPublicKeyBlob(byte type, byte version, ushort reserved, uint algId, uint magic, uint bitLen, uint pubExp, byte[] pubKeyData) { var w = new BlobWriter(3 * sizeof(uint) + s_offsetToKeyData + pubKeyData.Length); w.WriteUInt32(AlgorithmId.RsaSign); w.WriteUInt32(AlgorithmId.Sha); w.WriteUInt32((uint)(s_offsetToKeyData + pubKeyData.Length)); w.WriteByte(type); w.WriteByte(version); w.WriteUInt16(reserved); w.WriteUInt32(algId); w.WriteUInt32(magic); w.WriteUInt32(bitLen); w.WriteUInt32(pubExp); w.WriteBytes(pubKeyData); return(w.ToImmutableArray()); }