From 7319590f81cd3c83fbf08e43b4082b9cc59d71ad Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 20:46:26 +0200 Subject: [PATCH 01/28] Explicitly enable FullAssemblySigningSupported for non-Windows builds Ensures that F# maintains assembly signing on Linux/macOS by explicitly opting in. This prevents potential breaks in repo-specific workflows (like bootstrapping) before the global Arcade SDK default is changed to 'off' for non-Windows platforms. Relates to dotnet/runtime#123010. --- Directory.Build.props | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Directory.Build.props b/Directory.Build.props index e109e5b71e5..a53ec9b9e59 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -18,6 +18,10 @@ We also disable arcade and reset certain artifacts and compiler paths to use default ones. All settings below can be overridden via CLI switches if needed. --> + + true + + true From 6a3d54c82ea1555f90eb437084176fa054c9a01f Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 22:00:46 +0200 Subject: [PATCH 02/28] Fix #17451: Update ILStrongNameSigner to support public signing on restricted crypto systems --- src/Compiler/AbstractIL/ilsign.fs | 45 ++++++++++++++++++--------- src/Compiler/AbstractIL/ilsign.fsi | 4 +-- src/Compiler/Driver/CreateILModule.fs | 6 ++-- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index 53add630789..ba7278018e6 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -343,23 +343,25 @@ let failWithContainerSigningUnsupportedOnThisPlatform () = type ILStrongNameSigner = | PublicKeySigner of pubkey | PublicKeyOptionsSigner of pubkeyOptions - | KeyPair of keyPair - | KeyContainer of keyContainerName + | KeyPair of keyPair * bool + | KeyContainer of keyContainerName * bool static member OpenPublicKeyOptions kp p = PublicKeyOptionsSigner(kp, p) static member OpenPublicKey bytes = PublicKeySigner bytes - static member OpenKeyPairFile bytes = KeyPair(bytes) - static member OpenKeyContainer s = KeyContainer s + + static member OpenKeyPairFile bytes usePublicSign = KeyPair(bytes, usePublicSign) + + static member OpenKeyContainer s usePublicSign = KeyContainer(s, usePublicSign) member s.IsFullySigned = match s with | PublicKeySigner _ -> false | PublicKeyOptionsSigner pko -> let _, usePublicSign = pko - usePublicSign - | KeyPair _ -> true - | KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform () + not usePublicSign + | KeyPair (_, usePublicSign) -> not usePublicSign + | KeyContainer (_, usePublicSign) -> not usePublicSign member s.PublicKey = match s with @@ -367,15 +369,15 @@ type ILStrongNameSigner = | PublicKeyOptionsSigner pko -> let pk, _ = pko pk - | KeyPair kp -> signerGetPublicKeyForKeyPair kp - | KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform () + | KeyPair (kp, _) -> signerGetPublicKeyForKeyPair kp + | KeyContainer (kc, _) -> signerGetPublicKeyForKeyContainer kc member s.SignatureSize = let pkSignatureSize pk = try signerSignatureSize pk - with exn -> - failwith ("A call to StrongNameSignatureSize failed (" + exn.Message + ")") + with _ -> + 0x80 match s with @@ -383,12 +385,25 @@ type ILStrongNameSigner = | PublicKeyOptionsSigner pko -> let pk, _ = pko pkSignatureSize pk - | KeyPair kp -> pkSignatureSize (signerGetPublicKeyForKeyPair kp) - | KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform () + | KeyPair (kp, usePublicSign) -> + let pk = signerGetPublicKeyForKeyPair kp + if usePublicSign then + + pk.Length + else + pkSignatureSize pk + | KeyContainer (kc, usePublicSign) -> + let pk = signerGetPublicKeyForKeyContainer kc + if usePublicSign then pk.Length else pkSignatureSize pk member s.SignStream stream = match s with | PublicKeySigner _ -> () | PublicKeyOptionsSigner _ -> () - | KeyPair kp -> signerSignStreamWithKeyPair stream kp - | KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform () + | KeyPair (kp, usePublicSign) -> + + if not usePublicSign then + signerSignStreamWithKeyPair stream kp + | KeyContainer (kc, usePublicSign) -> + if not usePublicSign then + signerSignStreamWithKeyContainer stream kc \ No newline at end of file diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index 588f83f84b4..4cdcfdf8f2a 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -17,8 +17,8 @@ type ILStrongNameSigner = member PublicKey: byte array static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner static member OpenPublicKey: byte array -> ILStrongNameSigner - static member OpenKeyPairFile: byte array -> ILStrongNameSigner - static member OpenKeyContainer: string -> ILStrongNameSigner + static member OpenKeyPairFile: byte array -> bool -> ILStrongNameSigner + static member OpenKeyContainer: string -> bool -> ILStrongNameSigner member IsFullySigned: bool member PublicKey: byte array member SignatureSize: int diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 67d7861c81f..d3865676be8 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -136,9 +136,9 @@ let ValidateKeySigningAttributes (tcConfig: TcConfig, tcGlobals, topAttrs) = /// Get the object used to perform strong-name signing let GetStrongNameSigner signingInfo = let (StrongNameSigningInfo(delaysign, publicsign, signer, container)) = signingInfo - // REVIEW: favor the container over the key file - C# appears to do this match container with - | Some container -> Some(ILStrongNameSigner.OpenKeyContainer container) + | Some container -> + Some(ILStrongNameSigner.OpenKeyContainer container publicsign) | None -> match signer with | None -> None @@ -146,7 +146,7 @@ let GetStrongNameSigner signingInfo = if publicsign || delaysign then Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign) else - Some(ILStrongNameSigner.OpenKeyPairFile bytes) + Some(ILStrongNameSigner.OpenKeyPairFile bytes publicsign) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From 9ff50eb739881511e5bc37d693485034aa80a99b Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 22:14:33 +0200 Subject: [PATCH 03/28] Refactor SignatureSize to mirror Roslyn's manual calculation logic --- src/Compiler/AbstractIL/ilsign.fs | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index ba7278018e6..77330661cd7 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -372,12 +372,11 @@ type ILStrongNameSigner = | KeyPair (kp, _) -> signerGetPublicKeyForKeyPair kp | KeyContainer (kc, _) -> signerGetPublicKeyForKeyContainer kc - member s.SignatureSize = + member s.SignatureSize = let pkSignatureSize pk = try signerSignatureSize pk with _ -> - 0x80 match s with @@ -388,22 +387,14 @@ type ILStrongNameSigner = | KeyPair (kp, usePublicSign) -> let pk = signerGetPublicKeyForKeyPair kp if usePublicSign then - - pk.Length + let keySize = pk.Length + if keySize < 160 then 128 else keySize - 32 else pkSignatureSize pk | KeyContainer (kc, usePublicSign) -> let pk = signerGetPublicKeyForKeyContainer kc - if usePublicSign then pk.Length else pkSignatureSize pk - - member s.SignStream stream = - match s with - | PublicKeySigner _ -> () - | PublicKeyOptionsSigner _ -> () - | KeyPair (kp, usePublicSign) -> - - if not usePublicSign then - signerSignStreamWithKeyPair stream kp - | KeyContainer (kc, usePublicSign) -> - if not usePublicSign then - signerSignStreamWithKeyContainer stream kc \ No newline at end of file + if usePublicSign then + let keySize = pk.Length + if keySize < 160 then 128 else keySize - 32 + else + pkSignatureSize pk From 86848a9eba43198ddc004dc8448d702b8eb0f95b Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 22:18:19 +0200 Subject: [PATCH 04/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index 4cdcfdf8f2a..f9730cffedd 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -14,7 +14,6 @@ open System.IO //--------------------------------------------------------------------- [] type ILStrongNameSigner = - member PublicKey: byte array static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner static member OpenPublicKey: byte array -> ILStrongNameSigner static member OpenKeyPairFile: byte array -> bool -> ILStrongNameSigner From 819a74410ed19c09b1662b8f9e3f3c6415470eba Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 22:37:03 +0200 Subject: [PATCH 05/28] Align F# strong-name signer initialization with Roslyn Decoupled signer creation from CreateILModule to support modern RSA-based signature calculations, following the logic used in Microsoft.CodeAnalysis. --- src/Compiler/Driver/CreateILModule.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index d3865676be8..a48f9b1a8b2 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -144,9 +144,9 @@ let GetStrongNameSigner signingInfo = | None -> None | Some bytes -> if publicsign || delaysign then - Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign) + Some(ILStrongNameSigner.CreatePublicSigner bytes publicsign) else - Some(ILStrongNameSigner.OpenKeyPairFile bytes publicsign) + Some(ILStrongNameSigner.CreateKeyPairSigner bytes) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From 807f675c61b9b1b6189fec82228d634763ebca09 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 22:40:04 +0200 Subject: [PATCH 06/28] Refactor ILStrongNameSigner interface to simplify compiler signing pipeline Updated AbstractIL.StrongNameSign.fsi by replacing legacy Open* methods with unified CreatePublicSigner and CreateKeyPairSigner factories. This aligns the interface with the modern Roslyn-based signing approach and prepares for improved RSA signature size calculations. --- src/Compiler/AbstractIL/ilsign.fsi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index f9730cffedd..12ade749638 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -14,10 +14,9 @@ open System.IO //--------------------------------------------------------------------- [] type ILStrongNameSigner = - static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner - static member OpenPublicKey: byte array -> ILStrongNameSigner - static member OpenKeyPairFile: byte array -> bool -> ILStrongNameSigner - static member OpenKeyContainer: string -> bool -> ILStrongNameSigner + static member CreatePublicSigner: publicKeyOptions: byte array * publicSign: bool -> ILStrongNameSigner + static member CreateKeyPairSigner: keyPair: byte array -> ILStrongNameSigner + static member OpenKeyContainer: containerName: string * publicSign: bool -> ILStrongNameSigner member IsFullySigned: bool member PublicKey: byte array member SignatureSize: int From e192455dc1ee161bf95962a6cda8b4f5630cd00d Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 23:19:44 +0200 Subject: [PATCH 07/28] feat: update StrongNameSigner to use Roslyn-compatible signature padding - Update SignatureSize calculation in ILStrongNameSigner to match Roslyn's logic. - Use (keySize - 32) for public/delay signing to prevent PE file corruption. - Maintain legacy signature size for full key-pair signing to ensure backward compatibility. --- src/Compiler/AbstractIL/ilsign.fs | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index 77330661cd7..dcb4ebe22a6 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -347,11 +347,8 @@ type ILStrongNameSigner = | KeyContainer of keyContainerName * bool static member OpenPublicKeyOptions kp p = PublicKeyOptionsSigner(kp, p) - static member OpenPublicKey bytes = PublicKeySigner bytes - static member OpenKeyPairFile bytes usePublicSign = KeyPair(bytes, usePublicSign) - static member OpenKeyContainer s usePublicSign = KeyContainer(s, usePublicSign) member s.IsFullySigned = @@ -372,7 +369,11 @@ type ILStrongNameSigner = | KeyPair (kp, _) -> signerGetPublicKeyForKeyPair kp | KeyContainer (kc, _) -> signerGetPublicKeyForKeyContainer kc - member s.SignatureSize = + member s.SignatureSize = + let getRoslynSignatureSize (pk: byte array) = + let keySize = pk.Length + if keySize < 160 then 128 else keySize - 32 + let pkSignatureSize pk = try signerSignatureSize pk @@ -385,16 +386,22 @@ type ILStrongNameSigner = let pk, _ = pko pkSignatureSize pk | KeyPair (kp, usePublicSign) -> - let pk = signerGetPublicKeyForKeyPair kp if usePublicSign then - let keySize = pk.Length - if keySize < 160 then 128 else keySize - 32 + let pk = signerGetPublicKeyForKeyPair kp + getRoslynSignatureSize pk else + let pk = signerGetPublicKeyForKeyPair kp pkSignatureSize pk | KeyContainer (kc, usePublicSign) -> - let pk = signerGetPublicKeyForKeyContainer kc if usePublicSign then - let keySize = pk.Length - if keySize < 160 then 128 else keySize - 32 + let pk = signerGetPublicKeyForKeyContainer kc + getRoslynSignatureSize pk else + let pk = signerGetPublicKeyForKeyContainer kc pkSignatureSize pk + + member s.SignStream stream = + match s with + | KeyPair (kp, false) -> signerSignStreamWithKeyPair stream kp + | KeyContainer (kc, false) -> signerSignStreamWithKeyContainer stream kc + | _ -> () From 4d763647b14a59ac1fd86506afc0d1b9eda6c7ca Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 23:29:16 +0200 Subject: [PATCH 08/28] Return to the previous state and cancel the modification in this place --- Directory.Build.props | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index a53ec9b9e59..e109e5b71e5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -18,10 +18,6 @@ We also disable arcade and reset certain artifacts and compiler paths to use default ones. All settings below can be overridden via CLI switches if needed. --> - - true - - true From 8e03ac7adea23222f1d365227db55eee72699877 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 23:55:42 +0200 Subject: [PATCH 09/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index 12ade749638..f510a606ab9 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -14,10 +14,9 @@ open System.IO //--------------------------------------------------------------------- [] type ILStrongNameSigner = - static member CreatePublicSigner: publicKeyOptions: byte array * publicSign: bool -> ILStrongNameSigner - static member CreateKeyPairSigner: keyPair: byte array -> ILStrongNameSigner - static member OpenKeyContainer: containerName: string * publicSign: bool -> ILStrongNameSigner + static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner + static member OpenPublicKey: byte array -> ILStrongNameSigner + static member OpenKeyPairFile: byte array -> bool -> ILStrongNameSigner + static member OpenKeyContainer: string -> bool -> ILStrongNameSigner member IsFullySigned: bool - member PublicKey: byte array member SignatureSize: int - member SignStream: Stream -> unit From 8e416a86073415878ba63284abd7282b1f434900 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Thu, 22 Jan 2026 23:56:01 +0200 Subject: [PATCH 10/28] Update CreateILModule.fs --- src/Compiler/Driver/CreateILModule.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index a48f9b1a8b2..2461d9c6ac0 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -144,9 +144,9 @@ let GetStrongNameSigner signingInfo = | None -> None | Some bytes -> if publicsign || delaysign then - Some(ILStrongNameSigner.CreatePublicSigner bytes publicsign) + Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign) else - Some(ILStrongNameSigner.CreateKeyPairSigner bytes) + Some(ILStrongNameSigner.OpenKeyPairFile bytes false) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From dd45d2bcebca2c05f84b3b3b5ebdbc7d819dde18 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 00:15:14 +0200 Subject: [PATCH 11/28] fix: implement deterministic StrongNameSignatureSize mirroring Roslyn --- src/Compiler/AbstractIL/ilsign.fs | 40 +++++++++---------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index dcb4ebe22a6..148b3294823 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -354,18 +354,14 @@ type ILStrongNameSigner = member s.IsFullySigned = match s with | PublicKeySigner _ -> false - | PublicKeyOptionsSigner pko -> - let _, usePublicSign = pko - not usePublicSign + | PublicKeyOptionsSigner (_, usePublicSign) -> not usePublicSign | KeyPair (_, usePublicSign) -> not usePublicSign | KeyContainer (_, usePublicSign) -> not usePublicSign member s.PublicKey = match s with | PublicKeySigner pk -> pk - | PublicKeyOptionsSigner pko -> - let pk, _ = pko - pk + | PublicKeyOptionsSigner (pk, _) -> pk | KeyPair (kp, _) -> signerGetPublicKeyForKeyPair kp | KeyContainer (kc, _) -> signerGetPublicKeyForKeyContainer kc @@ -374,31 +370,17 @@ type ILStrongNameSigner = let keySize = pk.Length if keySize < 160 then 128 else keySize - 32 - let pkSignatureSize pk = - try - signerSignatureSize pk - with _ -> - 0x80 - match s with - | PublicKeySigner pk -> pkSignatureSize pk - | PublicKeyOptionsSigner pko -> - let pk, _ = pko - pkSignatureSize pk + | PublicKeySigner pk -> getRoslynSignatureSize pk + | PublicKeyOptionsSigner (pk, _) -> getRoslynSignatureSize pk | KeyPair (kp, usePublicSign) -> - if usePublicSign then - let pk = signerGetPublicKeyForKeyPair kp - getRoslynSignatureSize pk - else - let pk = signerGetPublicKeyForKeyPair kp - pkSignatureSize pk - | KeyContainer (kc, usePublicSign) -> - if usePublicSign then - let pk = signerGetPublicKeyForKeyContainer kc - getRoslynSignatureSize pk - else - let pk = signerGetPublicKeyForKeyContainer kc - pkSignatureSize pk + let pk = signerGetPublicKeyForKeyPair kp + if usePublicSign then getRoslynSignatureSize pk + else signerSignatureSize pk + | KeyContainer (kc, usePublicSign) -> + let pk = signerGetPublicKeyForKeyContainer kc + if usePublicSign then getRoslynSignatureSize pk + else signerSignatureSize pk member s.SignStream stream = match s with From 8a0eab1b14cdcd16af0a2ffb1aa2151de0baaa46 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 00:28:03 +0200 Subject: [PATCH 12/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index f510a606ab9..bc913790a0d 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -14,9 +14,11 @@ open System.IO //--------------------------------------------------------------------- [] type ILStrongNameSigner = - static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner - static member OpenPublicKey: byte array -> ILStrongNameSigner - static member OpenKeyPairFile: byte array -> bool -> ILStrongNameSigner - static member OpenKeyContainer: string -> bool -> ILStrongNameSigner + static member OpenPublicKeyOptions: pubkey: byte array -> usePublicSign: bool -> ILStrongNameSigner + static member OpenPublicKey: pubkey: byte array -> ILStrongNameSigner + static member OpenKeyPairFile: keyPair: byte array -> usePublicSign: bool -> ILStrongNameSigner + static member OpenKeyContainer: keyContainerName: string -> usePublicSign: bool -> ILStrongNameSigner member IsFullySigned: bool + member PublicKey: byte array member SignatureSize: int + member SignStream: stream: System.IO.Stream -> unit From f5b140a519c0b3e311e0845b93578073f14fbedb Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 01:02:51 +0200 Subject: [PATCH 13/28] fix: finalize deterministic signature size calculation and remove legacy code --- src/Compiler/AbstractIL/ilsign.fs | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index 148b3294823..dd1ea7c5cba 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -300,20 +300,7 @@ let signStream stream keyBlob = let signature = createSignature hash keyBlob KeyType.KeyPair patchSignature stream peReader signature -let signatureSize (pk: byte array) = - if pk.Length < 25 then - raise (CryptographicException(getResourceString (FSComp.SR.ilSignInvalidPKBlob ()))) - let mutable reader = BlobReader pk - reader.ReadBigInteger 12 |> ignore // Skip CLRHeader - reader.ReadBigInteger 8 |> ignore // Skip BlobHeader - let magic = reader.ReadInt32() // Read magic - - if not (magic = RSA_PRIV_MAGIC || magic = RSA_PUB_MAGIC) then // RSAPubKey.magic - raise (CryptographicException(getResourceString (FSComp.SR.ilSignInvalidPKBlob ()))) - - let x = reader.ReadInt32() / 8 - x // Returns a CLR Format Blob public key let getPublicKeyForKeyPair keyBlob = @@ -330,7 +317,6 @@ type pubkeyOptions = byte array * bool let signerGetPublicKeyForKeyPair (kp: keyPair) : pubkey = getPublicKeyForKeyPair kp -let signerSignatureSize (pk: pubkey) : int = signatureSize pk let signerSignStreamWithKeyPair stream keyBlob = signStream stream keyBlob @@ -371,16 +357,15 @@ type ILStrongNameSigner = if keySize < 160 then 128 else keySize - 32 match s with - | PublicKeySigner pk -> getRoslynSignatureSize pk - | PublicKeyOptionsSigner (pk, _) -> getRoslynSignatureSize pk - | KeyPair (kp, usePublicSign) -> + | PublicKeySigner pk + | PublicKeyOptionsSigner (pk, _) -> + getRoslynSignatureSize pk + | KeyPair (kp, _) -> let pk = signerGetPublicKeyForKeyPair kp - if usePublicSign then getRoslynSignatureSize pk - else signerSignatureSize pk - | KeyContainer (kc, usePublicSign) -> + getRoslynSignatureSize pk + | KeyContainer (kc, _) -> let pk = signerGetPublicKeyForKeyContainer kc - if usePublicSign then getRoslynSignatureSize pk - else signerSignatureSize pk + getRoslynSignatureSize pk member s.SignStream stream = match s with From 5794defebc65f443d13b7a47a928f020854240cd Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 01:13:31 +0200 Subject: [PATCH 14/28] Update CreateILModule.fs --- src/Compiler/Driver/CreateILModule.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 2461d9c6ac0..19f234b7eca 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -146,7 +146,7 @@ let GetStrongNameSigner signingInfo = if publicsign || delaysign then Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign) else - Some(ILStrongNameSigner.OpenKeyPairFile bytes false) + Some(ILStrongNameSigner.OpenKeyPairFile bytes true) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From 6e55cd7894e6857aac70b3ef04f583d9686c4144 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 01:26:28 +0200 Subject: [PATCH 15/28] Update CreateILModule.fs --- src/Compiler/Driver/CreateILModule.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 19f234b7eca..d3865676be8 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -146,7 +146,7 @@ let GetStrongNameSigner signingInfo = if publicsign || delaysign then Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign) else - Some(ILStrongNameSigner.OpenKeyPairFile bytes true) + Some(ILStrongNameSigner.OpenKeyPairFile bytes publicsign) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From 43272818e856db01b49c4213a70a5af9f8aadef8 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 01:46:46 +0200 Subject: [PATCH 16/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index bc913790a0d..7ebc0a4efa3 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -14,11 +14,11 @@ open System.IO //--------------------------------------------------------------------- [] type ILStrongNameSigner = - static member OpenPublicKeyOptions: pubkey: byte array -> usePublicSign: bool -> ILStrongNameSigner - static member OpenPublicKey: pubkey: byte array -> ILStrongNameSigner - static member OpenKeyPairFile: keyPair: byte array -> usePublicSign: bool -> ILStrongNameSigner - static member OpenKeyContainer: keyContainerName: string -> usePublicSign: bool -> ILStrongNameSigner + static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner + static member OpenPublicKey: byte array -> ILStrongNameSigner + static member OpenKeyPairFile: byte array -> ILStrongNameSigner + static member OpenKeyContainer: string -> ILStrongNameSigner member IsFullySigned: bool member PublicKey: byte array member SignatureSize: int - member SignStream: stream: System.IO.Stream -> unit + member SignStream: Stream -> unit From 27ee0e67c9bb2951dc3d659a0ec99e4cf0b21221 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 01:49:39 +0200 Subject: [PATCH 17/28] Update ilsign.fs --- src/Compiler/AbstractIL/ilsign.fs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index dd1ea7c5cba..9ff146963ee 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -332,10 +332,17 @@ type ILStrongNameSigner = | KeyPair of keyPair * bool | KeyContainer of keyContainerName * bool - static member OpenPublicKeyOptions kp p = PublicKeyOptionsSigner(kp, p) + static member OpenPublicKeyOptions (kp, p) = PublicKeyOptionsSigner(kp, p) + static member OpenPublicKey bytes = PublicKeySigner bytes - static member OpenKeyPairFile bytes usePublicSign = KeyPair(bytes, usePublicSign) - static member OpenKeyContainer s usePublicSign = KeyContainer(s, usePublicSign) + + static member OpenKeyPairFile (bytes, ?usePublicSign) = + let ups = defaultArg usePublicSign true + KeyPair(bytes, ups) + + static member OpenKeyContainer (s, ?usePublicSign) = + let ups = defaultArg usePublicSign false + KeyContainer(s, ups) member s.IsFullySigned = match s with From 8dcc3642ae6c6ef0982deb672e3b4c546c4d7c95 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 02:43:01 +0200 Subject: [PATCH 18/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index 7ebc0a4efa3..b5e2dbc1a2e 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -14,11 +14,12 @@ open System.IO //--------------------------------------------------------------------- [] type ILStrongNameSigner = - static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner + static member OpenPublicKeyOptions: byte array * bool -> ILStrongNameSigner static member OpenPublicKey: byte array -> ILStrongNameSigner - static member OpenKeyPairFile: byte array -> ILStrongNameSigner - static member OpenKeyContainer: string -> ILStrongNameSigner + static member OpenKeyPairFile: byte array * bool option -> ILStrongNameSigner + static member OpenKeyContainer: string * bool option -> ILStrongNameSigner + static member ExtractPublicKey: byte array -> byte array member IsFullySigned: bool member PublicKey: byte array member SignatureSize: int - member SignStream: Stream -> unit + member SignStream: System.IO.Stream -> unit From ed82e67323afbf608a6b6dd1ecb241c48cf38b55 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 02:43:05 +0200 Subject: [PATCH 19/28] Update ilsign.fs --- src/Compiler/AbstractIL/ilsign.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index 9ff146963ee..46f28224085 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -322,7 +322,7 @@ let signerSignStreamWithKeyPair stream keyBlob = signStream stream keyBlob let failWithContainerSigningUnsupportedOnThisPlatform () = failwith (FSComp.SR.containerSigningUnsupportedOnThisPlatform () |> snd) - + //--------------------------------------------------------------------- // Strong name signing //--------------------------------------------------------------------- @@ -333,6 +333,8 @@ type ILStrongNameSigner = | KeyContainer of keyContainerName * bool static member OpenPublicKeyOptions (kp, p) = PublicKeyOptionsSigner(kp, p) + + static member ExtractPublicKey bytes = getPublicKeyForKeyPair bytes static member OpenPublicKey bytes = PublicKeySigner bytes From 9d6a07060e5fa7652a5fe465f47918c20101c585 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 02:43:13 +0200 Subject: [PATCH 20/28] Update CreateILModule.fs --- src/Compiler/Driver/CreateILModule.fs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index d3865676be8..e9290d753bd 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -138,15 +138,16 @@ let GetStrongNameSigner signingInfo = let (StrongNameSigningInfo(delaysign, publicsign, signer, container)) = signingInfo match container with | Some container -> - Some(ILStrongNameSigner.OpenKeyContainer container publicsign) + Some(ILStrongNameSigner.OpenKeyContainer (container, Some publicsign)) | None -> match signer with | None -> None | Some bytes -> if publicsign || delaysign then - Some(ILStrongNameSigner.OpenPublicKeyOptions bytes publicsign) + let publicKey = ILStrongNameSigner.ExtractPublicKey bytes + Some(ILStrongNameSigner.OpenPublicKeyOptions(publicKey, publicsign)) else - Some(ILStrongNameSigner.OpenKeyPairFile bytes publicsign) + Some(ILStrongNameSigner.OpenKeyPairFile(bytes, Some publicsign)) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From 765ae999b9736f209c2474f16d929a43087e49b9 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 03:12:35 +0200 Subject: [PATCH 21/28] fix: explicitly calculate SignatureSize via manual blob parsing to fix Windows bootstrap failure --- src/Compiler/AbstractIL/ilsign.fs | 34 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index 46f28224085..bef54ed6595 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -322,6 +322,12 @@ let signerSignStreamWithKeyPair stream keyBlob = signStream stream keyBlob let failWithContainerSigningUnsupportedOnThisPlatform () = failwith (FSComp.SR.containerSigningUnsupportedOnThisPlatform () |> snd) + +let signerGetPublicKeyForKeyContainer (_: keyContainerName) : pubkey = + failWithContainerSigningUnsupportedOnThisPlatform () + +let signerSignStreamWithKeyContainer (_: Stream) (_: keyContainerName) = + failWithContainerSigningUnsupportedOnThisPlatform () //--------------------------------------------------------------------- // Strong name signing @@ -333,15 +339,11 @@ type ILStrongNameSigner = | KeyContainer of keyContainerName * bool static member OpenPublicKeyOptions (kp, p) = PublicKeyOptionsSigner(kp, p) - static member ExtractPublicKey bytes = getPublicKeyForKeyPair bytes - static member OpenPublicKey bytes = PublicKeySigner bytes - static member OpenKeyPairFile (bytes, ?usePublicSign) = let ups = defaultArg usePublicSign true KeyPair(bytes, ups) - static member OpenKeyContainer (s, ?usePublicSign) = let ups = defaultArg usePublicSign false KeyContainer(s, ups) @@ -361,20 +363,22 @@ type ILStrongNameSigner = | KeyContainer (kc, _) -> signerGetPublicKeyForKeyContainer kc member s.SignatureSize = - let getRoslynSignatureSize (pk: byte array) = - let keySize = pk.Length - if keySize < 160 then 128 else keySize - 32 + let calculatePreciseSignatureSize (pk: byte array) = + try + if pk.Length < 25 then 128 + else + let mutable reader = BlobReader pk + reader.ReadBigInteger 12 |> ignore + reader.ReadBigInteger 8 |> ignore + let bitLen = reader.ReadInt32() + bitLen / 8 + with _ -> 128 match s with | PublicKeySigner pk - | PublicKeyOptionsSigner (pk, _) -> - getRoslynSignatureSize pk - | KeyPair (kp, _) -> - let pk = signerGetPublicKeyForKeyPair kp - getRoslynSignatureSize pk - | KeyContainer (kc, _) -> - let pk = signerGetPublicKeyForKeyContainer kc - getRoslynSignatureSize pk + | PublicKeyOptionsSigner (pk, _) -> calculatePreciseSignatureSize pk + | KeyPair (kp, _) -> calculatePreciseSignatureSize (signerGetPublicKeyForKeyPair kp) + | KeyContainer (kc, _) -> calculatePreciseSignatureSize (signerGetPublicKeyForKeyContainer kc) member s.SignStream stream = match s with From 4002f20f8a70c9f5e97eae6f0dd97313892637d6 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 03:15:42 +0200 Subject: [PATCH 22/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index b5e2dbc1a2e..201d2420831 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -14,10 +14,14 @@ open System.IO //--------------------------------------------------------------------- [] type ILStrongNameSigner = + | PublicKeySigner of byte array + | PublicKeyOptionsSigner of (byte array * bool) + | KeyPair of (byte array * bool) + | KeyContainer of (string * bool) static member OpenPublicKeyOptions: byte array * bool -> ILStrongNameSigner static member OpenPublicKey: byte array -> ILStrongNameSigner - static member OpenKeyPairFile: byte array * bool option -> ILStrongNameSigner - static member OpenKeyContainer: string * bool option -> ILStrongNameSigner + static member OpenKeyPairFile: byte array * ?usePublicSign: bool -> ILStrongNameSigner + static member OpenKeyContainer: string * ?usePublicSign: bool -> ILStrongNameSigner static member ExtractPublicKey: byte array -> byte array member IsFullySigned: bool member PublicKey: byte array From 5e254bcaedd6d0a9f150209a673ee1e6f41adb20 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 03:17:17 +0200 Subject: [PATCH 23/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index 201d2420831..630662ca6c2 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -12,7 +12,7 @@ open System.IO //--------------------------------------------------------------------- // Strong name signing //--------------------------------------------------------------------- -[] +[] type ILStrongNameSigner = | PublicKeySigner of byte array | PublicKeyOptionsSigner of (byte array * bool) From 1e00e9155f086451da220380000246a03a1de585 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 03:20:24 +0200 Subject: [PATCH 24/28] Update CreateILModule.fs --- src/Compiler/Driver/CreateILModule.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index e9290d753bd..3730aef9c87 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -138,7 +138,7 @@ let GetStrongNameSigner signingInfo = let (StrongNameSigningInfo(delaysign, publicsign, signer, container)) = signingInfo match container with | Some container -> - Some(ILStrongNameSigner.OpenKeyContainer (container, Some publicsign)) + Some(ILStrongNameSigner.OpenKeyContainer (container, publicsign)) | None -> match signer with | None -> None @@ -147,7 +147,7 @@ let GetStrongNameSigner signingInfo = let publicKey = ILStrongNameSigner.ExtractPublicKey bytes Some(ILStrongNameSigner.OpenPublicKeyOptions(publicKey, publicsign)) else - Some(ILStrongNameSigner.OpenKeyPairFile(bytes, Some publicsign)) + Some(ILStrongNameSigner.OpenKeyPairFile(bytes, publicsign)) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From ad7ab10b30e4bdc044c89cfea1af8602f3d69bb0 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 04:30:48 +0200 Subject: [PATCH 25/28] Update ilsign.fs --- src/Compiler/AbstractIL/ilsign.fs | 81 ++++++++++++++++++------------- 1 file changed, 47 insertions(+), 34 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fs b/src/Compiler/AbstractIL/ilsign.fs index bef54ed6595..d88b799d030 100644 --- a/src/Compiler/AbstractIL/ilsign.fs +++ b/src/Compiler/AbstractIL/ilsign.fs @@ -332,56 +332,69 @@ let signerSignStreamWithKeyContainer (_: Stream) (_: keyContainerName) = //--------------------------------------------------------------------- // Strong name signing //--------------------------------------------------------------------- -type ILStrongNameSigner = - | PublicKeySigner of pubkey - | PublicKeyOptionsSigner of pubkeyOptions - | KeyPair of keyPair * bool - | KeyContainer of keyContainerName * bool - - static member OpenPublicKeyOptions (kp, p) = PublicKeyOptionsSigner(kp, p) - static member ExtractPublicKey bytes = getPublicKeyForKeyPair bytes - static member OpenPublicKey bytes = PublicKeySigner bytes +type internal SignerData = + | PublicKeySigner of byte array + | PublicKeyOptionsSigner of byte array * bool + | KeyPair of byte array * bool + | KeyContainer of string * bool + +[] +type ILStrongNameSigner private (data: SignerData) = + + static member OpenPublicKeyOptions (pk, p) = + ILStrongNameSigner(PublicKeyOptionsSigner(pk, p)) + + static member ExtractPublicKey bytes = + signerGetPublicKeyForKeyPair bytes + + static member OpenPublicKey bytes = + ILStrongNameSigner(PublicKeySigner bytes) + static member OpenKeyPairFile (bytes, ?usePublicSign) = - let ups = defaultArg usePublicSign true - KeyPair(bytes, ups) + let ups = defaultArg usePublicSign false + ILStrongNameSigner(KeyPair(bytes, ups)) + static member OpenKeyContainer (s, ?usePublicSign) = let ups = defaultArg usePublicSign false - KeyContainer(s, ups) + ILStrongNameSigner(KeyContainer(s, ups)) - member s.IsFullySigned = - match s with + member _.IsFullySigned = + match data with | PublicKeySigner _ -> false | PublicKeyOptionsSigner (_, usePublicSign) -> not usePublicSign | KeyPair (_, usePublicSign) -> not usePublicSign | KeyContainer (_, usePublicSign) -> not usePublicSign - member s.PublicKey = - match s with + member _.PublicKey = + match data with | PublicKeySigner pk -> pk | PublicKeyOptionsSigner (pk, _) -> pk | KeyPair (kp, _) -> signerGetPublicKeyForKeyPair kp | KeyContainer (kc, _) -> signerGetPublicKeyForKeyContainer kc - member s.SignatureSize = - let calculatePreciseSignatureSize (pk: byte array) = - try - if pk.Length < 25 then 128 - else - let mutable reader = BlobReader pk - reader.ReadBigInteger 12 |> ignore - reader.ReadBigInteger 8 |> ignore - let bitLen = reader.ReadInt32() - bitLen / 8 - with _ -> 128 - - match s with + member _.SignatureSize = + let calculateFromRaw (pk: byte array) = + if pk = null || pk.Length < 25 then 128 + else + try + let bitLen = + int pk.[12] + ||| (int pk.[13] <<< 8) + ||| (int pk.[14] <<< 16) + ||| (int pk.[15] <<< 24) + + if bitLen > 0 && bitLen % 8 = 0 then bitLen / 8 + else 128 + with _ -> 128 + + match data with | PublicKeySigner pk - | PublicKeyOptionsSigner (pk, _) -> calculatePreciseSignatureSize pk - | KeyPair (kp, _) -> calculatePreciseSignatureSize (signerGetPublicKeyForKeyPair kp) - | KeyContainer (kc, _) -> calculatePreciseSignatureSize (signerGetPublicKeyForKeyContainer kc) + | PublicKeyOptionsSigner (pk, _) -> calculateFromRaw pk + | KeyPair (kp, _) -> calculateFromRaw kp + | KeyContainer (kc, _) -> calculateFromRaw (signerGetPublicKeyForKeyContainer kc) - member s.SignStream stream = - match s with + member _.SignStream stream = + match data with | KeyPair (kp, false) -> signerSignStreamWithKeyPair stream kp | KeyContainer (kc, false) -> signerSignStreamWithKeyContainer stream kc | _ -> () From a45a07cd63dd93c6d6bc5ec0aaa0fad8b697cfc2 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 04:30:52 +0200 Subject: [PATCH 26/28] Update ilsign.fsi --- src/Compiler/AbstractIL/ilsign.fsi | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Compiler/AbstractIL/ilsign.fsi b/src/Compiler/AbstractIL/ilsign.fsi index 630662ca6c2..badd1e4a6cc 100644 --- a/src/Compiler/AbstractIL/ilsign.fsi +++ b/src/Compiler/AbstractIL/ilsign.fsi @@ -12,15 +12,11 @@ open System.IO //--------------------------------------------------------------------- // Strong name signing //--------------------------------------------------------------------- -[] +[] type ILStrongNameSigner = - | PublicKeySigner of byte array - | PublicKeyOptionsSigner of (byte array * bool) - | KeyPair of (byte array * bool) - | KeyContainer of (string * bool) - static member OpenPublicKeyOptions: byte array * bool -> ILStrongNameSigner + static member OpenPublicKeyOptions: byte array * bool -> ILStrongNameSigner static member OpenPublicKey: byte array -> ILStrongNameSigner - static member OpenKeyPairFile: byte array * ?usePublicSign: bool -> ILStrongNameSigner + static member OpenKeyPairFile: byte array * ?usePublicSign: bool -> ILStrongNameSigner static member OpenKeyContainer: string * ?usePublicSign: bool -> ILStrongNameSigner static member ExtractPublicKey: byte array -> byte array member IsFullySigned: bool From 4cfbae485015cced99e2f254d7b7546e0af755c3 Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 04:30:56 +0200 Subject: [PATCH 27/28] Update CreateILModule.fs --- src/Compiler/Driver/CreateILModule.fs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Compiler/Driver/CreateILModule.fs b/src/Compiler/Driver/CreateILModule.fs index 3730aef9c87..c4d28331931 100644 --- a/src/Compiler/Driver/CreateILModule.fs +++ b/src/Compiler/Driver/CreateILModule.fs @@ -138,16 +138,15 @@ let GetStrongNameSigner signingInfo = let (StrongNameSigningInfo(delaysign, publicsign, signer, container)) = signingInfo match container with | Some container -> - Some(ILStrongNameSigner.OpenKeyContainer (container, publicsign)) + Some(ILStrongNameSigner.OpenKeyContainer (container, publicsign || delaysign)) | None -> match signer with | None -> None | Some bytes -> if publicsign || delaysign then - let publicKey = ILStrongNameSigner.ExtractPublicKey bytes - Some(ILStrongNameSigner.OpenPublicKeyOptions(publicKey, publicsign)) + Some(ILStrongNameSigner.OpenKeyPairFile(bytes, usePublicSign=true)) else - Some(ILStrongNameSigner.OpenKeyPairFile(bytes, publicsign)) + Some(ILStrongNameSigner.OpenKeyPairFile(bytes, usePublicSign=false)) //---------------------------------------------------------------------------- // Building the contents of the finalized IL module From 1d8dadbd61e7c04a4e8b6b78f7fe953d2ec77e9b Mon Sep 17 00:00:00 2001 From: Ahmed Walid Date: Fri, 23 Jan 2026 04:51:40 +0200 Subject: [PATCH 28/28] Update ilsign.fsi