Skip to content

Commit

Permalink
chore(cli): Replace BouncyCastle with built-in libs
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-buse committed May 8, 2024
1 parent ce7a7b5 commit 3bb58fb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 166 deletions.
129 changes: 0 additions & 129 deletions src/KubeOps.Cli/Certificates/CertificateGenerator.cs

This file was deleted.

22 changes: 0 additions & 22 deletions src/KubeOps.Cli/Certificates/Extensions.cs

This file was deleted.

18 changes: 6 additions & 12 deletions src/KubeOps.Cli/Generators/CertificateGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
using KubeOps.Cli.Certificates;
using KubeOps.Cli.Output;
using KubeOps.Operator.Web.Certificates;

namespace KubeOps.Cli.Generators;

internal class CertificateGenerator(string serverName, string namespaceName) : IConfigGenerator
{
public void Generate(ResultOutput output)
{
var (caCert, caKey) = Certificates.CertificateGenerator.CreateCaCertificate();
using Operator.Web.CertificateGenerator generator = new(serverName, namespaceName);

output.Add("ca.pem", caCert.ToPem(), OutputFormat.Plain);
output.Add("ca-key.pem", caKey.ToPem(), OutputFormat.Plain);

var (srvCert, srvKey) = Certificates.CertificateGenerator.CreateServerCertificate(
(caCert, caKey),
serverName,
namespaceName);

output.Add("svc.pem", srvCert.ToPem(), OutputFormat.Plain);
output.Add("svc-key.pem", srvKey.ToPem(), OutputFormat.Plain);
output.Add("ca.pem", generator.Root.Certificate.EncodeToPem(), OutputFormat.Plain);
output.Add("ca-key.pem", generator.Root.Key.EncodeToPem(), OutputFormat.Plain);
output.Add("svc.pem", generator.Server.Certificate.EncodeToPem(), OutputFormat.Plain);
output.Add("svc-key.pem", generator.Server.Key.EncodeToPem(), OutputFormat.Plain);
}
}
5 changes: 2 additions & 3 deletions src/KubeOps.Cli/KubeOps.Cli.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -18,7 +18,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.7.1" />
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
Expand All @@ -34,7 +33,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\KubeOps.Abstractions\KubeOps.Abstractions.csproj"/>
<ProjectReference Include="..\KubeOps.Abstractions\KubeOps.Abstractions.csproj" />
<ProjectReference Include="..\KubeOps.Operator.Web\KubeOps.Operator.Web.csproj" />
<ProjectReference Include="..\KubeOps.Transpiler\KubeOps.Transpiler.csproj" />
</ItemGroup>
Expand Down

0 comments on commit 3bb58fb

Please sign in to comment.