Skip to content

Commit 3bb58fb

Browse files
committed
chore(cli): Replace BouncyCastle with built-in libs
1 parent ce7a7b5 commit 3bb58fb

File tree

4 files changed

+8
-166
lines changed

4 files changed

+8
-166
lines changed

src/KubeOps.Cli/Certificates/CertificateGenerator.cs

Lines changed: 0 additions & 129 deletions
This file was deleted.

src/KubeOps.Cli/Certificates/Extensions.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
using KubeOps.Cli.Certificates;
21
using KubeOps.Cli.Output;
2+
using KubeOps.Operator.Web.Certificates;
33

44
namespace KubeOps.Cli.Generators;
55

66
internal class CertificateGenerator(string serverName, string namespaceName) : IConfigGenerator
77
{
88
public void Generate(ResultOutput output)
99
{
10-
var (caCert, caKey) = Certificates.CertificateGenerator.CreateCaCertificate();
10+
using Operator.Web.CertificateGenerator generator = new(serverName, namespaceName);
1111

12-
output.Add("ca.pem", caCert.ToPem(), OutputFormat.Plain);
13-
output.Add("ca-key.pem", caKey.ToPem(), OutputFormat.Plain);
14-
15-
var (srvCert, srvKey) = Certificates.CertificateGenerator.CreateServerCertificate(
16-
(caCert, caKey),
17-
serverName,
18-
namespaceName);
19-
20-
output.Add("svc.pem", srvCert.ToPem(), OutputFormat.Plain);
21-
output.Add("svc-key.pem", srvKey.ToPem(), OutputFormat.Plain);
12+
output.Add("ca.pem", generator.Root.Certificate.EncodeToPem(), OutputFormat.Plain);
13+
output.Add("ca-key.pem", generator.Root.Key.EncodeToPem(), OutputFormat.Plain);
14+
output.Add("svc.pem", generator.Server.Certificate.EncodeToPem(), OutputFormat.Plain);
15+
output.Add("svc-key.pem", generator.Server.Key.EncodeToPem(), OutputFormat.Plain);
2216
}
2317
}

src/KubeOps.Cli/KubeOps.Cli.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -18,7 +18,6 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />
2221
<PackageReference Include="Microsoft.Build.Locator" Version="1.7.1" />
2322
<PackageReference Include="Microsoft.CodeAnalysis" Version="4.8.0" />
2423
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.8.0" />
@@ -34,7 +33,7 @@
3433
</ItemGroup>
3534

3635
<ItemGroup>
37-
<ProjectReference Include="..\KubeOps.Abstractions\KubeOps.Abstractions.csproj"/>
36+
<ProjectReference Include="..\KubeOps.Abstractions\KubeOps.Abstractions.csproj" />
3837
<ProjectReference Include="..\KubeOps.Operator.Web\KubeOps.Operator.Web.csproj" />
3938
<ProjectReference Include="..\KubeOps.Transpiler\KubeOps.Transpiler.csproj" />
4039
</ItemGroup>

0 commit comments

Comments
 (0)