Skip to content

Commit 748478d

Browse files
committed
Initial Add
1 parent be05e3e commit 748478d

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

PfxToSnk.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26730.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PfxToSnk", "PfxToSnk\PfxToSnk.csproj", "{F246F0A8-CA45-4B36-BEDD-C74B0BB19819}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F246F0A8-CA45-4B36-BEDD-C74B0BB19819}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F246F0A8-CA45-4B36-BEDD-C74B0BB19819}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F246F0A8-CA45-4B36-BEDD-C74B0BB19819}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F246F0A8-CA45-4B36-BEDD-C74B0BB19819}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {46B7DB07-F618-4C84-A1CA-A7303BEF9513}
24+
EndGlobalSection
25+
EndGlobal

PfxToSnk/PfxToSnk.csproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>

PfxToSnk/Program.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.IO;
3+
using System.Security.Cryptography;
4+
using System.Security.Cryptography.X509Certificates;
5+
6+
namespace PfxToSnk
7+
{
8+
class Program
9+
{
10+
static void Main(string[] args)
11+
{
12+
try
13+
{
14+
var certificate = new X509Certificate2(args[0], args[2], X509KeyStorageFlags.Exportable);
15+
var privateKey = (RSACryptoServiceProvider)certificate.PrivateKey;
16+
File.WriteAllBytes(args[1], privateKey.ExportCspBlob(true));
17+
}
18+
catch
19+
{
20+
PrintUsage();
21+
}
22+
}
23+
24+
static void PrintUsage()
25+
{
26+
Console.WriteLine("\nUsage: PfxToSnk input.pfx output.snk password \n\n");
27+
}
28+
}
29+
}

0 commit comments

Comments
 (0)