What a strong-name signature actually proves
A PublicKeyToken in an assembly reference looks like a tamper seal and a publisher stamp, but it is neither. Here is exactly what Glass.NET reads out of the Assembly table and the #Blob heap to show you the public key, derive the 8-byte token, and tell a fully signed assembly from a delay-signed one — and why, on modern .NET, the signature is never checked at load.
You open an assembly in Glass.NET and the identity line reads MyLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a5b2c8d4e6f70819. It is easy to read that token as two guarantees at once: that the bytes have not been altered since the publisher built them, and that the publisher is who they claim to be. A strong name is neither of those things. It is an identity label with a cryptographic shape, and understanding exactly what it does — and does not — assert is a short tour through the Assembly table, the #Blob heap, and one SHA-1 hash.
The real question
Two different facts hide behind that one token. The first is derivation: where do those eight bytes come from, and what are they a fingerprint of? The second is enforcement: when the runtime loads this assembly, does anything actually check a signature against those bytes? Most of the confusion about strong names comes from assuming the answer to the second question is “yes, always.” On modern .NET it is “no, never.” Glass answers both questions from metadata alone, and it is careful not to overstate the second.
Where the token comes from
A strong-named assembly stores its full public key in the manifest. In ILDASM-style syntax the defining assembly looks like this:
.assembly MyLib
{
.publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00
00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 ... )
.hash algorithm 0x00008004
.ver 1:0:0:0
}
That .publickey blob is the real key — a SNK public-key structure that begins with a header and the ASCII tag RSA1. It lives in the #Blob heap and is pointed at by the PublicKey column of the single-row Assembly table. An assembly that references MyLib does not repeat the whole key; it stores only the 8-byte token:
.assembly extern MyLib
{
.publickeytoken = (A5 B2 C8 D4 E6 F7 08 19)
.ver 1:0:0:0
}
The token is a hash of the key, computed the same way everywhere:
using System.Security.Cryptography;
static string PublicKeyToken(byte[] fullPublicKey)
{
byte[] hash = SHA1.HashData(fullPublicKey); // 20 bytes
byte[] token = hash[^8..]; // last 8 bytes
Array.Reverse(token); // stored little-endian, shown reversed
return Convert.ToHexString(token).ToLowerInvariant();
}
Take the SHA-1 of the whole public-key blob, keep the final eight bytes, reverse them, and print as hex. That is the entire algorithm. It means the token is a truncated fingerprint: it pins an assembly to a public key compactly, so a reference can name the exact key a dependency must have been built with without carrying 160 bytes of RSA modulus around. When the runtime binds MyLib, it recomputes the token of the candidate’s public key and compares it to the one in the reference. That comparison is identity matching, nothing more.
What Glass reads, and what it refuses to claim
When you load an assembly, Glass reads the Assembly table row, pulls the PublicKey blob out of #Blob, and runs exactly the hash above to show you the token on the identity line — it does not trust the token a reference claims, it derives it from the key that is actually present. Expand the Assembly node and the full public key is there in the metadata view, tagged RSA1, with the AssemblyFlags value beside it so you can see the PublicKey bit (0x0001) that marks the blob as a real key rather than a token.
The part Glass is deliberately quiet about is verification. There is a second artifact in the PE that people conflate with the key: the strong-name signature, an RSA signature over a hash of the image, stored in a reserved region the CLI header’s StrongNameSignature data directory points at. Glass will show you that the region exists and how large it is. It will not tell you the signature is “valid” as if that were a trust verdict, because on the runtime most readers care about, the question never gets asked.
The thing a strong name does not prove
Two independent gaps, and Glass surfaces the evidence for both.
It does not prove who the publisher is. A strong-name key is self-generated — sn -k produces one in a second, with no certificate authority, no identity, and no revocation. Anyone can mint a key and strong-name an assembly with it. The token tells you two assemblies were signed with the same key; it tells you nothing about whose key that is. (Authenticode, which binds a signature to an X.509 certificate issued to a named organization, is the artifact that carries publisher identity — a separate signature Glass reports separately.)
On modern .NET, it does not prove integrity. .NET Framework verified the strong-name signature when loading an assembly from outside the GAC, though a full-trust host could disable even that via the strong-name bypass. .NET Core and .NET 5+ removed load-time verification entirely: the strong name is used only to compute identity and bind references. An attacker who strips the signature, edits the IL, and leaves the public key in place produces an assembly that still loads and still reports the original token — because nothing recomputes the signature. This is why Glass labels the token as identity and leaves integrity to Authenticode and your own file hashing.
Delay-signed assemblies look signed but are not
There is a third state worth recognising, and it is where most “is this signed?” confusion starts. A delay-signed assembly carries the real public key — so it has a token and reports a full identity — but its signature region is reserved and zeroed, to be filled in later by someone who holds the private key:
# Developer builds with the public key only; signature space is reserved
csc /delaysign+ /keyfile:public-only.snk MyLib.cs
# Later, the release gatekeeper completes it with the private key
sn -R MyLib.dll full-keypair.snk
Glass reads the StrongNameSignature directory, sees a non-empty public key paired with an all-zero signature blob, and reports the assembly as delay-signed rather than signed. That distinction matters: a delay-signed assembly on .NET Framework would fail verification (or need a skip-verification registration), while on modern .NET it loads fine precisely because nothing checks — a vivid demonstration that “has a token” and “has a verified signature” are unrelated facts.
Caveats
The token derivation is fixed at SHA-1 regardless of what you signed with; a 2048-bit RSA key and the newer ECMA-style keys both reduce to an 8-byte SHA-1 token, so the token’s collision resistance is not the key’s. Glass computes and compares tokens, it does not attempt to cryptographically verify the signature blob, because a “valid signature” result would imply a load-time guarantee that modern runtimes do not provide and would be misleading to print. And a token match during binding is only enforced when the referencing assembly actually recorded a token — a reference built against an unsigned MyLib records an empty PublicKeyToken, and Glass shows that empty identity rather than inventing one.
Takeaway
A strong-name public key token is a SHA-1 fingerprint of a self-generated public key, stored whole in the assembly that owns it and as eight bytes in everything that references it. It binds references to a key, which is a real and useful identity guarantee. It is not a publisher certificate and, on .NET Core and .NET 5+, it is not a tamper seal — the signature it implies is never checked at load. Glass.NET reads the key, derives the token honestly, distinguishes signed from delay-signed, and stops exactly where the metadata’s guarantees stop, so you read the identity for what it is and look to Authenticode and your own hashing for the integrity it was never meant to carry.
Try Nebula.NET
Harden your .NET code in minutes — start with the free edition.