HighTechTalks DotNet Forums  

inconsistency in public key values generated by compiler and SN.exe

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss inconsistency in public key values generated by compiler and SN.exe in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Dan
 
Posts: n/a

Default inconsistency in public key values generated by compiler and SN.exe - 01-15-2004 , 04:21 AM






Hi all

I found some inconsistency in the presentation of the public key, need your
clarification...

1) I generated a public/private keypair using SN. Then I use the following
command to see the generated public key in text form:

SN -tp mycompany.key

the result is:

Microsoft (R) .NET Framework Strong Name Utility Version 1.1.4322.573
Copyright (C) Microsoft Corporation 1998-2002. All rights reserved.

Public key is
07020000002400005253413200040000010001005584eade28 88d7e139f8a8e4a832d2fccc5a
43
8452a8a017e98b778e98f07da40af843b704cb1bd9bd3eae36 24426cdf67d6754d2b6dc67f38
34
964a1c4285d2c4db599bb0b948caf3722b1ad5079c03a66947 310fb0e8f1949ddc23954e1777
17
61891974ebdf6037b1b640051a19c120f20d010eff6f8f37a3 4295fcbf40b799f70a3c2c9467
57
548dba2b581cb1260d87d758a4ac9c8a6c2e344f3f377fc6b0 74c2fe83b601a3e8f1712c7ced
9b
187aa5c037310188fe44bcce90397186f01d387b7d41006f1e 4774916738bd5b08bf52d150c8
8c
3c8feb6b268a7ee8e06028fdf0ad876ccf001ba3d4b12382fe 2a65c3c27273536f7282d4f638
17
020bc3d9d2b75151dc780c6a805eab52f107f86eadf69d1964 7399c6b09564cb2bc1b3cffd7f
6a
931bb8de4e95ff21e4e62404c475fbedd388c109fc542a3307 520b3d61c0ed99d3dbb70c4af5
bb
6d656c81e9e701c5f8fb4d039e41327b8ec21fed9972a8f9bb cbc0d33b07744249f11201798f
7d
495cdb520ff72ba93f0a1b854199f7bfebdeb00dc0e8d94a4d 255dbd9b64448dc0a35e4f4141
8f
9cbdbf7219482b9faea5d29f3252fe65aef3313dd9d7e7ac07 6b2691bb77ac17edc79875e227
2a
c16f1697fe337c58ac470846c127ea8aee0a0c4cc4f70cfd43 9831019cbf370310c7404373e4
d5
8dbdbecda9d7719b9c46d22eff46bfc7e50ac0aba77a89fe6f c620e3b8adbbf0c714a7c8d20e
0c
5b353f9db7794be8d6579eebb030eb7335e1ef452c1cede027 15aa4aad823d349d1618a37117
35
5fe7ba39aa49ac3ff89a63

Public key token is 1c1dd0229ca70b43

2) I use this keypair file (MyCompany.key) to generated a strongly name
assembly called MyTypes.dll. When I open the dll file using ILDASM, I found
the following definition in the Manifest section:

..assembly MyTypes
{
.custom instance void
[mscorlib]System.Reflection.AssemblyKeyFileAttribute::.ctor( string) = ( 01
00 0E 4D 79 43 6F 6D 70 61 6E 79 2E 6B 65 79 // ...MyCompany.key

73 00 00 ) // s..
// --- The following custom attribute is added automatically, do not
uncomment -------
// .custom instance void
[mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(bool ,
//
bool) = ( 01 00 00 01 00 00 )
.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 //
..$..RSA1........
55 84 EA DE 28 88 D7 E1 39 F8 A8 E4 A8 32 D2 FC //
U...(...9....2..
CC 5A 43 84 52 A8 A0 17 E9 8B 77 8E 98 F0 7D A4 //
..ZC.R.....w...}.
0A F8 43 B7 04 CB 1B D9 BD 3E AE 36 24 42 6C DF //
...C......>.6$Bl.
67 D6 75 4D 2B 6D C6 7F 38 34 96 4A 1C 42 85 D2 //
g.uM+m..84.J.B..
C4 DB 59 9B B0 B9 48 CA F3 72 2B 1A D5 07 9C 03 //
...Y...H..r+.....
A6 69 47 31 0F B0 E8 F1 94 9D DC 23 95 4E 17 77 //
..iG1.......#.N.w
17 61 89 19 74 EB DF 60 37 B1 B6 40 05 1A 19 C1 //
..a..t..`7..@....
20 F2 0D 01 0E FF 6F 8F 37 A3 42 95 FC BF 40 B7 ) //
......o.7.B...@.
.hash algorithm 0x00008004
.ver 1:0:0:0
}

3) I tried to compare the two public key values, they are not the same, is
there some form of translation being done here? or the SN.exe is displaying
the wrong values?

4) Then I consume the above strong named assembly in a test EXE. after I
have compile the EXE with reference to MyTypes.dll, again I found
inconsistency in the public key token specified in the EXE's Manifest, as
follow:

..assembly extern MyTypes
{
.publickeytoken = (36 18 63 1E 9B 74 BD 45 ) //
6.c..t.E
.ver 1:1:0:0
}

As suggested by SN.exe earlier, the public key token should be:

1c1dd0229ca70b43

Again, is there any translation done because the tokens are not the same or
anything wrong with the public key token generated by SN.exe?

hope to hear from you, thanks
dan



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.