Skip to content
Snippets Groups Projects
Commit 8182e078 authored by Klaus Fischer's avatar Klaus Fischer
Browse files

Merge branch 'issue/nuget-dependencies' into feature/1731-big-files-encryption

parents 0164b630 fbf43867
No related branches found
No related tags found
1 merge request!112Draft: Feature/1731 big files encryption
Showing
with 96 additions and 41 deletions
......@@ -14,18 +14,27 @@ reuse:
variables:
DOCKER_REGISTRY_READ: $DOCKER_PULL_REGISTRY
build:
build SDK:
stage: build
image: mcr.microsoft.com/dotnet/sdk:6.0
script:
- cp $CREDENTIALS ./Tests/MockContainer/credentials.json
- dotnet build FitConnect
nuget-pack:
build KeyManagement:
stage: build
image: mcr.microsoft.com/dotnet/sdk:6.0
script:
- cp $CREDENTIALS ./Tests/MockContainer/credentials.json
- dotnet build FitConnect
nuget-pack SDK:
only:
- tags
stage: nuget-pack
image: mcr.microsoft.com/dotnet/sdk:6.0
needs:
- build SDK
artifacts:
paths:
- ./artifacts
......@@ -42,6 +51,28 @@ nuget-pack:
- dotnet pack FitConnect -c Release -o ./artifacts
- dotnet nuget push ./artifacts/FitConnect.$CI_COMMIT_TAG.nupkg --api-key $NUGET_API_KEY -s https://api.nuget.org/v3/index.json
nuget-pack KeyManagement:
only:
- tags
stage: nuget-pack
image: mcr.microsoft.com/dotnet/sdk:6.0
needs:
- build KeyManagement
artifacts:
paths:
- ./artifacts
expire_in: 30 days
script:
- GIT_COMMIT_ID=$CI_COMMIT_SHORT_SHA
- sed -i -e "s|<PackageVersion>.*</PackageVersion>|<PackageVersion>$CI_COMMIT_TAG</PackageVersion>|" KeyManagement/KeyManagement.csproj
- FILE_VERSION=$(echo "$CI_COMMIT_TAG" | sed 's/\-.*//')
- sed -i -e "s|<AssemblyVersion>.*</AssemblyVersion>|<AssemblyVersion>$FILE_VERSION</AssemblyVersion>|" KeyManagement/KeyManagement.csproj
- sed -i -e "s|<FileVersion>.*</FileVersion>|<FileVersion>$FILE_VERSION</FileVersion>|" KeyManagement/KeyManagement.csproj
- sed -i -e "s|public const string PackageVersion = \".*\";|public const string PackageVersion = \"$CI_COMMIT_TAG\";|" KeyManagement/KeyManagement.csproj
- sed -i -e "s|public const string CommitId = \".*\";|public const string CommitId = \"$CI_COMMIT_SHORT_SHA\";|" KeyManagement/KeyManagement.csproj
- dotnet pack KeyManagement -c Release -o ./artifacts
- dotnet nuget push ./artifacts/FitConnect.KeyManagement.$CI_COMMIT_TAG.nupkg --api-key $NUGET_API_KEY -s https://api.nuget.org/v3/index.json
test:
stage: test
image: mcr.microsoft.com/dotnet/sdk:6.0
......
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Files: FitConnect/* Tests/* Examples/* JwkGenerator/*
Files: FitConnect/* Tests/* Examples/* KeyManagement/*
FitConnect.sln test.Dockerfile Test.pdf version.sh FitConnect.sln.DotSettings
README.md CHANGELOG.md *.md Dockerfile nuget_upload.sh ConsoleAppExample/* global.json
DummyServerForHeaderTests/* clean_repo.sh docker-compose.yml
......
......@@ -22,7 +22,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests\DummyServerForHeaderT
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ValidationTests", "Tests\ValidationTests\ValidationTests.csproj", "{DDEFDA59-FD75-4F25-9BA2-8DAE22B4A0B0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JwkGenerator", "JwkGenerator\JwkGenerator.csproj", "{D872CF15-8E00-4DD5-AB22-3DEA783F251F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeyManagement", "KeyManagement\KeyManagement.csproj", "{D872CF15-8E00-4DD5-AB22-3DEA783F251F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......
......@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<AssemblyVersion>0.0.0</AssemblyVersion>
<FileVersion>0.0.0</FileVersion>
<PackageVersion>1.1.0-rc.0</PackageVersion>
<PackageVersion>0.0.0</PackageVersion>
<Title>FIT-Connect .NET SDK</Title>
<Description>Library for sending and receiving submissions via FIT-Connect</Description>
<Copyright>2022 FIT-Connect contributors</Copyright>
......@@ -87,7 +87,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\JwkGenerator\JwkGenerator.csproj" />
<ProjectReference Include="..\KeyManagement\KeyManagement.csproj" />
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
......
......@@ -80,7 +80,7 @@ public class SendableReply : Submission, ISendableSubmission {
PaymentInformation = receivedSubmission.PaymentInformation;
}
public JwkGenerator.JsonWebKey PublicKey { get; internal set; }
public KeyManagement.JsonWebKey PublicKey { get; internal set; }
public static SendableReplyBuilder From(IReceivedSubmission receivedSubmission) {
......
......@@ -8,6 +8,7 @@ using FitConnect.Models;
using FitConnect.Models.Api.Metadata;
using FitConnect.Models.Api.Set;
using FitConnect.Models.v1.Api;
using FitConnect.Services.Models.v1.Routes;
using FitConnect.Services.Models.v1.Submission;
using FitConnect.Validation;
using Microsoft.Extensions.Logging;
......@@ -15,6 +16,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using NJsonSchema.Validation;
using Metadata = FitConnect.Models.Metadata;
using SubmissionSchema = FitConnect.Models.Api.Metadata.SubmissionSchema;
namespace FitConnect;
......@@ -234,7 +236,7 @@ public class Sender : FitConnectClient, ISender {
}
}
public async Task<SentSubmission> SendReplyAsync(SendableReply replySubmission, JwkGenerator.JsonWebKey publicKey) {
public async Task<SentSubmission> SendReplyAsync(SendableReply replySubmission, KeyManagement.JsonWebKey publicKey) {
return await SendAsync(replySubmission, true, publicKey);
}
......@@ -259,7 +261,7 @@ public class Sender : FitConnectClient, ISender {
private async Task<Submission>
FinishSubmissionTransmission(Submission submission, JwkGenerator.JsonWebKey? publicKey) {
FinishSubmissionTransmission(Submission submission, KeyManagement.JsonWebKey? publicKey) {
if (submission == null) {
Logger?.LogCritical("Submission is null on submit");
throw new InvalidOperationException("Submission is not ready");
......@@ -311,7 +313,7 @@ public class Sender : FitConnectClient, ISender {
private async Task<SentSubmission> SendAsync(SendableSubmission submission,
bool isReply,
JwkGenerator.JsonWebKey? publicKey) {
FitConnect.KeyManagement.JsonWebKey? publicKey) {
try {
await SubmissionSenderGuards(submission, submission.DataMimeType, isReply);
if (!SkipSubmissionDataValidation && !environment.ValidationSettings.SkipSubmissionDataValidation) {
......
......@@ -81,9 +81,9 @@ public class ReplyChannel {
/// <param name="processStandards"></param>
/// <returns></returns>
public static IReplyChannelType OfFitConnect(string publicKey, IEnumerable<string> processStandards)
=> new FitConnectReplyChannel(JwkGenerator.JsonWebKey.Deserialize(publicKey), processStandards);
=> new FitConnectReplyChannel(KeyManagement.JsonWebKey.Deserialize(publicKey), processStandards);
public static IReplyChannelType OfFitConnect(JwkGenerator.JsonWebKey publicKey,
public static IReplyChannelType OfFitConnect(KeyManagement.JsonWebKey publicKey,
IEnumerable<string> processStandards)
=> new FitConnectReplyChannel(publicKey, processStandards);
......@@ -116,7 +116,7 @@ public class ReplyChannel {
}
public class FitConnectReplyChannel : IReplyChannelType {
public FitConnectReplyChannel(JwkGenerator.JsonWebKey publicKey, IEnumerable<string> processStandards) {
public FitConnectReplyChannel(KeyManagement.JsonWebKey publicKey, IEnumerable<string> processStandards) {
PublicKey = publicKey;
ProcessStandards = processStandards;
}
......@@ -126,7 +126,7 @@ public class FitConnectReplyChannel : IReplyChannelType {
[JsonProperty("encryptionPublicKey")]
public JwkGenerator.JsonWebKey PublicKey { get; }
public KeyManagement.JsonWebKey PublicKey { get; }
}
/// <summary>
......
......@@ -495,7 +495,7 @@ public class Subscriber : FitConnectClient, IReceivedSubmission,
/// </summary>
/// <param name="caseId"></param>
/// <returns></returns>
private JwkGenerator.JsonWebKey? GetLastPublicKeyForCase(Guid caseId) {
private KeyManagement.JsonWebKey? GetLastPublicKeyForCase(Guid caseId) {
#warning Not implemented, yet - due to Server side implementation
return null;
}
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
namespace JwkGenerator;
namespace FitConnect.KeyManagement;
public static class Base64UrlEncoder {
public static string Encode(byte[] data) {
......
using System.Security.Cryptography;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace JwkGenerator;
namespace FitConnect.KeyManagement;
public class JwkGenerator {
public class Generator {
public void ExportKeys(JsonWebKey privateKey, JsonWebKey publicKey) {
var privateKeyJson = privateKey.ToJson();
var publicKeyJson = publicKey.ToJson();
......
......@@ -3,7 +3,7 @@ using System.Text.Json.Serialization;
using Newtonsoft.Json;
using JsonSerializer = System.Text.Json.JsonSerializer;
namespace JwkGenerator;
namespace FitConnect.KeyManagement;
public class JsonWebKey {
public string? Kty { get; set; }
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>FitConnect.KeyManagement</AssemblyName>
<RootNamespace>FitConnect.KeyManagement</RootNamespace>
<Title>FIT-Connect Key Management</Title>
<AssemblyVersion>0.0.0</AssemblyVersion>
<FileVersion>0.0.0</FileVersion>
<PackageVersion>0.0.0</PackageVersion>
<Description>Library for JWK Management for FIT-Connect .NET SDK</Description>
<Copyright>2022 FIT-Connect contributors</Copyright>
<PackageProjectUrl>https://docs.fitko.de/fit-connect/</PackageProjectUrl>
<Authors>Föderale IT-Kooperation (FITKO)</Authors>
<PackageLicense>https://git.fitko.de/fit-connect/sdk-dotnet/-/blob/main/LICENSE.txt</PackageLicense>
<RepositoryUrl>https://git.fitko.de/fit-connect/sdk-dotnet</RepositoryUrl>
<RepositoryType>GIT</RepositoryType>
<PackageTags>egovernment, ozg, fitconnect</PackageTags>
<PackageReleaseNotes>Initial Release</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>
<ItemGroup>
<None Include="icon.png" Pack="true" Visible="false" PackagePath=""/>
<None Include="README.md" Pack="true" Visible="false" PackagePath=""/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
namespace JwkGenerator;
namespace FitConnect.KeyManagement;
public class Program {
public static void Main(string[] args) {
var generator = new JwkGenerator();
var generator = new Generator();
var (privateKey, publicKey) = generator.CreateKeys();
Console.WriteLine("JWK wurde erfolgreich generiert und gespeichert.");
generator.ExportKeys(privateKey, publicKey);
}
}
\ No newline at end of file
}
# FIT-Connect KeyManagement
This package is used by the FIT-Connect .NET SDK to generate JWK for internal use
\ No newline at end of file
KeyManagement/icon.png

7.75 KiB

......@@ -4,12 +4,12 @@ using System.Text;
using FitConnect;
using FitConnect.Exceptions;
using FitConnect.Interfaces.Subscriber;
using FitConnect.KeyManagement;
using FitConnect.Models;
using FitConnect.Models.Api.Metadata;
using FitConnect.Models.Api.Set;
using FitConnect.Models.v1.Api;
using FluentAssertions;
using JwkGenerator;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
......@@ -79,7 +79,7 @@ public class ReplyChannelTest : EndToEndTestBase {
[Order(5)]
[Test]
public void T005_GenerateJwkPair() {
(GeneratedPrivateKey, GeneratedPublicKey) = new JwkGenerator.JwkGenerator().CreateKeys();
(GeneratedPrivateKey, GeneratedPublicKey) = new Generator().CreateKeys();
}
[Order(10)]
......
......@@ -5,7 +5,7 @@ All notable changes to the FIT-Connect .NET SDK will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/),
and this project adheres to [Semantic Versioning](https://semver.org/).
## [2.0.0] - 2024-02-20
## [2.0.1] - 2024-02-20
### Added
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment