DotNet Reference

.Net Reference

Program.cs
Go to the documentation of this file.
1 // Copyright 2010-2020 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 using System;
15 using System.IO;
16 using System.Security.Cryptography;
17 
19 {
20 class Program
21 {
22  static void Main(string[] args)
23  {
24  if (args == null || args.Length == 0)
25  {
26  Console.WriteLine("Key filename not specified.");
27  return;
28  }
29  string path = Directory.GetCurrentDirectory() + args[0];
30  Console.WriteLine("Key filename:" + path);
31  if (Console.Out != null)
32  Console.Out.Flush();
33  File.WriteAllBytes(path, GenerateStrongNameKeyPair());
34  }
35 
36  public static byte[] GenerateStrongNameKeyPair()
37  {
38  using (var provider = new RSACryptoServiceProvider(4096))
39  {
40  return provider.ExportCspBlob(!provider.PublicOnly);
41  }
42  }
43 }
44 }
Definition: Program.cs:19
using System
Definition: Program.cs:14
Definition: Program.cs:21
static byte[] GenerateStrongNameKeyPair()
Definition: Program.cs:36