Skip to content

Commit

Permalink
Add strong name signing for Consul assembly
Browse files Browse the repository at this point in the history
Fixes hashicorp#10 by adding a strong name signing key.

The new strong name is:

Consul, Version=0.5.2.8, Culture=neutral, PublicKeyToken=20a6ad9a81df1d95
  • Loading branch information
Tiru Srikantha committed Jul 20, 2015
1 parent 68adf1e commit eb58588
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Consul.Test/AgentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ public void Agent_Services()
var reg = new AgentServiceRegistration()
{
Name = "foo",
Tags = new[] {"bar", "baz"},
Tags = new[] { "bar", "baz" },
Port = 8000,
Check = new AgentServiceCheck
{
TTL = TimeSpan.FromSeconds(15)
}
};

c.Agent.ServiceRegister(reg);

var services = c.Agent.Services();
Expand All @@ -81,7 +82,7 @@ public void Agent_Services_CheckPassing()
var reg = new AgentServiceRegistration()
{
Name = "foo",
Tags = new[] {"bar", "baz"},
Tags = new[] { "bar", "baz" },
Port = 8000,
Check = new AgentServiceCheck
{
Expand Down Expand Up @@ -145,7 +146,7 @@ public void Agent_Services_MultipleChecks()
var reg = new AgentServiceRegistration()
{
Name = "foo",
Tags = new[] {"bar", "baz"},
Tags = new[] { "bar", "baz" },
Port = 8000,
Checks = new[]
{
Expand Down
25 changes: 25 additions & 0 deletions Consul.Test/AssemblyTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Reflection;
using System.Diagnostics;

namespace Consul.Test
{
/// <summary>
/// Summary description for AssemblyTest
/// </summary>
[TestClass]
public class AssemblyTest
{
[TestMethod]
public void Assembly_IsStrongNamed()
{
Type t = typeof(Consul.Client);
string s = t.Assembly.FullName.ToString();
Trace.WriteLine(s);
Assert.IsTrue(t.Assembly.FullName.Contains("PublicKeyToken"));
}
}
}
7 changes: 7 additions & 0 deletions Consul.Test/Consul.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\assets\consuldotnet.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Expand All @@ -56,6 +62,7 @@
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="AssemblyTest.cs" />
<Compile Include="ClientTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StatusTest.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Consul.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Consul", "Consul\Consul.csproj", "{1EB4B74D-0BAC-4D14-872E-00CF455CCD53}"
EndProject
Expand Down
6 changes: 6 additions & 0 deletions Consul/Consul.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\assets\consuldotnet.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
7 changes: 6 additions & 1 deletion Consul/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.2.8")]
[assembly: AssemblyFileVersion("0.5.2.8")]
[assembly: InternalsVisibleTo("Consul.Test")]
[assembly: InternalsVisibleTo("Consul.Test,PublicKey=" +
"002400000480000094000000060200000024000052534131000400000100010045f6337bf03a95" +
"218f1e0b4e70bb91f8ee49fcb58593d78c1008ee646cfcf785ea60bd0b1dde6f5f92ead738e2bd" +
"7f31ee9c209bbedbe1fd0cc5ee2ea60e73099044d2fa7ba1e8f0971fae411f42c6e8fab787d39a" +
"b8229ab857724c976ce23680bc94dc7b1e063042580e4e9f72792f953b3c62b80c4c406d8b4d27" +
"9d5f14ca")]
Binary file added assets/consuldotnet.snk
Binary file not shown.

0 comments on commit eb58588

Please sign in to comment.